From: Tom Tromey Date: Mon, 6 Jan 2025 14:45:33 +0000 (-0700) Subject: Handle case where DAP line can be None X-Git-Tag: binutils-2_44~172 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28e585134434ee2c65df5001e4494c1b4adcd204;p=thirdparty%2Fbinutils-gdb.git Handle case where DAP line can be None A comment in bugzilla pointed out a bug in my earlier patch to handle the DAP "linesStartAt1" setting. In particular, in the backtrace code, "line" can be None, which would lead to an exception from export_line. This patch fixes the problem. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32468 --- diff --git a/gdb/python/lib/gdb/dap/bt.py b/gdb/python/lib/gdb/dap/bt.py index a27c61a6cda..0fefa694c9a 100644 --- a/gdb/python/lib/gdb/dap/bt.py +++ b/gdb/python/lib/gdb/dap/bt.py @@ -84,9 +84,9 @@ def _backtrace(thread_id, levels, startFrame, stack_format): "column": 0, "instructionPointerReference": hex(pc), } - line = export_line(current_frame.line()) + line = current_frame.line() if line is not None: - newframe["line"] = line + newframe["line"] = export_line(line) if stack_format["line"]: # Unclear whether export_line should be called # here, but since it's just for users we pick the