diff options
author | Mark Wielaard <mark@klomp.org> | 2018-06-22 22:44:51 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-06-29 10:22:51 +0200 |
commit | 2ee84b2ca8b2da2bc4ad5663babfa25d97aa85b4 (patch) | |
tree | 4d0858c6896050b169d77d7211b8f4d94109a209 /tests/testfile-x32-s.bz2 | |
parent | e3b2060bb6a687587500c8d6c74145ef1d320c5c (diff) | |
download | elfutils-2ee84b2ca8b2da2bc4ad5663babfa25d97aa85b4.tar.gz |
libdw: Add dwarf_next_lines to read .debug_line tables without CUs.
It is sometimes useful to read .debug_line tables on their own without
having an associated CU DIE. DWARF5 line tables are self-contained.
Adjust dwarf_begin_elf to accept ELF files with just a .debug_line.
Add a new function dwarf_next_lines that returns the Dwarf_Files and
Dwarf_Lines while iterating over just the .debug_lines section. Since
we parse and cache the information it also will try to match the CU
a table is associated with. This is only necessary for DWARF4 line
tables (we will need at least the compilation dir from the CU) and
won't be done for DWARF5 line tables. It also isn't an error if there
is no associated CU (but will mean for DWARF4 line tables the dir list
and the file paths might not be complete).
A typical way to call this new function is:
Dwarf_Off off, next_off = 0;
Dwarf_CU *cu = NULL;
Dwarf_Files *files;
size_t nfiles;
Dwarf_Lines *lines;
size_t nlines;
int res;
while ((res = dwarf_next_lines (dbg, off = next_off, &next_off, &cu,
&files, &nfiles, &lines, &nlines)) == 0)
{
/* ... handle files and lines ... */
}
if (res < 0)
printf ("BAD dwarf_next_lines: %s\n", dwarf_errmsg (-1));
See libdw.h for the full documentation. For more examples on how to use
the function see the new testcases next-files and next-lines.
Also adjust the file paths for line tables missing a comp_dir.
They are no longer made "absolute" by prepending a slash '/' in front
of them. This really was not useful and didn't happen in any of the
testcases. They are now just kept relative.
Make eu-readelf --debug-dump=decodedline use dwarf_next_lines instead
of iterating over the CUs to show the (decoded) line tables. This allows
it to show decoded line tables even if there is no .debug_info section.
New tests have been added that mimic the get-files and get-lines tests
but use dwarf_next_lines instead of iterating over all CUs. They produce
identical output (modulo the CU information). Also add a new test file
that contains only a .debug_line section.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'tests/testfile-x32-s.bz2')
0 files changed, 0 insertions, 0 deletions