diff --git a/src/SeerConfigDialog.cpp b/src/SeerConfigDialog.cpp index aa4521e..a20adf8 100644 --- a/src/SeerConfigDialog.cpp +++ b/src/SeerConfigDialog.cpp @@ -230,36 +230,6 @@ bool SeerConfigDialog::gdbEnablePrettyPrinting () const { return _gdbConfigPage->gdbEnablePrettyPrinting(); } -void SeerConfigDialog::setDprintfStyle (const QString& style) { - - _gdbConfigPage->setDprintfStyle(style); -} - -QString SeerConfigDialog::dprintfStyle () const { - - return _gdbConfigPage->dprintfStyle(); -} - -void SeerConfigDialog::setDprintfFunction (const QString& function) { - - _gdbConfigPage->setDprintfFunction(function); -} - -QString SeerConfigDialog::dprintfFunction () const { - - return _gdbConfigPage->dprintfFunction(); -} - -void SeerConfigDialog::setDprintfChannel (const QString& channel) { - - _gdbConfigPage->setDprintfChannel(channel); -} - -QString SeerConfigDialog::dprintfChannel () const { - - return _gdbConfigPage->dprintfChannel(); -} - void SeerConfigDialog::setEditorFont (const QFont& font) { _editorConfigPage->setEditorFont(font); diff --git a/src/SeerConfigDialog.h b/src/SeerConfigDialog.h index 22b5a20..75911de 100644 --- a/src/SeerConfigDialog.h +++ b/src/SeerConfigDialog.h @@ -61,15 +61,6 @@ class SeerConfigDialog : public QDialog, protected Ui::SeerConfigDialogForm { void setGdbEnablePrettyPrinting (bool flag); bool gdbEnablePrettyPrinting () const; - void setDprintfStyle (const QString& style); - QString dprintfStyle () const; - - void setDprintfFunction (const QString& function); - QString dprintfFunction () const; - - void setDprintfChannel (const QString& channel); - QString dprintfChannel () const; - // Editor settings. void setEditorFont (const QFont& font); const QFont& editorFont () const; diff --git a/src/SeerEditorManagerWidget.cpp b/src/SeerEditorManagerWidget.cpp index 457677f..14a0b43 100644 --- a/src/SeerEditorManagerWidget.cpp +++ b/src/SeerEditorManagerWidget.cpp @@ -1179,10 +1179,10 @@ void SeerEditorManagerWidget::handleInsertBreakpoint (QString breakpoint) { emit insertBreakpoint (breakpoint); } -void SeerEditorManagerWidget::handleInsertPrintpoint (QString printpoint) { +void SeerEditorManagerWidget::handleInsertPrintpoint (QString type, QString function, QString channel, QString parameters) { // rethrow - emit insertPrintpoint (printpoint); + emit insertPrintpoint (type, function, channel, parameters); } void SeerEditorManagerWidget::handleDeleteBreakpoints (QString breakpoints) { diff --git a/src/SeerEditorManagerWidget.h b/src/SeerEditorManagerWidget.h index 0ae1959..b02dca5 100644 --- a/src/SeerEditorManagerWidget.h +++ b/src/SeerEditorManagerWidget.h @@ -71,7 +71,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW void handleOpenFile (const QString& file, const QString& fullname, int lineno); void handleOpenAddress (const QString& address); void handleInsertBreakpoint (QString breakpoint); - void handleInsertPrintpoint (QString printpoint); + void handleInsertPrintpoint (QString type, QString function, QString channel, QString parameters); void handleDeleteBreakpoints (QString breakpoints); void handleEnableBreakpoints (QString breakpoints); void handleDisableBreakpoints (QString breakpoints); @@ -101,7 +101,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW void refreshBreakpointsList (); void refreshStackFrames (); void insertBreakpoint (QString breakpoint); - void insertPrintpoint (QString printpoint); + void insertPrintpoint (QString type, QString function, QString channel, QString parameters); void deleteBreakpoints (QString breakpoints); void enableBreakpoints (QString breakpoints); void disableBreakpoints (QString breakpoints); diff --git a/src/SeerEditorWidgetSource.h b/src/SeerEditorWidgetSource.h index c029247..4e1fae5 100644 --- a/src/SeerEditorWidgetSource.h +++ b/src/SeerEditorWidgetSource.h @@ -102,7 +102,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit { signals: void insertBreakpoint (QString breakpoint); - void insertPrintpoint (QString printpoint); + void insertPrintpoint (QString type, QString function, QString channel, QString parameters); void deleteBreakpoints (QString breakpoints); void enableBreakpoints (QString breakpoints); void disableBreakpoints (QString breakpoints); diff --git a/src/SeerEditorWidgetSourceAreas.cpp b/src/SeerEditorWidgetSourceAreas.cpp index 71b659b..994d743 100644 --- a/src/SeerEditorWidgetSourceAreas.cpp +++ b/src/SeerEditorWidgetSourceAreas.cpp @@ -1259,8 +1259,19 @@ void SeerEditorWidgetSourceArea::showContextMenu (const QPoint& pos, const QPoin return; } + // Build a printpoint specification. + QString type = dlg.dprintfType(); + QString function = dlg.dprintfFunction(); + QString channel = dlg.dprintfChannel(); + QString parameters = dlg.printpointParameters(); + + // If nothing, just return. + if (parameters == "" || type == "") { + return; + } + // Emit the create breakpoint signal. - emit insertPrintpoint(dlg.printpointText()); + emit insertPrintpoint(type, function, channel, parameters); return; } diff --git a/src/SeerGdbConfigPage.cpp b/src/SeerGdbConfigPage.cpp index 13b5b56..23ee5b1 100644 --- a/src/SeerGdbConfigPage.cpp +++ b/src/SeerGdbConfigPage.cpp @@ -9,8 +9,7 @@ SeerGdbConfigPage::SeerGdbConfigPage(QWidget* parent) : QWidget(parent) { setupUi(this); // Connect things. - QObject::connect(gdbProgramToolButton, &QToolButton::clicked, this, &SeerGdbConfigPage::handleGdbProgramToolButton); - QObject::connect(styleButtonGroup, QOverload::of(&QButtonGroup::idClicked), this, &SeerGdbConfigPage::handleDprintfButtonGroup); + QObject::connect(gdbProgramToolButton, &QToolButton::clicked, this, &SeerGdbConfigPage::handleGdbProgramToolButton); // Setup the defaults. reset(); @@ -89,53 +88,6 @@ void SeerGdbConfigPage::setGdbEnablePrettyPrinting (bool flag) { gdbEnablePrettyPrintingCheckBox->setChecked(flag); } -QString SeerGdbConfigPage::dprintfStyle () const { - - if (styleGdbRadioButton->isChecked()) { - return "gdb"; - }else if (styleCallRadioButton->isChecked()) { - return "call"; - }else if (styleAgentRadioButton->isChecked()) { - return "agent"; - }else{ - return ""; - } -} - -QString SeerGdbConfigPage::dprintfFunction () const { - - return functionLineEdit->text(); -} - -QString SeerGdbConfigPage::dprintfChannel () const { - - return channelLineEdit->text(); -} - -void SeerGdbConfigPage::setDprintfStyle (const QString& style) { - - if (style == "gdb") { - styleGdbRadioButton->setChecked(true); - }else if (style == "call") { - styleCallRadioButton->setChecked(true); - }else if (style == "agent") { - styleAgentRadioButton->setChecked(true); - }else{ - } - - handleDprintfButtonGroup(); -} - -void SeerGdbConfigPage::setDprintfFunction (const QString& function) { - - functionLineEdit->setText(function); -} - -void SeerGdbConfigPage::setDprintfChannel (const QString& channel) { - - channelLineEdit->setText(channel); -} - void SeerGdbConfigPage::reset () { setGdbProgram("/usr/bin/gdb"); @@ -145,10 +97,6 @@ void SeerGdbConfigPage::reset () { setGdbHandleTerminatingException(true); setGdbRandomizeStartAddress(false); setGdbEnablePrettyPrinting(true); - - setDprintfStyle("gdb"); - setDprintfFunction("printf"); - setDprintfChannel(""); } void SeerGdbConfigPage::handleGdbProgramToolButton () { @@ -160,14 +108,3 @@ void SeerGdbConfigPage::handleGdbProgramToolButton () { } } -void SeerGdbConfigPage::handleDprintfButtonGroup () { - - functionLineEdit->setEnabled(false); - channelLineEdit->setEnabled(false); - - if (styleCallRadioButton->isChecked()) { - functionLineEdit->setEnabled(true); - channelLineEdit->setEnabled(true); - } -} - diff --git a/src/SeerGdbConfigPage.h b/src/SeerGdbConfigPage.h index fc67dd6..fdc0f56 100644 --- a/src/SeerGdbConfigPage.h +++ b/src/SeerGdbConfigPage.h @@ -28,18 +28,9 @@ class SeerGdbConfigPage : public QWidget, protected Ui::SeerGdbConfigPage { void setGdbRandomizeStartAddress (bool flag); void setGdbEnablePrettyPrinting (bool flag); - QString dprintfStyle () const; - QString dprintfFunction () const; - QString dprintfChannel () const; - - void setDprintfStyle (const QString& style); - void setDprintfFunction (const QString& function); - void setDprintfChannel (const QString& channel); - void reset (); protected slots: void handleGdbProgramToolButton (); - void handleDprintfButtonGroup (); }; diff --git a/src/SeerGdbConfigPage.ui b/src/SeerGdbConfigPage.ui index 34ecad1..e22df45 100644 --- a/src/SeerGdbConfigPage.ui +++ b/src/SeerGdbConfigPage.ui @@ -6,8 +6,8 @@ 0 0 - 792 - 870 + 603 + 470 @@ -20,142 +20,6 @@ 0 - - - - Printpoint/Dprintf Settings - - - - - - Style - - - - - - - Printpoint output goes the Gdb Ouput tab. - - - gdb - - - styleButtonGroup - - - - - - - Printpoint output goes to the Seer Console. - - - call - - - styleButtonGroup - - - - - - - Printpoint output is handled by the gdbserver. - - - agent - - - styleButtonGroup - - - - - - - Qt::Horizontal - - - - 561 - 20 - - - - - - - - Function - - - - - - - Channel - - - - - - - The name of a function in your program to use. - - - true - - - - - - - The channel value, if required by the function. - - - true - - - - - - - - - - <!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"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Specify an alternate gdb program and alternate gdb flags. </span></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; font-weight:600;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Changing many of these require saving the new configuration and restarting Seer to take effect</span>.</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;">Note, Seer relies on the &quot;mi&quot; interpreter that is built into gdb. If a different debugger is used, it must provide that. So, usually, the &quot;--interpreter=mi&quot; argument is a must.</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;">Async mode allows all gdb actions to happen in the background. This allows interrupting of a running program possible. Note, this is disabled for 'connect' mode as background commands may overwhelm the 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;">Non-stop mode, when turned on, will allow other threads to continue to run while another thread reaches a breakpoint.</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;">The gdb debugger normally starts the process at the same address each time. The program's 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;">A terminating-exception can happen when gdb is asked to call a function in your program. Like printing the return value from a function. If the function throws an exception, gdb can handle it by suppressing the exception or allowing the program to terminate. See:</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;"><span style=" font-family:'ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace'; color:#24292f; background-color:transparent;"> unwind-on-terminating-exception on|off</span></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> -<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;">'Channel' specifies the alternate channel to use when the style is 'call'. For example, if 'Function' is &quot;fprintf&quot;, the 'Channel' would be the value to pass to the first argument of the 'fprintf' call. eg: &quot;fp&quot;. Again, your program needs to provied the channel variable.</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></body></html> - - - @@ -267,16 +131,43 @@ p, li { white-space: pre-wrap; } + + + + <!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" /><meta charset="utf-8" /><style type="text/css"> +p, li { white-space: pre-wrap; } +hr { height: 1px; border-width: 0; } +li.unchecked::marker { content: "\2610"; } +li.checked::marker { content: "\2612"; } +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Specify an alternate gdb program and alternate gdb flags. </span></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; font-weight:600;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Changing many of these require saving the new configuration and restarting Seer to take effect</span>.</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;">Note, Seer relies on the &quot;mi&quot; interpreter that is built into gdb. If a different debugger is used, it must provide that. So, usually, the &quot;--interpreter=mi&quot; argument is a must.</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;">Async mode allows all gdb actions to happen in the background. This allows interrupting of a running program possible. Note, this is disabled for 'connect' mode as background commands may overwhelm the 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;">Non-stop mode, when turned on, will allow other threads to continue to run while another thread reaches a breakpoint.</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;">The gdb debugger normally starts the process at the same address each time. The program's 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;">A terminating-exception can happen when gdb is asked to call a function in your program. Like printing the return value from a function. If the function throws an exception, gdb can handle it by suppressing the exception or allowing the program to terminate. See:</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;"><span style=" font-family:'ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace'; color:#24292f; background-color:transparent;"> unwind-on-terminating-exception on|off</span></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></body></html> + + + gdbGroupBox textBrowser - printPointGroupBox - - - diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 6400b3e..84cac2d 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -2201,13 +2201,17 @@ void SeerGdbWidget::handleGdbPrintpointDisable (QString printpoints) { handleGdbGenericpointList(); } -void SeerGdbWidget::handleGdbPrintpointInsert (QString printpoint) { +void SeerGdbWidget::handleGdbPrintpointInsert (QString type, QString function, QString channel, QString parameters) { if (executableLaunchMode() == "") { return; } - handleGdbCommand("-dprintf-insert " + printpoint); + handleGdbCommand("-gdb-set dprintf-style " + type); + handleGdbCommand("-gdb-set dprintf-function " + function); + handleGdbCommand("-gdb-set dprintf-channel " + channel); + + handleGdbCommand("-dprintf-insert " + parameters); handleGdbGenericpointList(); } diff --git a/src/SeerGdbWidget.h b/src/SeerGdbWidget.h index 8ed80ce..fd04a1f 100644 --- a/src/SeerGdbWidget.h +++ b/src/SeerGdbWidget.h @@ -292,7 +292,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { void handleGdbPrintpointDelete (QString breakpoints); void handleGdbPrintpointEnable (QString breakpoints); void handleGdbPrintpointDisable (QString breakpoints); - void handleGdbPrintpointInsert (QString printpoint); + void handleGdbPrintpointInsert (QString type, QString function, QString channel, QString parameters); void handleGdbThreadListFrames (); void handleGdbThreadListIds (); void handleGdbThreadListGroups (); diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index a6d6e48..deb3b78 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -668,9 +668,6 @@ void SeerMainWindow::handleSettingsConfiguration () { dlg.setGdbHandleTerminatingException(gdbWidget->gdbHandleTerminatingException()); dlg.setGdbRandomizeStartAddress(gdbWidget->gdbRandomizeStartAddress()); dlg.setGdbEnablePrettyPrinting(gdbWidget->gdbEnablePrettyPrinting()); - dlg.setDprintfStyle(gdbWidget->dprintfStyle()); - dlg.setDprintfFunction(gdbWidget->dprintfFunction()); - dlg.setDprintfChannel(gdbWidget->dprintfChannel()); dlg.setEditorFont(gdbWidget->editorManager()->editorFont()); dlg.setEditorTabSize(gdbWidget->editorManager()->editorTabSize()); dlg.setEditorHighlighterSettings(gdbWidget->editorManager()->editorHighlighterSettings()); @@ -714,9 +711,6 @@ void SeerMainWindow::handleSettingsConfiguration () { gdbWidget->setGdbHandleTerminatingException(dlg.gdbHandleTerminatingException()); gdbWidget->setGdbRandomizeStartAddress(dlg.gdbRandomizeStartAddress()); gdbWidget->setGdbEnablePrettyPrinting(dlg.gdbEnablePrettyPrinting()); - gdbWidget->setDprintfStyle(dlg.dprintfStyle()); - gdbWidget->setDprintfFunction(dlg.dprintfFunction()); - gdbWidget->setDprintfChannel(dlg.dprintfChannel()); gdbWidget->editorManager()->setEditorFont(dlg.editorFont()); gdbWidget->editorManager()->setEditorTabSize(dlg.editorTabSize()); gdbWidget->editorManager()->setEditorHighlighterSettings(dlg.editorHighlighterSettings()); @@ -748,9 +742,6 @@ void SeerMainWindow::handleSettingsConfiguration () { gdbWidget->clearManualCommandHistory(); } - // Reset the dprintf, in case it was changed. - gdbWidget->resetDprintf(); - // Set the key shortcuts. setKeySettings(dlg.keySettings()); } @@ -1284,12 +1275,6 @@ void SeerMainWindow::writeConfigSettings () { settings.setValue("gdbarguments", gdbWidget->rrGdbArguments()); } settings.endGroup(); - settings.beginGroup("printpoints"); { - settings.setValue("style", gdbWidget->dprintfStyle()); - settings.setValue("function", gdbWidget->dprintfFunction()); - settings.setValue("channel", gdbWidget->dprintfChannel()); - } settings.endGroup(); - settings.beginGroup("editor"); { settings.setValue("font", gdbWidget->editorManager()->editorFont().toString()); @@ -1366,12 +1351,6 @@ void SeerMainWindow::readConfigSettings () { gdbWidget->setRRGdbArguments(settings.value("gdbarguments", "").toString()); } settings.endGroup(); - settings.beginGroup("printpoints"); { - gdbWidget->setDprintfStyle(settings.value("style", "gdb").toString()); - gdbWidget->setDprintfFunction(settings.value("function", "printf").toString()); - gdbWidget->setDprintfChannel(settings.value("channel", "").toString()); - } settings.endGroup(); - settings.beginGroup("editor"); { QFont f; diff --git a/src/SeerPrintpointCreateDialog.cpp b/src/SeerPrintpointCreateDialog.cpp index 8e60fa3..676a2a2 100644 --- a/src/SeerPrintpointCreateDialog.cpp +++ b/src/SeerPrintpointCreateDialog.cpp @@ -26,10 +26,15 @@ SeerPrintpointCreateDialog::SeerPrintpointCreateDialog (QWidget* parent) : QDial setFormat(""); setArguments(""); + setDPrintfType ("gdb"); + setDPrintfFunction (""); + setDPrintfChannel (""); + // Connect things. - QObject::connect(conditionalCheckBox, &QCheckBox::clicked, conditionalLineEdit, &QLineEdit::setEnabled); - QObject::connect(ignoreCountCheckBox, &QCheckBox::clicked, ignoreCountLineEdit, &QLineEdit::setEnabled); - QObject::connect(threadIdCheckBox, &QCheckBox::clicked, threadIdLineEdit, &QLineEdit::setEnabled); + QObject::connect(conditionalCheckBox, &QCheckBox::clicked, conditionalLineEdit, &QLineEdit::setEnabled); + QObject::connect(ignoreCountCheckBox, &QCheckBox::clicked, ignoreCountLineEdit, &QLineEdit::setEnabled); + QObject::connect(threadIdCheckBox, &QCheckBox::clicked, threadIdLineEdit, &QLineEdit::setEnabled); + QObject::connect(typeButtonGroup, &QButtonGroup::buttonClicked, this, &SeerPrintpointCreateDialog::handleDprintfTypeChanged); } SeerPrintpointCreateDialog::~SeerPrintpointCreateDialog () { @@ -158,7 +163,72 @@ QString SeerPrintpointCreateDialog::arguments () const { return argumentsLineEdit->text(); } -QString SeerPrintpointCreateDialog::printpointText () const { +QString SeerPrintpointCreateDialog::dprintfType () const { + + if (typeGdbRadioButton->isChecked()) { + return "gdb"; + }else if (typeCallRadioButton->isChecked()) { + return "call"; + }else if (typeAgentRadioButton->isChecked()) { + return "agent"; + } + + // Default. + return "gdb"; +} + +QString SeerPrintpointCreateDialog::dprintfFunction () const { + + if (dprintfType() == "gdb") { + return ""; + } + + return dprintfFunctionLineEdit->text(); +} + +QString SeerPrintpointCreateDialog::dprintfChannel () const { + + if (dprintfType() == "gdb") { + return ""; + } + + return dprintfChannelLineEdit->text(); +} + +void SeerPrintpointCreateDialog::setDPrintfType (const QString& text) { + + if (text == "gdb") { + typeGdbRadioButton->setChecked(true); + dprintfFunctionLineEdit->setEnabled(false); + dprintfChannelLineEdit->setEnabled(false); + return; + }else if (text == "call") { + typeCallRadioButton->setChecked(true); + dprintfFunctionLineEdit->setEnabled(true); + dprintfChannelLineEdit->setEnabled(true); + return; + }else if (text == "agent") { + typeAgentRadioButton->setChecked(true); + dprintfFunctionLineEdit->setEnabled(false); + dprintfChannelLineEdit->setEnabled(false); + return; + } + + // Default. + typeGdbRadioButton->setChecked(true); + dprintfFunctionLineEdit->setEnabled(false); + dprintfChannelLineEdit->setEnabled(false); +} + +void SeerPrintpointCreateDialog::setDPrintfFunction (const QString& text) { + dprintfFunctionLineEdit->setText(text); +} + +void SeerPrintpointCreateDialog::setDPrintfChannel (const QString& text) { + dprintfChannelLineEdit->setText(text); +} + +QString SeerPrintpointCreateDialog::printpointParameters () const { // Build a printpoint specification. // @@ -234,3 +304,7 @@ QString SeerPrintpointCreateDialog::printpointText () const { return printpointParameters; } +void SeerPrintpointCreateDialog::handleDprintfTypeChanged () { + setDPrintfType(dprintfType()); +} + diff --git a/src/SeerPrintpointCreateDialog.h b/src/SeerPrintpointCreateDialog.h index 06da32c..cf84dc3 100644 --- a/src/SeerPrintpointCreateDialog.h +++ b/src/SeerPrintpointCreateDialog.h @@ -52,9 +52,18 @@ class SeerPrintpointCreateDialog : public QDialog, protected Ui::SeerPrintpointC QString format () const; QString arguments () const; - QString printpointText () const; + QString dprintfType () const; + QString dprintfFunction () const; + QString dprintfChannel () const; + + void setDPrintfType (const QString& text); + void setDPrintfFunction (const QString& text); + void setDPrintfChannel (const QString& text); + + QString printpointParameters () const; public slots: + void handleDprintfTypeChanged (); private: }; diff --git a/src/SeerPrintpointCreateDialog.ui b/src/SeerPrintpointCreateDialog.ui index 5153a5e..419b9ab 100644 --- a/src/SeerPrintpointCreateDialog.ui +++ b/src/SeerPrintpointCreateDialog.ui @@ -6,8 +6,8 @@ 0 0 - 557 - 473 + 607 + 635 @@ -106,9 +106,9 @@ - + - Printpoint Type + Printpoint Conditions @@ -259,6 +259,122 @@ + + + + Printpoint Type + + + + + + Type + + + + + + + Printpoint output goes the Gdb Ouput tab. + + + gdb + + + typeButtonGroup + + + + + + + Printpoint output goes to the Seer Console. + + + call + + + typeButtonGroup + + + + + + + Printpoint output is handled by the gdbserver. + + + agent + + + typeButtonGroup + + + + + + + Qt::Horizontal + + + + 561 + 20 + + + + + + + + Help about Printpoints. + + + ... + + + + resources/RelaxLightIcons/help-about.svgresources/RelaxLightIcons/help-about.svg + + + + + + + Function + + + + + + + The name of a function in your program to use. + + + true + + + + + + + Channel + + + + + + + The channel variable, if required by the function. + + + true + + + + + + @@ -271,6 +387,29 @@ + + filenameLineEdit + lineNumberLineEdit + functionLineEdit + labelLineEdit + temporaryCheckBox + conditionalCheckBox + conditionalLineEdit + pendingCheckBox + ignoreCountCheckBox + ignoreCountLineEdit + disabledCheckBox + threadIdCheckBox + threadIdLineEdit + formatLineEdit + argumentsLineEdit + typeGdbRadioButton + typeCallRadioButton + typeAgentRadioButton + typeHelpToolButton + dprintfFunctionLineEdit + dprintfChannelLineEdit + @@ -306,4 +445,7 @@ + + + diff --git a/src/SeerPrintpointsBrowserWidget.cpp b/src/SeerPrintpointsBrowserWidget.cpp index 273ba43..c571454 100644 --- a/src/SeerPrintpointsBrowserWidget.cpp +++ b/src/SeerPrintpointsBrowserWidget.cpp @@ -231,15 +231,18 @@ void SeerPrintpointsBrowserWidget::handleAddToolButton () { } // Build a printpoint specification. - QString printpointParameters = dlg.printpointText(); + QString type = dlg.dprintfType(); + QString function = dlg.dprintfFunction(); + QString channel = dlg.dprintfChannel(); + QString parameters = dlg.printpointParameters(); // If nothing, just return. - if (printpointParameters == "") { + if (parameters == "" || type == "") { return; } // Otherwise send the command to create the printpoint. - emit insertPrintpoint(printpointParameters); + emit insertPrintpoint(type, function, channel, parameters); } void SeerPrintpointsBrowserWidget::handleDeleteToolButton () { diff --git a/src/SeerPrintpointsBrowserWidget.h b/src/SeerPrintpointsBrowserWidget.h index 4b1a94b..97818ba 100644 --- a/src/SeerPrintpointsBrowserWidget.h +++ b/src/SeerPrintpointsBrowserWidget.h @@ -39,7 +39,7 @@ class SeerPrintpointsBrowserWidget : public QWidget, protected Ui::SeerPrintpoin void addBreakpointCondition (QString printpoint, QString condition); void addBreakpointIgnore (QString printpoint, QString count); void addBreakpointCommand (QString breakpoint, QString command); - void insertPrintpoint (QString printpoint); + void insertPrintpoint (QString type, QString function, QString channel, QString parameters); void selectedFile (QString file, QString fullname, int lineno); protected: