From: Yao Qi Date: Thu, 7 Apr 2016 16:06:14 +0000 (+0100) Subject: Fix gdb.reverse/finish-reverse-bkpt.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c8064e7e9b4d7d9cc29a613af899a7739df60be6;p=binutils-gdb.git Fix gdb.reverse/finish-reverse-bkpt.exp I see the following fail on aarch64-linux break void_func Breakpoint 2 at 0x4007a0: file gdb/testsuite/gdb.reverse/finish-reverse.c, line 44. (gdb) PASS: gdb.reverse/finish-reverse-bkpt.exp: set breakpoint on void_func continue Continuing. Breakpoint 2, void_func () at gdb/testsuite/gdb.reverse/finish-reverse.c:44^M 44 void_test = 1; /* VOID FUNC */^M (gdb) PASS: gdb.reverse/finish-reverse-bkpt.exp: continue to breakpoint: void_func break *void_func^M Note: breakpoint 2 also set at pc 0x4007a0.^M Breakpoint 3 at 0x4007a0: file gdb/testsuite/gdb.reverse/finish-reverse.c, line 44. (gdb) PASS: gdb.reverse/finish-reverse-bkpt.exp: set breakpoint at void_func's entry reverse-finish^M Run back to call of #0 void_func () at gdb/testsuite/gdb.reverse/finish-reverse.c:44 main (argc=1, argv=0x7ffffffb78) at gdb/testsuite/gdb.reverse/finish-reverse.c:98 98 void_func (); /* call to void_func */^M (gdb) FAIL: gdb.reverse/finish-reverse-bkpt.exp: reverse-finish from void_func trips breakpoint at entry The test assumes that brekapoints on "void_func" and "*void_func" are set on different places because of function prologue. However, on aarch64-linux, there is no prologue in void_func, so two breakpoints are set at the same place (0x4007a0). (gdb) disassemble void_func Dump of assembler code for function void_func: 0x00000000004007a0 <+0>: adrp x0, 0x410000 0x00000000004007a4 <+4>: add x0, x0, #0xc14 0x00000000004007a8 <+8>: mov w1, #0x1 0x00000000004007ac <+12>: str w1, [x0] 0x00000000004007b0 <+16>: ret The fix to this problem is to single step forward before setting breakpoint on *void_func. gdb/testsuite: 2016-04-07 Yao Qi * gdb.reverse/finish-reverse-bkpt.exp: Use temporary breakpoint. Execute "si" command. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a044d5a44f3..e00afa7de5a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-07 Yao Qi + + * gdb.reverse/finish-reverse-bkpt.exp: Use temporary breakpoint. + Execute "si" command. + 2016-04-07 Yao Qi * gdb.reverse/next-reverse-bkpt-over-sr.exp: Match the breakpoint diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp index ccc332d7e2c..1dff8e10002 100644 --- a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp +++ b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp @@ -40,11 +40,16 @@ if [supports_process_record] { } set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"] -gdb_test "break void_func" \ - "Breakpoint $decimal at .*$srcfile, line $breakloc\." \ +gdb_test "tbreak void_func" \ + "Temporary breakpoint $decimal at .*$srcfile, line $breakloc\." \ "set breakpoint on void_func" gdb_continue_to_breakpoint "void_func" ".*$srcfile:$breakloc.*" +# We stop at the brekapoint on void_func, but breakpoint on +# *void_func will be set at the same place if function void_func doesn't +# have prologue. One step forward to avoid this. +gdb_test "si" + gdb_test "break \*void_func" \ "Breakpoint $decimal at .*" \ "set breakpoint at void_func's entry"