Here are the minimal steps to reproduce two failures in annota3.exp,
1. Fire gdb, and set breakpoints on main, handle_USR1 and printf,
$ ./gdb testsuite/gdb.base/annota3
(gdb) b main
(gdb) b handle_USR1
(gdb) b printf
2. Run and continue to breakpoint on printf. Now signal handler (handle_USR1) has been installed.
(gdb) run
Starting program: /home/yao/maverick/home/yao/git/build/gdb/testsuite/gdb.base/annota3
Breakpoint 1, main () at ../../../gdb/gdb/testsuite/gdb.base/annota3.c:32
32 int my_array[3] = { 1, 2, 3 };
(gdb) c
Continuing.
Breakpoint 3, 0x400d4516 in printf () from /lib/libc.so.6
3. Sent signal SIGUSR1 to child, and the expected behavior of GDB stops at function handle_USR1. Unfortunately, GDB stops at printf.
(gdb) signal SIGUSR1
Breakpoint 3, 0x400d4516 in printf () from /lib/libc.so.6
GDB does a software single step on [1] with signal 30, but seems kernel doesn't deliver this signal to child, so that breakpoint on signal handler is not hit. This is same as LP:649121.
Here are the minimal steps to reproduce two failures in annota3.exp,
1. Fire gdb, and set breakpoints on main, handle_USR1 and printf, gdb.base/ annota3
$ ./gdb testsuite/
(gdb) b main
(gdb) b handle_USR1
(gdb) b printf
2. Run and continue to breakpoint on printf. Now signal handler (handle_USR1) has been installed. maverick/ home/yao/ git/build/ gdb/testsuite/ gdb.base/ annota3 ./gdb/gdb/ testsuite/ gdb.base/ annota3. c:32
(gdb) run
Starting program: /home/yao/
Breakpoint 1, main () at ../../.
32 int my_array[3] = { 1, 2, 3 };
(gdb) c
Continuing.
Breakpoint 3, 0x400d4516 in printf () from /lib/libc.so.6
3. Sent signal SIGUSR1 to child, and the expected behavior of GDB stops at function handle_USR1. Unfortunately, GDB stops at printf.
(gdb) signal SIGUSR1
Breakpoint 3, 0x400d4516 in printf () from /lib/libc.so.6
Some debug message is shown below,
infrun: clear_proceed_ status_ thread (process 16469) exec_as_ sigtrap= 0) normal_ state WAITKIND_ STOPPED normal_ state WAITKIND_ STOPPED WHAT_STOP_ NOISY
infrun: proceed (addr=0xffffffff, signal=30, step=0)
infrun: resume (step=1, signal=30), trap_expected=1 // <-- [1]
infrun: wait_for_inferior (treat_
infrun: target_wait (-1, status) =
infrun: 16469 [process 16469],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_
infrun: TARGET_
infrun: stop_pc = 0x400d4518
infrun: software single step trap for process 16469
infrun: no stepping, continue
infrun: resume (step=0, signal=0), trap_expected=0
value is 7
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun: 16469 [process 16469],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_
infrun: TARGET_
infrun: stop_pc = 0x400d4516
infrun: BPSTAT_
infrun: stop_stepping
GDB does a software single step on [1] with signal 30, but seems kernel doesn't deliver this signal to child, so that breakpoint on signal handler is not hit. This is same as LP:649121.