[PATCH] Fix for gdb.python/py-breakpoint.exp

Carl Love cel@us.ibm.com
Wed Jul 21 17:15:23 GMT 2021


GDB maintainers:

The following patch adds a check to make sure gdb has the needed
hardware break point support for the test.

This patch was tested on Power 9 and Intel without any regression
errors.
Please let me know if it is acceptable.
                            Carl Love

----------------------------------------------------

Fix for gdb.python/py-breakpoint.exp

Not all systems support the hardware breakpoint support.  Added a check
to see if the system supports hardware breakpoints.

gdb/testsuite/ChangeLog
2021-07-20  Carl Love  <cel@us.ibm.com>

	* gdb.python/py-breakpoint.exp: Add check for hardware breakpoint
	support.
---
 gdb/testsuite/gdb.python/py-breakpoint.exp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index d8fb85b784c..b4dcad07eec 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -29,6 +29,23 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${options}]
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
+set supports_hbreak 0
+set test "probe hardware breakpoint support"
+gdb_test_multiple "hbreak -q main" $test {
+    -re "No hardware breakpoint support in the target.*" {
+	pass $test
+    }
+    -re "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*" {
+	set supports_hbreak 1
+	pass $test
+    }
+}
+
+if {!$supports_hbreak} {
+    unsupported "hardware breakpoints"
+    return
+}
+
 proc_with_prefix test_bkpt_basic { } {
     global srcfile testfile hex decimal
 
-- 
2.17.1




More information about the Gdb-patches mailing list