UShort ver;
UChar addr_size = 0;
+ UChar unit_type = 0;
DiCursor p = unitblock_img;
DiCursor end_img;
DiCursor abbrev_img;
if (ver >= 5)
/* unit_type for DWARF5 */
- /* unit_type = */ ML_(cur_step_UChar)(&p);
+ unit_type = ML_(cur_step_UChar)(&p);
else
/* get offset in abbrev */
atoffs = ui->dw64 ? ML_(cur_step_ULong)(&p)
/* Address size */
addr_size = ML_(cur_step_UChar)(&p);
- if (ver >= 5)
+ if (ver >= 5) {
/* get offset in abbrev */
atoffs = ui->dw64 ? ML_(cur_step_ULong)(&p)
: (ULong)(ML_(cur_step_UInt)(&p));
+ /* read any extra fields */
+ switch(unit_type) {
+ case DW_UT_compile:
+ case DW_UT_partial:
+ break;
+ case DW_UT_skeleton:
+ case DW_UT_split_compile:
+ /* dwo_id = */ ML_(cur_step_ULong)(&p);
+ break;
+ case DW_UT_type:
+ case DW_UT_split_type:
+ /* type_signature = */ ML_(cur_step_ULong)(&p);
+ /* type_offset = */ ui->dw64 ? ML_(cur_step_ULong)(&p)
+ : (ULong)(ML_(cur_step_UInt)(&p));
+ break;
+ default:
+ VG_(printf)( "### unhandled dwarf2 unit_type code 0x%x\n",
+ unit_type );
+ break;
+ }
+ }
+
/* End of this block */
end_img = ML_(cur_plus)(unitblock_img, blklen + (ui->dw64 ? 12 : 4));
cc->is_type_unit = type_unit;
cc->is_alt_info = alt_info;
- if (type_unit || (cc->version >= 5 && unit_type == DW_UT_type)) {
+ if (type_unit || (cc->version >= 5 && (unit_type == DW_UT_type
+ || unit_type == DW_UT_split_type))) {
cc->type_signature = get_ULong( c );
cc->type_offset = get_Dwarfish_UWord( c, cc->is_dw64 );
}
+ if (cc->version >= 5 && (unit_type == DW_UT_skeleton
+ || unit_type == DW_UT_split_compile)) {
+ /* dwo_id = */ get_ULong( c );
+ }
+
/* Set up cc->debug_abbv to point to the relevant table for this
CU. Set its .szB so that at least we can't read off the end of
the debug_abbrev section -- potentially (and quite likely) too