Skip to content

Commit

Permalink
Debugger: Minor tweak to ExpressionEvaluationJob.
Browse files Browse the repository at this point in the history
- ExpressionEvaluationJob now stores the final result value,
  and provides an accessor to it.
  • Loading branch information
anevilyak committed Oct 30, 2014
1 parent 942226c commit 43060a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/apps/debugger/jobs/ExpressionEvaluationJob.cpp
Expand Up @@ -34,7 +34,8 @@ ExpressionEvaluationJob::ExpressionEvaluationJob(Team* team,
fResultType(resultType),
fFrame(frame),
fThread(thread),
fManager(NULL)
fManager(NULL),
fResultValue(NULL)
{
fLanguage->AcquireReference();
if (fFrame != NULL)
Expand All @@ -53,6 +54,8 @@ ExpressionEvaluationJob::~ExpressionEvaluationJob()
fThread->ReleaseReference();
if (fManager != NULL)
fManager->ReleaseReference();
if (fResultValue != NULL)
fResultValue->ReleaseReference();
}


Expand All @@ -66,8 +69,6 @@ ExpressionEvaluationJob::Key() const
status_t
ExpressionEvaluationJob::Do()
{

Value* value = NULL;
BReference<Value> reference;
status_t result = B_OK;
if (fFrame != NULL && fManager == NULL) {
Expand All @@ -85,18 +86,17 @@ ExpressionEvaluationJob::Do()

ValueNode* neededNode = NULL;
result = fLanguage->EvaluateExpression(fExpression,
fResultType, fManager, value, neededNode);
fResultType, fManager, fResultValue, neededNode);
if (neededNode != NULL) {
result = ResolveNodeValue(neededNode);
if (State() == JOB_STATE_WAITING)
return B_OK;
else if (value != NULL)
reference.SetTo(value, true);
// if result != B_OK, fall through
}

AutoLocker<Team> teamLocker(fTeam);
fTeam->NotifyExpressionEvaluated(fExpression.String(), result, value);
fTeam->NotifyExpressionEvaluated(fExpression.String(), result,
fResultValue);

return B_OK;
}
Expand Down
3 changes: 3 additions & 0 deletions src/apps/debugger/jobs/Jobs.h
Expand Up @@ -245,6 +245,8 @@ class ExpressionEvaluationJob : public Job {
virtual const JobKey& Key() const;
virtual status_t Do();

Value* GetResultValue() const { return fResultValue; }

private:
status_t ResolveNodeValue(ValueNode* node);

Expand All @@ -260,6 +262,7 @@ class ExpressionEvaluationJob : public Job {
StackFrame* fFrame;
Thread* fThread;
ValueNodeManager* fManager;
Value* fResultValue;
};


Expand Down

0 comments on commit 43060a5

Please sign in to comment.