[gdb/testsuite] Add untested case in selftest_setup
authorTom de Vries <tdevries@suse.de>
Fri, 3 Sep 2021 13:13:14 +0000 (15:13 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 3 Sep 2021 13:13:14 +0000 (15:13 +0200)
commit5c177fed07e31081fa88f2dc5ca000363fbb3ad9
tree60d7275342d2c241ea79d5f9162d01273968db44
parentc6c2468fdf1b9d370cb5a6248feaaf65d33274a6
[gdb/testsuite] Add untested case in selftest_setup

When building gdb with "-Wall -O2 -g -flto=auto", I run into:
...
FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \
  (got interactive prompt)
FAIL: gdb.gdb/python-helper.exp: run until breakpoint at captured_main
WARNING: Couldn't test self
...
and similar in gdb.gdb/selftest.exp.

The first FAIL in more detail:
...
(gdb) break captured_main^M
Function "captured_main" not defined.^M
Make breakpoint pending on future shared library load? (y or [n]) n^M
(gdb) FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \
  (got interactive prompt)
...

The problem is that lto has optimized away the captured_main function
and consequently the selftests dependent on that cannot run.

Fix this by:
- using gdb_breakpoint to detect failure to set the breakpoint
- handling the failure to set a breakpoint by calling untested
- not emitting the warning if we've already got untested
such that we have:
...
(gdb) UNTESTED: gdb.gdb/python-helper.exp: Cannot set breakpoint at \
  captured_main, skipping testcase.
...

gdb/testsuite/ChangeLog:

2021-09-03  Tom de Vries  <tdevries@suse.de>

* lib/selftest-support.exp: Emit untested when not being able to set
breakpoint.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/selftest-support.exp
This page took 0.025185 seconds and 4 git commands to generate.