Add support for inlining scripts into .debug_gdb_scripts.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.guile / scm-section-script.exp
index 93a10a0d462bac55bebf1205869a5fa0459cfb32..8c04ac80b796bec39a40e49f22731c9e46fa702d 100644 (file)
@@ -53,14 +53,51 @@ gdb_start
 if { [skip_guile_tests] } { continue }
 
 gdb_reinitialize_dir $srcdir/$subdir
-gdb_test_no_output "set auto-load safe-path ${remote_guile_file}" \
+
+# Try first with a restrictive safe-path.
+
+gdb_test_no_output "set auto-load safe-path /restricted" \
+    "set restricted auto-load safe-path"
+gdb_load ${binfile}
+
+# Verify gdb did not load the scripts.
+set test_name "verify scripts not loaded"
+gdb_test_multiple "info auto-load guile-scripts" "$test_name" {
+    -re "Yes.*${testfile}.scm.*Yes.*inlined-script.*$gdb_prompt $" {
+       fail "$test_name"
+    }
+    -re "No.*${testfile}.scm.*No.*inlined-script.*$gdb_prompt $" {
+       pass "$test_name"
+    }
+}
+
+# Try again with a working safe-path.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_test_no_output "set auto-load safe-path ${remote_guile_file}:${binfile}" \
     "set auto-load safe-path"
 gdb_load ${binfile}
 
-# Verify gdb loaded the script.
-gdb_test "info auto-load guile-scripts" "Yes.*${testfile}.scm.*"
+# Verify gdb loaded each script and they appear once in the list.
+set test_name "verify scripts loaded"
+gdb_test_multiple "info auto-load guile-scripts" "$test_name" {
+    -re "${testfile}.scm.*${testfile}.scm.*$gdb_prompt $" {
+       fail "$test_name"
+    }
+    -re "inlined-script.*inlined-script.*$gdb_prompt $" {
+       fail "$test_name"
+    }
+    -re "Yes.*${testfile}.scm.*Yes.*inlined-script.*$gdb_prompt $" {
+       pass "$test_name"
+    }
+}
+
 # Again, with a regexp this time.
 gdb_test "info auto-load guile-scripts ${testfile}" "Yes.*${testfile}.scm.*"
+
 # Again, with a regexp that matches no scripts.
 gdb_test "info auto-load guile-scripts no-script-matches-this" \
   "No auto-load scripts matching no-script-matches-this."
@@ -74,3 +111,5 @@ gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \
 gdb_test "continue" ".*Breakpoint.*"
 
 gdb_test "print ss" " = a=<1> b=<2>"
+
+gdb_test "test-cmd 1 2 3" "test-cmd output, arg = 1 2 3"
This page took 0.026123 seconds and 4 git commands to generate.