debugger: rename data dumpers into "debugging helpers"

This commit is contained in:
hjk
2009-04-07 16:39:17 +02:00
parent 14eb3f6f26
commit bb3e6b720c
13 changed files with 214 additions and 164 deletions
+10 -10
View File
@@ -161,35 +161,35 @@ DebuggerSettings *theDebuggerSettings()
item->setText(QObject::tr("Collapse item"));
//
// Dumpers
// DebuggingHelper
//
item = new SavedAction(instance);
instance->insertItem(UseDumpers, item);
instance->insertItem(UseDebuggingHelpers, item);
item->setDefaultValue(true);
item->setSettingsKey("DebugMode", "UseDumpers");
item->setSettingsKey("DebugMode", "UseDebuggingHelpers");
item->setText(QObject::tr("Use data dumpers"));
item->setCheckable(true);
item->setDefaultValue(true);
item = new SavedAction(instance);
instance->insertItem(UseCustomDumperLocation, item);
item->setSettingsKey("DebugMode", "CustomDumperLocation");
instance->insertItem(UseCustomDebuggingHelperLocation, item);
item->setSettingsKey("DebugMode", "CustomDebuggingHelperLocation");
item->setCheckable(true);
item = new SavedAction(instance);
instance->insertItem(CustomDumperLocation, item);
item->setSettingsKey("DebugMode", "CustomDumperLocation");
instance->insertItem(CustomDebuggingHelperLocation, item);
item->setSettingsKey("DebugMode", "CustomDebuggingHelperLocation");
item = new SavedAction(instance);
instance->insertItem(DebugDumpers, item);
item->setSettingsKey("DebugMode", "DebugDumpers");
instance->insertItem(DebugDebuggingHelpers, item);
item->setSettingsKey("DebugMode", "DebugDebuggingHelpers");
item->setText(QObject::tr("Debug data dumpers"));
item->setCheckable(true);
item = new SavedAction(instance);
item->setText(QObject::tr("Recheck custom dumper availability"));
instance->insertItem(RecheckDumpers, item);
instance->insertItem(RecheckDebuggingHelpers, item);
//
// Breakpoints
+5 -5
View File
@@ -92,11 +92,11 @@ enum DebuggerActionCode
ExpandItem,
CollapseItem,
RecheckDumpers,
UseDumpers,
UseCustomDumperLocation,
CustomDumperLocation,
DebugDumpers,
RecheckDebuggingHelpers,
UseDebuggingHelpers,
UseCustomDebuggingHelperLocation,
CustomDebuggingHelperLocation,
DebugDebuggingHelpers,
// Source List
ListSourceFiles,
+24 -24
View File
@@ -321,23 +321,23 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
///////////////////////////////////////////////////////////////////////
//
// DumperOptionPage
// DebuggingHelperOptionPage
//
///////////////////////////////////////////////////////////////////////
namespace Debugger {
namespace Internal {
class DumperOptionPage : public Core::IOptionsPage
class DebuggingHelperOptionPage : public Core::IOptionsPage
{
Q_OBJECT
public:
DumperOptionPage() {}
DebuggingHelperOptionPage() {}
// IOptionsPage
QString id() const { return QLatin1String("DataDumper"); }
QString trName() const { return tr("Data Dumper"); }
QString id() const { return QLatin1String("DebuggingHelper"); }
QString trName() const { return tr("Debugging Helper"); }
QString category() const { return QLatin1String("Debugger"); }
QString trCategory() const { return tr("Debugger"); }
@@ -349,39 +349,39 @@ private:
Q_SLOT void updateState();
friend class DebuggerPlugin;
Ui::DumperOptionPage m_ui;
Ui::DebuggingHelperOptionPage m_ui;
Core::Utils::SavedActionSet m_group;
};
QWidget *DumperOptionPage::createPage(QWidget *parent)
QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
m_ui.dumperLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.dumperLocationChooser->setPromptDialogTitle(tr("Choose Dumper Location"));
m_ui.dumperLocationChooser->setPromptDialogTitle(tr("Choose DebuggingHelper Location"));
m_ui.dumperLocationChooser->setInitialBrowsePathBackup(
Core::ICore::instance()->resourcePath() + "../../lib");
connect(m_ui.checkBoxUseDumpers, SIGNAL(toggled(bool)),
connect(m_ui.checkBoxUseDebuggingHelpers, SIGNAL(toggled(bool)),
this, SLOT(updateState()));
connect(m_ui.checkBoxUseCustomDumperLocation, SIGNAL(toggled(bool)),
connect(m_ui.checkBoxUseCustomDebuggingHelperLocation, SIGNAL(toggled(bool)),
this, SLOT(updateState()));
m_group.clear();
m_group.insert(theDebuggerAction(UseDumpers),
m_ui.checkBoxUseDumpers);
m_group.insert(theDebuggerAction(UseCustomDumperLocation),
m_ui.checkBoxUseCustomDumperLocation);
m_group.insert(theDebuggerAction(CustomDumperLocation),
m_group.insert(theDebuggerAction(UseDebuggingHelpers),
m_ui.checkBoxUseDebuggingHelpers);
m_group.insert(theDebuggerAction(UseCustomDebuggingHelperLocation),
m_ui.checkBoxUseCustomDebuggingHelperLocation);
m_group.insert(theDebuggerAction(CustomDebuggingHelperLocation),
m_ui.dumperLocationChooser);
m_group.insert(theDebuggerAction(DebugDumpers),
m_ui.checkBoxDebugDumpers);
m_group.insert(theDebuggerAction(DebugDebuggingHelpers),
m_ui.checkBoxDebugDebuggingHelpers);
m_ui.dumperLocationChooser->
setEnabled(theDebuggerAction(UseCustomDumperLocation)->value().toBool());
setEnabled(theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool());
#ifndef QT_DEBUG
#if 0
@@ -396,13 +396,13 @@ QWidget *DumperOptionPage::createPage(QWidget *parent)
return w;
}
void DumperOptionPage::updateState()
void DebuggingHelperOptionPage::updateState()
{
m_ui.checkBoxUseCustomDumperLocation->setEnabled(
m_ui.checkBoxUseDumpers->isChecked());
m_ui.checkBoxUseCustomDebuggingHelperLocation->setEnabled(
m_ui.checkBoxUseDebuggingHelpers->isChecked());
m_ui.dumperLocationChooser->setEnabled(
m_ui.checkBoxUseDumpers->isChecked()
&& m_ui.checkBoxUseCustomDumperLocation->isChecked());
m_ui.checkBoxUseDebuggingHelpers->isChecked()
&& m_ui.checkBoxUseCustomDebuggingHelperLocation->isChecked());
}
} // namespace Internal
@@ -652,7 +652,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
// FIXME:
m_generalOptionPage = new GdbOptionPage;
addObject(m_generalOptionPage);
m_dumperOptionPage = new DumperOptionPage;
m_dumperOptionPage = new DebuggingHelperOptionPage;
addObject(m_dumperOptionPage);
m_locationMark = 0;
+3 -3
View File
@@ -57,7 +57,7 @@ namespace Internal {
class DebuggerManager;
class DebugMode;
class GdbOptionPage;
class DumperOptionPage;
class DebuggingHelperOptionPage;
class LocationMark;
class DebuggerPlugin : public ExtensionSystem::IPlugin
@@ -102,14 +102,14 @@ private:
friend class DebuggerManager;
friend class GdbOptionPage;
friend class DumperOptionPage;
friend class DebuggingHelperOptionPage;
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
DebuggerManager *m_manager;
DebugMode *m_debugMode;
GdbOptionPage *m_generalOptionPage;
DumperOptionPage *m_dumperOptionPage;
DebuggingHelperOptionPage *m_dumperOptionPage;
QString m_previousMode;
LocationMark *m_locationMark;
+1 -1
View File
@@ -1,6 +1,6 @@
TEMPLATE = lib
TARGET = Dumper
TARGET = DebuggingHelper
CONFIG += shared
DESTDIR = ../../../bin
include(../../qworkbenchlibrary.pri)
+12 -12
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DumperOptionPage</class>
<widget class="QWidget" name="DumperOptionPage">
<class>DebuggingHelperOptionPage</class>
<widget class="QWidget" name="DebuggingHelperOptionPage">
<property name="geometry">
<rect>
<x>0</x>
@@ -15,7 +15,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxUseDumpers">
<widget class="QCheckBox" name="checkBoxUseDebuggingHelpers">
<property name="toolTip">
<string>This will enable nice display of Qt and Standard Library objects in the Locals&amp;Watchers view</string>
</property>
@@ -43,7 +43,7 @@
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseCustomDumperLocation">
<widget class="QCheckBox" name="checkBoxUseCustomDebuggingHelperLocation">
<property name="toolTip">
<string>This will load a dumper library</string>
</property>
@@ -73,7 +73,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="labelDumperLocation">
<widget class="QLabel" name="labelDebuggingHelperLocation">
<property name="text">
<string>Location: </string>
</property>
@@ -85,9 +85,9 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxDebugDumpers">
<widget class="QCheckBox" name="checkBoxDebugDebuggingHelpers">
<property name="toolTip">
<string notr="true">This is an internal tool to make debugging the Custom Data Dumper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself.</string>
<string notr="true">This is an internal tool to make debugging the debugging helper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself.</string>
</property>
<property name="text">
<string>Debug custom dumpers</string>
@@ -108,13 +108,13 @@
</spacer>
</item>
</layout>
<zorder>checkBoxDebugDumpers</zorder>
<zorder>checkBoxUseDumpers</zorder>
<zorder>checkBoxUseDefaultDumperLocation</zorder>
<zorder>checkBoxDebugDebuggingHelpers</zorder>
<zorder>checkBoxUseDebuggingHelpers</zorder>
<zorder>checkBoxUseDefaultDebuggingHelperLocation</zorder>
<zorder>horizontalSpacer</zorder>
<zorder>labelDumperLocation</zorder>
<zorder>labelDebuggingHelperLocation</zorder>
<zorder>horizontalSpacer_2</zorder>
<zorder>labelDumperLocation</zorder>
<zorder>labelDebuggingHelperLocation</zorder>
</widget>
<customwidgets>
<customwidget>
+85 -85
View File
@@ -115,7 +115,7 @@ enum GdbCommandType
GdbInfoShared,
GdbInfoProc,
GdbInfoThreads,
GdbQueryDataDumper,
GdbQueryDebuggingHelper,
GdbTemporaryContinue,
GdbTargetCore,
@@ -147,11 +147,11 @@ enum GdbCommandType
WatchVarCreate,
WatchEvaluateExpression,
WatchToolTip,
WatchDumpCustomSetup,
WatchDumpCustomValue1, // waiting for gdb ack
WatchDumpCustomValue2, // waiting for actual data
WatchDumpCustomValue3, // macro based
WatchDumpCustomEditValue,
WatchDebuggingHelperSetup,
WatchDebuggingHelperValue1, // waiting for gdb ack
WatchDebuggingHelperValue2, // waiting for actual data
WatchDebuggingHelperValue3, // macro based
WatchDebuggingHelperEditValue,
};
static int &currentToken()
@@ -211,12 +211,12 @@ void GdbEngine::initializeConnections()
q, SLOT(showApplicationOutput(QString)),
Qt::QueuedConnection);
connect(theDebuggerAction(UseDumpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setUseDumpers(QVariant)));
connect(theDebuggerAction(DebugDumpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setDebugDumpers(QVariant)));
connect(theDebuggerAction(RecheckDumpers), SIGNAL(triggered()),
this, SLOT(recheckCustomDumperAvailability()));
connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setUseDebuggingHelpers(QVariant)));
connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setDebugDebuggingHelpers(QVariant)));
connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()),
this, SLOT(recheckDebuggingHelperAvailability()));
connect(theDebuggerAction(FormatHexadecimal), SIGNAL(triggered()),
this, SLOT(reloadRegisters()));
@@ -237,7 +237,7 @@ void GdbEngine::initializeConnections()
void GdbEngine::initializeVariables()
{
m_dataDumperState = DataDumperUninitialized;
m_debuggingHelperState = DebuggingHelperUninitialized;
m_gdbVersion = 100;
m_gdbBuildVersion = -1;
@@ -766,8 +766,8 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type,
case GdbInfoShared:
handleInfoShared(record);
break;
case GdbQueryDataDumper:
handleQueryDataDumper(record);
case GdbQueryDebuggingHelper:
handleQueryDebuggingHelper(record);
break;
case GdbTemporaryContinue:
continueInferior();
@@ -846,19 +846,19 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type,
case WatchToolTip:
handleToolTip(record, cookie.toString());
break;
case WatchDumpCustomValue1:
handleDumpCustomValue1(record, cookie.value<WatchData>());
case WatchDebuggingHelperValue1:
handleDebuggingHelperValue1(record, cookie.value<WatchData>());
break;
case WatchDumpCustomValue2:
handleDumpCustomValue2(record, cookie.value<WatchData>());
case WatchDebuggingHelperValue2:
handleDebuggingHelperValue2(record, cookie.value<WatchData>());
break;
case WatchDumpCustomValue3:
handleDumpCustomValue3(record, cookie.value<WatchData>());
case WatchDebuggingHelperValue3:
handleDebuggingHelperValue3(record, cookie.value<WatchData>());
break;
case WatchDumpCustomSetup:
handleDumpCustomSetup(record);
case WatchDebuggingHelperSetup:
handleDebuggingHelperSetup(record);
break;
default:
@@ -913,7 +913,7 @@ void GdbEngine::handleTargetCore(const GdbResultRecord &record)
//
qq->reloadRegisters();
// Gdb-Macro based Dumpers
// Gdb-Macro based DebuggingHelpers
sendCommand(
"define qdumpqstring\n"
"set $i = 0\n"
@@ -1104,10 +1104,10 @@ void GdbEngine::handleAqcuiredInferior()
#endif
if (theDebuggerBoolSetting(ListSourceFiles))
reloadSourceFiles();
tryLoadCustomDumpers();
tryLoadDebuggingHelpers();
#ifndef Q_OS_MAC
// intentionally after tryLoadCustomDumpers(),
// intentionally after tryLoadDebuggingHelpers(),
// otherwise we'd interupt solib loading.
if (theDebuggerBoolSetting(AllPluginBreakpoints)) {
sendCommand("set auto-solib-add on");
@@ -1216,7 +1216,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
return;
}
//tryLoadCustomDumpers();
//tryLoadDebuggingHelpers();
// jump over well-known frames
static int stepCounter = 0;
@@ -1523,7 +1523,7 @@ void GdbEngine::exitDebugger()
m_outputCollector.shutdown();
initializeVariables();
//q->settings()->m_debugDumpers = false;
//q->settings()->m_debugDebuggingHelpers = false;
}
@@ -1631,7 +1631,7 @@ bool GdbEngine::startDebugger()
// otherwise program doesn't know.
// Pass and Stop may be combined.
// We need "print" as otherwise we would get no feedback whatsoever
// Custom Dumper crashs which happen regularily for when accessing
// Custom DebuggingHelper crashs which happen regularily for when accessing
// uninitialized variables.
sendCommand("handle SIGSEGV nopass stop print");
@@ -1755,7 +1755,7 @@ void GdbEngine::handleAttach()
handleAqcuiredInferior();
q->resetLocation();
recheckCustomDumperAvailability();
recheckDebuggingHelperAvailability();
//
// Stack
@@ -1872,7 +1872,7 @@ void GdbEngine::setTokenBarrier()
m_oldestAcceptableToken = currentToken();
}
void GdbEngine::setDebugDumpers(const QVariant &on)
void GdbEngine::setDebugDebuggingHelpers(const QVariant &on)
{
if (on.toBool()) {
debugMessage("SWITCHING ON DUMPER DEBUGGING");
@@ -2698,7 +2698,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
return;
}
if (theDebuggerBoolSetting(DebugDumpers)) {
if (theDebuggerBoolSetting(DebugDebuggingHelpers)) {
// minimize interference
return;
}
@@ -2901,7 +2901,7 @@ static void setWatchDataSAddress(WatchData &data, const GdbMi &mi)
data.saddr = mi.data();
}
void GdbEngine::setUseDumpers(const QVariant &on)
void GdbEngine::setUseDebuggingHelpers(const QVariant &on)
{
qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on;
// FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
@@ -2910,9 +2910,9 @@ void GdbEngine::setUseDumpers(const QVariant &on)
updateLocals();
}
bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
bool GdbEngine::hasDebuggingHelperForType(const QString &type) const
{
if (!theDebuggerBoolSetting(UseDumpers))
if (!theDebuggerBoolSetting(UseDebuggingHelpers))
return false;
if (q->startMode() == AttachCore) {
@@ -2921,15 +2921,15 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
|| type == "QStringList" || type.endsWith("::QStringList");
}
if (theDebuggerBoolSetting(DebugDumpers)
&& qq->stackHandler()->isDebuggingDumpers())
if (theDebuggerBoolSetting(DebugDebuggingHelpers)
&& qq->stackHandler()->isDebuggingDebuggingHelpers())
return false;
if (m_dataDumperState != DataDumperAvailable)
if (m_debuggingHelperState != DebuggingHelperAvailable)
return false;
// simple types
if (m_availableSimpleDumpers.contains(type))
if (m_availableSimpleDebuggingHelpers.contains(type))
return true;
// templates
@@ -2937,10 +2937,10 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
QString inner;
if (!extractTemplate(type, &tmplate, &inner))
return false;
return m_availableSimpleDumpers.contains(tmplate);
return m_availableSimpleDebuggingHelpers.contains(tmplate);
}
void GdbEngine::runDirectDumper(const WatchData &data, bool dumpChildren)
void GdbEngine::runDirectDebuggingHelper(const WatchData &data, bool dumpChildren)
{
Q_UNUSED(dumpChildren);
QString type = data.type;
@@ -2953,17 +2953,17 @@ void GdbEngine::runDirectDumper(const WatchData &data, bool dumpChildren)
QVariant var;
var.setValue(data);
sendSynchronizedCommand(cmd, WatchDumpCustomValue3, var);
sendSynchronizedCommand(cmd, WatchDebuggingHelperValue3, var);
q->showStatusMessage(
tr("Retrieving data for watch view (%1 requests pending)...")
.arg(m_pendingRequests + 1), 10000);
}
void GdbEngine::runCustomDumper(const WatchData &data0, bool dumpChildren)
void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren)
{
if (q->startMode() == AttachCore) {
runDirectDumper(data0, dumpChildren);
runDirectDebuggingHelper(data0, dumpChildren);
return;
}
WatchData data = data0;
@@ -3112,14 +3112,14 @@ void GdbEngine::runCustomDumper(const WatchData &data0, bool dumpChildren)
QVariant var;
var.setValue(data);
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, var);
sendSynchronizedCommand(cmd, WatchDebuggingHelperValue1, var);
q->showStatusMessage(
tr("Retrieving data for watch view (%1 requests pending)...")
.arg(m_pendingRequests + 1), 10000);
// retrieve response
sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var);
sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDebuggingHelperValue2, var);
}
void GdbEngine::createGdbVariable(const WatchData &data)
@@ -3171,7 +3171,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
// a common case that can be easily solved
if (data.isChildrenNeeded() && isPointerType(data.type)
&& !isCustomValueDumperAvailable(data.type)) {
&& !hasDebuggingHelperForType(data.type)) {
// We sometimes know what kind of children pointers have
#if DEBUG_SUBITEM
qDebug() << "IT'S A POINTER";
@@ -3189,11 +3189,11 @@ void GdbEngine::updateSubItem(const WatchData &data0)
return;
}
if (data.isValueNeeded() && isCustomValueDumperAvailable(data.type)) {
if (data.isValueNeeded() && hasDebuggingHelperForType(data.type)) {
#if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: CUSTOMVALUE";
#endif
runCustomDumper(data, qq->watchHandler()->isExpandedIName(data.iname));
runDebuggingHelper(data, qq->watchHandler()->isExpandedIName(data.iname));
return;
}
@@ -3229,11 +3229,11 @@ void GdbEngine::updateSubItem(const WatchData &data0)
return;
}
if (data.isChildrenNeeded() && isCustomValueDumperAvailable(data.type)) {
if (data.isChildrenNeeded() && hasDebuggingHelperForType(data.type)) {
#if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: CUSTOMVALUE WITH CHILDREN";
#endif
runCustomDumper(data, true);
runDebuggingHelper(data, true);
return;
}
@@ -3254,11 +3254,11 @@ void GdbEngine::updateSubItem(const WatchData &data0)
return;
}
if (data.isChildCountNeeded() && isCustomValueDumperAvailable(data.type)) {
if (data.isChildCountNeeded() && hasDebuggingHelperForType(data.type)) {
#if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: CUSTOMVALUE WITH CHILDREN";
#endif
runCustomDumper(data, qq->watchHandler()->isExpandedIName(data.iname));
runDebuggingHelper(data, qq->watchHandler()->isExpandedIName(data.iname));
return;
}
@@ -3339,7 +3339,7 @@ void GdbEngine::updateWatchModel2()
}
}
void GdbEngine::handleQueryDataDumper(const GdbResultRecord &record)
void GdbEngine::handleQueryDebuggingHelper(const GdbResultRecord &record)
{
//qDebug() << "DATA DUMPER TRIAL:" << record.toString();
GdbMi output = record.data.findChild("consolestreamoutput");
@@ -3367,11 +3367,11 @@ void GdbEngine::handleQueryDataDumper(const GdbResultRecord &record)
//qDebug() << "CONTENTS: " << contents.toString();
//qDebug() << "SIMPLE DUMPERS: " << simple.toString();
m_availableSimpleDumpers.clear();
m_availableSimpleDebuggingHelpers.clear();
foreach (const GdbMi &item, simple.children())
m_availableSimpleDumpers.append(item.data());
if (m_availableSimpleDumpers.isEmpty()) {
m_dataDumperState = DataDumperUnavailable;
m_availableSimpleDebuggingHelpers.append(item.data());
if (m_availableSimpleDebuggingHelpers.isEmpty()) {
m_debuggingHelperState = DebuggingHelperUnavailable;
QMessageBox::warning(q->mainWindow(),
tr("Cannot find special data dumpers"),
tr("The debugged binary does not contain information needed for "
@@ -3381,11 +3381,11 @@ void GdbEngine::handleQueryDataDumper(const GdbResultRecord &record)
"into your project directly.")
);
} else {
m_dataDumperState = DataDumperAvailable;
m_debuggingHelperState = DebuggingHelperAvailable;
q->showStatusMessage(tr("%1 custom dumpers found.")
.arg(m_availableSimpleDumpers.size()));
.arg(m_availableSimpleDebuggingHelpers.size()));
}
//qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDumpers;
//qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDebuggingHelpers;
}
void GdbEngine::sendWatchParameters(const QByteArray &params0)
@@ -3436,7 +3436,7 @@ void GdbEngine::handleVarCreate(const GdbResultRecord &record,
if (record.resultClass == GdbResultDone) {
data.variable = data.iname;
setWatchDataType(data, record.data.findChild("type"));
if (isCustomValueDumperAvailable(data.type)) {
if (hasDebuggingHelperForType(data.type)) {
// we do not trust gdb if we have a custom dumper
if (record.data.findChild("children").isValid())
data.setChildrenUnneeded();
@@ -3484,7 +3484,7 @@ void GdbEngine::handleEvaluateExpression(const GdbResultRecord &record,
//updateWatchModel2();
}
void GdbEngine::handleDumpCustomSetup(const GdbResultRecord &record)
void GdbEngine::handleDebuggingHelperSetup(const GdbResultRecord &record)
{
//qDebug() << "CUSTOM SETUP RESULT: " << record.toString();
if (record.resultClass == GdbResultDone) {
@@ -3495,7 +3495,7 @@ void GdbEngine::handleDumpCustomSetup(const GdbResultRecord &record)
}
}
void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
void GdbEngine::handleDebuggingHelperValue1(const GdbResultRecord &record,
const WatchData &data0)
{
WatchData data = data0;
@@ -3510,7 +3510,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
#ifdef QT_DEBUG
// Make debugging of dumpers easier
if (theDebuggerBoolSetting(DebugDumpers)
if (theDebuggerBoolSetting(DebugDebuggingHelpers)
&& msg.startsWith("The program being debugged stopped while")
&& msg.contains("qDumpObjectData440")) {
// Fake full stop
@@ -3527,7 +3527,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
}
}
void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
const WatchData &data0)
{
WatchData data = data0;
@@ -3627,7 +3627,7 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
}
}
void GdbEngine::handleDumpCustomValue3(const GdbResultRecord &record,
void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record,
const WatchData &data0)
{
WatchData data = data0;
@@ -3668,7 +3668,7 @@ void GdbEngine::handleDumpCustomValue3(const GdbResultRecord &record,
QString cmd = "qdumpqstring (" + data1.exp + ")";
QVariant var;
var.setValue(data1);
sendSynchronizedCommand(cmd, WatchDumpCustomValue3, var);
sendSynchronizedCommand(cmd, WatchDebuggingHelperValue3, var);
}
} else {
data.setValue("<unavailable>");
@@ -3932,7 +3932,7 @@ void GdbEngine::handleVarListChildrenHelper(const GdbMi &item,
data.exp = parent.exp + '.' + exp;
}
if (isCustomValueDumperAvailable(data.type)) {
if (hasDebuggingHelperForType(data.type)) {
// we do not trust gdb if we have a custom dumper
data.setValueNeeded();
data.setChildCountNeeded();
@@ -3990,8 +3990,8 @@ void GdbEngine::handleToolTip(const GdbResultRecord &record,
if (what == "create") {
setWatchDataType(m_toolTip, record.data.findChild("type"));
setWatchDataChildCount(m_toolTip, record.data.findChild("numchild"));
if (isCustomValueDumperAvailable(m_toolTip.type))
runCustomDumper(m_toolTip, false);
if (hasDebuggingHelperForType(m_toolTip.type))
runDebuggingHelper(m_toolTip, false);
else
q->showStatusMessage(tr("Retrieving data for tooltip..."), 10000);
sendCommand("-data-evaluate-expression " + m_toolTip.exp,
@@ -4041,18 +4041,18 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString &
QString GdbEngine::dumperLibraryName() const
{
if (theDebuggerAction(UseCustomDumperLocation)->value().toBool())
return theDebuggerAction(CustomDumperLocation)->value().toString();
if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool())
return theDebuggerAction(CustomDebuggingHelperLocation)->value().toString();
return q->m_dumperLib;
}
void GdbEngine::tryLoadCustomDumpers()
void GdbEngine::tryLoadDebuggingHelpers()
{
if (m_dataDumperState != DataDumperUninitialized)
if (m_debuggingHelperState != DebuggingHelperUninitialized)
return;
PENDING_DEBUG("TRY LOAD CUSTOM DUMPERS");
m_dataDumperState = DataDumperUnavailable;
m_debuggingHelperState = DebuggingHelperUnavailable;
QString lib = dumperLibraryName();
//qDebug() << "DUMPERLIB: " << lib;
@@ -4064,44 +4064,44 @@ void GdbEngine::tryLoadCustomDumpers()
return;
}
m_dataDumperState = DataDumperLoadTried;
m_debuggingHelperState = DebuggingHelperLoadTried;
#if defined(Q_OS_WIN)
sendCommand("sharedlibrary .*"); // for LoadLibraryA
//sendCommand("handle SIGSEGV pass stop print");
//sendCommand("set unwindonsignal off");
sendCommand("call LoadLibraryA(\"" + lib + "\")",
WatchDumpCustomSetup);
WatchDebuggingHelperSetup);
sendCommand("sharedlibrary " + dotEscape(lib));
#elif defined(Q_OS_MAC)
//sendCommand("sharedlibrary libc"); // for malloc
//sendCommand("sharedlibrary libdl"); // for dlopen
QString flag = QString::number(RTLD_NOW);
sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")",
WatchDumpCustomSetup);
WatchDebuggingHelperSetup);
//sendCommand("sharedlibrary " + dotEscape(lib));
m_dataDumperState = DataDumperLoadTried;
m_debuggingHelperState = DebuggingHelperLoadTried;
#else
//sendCommand("p dlopen");
QString flag = QString::number(RTLD_NOW);
sendCommand("sharedlibrary libc"); // for malloc
sendCommand("sharedlibrary libdl"); // for dlopen
sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")",
WatchDumpCustomSetup);
WatchDebuggingHelperSetup);
// some older systems like CentOS 4.6 prefer this:
sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")",
WatchDumpCustomSetup);
WatchDebuggingHelperSetup);
sendCommand("sharedlibrary " + dotEscape(lib));
#endif
// retreive list of dumpable classes
sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)");
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper);
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDebuggingHelper);
}
void GdbEngine::recheckCustomDumperAvailability()
void GdbEngine::recheckDebuggingHelperAvailability()
{
// retreive list of dumpable classes
sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)");
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper);
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDebuggingHelper);
}
IDebuggerEngine *createGdbEngine(DebuggerManager *parent)
+20 -20
View File
@@ -72,12 +72,12 @@ struct GdbCookie
QVariant cookie;
};
enum DataDumperState
enum DebuggingHelperState
{
DataDumperUninitialized,
DataDumperLoadTried,
DataDumperAvailable,
DataDumperUnavailable,
DebuggingHelperUninitialized,
DebuggingHelperLoadTried,
DebuggingHelperAvailable,
DebuggingHelperUnavailable,
};
@@ -130,8 +130,8 @@ private:
void loadSymbols(const QString &moduleName);
void loadAllSymbols();
Q_SLOT void setDebugDumpers(const QVariant &on);
Q_SLOT void setUseDumpers(const QVariant &on);
Q_SLOT void setDebugDebuggingHelpers(const QVariant &on);
Q_SLOT void setUseDebuggingHelpers(const QVariant &on);
//
// Own stuff
@@ -306,11 +306,11 @@ private:
void handleTypeContents(const QString &output);
void maybeHandleInferiorPidChanged(const QString &pid);
void tryLoadCustomDumpers();
Q_SLOT void recheckCustomDumperAvailability();
void runCustomDumper(const WatchData &data, bool dumpChildren);
void runDirectDumper(const WatchData &data, bool dumpChildren);
bool isCustomValueDumperAvailable(const QString &type) const;
void tryLoadDebuggingHelpers();
Q_SLOT void recheckDebuggingHelperAvailability();
void runDebuggingHelper(const WatchData &data, bool dumpChildren);
void runDirectDebuggingHelper(const WatchData &data, bool dumpChildren);
bool hasDebuggingHelperForType(const QString &type) const;
void handleVarListChildren(const GdbResultRecord &record,
const WatchData &cookie);
@@ -321,15 +321,15 @@ private:
const WatchData &cookie);
void handleToolTip(const GdbResultRecord &record,
const QString &cookie);
void handleQueryDataDumper(const GdbResultRecord &record);
void handleDumpCustomValue1(const GdbResultRecord &record,
void handleQueryDebuggingHelper(const GdbResultRecord &record);
void handleDebuggingHelperValue1(const GdbResultRecord &record,
const WatchData &cookie);
void handleDumpCustomValue2(const GdbResultRecord &record,
void handleDebuggingHelperValue2(const GdbResultRecord &record,
const WatchData &cookie);
void handleDumpCustomValue3(const GdbResultRecord &record,
void handleDebuggingHelperValue3(const GdbResultRecord &record,
const WatchData &cookie);
void handleDumpCustomEditValue(const GdbResultRecord &record);
void handleDumpCustomSetup(const GdbResultRecord &record);
void handleDebuggingHelperEditValue(const GdbResultRecord &record);
void handleDebuggingHelperSetup(const GdbResultRecord &record);
void handleStackListLocals(const GdbResultRecord &record);
void handleStackListArguments(const GdbResultRecord &record);
void handleVarListChildrenHelper(const GdbMi &child,
@@ -340,11 +340,11 @@ private:
QString m_editedData;
int m_pendingRequests;
QStringList m_availableSimpleDumpers;
QStringList m_availableSimpleDebuggingHelpers;
QString m_namespace; // namespace used in "namespaced Qt";
int m_qtVersion; // Qt version used in the debugged program
DataDumperState m_dataDumperState; // state of qt creator dumpers
DebuggingHelperState m_debuggingHelperState;
QList<GdbMi> m_currentFunctionArgs;
QString m_currentFrame;
QMap<QString, QString> m_varToType;
+48
View File
@@ -240,7 +240,55 @@ void ScriptEngine::continueInferior()
void ScriptEngine::runInferior()
{
//QDir dir(QApplication::applicationDirPath());
//if (dir.dirName() == QLatin1String("debug") || dir.dirName() == QLatin1String("release"))
// dir.cdUp();
//dir.cdUp();
//dir.cdUp();
QDir dir("/home/apoenitz/dev/qtscriptgenerator");
if (!dir.cd("plugins")) {
fprintf(stderr, "plugins folder does not exist -- did you build the bindings?\n");
return;
}
QStringList paths = qApp->libraryPaths();
paths << dir.absolutePath();
qApp->setLibraryPaths(paths);
SDEBUG("ScriptEngine::runInferior()");
QStringList extensions;
extensions << "qt.core"
<< "qt.gui"
<< "qt.xml"
<< "qt.svg"
<< "qt.network"
<< "qt.sql"
<< "qt.opengl"
<< "qt.webkit"
<< "qt.xmlpatterns"
<< "qt.uitools";
QStringList failExtensions;
foreach (const QString &ext, extensions) {
QScriptValue ret = m_scriptEngine->importExtension(ext);
if (ret.isError())
failExtensions.append(ext);
}
if (!failExtensions.isEmpty()) {
if (failExtensions.size() == extensions.size()) {
qWarning("Failed to import Qt bindings!\n"
"Plugins directory searched: %s/script\n"
"Make sure that the bindings have been built, "
"and that this executable and the plugins are "
"using compatible Qt libraries.", qPrintable(dir.absolutePath()));
} else {
qWarning("Failed to import some Qt bindings: %s\n"
"Plugins directory searched: %s/script\n"
"Make sure that the bindings have been built, "
"and that this executable and the plugins are "
"using compatible Qt libraries.",
qPrintable(failExtensions.join(", ")), qPrintable(dir.absolutePath()));
}
}
QScriptValue result = m_scriptEngine->evaluate(m_scriptContents, m_scriptFileName);
}
+1 -1
View File
@@ -183,7 +183,7 @@ QList<StackFrame> StackHandler::frames() const
return m_stackFrames;
}
bool StackHandler::isDebuggingDumpers() const
bool StackHandler::isDebuggingDebuggingHelpers() const
{
for (int i = m_stackFrames.size(); --i >= 0; )
if (m_stackFrames.at(i).function.startsWith("qDumpObjectData"))
+1 -1
View File
@@ -74,7 +74,7 @@ public:
// Called from StackHandler after a new stack list has been received
void removeAll();
QAbstractItemModel *stackModel() { return this; }
bool isDebuggingDumpers() const;
bool isDebuggingDebuggingHelpers() const;
private:
// QAbstractTableModel
+2 -2
View File
@@ -189,8 +189,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(act3);
menu.addSeparator();
menu.addAction(theDebuggerAction(RecheckDumpers));
menu.addAction(theDebuggerAction(UseDumpers));
menu.addAction(theDebuggerAction(RecheckDebuggingHelpers));
menu.addAction(theDebuggerAction(UseDebuggingHelpers));
menu.addSeparator();
menu.addAction(theDebuggerAction(SettingsDialog));
+2
View File
@@ -30,6 +30,8 @@
function cube(a)
{
var x = a * a * a;
x = x + 1;
x = x - 1;
return x;
}