From 0573015d14887ade1a081baa04dcb7f8da8d19b7 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 21 Jun 2011 01:53:46 +0000 Subject: [PATCH] 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 --- .../debug_info/DwarfStackFrameDebugInfo.cpp | 2 +- src/apps/debugger/debug_info/DwarfTypes.cpp | 9 +++++---- src/apps/debugger/debug_info/DwarfTypes.h | 1 + src/apps/debugger/dwarf/DwarfFile.cpp | 16 +++++++++------- src/apps/debugger/dwarf/DwarfFile.h | 1 + 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp index 6835523d00..99853ae8f3 100644 --- a/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfStackFrameDebugInfo.cpp @@ -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; diff --git a/src/apps/debugger/debug_info/DwarfTypes.cpp b/src/apps/debugger/debug_info/DwarfTypes.cpp index 94fff333b5..0794e500e9 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.cpp +++ b/src/apps/debugger/debug_info/DwarfTypes.cpp @@ -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; diff --git a/src/apps/debugger/debug_info/DwarfTypes.h b/src/apps/debugger/debug_info/DwarfTypes.h index 5e7b87db51..9c5e05d104 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.h +++ b/src/apps/debugger/debug_info/DwarfTypes.h @@ -120,6 +120,7 @@ public: status_t ResolveLocation(DwarfTypeContext* typeContext, const LocationDescription* description, target_addr_t objectAddress, + bool hasObjectAddress, ValueLocation& _location); private: diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index 3b2fe4548a..e96aea49f2 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -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); diff --git a/src/apps/debugger/dwarf/DwarfFile.h b/src/apps/debugger/dwarf/DwarfFile.h index a979c6fa9e..f4d5281862 100644 --- a/src/apps/debugger/dwarf/DwarfFile.h +++ b/src/apps/debugger/dwarf/DwarfFile.h @@ -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);