Tracing 68000 disassembly to file

A forum about the Hatari ST/STE/Falcon emulator - the current version is v2.2.1

Moderators: simonsunnyboy, thothy, Moderator Team

Post Reply
chicane
Atari maniac
Atari maniac
Posts: 90
Joined: Mon Jul 02, 2012 11:25 am
Location: Leeds, UK

Tracing 68000 disassembly to file

Post 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.
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2189
Joined: Sun Jul 31, 2011 1:11 pm

Re: Tracing 68000 disassembly to file

Post 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.
chicane
Atari maniac
Atari maniac
Posts: 90
Joined: Mon Jul 02, 2012 11:25 am
Location: Leeds, UK

Re: Tracing 68000 disassembly to file

Post by chicane »

Thanks very much for your response Eero. I'll patch and recompile until there's an official fix.
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2189
Joined: Sun Jul 31, 2011 1:11 pm

Re: Tracing 68000 disassembly to file

Post by Eero Tamminen »

I commited above change as the fix, after an ACK from Nicolas.
chicane
Atari maniac
Atari maniac
Posts: 90
Joined: Mon Jul 02, 2012 11:25 am
Location: Leeds, UK

Re: Tracing 68000 disassembly to file

Post by chicane »

Fantastic, many thanks Eero.
Post Reply

Return to “Hatari”