[Bug libbacktrace/108870] Gather file/line info for file/namespace/static variables

2023-02-23 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108870

--- Comment #3 from Jakub Jelinek  ---
I think even on the libsanitizer side we don't always need such non-automatic
variable debug info, e.g. if no diagnostics needs to be reported for global
vars but just for automatic ones, heap etc., so perhaps scanning the
.debug_info separately for it might be better for that purpose.

[Bug libbacktrace/108870] Gather file/line info for file/namespace/static variables

2023-02-21 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108870

Ian Lance Taylor  changed:

   What|Removed |Added

 CC||ian at airs dot com

--- Comment #2 from Ian Lance Taylor  ---
Currently libbacktrace builds a mapping from compilation-unit PC ranges to line
programs.  This would be a completely different mapping, from variable
addresses to variable information.  As far as I know we would have to build it
from a complete scan of the .debug_info section.  Most programs don't need this
information, so it would be a shame to always build it.

Now I wish that there were some sort of options argument to
backtrace_create_state.  But actually backtrace_create_state does take a
threaded argument that almost everybody passes as 0.  The only non-zero cases I
could find in a web search were passing 1.  So we could redefine that as an
option.  Then programs that want variable information could pass 2 (or 3 for
variables plus threading).  With that option set, we can build a list of
address mapping to variables.

The next question would be whether we should unify the function and variable
mapping or keep them separate.  If we unify them we can use backtrace_pcinfo to
get variable information.  If we don't we should have another function that
does variable lookup.

It seems that the DWARF information does not include the size of the variable,
so to really get this right we'll have to also use the size information from
the symbol table, which is already available via backtrace_syminfo.

Any thoughts on whether the function/variable mappings should be unified or
distinct?

[Bug libbacktrace/108870] Gather file/line info for file/namespace/static variables

2023-02-21 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108870

Jakub Jelinek  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org
 Blocks||108834

--- Comment #1 from Jakub Jelinek  ---
Ian, any thoughts on this?


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108834
[Bug 108834] LTO: ltrans temporary file is used as module name in ASAN