From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 5F0D93858C56; Fri, 7 Oct 2022 14:17:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F0D93858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665152265; bh=cmX4xEGTo1uN6ZjJFkMd8vo7JA1qSZf3oU9L1qS3yeM=; h=From:To:Subject:Date:From; b=dbHcedKUYe16aEPx+MJhDVKzm4Bf3ZNjkxCMNuvIRLmmoBQGi5BFm36QoyTJzF1n0 iE6ZskcnT+pZ2ROw1W02mF1wkWNUuSrivcX5Lz+T0tGOkTz2JMWxEebJr102oaObHt bunDT6cUGAjEF7Xv7gVNCqJzf3QPo6hTRAJ1umew= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix DUPLICATEs with remote-gdbserver-on-localhost X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 8ed73e316466987d0d33ce9e21ebc8ff9aa4c4d7 X-Git-Newrev: 7fe3f841453c46b367aec9a130c3b6e0a580effa Message-Id: <20221007141745.5F0D93858C56@sourceware.org> Date: Fri, 7 Oct 2022 14:17:45 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7fe3f841453c= 46b367aec9a130c3b6e0a580effa commit 7fe3f841453c46b367aec9a130c3b6e0a580effa Author: Tom de Vries Date: Fri Oct 7 16:17:34 2022 +0200 [gdb/testsuite] Fix DUPLICATEs with remote-gdbserver-on-localhost =20 Fix some DUPLICATEs that we run into with target board remote-gdbserver-on-localhost, by using test_with_prefix. =20 Tested on x86_64-linux, with native and target board remote-gdbserver-on-localhost. Diff: --- 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.bas= e/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 } =20 -clean_restart ${binfile} -gdb_load_shlib ${binfile_lib} +with_test_prefix "first session" { + clean_restart ${binfile} + gdb_load_shlib ${binfile_lib} =20 -if ![runto lib] { - return -1 -} + if ![runto lib] { + return -1 + } =20 -if {![gdb_gcore_cmd $gcorefile "save a corefile"]} { - return -1 + if {![gdb_gcore_cmd $gcorefile "save a corefile"]} { + return -1 + } } =20 # Now restart gdb and load the corefile. =20 -clean_restart ${binfile} -gdb_load_shlib ${binfile_lib} +with_test_prefix "second session" { + clean_restart ${binfile} + gdb_load_shlib ${binfile_lib} =20 -gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated= corefile" + gdb_test "core ${gcorefile}" "Core was generated by .*" \ + "re-load generated corefile" =20 -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/pe= nding.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)" =20 -gdb_load ${binfile} -gdb_load_shlib $lib_sl +with_test_prefix "first load" { + gdb_load ${binfile} + gdb_load_shlib $lib_sl +} =20 set pendfunc1_loc [gdb_get_line_number "y =3D x + 4" ${libfile}.c] =20 @@ -74,8 +76,10 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir =20 -gdb_load ${binfile} -gdb_load_shlib $lib_sl +with_test_prefix "second load" { + gdb_load ${binfile} + gdb_load_shlib $lib_sl +} =20 # # 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 } =20 - 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 =20 - runto_main + runto_main =20 - gdb_breakpoint "bar" + gdb_breakpoint "bar" =20 - gdb_test "continue" "Breakpoint .* \\.?bar .*${expected_file}\\..*" \ - "run to breakpoint - $testopts" + gdb_test "continue" "Breakpoint .* \\.?bar .*${expected_file}\\..*" \ + "run to breakpoint" + } } =20 foreach lib1opts {{} {debug}} { diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gd= b/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 } =20 -# Do whatever is necessary to make sure that the shared library is -# loaded for remote targets. -gdb_load_shlib ${lib_so} +### First GDB session. =20 +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} =20 -### First GDB session. + # Run to foo to make sure foo refers to the function, and not foo@PLT. + if ![runto foo qualified] then { + return + } =20 -# Run to foo to make sure foo refers to the function, and not foo@PLT. -if ![runto foo qualified] then { - return -} + with_shared_gdb { =20 -with_shared_gdb { + set session_options $exec_options =20 - 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 =20 - # 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 =20 - 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] =20 - # 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] + } =20 - # 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] } =20 if { $long_size =3D=3D -1 || $addr_size =3D=3D -1 \ @@ -326,40 +327,43 @@ if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_= so \ =20 ### Second GDB session. =20 -clean_restart $binfile +with_test_prefix "second session" { + clean_restart $binfile =20 -# 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} =20 -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 + } =20 -# Finishing out of foo will create a value that will later need to -# be preserved when restarting the program. -gdb_test "finish" "=3D \\(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" =20 -# 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 *$" { =3D { =3D {a =3D 8, x =3D 9}, b =3D 10, x2 =3D 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" "=3D \\(class B \\*\\) ${::hex} .*" "finish out of f= oo" =20 -# 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 *$" { =3D { =3D {a =3D 8, x =3D 9}, b =3D 10, x2 =3D 11= }} \ + "dereference return value" =20 + # The original PR28030 reproducer stepped back into the shared object, + # so we'll do the same here: + gdb_test "step" "bar \\(.*" "step into bar" +} =20 ### Third GDB session. =20 -# 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/testsu= ite/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 # =20 -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "normal conditions" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} =20 -if ![runto_main] then { - return 0 -} + if ![runto_main] then { + return 0 + } =20 -set python_file [gdb_remote_download host \ - ${srcdir}/${subdir}/${testfile}.py] + set python_file [gdb_remote_download host \ + ${srcdir}/${subdir}/${testfile}.py] =20 -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 finis= h" + 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 f= inish" =20 -# set FinishBreakpoint + # set FinishBreakpoint =20 -gdb_test "python finishbp_default =3D gdb.FinishBreakpoint ()" \ - "Temporary breakpoint.*" "set FinishBreakpoint with default frame= value" -gdb_test "python finishbp =3D 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 =3D gdb.FinishBreakpoint ()" \ + "Temporary breakpoint.*" "set FinishBreakpoint with default frame value" + gdb_test "python finishbp =3D 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" =20 -# check normal bp hit + # check normal bp hit =20 -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_v= alue" =20 -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 fini= shBP on default frame has been hit" + gdb_test "python print (finishbp.is_valid())" "False.*"\ + "ensure that finish bp is invalid afer normal hit" =20 -# check FinishBreakpoint in main no allowed + # check FinishBreakpoint in main no allowed =20 -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" +} =20 # # Test FinishBreakpoint with no debug symbol=20 # =20 -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "no debug symbol" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} =20 -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."] =20 -if ![runto_main] then { - return 0 -} + if ![runto_main] then { + return 0 + } =20 -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" =20 -gdb_test "python finishBP =3D SimpleFinishBreakpoint(gdb.newest_frame())" \ - "SimpleFinishBreakpoint init" \ - "set finish breakpoint for no debug symbol test" -gdb_test "continue" "SimpleFinishBreakpoint stop.*" "check FinishBreakpoin= t hit" -gdb_test "python print (finishBP.return_value)" "None" "check return value= without debug symbol" + gdb_test "python finishBP =3D SimpleFinishBreakpoint(gdb.newest_frame(= ))" \ + "SimpleFinishBreakpoint init" \ + "set finish breakpoint for no debug symbol test" + gdb_test "continue" "SimpleFinishBreakpoint stop.*" "check FinishBreak= point hit" + gdb_test "python print (finishBP.return_value)" "None" "check return v= alue" +} =20 # # Test FinishBreakpoint in function returned by longjmp=20 # =20 -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 =3D 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" } =20 -gdb_test "python finishbp =3D 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=20 # (finish in dummy frame) # =20 -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "finish in dummy frame" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} =20 -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 4" + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" =20 =20 -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" } - =20 -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" =20 # # Test FinishBreakpoint in BP condition evaluation=20 # (finish in normal frame) # =20 -clean_restart ${testfile} -gdb_load_shlib ${lib_sl} +with_test_prefix "finish in normal frame" { + clean_restart ${testfile} + gdb_load_shlib ${lib_sl} =20 -gdb_test "source $python_file" "Python script imported.*" \ - "import python scripts, 5" + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" =20 -if ![runto_main] then { - return 0 -} + if ![runto_main] then { + return 0 + } =20 -gdb_test "break ${cond_line} if test(i,8)" \ - "Breakpoint .* at .*" "set conditional BP" -gdb_test "python TestBreakpoint()" "TestBreakpoint init" "set BP in condit= ion" + gdb_test "break ${cond_line} if test(i,8)" \ + "Breakpoint .* at .*" "set conditional BP" + gdb_test "python TestBreakpoint()" "TestBreakpoint init" "set BP in co= ndition" =20 -gdb_test "continue" \ - "test don't stop: 1.*test don't stop: 2.*test stop.*Error in test= ing breakpoint condition.*The program being debugged stopped while in a fun= ction 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 brea= kpoint condition.*The program being debugged stopped while in a function ca= lled from GDB.*" \ + "stop in condition function" =20 -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" +} =20 # # Test FinishBreakpoint in explicit inferior function call # =20 -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} =20 -if ![runto_main] then { - return 0 -} + gdb_test "source $python_file" "Python script imported.*" \ + "import python scripts" =20 -# return address in dummy frame + if ![runto_main] then { + return 0 + } =20 -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 =20 -# 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 fr= ame" =20 -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 pr= ogram being debugged stopped while in a function called from GDB.*" \ - "FinishBP stop at during explicit function call" + # return address in normal frame =20 + 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 be= ing debugged stopped while in a function called from GDB.*" \ + "FinishBP stop" +} =20 # # Test FinishBreakpoint when inferior exits # =20 -if ![runto "test_exec_exit"] then { - return 0 -} +with_test_prefix "inferior exit" { + if ![runto "test_exec_exit"] then { + return 0 + } =20 -gdb_test_no_output "set var self_exec =3D 0" "switch to exit() test" -gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinish= Breakpoint 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 =3D 0" "switch to exit() test" + gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFi= nishBreakpoint init" "set FinishBP after the exit()" + gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out= of scope after exit" +} =20 # # Test FinishBreakpoint when inferior execs # =20 -if ![runto "test_exec_exit"] then { - return 0 -} =20 +with_test_prefix "inferior exec" { + if ![runto "test_exec_exit"] then { + return 0 + } =20 -gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinish= Breakpoint 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())" "SimpleFi= nishBreakpoint 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" +}