diff --git a/Test/c/testbed b/Test/c/testbed index af1d809357679b80b1db758f61d69c6c01c1d3f4..2463fb6fef2499daae1efbb6c494339a4ecf002e 100644 --- a/Test/c/testbed +++ b/Test/c/testbed @@ -25,7 +25,6 @@ void xsystem(const char *cmd) { -// printf("*%s\n",cmd); if (system(cmd)) { fprintf(stderr,"'%s' failed!\n",cmd); @@ -405,8 +404,6 @@ int diff_debugger(char *folder,char *one,char *two,char *out) if(strstr(c2,"Unallocated")) continue; /* Skip LDC/STC/etc. - might be caused by VFP/NEON handling differences */ - if(strstr(c2,"MAR") || strstr(c2,"MRA")) - continue; if((strstr(c1,"LDC") || strstr(c1,"STC") || strstr(c1,"MCR") || strstr(c1,"MRC") || strstr(c1,"MRRC") || strstr(c1,"CDP")) && strstr(c2,"Undefined")) continue; if((strstr(c2,"LDC") || strstr(c2,"STC") || strstr(c2,"MCR") || strstr(c2,"MRC") || strstr(c2,"MRRC") || strstr(c2,"CDP")) && strstr(c1,"Undefined")) @@ -557,6 +554,7 @@ int main(int argc,char **argv) fread(raw,count<<2,1,f); fclose(f); process(rawfile,folder,raw,count); + free(raw); } else { diff --git a/c/main b/c/main index bb851b886c022c59833bf170be81627a13d029eb..76f8a315ef0fef34abdafb3dc72c79bd11b8bb3e 100644 --- a/c/main +++ b/c/main @@ -87,21 +87,6 @@ int main(int argc,char **argv) fprintf(stderr,"Usage: dis2 <file> <addr> [-debugger|-decaof|-decaofual]\n"); exit(EXIT_FAILURE); } - FILE *f = fopen(argv[1],"rb"); - if(!f) - { - fprintf(stderr,"Couldn't open '%s'\n",argv[1]); - exit(EXIT_FAILURE); - } - fseek(f,0,SEEK_END); - uint32_t len = ((uint32_t) ftell(f)) & ~3; - uint32_t *prog = (uint32_t *) malloc(len); - fseek(f,0,SEEK_SET); - fread(prog,len,1,f); - fclose(f); - uint32_t addr; - if(sscanf(argv[2],"0x%x",&addr) != 1) - addr = atoi(argv[2]); bool debugger = false; dis_options *opt; if(!strcmp(argv[3],"-debugger")) @@ -122,6 +107,28 @@ int main(int argc,char **argv) fprintf(stderr,"Unknown disassembly format '%s'\n",argv[3]); exit(EXIT_FAILURE); } + FILE *f = fopen(argv[1],"rb"); + if(!f) + { + fprintf(stderr,"Couldn't open '%s'\n",argv[1]); + exit(EXIT_FAILURE); + } + fseek(f,0,SEEK_END); + uint32_t len = ((uint32_t) ftell(f)) & ~3; + uint32_t *progstore, *prog; + progstore = prog = (uint32_t *) malloc(len); + if(!progstore) + { + fprintf(stderr,"Out of memory allocating %u\n",len); + fclose(f); + exit(EXIT_FAILURE); + } + fseek(f,0,SEEK_SET); + fread(prog,len,1,f); + fclose(f); + uint32_t addr; + if(sscanf(argv[2],"0x%x",&addr) != 1) + addr = atoi(argv[2]); while(len) { char buf[1024]; @@ -135,5 +142,6 @@ int main(int argc,char **argv) addr+=4; len-=4; } + free(progstore); return 0; }