aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/break.exp
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-01-27 15:12:25 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-02-02 16:27:36 +0000
commita591084285cc16a435258641691aa0a8f5bf42ee (patch)
treeb096fa3b9073303942ef7c20070bef1092648ae5 /gdb/testsuite/gdb.base/break.exp
parent82d0a72cdc9ca6cd37a8987e2bcd2eb707c51149 (diff)
downloadfsf-binutils-gdb-a591084285cc16a435258641691aa0a8f5bf42ee.zip
fsf-binutils-gdb-a591084285cc16a435258641691aa0a8f5bf42ee.tar.gz
fsf-binutils-gdb-a591084285cc16a435258641691aa0a8f5bf42ee.tar.bz2
gdb: test to check one aspect of the linespec parsing code
While working on the fix for PR cli/28665 (see previous couple of commits), I was playing with making a change in the linespec parsing code. Specifically, I was thinking about whether the spec_string for LINESPEC_LOCATION locations should ever be nullptr. I made a change to prevent the spec_string from ever being nullptr, tested gdb, and saw no regressions. However, as part of this work I was reviewing how the breakpoint code handles this case (spec_string being nullptr), and spotted that in parse_breakpoint_sals the nullptr case is specifically handled, so changing this should have caused a regression. But I didn't see one. So, this commit adds a comment in location.c mentioning that the nullptr case is (a) not an oversight, and (b) is required. Then I add a new test to gdb.base/break.exp that ensures a change in this area will cause a regression. This test passes on current gdb, but with my modified (and broken) gdb, the test would fail.
Diffstat (limited to 'gdb/testsuite/gdb.base/break.exp')
-rw-r--r--gdb/testsuite/gdb.base/break.exp5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index 39a8f32..2c939ad 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -520,6 +520,11 @@ gdb_test "break" \
"Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
"break on default location, 4th time"
+# Check setting a breakpoint at the default location with a condition attached.
+gdb_test "break if (1)" \
+ "Note: breakpoints \[0-9\]*, \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
+ "break on the default location, 5th time, but with a condition"
+
# Verify that a "silent" breakpoint can be set, and that GDB is indeed
# "silent" about its triggering.
#