]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdw: Refactor dwarf_next_lines and fix skipped CU
authorOmar Sandoval <osandov@fb.com>
Mon, 26 Feb 2024 19:32:49 +0000 (11:32 -0800)
committerMark Wielaard <mark@klomp.org>
Thu, 29 Feb 2024 22:57:43 +0000 (23:57 +0100)
commit855769777519cfa37d2bfe06a623acdbbba59faa
treefb86477121e51e028138202a7f9f132f0c144100
parentd7768acc697735cc7498ddc891a1065439ba1d6f
libdw: Refactor dwarf_next_lines and fix skipped CU

dwarf_next_lines has two loops over CUs: one from the CU after the given
CU to the end, and one from the first CU up to _but not including_ the
given CU.  This means that the given CU is never checked.

This is unlikely to matter in practice since CUs usually correspond 1:1
with line number tables in the same order, but let's fix it anyways.
Refactoring it to one loop fixes the problem and simplifies the next
change to support DWARF package files.

* libdw/dwarf_next_lines.c (dwarf_next_lines): Refactor loops
over CUs into one loop.

Signed-off-by: Omar Sandoval <osandov@fb.com>
libdw/dwarf_next_lines.c