Handle return value CPU states.
- DwarfStackFrameDebugInfo::CreateReturnValue() now takes a cpu state parameter. This is attached to the associated Variable object. - ResolveValueNodeJob() now checks if the value node child it's dealing with is that of a variable. If so it pulls that CpuState for the ValueLoader's purposes rather than the current state. This gets return values for multiple function calls in the same statement working.
This commit is contained in:
parent
47ffc32bc0
commit
2c6fab1de6
@ -1166,7 +1166,7 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
|
||||
BReference<FunctionID> idReference(
|
||||
targetFunction->GetFunctionID(), true);
|
||||
result = factory.CreateReturnValue(idReference, returnType,
|
||||
location, variable);
|
||||
location, subroutineState, variable);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "Architecture.h"
|
||||
#include "CompilationUnit.h"
|
||||
#include "CpuState.h"
|
||||
#include "DebugInfoEntries.h"
|
||||
#include "Dwarf.h"
|
||||
#include "DwarfFile.h"
|
||||
@ -279,7 +280,8 @@ DwarfStackFrameDebugInfo::CreateLocalVariable(FunctionID* functionID,
|
||||
|
||||
status_t
|
||||
DwarfStackFrameDebugInfo::CreateReturnValue(FunctionID* functionID,
|
||||
DIEType* returnType, ValueLocation* location, Variable*& _variable)
|
||||
DIEType* returnType, ValueLocation* location, CpuState* state,
|
||||
Variable*& _variable)
|
||||
{
|
||||
if (returnType == NULL)
|
||||
return B_BAD_VALUE;
|
||||
@ -300,7 +302,7 @@ DwarfStackFrameDebugInfo::CreateReturnValue(FunctionID* functionID,
|
||||
name.SetToFormat("%s returned", functionID->FunctionName().String());
|
||||
|
||||
Variable* variable = new(std::nothrow) Variable(id, name,
|
||||
type, location);
|
||||
type, location, state);
|
||||
if (variable == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
|
||||
class CompilationUnit;
|
||||
class CpuState;
|
||||
class DIEFormalParameter;
|
||||
class DIESubprogram;
|
||||
class DIEType;
|
||||
@ -60,6 +61,7 @@ public:
|
||||
status_t CreateReturnValue(FunctionID* functionID,
|
||||
DIEType* returnType,
|
||||
ValueLocation* location,
|
||||
CpuState* state,
|
||||
Variable*& _variable);
|
||||
// returns reference
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2012-2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -18,6 +18,8 @@
|
||||
#include "ValueLocation.h"
|
||||
#include "ValueNode.h"
|
||||
#include "ValueNodeContainer.h"
|
||||
#include "Variable.h"
|
||||
#include "VariableValueNodeChild.h"
|
||||
|
||||
|
||||
ResolveValueNodeValueJob::ResolveValueNodeValueJob(
|
||||
@ -144,9 +146,16 @@ ResolveValueNodeValueJob::_ResolveNodeValue()
|
||||
}
|
||||
}
|
||||
|
||||
CpuState* variableCpuState = NULL;
|
||||
VariableValueNodeChild* variableChild = dynamic_cast<
|
||||
VariableValueNodeChild*>(nodeChild);
|
||||
if (variableChild != NULL)
|
||||
variableCpuState = variableChild->GetVariable()->GetCpuState();
|
||||
|
||||
// resolve the node location and value
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
|
||||
fTypeInformation, fCpuState);
|
||||
fTypeInformation, variableCpuState != NULL ? variableCpuState
|
||||
: fCpuState);
|
||||
ValueLocation* location;
|
||||
Value* value;
|
||||
status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader,
|
||||
|
Loading…
Reference in New Issue
Block a user