From a4bb1a815a4d7ab58ebc3a0cc418532b86285dec Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Sat, 7 Jan 2023 10:45:10 -0800 Subject: [PATCH] debugger: show hll function names in disassembly --- src/debug.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/debug.c b/src/debug.c index 2ca4445..da5e0e0 100644 --- a/src/debug.c +++ b/src/debug.c @@ -639,6 +639,7 @@ static void dbg_print_local(struct dasm *dasm, int32_t n) static void dbg_print_arg(struct dasm *dasm, int n) { + static int hll = 0; int32_t value = dasm_arg(dasm, n); switch (dasm_arg_type(dasm, n)) { case T_INT: @@ -699,13 +700,20 @@ static void dbg_print_arg(struct dasm *dasm, int n) printf("%s", syscalls[value].name); break; case T_HLL: - if (value < 0 || value >= ain->nr_libraries) + if (value < 0 || value >= ain->nr_libraries) { printf("", value); - else + } else { dbg_print_identifier(ain->libraries[value].name); + hll = value; + } break; case T_HLLFUNC: - printf("%d", value); + if (hll < 0 || hll >= ain->nr_libraries) + printf("%d", value); + else if (value < 0 || value >= ain->libraries[hll].nr_functions) + printf("", value); + else + dbg_print_identifier(ain->libraries[hll].functions[value].name); break; case T_FILE: if (!ain->nr_filenames)