Author: anevilyak Date: 2011-07-16 05:01:21 +0200 (Sat, 16 Jul 2011) New Revision: 42434 Changeset: https://dev.haiku-os.org/changeset/42434 Ticket: https://dev.haiku-os.org/ticket/7818 Modified: haiku/trunk/src/apps/debugger/dwarf/DwarfFile.cpp Log: 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. Modified: haiku/trunk/src/apps/debugger/dwarf/DwarfFile.cpp =================================================================== --- haiku/trunk/src/apps/debugger/dwarf/DwarfFile.cpp 2011-07-15 18:50:14 UTC (rev 42433) +++ haiku/trunk/src/apps/debugger/dwarf/DwarfFile.cpp 2011-07-16 03:01:21 UTC (rev 42434) @@ -230,12 +230,9 @@ 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 @@ // 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));