aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.opt
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.opt')
-rw-r--r--gdb/testsuite/gdb.opt/inline-break.c34
-rw-r--r--gdb/testsuite/gdb.opt/inline-break.exp25
2 files changed, 59 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.opt/inline-break.c b/gdb/testsuite/gdb.opt/inline-break.c
index 922102d..f64a81a 100644
--- a/gdb/testsuite/gdb.opt/inline-break.c
+++ b/gdb/testsuite/gdb.opt/inline-break.c
@@ -176,6 +176,38 @@ not_inline_func3 (int x)
return y + inline_func3 (x);
}
+/* The following three functions serve to exercise GDB's inline frame
+ skipping logic when setting a user breakpoint on an inline function
+ by name. */
+
+/* A static inlined function that is called by another static inlined
+ function. */
+
+static inline ATTR int
+func_inline_callee (int x)
+{
+ return x * 23;
+}
+
+/* A static inlined function that calls another static inlined
+ function. The body of the function is as simple as possible so
+ that both functions are inlined to the same PC address. */
+
+static inline ATTR int
+func_inline_caller (int x)
+{
+ return func_inline_callee (x);
+}
+
+/* An extern not-inline function that calls a static inlined
+ function. */
+
+int
+func_extern_caller (int x)
+{
+ return func_inline_caller (x);
+}
+
/* Entry point. */
int
@@ -205,5 +237,7 @@ main (int argc, char *argv[])
x = not_inline_func3 (-21);
+ func_extern_caller (1);
+
return x;
}
diff --git a/gdb/testsuite/gdb.opt/inline-break.exp b/gdb/testsuite/gdb.opt/inline-break.exp
index 008ff1a..bae7625 100644
--- a/gdb/testsuite/gdb.opt/inline-break.exp
+++ b/gdb/testsuite/gdb.opt/inline-break.exp
@@ -231,4 +231,29 @@ foreach_with_prefix cmd [list "break" "tbreak"] {
}
}
+# func_extern_caller calls func_inline_caller which calls
+# func_inline_callee. The latter two are both inline functions. Test
+# that setting a breakpoint on each of the functions reports a stop at
+# that function. This exercises the inline frame skipping logic. If
+# we set a breakpoint at function A, we want to present the stop at A,
+# even if A's entry code is an inlined call to another inline function
+# B.
+
+foreach_with_prefix func {
+ "func_extern_caller"
+ "func_inline_caller"
+ "func_inline_callee"
+} {
+ clean_restart $binfile
+
+ if {![runto main]} {
+ untested "could not run to main"
+ continue
+ }
+
+ gdb_breakpoint $func
+ gdb_test "continue" "Breakpoint .* $func .*at .*$srcfile.*" \
+ "breakpoint hit presents stop at breakpointed function"
+}
+
unset -nocomplain results