Re: [hatari-devel] A question about the debugger

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On perjantai 11 syyskuu 2015, Roger Burrows wrote:
> I'm trying to use the debugger to figure out a problem that occurs under
> EmuTOS.  I have an initialisation file with:
> --------------------
> symbols etos256us.sym
> trace cpu_symbols
> history cpu 2000
> --------------------
> 
> I'm using the following command (from a Windows command prompt) to run a
> recent 1.9.0 test version of Hatari under Windows 7 (64-bit):
> --------------------
> hatari_falcon.exe --debug-except bus,autostart --parse debugger.ini -s 4
> --tos etos256us.img --log-file debug.log --trace-file debug.trace
> --------------------
> 
> I expected the trace info to go into "debug.trace" but it just goes to a
> (separate) windows console instead.  What am I doing wrong?  How do I get
> *all* the trace & debugging info to go to a file that I can browse
> later?

"logfile" command in the debugger (script) can be used to
redirect register, memory and disassembly dumps to a file. [1]

Same applies to shown CPU symbols regardless of whether
they're shown as part of dissassembly dump or trace output.

I think this is a bug.  Attached patch will should use the trace
output file when symbols names are part of trace output.  But if
you don't want to build your own Hatari, just use "logfile" command.

(While doing this I noticed that DSP output doesn't respect
either debug nor trace log file setting.  That needs to be
looked at later on.)


	- Eero

[1] I.e. the output file for these can be changed at run-time,
unlike the destination for the normal trace output (--trace-file)
and Hatari log messages (--log-file).
diff -r 214fb9dad54f src/debug/debugcpu.c
--- a/src/debug/debugcpu.c	Sat Sep 12 00:30:07 2015 +0300
+++ b/src/debug/debugcpu.c	Sat Sep 12 01:12:34 2015 +0300
@@ -143,11 +143,11 @@
  * Check whether given address matches any CPU symbol and whether
  * there's profiling information available for it.  If yes, show it.
  */
-static void DebugCpu_ShowAddressInfo(Uint32 addr)
+static void DebugCpu_ShowAddressInfo(Uint32 addr, FILE *fp)
 {
 	const char *symbol = Symbols_GetByCpuAddress(addr);
 	if (symbol)
-		fprintf(debugOutput, "%s:\n", symbol);
+		fprintf(fp, "%s:\n", symbol);
 }
 
 /**
@@ -195,7 +195,7 @@
 	/* output a range */
 	for (insts = 0; insts < max_insts && disasm_addr < disasm_upper; insts++)
 	{
-		DebugCpu_ShowAddressInfo(disasm_addr);
+		DebugCpu_ShowAddressInfo(disasm_addr, debugOutput);
 		Disasm(debugOutput, (uaecptr)disasm_addr, &nextpc, 1);
 		disasm_addr = nextpc;
 	}
@@ -617,7 +617,7 @@
 	}
 	if (LOG_TRACE_LEVEL((TRACE_CPU_DISASM|TRACE_CPU_SYMBOLS)))
 	{
-		DebugCpu_ShowAddressInfo(M68000_GetPC());
+		DebugCpu_ShowAddressInfo(M68000_GetPC(), TraceFile);
 	}
 	if (nCpuActiveCBs)
 	{
diff -r 214fb9dad54f src/debug/debugdsp.c
--- a/src/debug/debugdsp.c	Sat Sep 12 00:30:07 2015 +0300
+++ b/src/debug/debugdsp.c	Sat Sep 12 01:12:34 2015 +0300
@@ -103,11 +103,11 @@
  * Check whether given address matches any DSP symbol and whether
  * there's profiling information available for it.  If yes, show it.
  */
-static void DebugDsp_ShowAddressInfo(Uint16 addr)
+static void DebugDsp_ShowAddressInfo(Uint16 addr, FILE *fp)
 {
 	const char *symbol = Symbols_GetByDspAddress(addr);
 	if (symbol)
-		fprintf(debugOutput, "%s:\n", symbol);
+		fprintf(fp, "%s:\n", symbol);
 }
 
 
@@ -171,7 +171,7 @@
 	}
 	printf("DSP disasm 0x%hx-0x%hx:\n", dsp_disasm_addr, dsp_disasm_upper);
 	while (dsp_disasm_addr < dsp_disasm_upper) {
-		DebugDsp_ShowAddressInfo(dsp_disasm_addr);
+		DebugDsp_ShowAddressInfo(dsp_disasm_addr, stderr);
 		dsp_disasm_addr = DSP_DisasmAddress(stderr, dsp_disasm_addr, dsp_disasm_addr);
 	}
 
@@ -479,7 +479,7 @@
 	}
 	if (LOG_TRACE_LEVEL((TRACE_DSP_DISASM|TRACE_DSP_SYMBOLS)))
 	{
-		DebugDsp_ShowAddressInfo(DSP_GetPC());
+		DebugDsp_ShowAddressInfo(DSP_GetPC(), TraceFile);
 	}
 	if (nDspActiveCBs)
 	{


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/