diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2024-10-10 14:15:51 -0700 |
---|---|---|
committer | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2024-10-13 13:02:56 -0700 |
commit | d9252a0459d2d62eeca3213264c67bde23c679bd (patch) | |
tree | 17791666f15580ed6bbd8be9ce259d5b923e852d /gprofng | |
parent | df89bdf0baf106c3b0a9fae53e4e48607a7f3f87 (diff) | |
download | binutils-d9252a0459d2d62eeca3213264c67bde23c679bd.zip binutils-d9252a0459d2d62eeca3213264c67bde23c679bd.tar.gz binutils-d9252a0459d2d62eeca3213264c67bde23c679bd.tar.bz2 |
Fix 32110 gprofng segfaults on parsing DWARF of clang++ 18.1.3 produced binary
gprofng does not handle DW_FORM_strx1* forms correctly.
gprofng/ChangeLog
2024-10-10 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR 32110
* src/DwarfLib.cc: Handle DW_FORM_strx* forms.
Diffstat (limited to 'gprofng')
-rw-r--r-- | gprofng/src/DwarfLib.cc | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/gprofng/src/DwarfLib.cc b/gprofng/src/DwarfLib.cc index 18c47a4..a150c76 100644 --- a/gprofng/src/DwarfLib.cc +++ b/gprofng/src/DwarfLib.cc @@ -1006,6 +1006,10 @@ Dwr_Tag::dump () case DW_FORM_string: case DW_FORM_line_strp: case DW_FORM_strp_sup: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: case DW_FORM_implicit_const: Dprintf (DUMP_DWARFLIB, " \"%s\"", atrp->u.str ? atrp->u.str : "<NULL>"); break; @@ -1018,6 +1022,15 @@ Dwr_Tag::dump () atrp->u.str); break; case DW_FORM_addr: + case DW_FORM_addrx: + case DW_FORM_addrx1: + case DW_FORM_addrx2: + case DW_FORM_addrx3: + case DW_FORM_addrx4: + case DW_FORM_ref_sup4: + case DW_FORM_ref_sup8: + case DW_FORM_loclistx: + case DW_FORM_rnglistx: case DW_FORM_data2: case DW_FORM_data4: case DW_FORM_data8: @@ -2058,25 +2071,40 @@ DwrCU::set_die (Dwarf_Die die) (void) debug_infoSec->Get_64 (); break; case DW_FORM_addrx: - case DW_FORM_strx: case DW_FORM_loclistx: case DW_FORM_rnglistx: atf->u.offset = debug_infoSec->GetULEB128 (); break; - case DW_FORM_addrx1: + case DW_FORM_strx: + atf->u.offset = debug_infoSec->GetULEB128 (); + atf->u.str = get_string (dwarf->debug_strSec, atf->u.offset); + break; case DW_FORM_strx1: atf->u.offset = debug_infoSec->Get_8 (); + atf->u.str = get_string (dwarf->debug_strSec, atf->u.offset); break; - case DW_FORM_addrx2: case DW_FORM_strx2: atf->u.offset = debug_infoSec->Get_16 (); + atf->u.str = get_string (dwarf->debug_strSec, atf->u.offset); break; - case DW_FORM_addrx3: case DW_FORM_strx3: atf->u.offset = debug_infoSec->Get_24 (); + atf->u.str = get_string (dwarf->debug_strSec, atf->u.offset); break; - case DW_FORM_addrx4: case DW_FORM_strx4: + atf->u.offset = debug_infoSec->Get_32 (); + atf->u.str = get_string (dwarf->debug_strSec, atf->u.offset); + break; + case DW_FORM_addrx1: + atf->u.offset = debug_infoSec->Get_8 (); + break; + case DW_FORM_addrx2: + atf->u.offset = debug_infoSec->Get_16 (); + break; + case DW_FORM_addrx3: + atf->u.offset = debug_infoSec->Get_24 (); + break; + case DW_FORM_addrx4: case DW_FORM_ref_sup4: atf->u.offset = debug_infoSec->Get_32 (); break; |