[PATCH] Add option to llvm-dwarfdump to dump .eh_frame sections.

Eli Bendersky eliben at google.com
Thu Feb 21 15:56:55 PST 2013


>> The lib/DebugInfo code currently handles DWARF v3, which is (AFAIK)
>> what LLVM also generates.
>>
>
> Following a recent IRC discussion, just to point out what I mean
> exactly. CIE headers in DWARF v4 have extra fields after augmentation:
> address_size & segment size. Therefore, if you blindly assume you're
> reading DWARFv3 and you get v4 as input, the parsing will be wrong.
>
> The DWARF v4 standard states this explicitly in the introduction:
>
> "
> DWARF Version 4 is compatible with DWARF Version 3 except as follows:
>   [...]
>  * DWARF frame and line table sections include a additional fields
> that affect the location
> and interpretation of other data in the section.
> "
>
> DWARF comes with a version number (in the header of compilation
> units), which can be used to parse such information conditionally on
> the version. I imagine this is tools like GDB do (wanting to support
> multiple versions).
>

Looked in the code of a few common tools, as well as our frame
emission code (MCDwarf). We only emit v3 frame info. This is also what
LLDB knows how to consume. External tools are more flexible. Both
readelf and GDB (which uses BFD, which means all BFD-based code) have
special code in frame parsing that checks for DWARF version, and
parses the additional header fields if the version is 4 or higher.

Also, I was not precise previously: CIE headers contain the DWARF
version they're encoded in, so .debug_info is not required to be
present in the container object.

Eli



More information about the llvm-commits mailing list