Re: [hatari-devel] symbol names used in disassembly output (was: debugger suggestions)

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


Hi Toni,

On 26.4.2022 21.08, Toni Wilen wrote:
Toni (maintaining WinUAE) would need to add callback support to WinUAE disassembler for replacing addresses with corresponding symbol names.

Then after WinUAE disassembler has all the features provided by "ext" disassembler, we could drop the "ext" one.

UAE disassembler already supports optional symbols, it calls debugmem_get_symbol(<pc/any calculated effective address>) and if it returns string, it gets appended to disassembly.

Thanks, it seems to work fine with the attached test patch!  [1]


But what debugmem_get_segment() is for, and what branch_stack_push() and branch_stack_pop_*() in the code gen are used for?


Nicolas, any comments?


	- Eero

_dos_shrink:
00e5017e 2f2f 0008 move.l (a7,$0008) == $0000c8d8 [00012672],-(a7) [00000000] 00e50182 2f2f 0008 move.l (a7,$0008) == $0000c8d8 [00012672],-(a7) [00000000]
00e50186 4267                     clr.w -(a7) [0000]
00e50188 3f3c 004a                move.w #$004a,-(a7) [0000]
00e5018c 4eb9 00e4 f9bc           jsr $00e4f9bc _trap1
00e50192 4fef 000c                lea.l (a7,$000c) == $0000c8dc,a7
00e50196 4e75                     rts  == $00e66218

_dos_load_file:
00e50198 2f03                     move.l d3,-(a7) [00000000]
00e5019a 2f02                     move.l d2,-(a7) [00000000]
00e5019c 4267                     clr.w -(a7) [0000]
00e5019e 2f2f 000e move.l (a7,$000e) == $0000c8de [baf20001],-(a7) [00000000]
00e501a2 4eba fd1c                jsr (pc,$fd1c) == $00e4fec0 _dos_open
00e501a6 2400                     move.l d0,d2
00e501a8 5c8f                     addaq.l #$06,a7
00e501aa 6d1c                     blt.b #$1c == $00e501c8 (F)
00e501ac 3600                     move.w d0,d3
00e501ae 2f2f 0014 move.l (a7,$0014) == $0000c8e4 [00000000],-(a7) [00000000] 00e501b2 2f2f 0014 move.l (a7,$0014) == $0000c8e4 [00000000],-(a7) [00000000]
00e501b6 3f00                     move.w d0,-(a7) [0000]
00e501b8 4eba fd2e                jsr (pc,$fd2e) == $00e4fee8 _dos_read
00e501bc 2400                     move.l d0,d2
00e501be 3f03                     move.w d3,-(a7) [0000]
00e501c0 4eba fd14                jsr (pc,$fd14) == $00e4fed6 _dos_close
00e501c4 4fef 000c                lea.l (a7,$000c) == $0000c8dc,a7
00e501c8 2002                     move.l d2,d0
00e501ca 241f                     move.l (a7)+ [00e66218],d2
00e501cc 261f                     move.l (a7)+ [00e66218],d3
00e501ce 4e75                     rts  == $00e66218
From 64478f95053d856c39fe5700d1272bd655989457 Mon Sep 17 00:00:00 2001
From: Eero Tamminen <oak@xxxxxxxxxxxxxx>
Date: Sun, 22 May 2022 02:12:01 +0300
Subject: [PATCH] WIP: add debug symbols to WinUAE CPU core disassembly

---
 src/cpu/debugmem.h | 2 ++
 src/cpu/disasm.c   | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/cpu/debugmem.h b/src/cpu/debugmem.h
index 88f0e94a..da79a75f 100644
--- a/src/cpu/debugmem.h
+++ b/src/cpu/debugmem.h
@@ -5,6 +5,8 @@
 /* We use some #define / static inline to replace with 'empty' equivalent at compile time */
 /* and to avoid useless overhead at runtime */
 
+#include "symbols.h"  // use functions from here instead */
+
 #define	debugmem_trace	0
 
 static inline int debugmem_get_segment(uaecptr addr, bool *exact, bool *ext, TCHAR *out, TCHAR *name)
diff --git a/src/cpu/disasm.c b/src/cpu/disasm.c
index 3ebc8c00..0d6c2023 100644
--- a/src/cpu/disasm.c
+++ b/src/cpu/disasm.c
@@ -289,16 +289,17 @@ static void showea_val(TCHAR *buffer, uae_u16 opcode, uaecptr addr, int size)
 		}
 	}
 skip:
-#ifndef WINUAE_FOR_HATARI
 	for (int i = 0; i < size; i++) {
+#ifndef WINUAE_FOR_HATARI
 		TCHAR name[256];
 		if (debugmem_get_symbol(addr + i, name, sizeof(name) / sizeof(TCHAR))) {
+#else
+		const char *name;
+		if ((name = Symbols_GetByCpuAddress(addr + i, SYMTYPE_TEXT))) {
+#endif
 			_stprintf(buffer + _tcslen(buffer), _T(" %s"), name);
 		}
 	}
-#else
-	return;
-#endif
 }
 
 uaecptr ShowEA_disp(uaecptr *pcp, uaecptr base, TCHAR *buffer, const TCHAR *name, bool pcrel)
-- 
2.30.2



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