Introduce a flag in ExpressionEvaluationContext in order to distinguish between

cases where no object pointer is available vs the object pointer being present
but NULL, which would previously not be pushed onto the stack, leading to
expression evaluation failures.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42274 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2011-06-21 01:53:46 +00:00
parent 2b86134925
commit 0573015d14
5 changed files with 17 additions and 12 deletions

View File

@ -258,7 +258,7 @@ DwarfStackFrameDebugInfo::_CreateVariable(ObjectID* id, const BString& name,
if (locationDescription->IsValid()) {
status_t error = type->ResolveLocation(fTypeContext,
locationDescription, 0, *location);
locationDescription, 0, false, *location);
if (error != B_OK)
return error;

View File

@ -213,13 +213,14 @@ DwarfType::ResolveObjectDataLocation(target_addr_t objectAddress,
status_t
DwarfType::ResolveLocation(DwarfTypeContext* typeContext,
const LocationDescription* description, target_addr_t objectAddress,
ValueLocation& _location)
bool hasObjectAddress, ValueLocation& _location)
{
status_t error = typeContext->File()->ResolveLocation(
typeContext->GetCompilationUnit(), typeContext->SubprogramEntry(),
description, typeContext->TargetInterface(),
typeContext->InstructionPointer(), objectAddress,
typeContext->FramePointer(), typeContext->RelocationDelta(), _location);
typeContext->InstructionPointer(), objectAddress, hasObjectAddress,
typeContext->FramePointer(), typeContext->RelocationDelta(),
_location);
if (error != B_OK)
return error;
@ -678,7 +679,7 @@ DwarfCompoundType::_ResolveDataMemberLocation(DwarfType* memberType,
// evaluate the location description
status_t error = memberType->ResolveLocation(TypeContext(),
&locationDescription, piece.address, *location);
&locationDescription, piece.address, true, *location);
if (error != B_OK)
return error;

View File

@ -120,6 +120,7 @@ public:
status_t ResolveLocation(DwarfTypeContext* typeContext,
const LocationDescription* description,
target_addr_t objectAddress,
bool hasObjectAddress,
ValueLocation& _location);
private:

View File

@ -36,7 +36,7 @@ public:
DIESubprogram* subprogramEntry,
const DwarfTargetInterface* targetInterface,
target_addr_t instructionPointer, target_addr_t objectPointer,
target_addr_t framePointer,
bool hasObjectPointer, target_addr_t framePointer,
target_addr_t relocationDelta)
:
DwarfExpressionEvaluationContext(targetInterface, unit->AddressSize(),
@ -46,6 +46,7 @@ public:
fSubprogramEntry(subprogramEntry),
fInstructionPointer(instructionPointer),
fObjectPointer(objectPointer),
fHasObjectPointer(hasObjectPointer),
fFramePointer(framePointer),
fFrameBasePointer(0),
fFrameBaseEvaluated(false)
@ -54,7 +55,7 @@ public:
virtual bool GetObjectAddress(target_addr_t& _address)
{
if (fObjectPointer == 0)
if (!fHasObjectPointer)
return false;
_address = fObjectPointer;
@ -145,6 +146,7 @@ private:
DIESubprogram* fSubprogramEntry;
target_addr_t fInstructionPointer;
target_addr_t fObjectPointer;
bool fHasObjectPointer;
target_addr_t fFramePointer;
target_addr_t fFrameBasePointer;
bool fFrameBaseEvaluated;
@ -827,7 +829,7 @@ DwarfFile::EvaluateExpression(CompilationUnit* unit,
target_addr_t valueToPush, bool pushValue, target_addr_t& _result)
{
ExpressionEvaluationContext context(this, unit, subprogramEntry,
targetInterface, instructionPointer, 0, framePointer, 0);
targetInterface, instructionPointer, 0, false, framePointer, 0);
DwarfExpressionEvaluator evaluator(&context);
if (pushValue && evaluator.Push(valueToPush) != B_OK)
@ -842,8 +844,8 @@ DwarfFile::ResolveLocation(CompilationUnit* unit,
DIESubprogram* subprogramEntry, const LocationDescription* location,
const DwarfTargetInterface* targetInterface,
target_addr_t instructionPointer, target_addr_t objectPointer,
target_addr_t framePointer, target_addr_t relocationDelta,
ValueLocation& _result)
bool hasObjectPointer, target_addr_t framePointer,
target_addr_t relocationDelta, ValueLocation& _result)
{
// get the expression
const void* expression;
@ -855,8 +857,8 @@ DwarfFile::ResolveLocation(CompilationUnit* unit,
// evaluate it
ExpressionEvaluationContext context(this, unit, subprogramEntry,
targetInterface, instructionPointer, objectPointer, framePointer,
relocationDelta);
targetInterface, instructionPointer, objectPointer, hasObjectPointer,
framePointer, relocationDelta);
DwarfExpressionEvaluator evaluator(&context);
return evaluator.EvaluateLocation(expression, expressionLength,
_result);

View File

@ -68,6 +68,7 @@ public:
const DwarfTargetInterface* targetInterface,
target_addr_t instructionPointer,
target_addr_t objectPointer,
bool hasObjectPointer,
target_addr_t framePointer,
target_addr_t relocationDelta,
ValueLocation& _result);