Re: [PATCH] Fix macro info lookup for binaries containing DWARFv5 line table

Keith Seitz via Gdb-patches
2021-06-08T19:30:55Z

RFC ping

Anyone at all have an opinion on this direction?

Keith

On 5/24/21 11:47 AM, Keith Seitz via Gdb-patches wrote:
> On 5/24/21 4:36 AM, Tomar, Sourabh Singh wrote:
>> [AMD Public Use]
>>
>> Hello Keith,
>>
>> Could you please share your plan WRT to this patch.
>> Do you want to take it forward ? or you want me to take this forward.
>>
>
> I can pursue this...
>
> In that vein, does anyone (maintainers?) have an input on my "counterpatch"
> (reposted below) that removes this IS_ABSOLUTE_PREFIX stuff and copies the
> symtab's filename?
>
> I haven't officially submitted this as a patch because I'm curious whether
> my reading of this is correct/complete. Maybe the documentation/comments
> are incorrect or no longer valid?
>
> FWIW, I've tested that patch on native x86_64 Fedora 34 with no regressions.
>
> Keith
>
> Patch under discussion:
>
> gdb/ChangeLog
>
> * dwarf2/line-header.c (line_header::file_file_name): Copy
> the symtab's filename.
>
> diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c
> index 7575297f966..117c5a42cc5 100644
> --- a/gdb/dwarf2/line-header.c
> +++ b/gdb/dwarf2/line-header.c
> @@ -69,15 +69,10 @@ line_header::file_file_name (int file) const
> {
> const file_entry *fe = file_name_at (file);
>
> - if (!IS_ABSOLUTE_PATH (fe->name))
> - {
> - const char *dir = fe->include_dir (this);
> - if (dir != NULL)
> - return gdb::unique_xmalloc_ptr<char> (concat (dir, SLASH_STRING,
> - fe->name,
> - (char *) NULL));
> - }
> - return make_unique_xstrdup (fe->name);
> + /* macro_source_file requires: "This filename is relative to the
> + compilation directory, it exactly matches the symtab->filename
> + content." */
> + return make_unique_xstrdup (fe->symtab->filename);
> }
> else
> {
>