Search
lxdream.org :: lxdream :: r920:1e6a29649b56
lxdream 0.9.1
released Jun 29
Download Now
changeset920:1e6a29649b56
parent919:dfa21f43925b
child921:6c0e9a8f5618
authornkeynes
dateThu Dec 04 09:06:35 2008 +0000 (11 years ago)
Update to print symbols for matching operands
src/x86dasm/i386-dis.c
src/x86dasm/x86dasm.c
1.1 --- a/src/x86dasm/i386-dis.c Thu Dec 04 09:05:56 2008 +0000
1.2 +++ b/src/x86dasm/i386-dis.c Thu Dec 04 09:06:35 2008 +0000
1.3 @@ -3106,10 +3106,13 @@
1.4 }
1.5 else
1.6 {
1.7 + x86_print_symbolic_operand( buf, hex, disp );
1.8 + /*
1.9 if (hex)
1.10 sprintf (buf, "0x%x", (unsigned int) disp);
1.11 else
1.12 sprintf (buf, "%d", (int) disp);
1.13 + */
1.14 }
1.15 }
1.16
2.1 --- a/src/x86dasm/x86dasm.c Thu Dec 04 09:05:56 2008 +0000
2.2 +++ b/src/x86dasm/x86dasm.c Thu Dec 04 09:06:35 2008 +0000
2.3 @@ -104,6 +104,18 @@
2.4 }
2.5 }
2.6
2.7 +void x86_print_symbolic_operand( char *buf, int hex, unsigned int disp )
2.8 +{
2.9 + const char *sym = x86_find_symbol(disp, NULL);
2.10 + if( sym != NULL ) {
2.11 + snprintf( buf, 50, "<%s>", sym );
2.12 + } else if( hex ) {
2.13 + sprintf( buf, "0x%x", disp );
2.14 + } else {
2.15 + sprintf( buf, "%d", (int)disp );
2.16 + }
2.17 +}
2.18 +
2.19 uint32_t x86_disasm_instruction( uintptr_t pc, char *buf, int len, char *opcode )
2.20 {
2.21 int count, i;
.