Fix gdb.reverse/finish-reverse-bkpt.exp
authorYao Qi <yao.qi@linaro.org>
Thu, 7 Apr 2016 16:06:14 +0000 (17:06 +0100)
committerYao Qi <yao.qi@linaro.org>
Thu, 7 Apr 2016 16:06:14 +0000 (17:06 +0100)
commitc8064e7e9b4d7d9cc29a613af899a7739df60be6
treebca6538337d39ec2f7b27c13112bd8a54c6f27d2
parentbde475616e3fdb6d41c047956aaf627fbf34a85d
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  <yao.qi@linaro.org>

* gdb.reverse/finish-reverse-bkpt.exp: Use temporary breakpoint.
Execute "si" command.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp