forked from qt-creator/qt-creator
Debugger: Add specific customization hook for dumper initialization
We need to distiguish between start of GDB itself (a.k.a .gdbinit-style customization) and after the dumper machinery is initialized, which is nowadays often delayed until the first stop hook. Change-Id: I40f1e7225c2043b8bcb7d50eef948bb3c9162bb6 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -382,6 +382,9 @@ def registerDumper(function):
|
|||||||
|
|
||||||
def bbsetup(args = ''):
|
def bbsetup(args = ''):
|
||||||
global qqDumpers, qqFormats, qqEditable, typeCache
|
global qqDumpers, qqFormats, qqEditable, typeCache
|
||||||
|
qqDumpers = {}
|
||||||
|
qqFormats = {}
|
||||||
|
qqEditable = {}
|
||||||
typeCache = {}
|
typeCache = {}
|
||||||
module = sys.modules[__name__]
|
module = sys.modules[__name__]
|
||||||
|
|
||||||
|
|||||||
@@ -447,6 +447,11 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
|
|||||||
insertItem(GdbStartupCommands, item);
|
insertItem(GdbStartupCommands, item);
|
||||||
|
|
||||||
item = new SavedAction(this);
|
item = new SavedAction(this);
|
||||||
|
item->setSettingsKey(debugModeGroup, QLatin1String("GdbCustomDumperCommands"));
|
||||||
|
item->setDefaultValue(QString());
|
||||||
|
insertItem(GdbCustomDumperCommands, item);
|
||||||
|
item = new SavedAction(this);
|
||||||
|
|
||||||
item->setSettingsKey(debugModeGroup, QLatin1String("GdbPostAttachCommands"));
|
item->setSettingsKey(debugModeGroup, QLatin1String("GdbPostAttachCommands"));
|
||||||
item->setDefaultValue(QString());
|
item->setDefaultValue(QString());
|
||||||
insertItem(GdbPostAttachCommands, item);
|
insertItem(GdbPostAttachCommands, item);
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ enum DebuggerActionCode
|
|||||||
LoadGdbDumpers,
|
LoadGdbDumpers,
|
||||||
AttemptQuickStart,
|
AttemptQuickStart,
|
||||||
GdbStartupCommands,
|
GdbStartupCommands,
|
||||||
|
GdbCustomDumperCommands,
|
||||||
GdbPostAttachCommands,
|
GdbPostAttachCommands,
|
||||||
GdbWatchdogTimeout,
|
GdbWatchdogTimeout,
|
||||||
AutoEnrichParameters,
|
AutoEnrichParameters,
|
||||||
|
|||||||
@@ -1854,6 +1854,12 @@ void GdbEngine::handleHasPython(const GdbResponse &response)
|
|||||||
void GdbEngine::handlePythonSetup(const GdbResponse &response)
|
void GdbEngine::handlePythonSetup(const GdbResponse &response)
|
||||||
{
|
{
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
|
const QString commands = debuggerCore()->stringSetting(GdbCustomDumperCommands);
|
||||||
|
if (!commands.isEmpty()) {
|
||||||
|
postCommand(commands.toLocal8Bit());
|
||||||
|
postCommand("bbsetup");
|
||||||
|
}
|
||||||
|
|
||||||
postCommand("python qqStringCutOff = "
|
postCommand("python qqStringCutOff = "
|
||||||
+ debuggerCore()->action(MaximalStringLength)->value().toByteArray(),
|
+ debuggerCore()->action(MaximalStringLength)->value().toByteArray(),
|
||||||
ConsoleCommand|NonCriticalResponse);
|
ConsoleCommand|NonCriticalResponse);
|
||||||
@@ -4972,6 +4978,7 @@ void GdbEngine::tryLoadPythonDumpers()
|
|||||||
|
|
||||||
postCommand("python execfile('" + dumperSourcePath + "gbridge.py')",
|
postCommand("python execfile('" + dumperSourcePath + "gbridge.py')",
|
||||||
ConsoleCommand, CB(handlePythonSetup));
|
ConsoleCommand, CB(handlePythonSetup));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::reloadDebuggingHelpers()
|
void GdbEngine::reloadDebuggingHelpers()
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ public:
|
|||||||
QTextEdit *textEditStartupCommands;
|
QTextEdit *textEditStartupCommands;
|
||||||
QGroupBox *groupBoxPostAttachCommands;
|
QGroupBox *groupBoxPostAttachCommands;
|
||||||
QTextEdit *textEditPostAttachCommands;
|
QTextEdit *textEditPostAttachCommands;
|
||||||
|
QGroupBox *groupBoxCustomDumperCommands;
|
||||||
|
QTextEdit *textEditCustomDumperCommands;
|
||||||
|
|
||||||
//QGroupBox *groupBoxPluginDebugging;
|
//QGroupBox *groupBoxPluginDebugging;
|
||||||
//QRadioButton *radioButtonAllPluginBreakpoints;
|
//QRadioButton *radioButtonAllPluginBreakpoints;
|
||||||
@@ -167,20 +169,21 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
|||||||
"<b>Note:</b>This feature needs special support from the Linux "
|
"<b>Note:</b>This feature needs special support from the Linux "
|
||||||
"distribution and GDB build and is not everywhere available.</p></body></html>"));
|
"distribution and GDB build and is not everywhere available.</p></body></html>"));
|
||||||
|
|
||||||
groupBoxStartupCommands = new QGroupBox(this);
|
QString howToUsePython = GdbOptionsPage::tr(
|
||||||
groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));
|
|
||||||
groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr(
|
|
||||||
"<html><head/><body><p>GDB commands entered here will be executed after "
|
|
||||||
"GDB has been started and the debugging helpers have been initialized.</p>"
|
|
||||||
"<p>You can add commands to load further debugging helpers here, or "
|
|
||||||
"modify existing ones.</p>"
|
|
||||||
"<p>To execute simple Python commands, prefix them with \"python\".</p>"
|
"<p>To execute simple Python commands, prefix them with \"python\".</p>"
|
||||||
"<p>To execute sequences of Python commands spanning multiple lines "
|
"<p>To execute sequences of Python commands spanning multiple lines "
|
||||||
"prepend the block with \"python\" on a separate line, and append "
|
"prepend the block with \"python\" on a separate line, and append "
|
||||||
"\"end\" on a separate line.</p>"
|
"\"end\" on a separate line.</p>"
|
||||||
"<p>To execute arbitrary Python scripts, "
|
"<p>To execute arbitrary Python scripts, "
|
||||||
"use <i>python execfile('/path/to/script.py')</i>.</p>"
|
"use <i>python execfile('/path/to/script.py')</i>.</p>");
|
||||||
"</body></html>"));
|
|
||||||
|
groupBoxStartupCommands = new QGroupBox(this);
|
||||||
|
groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));
|
||||||
|
groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr(
|
||||||
|
"<html><head/><body><p>GDB commands entered here will be executed after "
|
||||||
|
"GDB has been started, but before the debugged program is started or "
|
||||||
|
"attached, and before the debugging helpers are initialized.</p>%1"
|
||||||
|
"<body></html>").arg(howToUsePython));
|
||||||
|
|
||||||
textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
|
textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
|
||||||
textEditStartupCommands->setAcceptRichText(false);
|
textEditStartupCommands->setAcceptRichText(false);
|
||||||
@@ -199,6 +202,18 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
|||||||
textEditPostAttachCommands->setAcceptRichText(false);
|
textEditPostAttachCommands->setAcceptRichText(false);
|
||||||
textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());
|
textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());
|
||||||
|
|
||||||
|
groupBoxCustomDumperCommands = new QGroupBox(this);
|
||||||
|
groupBoxCustomDumperCommands->setTitle(GdbOptionsPage::tr("Debugging Helper Customization"));
|
||||||
|
groupBoxCustomDumperCommands->setToolTip(GdbOptionsPage::tr(
|
||||||
|
"<html><head/><body><p>GDB commands entered here will be executed after "
|
||||||
|
"Qt Creator's debugging helpers have been loaded and fully initialized. "
|
||||||
|
"You can load additional debugging helpers or modify existing ones here.</p>"
|
||||||
|
"%1</body></html>").arg(howToUsePython));
|
||||||
|
|
||||||
|
textEditCustomDumperCommands = new QTextEdit(groupBoxStartupCommands);
|
||||||
|
textEditCustomDumperCommands->setAcceptRichText(false);
|
||||||
|
textEditCustomDumperCommands->setToolTip(groupBoxStartupCommands->toolTip());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
groupBoxPluginDebugging = new QGroupBox(q);
|
groupBoxPluginDebugging = new QGroupBox(q);
|
||||||
groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
|
groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
|
||||||
@@ -242,6 +257,9 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
|||||||
QGridLayout *postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
|
QGridLayout *postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
|
||||||
postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);
|
postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
QGridLayout *customDumperLayout = new QGridLayout(groupBoxCustomDumperCommands);
|
||||||
|
customDumperLayout->addWidget(textEditCustomDumperCommands, 0, 0, 1, 1);
|
||||||
|
|
||||||
//QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
//QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
||||||
//horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum));
|
//horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum));
|
||||||
//horizontalLayout->addWidget(labelSelectedPluginBreakpoints);
|
//horizontalLayout->addWidget(labelSelectedPluginBreakpoints);
|
||||||
@@ -251,6 +269,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
|||||||
gridLayout->addWidget(groupBoxGeneral, 0, 0, 2, 1);
|
gridLayout->addWidget(groupBoxGeneral, 0, 0, 2, 1);
|
||||||
gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
|
gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
|
||||||
gridLayout->addWidget(groupBoxPostAttachCommands, 1, 1, 1, 1);
|
gridLayout->addWidget(groupBoxPostAttachCommands, 1, 1, 1, 1);
|
||||||
|
gridLayout->addWidget(groupBoxCustomDumperCommands, 2, 1, 1, 1);
|
||||||
|
|
||||||
//gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
|
//gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
|
||||||
//gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1);
|
//gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1);
|
||||||
@@ -262,6 +281,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
|||||||
|
|
||||||
DebuggerCore *dc = debuggerCore();
|
DebuggerCore *dc = debuggerCore();
|
||||||
group.insert(dc->action(GdbStartupCommands), textEditStartupCommands);
|
group.insert(dc->action(GdbStartupCommands), textEditStartupCommands);
|
||||||
|
group.insert(dc->action(GdbCustomDumperCommands), textEditCustomDumperCommands);
|
||||||
group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands);
|
group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands);
|
||||||
group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit);
|
group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit);
|
||||||
group.insert(dc->action(LoadGdbDumpers), checkBoxLoadGdbDumpers);
|
group.insert(dc->action(LoadGdbDumpers), checkBoxLoadGdbDumpers);
|
||||||
|
|||||||
Reference in New Issue
Block a user