Debugger: implement DWARF5 compile unit header parsing

* introduce new field unitType. Currently we support only
  DW_UT_compile unit type.

* abbrevOffset and addressSize are shuffled around

Change-Id: I67db242240012b52e0ec59f87ffab7cb937eb212
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6981
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
David Karoly 2023-10-05 14:21:15 +02:00 committed by Rene Gollent
parent a5c358a6db
commit 3f2abbc390

View File

@ -988,10 +988,29 @@ DwarfFile::_ParseDebugInfoSection()
}
int version = dataReader.Read<uint16>(0);
off_t abbrevOffset = dwarf64
? dataReader.Read<uint64>(0)
: dataReader.Read<uint32>(0);
uint8 addressSize = dataReader.Read<uint8>(0);
if (version >= 5) {
uint8 unitType = dataReader.Read<uint8>(0);
if (unitType != DW_UT_compile) {
WARNING("\"%s\": Unsupported unit type %d\n",
fName, unitType);
return B_UNSUPPORTED;
}
}
off_t abbrevOffset;
uint8 addressSize;
if (version >= 5) {
addressSize = dataReader.Read<uint8>(0);
abbrevOffset = dwarf64
? dataReader.Read<uint64>(0)
: dataReader.Read<uint32>(0);
} else {
abbrevOffset = dwarf64
? dataReader.Read<uint64>(0)
: dataReader.Read<uint32>(0);
addressSize = dataReader.Read<uint8>(0);
}
if (dataReader.HasOverflow()) {
WARNING("\"%s\": Unexpected end of data in compilation unit "