public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug libdw/23982] New: dwarf_formref_die() does not support DW_FORM_indirect
@ 2018-12-13 17:21 Andreas.Kromke at dreamchip dot de
  2018-12-25 16:47 ` [Bug libdw/23982] " mark at klomp dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andreas.Kromke at dreamchip dot de @ 2018-12-13 17:21 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 23982
           Summary: dwarf_formref_die() does not support DW_FORM_indirect
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libdw
          Assignee: unassigned at sourceware dot org
          Reporter: Andreas.Kromke at dreamchip dot de
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

This kind of indirect form is generated by some ARM compilers.

A temporary workaround might be:


Dwarf_Attribute *attr = dwarf_attr_integrate(die, DW_AT_type, &attr_mem);
if (attr != NULL)
{
    unsigned int whatform = dwarf_whatform(attr);
    while(whatform == DW_FORM_indirect)
    {
        uint64_t val;
        const unsigned char *p = (const unsigned char *) attr->valp;
        get_uleb128_unchecked(val, p);
        whatform = (unsigned int) val;
        attr_mem.form = whatform;
        attr_mem.valp = (void *) p;
    }
    Dwarf_Die *type = dwarf_formref_die(attr, type_die);
...


However, this method is rather ugly, because it needs the internal function
get_uleb128_unchecked().

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

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

* [Bug libdw/23982] dwarf_formref_die() does not support DW_FORM_indirect
  2018-12-13 17:21 [Bug libdw/23982] New: dwarf_formref_die() does not support DW_FORM_indirect Andreas.Kromke at dreamchip dot de
@ 2018-12-25 16:47 ` mark at klomp dot org
  2019-01-02 17:12 ` Andreas.Kromke at dreamchip dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2018-12-25 16:47 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
I don't believe I have ever seen a DWARF producer that uses DW_FORM_indirect, I
wouldn't be surprised if other libdw function don't handle it correctly too.

Do you have an example file that shows DW_FORM_indirect being used? What
producer generated it?

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

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

* [Bug libdw/23982] dwarf_formref_die() does not support DW_FORM_indirect
  2018-12-13 17:21 [Bug libdw/23982] New: dwarf_formref_die() does not support DW_FORM_indirect Andreas.Kromke at dreamchip dot de
  2018-12-25 16:47 ` [Bug libdw/23982] " mark at klomp dot org
@ 2019-01-02 17:12 ` Andreas.Kromke at dreamchip dot de
  2019-01-13 16:39 ` mark at klomp dot org
  2021-09-03 13:49 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas.Kromke at dreamchip dot de @ 2019-01-02 17:12 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #2 from Andreas Kromke <Andreas.Kromke at dreamchip dot de> ---
Unfortunately I cannot provide the example file (due to legal restrictions),
but I can tell that the producer is the following:

"ARM C/C++ Compiler, 5.03 [Build 76]"

The machine is (obviously) ARM.

Here someone already mentioned the problem:

http://lists.gnu.org/archive/html/bug-gdb/2000-11/msg00009.html

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

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

* [Bug libdw/23982] dwarf_formref_die() does not support DW_FORM_indirect
  2018-12-13 17:21 [Bug libdw/23982] New: dwarf_formref_die() does not support DW_FORM_indirect Andreas.Kromke at dreamchip dot de
  2018-12-25 16:47 ` [Bug libdw/23982] " mark at klomp dot org
  2019-01-02 17:12 ` Andreas.Kromke at dreamchip dot de
@ 2019-01-13 16:39 ` mark at klomp dot org
  2021-09-03 13:49 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2019-01-13 16:39 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
As with your other bug without at least some example DWARF files this will be
somewhat hard to support. I think I know what would be needed, but without
actual testcases it will be hard to get right.

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

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

* [Bug libdw/23982] dwarf_formref_die() does not support DW_FORM_indirect
  2018-12-13 17:21 [Bug libdw/23982] New: dwarf_formref_die() does not support DW_FORM_indirect Andreas.Kromke at dreamchip dot de
                   ` (2 preceding siblings ...)
  2019-01-13 16:39 ` mark at klomp dot org
@ 2021-09-03 13:49 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2021-09-03 13:49 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
This was implemented by:

commit d63b26b8d21fb554049789290cd245cbe0446735
Author: Omar Sandoval <osandov@fb.com>
Date:   Fri Apr 23 16:36:15 2021 -0700

    libdw: handle DW_FORM_indirect when reading attributes

    Whenever we encounter an attribute with DW_FORM_indirect, we need to
    read its true form from the DIE data. Then, we can continue normally.
    This adds support to the most obvious places: __libdw_find_attr() and
    dwarf_getattrs(). There may be more places that need to be updated.

    I encountered this when inspecting a file that was processed by our BOLT
    tool: https://github.com/facebookincubator/BOLT. This also adds a couple
    of test cases using a file generated by that tool.

    Signed-off-by: Omar Sandoval <osandov@fb.com>

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

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

end of thread, other threads:[~2021-09-03 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 17:21 [Bug libdw/23982] New: dwarf_formref_die() does not support DW_FORM_indirect Andreas.Kromke at dreamchip dot de
2018-12-25 16:47 ` [Bug libdw/23982] " mark at klomp dot org
2019-01-02 17:12 ` Andreas.Kromke at dreamchip dot de
2019-01-13 16:39 ` mark at klomp dot org
2021-09-03 13:49 ` mark at klomp dot org

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).