2012-02-21 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / break-interp.exp
index d60bc718e0958fc94cb3f34a6b9d0fc02f0df696..59e5753426eab1b6de8569e74ae01cd8a968aa63 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2010, 2011 Free Software Foundation, Inc.
+# Copyright 2010-2012 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -155,7 +155,7 @@ proc reach_1 {func command displacement} {
                pass $test
            }
        }
-       -re "Stopped due to shared library event\r\n$gdb_prompt $" {
+       -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" {
            if {$func == "_dl_debug_state"} {
                if {$debug_state_count == 0} {
                    # First stop does not yet relocate the _start function
@@ -185,16 +185,12 @@ proc reach_1 {func command displacement} {
 # displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
 # bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
 proc reach {func command displacement} {
-    global pf_prefix
-    set old_ldprefix $pf_prefix
-    lappend pf_prefix "reach-$func:"
-
-    reach_1 $func $command $displacement
-
-    set pf_prefix $old_ldprefix
+    with_test_prefix "reach-$func" {
+       reach_1 $func $command $displacement
+    }
 }
 
-proc test_core {file displacement} {
+proc test_core {file displacement} { with_test_prefix "core" {
     global srcdir subdir gdb_prompt expect_out
 
     set corefile [core_find $file {} "segv"]
@@ -202,10 +198,6 @@ proc test_core {file displacement} {
        return
     }
 
-    global pf_prefix
-    set old_ldprefix $pf_prefix
-    lappend pf_prefix "core:"
-
     gdb_exit
     gdb_start
     # Clear it to never find any separate debug infos in $debug_root.
@@ -245,26 +237,18 @@ proc test_core {file displacement} {
     }
 
     gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
+}}
 
-    set pf_prefix $old_ldprefix
-}
-
-proc test_attach_gdb {file pid displacement prefix} {
+proc test_attach_gdb {file pid displacement prefix} { with_test_prefix "$prefix" {
     global gdb_prompt expect_out
 
-    global pf_prefix
-    set old_ldprefix $pf_prefix
-    lappend pf_prefix "$prefix:"
-
     gdb_exit
     gdb_start
 
     # Print the "PIE (Position Independent Executable) displacement" message.
     gdb_test_no_output "set verbose on"
 
-    if {$file != ""} {
-       gdb_test "file $file" "Reading symbols from .*done\\." "file"
-    }
+    gdb_test "file $file" "Reading symbols from .*done\\." "file"
 
     set test "attach"
     gdb_test_multiple "attach $pid" $test {
@@ -302,12 +286,11 @@ proc test_attach_gdb {file pid displacement prefix} {
 
     gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
     gdb_exit
-
-    set pf_prefix $old_ldprefix
-}
+}}
 
 proc test_attach {file displacement {relink_args ""}} {
     global board_info
+    global exec
 
     gdb_exit
 
@@ -336,10 +319,10 @@ proc test_attach {file displacement {relink_args ""}} {
     }
 
     if {$relink_args == ""} {
-       test_attach_gdb "" $pid $displacement "attach"
+       test_attach_gdb $exec $pid $displacement "attach"
     } else {
        # These could be rather passed as arguments.
-       global exec interp_saved interp
+       global interp_saved interp
 
        foreach relink {YES NO} {
            # Formerly this test was testing only prelinking of $EXEC.  As the
@@ -430,7 +413,7 @@ proc test_ld {file ifmain trynosym displacement} {
 
     global pf_prefix
     set old_ldprefix $pf_prefix
-    lappend pf_prefix "symbol-less:"
+    append pf_prefix " symbol-less:"
 
     # Test also `exec-file'-command loaded $FILE - therefore without symbols.
     # SYMBOL_OBJFILE is not available and only EXEC_BFD must be used.
@@ -545,7 +528,7 @@ foreach ldprelink {NO YES} {
        set interp_saved ${interp}-saved
 
        set pf_prefix $old_ldprefix
-       lappend pf_prefix "$ldname:"
+       append pf_prefix " $ldname:"
 
        if {$ldsepdebug == "NO"} {
            file_copy $interp_system $interp
@@ -627,7 +610,7 @@ foreach ldprelink {NO YES} {
                    set exec $binprefix-$binname
 
                    set pf_prefix $old_binprefix
-                   lappend pf_prefix "$binname:"
+                   append pf_prefix " $binname:"
 
                    set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]"
                    if {$binsepdebug != "NO"} {
This page took 0.025922 seconds and 4 git commands to generate.