From: Mark Wielaard Date: Fri, 10 Feb 2023 12:56:58 +0000 (+0100) Subject: libdw: Handle DW_OP_GNU_uninit in dwarf_getlocation X-Git-Tag: elfutils-0.189~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eab09c65a9eacb3f6001488f6980e5ac8f0c0aeb;p=thirdparty%2Felfutils.git libdw: Handle DW_OP_GNU_uninit in dwarf_getlocation dwarf_getlocation would return an error when it saw a DW_OP_GNU_uninit. Handle it by simply recognizing as a no argument operation. DW_OP_GNU_uninit is emitted by GCC as a marker to flag the location expression as referring to an uninitialized value. Signed-off-by: Mark Wielaard --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 2c1f61e89..ddf14e550 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2023-02-10 Mark Wielaard + + * dwarf_getlocation.c (__libdw_intern_expression): Handle + DW_OP_GNU_uninit. + 2023-02-12 Mark Wielaard * cfi.c (execute_cfi): Add cfi_asser before reading second lib128. diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index 4e8c047b5..66eab3e99 100644 --- a/libdw/dwarf_getlocation.c +++ b/libdw/dwarf_getlocation.c @@ -396,6 +396,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order, case DW_OP_form_tls_address: case DW_OP_GNU_push_tls_address: case DW_OP_stack_value: + case DW_OP_GNU_uninit: /* No operand. */ break; diff --git a/tests/ChangeLog b/tests/ChangeLog index 89f1a9918..eb3e1118f 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2023-02-10 Mark Wielaard + + * varlocs.c (print_expr): Handle DW_OP_GNU_uninit. + 2023-02-07 Mark Wielaard * tests/funcretval.c (handle_function): Check for diff --git a/tests/varlocs.c b/tests/varlocs.c index d2c13767c..8e563fd32 100644 --- a/tests/varlocs.c +++ b/tests/varlocs.c @@ -251,6 +251,12 @@ print_expr (Dwarf_Attribute *attr, Dwarf_Op *expr, Dwarf_Addr addr, int depth) printf ("%s", opname); break; + case DW_OP_GNU_uninit: + /* No arguments. Special. It means the expression describes + an value which hasn't been initialized (yet). */ + printf ("%s", opname); + break; + case DW_OP_call_frame_cfa: /* No arguments. Special. Pushes Call Frame Address as computed by CFI data (dwarf_cfi_addrframe will fetch that info (either from