void CMChooseProcessDialog::Receive ( JBroadcaster* sender, const Message& message ) { if (sender == this && message.Is(JXDialogDirector::kDeactivated)) { const JXDialogDirector::Deactivated* info = dynamic_cast<const JXDialogDirector::Deactivated*>(&message); assert( info != NULL ); if (info->Successful()) { JInteger pid; const JBoolean ok = itsProcessIDInput->GetValue(&pid); assert(ok); if (itsAttachToSelectionFlag) { (CMGetLink())->AttachToProcess(pid); } else { dynamic_cast<GDBLink*>(CMGetLink())->ProgramStarted(pid); } if (itsStopProgramFlag) { (CMGetLink())->StopProgram(); } } } JXDialogDirector::Receive(sender, message); }
void CMBreakpoint::Receive ( JBroadcaster* sender, const Message& message ) { if (message.Is(CMGetFullPath::kFileFound)) { const CMGetFullPath::FileFound* info = dynamic_cast<const CMGetFullPath::FileFound*>(&message); assert( info != NULL ); itsLocation.SetFileName(info->GetFullName()); (CMGetLink()->GetBreakpointManager())->BreakpointFileNameResolved(this); } else if (message.Is(CMGetFullPath::kFileNotFound)) { (CMGetLink()->GetBreakpointManager())->BreakpointFileNameInvalid(this); } else if (message.Is(CMGetFullPath::kNewCommand)) { const CMGetFullPath::NewCommand* info = dynamic_cast<const CMGetFullPath::NewCommand*>(&message); assert( info != NULL ); ListenTo(info->GetNewCommand()); } else { JBroadcaster::Receive(sender, message); } }
void CMRegistersDir::Receive ( JBroadcaster* sender, const Message& message ) { if (sender == CMGetLink() && (message.Is(CMLink::kProgramFinished) || message.Is(CMLink::kCoreCleared) || message.Is(CMLink::kDetachedFromProcess))) { Update(""); } else if (sender == CMGetLink() && (message.Is(CMLink::kProgramStopped) || CMVarNode::ShouldUpdate(message))) { itsNeedsUpdateFlag = kJTrue; Update(); } else if (sender == CMGetLink() && message.Is(CMLink::kSymbolsLoaded)) { const CMLink::SymbolsLoaded* info = dynamic_cast<const CMLink::SymbolsLoaded*>(&message); assert( info != NULL ); UpdateWindowTitle(info->GetProgramName()); } else if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate)) { UpdateFileMenu(); } else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandleFileMenu(selection->GetIndex()); } else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandleHelpMenu(selection->GetIndex()); } else { JXWindowDirector::Receive(sender, message); } }
CMLocation GDBGetStopLocation::GetLocation() const { const JString& data = GetLastResult(); CMLocation loc; JIndexRange r; if (locationPattern.Match(data, &r)) { std::istringstream stream(data.GetCString()); stream.seekg(r.last); JStringPtrMap<JString> map(JPtrArrayT::kDeleteAll); JString *s, *s1, *fullName; JIndex lineIndex; const JBoolean parsed = GDBLink::ParseMap(stream, &map); if (!parsed) { (CMGetLink())->Log("invalid data map"); } else if (!map.GetElement("fullname", &fullName)) { (CMGetLink())->Log("missing file name"); } else if (!map.GetElement("line", &s)) { (CMGetLink())->Log("missing line index"); } else if (!s->ConvertToUInt(&lineIndex)) { (CMGetLink())->Log("line index is not integer"); } else { loc.SetFileName(*fullName); loc.SetLineNumber(lineIndex); } if (parsed && map.GetElement("func", &s) && map.GetElement("addr", &s1)) { loc.SetFunctionName(*s); loc.SetMemoryAddress(*s1); } } else { (CMGetLink())->Log("GDBGetStopLocation failed to match"); } return loc; }
CMRegistersDir::CMRegistersDir ( CMCommandDirector* supervisor ) : JXWindowDirector(JXGetApplication()), itsCommandDir(supervisor), itsShouldUpdateFlag(kJFalse), // window is always initially hidden itsNeedsUpdateFlag(kJTrue) { itsCmd = (CMGetLink())->CreateGetRegisters(this); BuildWindow(); ListenTo(CMGetLink()); }
void CMLocalVarsDir::ReceiveGoingAway ( JBroadcaster* sender ) { if (sender == itsLink && !CMIsShuttingDown()) { itsLink = CMGetLink(); ListenTo(itsLink); (itsTree->GetRoot())->DeleteAllChildren(); CMVarNode* root = itsLink->CreateVarNode(kJFalse); assert( root != NULL ); itsTree->SetRoot(root); jdelete itsGetLocalsCmd; itsGetLocalsCmd = itsLink->CreateGetLocalVars(root); itsNeedsUpdateFlag = kJFalse; } else { JXWindowDirector::ReceiveGoingAway(sender); } }
void LLDBGetRegisters::HandleSuccess ( const JString& data ) { LLDBLink* link = dynamic_cast<LLDBLink*>(CMGetLink()); if (link == NULL) { return; } lldb::SBCommandInterpreter interp = link->GetDebugger()->GetCommandInterpreter(); if (!interp.IsValid()) { return; } lldb::SBCommandReturnObject result; interp.HandleCommand("register read", result); // https://llvm.org/bugs/show_bug.cgi?id=26421 if (result.IsValid() && result.Succeeded() /* && result.HasResult() */) { (GetDirector())->Update(result.GetOutput()); } }
void CMSourceDirector::ReceiveGoingAway ( JBroadcaster* sender ) { if (sender == itsLink && !CMIsShuttingDown() && IsMainSourceWindow()) { itsLink = CMGetLink(); ListenTo(itsLink); if (itsType == kMainSourceType) { jdelete itsSrcMainCmd; itsSrcMainCmd = itsLink->CreateDisplaySourceForMain(this); } else if (itsType == kMainAsmType) { jdelete itsGetAssemblyCmd; itsGetAssemblyCmd = NULL; } CMClearSourceDisplayTask* task = jnew CMClearSourceDisplayTask(this); assert( task != NULL ); task->Go(); } else if (sender == itsLink && !CMIsShuttingDown()) { JXCloseDirectorTask::Close(this); } else { JXWindowDirector::ReceiveGoingAway(sender); } }
JBoolean CMArray2DTable::ExtractInputData ( const JPoint& cell ) { JXInputField* input = NULL; const JBoolean ok = GetXInputField(&input); assert( ok ); const JString& text = input->GetText(); if (!text.IsEmpty()) { if (text != itsOrigEditValue) { const JString name = itsArrayDir->GetExpression(cell); (CMGetLink())->SetValue(name, text); } return kJTrue; } else { return kJFalse; } }
void JVMGetSourceFileList::Starting() { CMGetSourceFileList::Starting(); dynamic_cast<JVMLink*>(CMGetLink())->FlushClassList(); JXFileListTable* table = (GetFileList())->GetTable(); table->RemoveAllFiles(); const JPtrArray<JString>& list = dynamic_cast<JVMLink*>(CMGetLink())->GetSourcePathList(); const JSize count = list.GetElementCount(); for (JIndex i=1; i<=count; i++) { ScanDirectory(*(list.NthElement(i))); } }
void GDBGetStopLocationForAsm::HandleSuccess ( const JString& cmdData ) { dynamic_cast<GDBLink*>(CMGetLink())->SendProgramStopped2(GetLocation()); }
void CMLink::Log ( const JCharacter* log ) { (CMGetLink())->Broadcast(DebugOutput(log, kLogType)); }
JVMThreadNode::~JVMThreadNode() { JVMLink* link = dynamic_cast<JVMLink*>(CMGetLink()); if (link != NULL) // when switching debugger type, it won't be a JVMLink { link->ThreadDeleted(this); } }
void JVMGetIDSizes::Starting() { CMCommand::Starting(); dynamic_cast<JVMLink*>(CMGetLink())->Send(this, JVMLink::kVirtualMachineCmdSet, JVMLink::kVMIDSizesCmd, NULL, 0); }
void CMBreakpoint::SetIgnoreCount ( const JSize count ) { (CMGetLink())->SetBreakpointIgnoreCount(itsDebuggerIndex, count); }
void CMRegistersDir::ReceiveGoingAway ( JBroadcaster* sender ) { if (!CMIsShuttingDown()) { ListenTo(CMGetLink()); Update(""); delete itsCmd; itsCmd = (CMGetLink())->CreateGetRegisters(this); } JXWindowDirector::ReceiveGoingAway(sender); }
void LLDBWelcomeTask::Perform() { LLDBLink* link = dynamic_cast<LLDBLink*>(CMGetLink()); if (link != NULL) { link->BroadcastWelcome(itsMessage, itsRestartFlag); } }
void LLDBSymbolsLoadedTask::Perform() { LLDBLink* link = dynamic_cast<LLDBLink*>(CMGetLink()); if (link != NULL) { link->SymbolsLoaded(itsFileName); } }
void LLDBRunBackgroundCommandTask::Perform() { LLDBLink* link = dynamic_cast<LLDBLink*>(CMGetLink()); if (link != NULL) { link->SendMedicCommandSync(itsCmd); } }
void GDBGetFrame::HandleSuccess ( const JString& cmdData ) { const JString& data = GetLastResult(); JIndexRange r; if (framePattern.Match(data, &r)) { std::istringstream stream(data.GetCString()); stream.seekg(r.last); JStringPtrMap<JString> map(JPtrArrayT::kDeleteAll); JString* s; JIndex frameIndex; if (!GDBLink::ParseMap(stream, &map)) { (CMGetLink())->Log("invalid data map"); } else if (!map.GetElement("level", &s)) { (CMGetLink())->Log("missing frame index"); } else if (!s->ConvertToUInt(&frameIndex)) { (CMGetLink())->Log("frame index is not integer"); } else { itsWidget->SelectFrame(frameIndex); } } else { (CMGetLink())->Log("GDBGetFrame failed to match"); } }
void CMBreakpoint::CMBreakpointX() { const JString& fileName = GetFileName(); if (!fileName.IsEmpty()) // search target may have empty file name { JBoolean exists; JString fullName; if ((CMGetLink())->FindFile(fileName, &exists, &fullName)) { if (exists) { itsLocation.SetFileName(fullName); } } else { CMGetFullPath* cmd = (CMGetLink())->CreateGetFullPath(fileName); ListenTo(cmd); } } }
void CMVarNode::UpdateContent() { assert( itsIsPointerFlag ); delete itsContentCommand; const JString expr = GetFullName(); itsContentCommand = (CMGetLink())->CreateVarContentCommand(expr); ListenTo(itsContentCommand); itsContentCommand->CMCommand::Send(); }
void CMVarNode::ReceiveGoingAway ( JBroadcaster* sender ) { if (itsShouldListenToLinkFlag && !CMIsShuttingDown()) { ListenTo(CMGetLink()); } JNamedTreeNode::ReceiveGoingAway(sender); }
CMLineIndexTable::CMLineIndexTable ( JOrderedSetT::CompareResult (*bpCcompareFn)(CMBreakpoint *const &, CMBreakpoint *const &), CMSourceDirector* dir, CMSourceText* text, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXTable(1, 1, NULL, enclosure, hSizing, vSizing, x, y, w, h), itsDirector(dir), itsText(text), itsVScrollbar(scrollbarSet->GetVScrollbar()), itsCurrentLineIndex(0), itsLineMenu(NULL), itsDeselectTask(NULL) { itsLink = CMGetLink(); ListenTo(itsLink); itsBPList = jnew JPtrArray<CMBreakpoint>(JPtrArrayT::kForgetAll); assert(itsBPList != NULL); itsBPList->SetCompareFunction(bpCcompareFn); itsBPList->SetSortOrder(JOrderedSetT::kSortAscending); WantInput(kJFalse); SetBackColor(CMGetPrefsManager()->GetColor(CMPrefsManager::kBackColorIndex)); SetFocusColor(GetBackColor()); SetRowBorderInfo(0, GetBackColor()); SetColBorderInfo(0, GetBackColor()); SetDrawOrder(kDrawByCol); AppendCols(3); CMAdjustLineTableToTextTask* task = jnew CMAdjustLineTableToTextTask(this); assert( task != NULL ); task->Go(); ListenTo(itsText); ListenTo(itsVScrollbar); ListenTo(itsLink->GetBreakpointManager()); }
void GDBGetProgramName::HandleSuccess ( const JString& data ) { JString fileName; JArray<JIndexRange> matchList; if (fileNamePattern.Match(data, &matchList) || osxNamePattern.Match(data, &matchList)) { fileName = data.GetSubstring(matchList.GetElement(2)); } else { (CMGetLink())->Log("GDBGetProgramName failed to match"); } // CMLink has to broadcast SymbolsLoaded regardless of whether or not // we get what we expect from gdb. dynamic_cast<GDBLink*>(CMGetLink())->SaveProgramName(fileName); }
void CMSourceDirector::CMSourceViewDirectorX ( CMCommandDirector* commandDir ) { itsLink = CMGetLink(); ListenTo(itsLink); itsCommandDir = commandDir; ListenTo(itsCommandDir); BuildWindow(); ListenTo(CMGetPrefsManager()); }
CMLocalVarsDir::CMLocalVarsDir ( CMCommandDirector* supervisor ) : JXWindowDirector(JXGetApplication()), itsCommandDir(supervisor), itsNeedsUpdateFlag(kJFalse) { itsLink = CMGetLink(); ListenTo(itsLink); BuildWindow(); ListenTo(GetWindow()); }
CMVarNode::CMVarNode // root node ( const JBoolean shouldUpdate // kJFalse for Local Variables ) : JNamedTreeNode(NULL, ""), itsShouldListenToLinkFlag(shouldUpdate) { VarTreeNodeX(); itsValidFlag = kJTrue; if (itsShouldListenToLinkFlag) { ListenTo(CMGetLink()); } }
JVMThreadNode::JVMThreadNode ( const Type type, const JUInt64 id ) : CMThreadNode(id, "", "", 0), itsType(type) { if (id != kRootThreadGroupID) { dynamic_cast<JVMLink*>(CMGetLink())->ThreadCreated(this); CMCommand* cmd = new JVMGetThreadName(this); assert( cmd != NULL ); } }
void JVMThreadNode::FindParent ( const JUInt64 id ) { JVMLink* link = dynamic_cast<JVMLink*>(CMGetLink()); JVMThreadNode* parent; if (!link->FindThread(id, &parent)) { parent = new JVMThreadNode(kGroupType, id); assert( parent != NULL ); } parent->AppendThread(this); }