- fix: Breakpoint condition expression that contains spaces doesn't work.
  - enhancement: Double click on breakpoint table's condition cell to modify it.
This commit is contained in:
Roy Qu 2024-04-04 21:34:16 +08:00
parent 726043d144
commit 3e1e4b0f01
4 changed files with 40 additions and 20 deletions

View File

@ -115,6 +115,8 @@ Red Panda C++ Version 2.27
- enhancement: Set shortcuts for tools menu item.
- enhancement: Enhancement for custom tools.
- fix: Can't correctly undo/redo "Delete current line".
- fix: Breakpoint condition expression that contains spaces doesn't work.
- enhancement: Double click on breakpoint table's condition cell to modify it.
Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors.

View File

@ -1107,7 +1107,7 @@ void GDBMIDebuggerClient::addBreakpoint(PBreakpoint breakpoint)
// break "filename":linenum
QString condition;
if (!breakpoint->condition.isEmpty()) {
condition = " -c " + breakpoint->condition;
condition = QString(" -c \"%1\"").arg(breakpoint->condition);
}
QString filename = breakpoint->filename;
filename.replace('\\','/');
@ -1145,7 +1145,7 @@ void GDBMIDebuggerClient::setBreakpointCondition(PBreakpoint breakpoint)
QString("%1").arg(breakpoint->number));
} else {
postCommand("-break-condition",
QString("%1 %2").arg(breakpoint->number).arg(condition));
QString("%1 \"%2\"").arg(breakpoint->number).arg(condition));
}
}

View File

@ -208,6 +208,8 @@ MainWindow::MainWindow(QWidget *parent)
delete m;
ui->tblBreakpoints->setTextElideMode(Qt::ElideRight);
ui->tblBreakpoints->setWordWrap(false);
connect(ui->tblBreakpoints, &QTableView::doubleClicked,
this, &MainWindow::onBreakpointTableDoubleClicked);
m=ui->tblStackTrace->selectionModel();
ui->tblStackTrace->setModel(mDebugger->backtraceModel().get());
@ -3016,7 +3018,7 @@ void MainWindow::createCustomActions()
tr("Breakpoint condition..."),
ui->tblBreakpoints);
connect(mBreakpointViewPropertyAction,&QAction::triggered,
this, &MainWindow::onBreakpointViewProperty);
this, &MainWindow::onModifyBreakpointCondition);
mBreakpointViewRemoveAllAction = createAction(
tr("Remove All Breakpoints"),
@ -4815,6 +4817,13 @@ void MainWindow::onDebugConsoleClear()
}
}
void MainWindow::onBreakpointTableDoubleClicked(const QModelIndex &index)
{
if (index.isValid() && index.column()==2) {
modifyBreakpointCondition(index.row());
}
}
void MainWindow::onFilesViewOpenInExplorer()
{
QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex());
@ -5079,25 +5088,11 @@ void MainWindow::onBreakpointViewRemoveAll()
}
}
void MainWindow::onBreakpointViewProperty()
void MainWindow::onModifyBreakpointCondition()
{
int index =ui->tblBreakpoints->selectionModel()->currentIndex().row();
PBreakpoint breakpoint = debugger()->breakpointModel()->breakpoint(
index,
debugger()->isForProject()
);
if (breakpoint) {
bool isOk;
QString s=QInputDialog::getText(this,
tr("Break point condition"),
tr("Enter the condition of the breakpoint:"),
QLineEdit::Normal,
breakpoint->condition,&isOk);
if (isOk) {
pMainWindow->debugger()->setBreakPointCondition(index,s,debugger()->isForProject());
}
}
modifyBreakpointCondition(index);
}
void MainWindow::onSearchViewClearAll()
@ -7835,6 +7830,26 @@ QString MainWindow::switchHeaderSourceTarget(Editor *editor)
return QString();
}
void MainWindow::modifyBreakpointCondition(int index)
{
PBreakpoint breakpoint = debugger()->breakpointModel()->breakpoint(
index,
debugger()->isForProject()
);
if (breakpoint) {
bool isOk;
QString s=QInputDialog::getText(this,
tr("Break point condition"),
tr("Enter the condition of the breakpoint:"),
QLineEdit::Normal,
breakpoint->condition,&isOk);
if (isOk) {
debugger()->setBreakPointCondition(index,s,debugger()->isForProject());
}
}
}
void MainWindow::setupSlotsForProject()
{
connect(mProject.get(), &Project::unitAdded,

View File

@ -333,6 +333,8 @@ private:
void reparseNonProjectEditors();
QString switchHeaderSourceTarget(Editor *editor);
void modifyBreakpointCondition(int index);
private slots:
void setupSlotsForProject();
void onProjectUnitAdded(const QString &filename);
@ -400,6 +402,7 @@ private slots:
void onDebugConsoleSelectAll();
void onDebugConsoleCopy();
void onDebugConsoleClear();
void onBreakpointTableDoubleClicked(const QModelIndex& index);
void onFilesViewOpenInExplorer();
void onFilesViewOpenInTerminal();
void onFilesViewOpenWithExternal();
@ -421,7 +424,7 @@ private slots:
void onProjectRenameUnit();
void onBreakpointRemove();
void onBreakpointViewRemoveAll();
void onBreakpointViewProperty();
void onModifyBreakpointCondition();
void onSearchViewClearAll();
void onSearchViewClear();
void onTableIssuesClear();