Skip to content

Commit

Permalink
Properly save message tab order to config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
epasveer committed Feb 15, 2025
1 parent e69edbf commit d061885
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
45 changes: 41 additions & 4 deletions src/SeerGdbWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,17 @@ void SeerGdbWidget::addMessage (const QString& message, QMessageBox::Icon messag
_messagesBrowserWidget->addMessage(message, messageType);
}

void SeerGdbWidget::handleLogsTabMoved (int from, int to) {
void SeerGdbWidget::handleLogsTabMoved (int to, int from) {

Q_UNUSED(from);
Q_UNUSED(to);

// Keep track of console tab if it moved.
if (_consoleIndex == from) {
qDebug() << "Console tab index changed from" << from << "to" << to;
_consoleIndex = to;
}

// Don't handle anything here if Seer is exiting.
if (isQuitting()) {
return;
Expand Down Expand Up @@ -789,6 +795,19 @@ void SeerGdbWidget::readLogsSettings () {
}
}

// Find the console tab index.
_consoleIndex = -1;
for (int i=0; i<logsTabWidget->tabBar()->count(); i++) {
if (logsTabWidget->tabBar()->tabText(i) == "Console output") {
_consoleIndex = i;
break;
}
}

if (_consoleIndex < 0) {
qDebug() << "The console tab index is not in the settings.";
}

// Make a tab current.
if (current != "") {
for (int i=0; i<logsTabWidget->tabBar()->count(); i++) {
Expand Down Expand Up @@ -1100,9 +1119,10 @@ void SeerGdbWidget::handleGdbAttachExecutable () {
handleGdbSourceScripts();
}

// No console for 'attach' mode.
// No console for 'attach' mode but make sure it's reattached.
setExecutableLaunchMode("attach");
setGdbRecordMode("");
reattachConsole();

// Load ithe executable, if needed.
if (newExecutableFlag() == true) {
Expand Down Expand Up @@ -1173,10 +1193,11 @@ void SeerGdbWidget::handleGdbConnectExecutable () {
handleGdbSourceScripts();
}

// No console for 'connect' mode.
// No console for 'connect' mode but make sure it's reattached.
setExecutableLaunchMode("connect");
setGdbRecordMode("");
setExecutablePid(0);
reattachConsole();

// Connect to the remote gdbserver.
handleGdbCommand(QString("-target-select extended-remote %1").arg(executableConnectHostPort()));
Expand Down Expand Up @@ -1378,10 +1399,11 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
handleGdbSourceScripts();
}

// No console for 'core' mode.
// No console for 'core' mode but make sure it's reattached.
setExecutableLaunchMode("corefile");
setGdbRecordMode("");
setExecutablePid(0);
reattachConsole();

if (newExecutableFlag() == true) {
handleGdbExecutablePreCommands(); // Run any 'pre' commands before program is loaded.
Expand Down Expand Up @@ -3300,6 +3322,21 @@ void SeerGdbWidget::disconnectConsole () {
}
}

void SeerGdbWidget::reattachConsole () {

if (_consoleIndex < 0) {
return;
}

if (_consoleWidget == nullptr) {
return;
}

_consoleMode = "attached";

logsTabWidget->reattachTab(_consoleIndex);
}

void SeerGdbWidget::setConsoleMode (const QString& mode) {

_consoleMode = mode;
Expand Down
3 changes: 2 additions & 1 deletion src/SeerGdbWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm {
void readSettings ();

public slots:
void handleLogsTabMoved (int from, int to);
void handleLogsTabMoved (int to, int from);
void handleLogsTabChanged (int index);
void handleRaiseMessageTab ();

Expand Down Expand Up @@ -358,6 +358,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm {
void deleteConsole ();
void connectConsole ();
void disconnectConsole ();
void reattachConsole ();
SeerConsoleWidget* console ();
void sendGdbInterrupt (int signal);

Expand Down
5 changes: 4 additions & 1 deletion src/SeerMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,11 +1005,14 @@ void SeerMainWindow::handleText (const QString& text) {

return;

}else if (text == "^connected") {
//^connected
return;

}else if (text.startsWith("^connected,frame=")) {
//^connected,frame={level=\"0\",addr=\"0x00007f48351f80c1\",func=\"read\",args=[],from=\"/lib64/libc.so.6\",arch=\"i386:x86-64\"}"
return;


}else if (text.startsWith("*stopped")) {

QString reason_text = Seer::parseFirst(text, "reason=", '"', '"', false);
Expand Down
18 changes: 18 additions & 0 deletions tests/hellogdbserver/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Notes for debugging hellogdbserver with Seer.

In one terminal, start gdbserver.

$ gdbserver :1234 hellogdbserver

In another terminal, start Seer with the project file.

$ /usr/local/bin/seergdb -xxx -s --project project.seer


When exiting Seer, make sure to enter this command into the
gdb command field. Otherwise, the gdbserver process will hang
and you will need to 'kill -9' the gdbserver process.

(gdb) monitor exit


0 comments on commit d061885

Please sign in to comment.