mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 16:40:42 +08:00
Merge pull request #427 from epasveer/420-add-a-hotkey-for-run-to-cursor
420 add a hotkey for run to cursor
This commit is contained in:
@@ -1410,7 +1410,26 @@ void SeerEditorManagerWidget::handleRunToLine (QString fullname, int lineno) {
|
||||
void SeerEditorManagerWidget::handleRunToAddress (QString address) {
|
||||
|
||||
// rethrow
|
||||
emit runToAddress (address);
|
||||
if (address != "") {
|
||||
emit runToAddress (address);
|
||||
}
|
||||
}
|
||||
|
||||
void SeerEditorManagerWidget::handleRunToSelectedLine () {
|
||||
|
||||
SeerEditorWidgetSource* sourceTab = currentEditorWidgetTab();
|
||||
SeerEditorWidgetAssembly* assemblyTab = assemblyWidgetTab();
|
||||
|
||||
if (sourceTab) {
|
||||
emit runToLine (sourceTab->sourceArea()->fullname(), sourceTab->sourceArea()->currentLine());
|
||||
}
|
||||
|
||||
if (assemblyTab) {
|
||||
QString address = assemblyTab->assemblyArea()->currentLine();
|
||||
if (address != "") {
|
||||
emit runToAddress (address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SeerEditorManagerWidget::handleAddVariableLoggerExpression (QString expression) {
|
||||
|
||||
@@ -92,6 +92,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW
|
||||
void handleRefreshBreakpointsStackFrames ();
|
||||
void handleRunToLine (QString fullname, int lineno);
|
||||
void handleRunToAddress (QString address);
|
||||
void handleRunToSelectedLine ();
|
||||
void handleAddVariableLoggerExpression (QString expression);
|
||||
void handleAddVariableTrackerExpression (QString expression);
|
||||
void handleRefreshVariableTrackerValues ();
|
||||
|
||||
@@ -63,6 +63,7 @@ class SeerEditorWidgetAssemblyArea : public SeerPlainTextEdit {
|
||||
void setAddress (const QString& address, bool force=false);
|
||||
const QString& address () const;
|
||||
bool setCurrentLine (const QString& address);
|
||||
const QString currentLine () const;
|
||||
void scrollToLine (const QString& address);
|
||||
|
||||
void clearCurrentLines ();
|
||||
|
||||
@@ -877,6 +877,16 @@ bool SeerEditorWidgetAssemblyArea::setCurrentLine (const QString& address) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const QString SeerEditorWidgetAssemblyArea::currentLine () const {
|
||||
|
||||
// Get current lineno.
|
||||
int lineno = textCursor().blockNumber() + 1;
|
||||
|
||||
QString address = _lineAddressMap[lineno];
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
void SeerEditorWidgetAssemblyArea::scrollToLine (const QString& address) {
|
||||
|
||||
// Just return.
|
||||
@@ -1142,11 +1152,11 @@ void SeerEditorWidgetAssemblyArea::showContextMenu (const QPoint& pos, const QPo
|
||||
|
||||
int breakno = breakpointAddressToNumber(address);
|
||||
|
||||
runToAddressAction = new QAction(QString("Run to address %1").arg(address), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on address %1").arg(address), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint %1 on address %2").arg(breakno).arg(address), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint %1 on address %2").arg(breakno).arg(address), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint %1 on address %2").arg(breakno).arg(address), this);
|
||||
runToAddressAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/debug-execute-from-cursor.svg"), QString("Run to address %1").arg(address), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on address %1").arg(address), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint %1 on address %2").arg(breakno).arg(address), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint %1 on address %2").arg(breakno).arg(address), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint %1 on address %2").arg(breakno).arg(address), this);
|
||||
|
||||
runToAddressAction->setEnabled(true);
|
||||
createBreakpointAction->setEnabled(false);
|
||||
@@ -1155,11 +1165,11 @@ void SeerEditorWidgetAssemblyArea::showContextMenu (const QPoint& pos, const QPo
|
||||
disableAction->setEnabled(true);
|
||||
|
||||
}else{
|
||||
runToAddressAction = new QAction(QString("Run to address %1").arg(address), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on address %1").arg(address), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint on address %1").arg(address), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint on address %1").arg(address), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint on address %1").arg(address), this);
|
||||
runToAddressAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/debug-execute-from-cursor.svg"), QString("Run to address %1").arg(address), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on address %1").arg(address), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint on address %1").arg(address), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint on address %1").arg(address), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint on address %1").arg(address), this);
|
||||
|
||||
runToAddressAction->setEnabled(true);
|
||||
createBreakpointAction->setEnabled(true);
|
||||
|
||||
@@ -95,6 +95,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
|
||||
int breakpointLineToNumber (int lineno) const;
|
||||
bool breakpointLineEnabled (int lineno) const;
|
||||
void breakpointToggle ();
|
||||
void runToSelectedLine ();
|
||||
|
||||
void showContextMenu (QMouseEvent* event);
|
||||
void showContextMenu (QContextMenuEvent* event);
|
||||
@@ -121,6 +122,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
|
||||
SeerCurrentFile readCurrentPosition ();
|
||||
|
||||
void eraseColorCurrentLine (int lineno);
|
||||
|
||||
signals:
|
||||
void insertBreakpoint (QString breakpoint);
|
||||
void insertPrintpoint (QString type, QString function, QString channel, QString parameters);
|
||||
|
||||
@@ -948,6 +948,13 @@ void SeerEditorWidgetSourceArea::breakpointToggle () {
|
||||
}
|
||||
}
|
||||
|
||||
void SeerEditorWidgetSourceArea::runToSelectedLine () {
|
||||
|
||||
// Emit the runToLine signal.
|
||||
emit runToLine(fullname(), currentLine());
|
||||
|
||||
}
|
||||
|
||||
void SeerEditorWidgetSourceArea::showContextMenu (QMouseEvent* event) {
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
@@ -1005,13 +1012,13 @@ void SeerEditorWidgetSourceArea::showContextMenu (const QPoint& pos, const QPoin
|
||||
|
||||
int breakno = breakpointLineToNumber(lineno);
|
||||
|
||||
runToLineAction = new QAction(QString("Run to line %1").arg(lineno), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on line %1").arg(lineno), this);
|
||||
createPrintpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create printpoint on line %1").arg(lineno), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint %1 on line %2").arg(breakno).arg(lineno), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint %1 on line %2").arg(breakno).arg(lineno), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint %1 on line %2").arg(breakno).arg(lineno), this);
|
||||
openExternalEditor = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Open external editor on line %1").arg(lineno), this);
|
||||
runToLineAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/debug-execute-from-cursor.svg"), QString("Run to line %1").arg(lineno), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on line %1").arg(lineno), this);
|
||||
createPrintpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create printpoint on line %1").arg(lineno), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint %1 on line %2").arg(breakno).arg(lineno), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint %1 on line %2").arg(breakno).arg(lineno), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint %1 on line %2").arg(breakno).arg(lineno), this);
|
||||
openExternalEditor = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Open external editor on line %1").arg(lineno), this);
|
||||
|
||||
runToLineAction->setEnabled(true);
|
||||
createBreakpointAction->setEnabled(false);
|
||||
@@ -1022,13 +1029,13 @@ void SeerEditorWidgetSourceArea::showContextMenu (const QPoint& pos, const QPoin
|
||||
openExternalEditor->setEnabled(true);
|
||||
|
||||
}else{
|
||||
runToLineAction = new QAction(QString("Run to line %1").arg(lineno), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on line %1").arg(lineno), this);
|
||||
createPrintpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create printpoint on line %1").arg(lineno), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint on line %1").arg(lineno), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint on line %1").arg(lineno), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint on line %1").arg(lineno), this);
|
||||
openExternalEditor = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Open file in external editor"), this);
|
||||
runToLineAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/debug-execute-from-cursor.svg"), QString("Run to line %1").arg(lineno), this);
|
||||
createBreakpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create breakpoint on line %1").arg(lineno), this);
|
||||
createPrintpointAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Create printpoint on line %1").arg(lineno), this);
|
||||
deleteAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/edit-delete.svg"), QString("Delete breakpoint on line %1").arg(lineno), this);
|
||||
enableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-add.svg"), QString("Enable breakpoint on line %1").arg(lineno), this);
|
||||
disableAction = new QAction(QIcon(":/seer/resources/RelaxLightIcons/list-remove.svg"), QString("Disable breakpoint on line %1").arg(lineno), this);
|
||||
openExternalEditor = new QAction(QIcon(":/seer/resources/RelaxLightIcons/document-new.svg"), QString("Open file in external editor"), this);
|
||||
|
||||
runToLineAction->setEnabled(true);
|
||||
createBreakpointAction->setEnabled(true);
|
||||
@@ -1734,14 +1741,15 @@ void SeerEditorWidgetSourceArea::eraseColorCurrentLine (int lineno) {
|
||||
}
|
||||
|
||||
// Read current position in the source area: file name, line, column of cursor and first displayed line
|
||||
SeerEditorWidgetSourceArea::SeerCurrentFile SeerEditorWidgetSourceArea::readCurrentPosition()
|
||||
{
|
||||
SeerEditorWidgetSourceArea::SeerCurrentFile SeerEditorWidgetSourceArea::readCurrentPosition() {
|
||||
|
||||
SeerCurrentFile info;
|
||||
info.file = QFileInfo(file()).fileName(); // extract file name from full path
|
||||
info.fullname = fullname();
|
||||
info.cursorRow = currentLine();
|
||||
info.cursorCol = currentColumn();
|
||||
info.firstDisplayLine = firstDisplayLine();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ SeerKeySettings SeerKeySettings::populate () {
|
||||
keySettings.add("ReverseNexti", SeerKeySetting("ReverseNexti", QKeySequence::fromString("Shift+Ctrl+F5"), "Execute the previous instruction. Step over functions."));
|
||||
keySettings.add("ReverseStepi", SeerKeySetting("ReverseStepi", QKeySequence::fromString("Shift+Ctrl+F6"), "Execute the previous instruction. Step into functions."));
|
||||
keySettings.add("ReverseFinish", SeerKeySetting("ReverseFinish", QKeySequence::fromString("Shift+F7"), "Finish the current function in reverse."));
|
||||
keySettings.add("RunToLine", SeerKeySetting("RunToLine", QKeySequence::fromString("F9"), "Run to the currently selected line."));
|
||||
|
||||
return keySettings;
|
||||
}
|
||||
|
||||
+27
-19
@@ -144,25 +144,26 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) {
|
||||
QObject::connect(actionConsoleDetachedMinimized, &QAction::triggered, this, &SeerMainWindow::handleViewConsoleDetachedMinimized);
|
||||
QObject::connect(actionHelpAbout, &QAction::triggered, this, &SeerMainWindow::handleHelpAbout);
|
||||
|
||||
QObject::connect(actionControlRestart, &QAction::triggered, this, &SeerMainWindow::handleRestartExecutable);
|
||||
QObject::connect(actionControlTerminate, &QAction::triggered, this, &SeerMainWindow::handleTerminateExecutable);
|
||||
QObject::connect(actionControlContinue, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbContinue);
|
||||
QObject::connect(actionControlNext, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbNext);
|
||||
QObject::connect(actionControlStep, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbStep);
|
||||
QObject::connect(actionControlNexti, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbNexti);
|
||||
QObject::connect(actionControlStepi, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbStepi);
|
||||
QObject::connect(actionControlFinish, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbFinish);
|
||||
QObject::connect(actionControlReverseContinue, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseContinue);
|
||||
QObject::connect(actionControlReverseNext, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseNext);
|
||||
QObject::connect(actionControlReverseStep, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseStep);
|
||||
QObject::connect(actionControlReverseNexti, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseNexti);
|
||||
QObject::connect(actionControlReverseStepi, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseStepi);
|
||||
QObject::connect(actionControlReverseFinish, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseFinish);
|
||||
QObject::connect(actionControlRecordStart, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordStart);
|
||||
QObject::connect(actionControlRecordForward, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordForward);
|
||||
QObject::connect(actionControlRecordReverse, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordReverse);
|
||||
QObject::connect(actionControlRecordStop, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordStop);
|
||||
QObject::connect(actionControlInterrupt, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbInterrupt);
|
||||
QObject::connect(actionControlRestart, &QAction::triggered, this, &SeerMainWindow::handleRestartExecutable);
|
||||
QObject::connect(actionControlTerminate, &QAction::triggered, this, &SeerMainWindow::handleTerminateExecutable);
|
||||
QObject::connect(actionControlContinue, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbContinue);
|
||||
QObject::connect(actionControlNext, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbNext);
|
||||
QObject::connect(actionControlStep, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbStep);
|
||||
QObject::connect(actionControlNexti, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbNexti);
|
||||
QObject::connect(actionControlStepi, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbStepi);
|
||||
QObject::connect(actionControlFinish, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbFinish);
|
||||
QObject::connect(actionControlRunToLine, &QAction::triggered, gdbWidget->editorManager(), &SeerEditorManagerWidget::handleRunToSelectedLine);
|
||||
QObject::connect(actionControlReverseContinue, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseContinue);
|
||||
QObject::connect(actionControlReverseNext, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseNext);
|
||||
QObject::connect(actionControlReverseStep, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseStep);
|
||||
QObject::connect(actionControlReverseNexti, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseNexti);
|
||||
QObject::connect(actionControlReverseStepi, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseStepi);
|
||||
QObject::connect(actionControlReverseFinish, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbReverseFinish);
|
||||
QObject::connect(actionControlRecordStart, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordStart);
|
||||
QObject::connect(actionControlRecordForward, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordForward);
|
||||
QObject::connect(actionControlRecordReverse, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordReverse);
|
||||
QObject::connect(actionControlRecordStop, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRecordStop);
|
||||
QObject::connect(actionControlInterrupt, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbInterrupt);
|
||||
|
||||
QObject::connect(actionSettingsConfiguration, &QAction::triggered, this, &SeerMainWindow::handleSettingsConfiguration);
|
||||
QObject::connect(actionSettingsSaveConfiguration, &QAction::triggered, this, &SeerMainWindow::handleSettingsSaveConfiguration);
|
||||
@@ -1974,6 +1975,13 @@ void SeerMainWindow::refreshShortCuts () {
|
||||
actionControlDirectionMenu->setTitle(QString("Direction") + " (Toggle " + setting._sequence.toString() + ")");
|
||||
}
|
||||
|
||||
if (_keySettings.has("RunToLine")) {
|
||||
|
||||
SeerKeySetting setting = _keySettings.get("RunToLine");
|
||||
|
||||
actionControlRunToLine->setShortcut(setting._sequence);
|
||||
}
|
||||
|
||||
// Notify the editor manager of changes.
|
||||
gdbWidget->editorManager()->setEditorKeySettings(keySettings());
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
<addaction name="actionControlNext"/>
|
||||
<addaction name="actionControlStep"/>
|
||||
<addaction name="actionControlFinish"/>
|
||||
<addaction name="actionControlRunToLine"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionControlNexti"/>
|
||||
<addaction name="actionControlStepi"/>
|
||||
@@ -797,6 +798,21 @@
|
||||
<string>Reverse Stepi</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionControlRunToLine">
|
||||
<property name="icon">
|
||||
<iconset resource="resource.qrc">
|
||||
<normaloff>:/seer/resources/RelaxLightIcons/debug-execute-from-cursor.svg</normaloff>:/seer/resources/RelaxLightIcons/debug-execute-from-cursor.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Run To Line</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Run to the currently selected line. Stop at any breakpoints, or when the program exits.</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::NoRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
Reference in New Issue
Block a user