From 68ca7890ddaeb849c390295ecd914087da463497 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 14 Feb 2023 09:25:55 -0700 Subject: Fix DAP stackTrace through frames without debuginfo The DAP stackTrace implementation did not fully account for frames without debuginfo. Attemping this would yield a result like: {"request_seq": 5, "type": "response", "command": "stackTrace", "success": false, "message": "'NoneType' object has no attribute 'filename'", "seq": 11} This patch fixes the problem by adding another check for None. --- gdb/python/lib/gdb/dap/bt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/python/lib') diff --git a/gdb/python/lib/gdb/dap/bt.py b/gdb/python/lib/gdb/dap/bt.py index 7a17574..c5ede6e 100644 --- a/gdb/python/lib/gdb/dap/bt.py +++ b/gdb/python/lib/gdb/dap/bt.py @@ -69,7 +69,7 @@ def _backtrace(thread_id, levels, startFrame): "instructionPointerReference": hex(current_frame.pc()), } sal = _safe_sal(current_frame) - if sal is not None: + if sal is not None and sal.symtab is not None: newframe["source"] = { "name": os.path.basename(sal.symtab.filename), "path": sal.symtab.filename, -- cgit v1.1