]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdw: Fix dwarf_macro_getsrcfiles for DWARF 5
authorOmar Sandoval <osandov@fb.com>
Wed, 27 Sep 2023 18:20:54 +0000 (11:20 -0700)
committerMark Wielaard <mark@klomp.org>
Tue, 3 Oct 2023 21:01:13 +0000 (23:01 +0200)
commit4bddabc1e7f3020b83a5abd98901146c58da403e
tree1eb704585306b2666144abe762d416abc835bc2e
parent8a0d1d7ee7371c086fc11c166160196515c210e6
libdw: Fix dwarf_macro_getsrcfiles for DWARF 5

Dwarf_Macro_Op_Table::is_64bit conflates the address size and the offset
size: for .debug_macinfo, it is initialized based on the compilation
unit's address size, but for .debug_macro, it is initialized based on
the macro unit's offset size.  is_64bit is used to determine the address
size to pass to __libdw_getsrclines.  For a 64-bit architecture using
DWARF 5 with 32-bit offsets (the common case), this fails because
read_srclines checks that the given address size matches the address
size from the line number program header.

Fix it by splitting is_64bit into separate address_size and offset_size
members.

Fixes: fb90bf3f84b5 ("Support .debug_macro")
Signed-off-by: Omar Sandoval <osandov@fb.com>
libdw/ChangeLog
libdw/dwarf_getmacros.c
libdw/dwarf_macro_getsrcfiles.c
libdw/libdwP.h