rr: added support for RR.

This commit is contained in:
Ernie Pasveer
2023-04-16 13:26:12 -05:00
parent d5aa8f9089
commit 7222a04130
8 changed files with 101 additions and 26 deletions
+1
View File
@@ -3,6 +3,7 @@
## [1.17beta] - 2023-??-??
* Add a dialog when a breakpoint is reached.
* Add support for the RR debugger. (seergdb --rr host:port)
## [1.16] - 2023-04-07
* Add pid to main window and console title bars.
+2 -2
View File
@@ -776,8 +776,8 @@ void SeerDebugDialog::handleRunModeChanged (int id) {
if (id == 3) {
executableSymbolNameLineEdit->setEnabled(true);
executableSymbolNameToolButton->setEnabled(true);
preCommandsPlainTextEdit->setPlaceholderText("gdb commands before \"connect\"");
postCommandsPlainTextEdit->setPlaceholderText("gdb commands after \"connect\"");
preCommandsPlainTextEdit->setPlaceholderText("gdb commands before \"RR connect\"");
postCommandsPlainTextEdit->setPlaceholderText("gdb commands after \"RR connect\"");
}
// ID == 4 COREFILE
+20 -20
View File
@@ -207,7 +207,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>3</number>
<number>2</number>
</property>
<widget class="QWidget" name="runTab">
<property name="sizePolicy">
@@ -588,7 +588,20 @@
</item>
</layout>
</item>
<item row="1" column="0">
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="connectProgramHostPortLabel">
@@ -606,7 +619,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>How to access the remote gdbserver.</string>
<string>How to access the gdbserver.</string>
</property>
<property name="text">
<string/>
@@ -621,19 +634,6 @@
</item>
</layout>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@@ -650,7 +650,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Connect to a RR replay server.</string>
<string>Connect to a RR replay session.</string>
</property>
</widget>
</item>
@@ -670,7 +670,7 @@
<item>
<widget class="QToolButton" name="helpRRToolButton">
<property name="toolTip">
<string>Help for Connect launch method.</string>
<string>Help for RR launch method.</string>
</property>
<property name="text">
<string>...</string>
@@ -688,7 +688,7 @@
<item>
<widget class="QLabel" name="rrHostPortLabel">
<property name="text">
<string>RR replay server</string>
<string>RR replay session</string>
</property>
</widget>
</item>
@@ -701,7 +701,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>How to access the remote gdbserver.</string>
<string>How to access the RR session.</string>
</property>
<property name="text">
<string/>
+16 -3
View File
@@ -58,7 +58,7 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
_gdbHandleTerminatingException = true;
_gdbRandomizeStartAddress = false;
_gdbEnablePrettyPrinting = true;
_gdbRecordMode = "stop";
_gdbRecordMode = "";
_gdbRecordDirection = "";
_consoleMode = "";
_consoleScrollLines = 1000;
@@ -551,7 +551,9 @@ void SeerGdbWidget::setGdbRecordMode(const QString& mode) {
_gdbRecordMode = mode;
handleGdbCommand("record " + gdbRecordMode());
if (mode != "rr" && mode != "") {
handleGdbCommand("record " + gdbRecordMode());
}
emit recordSettingsChanged();
}
@@ -862,6 +864,7 @@ void SeerGdbWidget::handleGdbRunExecutable (const QString& breakMode) {
connectConsole();
setExecutableLaunchMode("run");
setGdbRecordMode("");
setExecutablePid(0);
// Load ithe executable, if needed.
@@ -978,6 +981,7 @@ void SeerGdbWidget::handleGdbAttachExecutable () {
// No console for 'attach' mode.
setExecutableLaunchMode("attach");
setGdbRecordMode("");
// Load ithe executable, if needed.
if (newExecutableFlag() == true) {
@@ -1046,6 +1050,7 @@ void SeerGdbWidget::handleGdbConnectExecutable () {
// No console for 'connect' mode.
setExecutableLaunchMode("connect");
setGdbRecordMode("");
setExecutablePid(0);
// Connect to the remote gdbserver.
@@ -1115,6 +1120,7 @@ void SeerGdbWidget::handleGdbRRExecutable () {
// No console for 'connect' mode.
setExecutableLaunchMode("rr");
setGdbRecordMode("rr");
setExecutablePid(0);
// Connect to the remote gdbserver.
@@ -1200,6 +1206,7 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
// No console for 'core' mode.
setExecutableLaunchMode("corefile");
setGdbRecordMode("");
setExecutablePid(0);
if (newExecutableFlag() == true) {
@@ -1236,6 +1243,7 @@ void SeerGdbWidget::handleGdbShutdown () {
// We are in no mode now.
setExecutableLaunchMode("");
setGdbRecordMode("");
// Give the gdb and 'exit' command.
// This should handle detaching from an attached pid.
@@ -1363,7 +1371,7 @@ void SeerGdbWidget::handleGdbRecordReverse () {
void SeerGdbWidget::handleGdbRecordStartStopToggle () {
if (gdbRecordMode() == "stop") {
if (gdbRecordMode() == "stop" || gdbRecordMode() == "") {
setGdbRecordMode("full");
setGdbRecordDirection("");
@@ -1373,6 +1381,10 @@ void SeerGdbWidget::handleGdbRecordStartStopToggle () {
setGdbRecordMode("stop");
setGdbRecordDirection("");
}else if (gdbRecordMode() == "rr") {
// Don't do anthing.
}else{
setGdbRecordMode("stop");
@@ -2840,6 +2852,7 @@ void SeerGdbWidget::killGdb () {
// Clear the launch mode.
setExecutableLaunchMode("");
setGdbRecordMode("");
// Kill the process.
_gdbProcess->kill();
+4 -1
View File
@@ -856,6 +856,9 @@ void SeerMainWindow::handleText (const QString& text) {
}else if (text.startsWith("^done,asm_insns=[")) {
return;
}else if (text.startsWith("^done,ada-exceptions={") && text.endsWith("}")) {
return;
}else if (text.contains(QRegExp("^([0-9]+)\\^done"))) {
return;
@@ -1084,7 +1087,7 @@ void SeerMainWindow::handleRecordSettingsChanged () {
// Toolbar
actionRecordProcess->setText("RR");
actionRecordProcess->setEnabled(false);
actionRecordProcess->setEnabled(true);
actionRecordDirection->setEnabled(true);
}else{
+1
View File
@@ -66,6 +66,7 @@
<file>resources/help/RunDebugMode.md</file>
<file>resources/help/AttachDebugMode.md</file>
<file>resources/help/ConnectDebugMode.md</file>
<file>resources/help/RRDebugMode.md</file>
<file>resources/help/CorefileDebugMode.md</file>
</qresource>
</RCC>
+1
View File
@@ -6,6 +6,7 @@ Seer supports most debugging modes that gdb provides. These are:
* Starting and running a program
* Attaching to a local process on the system
* Connecting to a gdbserver
* Connecting to a RR replay session
* Loading a corefile leftover from a program that crashed
### What can you do?
+56
View File
@@ -0,0 +1,56 @@
## RR debug mode
### Introduction
This mode allows Seer to debug a local or remote RR replay session.
RR allows time-travel debugging. In that, you can step forward or backwards in the execution of program
being debugged.
gdb has its own notion of time-travel debugging. However, it differs from RR's method. With gdb, the
record of instructions is recorded as you are debugging the program. With RR, the record of instructions
are made once when you run the program with 'rr record'. Seer/gdb can then connect to the recordings
via the 'rr replay -s' command.
Further information on RR is listed below in the references.
### Requirements
In this mode, Seer needs:
* Optional symbol file if the executable doesn't have debug information
* How to look for the RR replay session (machine and port)
* Optional gdb commands to execute before and after Seer connects to the RR replay session
### What can you do?
In this mode, Seer will connect to the RR replay session via its host:port. The program will be stopped befor 'main'.
At this point you can set breakpoints and tell Seer to 'continue' or any typical debugging command.
Seer will show a 'Direction' arrow on the toolbar. This will set the debugging direction to forward or reverse. And
affects all commands like: 'step', 'next', 'finish', etc.
A typical debugging sequence would look like:
```
# Use RR to record all instructions for a program.
$ rr record -n hellosegv one two three
# Use RR to start a replay session on the previously create instructions. Pick a free port.
$ rr replay -s 50505 -k
Launch gdb with
gdb '-l' '10000' '-ex' 'set sysroot /' '-ex' 'target extended-remote 127.0.0.1:50505' /nas/erniep/Development/seer/tests/hellosegv/hellosegv
# In a separate terminal, use Seer to connect to that replay session port.
$ seergdb --rr localhost:50505
```
Now use Seer as you normally would. Use the Direction arrow in the main toolbar to change debugging directions.
### References
Check references for RR and gdb.
* [RR website](https://rr-project.org)
* [RR github](https://github.com/rr-debugger/rr/wiki/Usage)
* [gdb's record mode](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Process-Record-and-Replay.html#index-record-mode)