]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Handle case where DAP line can be None
authorTom Tromey <tromey@adacore.com>
Mon, 6 Jan 2025 14:45:33 +0000 (07:45 -0700)
committerTom Tromey <tromey@adacore.com>
Mon, 13 Jan 2025 14:37:19 +0000 (07:37 -0700)
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

gdb/python/lib/gdb/dap/bt.py

index a27c61a6cdaeb71ab75cb7a0efb6f871cf8af686..0fefa694c9a3527d6174d95ec837a940438f40d8 100644 (file)
@@ -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