RR: Finished the rework of using RR directly.

This commit is contained in:
Ernie Pasveer
2023-09-04 15:25:40 -05:00
parent 4f8897154a
commit b1c4a8ba86
8 changed files with 62 additions and 117 deletions
+4 -20
View File
@@ -65,7 +65,7 @@ SeerDebugDialog::SeerDebugDialog (QWidget* parent) : QDialog(parent) {
QObject::connect(executableWorkingDirectoryToolButton, &QToolButton::clicked, this, &SeerDebugDialog::handleExecutableWorkingDirectoryToolButton);
QObject::connect(loadBreakpointsFilenameToolButton, &QToolButton::clicked, this, &SeerDebugDialog::handleLoadBreakpointsFilenameToolButton);
QObject::connect(rrLoadTraceDirectoryToolButton, &QToolButton::clicked, this, &SeerDebugDialog::handleLoadRRTraceDirectoryToolButton);
QObject::connect(rrLoadBreakpointsFilenameToolButton, &QToolButton::clicked, this, &SeerDebugDialog::handleLoadRRBreakpointsFilenameToolButton);
QObject::connect(rrLoadBreakpointsFilenameToolButton, &QToolButton::clicked, this, &SeerDebugDialog::handleLoadBreakpointsFilenameToolButton);
QObject::connect(loadCoreFilenameToolButton, &QToolButton::clicked, this, &SeerDebugDialog::handleLoadCoreFilenameToolButton);
QObject::connect(breakpointInFunctionLineEdit, &QLineEdit::textChanged, this, &SeerDebugDialog::handleBreakpointInFunctionLineEdit);
QObject::connect(attachProgramPidToolButton, &QToolButton::clicked, this, &SeerDebugDialog::handleProgramPidToolButton);
@@ -138,6 +138,7 @@ QString SeerDebugDialog::executableArguments () const {
void SeerDebugDialog::setBreakpointsFilename (const QString& breakpointsFilename) {
loadBreakpointsFilenameLineEdit->setText(breakpointsFilename);
rrLoadBreakpointsFilenameLineEdit->setText(breakpointsFilename);
}
QString SeerDebugDialog::breakpointsFilename () const {
@@ -258,14 +259,6 @@ QString SeerDebugDialog::rrTraceDirectory () const {
return rrTraceDirectoryLineEdit->text();
}
void SeerDebugDialog::setRRBreakpointsFilename (const QString& breakpointsFilename) {
rrLoadBreakpointsFilenameLineEdit->setText(breakpointsFilename);
}
QString SeerDebugDialog::rrBreakpointsFilename () const {
return rrLoadBreakpointsFilenameLineEdit->text();
}
void SeerDebugDialog::setLaunchMode (const QString& mode) {
if (mode == "start") {
@@ -385,15 +378,6 @@ void SeerDebugDialog::handleExecutableWorkingDirectoryToolButton () {
}
}
void SeerDebugDialog::handleLoadBreakpointsFilenameToolButton () {
QString name = QFileDialog::getOpenFileName(this, "Select a breakpoints file to load.", breakpointsFilename(), "Breakpoints (*.seer);;All files (*.*)", nullptr, QFileDialog::DontUseNativeDialog);
if (name != "") {
setBreakpointsFilename(name);
}
}
void SeerDebugDialog::handleBreakpointInFunctionLineEdit () {
breakpointInFunctionRadioButton->setChecked(true);
@@ -408,12 +392,12 @@ void SeerDebugDialog::handleLoadRRTraceDirectoryToolButton () {
}
}
void SeerDebugDialog::handleLoadRRBreakpointsFilenameToolButton () {
void SeerDebugDialog::handleLoadBreakpointsFilenameToolButton () {
QString name = QFileDialog::getOpenFileName(this, "Select a breakpoints file to load.", breakpointsFilename(), "Breakpoints (*.seer);;All files (*.*)", nullptr, QFileDialog::DontUseNativeDialog);
if (name != "") {
setRRBreakpointsFilename(name);
setBreakpointsFilename(name);
}
}
-2
View File
@@ -56,7 +56,6 @@ class SeerDebugDialog : public QDialog, protected Ui::SeerDebugDialogForm {
// Connectect to a RR server. "rr".
void setRRTraceDirectory (const QString& rrTraceDirectory);
QString rrTraceDirectory () const;
void setRRBreakpointsFilename (const QString& breakpointsFilename);
QString rrBreakpointsFilename () const;
// Load a core file. "corefile".
@@ -79,7 +78,6 @@ class SeerDebugDialog : public QDialog, protected Ui::SeerDebugDialogForm {
void handleLoadBreakpointsFilenameToolButton ();
void handleBreakpointInFunctionLineEdit ();
void handleLoadRRTraceDirectoryToolButton ();
void handleLoadRRBreakpointsFilenameToolButton ();
void handleLoadCoreFilenameToolButton ();
void handleProgramPidToolButton ();
void handleLoadProjectToolButton ();
-53
View File
@@ -769,59 +769,6 @@
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QRadioButton" name="rrNoBreakpointRadioButton">
<property name="toolTip">
<string>No initial breakpoint.</string>
</property>
<property name="text">
<string>No breakpoint</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rrBreakpointInMainRadioButton">
<property name="toolTip">
<string>Set a breakpoint in &quot;main&quot;.</string>
</property>
<property name="text">
<string>Break in &quot;main&quot;</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rrBreakpointInFunctionRadioButton">
<property name="toolTip">
<string>Set a breakpoint in a function or at an address.</string>
</property>
<property name="text">
<string>Break in</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="rrBreakpointInFunctionLineEdit">
<property name="toolTip">
<string>The breakpoint function or address.</string>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>_function or 0xaddress</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
+1 -1
View File
@@ -1059,7 +1059,7 @@ void SeerGdbWidget::handleGdbAttachExecutable () {
handleGdbExecutableWorkingDirectory(); // Set the program's working directory before running.
handleGdbAssemblyDisassemblyFlavor(); // Set the disassembly flavor to use.
handleGdbAssemblySymbolDemangling(); // Set the symbol demangling.
//
if (assemblyShowAssemblyTabOnStartup()) {
editorManager()->showAssembly();
}
+16 -14
View File
@@ -2,15 +2,15 @@
### Introduction
This mode allows Seer to debug a local or remote RR replay session.
This mode allows Seer to debug a 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.
are made once when you run the program with 'rr record'. Seer can then load the recording (aka: trace-directory)
by running the 'rr replay -s' command.
Further information on RR is listed below in the references.
@@ -18,12 +18,17 @@ 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 symbol file if the recording doesn't have debug information
* A path to the directory containing the RR recording (aka: trace-directory)
* Optional gdb commands to execute before and after Seer connects to the RR replay session
See the RR config settings set the path to the RR program.
```
Settings -> Configure -> RR
```
### 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'.
In this mode, Seer will load the RR replay session by running 'rr replay'. 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
@@ -33,15 +38,12 @@ A typical debugging sequence would look like:
```
# Use RR to record all instructions for a program.
$ rr record -n hellosegv one two three
# The recording will be saved to 'hellosegv.rr'
$ rr record -n --output-trace-dir=hellosegv.rr 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
# Use Seer to debug this recording. Can be done as many times as you
# want without creating a new recording.
$ seergdb --rr hellosegv.rr
```
Now use Seer as you normally would. Use the Direction arrow in the main toolbar to change debugging directions.
+1 -3
View File
@@ -119,7 +119,6 @@ int main (int argc, char* argv[]) {
parser.process(app);
if (parser.isSet(helpOption)) {
//parser.showHelp();
seerhelp();
}
@@ -309,9 +308,8 @@ int main (int argc, char* argv[]) {
seer.launchExecutable(launchMode, breakMode);
//seer.move(800, 400);
seer.show();
//seer.activateWindow();
seer.activateWindow();
return app.exec();
}
+1
View File
@@ -1,2 +1,3 @@
hellorr
rr
*.seer
+39 -24
View File
@@ -4,32 +4,47 @@ Record a RR session.
https://github.com/rr-debugger/rr/wiki/Usage
$ export _RR_TRACE_DIR=/nas/erniep/Development/seer/tests/hellorr/rr
$ rr record -n hellorr
Replay the RR session in gdb.
Or...
$ export _RR_TRACE_DIR=/nas/erniep/Development/seer/tests/hellorr/rr
$ rr replay
Using RR in a gui debugger. Basically, attach to the rr server port.
https://github.com/rr-debugger/rr/wiki/Using-rr-in-an-IDE
$ export _RR_TRACE_DIR=/nas/erniep/Development/seer/tests/hellorr/rr
$ rr replay -s 50505 -k
$ 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/hellorr/hellorr
In a different terminal, use "RR" method in the Debug dialog and connect to "127.0.0.1:50505".
You may need to tell Seer to load the executable for the symbols.
$ export _RR_TRACE_DIR=/nas/erniep/Development/seer/tests/hellorr/rr
$ seergdb --rr localhost:50505 --sym hellorr
$ rr record -n --output-trace-dir=/path/to/rr/trace-directory hellorr arg1 arg2
Replay the RR session in Seer.
$ seergdb --rr /path/to/rr/trace-directory
THE FOLLOWING IS OLD!!
This method allowed Seer to connect to a RR debug server via a host:port.
I've deprecated this in favor of running 'rr replay' directly.
Replay the RR session in gdb.
$ export _RR_TRACE_DIR=/nas/erniep/Development/seer/tests/hellorr/rr
$ rr replay
Using RR in a gui debugger. Basically, attach to the rr server port.
https://github.com/rr-debugger/rr/wiki/Using-rr-in-an-IDE
$ export _RR_TRACE_DIR=/nas/erniep/Development/seer/tests/hellorr/rr
$ rr replay -s 50505 -k
$ 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/hellorr/hellorr
In a different terminal, use "RR" method in the Debug dialog and connect to "127.0.0.1:50505".
You may need to tell Seer to load the executable for the symbols.
$ export _RR_TRACE_DIR=/nas/erniep/Development/seer/tests/hellorr/rr
$ seergdb --rr localhost:50505 --sym hellorr