Read .debug_line without .debug_info

Mark Wielaard
Mon Mar 26 19:12:00 GMT 2018

Hi Sasha,

On Mon, Mar 26, 2018 at 04:41:06PM +0000, Sasha Da Rocha Pinheiro wrote:
> is it possible to read contents of .debug_line section without the
> presence of a .debug_info section?

No, because .debug_line sections need some information from the CU
which comes from the .debug_info. In particular the directory table
starts with the compilation directory which can only be gotten from
the CU (DW_AT_comp_dir). The files in the file list (which don't have
an explicit dir associated) are all given relative to that comp dir.

A line table can only be gotten through a CU DIE (from the .debug_info).

But DWARF5 did make some changes that mean the .debug_line tables
can stand on their own (and have their own .debug_line_str section
for the dir and file names). I am about to post patches for that.
But I haven't thought about adding an interface to iterate through
the line tables without associated CUs. It would be nice if that
also worked for pre-DWARF5 line tables. But how to represent the
missing information?

> We have CUDA binaries being generated with only .debug_line, and we
> wish to use that. Is it possible to do that with libdw?

Not at the moment. Sorry.

> If not, any ideas of how to construct a minimum .debug_info in order
> to read it?

At the moment you need a minimal CU DIE with a DW_AT_stmt_list pointing
to the line table, a DW_AT_name for the primary source file and a
DW_AT_comp_dir for the compilation directory to resolve any relative



More information about the Elfutils-devel mailing list