https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108870
Bug ID: 108870
Summary: Gather file/line info for file/namespace/static
variables
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libbacktrace
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: ian at gcc dot gnu.org
Target Milestone: ---
As discussed in PR108834, llvm symbolizer switched to providing detailed
file/line info from debuginfo rather than by the compiler emitting the location
data into sourcefiles.
Currently the libsanitizer libbacktrace based symbolizer for data uses
backtrace_syminfo((backtrace_state *)state_, addr, SymbolizeDataCallback,
ErrorCallback, info);
which fills in (demangled) name from ELF symbol name, start and size (again,
from ELF).
We'd need to look up DWARF DW_TAG_variable DIEs (both at compile_unit/namespace
level and also nested in DW_TAG_subprogram and their children), which have
DW_AT_location of the form DW_OP_addr symbol_addr and map the symbol_addr to
DW_AT_decl_{file,line} and maybe DW_AT_name?
Wonder if we should just walk the whole .debug_info lazily the first time
something like libsanitizer asks for it, or if the current .debug_info walk
(read_function_info/read_function_entry) should gather it with other stuff if
libbacktrace user asks for it during library initialization somehow. Though, I
think
read_function_info is invoked only if read_line_info was successful...