From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 79BD7385C421 for ; Fri, 7 Oct 2022 14:18:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79BD7385C421 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A5F1C21972 for ; Fri, 7 Oct 2022 14:18:19 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7FEC013A3D for ; Fri, 7 Oct 2022 14:18:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KwwGHis1QGNYEAAAMHmgww (envelope-from ) for ; Fri, 07 Oct 2022 14:18:19 +0000 Date: Fri, 7 Oct 2022 16:18:18 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix DUPLICATEs with remote-gdbserver-on-localhost Message-ID: <20221007141816.GA3684@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2022 14:18:23 -0000 Hi, Fix some DUPLICATEs that we run into with target board remote-gdbserver-on-localhost, by using test_with_prefix. Tested on x86_64-linux, with native and target board remote-gdbserver-on-localhost. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix DUPLICATEs with remote-gdbserver-on-localhost --- gdb/testsuite/gdb.base/gcore-relro.exp | 27 +- gdb/testsuite/gdb.base/pending.exp | 12 +- gdb/testsuite/gdb.base/solib-weak.exp | 22 +- .../gdb.dwarf2/locexpr-data-member-location.exp | 124 ++++----- gdb/testsuite/gdb.python/py-finish-breakpoint.exp | 279 +++++++++++---------- 5 files changed, 247 insertions(+), 217 deletions(-) diff --git a/gdb/testsuite/gdb.base/gcore-relro.exp b/gdb/testsuite/gdb.base/gcore-relro.exp index 0bfbe99040d..6417ac5b143 100644 --- a/gdb/testsuite/gdb.base/gcore-relro.exp +++ b/gdb/testsuite/gdb.base/gcore-relro.exp @@ -35,22 +35,27 @@ set objfile [standard_output_file ${testfile}.o] return -1 } -clean_restart ${binfile} -gdb_load_shlib ${binfile_lib} +with_test_prefix "first session" { + clean_restart ${binfile} + gdb_load_shlib ${binfile_lib} -if ![runto lib] { - return -1 -} + if ![runto lib] { + return -1 + } -if {![gdb_gcore_cmd $gcorefile "save a corefile"]} { - return -1 + if {![gdb_gcore_cmd $gcorefile "save a corefile"]} { + return -1 + } } # Now restart gdb and load the corefile. -clean_restart ${binfile} -gdb_load_shlib ${binfile_lib} +with_test_prefix "second session" { + clean_restart ${binfile} + gdb_load_shlib ${binfile_lib} -gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile" + gdb_test "core ${gcorefile}" "Core was generated by .*" \ + "re-load generated corefile" -gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded" + gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded" +} diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp index 9b3fb024887..1de35ea9927 100644 --- a/gdb/testsuite/gdb.base/pending.exp +++ b/gdb/testsuite/gdb.base/pending.exp @@ -57,8 +57,10 @@ gdb_test "info break" \ \[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \ "single pending breakpoint info (without symbols)" -gdb_load ${binfile} -gdb_load_shlib $lib_sl +with_test_prefix "first load" { + gdb_load ${binfile} + gdb_load_shlib $lib_sl +} set pendfunc1_loc [gdb_get_line_number "y = x + 4" ${libfile}.c] @@ -74,8 +76,10 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} -gdb_load_shlib $lib_sl +with_test_prefix "second load" { + gdb_load ${binfile} + gdb_load_shlib $lib_sl +} # # Test setting, querying, and modifying pending breakpoints diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp index c82eee28e21..a8a9fc915b3 100644 --- a/gdb/testsuite/gdb.base/solib-weak.exp +++ b/gdb/testsuite/gdb.base/solib-weak.exp @@ -85,19 +85,21 @@ proc do_test { lib1opts lib2opts lib1first } { return -1 } - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - gdb_load_shlib $lib1 - gdb_load_shlib $lib2 + with_test_prefix $testopts { + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} + gdb_load_shlib $lib1 + gdb_load_shlib $lib2 - runto_main + runto_main - gdb_breakpoint "bar" + gdb_breakpoint "bar" - gdb_test "continue" "Breakpoint .* \\.?bar .*${expected_file}\\..*" \ - "run to breakpoint - $testopts" + gdb_test "continue" "Breakpoint .* \\.?bar .*${expected_file}\\..*" \ + "run to breakpoint" + } } foreach lib1opts {{} {debug}} { diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp index 8e924eac57f..bd20272637c 100644 --- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp +++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp @@ -97,48 +97,49 @@ if [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -# Do whatever is necessary to make sure that the shared library is -# loaded for remote targets. -gdb_load_shlib ${lib_so} +### First GDB session. +with_test_prefix "first session" { + # Do whatever is necessary to make sure that the shared library is + # loaded for remote targets. + gdb_load_shlib ${lib_so} -### First GDB session. + # Run to foo to make sure foo refers to the function, and not foo@PLT. + if ![runto foo qualified] then { + return + } -# Run to foo to make sure foo refers to the function, and not foo@PLT. -if ![runto foo qualified] then { - return -} + with_shared_gdb { -with_shared_gdb { + set session_options $exec_options - set session_options $exec_options + # Rather than start a new session, declare the current session the + # shared one. Otherwise, get_func_info would compile an executable + # in a temp dir, which means -Wl,-rpath,\\\$ORIGIN no longer finds + # the shared lib. + share_gdb ${srcdir}/${subdir}/$srcfile $session_options - # Rather than start a new session, declare the current session the - # shared one. Otherwise, get_func_info would compile an executable - # in a temp dir, which means -Wl,-rpath,\\\$ORIGIN no longer finds - # the shared lib. - share_gdb ${srcdir}/${subdir}/$srcfile $session_options + get_func_info foo $session_options + get_func_info bar $session_options - get_func_info foo $session_options - get_func_info bar $session_options + # Using our running GDB session, determine sizes of several types. + set long_size [get_sizeof "long" -1] + set addr_size [get_sizeof "void *" -1] + set struct_A_size [get_sizeof "g_A" -1] + set struct_B_size [get_sizeof "g_B" -1] - # Using our running GDB session, determine sizes of several types. - set long_size [get_sizeof "long" -1] - set addr_size [get_sizeof "void *" -1] - set struct_A_size [get_sizeof "g_A" -1] - set struct_B_size [get_sizeof "g_B" -1] + # Retrieve struct offset of MBR in struct TP + proc get_offsetof { tp mbr } { + return [get_integer_valueof "&((${tp} *) 0)->${mbr}" -1] + } - # Retrieve struct offset of MBR in struct TP - proc get_offsetof { tp mbr } { - return [get_integer_valueof "&((${tp} *) 0)->${mbr}" -1] + # Use running GDB session to get struct offsets + set A_a [get_offsetof A a] + set A_x [get_offsetof A x] + set B_a [get_offsetof B a] + set B_b [get_offsetof B b] + set B_x2 [get_offsetof B x2] } - - # Use running GDB session to get struct offsets - set A_a [get_offsetof A a] - set A_x [get_offsetof A x] - set B_a [get_offsetof B a] - set B_b [get_offsetof B b] - set B_x2 [get_offsetof B x2] } if { $long_size == -1 || $addr_size == -1 \ @@ -326,40 +327,43 @@ if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_so \ ### Second GDB session. -clean_restart $binfile +with_test_prefix "second session" { + clean_restart $binfile -# Again, do whatever is necessary to make sure that the shared library is -# loaded for remote targets. -gdb_load_shlib ${lib_so} + # Again, do whatever is necessary to make sure that the shared library is + # loaded for remote targets. + gdb_load_shlib ${lib_so} -if ![runto_main] then { - return -} - -# Step into foo so that we can finish out of it. -gdb_test "step" "foo .. at .* foo end.*" "step into foo" + if ![runto_main] then { + return + } -# Finishing out of foo will create a value that will later need to -# be preserved when restarting the program. -gdb_test "finish" "= \\(class B \\*\\) ${::hex} .*" "finish out of foo" + # Step into foo so that we can finish out of it. + gdb_test "step" "foo .. at .* foo end.*" "step into foo" -# Dereferencing and printing the return value isn't necessary -# for reproducing the bug, but we should make sure that the -# return value is what we expect it to be. -gdb_test "p *$" { = { = {a = 8, x = 9}, b = 10, x2 = 11}} \ - "dereference return value" + # Finishing out of foo will create a value that will later need to + # be preserved when restarting the program. + gdb_test "finish" "= \\(class B \\*\\) ${::hex} .*" "finish out of foo" -# The original PR28030 reproducer stepped back into the shared object, -# so we'll do the same here: -gdb_test "step" "bar \\(.*" "step into bar" + # Dereferencing and printing the return value isn't necessary + # for reproducing the bug, but we should make sure that the + # return value is what we expect it to be. + gdb_test "p *$" { = { = {a = 8, x = 9}, b = 10, x2 = 11}} \ + "dereference return value" + # The original PR28030 reproducer stepped back into the shared object, + # so we'll do the same here: + gdb_test "step" "bar \\(.*" "step into bar" +} ### Third GDB session. -# We don't want a clean restart here since that will be too clean. -# The original reproducer for PR28030 set a breakpoint in the shared -# library and then restarted via "run". The command below does roughly -# the same thing. It's at this step that an internal error would -# occur for PR28030. The "message" argument tells runto to turn on -# the printing of PASSes while runto is doing its job. -runto "bar" message +with_test_prefix "third session" { + # We don't want a clean restart here since that will be too clean. + # The original reproducer for PR28030 set a breakpoint in the shared + # library and then restarted via "run". The command below does roughly + # the same thing. It's at this step that an internal error would + # occur for PR28030. The "message" argument tells runto to turn on + # the printing of PASSes while runto is doing its job. + runto "bar" message +} diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp index 34e0a2b9855..c525337990e 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp @@ -46,204 +46,219 @@ if { [skip_python_tests] } { continue } # Test FinishBreakpoint in normal conditions # -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "normal conditions" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} -if ![runto_main] then { - return 0 -} + if ![runto_main] then { + return 0 + } -set python_file [gdb_remote_download host \ - ${srcdir}/${subdir}/${testfile}.py] + set python_file [gdb_remote_download host \ + ${srcdir}/${subdir}/${testfile}.py] -gdb_test_no_output "set confirm off" "disable confirmation" -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 1" -gdb_breakpoint "increase_1" -gdb_test "continue" "Breakpoint .*at.*" "continue to the function to finish" + gdb_test_no_output "set confirm off" "disable confirmation" + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" + gdb_breakpoint "increase_1" + gdb_test "continue" "Breakpoint .*at.*" "continue to the function to finish" -# set FinishBreakpoint + # set FinishBreakpoint -gdb_test "python finishbp_default = gdb.FinishBreakpoint ()" \ - "Temporary breakpoint.*" "set FinishBreakpoint with default frame value" -gdb_test "python finishbp = MyFinishBreakpoint (gdb.parse_and_eval ('a'), gdb.newest_frame ())" \ - "Temporary breakpoint.*" "set FinishBreakpoint" -gdb_test "python print (finishbp.return_value)" "None.*" \ - "check return_value at init" + gdb_test "python finishbp_default = gdb.FinishBreakpoint ()" \ + "Temporary breakpoint.*" "set FinishBreakpoint with default frame value" + gdb_test "python finishbp = MyFinishBreakpoint (gdb.parse_and_eval ('a'), gdb.newest_frame ())" \ + "Temporary breakpoint.*" "set FinishBreakpoint" + gdb_test "python print (finishbp.return_value)" "None.*" \ + "check return_value at init" -# check normal bp hit + # check normal bp hit -gdb_test "continue" "MyFinishBreakpoint stop with.*return_value is: -5.*#0.*increase.*" \ - "check MyFinishBreakpoint hit" -gdb_test "python print (finishbp.return_value)" "-5.*" "check return_value" + gdb_test "continue" "MyFinishBreakpoint stop with.*return_value is: -5.*#0.*increase.*" \ + "check MyFinishBreakpoint hit" + gdb_test "python print (finishbp.return_value)" "-5.*" "check return_value" -gdb_test "python print (finishbp_default.hit_count)" "1.*" "check finishBP on default frame has been hit" -gdb_test "python print (finishbp.is_valid())" "False.*"\ - "ensure that finish bp is invalid afer normal hit" + gdb_test "python print (finishbp_default.hit_count)" "1.*" "check finishBP on default frame has been hit" + gdb_test "python print (finishbp.is_valid())" "False.*"\ + "ensure that finish bp is invalid afer normal hit" -# check FinishBreakpoint in main no allowed + # check FinishBreakpoint in main no allowed -gdb_test "finish" "main.*" "return to main()" -gdb_test "python MyFinishBreakpoint (None, gdb.selected_frame ())" \ - "ValueError: \"FinishBreakpoint\" not meaningful in the outermost frame..*" \ - "check FinishBP not allowed in main" + gdb_test "finish" "main.*" "return to main()" + gdb_test "python MyFinishBreakpoint (None, gdb.selected_frame ())" \ + "ValueError: \"FinishBreakpoint\" not meaningful in the outermost frame..*" \ + "check FinishBP not allowed in main" +} # # Test FinishBreakpoint with no debug symbol # -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "no debug symbol" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 2" -set cond_line [gdb_get_line_number "Condition Break."] + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" + set cond_line [gdb_get_line_number "Condition Break."] -if ![runto_main] then { - return 0 -} + if ![runto_main] then { + return 0 + } -gdb_test "print do_nothing" "no debug info.*" "ensure that shared lib has no debug info" -gdb_breakpoint "do_nothing" {temporary} -gdb_test "continue" "Temporary breakpoint .*in \\.?do_nothing.*" \ - "continue to do_nothing" + gdb_test "print do_nothing" "no debug info.*" "ensure that shared lib has no debug info" + gdb_breakpoint "do_nothing" {temporary} + gdb_test "continue" "Temporary breakpoint .*in \\.?do_nothing.*" \ + "continue to do_nothing" -gdb_test "python finishBP = SimpleFinishBreakpoint(gdb.newest_frame())" \ - "SimpleFinishBreakpoint init" \ - "set finish breakpoint for no debug symbol test" -gdb_test "continue" "SimpleFinishBreakpoint stop.*" "check FinishBreakpoint hit" -gdb_test "python print (finishBP.return_value)" "None" "check return value without debug symbol" + gdb_test "python finishBP = SimpleFinishBreakpoint(gdb.newest_frame())" \ + "SimpleFinishBreakpoint init" \ + "set finish breakpoint for no debug symbol test" + gdb_test "continue" "SimpleFinishBreakpoint stop.*" "check FinishBreakpoint hit" + gdb_test "python print (finishBP.return_value)" "None" "check return value" +} # # Test FinishBreakpoint in function returned by longjmp # -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} - -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 3" - -if ![runto call_longjmp_1] then { - return +with_test_prefix "function returned by longjump" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} + + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" + + if ![runto call_longjmp_1] then { + return + } + + gdb_test "python finishbp = SimpleFinishBreakpoint(gdb.newest_frame())" \ + "SimpleFinishBreakpoint init" \ + "set finish breakpoint for longjmp test" + gdb_test "break [gdb_get_line_number "after longjmp."]" "Breakpoint.* at .*" \ + "set BP after the jump" + gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" \ + "check FinishBP out of scope notification" + gdb_test "python print (finishbp.is_valid())" "False.*"\ + "ensure that finish bp is invalid after out of scope notification" } -gdb_test "python finishbp = SimpleFinishBreakpoint(gdb.newest_frame())" \ - "SimpleFinishBreakpoint init" \ - "set finish breakpoint for longjmp test" -gdb_test "break [gdb_get_line_number "after longjmp."]" "Breakpoint.* at .*" \ - "set BP after the jump" -gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" \ - "check FinishBP out of scope notification" -gdb_test "python print (finishbp.is_valid())" "False.*"\ - "ensure that finish bp is invalid afer out of scope notification" - # # Test FinishBreakpoint in BP condition evaluation # (finish in dummy frame) # -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "finish in dummy frame" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 4" + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" -if ![runto_main] then { - return 0 + if ![runto_main] then { + return 0 + } + + gdb_test "break ${cond_line} if test_1(i,8)" "Breakpoint .* at .*" \ + "set a conditional BP" + gdb_test "python TestBreakpoint()" "TestBreakpoint init" \ + "set FinishBP in a breakpoint condition" + gdb_test "continue" \ + "\"FinishBreakpoint\" cannot be set on a dummy frame.*" \ + "don't allow FinishBreakpoint on dummy frames" + gdb_test "print i" "8" \ + "check stopped location" } - -gdb_test "break ${cond_line} if test_1(i,8)" "Breakpoint .* at .*" \ - "set a conditional BP" -gdb_test "python TestBreakpoint()" "TestBreakpoint init" \ - "set FinishBP in a breakpoint condition" -gdb_test "continue" \ - "\"FinishBreakpoint\" cannot be set on a dummy frame.*" \ - "don't allow FinishBreakpoint on dummy frames" -gdb_test "print i" "8" \ - "check stopped location for stop in dummy frame case" # # Test FinishBreakpoint in BP condition evaluation # (finish in normal frame) # -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "finish in normal frame" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 5" + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" -if ![runto_main] then { - return 0 -} + if ![runto_main] then { + return 0 + } -gdb_test "break ${cond_line} if test(i,8)" \ - "Breakpoint .* at .*" "set conditional BP" -gdb_test "python TestBreakpoint()" "TestBreakpoint init" "set BP in condition" + gdb_test "break ${cond_line} if test(i,8)" \ + "Breakpoint .* at .*" "set conditional BP" + gdb_test "python TestBreakpoint()" "TestBreakpoint init" "set BP in condition" -gdb_test "continue" \ - "test don't stop: 1.*test don't stop: 2.*test stop.*Error in testing breakpoint condition.*The program being debugged stopped while in a function called from GDB.*" \ - "stop in condition function" + gdb_test "continue" \ + "test don't stop: 1.*test don't stop: 2.*test stop.*Error in testing breakpoint condition.*The program being debugged stopped while in a function called from GDB.*" \ + "stop in condition function" -gdb_test "continue" "Continuing.*" "finish condition evaluation" -gdb_test "continue" "Breakpoint.*" "stop at conditional breakpoint" -gdb_test "print i" "8" \ - "check stopped location for stop in normal frame case" + gdb_test "continue" "Continuing.*" "finish condition evaluation" + gdb_test "continue" "Breakpoint.*" "stop at conditional breakpoint" + gdb_test "print i" "8" \ + "check stopped location" +} # # Test FinishBreakpoint in explicit inferior function call # -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} - -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 6" +with_test_prefix "explicit inferior function call" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} -if ![runto_main] then { - return 0 -} + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" -# return address in dummy frame + if ![runto_main] then { + return 0 + } -gdb_test "python TestExplicitBreakpoint('increase_1')" "Breakpoint.*at.*" \ - "prepare TestExplicitBreakpoint, return addr in dummy frame" -gdb_test "print increase_1(&i)" \ - "\"FinishBreakpoint\" cannot be set on a dummy frame.*" \ - "don't allow FinishBreakpoint on dummy frames, return address in dummy frame" + # return address in dummy frame -# return address in normal frame + gdb_test "python TestExplicitBreakpoint('increase_1')" "Breakpoint.*at.*" \ + "prepare TestExplicitBreakpoint, return addr in dummy frame" + gdb_test "print increase_1(&i)" \ + "\"FinishBreakpoint\" cannot be set on a dummy frame.*" \ + "don't allow FinishBreakpoint on dummy frames, return address in dummy frame" -delete_breakpoints -gdb_test "python TestExplicitBreakpoint(\"increase_1\")" "Breakpoint.*at.*" \ - "prepare TestExplicitBreakpoint, return addr in normal frame" -gdb_test "print increase(&i)" \ - "SimpleFinishBreakpoint init.*SimpleFinishBreakpoint stop.*The program being debugged stopped while in a function called from GDB.*" \ - "FinishBP stop at during explicit function call" + # return address in normal frame + delete_breakpoints + gdb_test "python TestExplicitBreakpoint(\"increase_1\")" "Breakpoint.*at.*" \ + "prepare TestExplicitBreakpoint, return addr in normal frame" + gdb_test "print increase(&i)" \ + "SimpleFinishBreakpoint init.*SimpleFinishBreakpoint stop.*The program being debugged stopped while in a function called from GDB.*" \ + "FinishBP stop" +} # # Test FinishBreakpoint when inferior exits # -if ![runto "test_exec_exit"] then { - return 0 -} +with_test_prefix "inferior exit" { + if ![runto "test_exec_exit"] then { + return 0 + } -gdb_test_no_output "set var self_exec = 0" "switch to exit() test" -gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exit()" -gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exit" + gdb_test_no_output "set var self_exec = 0" "switch to exit() test" + gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exit()" + gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exit" +} # # Test FinishBreakpoint when inferior execs # -if ![runto "test_exec_exit"] then { - return 0 -} +with_test_prefix "inferior exec" { + if ![runto "test_exec_exit"] then { + return 0 + } -gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exec" -gdb_test "catch exec" "Catchpoint.*\(exec\).*" -gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exec" + gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exec" + gdb_test "catch exec" "Catchpoint.*\(exec\).*" + gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exec" +}