Fix scripted probe breakpoints
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.guile / scm-breakpoint.exp
index d181710f8f373164bdfc6445f7564739bba00f7f..183ad1671f5997706421c91eb3a6191d28f77189 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2014 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 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
@@ -20,7 +20,7 @@ load_lib gdb-guile.exp
 
 standard_testfile
 
-if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
@@ -126,7 +126,7 @@ proc test_bkpt_deletion { } {
        gdb_test "guile (print (length del-list))" \
            "= 3" "number of breakpoints before delete"
        gdb_continue_to_breakpoint "Break at multiply." \
-           ".*/$srcfile:$deltst_location.*"
+           ".*$srcfile:$deltst_location.*"
        gdb_scm_test_silent_cmd  "guile (delete-breakpoint! dp1)" \
            "delete breakpoint"
        gdb_test "guile (print (breakpoint-number dp1))" \
@@ -136,7 +136,7 @@ proc test_bkpt_deletion { } {
            "get breakpoint list 5"
        gdb_test "guile (print (length del-list))" \
            "= 2" "number of breakpoints after delete"
-       gdb_continue_to_breakpoint "Break at end." ".*/$srcfile:$end_location.*"
+       gdb_continue_to_breakpoint "Break at end." ".*$srcfile:$end_location.*"
     }
 }
 
@@ -372,7 +372,7 @@ proc test_bkpt_eval_funcs { } {
            "create also-eval-bp1 breakpoint"
        gdb_scm_test_silent_cmd  "guile (define never-eval-bp1 (make-bp-also-eval \"$end_location\"))" \
            "create never-eval-bp1 breakpoint"
-       gdb_continue_to_breakpoint "Break at multiply." ".*/$srcfile:$bp_location2.*"
+       gdb_continue_to_breakpoint "Break at multiply." ".*$srcfile:$bp_location2.*"
        gdb_test "print i" "3" "check inferior value matches guile accounting"
        gdb_test "guile (print (bp-eval-inf-i eval-bp1))" \
            "= 3" "check guile accounting matches inferior"
@@ -414,7 +414,7 @@ proc test_bkpt_eval_funcs { } {
        gdb_test "guile (print (bp-eval-count check-eval))" \
            "= 0" \
            "test that evaluate function has not been yet executed (ie count = 0)"
-       gdb_continue_to_breakpoint "Break at multiply." ".*/$srcfile:$bp_location2.*"
+       gdb_continue_to_breakpoint "Break at multiply." ".*$srcfile:$bp_location2.*"
        gdb_test "guile (print (bp-eval-count check-eval))" \
            "= 1" \
            "test that evaluate function is run when location also has normal bp"
@@ -487,6 +487,40 @@ proc test_bkpt_registration {} {
     }
 }
 
+proc test_bkpt_address {} {
+    global decimal srcfile
+
+    # Leading whitespace is intentional!
+    gdb_scm_test_silent_cmd \
+       "guile (define bp1 (make-breakpoint \"  *multiply\"))" \
+       "create address breakpoint a '  *multiply'" 1
+
+    gdb_test "guile (register-breakpoint! bp1)" \
+       ".*Breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\."
+}
+
+proc test_bkpt_probe {} {
+    global decimal hex testfile srcfile
+
+    if { [prepare_for_testing "failed to prepare" ${testfile}-probes \
+           ${srcfile} {additional_flags=-DUSE_PROBES}] } {
+       return -1
+    }
+
+    if ![gdb_guile_runto_main] then {
+       return
+    }
+
+    gdb_scm_test_silent_cmd \
+       "guile (define bp1 (make-breakpoint \"-probe test:result_updated\"))" \
+       "create probe breakpoint"
+
+    gdb_test \
+       "guile (register-breakpoint! bp1)" \
+       "Breakpoint $decimal at $hex" \
+       "register probe breakpoint"
+}
+
 test_bkpt_basic
 test_bkpt_deletion
 test_bkpt_cond_and_cmds
@@ -495,3 +529,5 @@ test_watchpoints
 test_bkpt_internal
 test_bkpt_eval_funcs
 test_bkpt_registration
+test_bkpt_address
+test_bkpt_probe
This page took 0.029922 seconds and 4 git commands to generate.