Debugger: Cleanup.

Team:
- Remove expression evaluation event / listener hook. This doesn't
  really belong to the Team anyways.

UserInterfaceListener:
- ExpressionEvaluationRequested() now takes an ExpressionInfo object
  rather than the individual subcomponents.

ExpressionEvaluationJob:
- Notification of expression evaluation completion is now handled
  via the info object's listener interface rather than the Team.

Others:
- Adjust all users of expressions to set themselves up as
  ExpressionInfo::Listener subclasses, and consequently add themselves
  to the respective info object when requesting evaluation. This
  significantly simplifies various things, and also ensures that no
  one accidentally gets notified of an expression they didn't actually
  ask for, which could occur with the previous Team-based listener
  interface. Make all other required adjustments for new interface
  usage.

No functional change intended.
This commit is contained in:
Rene Gollent
2014-11-08 18:42:53 -05:00
parent 05d1068c97
commit d1c9ffed34
22 changed files with 310 additions and 352 deletions
+18 -20
View File
@@ -28,6 +28,7 @@
#include "CpuState.h"
#include "DebuggerInterface.h"
#include "DebugReportGenerator.h"
#include "ExpressionInfo.h"
#include "FileManager.h"
#include "Function.h"
#include "FunctionID.h"
@@ -751,19 +752,17 @@ TeamDebugger::MessageReceived(BMessage* message)
}
// ExpressionEvaluationRequested() acquires a reference
// on our behalf.
// to both the language and the expression info on our behalf.
BReference<SourceLanguage> reference(language, true);
const char* expression;
if (message->FindString("expression", &expression) != B_OK)
break;
type_code resultType;
if (message->FindInt32("type",
reinterpret_cast<int32*>(&resultType)) != B_OK) {
ExpressionInfo* info;
if (message->FindPointer("info",
reinterpret_cast<void**>(&info)) != B_OK) {
break;
}
BReference<ExpressionInfo> infoReference(info, true);
StackFrame* frame;
if (message->FindPointer("frame",
reinterpret_cast<void**>(&frame)) != B_OK) {
@@ -780,8 +779,7 @@ TeamDebugger::MessageReceived(BMessage* message)
thread = NULL;
}
_HandleEvaluateExpression(language, expression, resultType,
frame, thread);
_HandleEvaluateExpression(language, info, frame, thread);
break;
}
@@ -1162,21 +1160,22 @@ TeamDebugger::InspectRequested(target_addr_t address,
void
TeamDebugger::ExpressionEvaluationRequested(SourceLanguage* language,
const char* expression, type_code resultType, StackFrame* frame,
::Thread* thread)
ExpressionInfo* info, StackFrame* frame, ::Thread* thread)
{
BMessage message(MSG_EVALUATE_EXPRESSION);
message.AddPointer("language", language);
message.AddString("expression", expression);
message.AddInt32("type", resultType);
message.AddPointer("info", info);
if (frame != NULL)
message.AddPointer("frame", frame);
if (thread != NULL)
message.AddPointer("thread", thread);
BReference<SourceLanguage> reference(language);
if (PostMessage(&message) == B_OK)
reference.Detach();
BReference<SourceLanguage> languageReference(language);
BReference<ExpressionInfo> infoReference(info);
if (PostMessage(&message) == B_OK) {
languageReference.Detach();
infoReference.Detach();
}
}
@@ -2060,12 +2059,11 @@ TeamDebugger::_HandleInspectAddress(target_addr_t address,
void
TeamDebugger::_HandleEvaluateExpression(SourceLanguage* language,
const char* expression, type_code resultType, StackFrame* frame,
::Thread* thread)
ExpressionInfo* info, StackFrame* frame, ::Thread* thread)
{
status_t result = fWorker->ScheduleJob(
new(std::nothrow) ExpressionEvaluationJob(fTeam, fDebuggerInterface,
language, expression, resultType, frame, thread));
language, info, frame, thread));
if (result != B_OK) {
_NotifyUser("Evaluate Expression", "Failed to evaluate expression: %s",
strerror(result));