diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2024-12-20 19:59:03 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-20 12:59:03 +0100 |
| commit | 6ac7d7a1dbb2092b4a7d7b3b678a6cf403f455ca (patch) | |
| tree | 2cd75b20125c599d953ca36439748832c92c676a /src/emu | |
| parent | 291db1530cb122e7235ceb707125caf44ac4560c (diff) | |
| download | box64-6ac7d7a1dbb2092b4a7d7b3b678a6cf403f455ca.tar.gz box64-6ac7d7a1dbb2092b4a7d7b3b678a6cf403f455ca.zip | |
[GDBJIT] Display DynaRec info in source file (#2179)
* [GDBJIT] Display DynaRec info in source file * fix
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64emu.c | 4 | ||||
| -rw-r--r-- | src/emu/x64run_private.c | 2 | ||||
| -rw-r--r-- | src/emu/x64trace.c | 10 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/emu/x64emu.c b/src/emu/x64emu.c index 02ef89d5..7619483b 100644 --- a/src/emu/x64emu.c +++ b/src/emu/x64emu.c @@ -570,10 +570,10 @@ void StopEmu(x64emu_t* emu, const char* reason, int is32bits) #ifdef HAVE_TRACE if(box64_is32bits) { if(my_context->dec32) - printf_log(LOG_NONE, "%s\n", DecodeX64Trace(my_context->dec32, emu->old_ip)); + printf_log(LOG_NONE, "%s\n", DecodeX64Trace(my_context->dec32, emu->old_ip, 1)); } else { if(my_context->dec) - printf_log(LOG_NONE, "%s\n", DecodeX64Trace(my_context->dec, emu->old_ip)); + printf_log(LOG_NONE, "%s\n", DecodeX64Trace(my_context->dec, emu->old_ip, 1)); } #endif } diff --git a/src/emu/x64run_private.c b/src/emu/x64run_private.c index 1d80e76a..8bc99819 100644 --- a/src/emu/x64run_private.c +++ b/src/emu/x64run_private.c @@ -1232,7 +1232,7 @@ void PrintTrace(x64emu_t* emu, uintptr_t ip, int dynarec) printf_log(LOG_NONE, "%p: Native call to %p => %s\n", (void*)ip, (void*)a, GetNativeName(*(void**)(ip+11))); } } else { - printf_log(LOG_NONE, "%s", DecodeX64Trace(is32bits?my_context->dec32:my_context->dec, ip)); + printf_log(LOG_NONE, "%s", DecodeX64Trace(is32bits ? my_context->dec32 : my_context->dec, ip, 1)); uint8_t peek = PK(0); rex_t rex = {0}; if(!is32bits && peek>=0x40 && peek<=0x4f) { diff --git a/src/emu/x64trace.c b/src/emu/x64trace.c index 415a268c..e14f22df 100644 --- a/src/emu/x64trace.c +++ b/src/emu/x64trace.c @@ -128,7 +128,7 @@ void DeleteX64TraceDecoder(zydis_dec_t **dec) #endif } -const char* DecodeX64Trace(zydis_dec_t *dec, uintptr_t p) +const char* DecodeX64Trace(zydis_dec_t* dec, uintptr_t p, int withhex) { #ifndef HAVE_TRACE return "???"; @@ -138,9 +138,11 @@ const char* DecodeX64Trace(zydis_dec_t *dec, uintptr_t p) &dec->instruction))) { char tmp[511]; buff[0]='\0'; - for (int i=0; i<dec->instruction.length; ++i) { - sprintf(tmp, "%02X ", *((unsigned char*)p+i)); - strcat(buff, tmp); + if (withhex) { + for (int i = 0; i < dec->instruction.length; ++i) { + sprintf(tmp, "%02X ", *((unsigned char*)p + i)); + strcat(buff, tmp); + } } #if 0 const /*ZydisFormatterToken*/void* token; |