diff options
Diffstat (limited to 'libpcsxcore/ix86_64/iR3000A-64.c')
| -rw-r--r-- | libpcsxcore/ix86_64/iR3000A-64.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/libpcsxcore/ix86_64/iR3000A-64.c b/libpcsxcore/ix86_64/iR3000A-64.c index fe146589..7f9a35cb 100644 --- a/libpcsxcore/ix86_64/iR3000A-64.c +++ b/libpcsxcore/ix86_64/iR3000A-64.c @@ -354,9 +354,10 @@ static void iDumpRegs() { } } -void iDumpBlock(char *ptr) { +static void iDumpBlock(s8 *ptr) { FILE *f; u32 i; + char buf[200]; SysPrintf("dump1 %x:%x, %x\n", psxRegs.pc, pc, psxRegs.cycle); @@ -364,11 +365,31 @@ void iDumpBlock(char *ptr) { SysPrintf("%s\n", disR3000AF(PSXMu32(i), i)); fflush(stdout); +#if 1 f = fopen("dump1", "w"); - fwrite(ptr, 1, (uptr)x86Ptr - (uptr)ptr, f); - fclose(f); - //system("ndisasm -b64 dump1"); - fflush(stdout); + if(f) { + /* errors don't really matter, but gcc complains if ignored */ + int err; + err = fwrite(ptr, (uptr)x86Ptr - (uptr)ptr, 1, f) != 1; + err = fclose(f) != 0 || err; + if(!err) { + sprintf(buf, "objdump -m i386 -M x86-64 -D -b binary --adjust-vma=0x%lx dump1", (unsigned long)ptr); + err = system(buf); + } else + perror("dump1"); + remove("dump1"); + } +#else + /* probably pointless; branch targets are still not symbols */ + sprintf(buf, + "gdb --batch --quiet" + " -ex 'set verbose 0'" + " -ex 'set confirm 0'" + " -ex 'attach %d'" + " -ex 'disas/r %p,%p'" + , getpid(), ptr, x86Ptr - 1); + system(buf); +#endif } #define REC_FUNC(f) \ |
