From f240a33b1b38d1ba34f6e40b5b790edeee2a6762 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Tue, 27 Dec 2016 18:01:03 +0100 Subject: [PATCH] Fixed formats (not fault of inttypes, but wrong scanf formats) --- debug.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/debug.c b/debug.c index 2b0a6c9..ee9a64d 100644 --- a/debug.c +++ b/debug.c @@ -72,12 +72,12 @@ void query() { //TODO discard stdin uint8_t end = 0; - unsigned int bpoint; - unsigned int mempos; + uint16_t bpoint; + uint16_t mempos; char input[100] = {0}; char filename[32]; - unsigned int reg; - unsigned int value; + uint8_t reg; + uint16_t value; while(!end) { printf("\n> "); @@ -96,14 +96,14 @@ void query() switch (command) { case 'b': - sscanf(input,"b %d\n",&bpoint); - fprintf(stderr,"Set breakpoint %d to %d",nbpoints,bpoint); + sscanf(input,"b %hu\n",&bpoint); + fprintf(stderr,"Set breakpoint %hu to %hu",nbpoints,bpoint); breakpoints[nbpoints] = bpoint; nbpoints = nbpoints + 1 % 0xFF; break; case 'd': - sscanf(input,"d %d\n",&bpoint); - fprintf(stderr,"Deleted breakpoint %d",bpoint); + sscanf(input,"d %hu\n",&bpoint); + fprintf(stderr,"Deleted breakpoint %hu",bpoint); breakpoints[bpoint] = 0; break; case 'c': @@ -117,7 +117,7 @@ void query() print_regs(); break; case 'm': - sscanf(input,"m %X\n",&mempos); + sscanf(input,"m %hX\n",&mempos); fprintf(stderr,"%02X: %02x\n",mempos,mem[mempos]); break; case 's': @@ -131,8 +131,8 @@ void query() fprintf(stderr,"Loaded state as %s",filename); break; case 'w': - sscanf(input,"w r%d %d\n",®,&value); - fprintf(stderr,"Setting r%d = %02X",reg,value); + sscanf(input,"w r%hhu %hu\n",®,&value); + fprintf(stderr,"Setting r%hhu = %02X",reg,value); regs[reg] = value; break; case 'q': -- libgit2 0.22.2