Changeset 1339

Show
Ignore:
Timestamp:
07/30/07 18:51:21 (1 year ago)
Author:
common
Message:

libemu

  • use debug macro in cpu's instruction debugging, getting the instrstring takes _many_ cycles
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libemu/trunk/src/emu_cpu.c

    r1320 r1339  
    3232#include <stdbool.h> 
    3333 
     34#include "../config.h" 
     35 
    3436#include "emu/emu_cpu.h" 
    3537#include "emu/emu_cpu_data.h" 
     
    133135        } 
    134136 
    135         c->instr_string = (char *)malloc(32); 
     137        c->instr_string = (char *)malloc(82); 
    136138        c->repeat_current_instr = false; 
    137139        init_prefix_map(); 
     
    442444                return 0; 
    443445        } 
     446 
     447#ifdef DEBUG 
     448        str[81] = '\0'; 
     449        memset(str, 0x20, 81); 
     450 
     451        int i;  
     452        for (i=0;i<instrsize;i++) 
     453        { 
     454                snprintf(str+i*2, 36-2*i, "%02X", data[i]); 
     455        } 
     456        memset(str+strlen(str), 0x20, 81-strlen(str)); 
     457 
     458 
     459 
    444460        // step 3: print it 
    445         get_instruction_string(&inst, FORMAT_INTEL, 0, str, 32); 
    446  
    447         return instrsize; 
    448  
    449         printf("%08x ", eip); 
    450         int i; 
    451         for (i=0; i<instrsize; i++) 
    452         { 
    453                 printf("%02x", data[i]); 
    454         } 
    455         for (;i<15;i++) 
    456         { 
    457                 printf("  "); 
    458         } 
    459         printf(" %s\n", str); 
     461        get_instruction_string(&inst, FORMAT_INTEL, 0, str, 31); 
     462#endif // DEBUG 
    460463 
    461464        return instrsize;