Skip to content

Commit

Permalink
gdb: mips: Fix large-frame.exp test case failure
Browse files Browse the repository at this point in the history
$ objdump -d outputs/gdb.base/large-frame/large-frame-O2
0000000120000b20 <func>:
   120000b20:   67bdbff0        daddiu  sp,sp,-16400
   120000b24:   ffbc4000        sd      gp,16384(sp)
   120000b28:   3c1c0002        lui     gp,0x2
   120000b2c:   679c8210        daddiu  gp,gp,-32240
   120000b30:   0399e02d        daddu   gp,gp,t9
   120000b34:   df998058        ld      t9,-32680(gp)
   120000b38:   ffbf4008        sd      ra,16392(sp)
   120000b3c:   0411ffd8        bal     120000aa0 <blah>
...

The disassembly of the above func function shows that we may use
instructions such as daddiu/daddu, so add "daddiu $gp,$gp,n",
"daddu $gp,$gp,$t9" and "daddu $gp,$t9,$gp" to the mips32_scan_prologue
function to fix the large-frame.exp test case.

Before applying the patch:

 backtrace
 #0  blah (a=0xfffffee220) at .../gdb/testsuite/gdb.base/large-frame-1.c:24
 riscvarchive#1  0x0000000120000b44 in func ()
 Backtrace stopped: frame did not save the PC
 (gdb) FAIL: gdb.base/large-frame.exp: optimize=-O2: backtrace

 # of expected passes            5
 # of unexpected failures        1

After applying the patch:

 # of expected passes            6

Signed-off-by: Youling Tang <[email protected]>
  • Loading branch information
Youling Tang authored and maciej-w-rozycki committed May 10, 2022
1 parent 2c3c88d commit f8b786e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gdb/mips-tdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -3588,8 +3588,11 @@ mips32_scan_prologue (struct gdbarch *gdbarch,
|| (inst & 0xFF9F07FF) == 0x00800021 /* move reg,$a0-$a3 */
|| high_word == 0x3c1c /* lui $gp,n */
|| high_word == 0x279c /* addiu $gp,$gp,n */
|| high_word == 0x679c /* daddiu $gp,$gp,n */
|| inst == 0x0399e021 /* addu $gp,$gp,$t9 */
|| inst == 0x033ce021 /* addu $gp,$t9,$gp */
|| inst == 0x0399e02d /* daddu $gp,$gp,$t9 */
|| inst == 0x033ce02d /* daddu $gp,$t9,$gp */
)
{
/* These instructions are part of the prologue, but we don't
Expand Down

0 comments on commit f8b786e

Please sign in to comment.