In the case where the .eh_frame section was used, Debugger was reading the

exception table address at the wrong location, leading to totally bogus values
for the alignment factors and return register, which ultimately resulted in
failing to reconstruct the CFI. (.eh_frame Format reference:
http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html )

Fixes #7818.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42434 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-07-16 03:01:21 +00:00
parent aeba7dc609
commit 4ee20b83b4
+8 -5
View File
@@ -230,12 +230,9 @@ struct DwarfFile::CIEAugmentation {
return B_OK;
}
if (strcmp(fString, "eh") == 0) {
// the augmentation consists of the exception table pointer
// -- just ignore it
dataReader.ReadAddress(0);
// nothing to do
if (strcmp(fString, "eh") == 0)
return B_OK;
}
// something we can't handle
return B_UNSUPPORTED;
@@ -1584,6 +1581,12 @@ DwarfFile::_ParseCIE(CompilationUnit* unit, CfaContext& context,
// read the augmentation string
cieAugmentation.Init(dataReader);
// in the cause of augmentation string "eh",
// the exception table pointer is located immediately before the
// code/data alignment values. We have no use for it so simply skip.
if (strcmp(cieAugmentation.String(), "eh") == 0)
dataReader.Skip(dwarf64 ? sizeof(uint64) : sizeof(uint32));
context.SetCodeAlignment(dataReader.ReadUnsignedLEB128(0));
context.SetDataAlignment(dataReader.ReadSignedLEB128(0));
context.SetReturnAddressRegister(dataReader.ReadUnsignedLEB128(0));