- Add some extra methods to DataReader which obtain a new reader with additional restrictions.
- Use new methods to simplify a few places in DwarfFile. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39918 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -36,6 +36,21 @@ public:
|
|||||||
fOverflow = false;
|
fOverflow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataReader RestrictedReader()
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataReader RestrictedReader(off_t maxLength)
|
||||||
|
{
|
||||||
|
return DataReader(fData, maxLength, fAddressSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
DataReader RestrictedReader(off_t relativeOffset, off_t maxLength)
|
||||||
|
{
|
||||||
|
return DataReader(fData + relativeOffset, maxLength, fAddressSize);
|
||||||
|
}
|
||||||
|
|
||||||
bool HasData() const
|
bool HasData() const
|
||||||
{
|
{
|
||||||
return fSize > 0;
|
return fSize > 0;
|
||||||
|
|||||||
@@ -672,8 +672,10 @@ DwarfFile::UnwindCallFrame(CompilationUnit* unit,
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
DataReader restrictedReader =
|
||||||
|
dataReader.RestrictedReader(remaining);
|
||||||
error = _ParseFrameInfoInstructions(unit, context,
|
error = _ParseFrameInfoInstructions(unit, context,
|
||||||
dataReader.Offset(), remaining);
|
restrictedReader);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
@@ -1604,22 +1606,15 @@ DwarfFile::_ParseCIE(CompilationUnit* unit, CfaContext& context,
|
|||||||
if (remaining < 0)
|
if (remaining < 0)
|
||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
|
|
||||||
return _ParseFrameInfoInstructions(unit, context,
|
DataReader restrictedReader = dataReader.RestrictedReader(remaining);
|
||||||
cieOffset + dataReader.Offset(), remaining);
|
return _ParseFrameInfoInstructions(unit, context, restrictedReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
|
DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
|
||||||
CfaContext& context, off_t instructionOffset, off_t instructionSize)
|
CfaContext& context, DataReader& dataReader)
|
||||||
{
|
{
|
||||||
if (instructionSize <= 0)
|
|
||||||
return B_OK;
|
|
||||||
|
|
||||||
DataReader dataReader(
|
|
||||||
(uint8*)fDebugFrameSection->Data() + instructionOffset,
|
|
||||||
instructionSize, unit->AddressSize());
|
|
||||||
|
|
||||||
while (dataReader.BytesRemaining() > 0) {
|
while (dataReader.BytesRemaining() > 0) {
|
||||||
TRACE_CFI(" [%2lld]", dataReader.BytesRemaining());
|
TRACE_CFI(" [%2lld]", dataReader.BytesRemaining());
|
||||||
|
|
||||||
|
|||||||
@@ -116,8 +116,7 @@ private:
|
|||||||
CIEAugmentation& cieAugmentation);
|
CIEAugmentation& cieAugmentation);
|
||||||
status_t _ParseFrameInfoInstructions(
|
status_t _ParseFrameInfoInstructions(
|
||||||
CompilationUnit* unit, CfaContext& context,
|
CompilationUnit* unit, CfaContext& context,
|
||||||
off_t instructionOffset,
|
DataReader& dataReader);
|
||||||
off_t instructionSize);
|
|
||||||
|
|
||||||
status_t _ParsePublicTypesInfo();
|
status_t _ParsePublicTypesInfo();
|
||||||
status_t _ParsePublicTypesInfo(DataReader& dataReader,
|
status_t _ParsePublicTypesInfo(DataReader& dataReader,
|
||||||
|
|||||||
Reference in New Issue
Block a user