Commit f240a33b1b38d1ba34f6e40b5b790edeee2a6762
1 parent
4902e75a
Fixed formats (not fault of inttypes, but wrong scanf formats)
Showing
1 changed file
with
11 additions
and
11 deletions
debug.c
... | ... | @@ -72,12 +72,12 @@ void query() |
72 | 72 | { |
73 | 73 | //TODO discard stdin |
74 | 74 | uint8_t end = 0; |
75 | - unsigned int bpoint; | |
76 | - unsigned int mempos; | |
75 | + uint16_t bpoint; | |
76 | + uint16_t mempos; | |
77 | 77 | char input[100] = {0}; |
78 | 78 | char filename[32]; |
79 | - unsigned int reg; | |
80 | - unsigned int value; | |
79 | + uint8_t reg; | |
80 | + uint16_t value; | |
81 | 81 | while(!end) |
82 | 82 | { |
83 | 83 | printf("\n> "); |
... | ... | @@ -96,14 +96,14 @@ void query() |
96 | 96 | switch (command) |
97 | 97 | { |
98 | 98 | case 'b': |
99 | - sscanf(input,"b %d\n",&bpoint); | |
100 | - fprintf(stderr,"Set breakpoint %d to %d",nbpoints,bpoint); | |
99 | + sscanf(input,"b %hu\n",&bpoint); | |
100 | + fprintf(stderr,"Set breakpoint %hu to %hu",nbpoints,bpoint); | |
101 | 101 | breakpoints[nbpoints] = bpoint; |
102 | 102 | nbpoints = nbpoints + 1 % 0xFF; |
103 | 103 | break; |
104 | 104 | case 'd': |
105 | - sscanf(input,"d %d\n",&bpoint); | |
106 | - fprintf(stderr,"Deleted breakpoint %d",bpoint); | |
105 | + sscanf(input,"d %hu\n",&bpoint); | |
106 | + fprintf(stderr,"Deleted breakpoint %hu",bpoint); | |
107 | 107 | breakpoints[bpoint] = 0; |
108 | 108 | break; |
109 | 109 | case 'c': |
... | ... | @@ -117,7 +117,7 @@ void query() |
117 | 117 | print_regs(); |
118 | 118 | break; |
119 | 119 | case 'm': |
120 | - sscanf(input,"m %X\n",&mempos); | |
120 | + sscanf(input,"m %hX\n",&mempos); | |
121 | 121 | fprintf(stderr,"%02X: %02x\n",mempos,mem[mempos]); |
122 | 122 | break; |
123 | 123 | case 's': |
... | ... | @@ -131,8 +131,8 @@ void query() |
131 | 131 | fprintf(stderr,"Loaded state as %s",filename); |
132 | 132 | break; |
133 | 133 | case 'w': |
134 | - sscanf(input,"w r%d %d\n",®,&value); | |
135 | - fprintf(stderr,"Setting r%d = %02X",reg,value); | |
134 | + sscanf(input,"w r%hhu %hu\n",®,&value); | |
135 | + fprintf(stderr,"Setting r%hhu = %02X",reg,value); | |
136 | 136 | regs[reg] = value; |
137 | 137 | break; |
138 | 138 | case 'q': | ... | ... |