Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
gdb
gdb-testsuite-fix-gdb.gdb-python-helper.exp-wit...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch of Package gdb
From f90de5ff0840a3807e01a250fd3379a009821a04 Mon Sep 17 00:00:00 2001 From: Tom de Vries <tdevries@suse.de> Date: Mon, 24 Apr 2023 22:08:53 +0200 Subject: [PATCH 4/4] [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 | 77 +++++++++++++++++++------ 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/gdb/testsuite/gdb.gdb/python-helper.exp b/gdb/testsuite/gdb.gdb/python-helper.exp index 8afbc0f219b..0520d5800fb 100644 --- a/gdb/testsuite/gdb.gdb/python-helper.exp +++ b/gdb/testsuite/gdb.gdb/python-helper.exp @@ -127,7 +127,9 @@ proc test_python_helper {} { # GDB, this should result in the outer GDB stopping at one of the # breakpoints we created.. send_inferior "print 1\n" - gdb_test -prompt $outer_prompt_re "" "Breakpoint $decimal, value_print.*" "hit breakpoint in outer gdb" + gdb_test -prompt $outer_prompt_re "" \ + "Breakpoint $bkptno_numopt_re, value_print.*" \ + "hit breakpoint in outer gdb" # Now inspect the type of parameter VAL, this should trigger the # pretty printers. @@ -165,8 +167,10 @@ proc test_python_helper {} { # information, this will include the TYPE_SPECIFIC_INT # information. send_inferior "print global_c.m_val\n" - gdb_test -prompt $outer_prompt_re "" "Breakpoint $decimal, value_print.*" "print integer from DWARF info" - + gdb_test -prompt $outer_prompt_re "" \ + "Breakpoint $bkptno_numopt_re, value_print.*" \ + "print integer from DWARF info" + set answer [multi_line \ "$decimal = " \ "{name = $hex \"int\"," \ @@ -190,23 +194,58 @@ proc test_python_helper {} { # Send a command to the inner GDB, this should result in the outer # GDB stopping at the value_print breakpoint again. send_inferior "ptype global_c\n" - gdb_test -prompt $outer_prompt_re "" "Breakpoint $bkptno_numopt_re, c_print_type.*" "hit breakpoint in outer gdb again" + set test "hit breakpoint in outer gdb again" + set in_outer_gdb 0 + gdb_test_multiple "" $test -prompt $outer_prompt_re { + -re "Breakpoint $bkptno_numopt_re, c_print_type.*\r\n$outer_prompt_re" { + pass $gdb_test_name + set in_outer_gdb 1 + } + -re "\r\n$gdb_prompt $" { + unsupported $gdb_test_name + } + } - set answer [multi_line \ - "$decimal = " \ - "{name = $hex \"CC\"," \ - " code = TYPE_CODE_STRUCT," \ - " flags = \[^\r\n\]+," \ - " owner = $hex \\(objfile\\)," \ - " target_type = 0x0," \ - " flds_bnds\\.fields\\\[0\\\]:" \ - " {m_name = $hex \"m_val\"," \ - " m_type = $hex," \ - " m_loc_kind = FIELD_LOC_KIND_BITPOS," \ - " bitsize = 0," \ - " bitpos = 0}," \ - " cplus_stuff = $hex}"] - gdb_test -prompt $outer_prompt_re "print *type->main_type" $answer + if { ! $in_outer_gdb } { + return 0 + } + + set cmd "print *type->main_type" + set cmd_supported 1 + foreach sub_expr { type type->main_type } { + set ok 0 + gdb_test_multiple "print $sub_expr" "" -prompt $outer_prompt_re { + -re " = \\(\[^\r\n\]+ \\*\\) $hex\r\n$outer_prompt_re" { + set ok 1 + } + -re "\r\n$outer_prompt_re" { + } + } + if { ! $ok } { + set cmd_supported 0 + break + } + } + + if { $cmd_supported } { + set answer [multi_line \ + "$decimal = " \ + "{name = $hex \"CC\"," \ + " code = TYPE_CODE_STRUCT," \ + " flags = \[^\r\n\]+," \ + " owner = $hex \\(objfile\\)," \ + " target_type = 0x0," \ + " flds_bnds\\.fields\\\[0\\\]:" \ + " {m_name = $hex \"m_val\"," \ + " m_type = $hex," \ + " m_loc_kind = FIELD_LOC_KIND_BITPOS," \ + " bitsize = 0," \ + " bitpos = 0}," \ + " cplus_stuff = $hex}"] + gdb_test -prompt $outer_prompt_re $cmd $answer + } else { + unsupported $cmd + } return 0 } -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor