Finished with this task. Still doesn't fix RR, though.

This commit is contained in:
Ernie Pasveer
2025-09-13 13:19:21 -05:00
parent 8f1f74878b
commit 39f8f9ee5a
2 changed files with 45 additions and 16 deletions
+44 -16
View File
@@ -111,7 +111,8 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
logsTabWidget->addTab(_seerOutputLog, "Seer output"); logsTabWidget->addTab(_seerOutputLog, "Seer output");
logsTabWidget->setCurrentIndex(0); logsTabWidget->setCurrentIndex(0);
// Create the console. // Create the console tab.
// Each RUN method will create and connect to the console's terminal.
createConsole(); createConsole();
// Create editor options bar. // Create editor options bar.
@@ -1059,15 +1060,19 @@ void SeerGdbWidget::handleGdbRunExecutable (const QString& breakMode, bool loadS
// This causes a new gdb each time. The same console, though. // This causes a new gdb each time. The same console, though.
setNewExecutableFlag(true); setNewExecutableFlag(true);
// Disconnect from the console and delete the old gdb if there is a new executable. // Delete the old gdb if there is a new executable.
if (newExecutableFlag() == true) { if (newExecutableFlag() == true) {
console()->deleteTerminal();
killGdb(); killGdb();
} }
// If gdb isn't running, start it. // If gdb isn't running, start it.
if (isGdbRuning() == false) { if (isGdbRuning() == false) {
// Connect the terminal to the console.
console()->resetTerminal();
console()->connectTerminal();
// Start gdb.
bool f = startGdb(); bool f = startGdb();
if (f == false) { if (f == false) {
QMessageBox::critical(this, tr("Error"), tr("Can't start gdb.")); QMessageBox::critical(this, tr("Error"), tr("Can't start gdb."));
@@ -1090,8 +1095,6 @@ void SeerGdbWidget::handleGdbRunExecutable (const QString& breakMode, bool loadS
} }
// Set the program's tty device for stdin and stdout. // Set the program's tty device for stdin and stdout.
console()->createTerminal();
console()->connectTerminal();
handleGdbTerminalDeviceName(); handleGdbTerminalDeviceName();
setExecutableLaunchMode("run"); setExecutableLaunchMode("run");
@@ -1200,9 +1203,8 @@ void SeerGdbWidget::handleGdbAttachExecutable (bool loadSessionBreakpoints) {
// This causes a new gdb each time. The same console, though. // This causes a new gdb each time. The same console, though.
setNewExecutableFlag(true); setNewExecutableFlag(true);
// Disconnect from the console and delete the old gdb if there is a new executable. // Delete the old gdb if there is a new executable.
if (newExecutableFlag() == true) { if (newExecutableFlag() == true) {
console()->deleteTerminal();
killGdb(); killGdb();
} }
@@ -1210,6 +1212,11 @@ void SeerGdbWidget::handleGdbAttachExecutable (bool loadSessionBreakpoints) {
// No need to connect to the console in this mode. // No need to connect to the console in this mode.
if (isGdbRuning() == false) { if (isGdbRuning() == false) {
// Connect the terminal to the console.
console()->resetTerminal();
console()->connectTerminal();
// Start gdb.
bool f = startGdb(); bool f = startGdb();
if (f == false) { if (f == false) {
QMessageBox::critical(this, tr("Error"), tr("Can't start gdb.")); QMessageBox::critical(this, tr("Error"), tr("Can't start gdb."));
@@ -1224,6 +1231,10 @@ void SeerGdbWidget::handleGdbAttachExecutable (bool loadSessionBreakpoints) {
handleGdbSourceScripts(); handleGdbSourceScripts();
} }
// Set the program's tty device for stdin and stdout.
// Not really needed for 'attach' mode, but do it anyway.
handleGdbTerminalDeviceName();
// No console for 'attach' mode but make sure it's reattached. // No console for 'attach' mode but make sure it's reattached.
setExecutableLaunchMode("attach"); setExecutableLaunchMode("attach");
saveLaunchMode(); saveLaunchMode();
@@ -1295,14 +1306,17 @@ void SeerGdbWidget::handleGdbConnectExecutable (bool loadSessionBreakpoints) {
// Disconnect from the terminal and delete the old gdb if there is a new executable. // Disconnect from the terminal and delete the old gdb if there is a new executable.
if (newExecutableFlag() == true) { if (newExecutableFlag() == true) {
console()->deleteTerminal();
killGdb(); killGdb();
} }
// If gdb isn't running, start it. // If gdb isn't running, start it.
// No need to connect to the console in this mode.
if (isGdbRuning() == false) { if (isGdbRuning() == false) {
// Connect the terminal to the console.
console()->resetTerminal();
console()->connectTerminal();
// Start gdb.
bool f = startGdb(); bool f = startGdb();
if (f == false) { if (f == false) {
QMessageBox::critical(this, tr("Error"), tr("Can't start gdb.")); QMessageBox::critical(this, tr("Error"), tr("Can't start gdb."));
@@ -1313,6 +1327,10 @@ void SeerGdbWidget::handleGdbConnectExecutable (bool loadSessionBreakpoints) {
handleGdbSourceScripts(); handleGdbSourceScripts();
} }
// Set the program's tty device for stdin and stdout.
// Not really needed for 'connect' mode, but do it anyway.
handleGdbTerminalDeviceName();
// No console for 'connect' mode but make sure it's reattached. // No console for 'connect' mode but make sure it's reattached.
setExecutableLaunchMode("connect"); setExecutableLaunchMode("connect");
saveLaunchMode(); saveLaunchMode();
@@ -1327,7 +1345,7 @@ void SeerGdbWidget::handleGdbConnectExecutable (bool loadSessionBreakpoints) {
}else{ }else{
handleGdbCommand("-gdb-set debug remote 0"); handleGdbCommand("-gdb-set debug remote 0");
} }
handleGdbExecutablePreCommands(); // Run any 'pre' commands before program is loaded. handleGdbExecutablePreCommands(); // Run any 'pre' commands before program is loaded.
} }
// Connect to the remote gdbserver using the proper remote type. // Connect to the remote gdbserver using the proper remote type.
@@ -1402,13 +1420,17 @@ void SeerGdbWidget::handleGdbRRExecutable (bool loadSessionBreakpoints) {
// Disconnect from the console and delete the old gdb, then reconnect. // Disconnect from the console and delete the old gdb, then reconnect.
if (newExecutableFlag() == true) { if (newExecutableFlag() == true) {
console()->deleteTerminal();
killGdb(); killGdb();
} }
// If gdb isn't running, start it. // If gdb isn't running, start it.
if (isGdbRuning() == false) { if (isGdbRuning() == false) {
// Connect the terminal to the console.
console()->resetTerminal();
console()->connectTerminal();
// Start gdb.
bool f = startGdbRR(); bool f = startGdbRR();
if (f == false) { if (f == false) {
QMessageBox::critical(this, tr("Error"), tr("Can't start gdb.")); QMessageBox::critical(this, tr("Error"), tr("Can't start gdb."));
@@ -1417,8 +1439,6 @@ void SeerGdbWidget::handleGdbRRExecutable (bool loadSessionBreakpoints) {
} }
// Set the program's tty device for stdin and stdout. // Set the program's tty device for stdin and stdout.
console()->createTerminal();
console()->connectTerminal();
handleGdbTerminalDeviceName(); handleGdbTerminalDeviceName();
// Set the launch mode. // Set the launch mode.
@@ -1512,7 +1532,6 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
// Disconnect from the console and delete the old gdb. No need to reconnect. // Disconnect from the console and delete the old gdb. No need to reconnect.
if (newExecutableFlag() == true) { if (newExecutableFlag() == true) {
console()->deleteTerminal();
killGdb(); killGdb();
} }
@@ -1520,6 +1539,11 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
// No need to connect to the console in this mode. // No need to connect to the console in this mode.
if (isGdbRuning() == false) { if (isGdbRuning() == false) {
// Connect the terminal to the console.
console()->resetTerminal();
console()->connectTerminal();
// Start gdb.
bool f = startGdb(); bool f = startGdb();
if (f == false) { if (f == false) {
QMessageBox::critical(this, tr("Error"), tr("Can't start gdb.")); QMessageBox::critical(this, tr("Error"), tr("Can't start gdb."));
@@ -1534,6 +1558,10 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
handleGdbSourceScripts(); handleGdbSourceScripts();
} }
// Set the program's tty device for stdin and stdout.
// Not really needed for 'core' mode, but do it anyway.
handleGdbTerminalDeviceName();
// No console for 'core' mode but make sure it's reattached. // No console for 'core' mode but make sure it's reattached.
setExecutableLaunchMode("corefile"); setExecutableLaunchMode("corefile");
saveLaunchMode(); saveLaunchMode();
@@ -1561,7 +1589,7 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
// Run any 'post' commands after program is loaded. // Run any 'post' commands after program is loaded.
handleGdbExecutablePostCommands(); handleGdbExecutablePostCommands();
// This is needed for code mode to refresh the stack frame, for some reason. // This is needed for 'core' mode to refresh the stack frame, for some reason.
handleGdbStackListFrames(); handleGdbStackListFrames();
// Set window titles with name of program. // Set window titles with name of program.
@@ -2100,7 +2128,7 @@ void SeerGdbWidget::handleGdbTerminalDeviceName () {
if (_consoleWidget->terminalDeviceName() != "") { if (_consoleWidget->terminalDeviceName() != "") {
handleGdbCommand(QString("-inferior-tty-set ") + _consoleWidget->terminalDeviceName()); handleGdbCommand(QString("-inferior-tty-set ") + _consoleWidget->terminalDeviceName());
}else{ }else{
qWarning() << "Can't set TTY name because the name is blank."; qWarning() << "Can't set TTY name because the name is blank.";
+1
View File
@@ -9,6 +9,7 @@ Record a RR session.
Or... Or...
$ rr record -n --output-trace-dir=/path/to/rr/trace-directory hellorr arg1 arg2 $ rr record -n --output-trace-dir=/path/to/rr/trace-directory hellorr arg1 arg2
$ rr record -n --output-trace-dir=`pwd`/rr hellorr one two three
Replay the RR session in Seer. Replay the RR session in Seer.