From 4ee20b83b4a00bc90c97201695caab2f2a2d0385 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 16 Jul 2011 03:01:21 +0000 Subject: [PATCH] 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 --- src/apps/debugger/dwarf/DwarfFile.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index e96aea49f2..647edbb393 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -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));