diff options
author | Mark Alexander <marka@cygnus> | 1997-08-06 06:59:03 +0000 |
---|---|---|
committer | Mark Alexander <marka@cygnus> | 1997-08-06 06:59:03 +0000 |
commit | ac210a14ca2f02360e7afad86933dd32d80f5428 (patch) | |
tree | 1b188bb8991ed4388b41d9556a86049812822bd2 | |
parent | c031a0bdf6bb1f5cdf16b338ba5c5f4e08fbc8f1 (diff) | |
download | gdb-ac210a14ca2f02360e7afad86933dd32d80f5428.zip gdb-ac210a14ca2f02360e7afad86933dd32d80f5428.tar.gz gdb-ac210a14ca2f02360e7afad86933dd32d80f5428.tar.bz2 |
* tic80-tdep.c (tic80_init_extra_frame_info): Allow zero
as a valid SP-relative offset of a saved register.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/tic80-tdep.c | 21 |
2 files changed, 20 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25b098f..e78571d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Tue Aug 5 23:56:14 1997 Mark Alexander <marka@cygnus.com> + + * tic80-tdep.c (tic80_init_extra_frame_info): Allow zero + as a valid SP-relative offset of a saved register. + Wed Aug 6 00:24:08 1997 Jeffrey A Law (law@cygnus.com) * hpread.c (hpread_read_struct_type): Use accessor macros rather diff --git a/gdb/tic80-tdep.c b/gdb/tic80-tdep.c index 5d1cc64..9648d55 100644 --- a/gdb/tic80-tdep.c +++ b/gdb/tic80-tdep.c @@ -176,7 +176,10 @@ tic80_init_extra_frame_info (fi) if (fi->next) fi->pc = FRAME_SAVED_PC (fi->next); - memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs); + /* Because zero is a valid register offset relative to SP, we initialize + the offsets to -1 to indicate unused entries. */ + for (reg = 0; reg < NUM_REGS; reg++) + fi->fsr.regs[reg] = -1; if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) { @@ -194,12 +197,18 @@ tic80_init_extra_frame_info (fi) if (!fi->next) /* this is the innermost frame? */ fi->frame = read_register (fi->framereg); else /* not the innermost frame */ - if (fi->framereg == FP_REGNUM) /* we have an FP */ - if (fi->next->fsr.regs[FP_REGNUM] != 0) /* caller saved our FP */ - fi->frame = read_memory_integer (fi->next->fsr.regs[FP_REGNUM], 4); + /* If this function uses FP as the frame register, and the function + it called saved the FP, get the saved FP. */ + if (fi->framereg == FP_REGNUM && + fi->next->fsr.regs[FP_REGNUM] != (unsigned) -1) + fi->frame = read_memory_integer (fi->next->fsr.regs[FP_REGNUM], 4); + + /* Convert SP-relative offsets of saved registers to real addresses. */ for (reg = 0; reg < NUM_REGS; reg++) - if (fi->fsr.regs[reg] != 0) - fi->fsr.regs[reg] += fi->frame - fi->frameoffset; + if (fi->fsr.regs[reg] == (unsigned) -1) + fi->fsr.regs[reg] = 0; /* unused entry */ + else + fi->fsr.regs[reg] += fi->frame - fi->frameoffset; } } |