Skip to content

Commit 899228f

Browse files
authored
Merge pull request #323 from epasveer/190-see-if-seer-can-support-the-udb-debugger
190 see if seer can support the udb debugger
2 parents 7411288 + e040380 commit 899228f

25 files changed

+169
-136
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Fixed bug when adding variable to tracker. Sometimes would not refresh value.
2121
* Raise Logger or Tracker tab when new variable is added.
2222
* Implment gdb's "checkpoint" feature. As simple time-travel feature.
23+
* Add preliminary support for Undo's udb time-traveling debugger.
2324

2425
## [2.5] - 2024-12-24
2526
* Console now supports a subset of ANSI color codes.

src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ if(${QTVERSION} STREQUAL "QT6")
3232
find_package(Qt6 COMPONENTS REQUIRED PrintSupport)
3333
find_package(Qt6 COMPONENTS REQUIRED Charts)
3434
find_package(Qt6 COMPONENTS REQUIRED Svg)
35+
find_package(Qt6 COMPONENTS REQUIRED OpenGL)
3536

3637
set(CMAKE_CXX_STANDARD 17)
3738
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -279,7 +280,7 @@ add_executable(${PROJECT_NAME} ${SYSTEM_TYPE} ${SOURCE_FILES})
279280
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
280281

281282
if(${QTVERSION} STREQUAL "QT6")
282-
target_link_libraries(${PROJECT_NAME} Qt6::Widgets Qt6::Gui Qt6::Core Qt6::PrintSupport Qt6::Charts Qt6::Svg)
283+
target_link_libraries(${PROJECT_NAME} Qt6::Widgets Qt6::Gui Qt6::Core Qt6::PrintSupport Qt6::Charts Qt6::Svg Qt6::OpenGL)
283284
elseif(${QTVERSION} STREQUAL "QT5")
284285
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Gui Qt5::Core Qt5::PrintSupport Qt5::Charts)
285286
endif()

src/SeerAdaTasksBrowserWidget.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ void SeerAdaTasksBrowserWidget::handleText (const QString& text) {
135135
adaTaskTreeWidget->setCurrentItem(matches.first());
136136
}
137137

138-
}else if (text.startsWith("^error,msg=\"No registers.\"")) {
139-
adaTaskTreeWidget->clear();
140-
141138
}else{
142139
// Ignore others.
143140
}

src/SeerBreakpointsBrowserWidget.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ void SeerBreakpointsBrowserWidget::handleText (const QString& text) {
183183
}
184184
}
185185

186-
}else if (text.startsWith("^error,msg=\"No registers.\"")) {
187-
// Ignore.
188-
189186
}else{
190187
// Ignore others.
191188
}

src/SeerCatchpointsBrowserWidget.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ void SeerCatchpointsBrowserWidget::handleText (const QString& text) {
221221
qDeleteAll(matches);
222222
}
223223

224-
}else if (text.startsWith("^error,msg=\"No registers.\"")) {
225-
// Ignore.
226-
227224
}else{
228225
// Ignore others.
229226
}

src/SeerCheckpointsBrowserWidget.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</property>
2222
<column>
2323
<property name="text">
24-
<string>State</string>
24+
<string>Active</string>
2525
</property>
2626
</column>
2727
<column>

src/SeerGdbWidget.cpp

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
381381
QObject::connect(this, &SeerGdbWidget::sessionTerminated, variableManagerWidget->variableLoggerBrowserWidget(), &SeerVariableLoggerBrowserWidget::handleSessionTerminated);
382382
QObject::connect(this, &SeerGdbWidget::sessionTerminated, variableManagerWidget->variableTrackerBrowserWidget(), &SeerVariableTrackerBrowserWidget::handleSessionTerminated);
383383
QObject::connect(this, &SeerGdbWidget::sessionTerminated, variableManagerWidget->registerValuesBrowserWidget(), &SeerRegisterValuesBrowserWidget::handleSessionTerminated);
384+
QObject::connect(this, &SeerGdbWidget::sessionTerminated, stackManagerWidget, &SeerStackManagerWidget::handleSessionTerminated);
384385
QObject::connect(this, &SeerGdbWidget::sessionTerminated, stackManagerWidget->stackFramesBrowserWidget(), &SeerStackFramesBrowserWidget::handleSessionTerminated);
385386
QObject::connect(this, &SeerGdbWidget::sessionTerminated, stackManagerWidget->stackLocalsBrowserWidget(), &SeerStackLocalsBrowserWidget::handleSessionTerminated);
386387
QObject::connect(this, &SeerGdbWidget::sessionTerminated, stackManagerWidget->stackArgumentsBrowserWidget(), &SeerStackArgumentsBrowserWidget::handleSessionTerminated);
@@ -411,7 +412,6 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
411412

412413
// Restore window settings.
413414
readSettings();
414-
415415
}
416416

417417
SeerGdbWidget::~SeerGdbWidget () {
@@ -739,10 +739,18 @@ QString SeerGdbWidget::gdbRemoteTargetType () const {
739739

740740
void SeerGdbWidget::setGdbRecordMode(const QString& mode) {
741741

742-
_gdbRecordMode = mode;
742+
if (mode == "auto") {
743+
if (gdbProgram().contains("udb")) {
744+
_gdbRecordMode = "udb";
745+
}else{
746+
_gdbRecordMode = "";
747+
}
748+
}else{
749+
_gdbRecordMode = mode;
750+
}
743751

744-
if (mode != "rr" && mode != "") {
745-
handleGdbCommand("record " + gdbRecordMode());
752+
if (_gdbRecordMode != "rr" && _gdbRecordMode != "udb" && _gdbRecordMode != "") {
753+
handleGdbCommand("record " + _gdbRecordMode);
746754
}
747755

748756
emit recordSettingsChanged();
@@ -1076,7 +1084,7 @@ void SeerGdbWidget::handleGdbRunExecutable (const QString& breakMode, bool loadS
10761084

10771085
setExecutableLaunchMode("run");
10781086
saveLaunchMode();
1079-
setGdbRecordMode("");
1087+
setGdbRecordMode("auto");
10801088
setExecutablePid(0);
10811089

10821090
// Load the executable, if needed.
@@ -1207,7 +1215,7 @@ void SeerGdbWidget::handleGdbAttachExecutable (bool loadSessionBreakpoints) {
12071215
// No console for 'attach' mode but make sure it's reattached.
12081216
setExecutableLaunchMode("attach");
12091217
saveLaunchMode();
1210-
setGdbRecordMode("");
1218+
setGdbRecordMode("auto");
12111219
reattachConsole();
12121220

12131221
// Load the executable, if needed.
@@ -1296,7 +1304,7 @@ void SeerGdbWidget::handleGdbConnectExecutable (bool loadSessionBreakpoints) {
12961304
// No console for 'connect' mode but make sure it's reattached.
12971305
setExecutableLaunchMode("connect");
12981306
saveLaunchMode();
1299-
setGdbRecordMode("");
1307+
setGdbRecordMode("auto");
13001308
setExecutablePid(0);
13011309
reattachConsole();
13021310

@@ -1447,9 +1455,9 @@ void SeerGdbWidget::handleGdbRRExecutable (bool loadSessionBreakpoints) {
14471455
// Restart the executable if it was already running.
14481456
if (newExecutableFlag() == false) {
14491457
if (_executableBreakMode == "inmain") {
1450-
handleGdbCommand("-exec-run --all --start"); // Stop in main
1458+
handleGdbCommand("-exec-run --start"); // Stop in main
14511459
}else{
1452-
handleGdbCommand("-exec-run --all"); // Do not stop in main. But honor other breakpoints that may have been previously set.
1460+
handleGdbCommand("-exec-run"); // Do not stop in main. But honor other breakpoints that may have been previously set.
14531461
}
14541462
}
14551463

@@ -1517,7 +1525,7 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
15171525
// No console for 'core' mode but make sure it's reattached.
15181526
setExecutableLaunchMode("corefile");
15191527
saveLaunchMode();
1520-
setGdbRecordMode("");
1528+
setGdbRecordMode("auto");
15211529
setExecutablePid(0);
15221530
reattachConsole();
15231531

@@ -1576,7 +1584,7 @@ void SeerGdbWidget::handleGdbTerminateExecutable (bool confirm) {
15761584
}
15771585

15781586
handleGdbCommand(QString("save breakpoints /tmp/breakpoints.seer.%1").arg(QCoreApplication::applicationPid()));
1579-
delay(1);
1587+
delay(2);
15801588

15811589
// Give the gdb and 'exit' command.
15821590
// This should handle detaching from an attached pid.
@@ -1694,7 +1702,7 @@ void SeerGdbWidget::handleGdbContinue () {
16941702
return;
16951703
}
16961704

1697-
handleGdbCommand(QString("-exec-continue %1 --all").arg(gdbRecordDirection()));
1705+
handleGdbCommand(QString("-exec-continue %1").arg(gdbRecordDirection()));
16981706
}
16991707

17001708
void SeerGdbWidget::handleGdbRecordStart () {
@@ -1703,8 +1711,8 @@ void SeerGdbWidget::handleGdbRecordStart () {
17031711
return;
17041712
}
17051713

1706-
if (executableLaunchMode() == "rr") {
1707-
QMessageBox::warning(this, "Seer", QString("Record 'Start' not available in RR mode."), QMessageBox::Ok);
1714+
if (executableLaunchMode() == "rr" || executableLaunchMode() == "udb") {
1715+
QMessageBox::warning(this, "Seer", QString("Record 'Start' not available in RR or UDB mode."), QMessageBox::Ok);
17081716
return;
17091717
}
17101718

@@ -1718,8 +1726,8 @@ void SeerGdbWidget::handleGdbRecordStop () {
17181726
return;
17191727
}
17201728

1721-
if (executableLaunchMode() == "rr") {
1722-
QMessageBox::warning(this, "Seer", QString("Record 'Stop' not available in RR mode."), QMessageBox::Ok);
1729+
if (executableLaunchMode() == "rr" || executableLaunchMode() == "udb") {
1730+
QMessageBox::warning(this, "Seer", QString("Record 'Stop' not available in RR or UDB mode."), QMessageBox::Ok);
17231731
return;
17241732
}
17251733

@@ -1753,6 +1761,10 @@ void SeerGdbWidget::handleGdbRecordStartStopToggle () {
17531761

17541762
// Don't do anthing.
17551763

1764+
}else if (gdbRecordMode() == "udb") {
1765+
1766+
// Don't do anthing.
1767+
17561768
}else{
17571769

17581770
setGdbRecordMode("stop");
@@ -2065,9 +2077,6 @@ void SeerGdbWidget::handleGdbSessionLoadBreakpoints () {
20652077

20662078
handleGdbCommand(QString("source -v /tmp/breakpoints.seer.%1").arg(QCoreApplication::applicationPid()));
20672079
handleGdbGenericpointList();
2068-
2069-
delay(1);
2070-
QFile::remove(QString("/tmp/breakpoints.seer.%1").arg(QCoreApplication::applicationPid()));
20712080
}
20722081

20732082
void SeerGdbWidget::handleGdbSessionSaveBreakpoints () {
@@ -4089,7 +4098,7 @@ void SeerGdbWidget::sendGdbInterrupt (int signal) {
40894098
// We do have the ability to use a different signal, though. :^)
40904099

40914100
if (signal < 0) {
4092-
handleGdbCommand("-exec-interrupt --all");
4101+
handleGdbCommand("-exec-interrupt");
40934102

40944103
}else{
40954104
int stat = kill(executablePid(), signal);

src/SeerMainWindow.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,7 @@ void SeerMainWindow::handleRecordSettingsChanged () {
13301330

13311331
// Toolbar
13321332
actionRecordProcess->setText("Record");
1333+
actionRecordProcess->setToolTip("Toggle Record mode.");
13331334
actionRecordProcess->setEnabled(true);
13341335
actionRecordDirection->setEnabled(false);
13351336
actionRecordDirection->setIcon(QIcon(":/seer/resources/RelaxLightIcons/go-next.svg"));
@@ -1363,6 +1364,7 @@ void SeerMainWindow::handleRecordSettingsChanged () {
13631364

13641365
// Toolbar
13651366
actionRecordProcess->setText("Recording");
1367+
actionRecordProcess->setToolTip("Toggle Record mode.");
13661368
actionRecordProcess->setEnabled(true);
13671369
actionRecordDirection->setEnabled(true);
13681370

@@ -1395,11 +1397,45 @@ void SeerMainWindow::handleRecordSettingsChanged () {
13951397

13961398
// Toolbar
13971399
actionRecordProcess->setText("RR");
1400+
actionRecordProcess->setToolTip("Using RR debugger.");
1401+
actionRecordProcess->setEnabled(true);
1402+
actionRecordDirection->setEnabled(true);
1403+
1404+
}else if (gdbWidget->gdbRecordMode() == "udb") {
1405+
1406+
// Menu Control
1407+
actionControlRecordStart->setEnabled(false);
1408+
actionControlRecordStop->setEnabled(false);
1409+
actionControlRecordForward->setEnabled(true);
1410+
actionControlRecordReverse->setEnabled(true);
1411+
1412+
if (gdbWidget->gdbRecordDirection() == "") {
1413+
1414+
actionControlRecordForward->setChecked(true);
1415+
actionRecordDirection->setIcon(QIcon(":/seer/resources/RelaxLightIcons/go-next.svg"));
1416+
1417+
}else if (gdbWidget->gdbRecordDirection() == "--reverse") {
1418+
1419+
actionControlRecordReverse->setChecked(true);
1420+
actionRecordDirection->setIcon(QIcon(":/seer/resources/RelaxLightIcons/go-previous.svg"));
1421+
1422+
}else{
1423+
1424+
actionControlRecordForward->setChecked(false);
1425+
actionControlRecordReverse->setChecked(false);
1426+
actionRecordDirection->setIcon(QIcon(":/seer/resources/RelaxLightIcons/go-next.svg"));
1427+
1428+
qDebug() << "Bad record direction of '" << gdbWidget->gdbRecordDirection() << "'";
1429+
}
1430+
1431+
// Toolbar
1432+
actionRecordProcess->setText("UDB");
1433+
actionRecordProcess->setToolTip("Using UDB debugger.");
13981434
actionRecordProcess->setEnabled(true);
13991435
actionRecordDirection->setEnabled(true);
14001436

14011437
}else{
1402-
qDebug() << "Bad record mode of '" << gdbWidget->gdbRecordMode() << "'";
1438+
qDebug() << "Bad record mode of:" << gdbWidget->gdbRecordMode();
14031439
}
14041440
}
14051441

src/SeerMainWindow.ui

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
</property>
9999
<widget class="QMenu" name="menuRecord">
100100
<property name="toolTip">
101-
<string>Set Gdb Record mode.</string>
101+
<string>Set Record mode.</string>
102102
</property>
103103
<property name="title">
104104
<string>Record</string>
@@ -112,7 +112,7 @@
112112
</widget>
113113
<widget class="QMenu" name="menuDirection">
114114
<property name="toolTip">
115-
<string>Set Gdb Playback direction.</string>
115+
<string>Set Playback direction.</string>
116116
</property>
117117
<property name="title">
118118
<string>Direction</string>
@@ -529,7 +529,7 @@
529529
<string>Stop</string>
530530
</property>
531531
<property name="toolTip">
532-
<string>Stop Gdb Record mode.</string>
532+
<string>Stop Record mode.</string>
533533
</property>
534534
</action>
535535
<action name="actionControlRecordReverse">
@@ -556,7 +556,7 @@
556556
<string>Record</string>
557557
</property>
558558
<property name="toolTip">
559-
<string>Toggle Gdb Record mode.</string>
559+
<string>Toggle Record mode.</string>
560560
</property>
561561
</action>
562562
<action name="actionControlRecordStart">
@@ -568,7 +568,7 @@
568568
<string>Start</string>
569569
</property>
570570
<property name="toolTip">
571-
<string>Start Gdb Record mode.</string>
571+
<string>Start Record mode.</string>
572572
</property>
573573
</action>
574574
<action name="actionControlRecordForward">
@@ -595,7 +595,7 @@
595595
<string>Direction</string>
596596
</property>
597597
<property name="toolTip">
598-
<string>Toggle Gdb Playback direction.</string>
598+
<string>Toggle Playback direction.</string>
599599
</property>
600600
</action>
601601
<action name="actionViewImageVisualizer">

src/SeerMemoryVisualizerWidget.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,6 @@ void SeerMemoryVisualizerWidget::handleText (const QString& text) {
296296
handleRefreshButton();
297297
}
298298

299-
// End of program. Clear everything as it will be out of date.
300-
}else if (text.startsWith("^error,msg=\"No registers.\"")) {
301-
setVariableName("");
302-
setMemoryLength("");
303-
304299
}else{
305300
// Ignore anything else.
306301
}

0 commit comments

Comments
 (0)