diff --git a/gdb/python/lib/gdb/FrameDecorator.py b/gdb/python/lib/gdb/FrameDecorator.py index aa9a2201bec..39ee2e2547c 100644 --- a/gdb/python/lib/gdb/FrameDecorator.py +++ b/gdb/python/lib/gdb/FrameDecorator.py @@ -75,17 +75,10 @@ class _FrameDecoratorBase(object): elif frame.type() == gdb.SIGTRAMP_FRAME: return "" - func = frame.function() - - # If we cannot determine the function name, return the - # address. If GDB detects an integer value from this function - # it will attempt to find the function name from minimal - # symbols via its own internal functions. - if func is None: - pc = frame.pc() - return pc - - return str(func) + func = frame.name() + if not isinstance(func, str): + func = "???" + return func def address(self): """Return the address of the frame's pc""" diff --git a/gdb/testsuite/gdb.dap/bt-nodebug.exp b/gdb/testsuite/gdb.dap/bt-nodebug.exp index e4dcef35a67..e9726d2e17d 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