public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/26813] New: DW_FORM_rnglistx and DW_FORM_loclistx not fully supported
@ 2020-10-29 17:30 zoran.zaric at amd dot com
  2020-10-29 17:33 ` [Bug symtab/26813] " zoran.zaric at amd dot com
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: zoran.zaric at amd dot com @ 2020-10-29 17:30 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26813

            Bug ID: 26813
           Summary: DW_FORM_rnglistx and DW_FORM_loclistx not fully
                    supported
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: zoran.zaric at amd dot com
  Target Milestone: ---

Created attachment 12929
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12929&action=edit
Test application and gdb patch

Gdb seems to be reporting an internal error when attributes of either
DW_FORM_rnglistx or DW_FORM_loclistx form are found in DWARF.

Both of these forms are part of the newest DWARF 5 standard, which support was
only recently added to the gdb.

Original problem was found on a application written in HIP language and compile
using a Clang based compiler (version 11 or newer). 

Considering that HIP language and runtime is not everybody's cup of tea, I
tried to find a C++ application that can reproduce an issue. 

I was lucky, and it seems that my old application, written to solving some
logical problem from years ago, exposes the same bug.

The bug will only show up if a compiler used is Clang 11 (or newer) and it
doesn't seem to show up under gcc.

To reproduce the issue, one just need to build the application using a simple
make command. After that it needs to be run under the debugger without any
arguments:

  $ tar -xf MagicPurse.tar.xz
  $ make
  $ gdb ./MagicPurse

The reason I've have not tried to reduce the application is because it exposes
multiple levels of bugs, and it seems useful to have the whole thing to make
sure that we don't miss any unknown issues.

I have debugged the reason behind the internal error and found that both of
these forms are not properly processed when read. The attached archive also
contains a small patch (dwarf-5-fix-WIP.patch) that deals with that problem.

After applying the patch, another issue comes up where the DW_FORM_rnglistx
form is not resolved properly. The problem seems to be in read_rnglist_index
function.

These new forms can have multiple headers inside of .debug_rnglist where the
read_rnglist_index function only ever reads the first one. This results in an
error message:

    DW_FORM_rnglistx index pointing outside of .debug_rnglists offset array ...

My patch is based on 006811bc02fe28060a8557b1f17a129440c975d4 commit and it
makes sense to me, but I am not that familiar with the mechanism behind reading
the dwarf sections.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-05-16  1:12 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 17:30 [Bug symtab/26813] New: DW_FORM_rnglistx and DW_FORM_loclistx not fully supported zoran.zaric at amd dot com
2020-10-29 17:33 ` [Bug symtab/26813] " zoran.zaric at amd dot com
2020-10-29 18:08 ` simark at simark dot ca
2020-10-30 14:22 ` tromey at sourceware dot org
2020-10-30 15:03 ` zoran.zaric at amd dot com
2020-10-30 18:21 ` simark at simark dot ca
2020-10-30 18:22 ` simark at simark dot ca
2020-10-30 19:03 ` simark at simark dot ca
2020-10-30 21:19 ` simark at simark dot ca
2020-11-02 15:57 ` simark at simark dot ca
2021-01-20  9:26 ` mliska at suse dot cz
2021-02-02 15:42 ` cvs-commit at gcc dot gnu.org
2021-02-02 15:43 ` cvs-commit at gcc dot gnu.org
2021-02-02 15:43 ` cvs-commit at gcc dot gnu.org
2021-02-02 15:43 ` cvs-commit at gcc dot gnu.org
2021-02-02 15:43 ` simark at simark dot ca
2021-02-03 19:17 ` cvs-commit at gcc dot gnu.org
2021-02-03 19:17 ` cvs-commit at gcc dot gnu.org
2021-02-03 19:17 ` cvs-commit at gcc dot gnu.org
2022-05-15 12:13 ` jeanmichael.celerier at gmail dot com
2022-05-15 14:33 ` tromey at sourceware dot org
2022-05-15 14:55 ` jeanmichael.celerier at gmail dot com
2022-05-15 15:09 ` tromey at sourceware dot org
2022-05-16  1:12 ` simark at simark dot ca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).