Logging breakpoints to trace file
Moderators: simonsunnyboy, npomarede, thothy, Moderator Team
Logging breakpoints to trace file
Hi there guys,
Im getting my feet wet in Hatari tracing. I can use the regular trace options to write events to a log file, which is awesome. I wish to now further capture more information into the log file, by expanding its writes to the logfile with logging set breakpoints.
However, when I do `b pc=$addr :trace', the output is hit to console, and not to the trace logfile. The documentation is quite comprehensive, but so far I have not found a way to direct the logging of breakpoints towards the trace file.
Does anyone know if this is possible? And if it is, how to do this?
Would be much appreciated,
Kind regards
wietze spkr/smfx
Im getting my feet wet in Hatari tracing. I can use the regular trace options to write events to a log file, which is awesome. I wish to now further capture more information into the log file, by expanding its writes to the logfile with logging set breakpoints.
However, when I do `b pc=$addr :trace', the output is hit to console, and not to the trace logfile. The documentation is quite comprehensive, but so far I have not found a way to direct the logging of breakpoints towards the trace file.
Does anyone know if this is possible? And if it is, how to do this?
Would be much appreciated,
Kind regards
wietze spkr/smfx
Re: Logging breakpoints to trace file
I think I kind of sovled my situation. By using a configuration file that contains the trace and breakpoint configuration, I can start hatari, and direct the output from hatari towards a file; and it seems all logging is then accumulated into one file.
F.e.:
With trace.ini:
F.e.:
Code: Select all
./hatari --parse trace.ini >test.log 2>&1Code: Select all
trace video_vbl
b pc=$712 :trace
b pc=$718 :trace
Re: Logging breakpoints to trace file
One more question, can hatari monitor memory writes? I would like to know when an interrupt vector changes.
Re: Logging breakpoints to trace file
Hi
yes it's possible. You can set a breakpoint that compares the content of memory :
If VBL points to $e01234 and you want to monitor its change :
Code: Select all
b ($70).l ! $e01234Code: Select all
b ($70).l ! ($70).lNicolas
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Logging breakpoints to trace file
":trace" option just tells breakpoint not to invoke debugger, so that breakpoints can be used for tracing. I hadn't even considered that the breakpoint output itself should go to the trace file, because I've mainly used them either to check whether something happens at all (i.e. only little output), or to run debugger scripts with ":file" option, in which case breakpoints can output basically anything, and parts of that output would already go elsewhere [1].wietze wrote: ↑Tue Jul 26, 2022 6:59 am Im getting my feet wet in Hatari tracing. I can use the regular trace options to write events to a log file, which is awesome. I wish to now further capture more information into the log file, by expanding its writes to the logfile with logging set breakpoints.
However, when I do `b pc=$addr :trace', the output is hit to console, and not to the trace logfile. The documentation is quite comprehensive, but so far I have not found a way to direct the logging of breakpoints towards the trace file.
I.e. just redirecting whole Hatari output is probably the best option for breakpoint output. Note that if you want to see the output live, while it's being saved, you can use "tee" unix command.
(I'm not sure whether output redirection can be easily done on Windows though, so it could be a problem for users on Windows?)
[1] Hatari actually has currently 5 different outputs:
- Tracing, controlled by "--trace-file" and "--trace"
- Logging, controlled by "--log-file" and "--log-level"
- Debugger disasm/memdump/registers output, controlled by "logfile"
- xconout redirection [2] and Hatari command line help, hard-coded to stdout
- Rest of debugger (breakpoints etc) and rest of Hatari output, hard-coded to stderr
[2] included to "os_base" and "os_all" trace options for VT52 console, which can be enabled also without rest of tracing using "--conout 2" option.
Re: Logging breakpoints to trace file
Of course it can be easily done. E.g., ...Eero Tamminen wrote: ↑Thu Jul 28, 2022 10:46 am (I'm not sure whether output redirection can be easily done on Windows though
hatari.exe 2> log.txt
... to only redirect stderr and
hatari.exe > foo.txt 2>&1
... to redirect stdout and stderr.
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Logging breakpoints to trace file
Is that normal Windows terminal or does one need e.g. to install Cygwin / Bash?czietz wrote: ↑Thu Jul 28, 2022 3:39 pmOf course it can be easily done. E.g., ...Eero Tamminen wrote: ↑Thu Jul 28, 2022 10:46 am (I'm not sure whether output redirection can be easily done on Windows though
hatari.exe 2> log.txt
... to only redirect stderr and
hatari.exe > foo.txt 2>&1
... to redirect stdout and stderr.
Re: Logging breakpoints to trace file
Of course. Why are you so surprised?
https://docs.microsoft.com/en-US/troubl ... and-prompt
EDIT: But I forgot one important detail! I always use Hatari as a console application under Windows. (I don't like the way its delivered as a GUI application by default.) Therefore I have setup my own builds accordingly and official builds are modified with a hex editor: https://listengine.tuxfamily.org/lists. ... 00002.html.
EDIT2: But it also works the same with the default "GUI" setting for hatari.exe.
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Logging breakpoints to trace file
I was surprised because I haven't had to really use Windows for a long time, especially from console, and Windows terminal was DOS based for so long (in 90's), and really sucked because of that. They did that PowerShell thing around 2006, but I understood that to have its own (more object oriented) syntax. Nice to hear that unix conventions work nowadays on Windows too.
Even nicer would be if unix sockets and FIFOs would also work, so that Hatari remote control APIs could be used...
PS. At home I've never had Windows, but I do have a Windows laptop at work even now, to change Windows AD password (have had bad experience trying to do that from Linux), and to use some odd web thing now and then where corporate infra is too broken to support standards and Linux (e.g. some commercial web-based service requiring so old crypto that support for it is dropped from latest Fedora for security reasons). Switching between USB headsets in Microsoft Teams seems to work better under Windows than Linux, but I think that's a Teams issue, not Linux one.
Even nicer would be if unix sockets and FIFOs would also work, so that Hatari remote control APIs could be used...
PS. At home I've never had Windows, but I do have a Windows laptop at work even now, to change Windows AD password (have had bad experience trying to do that from Linux), and to use some odd web thing now and then where corporate infra is too broken to support standards and Linux (e.g. some commercial web-based service requiring so old crypto that support for it is dropped from latest Fedora for security reasons). Switching between USB headsets in Microsoft Teams seems to work better under Windows than Linux, but I think that's a Teams issue, not Linux one.

