aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/inline-frame.c16
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.opt/inline-break.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-break.exp42
5 files changed, 66 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4c04d0b..3ed5cf3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-29 Pedro Alves <palves@redhat.com>
+
+ * inline-frame.c (stopped_by_user_bp_inline_frame): Return
+ true if the the location has no symbol.
+
2018-06-28 Tom Tromey <tom@tromey.com>
* NEWS: Mention --enable-codesign.
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index 896b000..c6caf9d 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -300,10 +300,18 @@ stopped_by_user_bp_inline_frame (const block *frame_block, bpstat stop_chain)
bp_location *loc = s->bp_location_at;
enum bp_loc_type t = loc->loc_type;
- if ((t == bp_loc_software_breakpoint
- || t == bp_loc_hardware_breakpoint)
- && frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
- return true;
+ if (t == bp_loc_software_breakpoint
+ || t == bp_loc_hardware_breakpoint)
+ {
+ /* If the location has a function symbol, check whether
+ the frame was for that inlined function. If it has
+ no function symbol, then assume it is. I.e., default
+ to presenting the stop at the innermost inline
+ function. */
+ if (loc->symbol == nullptr
+ || frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
+ return true;
+ }
}
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d16f33a..3d93d32 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-29 Pedro Alves <palves@redhat.com>
+
+ * gdb.opt/inline-break.c (func1): Add "break here" marker.
+ * gdb.opt/inline-break.exp: Test setting breakpoints by line
+ number and address and running to them.
+
2018-06-29 Richard Bunt <richard.bunt@arm.com>
* gdb.base/watchpoint-hw-attach.exp: Remove unstable output.
diff --git a/gdb/testsuite/gdb.opt/inline-break.c b/gdb/testsuite/gdb.opt/inline-break.c
index f64a81a..d477929 100644
--- a/gdb/testsuite/gdb.opt/inline-break.c
+++ b/gdb/testsuite/gdb.opt/inline-break.c
@@ -29,7 +29,7 @@
static inline ATTR int
func1 (int x)
{
- return x * 23;
+ return x * 23; /* break here */
}
/* A non-static inlined function that is called once. */
diff --git a/gdb/testsuite/gdb.opt/inline-break.exp b/gdb/testsuite/gdb.opt/inline-break.exp
index bae7625..46ef6f1 100644
--- a/gdb/testsuite/gdb.opt/inline-break.exp
+++ b/gdb/testsuite/gdb.opt/inline-break.exp
@@ -256,4 +256,46 @@ foreach_with_prefix func {
"breakpoint hit presents stop at breakpointed function"
}
+# Test setting a breakpoint in an inline function by line number and
+# by address, and that GDB presents the stop there.
+
+set line [gdb_get_line_number "break here"]
+
+with_test_prefix "line number" {
+ clean_restart $binfile
+
+ if {![runto main]} {
+ untested "could not run to main"
+ continue
+ }
+
+ # Set the breakpoint by line number, and check that GDB reports
+ # the breakpoint location being the inline function.
+ gdb_test "break $srcfile:$line" ".*Breakpoint .* at .*: file .*$srcfile, line $line."
+ gdb_test "continue" "Breakpoint .*, func1 \\(x=1\\) at .*$srcfile:$line.*break here.*" \
+ "breakpoint hit presents stop at inlined function"
+
+ # Save the PC for the following by-address test.
+ set address [get_hexadecimal_valueof "\$pc" "0"]
+}
+
+# Test setting a breakpoint in an inline function by address, and that
+# GDB presents the stop there.
+
+with_test_prefix "address" {
+
+ clean_restart $binfile
+
+ if {![runto main]} {
+ untested "could not run to main"
+ continue
+ }
+
+ # Set the breakpoint by address, and check that GDB reports the
+ # breakpoint location being the inline function.
+ gdb_test "break *$address" ".*Breakpoint .* at $address: file .*$srcfile, line $line."
+ gdb_test "continue" "Breakpoint .*, func1 \\(x=1\\) at .*$srcfile:$line.*break here.*" \
+ "breakpoint hit presents stop at inlined function"
+}
+
unset -nocomplain results