public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] [gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto=auto and gcc 7.5.0
@ 2023-07-19  7:18 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-07-19  7:18 UTC (permalink / raw)
  To: gdb-patches

With a gdb build with -O2 -flto=auto using gcc 7.5.0, I run into:
...
(gdb) ptype global_c^M
^M
Thread 1 "xgdb" hit Breakpoint 3, \
  _Z12c_print_typeP4typePKcP7ui_fileii8languagePK18type_print_options () at \
  gdb/c-typeprint.c:175^M
175     {^M
(outer-gdb) FAIL: gdb.gdb/python-helper.exp: hit breakpoint in outer gdb again
...

This is a problem with the debug info, which marks the CU containing the
function declaration as C rather than C++.  This is fixed in gcc 8 and later.

Work around this compiler problem by allowing the mangled name.

Tested on x86_64-linux.

PR testsuite/30648
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30648
---
 gdb/testsuite/gdb.gdb/python-helper.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.gdb/python-helper.exp b/gdb/testsuite/gdb.gdb/python-helper.exp
index 217f123302d..719c3975f5d 100644
--- a/gdb/testsuite/gdb.gdb/python-helper.exp
+++ b/gdb/testsuite/gdb.gdb/python-helper.exp
@@ -193,8 +193,12 @@ proc test_python_helper {} {
     send_inferior "ptype global_c\n"
     set test "hit breakpoint in outer gdb again"
     set in_outer_gdb 0
+    # With gdb build with -O2 -flto=auto and gcc 7.5.0, we get the mangled
+    # name of c_print_type due to a problem in the debug info, so we work
+    # around this by less strict matching.
+    set fn_name "\[^\r\n\]*c_print_type\[^\r\n\]*"
     gdb_test_multiple "" $test  -prompt $outer_prompt_re {
-	-re -wrap "Breakpoint $bkptno_numopt_re, c_print_type.*" {
+	-re -wrap "Breakpoint $bkptno_numopt_re, $fn_name.*" {
 	    pass $gdb_test_name
 	    set in_outer_gdb 1
 	}

base-commit: 03c02b696e90714a0ae2c0200d3c65cfffcaa1ee
-- 
2.35.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-19  7:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19  7:18 [pushed] [gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 -flto=auto and gcc 7.5.0 Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).