Skip to content

Commit

Permalink
Merge pull request #248 from epasveer/239-add-hover-tool-tip-info-for…
Browse files Browse the repository at this point in the history
…-breakpoints-in-source-editor-windows

239 add hover tool tip info for breakpoints in source editor windows
  • Loading branch information
epasveer authored Sep 11, 2024
2 parents e35c03c + f3144f3 commit 860b2d4
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 107 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- Detached and minimized
- Attached in Seer's tab view (with gdb logs and seer logs).
* Improved handling of \n \t and other escaped characters in gdb log window.
* Show breakpoint info as a tooltip if the breakpoint icon is clicked with
LMB and held down.

## [2.4] - 2024-03-18
* Changed main icon to a more license friendly one.
Expand Down
2 changes: 1 addition & 1 deletion src/SeerBreakpointsBrowserWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void SeerBreakpointsBrowserWidget::handleText (const QString& text) {

QStringList bkpt_list = Seer::parse(newtext, "bkpt=", '{', '}', false);

for ( const auto& bkpt_text : bkpt_list ) {
for (const auto& bkpt_text : bkpt_list) {

//
// A different way (better?) of parsing the table output
Expand Down
71 changes: 39 additions & 32 deletions src/SeerEditorManagerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ const QString& SeerEditorManagerWidget::editorExternalEditorCommand () const {

void SeerEditorManagerWidget::handleText (const QString& text) {

// Update the current line.
if (text.startsWith("*stopped")) {

//qDebug() << ":stopped:" << text;
Expand Down Expand Up @@ -489,6 +490,7 @@ void SeerEditorManagerWidget::handleText (const QString& text) {

return;

// Refresh the breakpoints for all opened files.
}else if (text.startsWith("^done,BreakpointTable={") && text.endsWith("}")) {

//
Expand Down Expand Up @@ -558,6 +560,35 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
}
}

// Send the info for an individual breakpoint to all opened files.
// Each opened file can accept it (or reject it) to display the
// info as a ToolTip.
}else if (text.contains(QRegularExpression("^([0-9]+)\\^done,BreakpointTable={")) && text.endsWith("}")) {

//
// See SeerBreakpointsBrowserWidget.cpp
//
// 7^done,BreakpointTable={
// ...
// }
//

// Loop through each opened file and forward the text.
SeerEditorManagerEntries::iterator i = beginEntry();
SeerEditorManagerEntries::iterator e = endEntry();

while (i != e) {
i->widget->sourceArea()->handleText(text);
i++;
}

// Forward the text to the assembly widget, if there is one.
SeerEditorWidgetAssembly* assemblyWidget = assemblyWidgetTab();

if (assemblyWidget) {
assemblyWidget->assemblyArea()->handleText(text);
}

}else if (text.startsWith("^done,stack=[") && text.endsWith("]")) {

//qDebug() << ":stack:" << text;
Expand Down Expand Up @@ -828,6 +859,7 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QS
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::deleteBreakpoints, this, &SeerEditorManagerWidget::handleDeleteBreakpoints);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::enableBreakpoints, this, &SeerEditorManagerWidget::handleEnableBreakpoints);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::disableBreakpoints, this, &SeerEditorManagerWidget::handleDisableBreakpoints);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::infoBreakpoint, this, &SeerEditorManagerWidget::handleInfoBreakpoint);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::refreshBreakpointsStackFrames, this, &SeerEditorManagerWidget::handleRefreshBreakpointsStackFrames);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::runToLine, this, &SeerEditorManagerWidget::handleRunToLine);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::addVariableLoggerExpression, this, &SeerEditorManagerWidget::handleAddVariableLoggerExpression);
Expand Down Expand Up @@ -888,6 +920,7 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QS
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::deleteBreakpoints, this, &SeerEditorManagerWidget::handleDeleteBreakpoints);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::enableBreakpoints, this, &SeerEditorManagerWidget::handleEnableBreakpoints);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::disableBreakpoints, this, &SeerEditorManagerWidget::handleDisableBreakpoints);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::infoBreakpoint, this, &SeerEditorManagerWidget::handleInfoBreakpoint);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::refreshBreakpointsStackFrames, this, &SeerEditorManagerWidget::handleRefreshBreakpointsStackFrames);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::runToLine, this, &SeerEditorManagerWidget::handleRunToLine);
QObject::connect(editorWidget->sourceArea(), &SeerEditorWidgetSourceArea::addVariableLoggerExpression, this, &SeerEditorManagerWidget::handleAddVariableLoggerExpression);
Expand Down Expand Up @@ -1131,44 +1164,40 @@ void SeerEditorManagerWidget::handleAddAlternateDirectory (QString path) {

void SeerEditorManagerWidget::handleInsertBreakpoint (QString breakpoint) {

//qDebug() << breakpoint;

// rethrow
emit insertBreakpoint (breakpoint);
}

void SeerEditorManagerWidget::handleInsertPrintpoint (QString printpoint) {

//qDebug() << printpoint;

// rethrow
emit insertPrintpoint (printpoint);
}

void SeerEditorManagerWidget::handleDeleteBreakpoints (QString breakpoints) {

//qDebug() << breakpoints;

// rethrow
emit deleteBreakpoints (breakpoints);
}

void SeerEditorManagerWidget::handleEnableBreakpoints (QString breakpoints) {

//qDebug() << breakpoints;

// rethrow
emit enableBreakpoints (breakpoints);
}

void SeerEditorManagerWidget::handleDisableBreakpoints (QString breakpoints) {

//qDebug() << breakpoints;

// rethrow
emit disableBreakpoints (breakpoints);
}

void SeerEditorManagerWidget::handleInfoBreakpoint (int breakpointid, QString breakpoint) {

// rethrow
emit infoBreakpoint (breakpointid, breakpoint);
}

void SeerEditorManagerWidget::handleRefreshBreakpointsStackFrames () {

// Ask for the breakpoint list to be resent, in case files have breakpoints.
Expand All @@ -1180,80 +1209,60 @@ void SeerEditorManagerWidget::handleRefreshBreakpointsStackFrames () {

void SeerEditorManagerWidget::handleRunToLine (QString fullname, int lineno) {

//qDebug() << fullname << lineno;

// rethrow
emit runToLine (fullname, lineno);
}

void SeerEditorManagerWidget::handleRunToAddress (QString address) {

//qDebug() << address;

// rethrow
emit runToAddress (address);
}

void SeerEditorManagerWidget::handleAddVariableLoggerExpression (QString expression) {

//qDebug() << expression;

// rethrow
emit addVariableLoggerExpression (expression);
}

void SeerEditorManagerWidget::handleAddVariableTrackerExpression (QString expression) {

//qDebug() << expression;

// rethrow
emit addVariableTrackerExpression (expression);
}

void SeerEditorManagerWidget::handleRefreshVariableTrackerValues () {

//qDebug();

// rethrow
emit refreshVariableTrackerValues ();
}

void SeerEditorManagerWidget::handleEvaluateVariableExpression (int expressionid, QString expression) {

//qDebug();

// rethrow
emit evaluateVariableExpression (expressionid, expression);
}

void SeerEditorManagerWidget::handleAddMemoryVisualizer (QString expression) {

//qDebug() << expression;

// rethrow
emit addMemoryVisualize (expression);
}

void SeerEditorManagerWidget::handleAddArrayVisualizer (QString expression) {

//qDebug() << expression;

// rethrow
emit addArrayVisualize (expression);
}

void SeerEditorManagerWidget::handleAddStructVisualizer (QString expression) {

//qDebug() << expression;

// rethrow
emit addStructVisualize (expression);
}

void SeerEditorManagerWidget::handleRequestAssembly (QString address) {

//qDebug() << address;

// rethrow
emit requestAssembly (address);

Expand All @@ -1264,8 +1273,6 @@ void SeerEditorManagerWidget::handleRequestAssembly (QString address) {

void SeerEditorManagerWidget::handleRequestSourceAndAssembly (QString address) {

//qDebug() << address;

// rethrow
emit requestSourceAndAssembly (address);

Expand Down
2 changes: 2 additions & 0 deletions src/SeerEditorManagerWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW
void handleDeleteBreakpoints (QString breakpoints);
void handleEnableBreakpoints (QString breakpoints);
void handleDisableBreakpoints (QString breakpoints);
void handleInfoBreakpoint (int breakpointid, QString breakpoint);
void handleRefreshBreakpointsStackFrames ();
void handleRunToLine (QString fullname, int lineno);
void handleRunToAddress (QString address);
Expand Down Expand Up @@ -104,6 +105,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW
void deleteBreakpoints (QString breakpoints);
void enableBreakpoints (QString breakpoints);
void disableBreakpoints (QString breakpoints);
void infoBreakpoint (int breakpointid, QString breakpoint);
void runToLine (QString file, int lineno);
void runToAddress (QString address);
void addVariableLoggerExpression (QString expression);
Expand Down
5 changes: 5 additions & 0 deletions src/SeerEditorWidgetSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
void showContextMenu (const QPoint& pos, const QPointF& globalPos);
void setQuickBreakpoint (QMouseEvent* event);
void setQuickRunToLine (QMouseEvent* event);
void showBreakpointToolTip (QMouseEvent* event);

void clearExpression ();

Expand All @@ -105,6 +106,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
void deleteBreakpoints (QString breakpoints);
void enableBreakpoints (QString breakpoints);
void disableBreakpoints (QString breakpoints);
void infoBreakpoint (int breakpointid, QString breakpoint);
void refreshBreakpointsStackFrames ();
void runToLine (QString fullname, int lineno);
void addVariableLoggerExpression (QString expression);
Expand All @@ -123,6 +125,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
void handleText (const QString& text);
void handleHighlighterSettingsChanged ();
void handleWatchFileModified (const QString& path);
void handleBreakpointToolTip (QPoint pos, const QString& text);

protected:
void resizeEvent (QResizeEvent* event);
Expand Down Expand Up @@ -159,6 +162,8 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
int _selectedExpressionId;
QString _selectedExpressionName;
QString _selectedExpressionValue;
QPoint _selectedBreakpointPosition;
int _selectedBreakpointId;

SeerEditorWidgetSourceLineNumberArea* _lineNumberArea;
SeerEditorWidgetSourceBreakPointArea* _breakPointArea;
Expand Down
Loading

0 comments on commit 860b2d4

Please sign in to comment.