diff options
author | Tom Tromey <tromey@adacore.com> | 2023-08-01 13:57:19 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-08-03 09:35:38 -0600 |
commit | 30baee6865571bb0385dbc6ee7e06701e1253028 (patch) | |
tree | d8056d8e7dcfbe90067a72743b9785904fe8cc85 /gdb/testsuite/gdb.dap | |
parent | b1c0ab20809a502b2d2224fecb0dca3ada2e9b22 (diff) | |
download | gdb-30baee6865571bb0385dbc6ee7e06701e1253028.zip gdb-30baee6865571bb0385dbc6ee7e06701e1253028.tar.gz gdb-30baee6865571bb0385dbc6ee7e06701e1253028.tar.bz2 |
Use frame.name() in FrameDecorator
A co-worker pointed out that gdb's DAP implementation might return an
integer for the name of a stack frame, like:
{"id": 1, "name": 93824992310799, ...}
This can be seen currently in the logs of the bt-nodebug.exp test
case.
What is happening is that FrameDecorator falls back on returning the
PC when the frame's function symbol cannot be found, relying on the
gdb core to look up the minsym and print its name.
This can actually yield the wrong answer sometimes, because it falls
into the get_frame_pc / get_frame_address_in_block problem -- if the
frame is at a call to a noreturn function, the PC in this case might
appear to be in the next function in memory. For more on this, see:
https://sourceware.org/bugzilla/show_bug.cgi?id=8416
and related bugs.
However, there's a different approach we can take: the code here can
simply use Frame.name. This handles the PC problem correctly, and
gets us the information we need.
Diffstat (limited to 'gdb/testsuite/gdb.dap')
-rw-r--r-- | gdb/testsuite/gdb.dap/bt-nodebug.exp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.dap/bt-nodebug.exp b/gdb/testsuite/gdb.dap/bt-nodebug.exp index e4dcef3..e9726d2 100644 --- a/gdb/testsuite/gdb.dap/bt-nodebug.exp +++ b/gdb/testsuite/gdb.dap/bt-nodebug.exp @@ -44,6 +44,13 @@ lassign [dap_wait_for_event_and_check "stopped at function breakpoint" stopped \ "body hitBreakpointIds" $fn_bpno] unused objs # The bug was that this request would fail. -dap_check_request_and_response "backtrace" stackTrace {o threadId [i 1]} +set obj [dap_check_request_and_response "backtrace" \ + stackTrace {o threadId [i 1]}] +set frames [dict get [lindex $obj 0] body stackFrames] + +gdb_assert {[llength $frames] == 3} "three frames" + +gdb_assert {[dict get [lindex $frames 1] name] == "no_debug_info"} \ + "name of no-debug frame" dap_shutdown |