[gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto
authorTom de Vries <tdevries@suse.de>
Mon, 24 Apr 2023 20:08:53 +0000 (22:08 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 24 Apr 2023 20:08:53 +0000 (22:08 +0200)
commit60732b42936b322a30d2d08618432eabb94b5a67
treee128130ab0d2db4493b6b7fd5fcdd1f537a33ecd
parent4fa173cfd79f8a00c091f8a5a119bc2b064cc716
[gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto

On openSUSE Leap 15.4, with gcc 7.5.0, when building gdb with
-O2 -g -flto=auto, I run into:
...
FAIL: gdb.gdb/python-helper.exp: hit breakpoint in outer gdb
FAIL: gdb.gdb/python-helper.exp: print integer from DWARF info
FAIL: gdb.gdb/python-helper.exp: print *type->main_type
...

Fix the first two FAILs by using $bkptno_numopt_re.

The last FAIL is due to:
...
(outer-gdb) print *type->main_type^M
A syntax error in expression, near `->main_type'.^M
(outer-gdb) FAIL: gdb.gdb/python-helper.exp: print *type->main_type
...
because:
...
(outer-gdb) print type^M
Attempt to use a type name as an expression^M
...

Fix this by making the test unresolved if "print type" or
"print type->main_type" doesn't succeed.

On openSUSE Tumbleweed, with gcc 13.0.1, when building gdb with
-O2 -g -flto=auto, I run into timeouts due to the breakpoint in c_print_type
not hitting.  Fix this by detecting the situation and bailing out.

Tested on x86_64-linux.
gdb/testsuite/gdb.gdb/python-helper.exp