gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / break-interp.exp
index d225b6c8656f50dedcba962b52dde20b70f5dddf..d2799489b7eaa5cb50798d3b9e298da00ce1fd93 100644 (file)
@@ -223,7 +223,7 @@ proc reach {func command} {
     }
 }
 
-proc test_ld {file ifmain} {
+proc test_ld {file ifmain trynosym} {
     global srcdir subdir gdb_prompt
 
     # First test normal `file'-command loaded $FILE with symbols.
@@ -239,6 +239,50 @@ proc test_ld {file ifmain} {
     if $ifmain {
        reach "main" continue
     }
+
+    if !$trynosym {
+       return
+    }
+
+    global pf_prefix
+    set old_ldprefix $pf_prefix
+    lappend 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.
+
+    gdb_exit
+    gdb_start
+    # Clear it to never find any separate debug infos in $debug_root.
+    gdb_test "set debug-file-directory"
+    gdb_reinitialize_dir $srcdir/$subdir
+
+    # Test no (error) message has been printed by `exec-file'.
+    set escapedfile [string_to_regexp $file]
+    gdb_test "exec-file $file" "exec-file $escapedfile" "load"
+
+    if $ifmain {
+       reach "dl_main" run
+
+       set test "info files"
+       set entrynohex ""
+       gdb_test_multiple $test $test {
+           -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n.*$gdb_prompt $" {
+               set entrynohex $expect_out(1,string) 
+               pass $test
+           }
+       }
+       if {$entrynohex != ""} {
+           gdb_test "break *0x$entrynohex" "" "break at entry point"
+           gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
+       }
+    } else {
+       # There is no symbol to break at ld.so.  Moreover it can exit with an
+       # error code.
+       gdb_test "run" "Program exited (normally|with code \[0-9\]+)\\." "ld.so exit"
+    }
+
+    set pf_prefix $old_ldprefix
 }
 
 # Create separate binaries for each testcase - to make the possible reported
@@ -322,7 +366,7 @@ foreach ldprelink {NO YES} {
        if ![prelink$ldprelink $interp] {
            continue
        }
-       test_ld $interp 0
+       test_ld $interp 0 [expr {$ldsepdebug == "NO"}]
 
        if ![copy $interp $interp_saved] {
            continue
@@ -401,7 +445,7 @@ foreach ldprelink {NO YES} {
 
                    if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" $exec]
                        && [copy $interp_saved $interp]} {
-                       test_ld $exec 1
+                       test_ld $exec 1 [expr {$binsepdebug == "NO"}]
                    }
                }
            }
This page took 0.025986 seconds and 4 git commands to generate.