Skip to content

Commit b33b677

Browse files
oltolmtromey
authored andcommitted
gdb/dap: fix decode_source
The documentation for the Source interface says * The path of the source to be shown in the UI. * It is only used to locate and load the content of the source if no * `sourceReference` is specified (or its value is 0). but the code used `path` first. I fixed it to use `sourceReference` first. Approved-By: Tom Tromey <[email protected]>
1 parent a19c781 commit b33b677

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gdb/python/lib/gdb/dap/sources.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def decode_source(source):
6464
"""Decode a Source object.
6565
6666
Finds and returns the filename of a given Source object."""
67-
if "path" in source:
68-
return source["path"]
69-
if "sourceReference" not in source:
67+
if "sourceReference" not in source or source["sourceReference"] <= 0:
68+
if "path" in source:
69+
return source["path"]
7070
raise DAPException("either 'path' or 'sourceReference' must appear in Source")
7171
ref = source["sourceReference"]
7272
if ref not in _id_map:

0 commit comments

Comments
 (0)