diff --git a/src/SeerConfigDialog.cpp b/src/SeerConfigDialog.cpp index 6f0f2d9..b8fb621 100644 --- a/src/SeerConfigDialog.cpp +++ b/src/SeerConfigDialog.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,21 @@ SeerConfigDialog::SeerConfigDialog(QWidget* parent) : QDialog(parent) { contentsListWidget->setMaximumWidth(128); contentsListWidget->setSpacing(12); + QPushButton* resetButton = buttonBox->button(QDialogButtonBox::Reset); + if (resetButton) { + resetButton->setToolTip("Reset configuration for the current page to initial settings."); + } + + QPushButton* okButton = buttonBox->button(QDialogButtonBox::Ok); + if (okButton) { + okButton->setToolTip("Accept configuration changes to all pages."); + } + + QPushButton* cancelButton = buttonBox->button(QDialogButtonBox::Cancel); + if (cancelButton) { + cancelButton->setToolTip("Discard configuration changes to all pages."); + } + // Create pages. _gdbConfigPage = new SeerGdbConfigPage; _editorConfigPage = new SeerEditorConfigPage; @@ -133,6 +149,15 @@ bool SeerConfigDialog::gdbRandomizeStartAddress () const { return _gdbConfigPage->gdbRandomizeStartAddress(); } +void SeerConfigDialog::setGdbEnablePrettyPrinting (bool flag) { + + _gdbConfigPage->setGdbEnablePrettyPrinting(flag); +} + +bool SeerConfigDialog::gdbEnablePrettyPrinting () const { + + return _gdbConfigPage->gdbEnablePrettyPrinting(); +} void SeerConfigDialog::setDprintfStyle (const QString& style) { diff --git a/src/SeerConfigDialog.h b/src/SeerConfigDialog.h index e55a23e..a72f3a0 100644 --- a/src/SeerConfigDialog.h +++ b/src/SeerConfigDialog.h @@ -38,6 +38,9 @@ class SeerConfigDialog : public QDialog, protected Ui::SeerConfigDialogForm { void setGdbRandomizeStartAddress (bool flag); bool gdbRandomizeStartAddress () const; + void setGdbEnablePrettyPrinting (bool flag); + bool gdbEnablePrettyPrinting () const; + void setDprintfStyle (const QString& style); QString dprintfStyle () const; diff --git a/src/SeerGdbConfigPage.cpp b/src/SeerGdbConfigPage.cpp index 52eca3f..263df3c 100644 --- a/src/SeerGdbConfigPage.cpp +++ b/src/SeerGdbConfigPage.cpp @@ -49,6 +49,11 @@ bool SeerGdbConfigPage::gdbRandomizeStartAddress () const { return gdbRandomizeStartAddressCheckBox->isChecked(); } +bool SeerGdbConfigPage::gdbEnablePrettyPrinting () const { + + return gdbEnablePrettyPrintingCheckBox->isChecked(); +} + void SeerGdbConfigPage::setGdbProgram (const QString& program) { gdbProgramLineEdit->setText(program); @@ -74,6 +79,11 @@ void SeerGdbConfigPage::setGdbRandomizeStartAddress (bool flag) { gdbRandomizeStartAddressCheckBox->setChecked(flag); } +void SeerGdbConfigPage::setGdbEnablePrettyPrinting (bool flag) { + + gdbEnablePrettyPrintingCheckBox->setChecked(flag); +} + QString SeerGdbConfigPage::dprintfStyle () const { if (styleGdbRadioButton->isChecked()) { @@ -128,6 +138,7 @@ void SeerGdbConfigPage::reset () { setGdbAsyncMode(true); setGdbHandleTerminatingException(true); setGdbRandomizeStartAddress(false); + setGdbEnablePrettyPrinting(true); setDprintfStyle("gdb"); setDprintfFunction("printf"); diff --git a/src/SeerGdbConfigPage.h b/src/SeerGdbConfigPage.h index 276b4b6..dddbd08 100644 --- a/src/SeerGdbConfigPage.h +++ b/src/SeerGdbConfigPage.h @@ -17,12 +17,14 @@ class SeerGdbConfigPage : public QWidget, protected Ui::SeerGdbConfigPage { bool gdbAsyncMode () const; bool gdbHandleTerminatingException () const; bool gdbRandomizeStartAddress () const; + bool gdbEnablePrettyPrinting () const; void setGdbProgram (const QString& program); void setGdbArguments (const QString& arguments); void setGdbAsyncMode (bool flag); void setGdbHandleTerminatingException (bool flag); void setGdbRandomizeStartAddress (bool flag); + void setGdbEnablePrettyPrinting (bool flag); QString dprintfStyle () const; QString dprintfFunction () const; diff --git a/src/SeerGdbConfigPage.ui b/src/SeerGdbConfigPage.ui index 1342e8c..1d66754 100644 --- a/src/SeerGdbConfigPage.ui +++ b/src/SeerGdbConfigPage.ui @@ -26,10 +26,23 @@ Gdb Settings - - + + - Specify the path and name of the gdb debugger. + Randomize the process start address. + + + Randomize start address + + + + + + + Handle terminating exceptions when calling functions. + + + Handle terminating-exception @@ -47,6 +60,20 @@ + + + + Open a file dialog to locate the gdb debugger. + + + + + + + :/seer/resources/RelaxLightIcons/document-open.svg:/seer/resources/RelaxLightIcons/document-open.svg + + + @@ -64,37 +91,20 @@ - - + + - Handle terminating exceptions when calling functions. - - - Handle terminating-exception + Specify the path and name of the gdb debugger. - - + + - Open a file dialog to locate the gdb debugger. + Show variables with gdb's 'pretty-printing' system. - - - - - :/seer/resources/RelaxLightIcons/document-open.svg:/seer/resources/RelaxLightIcons/document-open.svg - - - - - - - Randomize the process start address. - - - Randomize start address + Enable pretty-printing @@ -225,6 +235,9 @@ + + Show variables with gdb's 'pretty-print' system. + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -242,6 +255,8 @@ p, li { white-space: pre-wrap; } <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The gdb debugger normally starts the process at the same address each time. The process start address can be randomized.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Enabling pretty-printing allows gdb to present certain variables (like std::string) in a pleasing way. Otherwise, the contents of the variables are presented in their full description. (See gdb 'pretty-printing'). Once enabled, it can not be turned off for the Seer session.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Printpoints use the 'dprintf' command available in gdb. The output of 'dprintf' can be sent to the Seer Console ('call') or the GDB output tab ('gdb'). A value of 'agent' is meant for use with a gdbserver.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">'Function' specifies what function to use when the style is 'call'. Typically it is 'printf'. Your program must provide the function. Most programs have 'printf' linked in. </p> diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 6cc76b0..b6625ae 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -52,6 +52,7 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { _assemblyDisassemblyFlavor = "att"; _gdbHandleTerminatingException = true; _gdbRandomizeStartAddress = false; + _gdbEnablePrettyPrinting = true; _consoleMode = ""; _consoleScrollLines = 1000; _rememberManualCommandCount = 10; @@ -437,6 +438,16 @@ bool SeerGdbWidget::gdbRandomizeStartAddress () const { return _gdbRandomizeStartAddress; } +void SeerGdbWidget::setGdbEnablePrettyPrinting (bool flag) { + + _gdbEnablePrettyPrinting = flag; +} + +bool SeerGdbWidget::gdbEnablePrettyPrinting () const { + + return _gdbEnablePrettyPrinting; +} + void SeerGdbWidget::setDprintfStyle (const QString& style) { _dprintfStyle = style; @@ -664,6 +675,10 @@ void SeerGdbWidget::handleGdbRunExecutable (const QString& breakMode) { handleGdbCommand("-gdb-set disable-randomization on"); // Turn on randomization of starting address for process. } + if (gdbEnablePrettyPrinting()) { + handleGdbCommand("-enable-pretty-printing"); // Turn on pretty-printing. Can not be turned off. + } + // Set the program's arguments before running. handleGdbExecutableArguments(); diff --git a/src/SeerGdbWidget.h b/src/SeerGdbWidget.h index 992ec9f..3ee7ba7 100644 --- a/src/SeerGdbWidget.h +++ b/src/SeerGdbWidget.h @@ -79,6 +79,10 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { void setGdbRandomizeStartAddress (bool flag); bool gdbRandomizeStartAddress () const; + void setGdbEnablePrettyPrinting (bool flag); + bool gdbEnablePrettyPrinting () const; + + void setDprintfStyle (const QString& style); QString dprintfStyle () const; @@ -255,6 +259,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { bool _gdbASyncMode; bool _gdbHandleTerminatingException; bool _gdbRandomizeStartAddress; + bool _gdbEnablePrettyPrinting; QString _dprintfStyle; QString _dprintfFunction; QString _dprintfChannel; diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index 3a9030d..40d28d8 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -440,6 +440,7 @@ void SeerMainWindow::handleSettingsConfiguration () { dlg.setGdbAsyncMode(gdbWidget->gdbAsyncMode()); dlg.setGdbHandleTerminatingException(gdbWidget->gdbHandleTerminatingException()); dlg.setGdbRandomizeStartAddress(gdbWidget->gdbRandomizeStartAddress()); + dlg.setGdbEnablePrettyPrinting(gdbWidget->gdbEnablePrettyPrinting()); dlg.setDprintfStyle(gdbWidget->dprintfStyle()); dlg.setDprintfFunction(gdbWidget->dprintfFunction()); dlg.setDprintfChannel(gdbWidget->dprintfChannel()); @@ -469,6 +470,7 @@ void SeerMainWindow::handleSettingsConfiguration () { gdbWidget->setGdbAsyncMode(dlg.gdbAsyncMode()); gdbWidget->setGdbHandleTerminatingException(dlg.gdbHandleTerminatingException()); gdbWidget->setGdbRandomizeStartAddress(dlg.gdbRandomizeStartAddress()); + gdbWidget->setGdbEnablePrettyPrinting(dlg.gdbEnablePrettyPrinting()); gdbWidget->setDprintfStyle(dlg.dprintfStyle()); gdbWidget->setDprintfFunction(dlg.dprintfFunction()); gdbWidget->setDprintfChannel(dlg.dprintfChannel()); @@ -830,6 +832,7 @@ void SeerMainWindow::writeConfigSettings () { settings.setValue("asyncmode", gdbWidget->gdbAsyncMode()); settings.setValue("handleterminatingexception", gdbWidget->gdbHandleTerminatingException()); settings.setValue("randomizestartaddress", gdbWidget->gdbRandomizeStartAddress()); + settings.setValue("enableprettyprinting", gdbWidget->gdbEnablePrettyPrinting()); } settings.endGroup(); settings.beginGroup("printpoints"); { @@ -895,6 +898,7 @@ void SeerMainWindow::readConfigSettings () { gdbWidget->setGdbAsyncMode(settings.value("asyncmode", true).toBool()); gdbWidget->setGdbHandleTerminatingException(settings.value("handleterminatingexception", true).toBool()); gdbWidget->setGdbRandomizeStartAddress(settings.value("randomizestartaddress", false).toBool()); + gdbWidget->setGdbEnablePrettyPrinting(settings.value("enableprettyprinting", true).toBool()); } settings.endGroup(); settings.beginGroup("printpoints"); {