Skip to content

Commit baddcaf

Browse files
committed
Note GDB 5 distinctives in BrickEmu debugger.c
1 parent 7a734dc commit baddcaf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

debugger.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@
4949
* the high 16 bits, the rest is 0 padded. The top 3 registers are
5050
* not used by h8/300, and ignored (0 filled).
5151
*/
52+
typedef int32 gdb_register_size_t;
5253
#define NUM_REGS 13
53-
#define NUM_REG_BYTES (NUM_REGS*sizeof(int32))
54+
#define NUM_REG_BYTES (NUM_REGS*sizeof(gdb_register_size_t))
5455

5556
int debuggerfd;
5657
int monitorport;
@@ -209,12 +210,12 @@ static void db_handle_packet(char* packet) {
209210
break;
210211
case 'g' : /* return the value of the CPU registers */
211212
/*
212-
* GDB expects 13 x 32 bit registers. The real register value is in
213-
* the high 16 bits, the rest is 0 padded. The top 3 registers are
214-
* not used by h8/300, and ignored (0 filled).
213+
* Older GDB versions expect 13 x 32 bit registers. For these, the
214+
* real register value is in the high 16 bits, the rest is 0 padded.
215+
* The top 3 registers are not used by h8/300, and ignored (0 filled).
215216
*/
216-
217217
memset(db_registers, 0, sizeof(db_registers));
218+
218219
for (i = 0; i < 8; i++) {
219220
db_registers[4*i] = reg[i];
220221
db_registers[4*i+1] = reg[i+8];

0 commit comments

Comments
 (0)