summaryrefslogtreecommitdiff
path: root/crenshaw
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-08-16 14:52:29 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2018-08-16 14:52:29 +0200
commite010c35dd67d24a6bbf1acd5ae0ed1d64d0d905d (patch)
tree627a1a04e52975839307369db4c56ce9684ea9d3 /crenshaw
parent26164db8ad8df2e8d8b16df559d918cabdce121e (diff)
downloadcompilertests-e010c35dd67d24a6bbf1acd5ae0ed1d64d0d905d.tar.gz
compilertests-e010c35dd67d24a6bbf1acd5ae0ed1d64d0d905d.tar.bz2
improved emulator output
Diffstat (limited to 'crenshaw')
-rw-r--r--crenshaw/emul.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/crenshaw/emul.c b/crenshaw/emul.c
index e84c4b7..c17e48b 100644
--- a/crenshaw/emul.c
+++ b/crenshaw/emul.c
@@ -32,7 +32,6 @@ static void dump_regs( uc_engine *uc )
uc_reg_read( uc, UC_X86_REG_EBX, &ebx );
uc_reg_read( uc, UC_X86_REG_ECX, &ecx );
- printf( "--\n" );
printf( "EIP: %08x\n", eip );
printf( "ESP: %08x\n", esp );
printf( "EAX: %08x\n", eax );
@@ -131,8 +130,12 @@ int main( int argc, char *argv[] )
uint64_t address = CODE_START;
cs_insn *instr = cs_malloc( cs );
bool terminate = false;
+ int iteration = 1;
while( !terminate ) {
+
+ printf( "-- iteration %d\n", iteration );
+ iteration++;
if( !cs_disasm_iter( cs, (const uint8_t **)&code, &code_size, &address, instr ) ) {
fprintf( stderr, "ERROR: failed to call cs_disasm_iter( ): %s\n", cs_strerror( cs_errno( cs ) ) );
@@ -141,8 +144,12 @@ int main( int argc, char *argv[] )
exit( EXIT_FAILURE );
}
- printf( "0x%08x:\t%s\t\t%s\n",
- (uint32_t)instr->address, instr->mnemonic, instr->op_str );
+ printf( "%04X: ", address );
+ for( int i = 0; i < instr->size; i++ ) {
+ printf( "%02X ", instr->bytes[i] );
+ }
+
+ printf( " %s\t\t%s\n", instr->mnemonic, instr->op_str );
uerr = uc_emu_start( uc, addr, CODE_START + CODE_SIZE, 0, 1 );
if( uerr != UC_ERR_OK ) {