Cleanup: store and retrieve the relocation delta from
the evaluation context instead. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39416 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
de2e54ace0
commit
1a5bb78d9e
@ -36,10 +36,12 @@ static const uint32 kMaxOperationCount = 10000;
|
||||
|
||||
|
||||
DwarfExpressionEvaluationContext::DwarfExpressionEvaluationContext(
|
||||
const DwarfTargetInterface* targetInterface, uint8 addressSize)
|
||||
const DwarfTargetInterface* targetInterface, uint8 addressSize,
|
||||
target_addr_t relocationDelta)
|
||||
:
|
||||
fTargetInterface(targetInterface),
|
||||
fAddressSize(addressSize)
|
||||
fAddressSize(addressSize),
|
||||
fRelocationDelta(relocationDelta)
|
||||
{
|
||||
}
|
||||
|
||||
@ -159,8 +161,8 @@ DwarfExpressionEvaluator::Evaluate(const void* expression, size_t size,
|
||||
|
||||
status_t
|
||||
DwarfExpressionEvaluator::EvaluateLocation(const void* expression, size_t size,
|
||||
target_addr_t relocationDelta, ValueLocation& _location)
|
||||
{
|
||||
ValueLocation& _location)
|
||||
{
|
||||
_location.Clear();
|
||||
|
||||
// the empty expression is a valid one
|
||||
@ -181,7 +183,7 @@ DwarfExpressionEvaluator::EvaluateLocation(const void* expression, size_t size,
|
||||
_Push(objectAddress);
|
||||
|
||||
ValuePieceLocation piece;
|
||||
status_t error = _Evaluate(&piece, relocationDelta);
|
||||
status_t error = _Evaluate(&piece);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
@ -229,7 +231,7 @@ DwarfExpressionEvaluator::EvaluateLocation(const void* expression, size_t size,
|
||||
_Push(objectAddress);
|
||||
|
||||
ValuePieceLocation piece;
|
||||
status_t error = _Evaluate(&piece, relocationDelta);
|
||||
status_t error = _Evaluate(&piece);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
@ -262,8 +264,7 @@ DwarfExpressionEvaluator::EvaluateLocation(const void* expression, size_t size,
|
||||
|
||||
|
||||
status_t
|
||||
DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece,
|
||||
target_addr_t relocationDelta)
|
||||
DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece)
|
||||
{
|
||||
TRACE_EXPR_ONLY({
|
||||
TRACE_EXPR("DwarfExpressionEvaluator::_Evaluate(%p, %lld)\n",
|
||||
@ -283,7 +284,7 @@ DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece,
|
||||
switch (opcode) {
|
||||
case DW_OP_addr:
|
||||
TRACE_EXPR(" DW_OP_addr\n");
|
||||
_Push(fDataReader.ReadAddress(0) + relocationDelta);
|
||||
_Push(fDataReader.ReadAddress(0) + fContext->RelocationDelta());
|
||||
break;
|
||||
case DW_OP_const1u:
|
||||
TRACE_EXPR(" DW_OP_const1u\n");
|
||||
|
@ -19,13 +19,17 @@ class DwarfExpressionEvaluationContext {
|
||||
public:
|
||||
DwarfExpressionEvaluationContext(
|
||||
const DwarfTargetInterface* targetInterface,
|
||||
uint8 addressSize);
|
||||
uint8 addressSize,
|
||||
target_addr_t relocationDelta);
|
||||
virtual ~DwarfExpressionEvaluationContext();
|
||||
|
||||
const DwarfTargetInterface* TargetInterface() const
|
||||
{ return fTargetInterface; }
|
||||
uint8 AddressSize() const { return fAddressSize; }
|
||||
|
||||
target_addr_t RelocationDelta() const
|
||||
{ return fRelocationDelta; }
|
||||
|
||||
virtual bool GetObjectAddress(target_addr_t& _address) = 0;
|
||||
virtual bool GetFrameAddress(target_addr_t& _address) = 0;
|
||||
virtual bool GetFrameBaseAddress(target_addr_t& _address)
|
||||
@ -43,6 +47,7 @@ public:
|
||||
protected:
|
||||
const DwarfTargetInterface* fTargetInterface;
|
||||
uint8 fAddressSize;
|
||||
target_addr_t fRelocationDelta;
|
||||
};
|
||||
|
||||
|
||||
@ -57,8 +62,7 @@ public:
|
||||
status_t Evaluate(const void* expression, size_t size,
|
||||
target_addr_t& _result);
|
||||
status_t EvaluateLocation(const void* expression,
|
||||
size_t size, target_addr_t relocationDelta,
|
||||
ValueLocation& _location);
|
||||
size_t size, ValueLocation& _location);
|
||||
// The returned location will have DWARF
|
||||
// semantics regarding register numbers and
|
||||
// bit offsets/sizes (cf. bit pieces).
|
||||
@ -72,8 +76,7 @@ private:
|
||||
inline void _Push(target_addr_t value);
|
||||
inline target_addr_t _Pop();
|
||||
|
||||
status_t _Evaluate(ValuePieceLocation* _piece,
|
||||
target_addr_t relocationDelta = 0);
|
||||
status_t _Evaluate(ValuePieceLocation* _piece);
|
||||
void _DereferenceAddress(uint8 addressSize);
|
||||
void _DereferenceAddressSpaceAddress(
|
||||
uint8 addressSize);
|
||||
|
@ -36,9 +36,11 @@ public:
|
||||
DIESubprogram* subprogramEntry,
|
||||
const DwarfTargetInterface* targetInterface,
|
||||
target_addr_t instructionPointer, target_addr_t objectPointer,
|
||||
target_addr_t framePointer)
|
||||
target_addr_t framePointer,
|
||||
target_addr_t relocationDelta)
|
||||
:
|
||||
DwarfExpressionEvaluationContext(targetInterface, unit->AddressSize()),
|
||||
DwarfExpressionEvaluationContext(targetInterface, unit->AddressSize(),
|
||||
relocationDelta),
|
||||
fFile(file),
|
||||
fUnit(unit),
|
||||
fSubprogramEntry(subprogramEntry),
|
||||
@ -828,7 +830,7 @@ DwarfFile::EvaluateExpression(CompilationUnit* unit,
|
||||
target_addr_t valueToPush, bool pushValue, target_addr_t& _result)
|
||||
{
|
||||
ExpressionEvaluationContext context(this, unit, subprogramEntry,
|
||||
targetInterface, instructionPointer, 0, framePointer);
|
||||
targetInterface, instructionPointer, 0, framePointer, 0);
|
||||
DwarfExpressionEvaluator evaluator(&context);
|
||||
|
||||
if (pushValue && evaluator.Push(valueToPush) != B_OK)
|
||||
@ -856,10 +858,11 @@ DwarfFile::ResolveLocation(CompilationUnit* unit,
|
||||
|
||||
// evaluate it
|
||||
ExpressionEvaluationContext context(this, unit, subprogramEntry,
|
||||
targetInterface, instructionPointer, objectPointer, framePointer);
|
||||
targetInterface, instructionPointer, objectPointer, framePointer,
|
||||
relocationDelta);
|
||||
DwarfExpressionEvaluator evaluator(&context);
|
||||
return evaluator.EvaluateLocation(expression, expressionLength,
|
||||
relocationDelta, _result);
|
||||
return evaluator.EvaluateLocation(expression, expressionLength,
|
||||
_result);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user