Skip to content

Commit

Permalink
Show breakpoint info as a tooltip if the breakpoint icon is clicked w…
Browse files Browse the repository at this point in the history
…ith LMB and held down.
  • Loading branch information
epasveer committed Sep 11, 2024
1 parent 4a23563 commit f3144f3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 5 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
53 changes: 50 additions & 3 deletions src/SeerEditorWidgetSourceAreas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ void SeerEditorWidgetSourceArea::handleText (const QString& text) {

}else if (text.contains(QRegularExpression("^([0-9]+)\\^done,BreakpointTable="))) {

// 11^7^done,BreakpointTable={...}
// 11^done,BreakpointTable={...}

QString id_text = text.section('^', 0,0);

Expand Down Expand Up @@ -1816,9 +1816,56 @@ void SeerEditorWidgetSourceArea::handleWatchFileModified (const QString& path) {

void SeerEditorWidgetSourceArea::handleBreakpointToolTip (QPoint pos, const QString& text) {

QString str = text;
// 11^7^done,BreakpointTable={...}
// 7^done,BreakpointTable={
// nr_rows="1",
// nr_cols="6",
// hdr=[],
// body=[
// bkpt={
// number="2",
// type="breakpoint",
// disp="keep",
// enabled="y",
// addr="0x0000000000400ccd",
// func="main(int, char**)",
// file="helloworld.cpp",
// fullname="/nas/erniep/Development/seer/tests/helloworld/helloworld.cpp",
// line="30",
// thread-groups=["i1"],
// times="1",
// original-location="-source /nas/erniep/Development/seer/tests/helloworld/helloworld.cpp -line 30"
// }
// ]
// }

QString newtext = Seer::filterEscapes(text); // Filter escaped characters.
QString tooltiptext;

QToolTip::showText(mapToGlobal(pos), str);
//
// Parse 'body' text.
//
QString body_text = Seer::parseFirst(newtext, "body=", '[', ']', false);

if (body_text != "") {

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

// Construct the tooltip.
tooltiptext += "Breakpoint information\n\n";
for (const auto& bkpt_text : bkpt_list) {

QStringList item_list = Seer::parseCommaList(bkpt_text);

for (const auto& item_text : item_list) {
tooltiptext += item_text + "\n";
}

break; // Take the first breakpoint in case, somehow, more are returned.
}
}

QToolTip::showText(mapToGlobal(pos), tooltiptext);
}

//
Expand Down
2 changes: 1 addition & 1 deletion src/SeerGdbWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ void SeerGdbWidget::handleGdbBreakpointInfo (int breakpointid, QString breakpoin
return;
}

QString str = QString("%1-break-list %2").arg(breakpointid).arg(breakpoint);
QString str = QString("%1-break-info %2").arg(breakpointid).arg(breakpoint);

handleGdbCommand(str);
}
Expand Down
1 change: 1 addition & 0 deletions src/SeerMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <QtWidgets/QMenu>
#include <QtWidgets/QStyleFactory>
#include <QtWidgets/QToolButton>
#include <QtWidgets/QToolTip>
#include <QtGui/QKeySequence>
#include <QtGui/QPalette>
#include <QtCore/QCoreApplication>
Expand Down

0 comments on commit f3144f3

Please sign in to comment.