[binutils-gdb] Explicitly use print_name in DAP
Tom Tromey
tromey@sourceware.org
Fri Jan 9 17:03:02 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=02ae0785e38f08a26d5b6be5bbe2753ae9ea4836
commit 02ae0785e38f08a26d5b6be5bbe2753ae9ea4836
Author: Tom Tromey <tromey@adacore.com>
Date: Wed Dec 3 07:48:00 2025 -0700
Explicitly use print_name in DAP
This changes some DAP code to explicitly use a symbol's print name.
Some places were using '.name'; and while 'str' does use the print
name, it seems better to be both consistent and explicit.
Diff:
---
gdb/python/lib/gdb/dap/disassemble.py | 4 ++--
gdb/python/lib/gdb/dap/globalvars.py | 2 +-
gdb/python/lib/gdb/dap/scopes.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/python/lib/gdb/dap/disassemble.py b/gdb/python/lib/gdb/dap/disassemble.py
index 8826fce4a5b..0558a3ce84e 100644
--- a/gdb/python/lib/gdb/dap/disassemble.py
+++ b/gdb/python/lib/gdb/dap/disassemble.py
@@ -38,10 +38,10 @@ class _BlockTracker:
return
self._blocks.add(block)
if block.function is not None:
- self._labels[block.start] = block.function.name
+ self._labels[block.start] = block.function.print_name
for sym in block:
if sym.addr_class == gdb.SYMBOL_LOC_LABEL:
- self._labels[int(sym.value())] = sym.name
+ self._labels[int(sym.value())] = sym.print_name
block = block.superblock
# Add PC to this tracker. Update RESULT as appropriate with
diff --git a/gdb/python/lib/gdb/dap/globalvars.py b/gdb/python/lib/gdb/dap/globalvars.py
index 13a05942d7c..c90404362c4 100644
--- a/gdb/python/lib/gdb/dap/globalvars.py
+++ b/gdb/python/lib/gdb/dap/globalvars.py
@@ -61,7 +61,7 @@ class _Globals(BaseReference):
@in_gdb_thread
def fetch_one_child(self, idx):
sym = self._var_list[idx]
- return (sym.name, sym.value())
+ return (sym.print_name, sym.value())
@in_gdb_thread
diff --git a/gdb/python/lib/gdb/dap/scopes.py b/gdb/python/lib/gdb/dap/scopes.py
index cd53f6f36fb..98a710f2df5 100644
--- a/gdb/python/lib/gdb/dap/scopes.py
+++ b/gdb/python/lib/gdb/dap/scopes.py
@@ -64,7 +64,7 @@ def symbol_value(sym, frame):
# be needed, but this is a way to set the current language
# properly so that language-dependent APIs will work.
inf_frame.select()
- name = str(sym.symbol())
+ name = sym.symbol().print_name
val = sym.value()
if val is None:
# No synthetic value, so must read the symbol value
More information about the Gdb-cvs
mailing list