Page 1 of 1

Tracing 68000 disassembly to file

Posted: Sat Nov 30, 2019 6:27 pm
by chicane
I'm trying to use the debugger to get Hatari to trace the instructions executed by the 68000 into a file on the filesystem.

First, I'm starting Hatari with the following command line:

Code: Select all

hatari --trace-file lotus.trace


After this, I'm breaking into the debugger, enabling the disassembly trace and then continuing execution:

Code: Select all

> trace cpu_disasm
> cont


After this, the disassembly appears in the console window from which Hatari was started, but the trace file I've specified just contains "cpu video_cyc" notifications and nothing else:

Code: Select all

video_cyc=159776  32@312 : cpu video_cyc=159798  54@312 : cpu video_cyc=159806  62@312 : cpu video_cyc=159830  86@312 :
cpu video_cyc=159840  96@312 : cpu video_cyc=159862 118@312 : cpu video_cyc=159870 126@312 : cpu video_cyc=159894 150@312 :
cpu video_cyc=159904 160@312 : cpu video_cyc=159926 182@312 : cpu video_cyc=159934 190@312 : cpu video_cyc=159958 214@312 :


I've taken a look at the Hatari source (src/cpu/newcpu.c) which, at first glance, would seem to align with what's happening:

Code: Select all

LOG_TRACE_PRINT ( "cpu video_cyc=%6d %3d@%3d : " , FrameCycles, LineCycles, HblCounterVideo );
m68k_disasm_file(stderr, m68k_getpc (), NULL, m68k_getpc (), 1);


It looks like the "cpu video_cyc" notification is being sent to the trace file, but the instruction disassembly just goes to stderr. I could obviously work around this (e.g. by redirecting stderr) but I'd like to take advantage of the file redirection functionality if I can get it to work.

I have a feeling I may have misunderstood something somewhere along the line. Can anybody shed any light on this please? This is Hatari 2.1.0 on Ubuntu if it's of any significance.

Thanks.

Re: Tracing 68000 disassembly to file

Posted: Sun Dec 01, 2019 11:39 pm
by Eero Tamminen
Seems to be broken also in latest Hatari sources.

On Linux, you can fix it with this one-liner:

Code: Select all

sed -i 's/m68k_disasm_file(stderr,/m68k_disasm_file(TraceFile,/' src/cpu/newcpu.c


And recompile. I'll look into getting that fixed for next release.

Re: Tracing 68000 disassembly to file

Posted: Mon Dec 02, 2019 9:41 am
by chicane
Thanks very much for your response Eero. I'll patch and recompile until there's an official fix.

Re: Tracing 68000 disassembly to file

Posted: Mon Dec 02, 2019 8:14 pm
by Eero Tamminen
I commited above change as the fix, after an ACK from Nicolas.

Re: Tracing 68000 disassembly to file

Posted: Thu Dec 12, 2019 2:59 pm
by chicane
Fantastic, many thanks Eero.