https://bugs.llvm.org/show_bug.cgi?id=44482

            Bug ID: 44482
           Summary: llvm-dwarfdump with DWARF3: error: Unable to resolve
                    DW_LLE_offset_pair: base address unknown
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

Created attachment 22995
  --> https://bugs.llvm.org/attachment.cgi?id=22995&action=edit
test case

We have a test case built with CompCert, for which (I think ;-) llvm-dwarfdump
falsely emits an error on "llvm-dwarfdump -all -verify $attached_binary":
> error: Unable to resolve DW_LLE_offset_pair: base address unknown

This only happened after upgrading llvm to a newer trunk. Tested last week with
git/master cd2a73a9f01b2ec1b7e239ba83201199df0d7912 (the relevant code doesn't
seem to have changed since then).

The problem seems to be that some DWARF3 .debug_loc info is parsed as a DWARF5
DW_LLE_offset_pair, and in that case the parser (now) always expects a
DW_LLE_base_address to be set - else it emits the above error. For DWARF5 that
would be correct, however, for DWARF3 there are no DW_LLE_* codes, and the
parser should just use an offset of 0.

Some digging points to https://reviews.llvm.org/D70081 and commit
https://github.com/llvm/llvm-project/commit/ebe2f56030458e7a4c2375c6d92a48f0ed01eb5b
- more specifically, the code around the "if (!Base)" at
https://github.com/llvm/llvm-project/blame/master/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp#L81

Hence adding labath to CC list.

Tool output:
> Verifying [...]
> Verifying .debug_abbrev...
> Verifying .debug_info Unit Header Chain...
> error: Unable to resolve DW_LLE_offset_pair: base address unknown
> 
> 0x00000297: DW_TAG_formal_parameter
>               DW_AT_name      ("x")
>               DW_AT_type      (0x0000000000000066 "int")
>               DW_AT_location  (0x00000000: 
>                  (0x000000000040ad80, 0x000000000040ad84): DW_OP_reg0)
> 
> Verifying .debug_info references...
> Verifying .debug_types Unit Header Chain...
> Verifying .debug_line...
> Errors detected.

debug_info (header), only a single CU, version is 3:
>  Compilation Unit @ offset 0x0:
>   Length:        0x2a1 (32-bit)
>   Version:       3
>   Abbrev Offset: 0x0
>   Pointer Size:  8

debug_info (for this entry the verification fails):
> <2><297>: Abbrev Number: 13 (DW_TAG_formal_parameter)
>     <298>   DW_AT_name        : x
>     <29a>   DW_AT_type        : <0x66>
>     <29e>   DW_AT_location    : 0x0 (location list)

debug_abbrev for the above entry:
>   13      DW_TAG_formal_parameter    [no children]
>    DW_AT_name         DW_FORM_string
>    DW_AT_type         DW_FORM_ref_addr
>    DW_AT_location     DW_FORM_data4
>    DW_AT value: 0     DW_FORM value: 0

debug_loc:
>    Offset   Begin            End              Expression
>    00000000 000000000040ad80 000000000040ad84 (DW_OP_reg0 (x0))
>    00000013 <End of list

The attached binary is built with (latest as of 30th Dec) CompCert for AArch64.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to