Bug 25459 - Forward pseudo-reference triggers error
Summary: Forward pseudo-reference triggers error
Status: NEW
Alias: None
Product: dwz
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on: 27568
Blocks:
  Show dependency treegraph
 
Reported: 2020-01-24 19:23 UTC by Tom de Vries
Modified: 2021-03-12 10:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2020-01-24 19:23:58 UTC
As we have seen, the test-case in PR25456 triggers an error:
...
$ dwz clang-offload-bundler-10.debug
dwz: clang-offload-bundler-10.debug: Couldn't find DIE referenced by DW_OP_GNU_implicit_pointer
... 

However, the question is: should this error be triggered?

We have a DIE in a partial unit:
...
 <3><481a37>: Abbrev Number: 1 (DW_TAG_formal_parameter)
    <481a38>   DW_AT_abstract_origin: <0x5232>
    <481a3c>   DW_AT_location    : 0x902527 (location list)
    <481a40>   DW_AT_GNU_locviews: 0x902525
...
for which we calculate the checksum, so we follow the DW_AT_location to:
...
    00902525 v000000000000000 v000000000000003 location view pair

    00902527 v000000000000000 v000000000000003 views at 00902525 for:
             0000000000000033 0000000000000033 (DW_OP_GNU_implicit_pointer: <0x1263f86> 0)
...
from where we would like to go to:
...
<1><1263f86>: Abbrev Number: 206 (DW_TAG_dwarf_procedure)
    <1263f88>   DW_AT_location    : 4 byte block: 9e 2 7e 0     (DW_OP_implicit_value 2 byte block: 7e 0 )
...
but we can't because the CU containing this DIE hasn't been processed by read_debug_info.
Comment 1 Tom de Vries 2020-01-26 21:16:37 UTC
There are few things to consider here:
- It would be good to be able to handle a forward pseudo-reference. Presumably
  such a thing would be handled by doing two passes over .debug_info, much like
  is done in low-mem mode. This ties in somewhat with PR25229 - "Add input
  verification phase".
- another question is whether dwz should generate the code such as is present in
  clang-offload-bundler-10.debug. If this was a normal reference, the referenced
  DIE would have been forced into a partial unit. Should we do the same for
  pseudo-references?