void CtrlDisplayListView::onMouseDown(WPARAM wParam, LPARAM lParam, int button) { int x = LOWORD(lParam); int y = HIWORD(lParam); int line = y/rowHeight; u32 newAddress = windowStart + line*instructionSize; bool extend = KeyDownAsync(VK_SHIFT); if (button == 1) { if (newAddress == curAddress && hasFocus) { toggleBreakpoint(); } } else if (button == 2) { // Maintain the current selection if right clicking into it. if (newAddress >= selectRangeStart && newAddress < selectRangeEnd) extend = true; } setCurAddress(newAddress,extend); SetFocus(wnd); redraw(); }
void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button) { dontRedraw = false; int x = LOWORD(lParam); int y = HIWORD(lParam); u32 newAddress = yToAddress(y); bool extend = KeyDownAsync(VK_SHIFT); if (button == 1) { if (newAddress == curAddress && hasFocus) { toggleBreakpoint(); } } else if (button == 2) { // Maintain the current selection if right clicking into it. if (newAddress >= selectRangeStart && newAddress < selectRangeEnd) extend = true; } setCurAddress(newAddress, extend); SetFocus(wnd); redraw(); }
void Debugger::removeBreakpoint(BreakpointID id) { ASSERT(id != noBreakpointID); BreakpointIDToBreakpointMap::iterator idIt = m_breakpointIDToBreakpoint.find(id); ASSERT(idIt != m_breakpointIDToBreakpoint.end()); Breakpoint& breakpoint = *idIt->value; SourceID sourceID = breakpoint.sourceID; ASSERT(sourceID); SourceIDToBreakpointsMap::iterator it = m_sourceIDToBreakpoints.find(sourceID); ASSERT(it != m_sourceIDToBreakpoints.end()); LineToBreakpointsMap::iterator breaksIt = it->value.find(breakpoint.line); ASSERT(breaksIt != it->value.end()); toggleBreakpoint(breakpoint, BreakpointDisabled); BreakpointsInLine& breakpoints = breaksIt->value; unsigned breakpointsCount = breakpoints.size(); for (unsigned i = 0; i < breakpointsCount; i++) { if (breakpoints[i].id == breakpoint.id) { breakpoints.remove(i); m_breakpointIDToBreakpoint.remove(idIt); if (breakpoints.isEmpty()) { it->value.remove(breaksIt); if (it->value.isEmpty()) m_sourceIDToBreakpoints.remove(it); } break; } } }
void Debugger::applyBreakpoints(CodeBlock* codeBlock) { BreakpointIDToBreakpointMap& breakpoints = m_breakpointIDToBreakpoint; for (auto it = breakpoints.begin(); it != breakpoints.end(); ++it) { Breakpoint& breakpoint = *it->value; toggleBreakpoint(codeBlock, breakpoint, BreakpointEnabled); } }
void CtrlDisplayListView::onKeyDown(WPARAM wParam, LPARAM lParam) { u32 windowEnd = windowStart+visibleRows*instructionSize; switch (wParam & 0xFFFF) { case VK_DOWN: setCurAddress(curAddress + instructionSize, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); break; case VK_UP: setCurAddress(curAddress - instructionSize, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); break; case VK_NEXT: if (curAddress != windowEnd - instructionSize && curAddressIsVisible()) { setCurAddress(windowEnd - instructionSize, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } else { setCurAddress(curAddress + visibleRows * instructionSize, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } break; case VK_PRIOR: if (curAddress != windowStart && curAddressIsVisible()) { setCurAddress(windowStart, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } else { setCurAddress(curAddress - visibleRows * instructionSize, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } break; case VK_LEFT: gotoAddr(list.pc); return; case VK_SPACE: toggleBreakpoint(); break; case VK_F10: case VK_F11: SendMessage(GetParent(wnd),WM_GEDBG_STEPDISPLAYLIST,0,0); break; } redraw(); }
FileEditor::FileEditor(const QString &filename, QMdiSubWindow *parent, const QString &baseDir) : mFilename(filename), mdiWindow(parent), mBaseDir(baseDir) { mFocusRecursion = mChanged = mOmitReloadChecks = false; mCurrentBreakpoint = -1; // Update GUI and content reloadContent(); setupEditor(); updateLexer(); updateWindowTitle(); HilecInterface* hilec = HilecSingleton::hilec(); if(hilec) { QList<int> breakpoints = hilec->breakpoints(mFilename); foreach(int line, breakpoints){ toggleBreakpoint(line-1); } }
BreakpointID Debugger::setBreakpoint(Breakpoint& breakpoint, bool& existing) { ASSERT(breakpoint.resolved); ASSERT(breakpoint.sourceID != noSourceID); SourceID sourceID = breakpoint.sourceID; unsigned line = breakpoint.line; unsigned column = breakpoint.column; SourceIDToBreakpointsMap::iterator it = m_sourceIDToBreakpoints.find(breakpoint.sourceID); if (it == m_sourceIDToBreakpoints.end()) it = m_sourceIDToBreakpoints.set(sourceID, LineToBreakpointsMap()).iterator; LineToBreakpointsMap::iterator breaksIt = it->value.find(line); if (breaksIt == it->value.end()) breaksIt = it->value.set(line, adoptRef(new BreakpointsList)).iterator; BreakpointsList& breakpoints = *breaksIt->value; for (Breakpoint* current = breakpoints.head(); current; current = current->next()) { if (current->column == column) { // Found existing breakpoint. Do not create a duplicate at this location. existing = true; return current->id; } } existing = false; BreakpointID id = ++m_topBreakpointID; RELEASE_ASSERT(id != noBreakpointID); breakpoint.id = id; Breakpoint* newBreakpoint = new Breakpoint(breakpoint); breakpoints.append(newBreakpoint); m_breakpointIDToBreakpoint.set(id, newBreakpoint); toggleBreakpoint(*newBreakpoint, BreakpointEnabled); return id; }
BreakpointID Debugger::setBreakpoint(Breakpoint breakpoint, unsigned& actualLine, unsigned& actualColumn) { SourceID sourceID = breakpoint.sourceID; unsigned line = breakpoint.line; unsigned column = breakpoint.column; SourceIDToBreakpointsMap::iterator it = m_sourceIDToBreakpoints.find(sourceID); if (it == m_sourceIDToBreakpoints.end()) it = m_sourceIDToBreakpoints.set(sourceID, LineToBreakpointsMap()).iterator; LineToBreakpointsMap::iterator breaksIt = it->value.find(line); if (breaksIt == it->value.end()) breaksIt = it->value.set(line, adoptRef(new BreakpointsList)).iterator; BreakpointsList& breakpoints = *breaksIt->value; for (Breakpoint* current = breakpoints.head(); current; current = current->next()) { if (current->column == column) { // The breakpoint already exists. We're not allowed to create a new // breakpoint at this location. Rather than returning the breakpointID // of the pre-existing breakpoint, we need to return noBreakpointID // to indicate that we're not creating a new one. return noBreakpointID; } } BreakpointID id = ++m_topBreakpointID; RELEASE_ASSERT(id != noBreakpointID); breakpoint.id = id; actualLine = line; actualColumn = column; Breakpoint* newBreakpoint = new Breakpoint(breakpoint); breakpoints.append(newBreakpoint); m_breakpointIDToBreakpoint.set(id, newBreakpoint); toggleBreakpoint(breakpoint, BreakpointEnabled); return id; }
BreakpointID Debugger::setBreakpoint(Breakpoint breakpoint, unsigned& actualLine, unsigned& actualColumn) { SourceID sourceID = breakpoint.sourceID; unsigned line = breakpoint.line; unsigned column = breakpoint.column; SourceIDToBreakpointsMap::iterator it = m_sourceIDToBreakpoints.find(sourceID); if (it == m_sourceIDToBreakpoints.end()) it = m_sourceIDToBreakpoints.set(sourceID, LineToBreakpointsMap()).iterator; LineToBreakpointsMap::iterator breaksIt = it->value.find(line); if (breaksIt == it->value.end()) breaksIt = it->value.set(line, BreakpointsInLine()).iterator; BreakpointsInLine& breakpoints = breaksIt->value; unsigned breakpointsCount = breakpoints.size(); for (unsigned i = 0; i < breakpointsCount; i++) if (breakpoints[i].column == column) { // The breakpoint already exists. We're not allowed to create a new // breakpoint at this location. Rather than returning the breakpointID // of the pre-existing breakpoint, we need to return noBreakpointID // to indicate that we're not creating a new one. return noBreakpointID; } BreakpointID id = ++m_topBreakpointID; RELEASE_ASSERT(id != noBreakpointID); breakpoint.id = id; actualLine = line; actualColumn = column; breakpoints.append(breakpoint); m_breakpointIDToBreakpoint.set(id, &breakpoints.last()); toggleBreakpoint(breakpoint, BreakpointEnabled); return id; }
void Debugger::removeBreakpoint(BreakpointID id) { ASSERT(id != noBreakpointID); BreakpointIDToBreakpointMap::iterator idIt = m_breakpointIDToBreakpoint.find(id); ASSERT(idIt != m_breakpointIDToBreakpoint.end()); Breakpoint* breakpoint = idIt->value; SourceID sourceID = breakpoint->sourceID; ASSERT(sourceID); SourceIDToBreakpointsMap::iterator it = m_sourceIDToBreakpoints.find(sourceID); ASSERT(it != m_sourceIDToBreakpoints.end()); LineToBreakpointsMap::iterator breaksIt = it->value.find(breakpoint->line); ASSERT(breaksIt != it->value.end()); toggleBreakpoint(*breakpoint, BreakpointDisabled); BreakpointsList& breakpoints = *breaksIt->value; #if !ASSERT_DISABLED bool found = false; for (Breakpoint* current = breakpoints.head(); current && !found; current = current->next()) { if (current->id == breakpoint->id) found = true; } ASSERT(found); #endif m_breakpointIDToBreakpoint.remove(idIt); breakpoints.remove(breakpoint); delete breakpoint; if (breakpoints.isEmpty()) { it->value.remove(breaksIt); if (it->value.isEmpty()) m_sourceIDToBreakpoints.remove(it); } }
void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam) { dontRedraw = false; u32 windowEnd = manager.getNthNextAddress(windowStart,visibleRows); keyTaken = true; if (KeyDownAsync(VK_CONTROL)) { switch (tolower(wParam & 0xFFFF)) { case 'f': case 's': search(false); break; case 'c': case VK_INSERT: copyInstructions(selectRangeStart, selectRangeEnd, true); break; case 'x': disassembleToFile(); break; case 'a': assembleOpcode(curAddress,""); break; case 'g': { u32 addr; if (executeExpressionWindow(wnd,debugger,addr) == false) return; gotoAddr(addr); } break; case 'e': // edit breakpoint editBreakpoint(); break; case 'd': // toogle breakpoint enabled toggleBreakpoint(true); break; case VK_UP: scrollWindow(-1); scanFunctions(); break; case VK_DOWN: scrollWindow(1); scanFunctions(); break; case VK_NEXT: setCurAddress(manager.getNthPreviousAddress(windowEnd,1),KeyDownAsync(VK_SHIFT)); break; case VK_PRIOR: setCurAddress(windowStart,KeyDownAsync(VK_SHIFT)); break; } } else { switch (wParam & 0xFFFF) { case VK_DOWN: setCurAddress(manager.getNthNextAddress(curAddress,1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); break; case VK_UP: setCurAddress(manager.getNthPreviousAddress(curAddress,1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); break; case VK_NEXT: if (manager.getNthNextAddress(curAddress,1) != windowEnd && curAddressIsVisible()) { setCurAddress(manager.getNthPreviousAddress(windowEnd,1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } else { setCurAddress(manager.getNthNextAddress(windowEnd,visibleRows-1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } break; case VK_PRIOR: if (curAddress != windowStart && curAddressIsVisible()) { setCurAddress(windowStart, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } else { setCurAddress(manager.getNthPreviousAddress(windowStart,visibleRows), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } break; case VK_LEFT: if (jumpStack.empty()) { gotoPC(); } else { u32 addr = jumpStack[jumpStack.size()-1]; jumpStack.pop_back(); gotoAddr(addr); } return; case VK_RIGHT: followBranch(); return; case VK_TAB: displaySymbols = !displaySymbols; break; case VK_SPACE: debugger->toggleBreakpoint(curAddress); break; case VK_F3: search(true); break; default: keyTaken = false; return; } } redraw(); }
SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : QMainWindow(parent) , fCentralSplitter(this) , fStatusBar(this) , fToolBar(this) , fActionOpen(this) , fActionBreakpoint(this) , fActionCancel(this) , fActionClearBreakpoints(this) , fActionClearDeletes(this) , fActionClose(this) , fActionCreateBreakpoint(this) , fActionDelete(this) , fActionDirectory(this) , fActionGoToLine(this) , fActionInspector(this) , fActionSettings(this) , fActionPlay(this) , fActionPause(this) , fActionRewind(this) , fActionSave(this) , fActionSaveAs(this) , fActionShowDeletes(this) , fActionStepBack(this) , fActionStepForward(this) , fActionZoomIn(this) , fActionZoomOut(this) , fMapper(this) , fListWidget(&fCentralSplitter) , fDirectoryWidget(&fCentralSplitter) , fCanvasWidget(this, &fDebugger) , fDrawCommandGeometryWidget(&fDebugger) , fMenuBar(this) , fMenuFile(this) , fMenuNavigate(this) , fMenuView(this) , fLoading(false) { setupUi(this); fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection); connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateDrawCommandInfo())); connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile())); connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory())); connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); connect(&fDirectoryWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(populateDirectoryWidget())); connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleBreakpoint())); connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay())); connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())); connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForward())); connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoints())); connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector())); connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings())); connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString))); connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel())); connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints())); connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes())); connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); #if SK_SUPPORT_GPU connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLSettingsChanged())); #endif connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(actionRasterSettingsChanged())); connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(actionVisualizationsChanged())); connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(actionTextureFilter())); connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))); connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint())); connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(int))); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))); connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(actionScale(float))); connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); fViewStateFrame.setDisabled(true); fInspectorWidget.setDisabled(true); fMenuEdit.setDisabled(true); fMenuNavigate.setDisabled(true); fMenuView.setDisabled(true); }
void BreakpointListView::slotBreakpointUnmarked(const QString& filePath, int line) { toggleBreakpoint(filePath, line); }
void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button == 1) { int x = LOWORD(lParam); int y = HIWORD(lParam); setCurAddress(yToAddress(y), GetAsyncKeyState(VK_SHIFT) != 0); redraw(); } else if (button == 2) { //popup menu? POINT pt; GetCursorPos(&pt); switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,1),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) { case ID_DISASM_GOTOINMEMORYVIEW: for (int i=0; i<numCPUs; i++) if (memoryWindow[i]) memoryWindow[i]->Goto(curAddress); break; case ID_DISASM_ADDHLE: break; case ID_DISASM_TOGGLEBREAKPOINT: toggleBreakpoint(); redraw(); break; case ID_DISASM_ASSEMBLE: assembleOpcode(curAddress,""); break; case ID_DISASM_COPYINSTRUCTIONDISASM: { int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize; char opcode[64], arguments[256]; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize) { const char *dizz = debugger->disasm(pos, instructionSize); parseDisasm(dizz, opcode, arguments); p += snprintf(p, end - p, "%s\t%s\r\n", opcode, arguments); } W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_COPYADDRESS: { char temp[16]; sprintf(temp,"%08X",curAddress); W32Util::CopyTextToClipboard(wnd, temp); } break; case ID_DISASM_SETPCTOHERE: debugger->setPC(curAddress); redraw(); break; case ID_DISASM_FOLLOWBRANCH: followBranch(); break; case ID_DISASM_COPYINSTRUCTIONHEX: { int space = 24 * (selectRangeEnd - selectRangeStart) / instructionSize; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize) p += snprintf(p, end - p, "%08X\r\n", debugger->readMemory(pos)); W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_RUNTOHERE: { debugger->setBreakpoint(curAddress); debugger->runToBreakpoint(); redraw(); } break; case ID_DISASM_RENAMEFUNCTION: { int sym = symbolMap.GetSymbolNum(curAddress); if (sym != -1) { char name[256]; std::string newname; strncpy_s(name, symbolMap.GetSymbolName(sym),_TRUNCATE); if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), L"New function name", name, newname)) { symbolMap.SetSymbolName(sym, newname.c_str()); redraw(); SendMessage(GetParent(wnd),WM_DEB_MAPLOADED,0,0); } } else { MessageBox(MainWindow::GetHWND(), L"No symbol selected",0,0); } } break; case ID_DISASM_DISASSEMBLETOFILE: disassembleToFile(); break; } return; } redraw(); }
void DebuggerManager::initActions() { KAction * newaction; KActionCollection *ac = quantaApp->actionCollection(); if(!ac) return; //Debugger, breakpoint newaction = new KAction(i18n("Toggle &Breakpoint"), SmallIcon("debug_breakpoint"), Qt::CTRL+Qt::SHIFT+Qt::Key_B, this, SLOT(toggleBreakpoint()), ac, "debug_breakpoints_toggle"); newaction->setToolTip(i18n("Toggles a breakpoint at the current cursor location")); newaction = new KAction(i18n("&Clear Breakpoints"), 0, this, SLOT(clearBreakpoints()), ac, "debug_breakpoints_clear"); newaction->setToolTip(i18n("Clears all breakpoints")); newaction = new KAction(i18n("Break When..."), SmallIcon("math_int"), 0, this, SLOT(slotConditionalBreakpoint()), ac, "debug_conditional_break"); newaction->setToolTip(i18n("Adds a new conditional breakpoint")); newaction = new KAction(i18n("Break When..."), SmallIcon("math_int"), 0, this, SLOT(slotConditionalBreakpoint()), ac, "debug_conditional_breakdialog"); newaction->setToolTip(i18n("Adds a new conditional breakpoint")); // Execution newaction = new KAction(i18n("Send HTTP R&equest"), SmallIcon("debug_currentline"), 0, this, SLOT(slotDebugRequest()), ac, "debug_request"); newaction->setToolTip(i18n("Initiate HTTP Request to the server with debugging activated")); newaction = new KAction(i18n("&Trace"), SmallIcon("debug_run"), 0, this, SLOT(slotDebugTrace()), ac, "debug_trace"); newaction->setToolTip(i18n("Traces through the script. If a script is currently not being debugged, it will start in trace mode when started")); newaction = new KAction(i18n("&Run"), SmallIcon("debug_leap"), 0, this, SLOT(slotDebugRun()), ac, "debug_run"); newaction->setToolTip(i18n("Runs the script. If a script is currently not being debugged, it will start in run mode when started")); newaction = new KAction(i18n("&Step"), SmallIcon("debug_stepover"), 0, this, SLOT(slotDebugStepOver()), ac, "debug_stepover"); newaction->setToolTip(i18n("Executes the next line of execution, but does not step into functions or includes")); newaction = new KAction(i18n("Step &Into"), SmallIcon("debug_stepinto"), 0, this, SLOT(slotDebugStepInto()), ac, "debug_stepinto"); newaction->setToolTip(i18n("Executes the next line of execution and steps into it if it is a function call or inclusion of a file")); newaction = new KAction(i18n("S&kip"), SmallIcon("debug_skip"), 0, this, SLOT(slotDebugSkip()), ac, "debug_skip"); newaction->setToolTip(i18n("Skips the next command of execution and makes the next command the current one")); newaction = new KAction(i18n("Step &Out"), SmallIcon("debug_stepout"), 0, this, SLOT(slotDebugStepOut()), ac, "debug_stepout"); newaction->setToolTip(i18n("Executes the rest of the commands in the current function/file and pauses when it is done (when it reaches a higher level in the backtrace)")); newaction = new KAction(i18n("&Pause"), SmallIcon("debug_pause"), 0, this, SLOT(slotDebugPause()), ac, "debug_pause"); newaction->setToolTip(i18n("Pauses the scripts if it is running or tracing. If a script is currently not being debugged, it will start in paused mode when started")); newaction = new KAction(i18n("Kill"), SmallIcon("debug_kill"), 0, this, SLOT(slotDebugKill()), ac, "debug_kill"); newaction->setToolTip(i18n("Kills the currently running script")); newaction = new KAction(i18n("Start Session"), SmallIcon("debug_connect"), 0, this, SLOT(slotDebugStartSession()), ac, "debug_connect"); newaction->setToolTip(i18n("Starts the debugger internally (Makes debugging possible)")); newaction = new KAction(i18n("End Session"), SmallIcon("debug_disconnect"), 0, this, SLOT(slotDebugEndSession()), ac, "debug_disconnect"); newaction->setToolTip(i18n("Stops the debugger internally (debugging not longer possible)")); // Variables newaction = new KAction(i18n("Watch Variable"), SmallIcon("math_brace"), 0, this, SLOT(slotAddWatch()), ac, "debug_addwatch"); newaction->setToolTip(i18n("Adds a variable to the watch list")); newaction = new KAction(i18n("Watch Variable"), SmallIcon("math_brace"), 0, this, SLOT(slotAddWatch()), ac, "debug_addwatchdialog"); newaction->setToolTip(i18n("Adds a variable to the watch list")); newaction = new KAction(i18n("Set Value of Variable"), SmallIcon("edit"), 0, this, SLOT(slotVariableSet()), ac, "debug_variable_set"); newaction->setToolTip(i18n("Changes the value of a variable")); newaction = new KAction(i18n("Set Value of Variable"), SmallIcon("edit"), 0, this, SLOT(slotVariableSet()), ac, "debug_variable_setdialog"); newaction->setToolTip(i18n("Changes the value of a variable")); newaction = new KAction(i18n("Open Profiler Output"), SmallIcon("launch"), 0, this, SLOT(slotProfilerOpen()), ac, "debug_profiler_open"); newaction->setToolTip(i18n("Opens the profiler output file")); enableAction("*", false); }
void BreakpointListView::slotBreakpointUnmarked(const KURL& url, int line) { toggleBreakpoint(url, line); }
SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : QMainWindow(parent) , fCentralSplitter(this) , fStatusBar(this) , fToolBar(this) , fActionOpen(this) , fActionBreakpoint(this) , fActionToggleIndexStyle(this) , fActionProfile(this) , fActionCancel(this) , fActionClearBreakpoints(this) , fActionClearDeletes(this) , fActionClose(this) , fActionCreateBreakpoint(this) , fActionDelete(this) , fActionDirectory(this) , fActionGoToLine(this) , fActionInspector(this) , fActionSettings(this) , fActionPlay(this) , fActionPause(this) , fActionRewind(this) , fActionSave(this) , fActionSaveAs(this) , fActionShowDeletes(this) , fActionStepBack(this) , fActionStepForward(this) , fActionZoomIn(this) , fActionZoomOut(this) , fMapper(this) , fListWidget(&fCentralSplitter) , fDirectoryWidget(&fCentralSplitter) , fCanvasWidget(this, &fDebugger) , fImageWidget(&fDebugger) , fMenuBar(this) , fMenuFile(this) , fMenuNavigate(this) , fMenuView(this) , fBreakpointsActivated(false) , fIndexStyleToggle(false) , fDeletesActivated(false) , fPause(false) , fLoading(false) { setupUi(this); fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection); connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(registerListClick(QListWidgetItem *))); connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile())); connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory())); connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleBreakpoint())); connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay())); connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())); connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForward())); connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoints())); connect(&fActionToggleIndexStyle, SIGNAL(triggered()), this, SLOT(actionToggleIndexStyle())); connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector())); connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings())); connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString))); connect(&fActionProfile, SIGNAL(triggered()), this, SLOT(actionProfile())); connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel())); connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints())); connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes())); connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); connect(&fSettingsWidget, SIGNAL(visibilityFilterChanged()), this, SLOT(actionCommandFilter())); #if SK_SUPPORT_GPU connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLWidget())); #endif connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(actionTextureFilter())); connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionRasterWidget(bool))); connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionOverdrawVizWidget(bool))); connect(fSettingsWidget.getMegaVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionMegaVizWidget(bool))); connect(fSettingsWidget.getPathOpsCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionPathOpsWidget(bool))); connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))); connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint())); connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(int))); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), &fSettingsWidget, SLOT(updateHit(int))); connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(actionScale(float))); connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fSettingsWidget, SLOT(updateCommand(int))); connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); fInspectorWidget.setDisabled(true); fMenuEdit.setDisabled(true); fMenuNavigate.setDisabled(true); fMenuView.setDisabled(true); SkGraphics::Init(); }
uint32 Editor::onMessage(uint32 message, uint32 wParam, uint32 lParam) { switch (message) { case WM_DESTROY: delete target; target = NULL; break; case WM_SETCURSOR: if (LOWORD(lParam) == HTCLIENT) { POINT pt; GetCursorPos(&pt); ScreenToClient(hWnd, &pt); if (pt.x < LeftMargin()) SetCursor(cursors[cArrow]); else if (selStart != caret) { pt.x = (pt.x - LeftMargin()) / chSize.cx + scrollPos.x; pt.y = pt.y / chSize.cy + scrollPos.y; if (pt.y < 0 || pt.y >= lines.length() || pt.x < 0 || pt.x >= lines[pt.y].text.length()) SetCursor(cursors[cBeam]); else { int offset = fromPoint(pt); int sela = (selStart < caret ? selStart : caret); int selb = (selStart < caret ? caret : selStart); if (offset >= sela && offset < selb) SetCursor(cursors[cArrow]); else SetCursor(cursors[cBeam]); } } else SetCursor(cursors[cBeam]); } else SetCursor(cursors[cArrow]); return TRUE; case WM_ERASEBKGND: return TRUE; case WM_PAINT: paint(); return 0; case WM_SIZE: if (hBitmap) { int wd = LOWORD(lParam); int ht = HIWORD(lParam); if (wd < 10) wd = 10; if (ht < 10) ht = 10; hBitmap = CreateCompatibleBitmap(hDC, wd, ht); SelectObject(hDC, hBitmap); } updateExtent(); return 0; case WM_SETFOCUS: placeCaret(); invalidate(); getParent()->notify(EN_FOCUSED, (uint32) this, 0); return 0; case WM_KILLFOCUS: DestroyCaret(); updateCaret(); invalidate(); return 0; case WM_LBUTTONDBLCLK: { POINT pt = paramToPoint(lParam); fixPoint(pt); int ptStart = wordEnd(lines[pt.y].text.c_str(), pt.x, -1); int ptEnd = wordEnd(lines[pt.y].text.c_str(), pt.x, 1); int offset = fromPoint(pt); selStart = offset - (pt.x - ptStart); caret = offset + (ptEnd - pt.x); updateCaret(); } return 0; case WM_LBUTTONDOWN: if (int(GET_X_LPARAM(lParam)) < int(settings->bpOffset - scrollPos.x * chSize.cx)) { POINT pt = paramToPoint(lParam); toggleBreakpoint(pt.y); } else { POINT pt = paramToPoint(lParam); int offset = fromPoint(pt); int sela = (selStart < caret ? selStart : caret); int selb = (selStart > caret ? selStart : caret); if (offset >= sela && offset < selb) { dragop = 1; uint32 fx = DoDragDropEx(CF_UNICODETEXT, CreateGlobalText(getSelection()), DROPEFFECT_MOVE | DROPEFFECT_COPY, hWnd); if (fx == DROPEFFECT_NONE) dragop = 0; //else if (fx != DROPEFFECT_COPY && dragop != 2) // replace(sela, selb, ""); } else SetCapture(hWnd); if (dragop == 0) { caret = offset; if (!(wParam & MK_SHIFT)) selStart = caret; } dragop = 0; if (GetFocus() != hWnd) SetFocus(hWnd); updateCaret(); } return 0; case WM_RBUTTONDOWN: if (int(GET_X_LPARAM(lParam)) >= int(settings->bpOffset - scrollPos.x * chSize.cx)) { POINT pt = paramToPoint(lParam); int offset = fromPoint(pt); int sela = (selStart < caret ? selStart : caret); int selb = (selStart > caret ? selStart : caret); if (offset < sela || offset >= selb) caret = selStart = offset; if (GetFocus() != hWnd) SetFocus(hWnd); updateCaret(); } return 0; case WM_MOUSEMOVE: if (GetCapture() == hWnd && (wParam & MK_LBUTTON)) { POINT pt = paramToPoint(lParam); caret = fromPoint(pt); updateCaret(); } return 0; case WM_LBUTTONUP: ReleaseCapture(); return 0; case WM_CHAR: if (iswprint(wParam) && (GetAsyncKeyState(VK_CONTROL) & 0x8000) == 0) { if (caret == selStart && !insertMode && caret < getTextLength()) replace(caret, caret + 1, WideString((wchar_t) wParam)); else replace(selStart, caret, WideString((wchar_t) wParam)); } return 0; case WM_VSCROLL: { SCROLLINFO si; memset(&si, 0, sizeof si); si.cbSize = sizeof si; si.fMask = SIF_ALL; GetScrollInfo(hWnd, SB_VERT, &si); switch (LOWORD(wParam)) { case SB_TOP: si.nPos = si.nMin; break; case SB_BOTTOM: si.nPos = si.nMax; break; case SB_LINEUP: si.nPos--; break; case SB_LINEDOWN: si.nPos++; break; case SB_PAGEUP: si.nPos -= si.nPage; break; case SB_PAGEDOWN: si.nPos += si.nPage; break; case SB_THUMBTRACK: si.nPos = si.nTrackPos; break; } doScroll(scrollPos.x, si.nPos); } return 0; case WM_HSCROLL: { SCROLLINFO si; memset(&si, 0, sizeof si); si.cbSize = sizeof si; si.fMask = SIF_ALL; GetScrollInfo(hWnd, SB_HORZ, &si); switch (LOWORD(wParam)) { case SB_LEFT: si.nPos = si.nMin; break; case SB_RIGHT: si.nPos = si.nMax; break; case SB_LINELEFT: si.nPos--; break; case SB_LINERIGHT: si.nPos++; break; case SB_PAGELEFT: si.nPos -= si.nPage; break; case SB_PAGERIGHT: si.nPos += si.nPage; break; case SB_THUMBTRACK: si.nPos = si.nTrackPos; break; } doScroll(si.nPos, scrollPos.y); } return 0; case WM_MOUSEWHEEL: { int step; SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &step, 0); if (step < 0) step = 3; scrollAccum.y += GET_WHEEL_DELTA_WPARAM(wParam) * step; doScroll(scrollPos.x, scrollPos.y - scrollAccum.y / WHEEL_DELTA); scrollAccum.y %= WHEEL_DELTA; } return 0; case WM_MOUSEHWHEEL: { scrollAccum.x += GET_WHEEL_DELTA_WPARAM(wParam) * 4; doScroll(scrollPos.x + scrollAccum.x / WHEEL_DELTA, scrollPos.y); scrollAccum.x %= WHEEL_DELTA; } return 0; case WM_DRAGOVER: { if (running || settings->mode) return TRUE; POINT pt = paramToPoint(lParam); dropPos = fromPoint(pt); RECT rc; GetClientRect(hWnd, &rc); int xto = scrollPos.x; if (pt.x < 10) xto--; else if (pt.x > rc.right - 10) xto++; int yto = scrollPos.y; if (pt.y < 10) yto--; else if (pt.y > rc.bottom - 10) yto++; doScroll(xto, yto); int sela = (selStart < caret ? selStart : caret); int selb = (selStart > caret ? selStart : caret); if (dropPos > sela && dropPos < selb) return TRUE; else { fixPoint(pt); CreateCaret(hWnd, NULL, 2, chSize.cy); SetCaretPos((pt.x - scrollPos.x) * chSize.cx + LeftMargin(), (pt.y - scrollPos.y) * chSize.cy); ShowCaret(hWnd); } } return 0; case WM_DRAGLEAVE: dropPos = 0; updateCaret(); return 0; case WM_DRAGDROP: if (running || settings->mode) return DROPEFFECT_NONE; if (dragop) { dragop = 2; int sela = (selStart < caret ? selStart : caret); int selb = (selStart > caret ? selStart : caret); if (dropPos < sela || dropPos > selb) { WideString text = getSelection(); if (lParam != DROPEFFECT_COPY) { replace(sela, selb, L""); if (dropPos > selb) dropPos -= (selb - sela); caret = replace(dropPos, dropPos, text, NULL, true); } else caret = replace(dropPos, dropPos, text); selStart = dropPos; } } else { caret = replace(dropPos, dropPos, GetGlobalTextWide((HGLOBAL) wParam)); selStart = dropPos; return DROPEFFECT_COPY; } return lParam; case WM_SYSKEYDOWN: case WM_KEYDOWN: onKey(wParam); return 0; case WM_COMMAND: switch (LOWORD(wParam)) { case ID_EDIT_UNDO: { bool glue = true; bool first = true; while (glue && historyPos > 0) { HistoryItem& h = history[--historyPos]; replace(h.begin, h.end, h.text, &h); glue = h.glue; h.glue = !first; first = false; } } break; case ID_EDIT_REDO: { bool glue = true; bool first = true; while (glue && historyPos < history.length()) { HistoryItem& h = history[historyPos++]; replace(h.begin, h.end, h.text, &h); glue = h.glue; h.glue = !first; first = false; } } break; case ID_EDIT_SELECTALL: selStart = 0; caret = getTextLength(); updateCaret(); break; case ID_EDIT_COPY: if (caret != selStart) SetClipboard(CF_UNICODETEXT, CreateGlobalText(getSelection())); else { POINT pt = toPoint(caret); pt.x = 0; int start = fromPoint(pt); if (pt.y < lines.length() - 1) pt.y++; else pt.x = lines[pt.y].text.length(); int end = fromPoint(pt); if (pCopyLine) pCopyLine->Release(); pCopyLine = SetClipboard(CF_UNICODETEXT, CreateGlobalText(substring(start, end))); if (pCopyLine) pCopyLine->AddRef(); } break; case ID_EDIT_CUT: if (caret != selStart) { SetClipboard(CF_UNICODETEXT, CreateGlobalText(getSelection())); replace(selStart, caret, L""); } else { POINT pt = toPoint(caret); POINT save = pt; pt.x = 0; int start = fromPoint(pt); if (pt.y < lines.length() - 1) pt.y++; else pt.x = lines[pt.y].text.length(); int end = fromPoint(pt); if (pCopyLine) pCopyLine->Release(); pCopyLine = SetClipboard(CF_UNICODETEXT, CreateGlobalText(substring(start, end))); if (pCopyLine) pCopyLine->AddRef(); replace(start, end, L""); caret = selStart = fromPoint(save); updateCaret(); } break; case ID_EDIT_PASTE: { ClipboardReader reader(CF_UNICODETEXT); if (reader.getData()) { if (OleIsCurrentClipboard(pCopyLine) == S_OK) { POINT pt = toPoint(caret); pt.x = 0; caret = selStart = fromPoint(pt); } selStart = caret = replace(selStart, caret, GetGlobalTextWide(reader.getData())); updateCaret(); } } break; case ID_DEBUG_BREAKPOINT: { POINT pt = toPoint(caret); toggleBreakpoint(pt.y); } break; default: return M_UNHANDLED; } return 0; } return M_UNHANDLED; }
void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button == 2) { //popup menu? POINT pt; GetCursorPos(&pt); switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,POPUP_SUBMENU_ID_DISPLAYLISTVIEW),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) { case ID_DISASM_GOTOINMEMORYVIEW: for (int i=0; i<numCPUs; i++) if (memoryWindow[i]) memoryWindow[i]->Goto(curAddress); break; case ID_DISASM_TOGGLEBREAKPOINT: toggleBreakpoint(); redraw(); break; case ID_DISASM_COPYINSTRUCTIONDISASM: { int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd && p < end; pos += instructionSize) { GPUDebugOp op = gpuDebug->DissassembleOp(pos); p += snprintf(p, end - p, "%s\r\n", op.desc.c_str()); } W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_COPYADDRESS: { char temp[16]; sprintf(temp,"%08X",curAddress); W32Util::CopyTextToClipboard(wnd, temp); } break; case ID_DISASM_SETPCTOHERE: { gpuDebug->ResetListPC(list.id,curAddress); list.pc = curAddress; redraw(); } break; case ID_GEDBG_SETSTALLADDR: { gpuDebug->ResetListStall(list.id,curAddress); list.stall = curAddress; redraw(); } break; case ID_DISASM_COPYINSTRUCTIONHEX: { int space = 24 * (selectRangeEnd - selectRangeStart) / instructionSize; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd && p < end; pos += instructionSize) p += snprintf(p, end - p, "%08X\r\n", Memory::ReadUnchecked_U32(pos)); W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_RUNTOHERE: { SendMessage(GetParent(wnd),WM_GEDBG_RUNTOWPARAM,curAddress,0); redraw(); } break; case ID_GEDBG_GOTOPC: setCurAddress(list.pc); scrollAddressIntoView(); redraw(); break; case ID_GEDBG_GOTOADDR: { u32 newAddress = curAddress; if (!InputBox_GetHex(GetModuleHandle(NULL), wnd, L"Address", curAddress, newAddress)) { break; } if (Memory::IsValidAddress(newAddress)) { setCurAddress(newAddress); scrollAddressIntoView(); redraw(); } } break; } return; } redraw(); }
void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button == 1) { int x = LOWORD(lParam); int y = HIWORD(lParam); setCurAddress(yToAddress(y), KeyDownAsync(VK_SHIFT)); redraw(); } else if (button == 2) { //popup menu? POINT pt; GetCursorPos(&pt); switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,1),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) { case ID_DISASM_GOTOINMEMORYVIEW: SendMessage(GetParent(wnd),WM_DEB_GOTOHEXEDIT,curAddress,0); break; case ID_DISASM_ADDHLE: break; case ID_DISASM_TOGGLEBREAKPOINT: toggleBreakpoint(); redraw(); break; case ID_DISASM_ASSEMBLE: assembleOpcode(curAddress,""); break; case ID_DISASM_COPYINSTRUCTIONDISASM: copyInstructions(selectRangeStart, selectRangeEnd, true); break; case ID_DISASM_COPYADDRESS: { char temp[16]; sprintf(temp,"%08X",curAddress); W32Util::CopyTextToClipboard(wnd, temp); } break; case ID_DISASM_SETPCTOHERE: debugger->setPC(curAddress); redraw(); break; case ID_DISASM_FOLLOWBRANCH: followBranch(); break; case ID_DISASM_COPYINSTRUCTIONHEX: copyInstructions(selectRangeStart, selectRangeEnd, false); break; case ID_DISASM_RUNTOHERE: { SendMessage(GetParent(wnd), WM_COMMAND, ID_DEBUG_RUNTOLINE, 0); redraw(); } break; case ID_DISASM_RENAMEFUNCTION: { u32 funcBegin = symbolMap.GetFunctionStart(curAddress); if (funcBegin != -1) { char name[256]; std::string newname; strncpy_s(name, symbolMap.GetLabelString(funcBegin).c_str(),_TRUNCATE); if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), L"New function name", name, newname)) { symbolMap.SetLabelName(newname.c_str(),funcBegin); u32 funcSize = symbolMap.GetFunctionSize(curAddress); MIPSAnalyst::RegisterFunction(funcBegin, funcSize, newname.c_str()); MIPSAnalyst::UpdateHashMap(); MIPSAnalyst::ApplyHashMap(); SendMessage(GetParent(wnd),WM_DEB_MAPLOADED,0,0); redraw(); } } else { MessageBox(MainWindow::GetHWND(), L"No symbol selected",0,0); } } break; case ID_DISASM_REMOVEFUNCTION: { char statusBarTextBuff[256]; u32 funcBegin = symbolMap.GetFunctionStart(curAddress); if (funcBegin != -1) { u32 prevBegin = symbolMap.GetFunctionStart(funcBegin-1); if (prevBegin != -1) { u32 expandedSize = symbolMap.GetFunctionSize(prevBegin)+symbolMap.GetFunctionSize(funcBegin); symbolMap.SetFunctionSize(prevBegin,expandedSize); } symbolMap.RemoveFunction(funcBegin,true); symbolMap.SortSymbols(); manager.clear(); SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0); } else { snprintf(statusBarTextBuff,256, "WARNING: unable to find function symbol here"); SendMessage(GetParent(wnd), WM_DEB_SETSTATUSBARTEXT, 0, (LPARAM) statusBarTextBuff); } redraw(); } break; case ID_DISASM_ADDFUNCTION: { char statusBarTextBuff[256]; u32 prevBegin = symbolMap.GetFunctionStart(curAddress); if (prevBegin != -1) { if (prevBegin == curAddress) { snprintf(statusBarTextBuff,256, "WARNING: There's already a function entry point at this adress"); SendMessage(GetParent(wnd), WM_DEB_SETSTATUSBARTEXT, 0, (LPARAM) statusBarTextBuff); } else { char symname[128]; u32 prevSize = symbolMap.GetFunctionSize(prevBegin); u32 newSize = curAddress-prevBegin; symbolMap.SetFunctionSize(prevBegin,newSize); newSize = prevSize-newSize; snprintf(symname,128,"u_un_%08X",curAddress); symbolMap.AddFunction(symname,curAddress,newSize); symbolMap.SortSymbols(); manager.clear(); SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0); } } else { char symname[128]; int newSize = selectRangeEnd - selectRangeStart; snprintf(symname, 128, "u_un_%08X", selectRangeStart); symbolMap.AddFunction(symname, selectRangeStart, newSize); symbolMap.SortSymbols(); SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0); } redraw(); } break; case ID_DISASM_DISASSEMBLETOFILE: disassembleToFile(); break; } return; } redraw(); }
void Debugger::applyBreakpoints(CodeBlock* codeBlock) { BreakpointIDToBreakpointMap& breakpoints = m_breakpointIDToBreakpoint; for (auto* breakpoint : breakpoints.values()) toggleBreakpoint(codeBlock, *breakpoint, BreakpointEnabled); }
void main(int argc, char* argv[]) { bool singleClock = false; genAGCStates(); MON::displayAGC(); while(1) { // NOTE: assumes that the display is always pointing to the start of // a new line at the top of this loop! // Clock the AGC, but between clocks, poll the keyboard // for front-panel input by the user. This uses a Microsoft function; // substitute some other non-blocking function to access the keyboard // if you're porting this to a different platform. cout << "> "; cout.flush(); // display prompt while( !_kbhit() ) { if(MON::FCLK || singleClock) { // This is a performance enhancement. If the AGC is running, // don't check the keyboard or simulator display every simulation // cycle, because that slows the simulator down too much. int genStateCntr = 100; do { CLK::clkAGC(); singleClock = false; genAGCStates(); genStateCntr--; // This needs more work. It doesn't always stop at the // right location and sometimes stops at the instruction // afterwards, too. if(breakpointEnab && breakpoint == MBF::getEffectiveAddress()) { MON::RUN = 0; } // Halt right after the instruction that changes a watched // memory location. if(watchEnab) { unsigned newWatchValue = MBF::readMemory(watchAddr); if(newWatchValue != oldWatchValue) { MON::RUN = 0; } oldWatchValue = newWatchValue; } } while (MON::FCLK && MON::RUN && genStateCntr > 0); updateAGCDisplay(); } // for convenience, clear the single step switch on TP1; in the // hardware AGC, this happens when the switch is released if(MON::STEP && TPG::register_SG.read() == TP1) MON::STEP = 0; } char key = _getch(); // Keyboard controls for front-panel: switch(key) { // AGC controls // simulator controls case 'q': cout << "QUIT..." << endl; exit(0); case 'm': showMenu(); break; case 'd': genAGCStates(); MON::displayAGC(); break; // update display case 'l': loadMemory(); break; case 'e': examineMemory(); break; case 'f': showSourceCode(); break; case ']': incrCntr(); //genAGCStates(); //displayAGC(EVERY_CYCLE); break; case '[': decrCntr(); //genAGCStates(); //displayAGC(EVERY_CYCLE); break; case 'i': interrupt(); //genAGCStates(); //displayAGC(EVERY_CYCLE); break; case 'z': //SCL::F17 = (SCL::F17 + 1) % 2; genAGCStates(); MON::displayAGC(); break; case 'x': //SCL::F13 = (SCL::F13 + 1) % 2; genAGCStates(); MON::displayAGC(); break; case 'r': MON::RUN = (MON::RUN + 1) % 2; genAGCStates(); if(!MON::FCLK) MON::displayAGC(); break; case 's': MON::STEP = (MON::STEP + 1) % 2; genAGCStates(); if(!MON::FCLK) MON::displayAGC(); break; case 'a': MON::SA = (MON::SA + 1) % 2; genAGCStates(); MON::displayAGC(); break; case 'n': MON::INST = (MON::INST + 1) % 2; genAGCStates(); MON::displayAGC(); break; case 'p': MON::PURST = (MON::PURST + 1) % 2; genAGCStates(); MON::displayAGC(); break; case 'b': toggleBreakpoint(); break; case 'y': toggleWatch(); break; // DSKY: case '0': KBD::keypress(KEYIN_0); break; case '1': KBD::keypress(KEYIN_1); break; case '2': KBD::keypress(KEYIN_2); break; case '3': KBD::keypress(KEYIN_3); break; case '4': KBD::keypress(KEYIN_4); break; case '5': KBD::keypress(KEYIN_5); break; case '6': KBD::keypress(KEYIN_6); break; case '7': KBD::keypress(KEYIN_7); break; case '8': KBD::keypress(KEYIN_8); break; case '9': KBD::keypress(KEYIN_9); break; case '+': KBD::keypress(KEYIN_PLUS); break; case '-': KBD::keypress(KEYIN_MINUS); break; case '.': KBD::keypress(KEYIN_CLEAR); break; case '/': KBD::keypress(KEYIN_VERB); break; case '*': KBD::keypress(KEYIN_NOUN); break; case 'g': KBD::keypress(KEYIN_KEY_RELEASE); break; case 'h': KBD::keypress(KEYIN_ERROR_RESET); break; case 'j': KBD::keypress(KEYIN_ENTER); break; case '\0': // must be a function key key = _getch(); switch(key) { case 0x3b: // F1: single clock pulse (when system clock off) singleClock = true; break; case 0x3c: // F2: manual clock (FCLK=0) MON::FCLK = 0; genAGCStates(); MON::displayAGC(); break; case 0x3e: // F4: fast clock (FCLK=1) MON::FCLK = 1; genAGCStates(); MON::displayAGC(); break; default: cout << "function key: " << key << "=" << hex << (int) key << dec << endl; } break; //default: cout << "??" << endl; default: cout << key << "=" << hex << (int) key << dec << endl; } } }
void BreakpointListView::slotBreakpointMarked(const KURL& url, int line, bool enabled) { toggleBreakpoint(url, line, enabled); }