aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-10-17 11:56:47 +0100
committerAndrew Burgess <aburgess@redhat.com>2024-10-20 21:54:13 +0100
commit48a0a7ca5e6f928bb707cb16aeae1ff8b678f101 (patch)
treeaa91f018169d3f881ca64f540bc056da6fbf22aa /gdb/testsuite
parent40ae603e6e0fe21fd0c1677dcf4e137cf99c2ebe (diff)
downloadgdb-48a0a7ca5e6f928bb707cb16aeae1ff8b678f101.zip
gdb-48a0a7ca5e6f928bb707cb16aeae1ff8b678f101.tar.gz
gdb-48a0a7ca5e6f928bb707cb16aeae1ff8b678f101.tar.bz2
gdb: fix 'maint info inline-frames' after 'stepi'
There is an invalid assumption within 'maint info inline-frames' which triggers an assert: (gdb) stepi 0x000000000040119d 18 printf ("Hello World\n"); (gdb) maintenance info inline-frames ../../src/gdb/inline-frame.c:554: internal-error: maintenance_info_inline_frames: Assertion `it != inline_states.end ()' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- ... etc ... The problem is this assert: /* Stopped threads always have cached inline_state information. */ gdb_assert (it != inline_states.end ()); If you check out infrun.c and look in handle_signal_stop for the call to skip_inline_frames then you'll find a rather large comment that explains that we don't always compute the inline state information for performance reasons. So the assertion is not valid. I've updated the code so that if there is cached information we use that, but if there is not then we just create our own information for the current $pc of the current thread. This means that, if there is cached information, GDB still correctly shows which frame the inferior is in (it might not be in the inner most frame). If there is no cached information we will always display the inferior as being in the inner most frame, but that's OK, because if skip_inline_frames has not been called then GDB will have told the user they are in the inner most frame, so everything lines up. I've extended the test to check 'maint info inline-frames' after a stepi which would previously have triggered the assertion.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp b/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp
index 16be22a..97e5d99 100644
--- a/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp
+++ b/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp
@@ -173,6 +173,20 @@ gdb_test "maint info blocks" [make_blocks_result normal_func \
inline_func_a inline_func_b] \
"maint info blocks within inline function, all blocks still visible"
+# Use 'stepi' and check 'maint info inline-frames' still works.
+gdb_test "stepi" ".*" "perform stepi"
+gdb_test "maint info inline-frames" \
+ [multi_line \
+ "^Inline state information for thread $decimal\\." \
+ "program counter = $hex" \
+ "skipped frames = 0" \
+ "> inline_func_b"] \
+ "check inline-frames state when within inline_func_b after stepi"
+
+gdb_test "maint info blocks" [make_blocks_result normal_func \
+ inline_func_a inline_func_b] \
+ "maint info blocks within inline function after stepi, all blocks still visible"
+
# Use the recorded $pc value to check inline frames.
gdb_test "maint info inline-frames $pc" \
[multi_line \