This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix gdb.gdb/ selftest tests when testing optimized GDB builds
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Fri, 20 Oct 2017 10:57:19 -0400
- Subject: [binutils-gdb] Fix gdb.gdb/ selftest tests when testing optimized GDB builds
- Authentication-results: sourceware.org; auth=none
*** TEST RESULTS FOR COMMIT fcc8fb2f3de370f2def30bb18c98243ed4f3fb8c ***
Author: Pedro Alves <palves@redhat.com>
Branch: master
Commit: fcc8fb2f3de370f2def30bb18c98243ed4f3fb8c
Fix gdb.gdb/ selftest tests when testing optimized GDB builds
After commit bf4692711232 ("Eliminate catch_errors"), GCC started
inlining captured_command_loop in captured_main. And setting a
breakpoint on captured_command_loop makes the inferior GDB stop in
captured_main, _after_ captured_command_loop's call to
interp_pre_command_loop, which prints the inferior GDB's prompt, has
already executed, confusing the gdb.gdb/ selftest tests:
(gdb) FAIL: gdb.gdb/complaints.exp: run until breakpoint at captured_command_loop
WARNING: Couldn't test self
Debugging GDB with GDB manually, we see:
(top-gdb) b captured_command_loop
Breakpoint 1 at 0x71ee60: file src/gdb/main.c, line 324.
(top-gdb) r
[....]
(gdb) <<<<<< PROMPT HERE
Thread 1 "gdb" hit Breakpoint 1, captured_main (data=<optimized out>) at src/gdb/main.c:1147
1147 captured_command_loop ();
(top-gdb)
Note the stop at 'captured_main', and the "PROMPT HERE" line. That
prompt does not show up when debugging a non-optimized build of GDB.
Fix this by preventing inlining of captured_command_loop.
Ref: https://sourceware.org/ml/gdb-patches/2017-10/msg00522.html
gdb/ChangeLog:
2017-10-20 Pedro Alves <palves@redhat.com>
* main.c (captured_command_loop): Add attribute noinline.