[Bug symtab/34389] Source code lookup fails for code at or near 0 when linking with garbage collection

aburgess at redhat dot com via Gdb-prs <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34389

--- Comment #1 from Andrew Burgess <aburgess at redhat dot com> ---
Created attachment 16837
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16837&action=edit
Possible work around for this issue

Attached is a possible work around.  This isn't an full fix though.

The current code assumes that the blockvector's address map is "perfect", if
the address map claims to contain a given address then we assume that this is
the correct block vector, and consequentially the correct compunit_symtab. 
This is usually fine, except for the garbage collected functions being placed
at zero.

So this patch says that, if the PC we're looking for is within an address range
that starts at zero then this might be a garbage collected range, and we
shouldn't trust the address map.

Instead we fall back to the
quick_symbol_functions::find_pc_sect_compunit_symtab function, which will look
for the compunit_symtab with a symbol closest to the PC we're looking for.  My
hope is that this will usually find the correct compunit_symtab that we're
looking for.  At least, for the reproducer that was created for this bug, this
fix seems to resolve the issue, I haven't tried with the original user's
example though (see link in bug description).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.