Add config to set gdb's architecture.

This commit is contained in:
Ernie Pasveer
2025-11-17 14:35:37 -06:00
parent 4e8f3549cb
commit 7ad9fb67c4
9 changed files with 121 additions and 22 deletions
+1
View File
@@ -14,6 +14,7 @@
* Breakpoints: Allow multiple filename:line entries for the --break-source option.
* Control: Add ^D to toggle record playback direction for RR, Undo, and gdb's Record.
* Control: Add SHIFT+F5 (etal) to reverse step (etc.) during record playback for RR, Undo, and gdb's Record.
* GDB: Add Seer config to set gdb architecture.
## [2.6] - 2025-10-07
* Watchpoints: Fixed regression when adding commands to a watchpoint.
+10
View File
@@ -244,6 +244,16 @@ QString SeerConfigDialog::gdbRemoteTargetType () const {
return _gdbConfigPage->gdbRemoteTargetType();
}
void SeerConfigDialog::setGdbArchitectureType (const QString& type) {
_gdbConfigPage->setGdbArchitectureType(type);
}
QString SeerConfigDialog::gdbArchitectureType () const {
return _gdbConfigPage->gdbArchitectureType();
}
void SeerConfigDialog::setEditorFont (const QFont& font) {
_editorConfigPage->setEditorFont(font);
+3
View File
@@ -68,6 +68,9 @@ class SeerConfigDialog : public QDialog, protected Ui::SeerConfigDialogForm {
void setGdbRemoteTargetType (const QString& type);
QString gdbRemoteTargetType () const;
void setGdbArchitectureType (const QString& type);
QString gdbArchitectureType () const;
// Editor settings.
void setEditorFont (const QFont& font);
const QFont& editorFont () const;
+16
View File
@@ -62,6 +62,15 @@ QString SeerGdbConfigPage::gdbRemoteTargetType () const {
return gdbRemoteTargetTypeCombo->currentText();
}
QString SeerGdbConfigPage::gdbArchitectureType () const {
QString type = gdbArchitectureLineEdit->text();
if (type == "") type = "auto";
return type;
}
void SeerGdbConfigPage::setGdbProgram (const QString& program) {
gdbProgramLineEdit->setText(program);
@@ -102,6 +111,11 @@ void SeerGdbConfigPage::setGdbRemoteTargetType (const QString& type) {
gdbRemoteTargetTypeCombo->setCurrentText(type);
}
void SeerGdbConfigPage::setGdbArchitectureType (const QString& type) {
gdbArchitectureLineEdit->setText(type);
}
void SeerGdbConfigPage::reset () {
setGdbProgram("/usr/bin/gdb");
@@ -111,6 +125,8 @@ void SeerGdbConfigPage::reset () {
setGdbHandleTerminatingException(true);
setGdbRandomizeStartAddress(false);
setGdbEnablePrettyPrinting(true);
setGdbRemoteTargetType("extended-remote");
setGdbArchitectureType("auto");
}
void SeerGdbConfigPage::handleGdbProgramToolButton () {
+2
View File
@@ -24,6 +24,7 @@ class SeerGdbConfigPage : public QWidget, protected Ui::SeerGdbConfigPage {
bool gdbRandomizeStartAddress () const;
bool gdbEnablePrettyPrinting () const;
QString gdbRemoteTargetType () const;
QString gdbArchitectureType () const;
void setGdbProgram (const QString& program);
@@ -34,6 +35,7 @@ class SeerGdbConfigPage : public QWidget, protected Ui::SeerGdbConfigPage {
void setGdbRandomizeStartAddress (bool flag);
void setGdbEnablePrettyPrinting (bool flag);
void setGdbRemoteTargetType (const QString& type);
void setGdbArchitectureType (const QString& type);
void reset ();
+49 -13
View File
@@ -19,7 +19,7 @@
<property name="title">
<string>Gdb Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="gdbProgramLabel">
<property name="text">
@@ -27,7 +27,7 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<item row="0" column="1">
<widget class="QLineEdit" name="gdbProgramLineEdit">
<property name="toolTip">
<string>Specify the path and name of the gdb debugger.</string>
@@ -37,7 +37,7 @@
</property>
</widget>
</item>
<item row="0" column="3">
<item row="0" column="2">
<widget class="QToolButton" name="gdbProgramToolButton">
<property name="toolTip">
<string>Open a file dialog to locate the gdb debugger.</string>
@@ -58,7 +58,7 @@
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<item row="1" column="1">
<widget class="QLineEdit" name="gdbArgumentsLineEdit">
<property name="toolTip">
<string>Arguments to pass to the gdb debugger.</string>
@@ -68,7 +68,7 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="gdbAsyncModeCheckBox">
@@ -122,16 +122,16 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<item row="3" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="gdbRemoteTargetTypeLabel">
<property name="text">
<string>Remote target type</string>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QComboBox" name="gdbRemoteTargetTypeCombo">
<property name="toolTip">
<string>Select the type of remote target connection.</string>
@@ -148,10 +148,8 @@
</item>
</widget>
</item>
</layout>
</item>
<item row="3" column="2" colspan="2">
<spacer name="horizontalSpacer">
<item row="0" column="2">
<spacer name="horizontalSpacer_1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -163,6 +161,38 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="gdbArchitectureTypeLabel">
<property name="text">
<string>Architecture type</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="gdbArchitectureLineEdit">
<property name="toolTip">
<string>Executable architecture type.</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>385</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
@@ -201,6 +231,12 @@ li.checked::marker { content: &quot;\2612&quot;; }
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Extended remote is generally suggested but may not be supported by all gdbserver programs. If you experience a slowness starting Seer, try &amp;quot;remote&amp;quot;.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The Architecture Type sets the target's architecture type. The value can be &amp;quot;auto&amp;quot;, in addition of one of the support architectures your version of gdb supports.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Run this command in gdb to see a full list of architectures supported by your version of gdb.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; (gdb) set architecture&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
+22
View File
@@ -756,6 +756,16 @@ QString SeerGdbWidget::gdbRemoteTargetType () const {
return _gdbRemoteTargetType;
}
void SeerGdbWidget::setGdbArchitectureType (const QString& type) {
_gdbArchitectureType = type;
}
QString SeerGdbWidget::gdbArchitectureType () const {
return _gdbArchitectureType;
}
void SeerGdbWidget::setGdbRecordMode(const QString& mode) {
if (mode == "auto") {
@@ -1115,6 +1125,7 @@ void SeerGdbWidget::handleGdbRunExecutable (const QString& breakMode, bool loadS
// Load the executable, if needed.
if (newExecutableFlag() == true) {
handleGdbSetArchitectureType();
handleGdbExecutablePreCommands(); // Run any 'pre' commands before program is loaded.
handleGdbExecutableName(); // Load the program into the gdb process.
handleGdbExecutableSources(); // Load the program source files.
@@ -1258,6 +1269,7 @@ void SeerGdbWidget::handleGdbAttachExecutable (bool loadSessionBreakpoints) {
// Load the executable, if needed.
if (newExecutableFlag() == true) {
handleGdbSetArchitectureType();
handleGdbExecutablePreCommands(); // Run any 'pre' commands before program is loaded.
handleGdbExecutableName(); // Load the program into the gdb process.
handleGdbExecutableSources(); // Load the program source files.
@@ -1376,6 +1388,7 @@ void SeerGdbWidget::handleGdbConnectExecutable (bool loadSessionBreakpoints) {
// Load the executable, if needed.
if (newExecutableFlag() == true) {
handleGdbSetArchitectureType();
handleGdbExecutableName(); // Load the program into the gdb process.
handleGdbExecutableSources(); // Load the program source files.
handleGdbExecutableLoadBreakpoints(); // Set the program's breakpoints (if any) before running.
@@ -1485,6 +1498,7 @@ void SeerGdbWidget::handleGdbRRExecutable (bool loadSessionBreakpoints) {
// Load the executable, if needed.
// For RR, this will start it.
if (newExecutableFlag() == true) {
handleGdbSetArchitectureType();
handleGdbExecutablePreCommands(); // Run any 'pre' commands before program is loaded.
handleGdbExecutableName(); // Load the program into the gdb process.
handleGdbExecutableSources(); // Load the program source files.
@@ -1604,6 +1618,7 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
reattachConsole();
if (newExecutableFlag() == true) {
handleGdbSetArchitectureType();
handleGdbExecutablePreCommands(); // Run any 'pre' commands before program is loaded.
handleGdbExecutableName(); // Load the program into the gdb process.
handleGdbExecutableSources(); // Load the program source files.
@@ -4149,6 +4164,13 @@ void SeerGdbWidget::handleGdbSourceScripts () {
qDebug() << "Done.";
}
void SeerGdbWidget::handleGdbSetArchitectureType () {
if (gdbArchitectureType() != "") {
handleGdbCommand(QString("set architecture ") + gdbArchitectureType());
}
}
QString SeerGdbWidget::assemblySymbolDemagling () const {
return _assemblySymbolDemangling;
+5
View File
@@ -112,6 +112,9 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm {
void setGdbRemoteTargetType (const QString& type);
QString gdbRemoteTargetType () const;
void setGdbArchitectureType (const QString& type);
QString gdbArchitectureType () const;
void setGdbRecordMode (const QString& mode);
QString gdbRecordMode () const;
@@ -376,6 +379,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm {
void handleGdbForkFollowMode (QString mode);
void handleGdbLoadMICommands ();
void handleGdbSourceScripts ();
void handleGdbSetArchitectureType ();
void handleGdbProcessFinished (int exitCode, QProcess::ExitStatus exitStatus);
void handleGdbProcessErrored (QProcess::ProcessError errorStatus);
@@ -429,6 +433,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm {
QString _gdbRecordMode;
QString _gdbRecordDirection;
QString _gdbRemoteTargetType;
QString _gdbArchitectureType;
bool _assemblyShowAssemblyTabOnStartup;
QString _assemblyDisassemblyFlavor;
QString _assemblySymbolDemangling;
+4
View File
@@ -741,6 +741,7 @@ void SeerMainWindow::handleSettingsConfiguration () {
dlg.setGdbRandomizeStartAddress(gdbWidget->gdbRandomizeStartAddress());
dlg.setGdbEnablePrettyPrinting(gdbWidget->gdbEnablePrettyPrinting());
dlg.setGdbRemoteTargetType(gdbWidget->gdbRemoteTargetType());
dlg.setGdbArchitectureType(gdbWidget->gdbArchitectureType());
dlg.setEditorFont(gdbWidget->editorManager()->editorFont());
dlg.setEditorTabSize(gdbWidget->editorManager()->editorTabSize());
dlg.setEditorHighlighterSettings(gdbWidget->editorManager()->editorHighlighterSettings());
@@ -785,6 +786,7 @@ void SeerMainWindow::handleSettingsConfiguration () {
gdbWidget->setGdbRandomizeStartAddress(dlg.gdbRandomizeStartAddress());
gdbWidget->setGdbEnablePrettyPrinting(dlg.gdbEnablePrettyPrinting());
gdbWidget->setGdbRemoteTargetType(dlg.gdbRemoteTargetType());
gdbWidget->setGdbArchitectureType(dlg.gdbArchitectureType());
gdbWidget->editorManager()->setEditorFont(dlg.editorFont());
gdbWidget->editorManager()->setEditorTabSize(dlg.editorTabSize());
gdbWidget->editorManager()->setEditorHighlighterSettings(dlg.editorHighlighterSettings());
@@ -1554,6 +1556,7 @@ void SeerMainWindow::writeConfigSettings () {
settings.setValue("randomizestartaddress", gdbWidget->gdbRandomizeStartAddress());
settings.setValue("enableprettyprinting", gdbWidget->gdbEnablePrettyPrinting());
settings.setValue("remotetargettype", gdbWidget->gdbRemoteTargetType());
settings.setValue("architecturetype", gdbWidget->gdbArchitectureType());
} settings.endGroup();
settings.beginGroup("rr"); {
@@ -1633,6 +1636,7 @@ void SeerMainWindow::readConfigSettings () {
gdbWidget->setGdbRandomizeStartAddress(settings.value("randomizestartaddress", false).toBool());
gdbWidget->setGdbEnablePrettyPrinting(settings.value("enableprettyprinting", true).toBool());
gdbWidget->setGdbRemoteTargetType(settings.value("remotetargettype", "extended-remote").toString());
gdbWidget->setGdbArchitectureType(settings.value("architecturetype", "auto").toString());
} settings.endGroup();
settings.beginGroup("rr"); {