Commit f67c6dba authored by hjk's avatar hjk Committed by hjk

debugger: prepare naive handling of multiple inferiors

Change-Id: I2ea81b1a9407ae7e5045aadf43b0c2d971fc615b
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 66cf82a4
...@@ -167,9 +167,10 @@ public: ...@@ -167,9 +167,10 @@ public:
QString displayName() const { return tr("Debugger Settings"); } QString displayName() const { return tr("Debugger Settings"); }
private slots: private slots:
void useCppDebuggerToggled(bool toggled); void useCppDebuggerToggled(bool on);
void useQmlDebuggerToggled(bool toggled); void useQmlDebuggerToggled(bool on);
void qmlDebugServerPortChanged(int port); void qmlDebugServerPortChanged(int port);
void useMultiProcessToggled(bool on);
public: public:
DebuggerRunConfigurationAspect *m_aspect; // not owned DebuggerRunConfigurationAspect *m_aspect; // not owned
...@@ -179,6 +180,7 @@ public: ...@@ -179,6 +180,7 @@ public:
QSpinBox *m_debugServerPort; QSpinBox *m_debugServerPort;
QLabel *m_debugServerPortLabel; QLabel *m_debugServerPortLabel;
QLabel *m_qmlDebuggerInfoLabel; QLabel *m_qmlDebuggerInfoLabel;
QCheckBox *m_useMultiProcess;
}; };
DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfiguration) DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfiguration)
...@@ -204,6 +206,12 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat ...@@ -204,6 +206,12 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat
m_debugServerPort->setValue(m_aspect->qmlDebugServerPort()); m_debugServerPort->setValue(m_aspect->qmlDebugServerPort());
static const QByteArray env = qgetenv("QTC_DEBUGGER_MULTIPROCESS");
m_useMultiProcess =
new QCheckBox(tr("Enable Debugging of Subprocesses"), this);
m_useMultiProcess->setChecked(m_aspect->useMultiProcess());
m_useMultiProcess->setVisible(env.toInt());
connect(m_qmlDebuggerInfoLabel, SIGNAL(linkActivated(QString)), connect(m_qmlDebuggerInfoLabel, SIGNAL(linkActivated(QString)),
Core::HelpManager::instance(), SLOT(handleHelpRequest(QString))); Core::HelpManager::instance(), SLOT(handleHelpRequest(QString)));
connect(m_useQmlDebugger, SIGNAL(toggled(bool)), connect(m_useQmlDebugger, SIGNAL(toggled(bool)),
...@@ -212,6 +220,8 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat ...@@ -212,6 +220,8 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat
SLOT(useCppDebuggerToggled(bool))); SLOT(useCppDebuggerToggled(bool)));
connect(m_debugServerPort, SIGNAL(valueChanged(int)), connect(m_debugServerPort, SIGNAL(valueChanged(int)),
SLOT(qmlDebugServerPortChanged(int))); SLOT(qmlDebugServerPortChanged(int)));
connect(m_useMultiProcess, SIGNAL(toggled(bool)),
SLOT(useMultiProcessToggled(bool)));
if (m_aspect->isDisplaySuppressed()) if (m_aspect->isDisplaySuppressed())
hide(); hide();
...@@ -242,6 +252,7 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat ...@@ -242,6 +252,7 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat
layout->setMargin(0); layout->setMargin(0);
layout->addWidget(m_useCppDebugger); layout->addWidget(m_useCppDebugger);
layout->addLayout(qmlLayout); layout->addLayout(qmlLayout);
layout->addWidget(m_useMultiProcess);
setLayout(layout); setLayout(layout);
} }
...@@ -250,25 +261,30 @@ void DebuggerRunConfigWidget::qmlDebugServerPortChanged(int port) ...@@ -250,25 +261,30 @@ void DebuggerRunConfigWidget::qmlDebugServerPortChanged(int port)
m_aspect->m_qmlDebugServerPort = port; m_aspect->m_qmlDebugServerPort = port;
} }
void DebuggerRunConfigWidget::useCppDebuggerToggled(bool toggled) void DebuggerRunConfigWidget::useCppDebuggerToggled(bool on)
{ {
m_aspect->m_useCppDebugger = toggled; m_aspect->m_useCppDebugger = on;
if (!toggled && !m_useQmlDebugger->isChecked()) if (!on && !m_useQmlDebugger->isChecked())
m_useQmlDebugger->setChecked(true); m_useQmlDebugger->setChecked(true);
} }
void DebuggerRunConfigWidget::useQmlDebuggerToggled(bool toggled) void DebuggerRunConfigWidget::useQmlDebuggerToggled(bool on)
{ {
m_debugServerPort->setEnabled(toggled); m_debugServerPort->setEnabled(on);
m_debugServerPortLabel->setEnabled(toggled); m_debugServerPortLabel->setEnabled(on);
m_aspect->m_useQmlDebugger = toggled m_aspect->m_useQmlDebugger = on
? DebuggerRunConfigurationAspect::EnableQmlDebugger ? DebuggerRunConfigurationAspect::EnableQmlDebugger
: DebuggerRunConfigurationAspect::DisableQmlDebugger; : DebuggerRunConfigurationAspect::DisableQmlDebugger;
if (!toggled && !m_useCppDebugger->isChecked()) if (!on && !m_useCppDebugger->isChecked())
m_useCppDebugger->setChecked(true); m_useCppDebugger->setChecked(true);
} }
void DebuggerRunConfigWidget::useMultiProcessToggled(bool on)
{
m_aspect->m_useMultiProcess = on;
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// //
// DebuggerRunControlPrivate // DebuggerRunControlPrivate
...@@ -900,12 +916,15 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu ...@@ -900,12 +916,15 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
} }
} }
if (runConfiguration->debuggerAspect()->useCppDebugger()) DebuggerRunConfigurationAspect *aspect = runConfiguration->debuggerAspect();
sp.multiProcess = aspect->useMultiProcess();
if (aspect->useCppDebugger())
sp.languages |= CppLanguage; sp.languages |= CppLanguage;
if (runConfiguration->debuggerAspect()->useQmlDebugger()) { if (aspect->useQmlDebugger()) {
sp.qmlServerAddress = _("127.0.0.1"); sp.qmlServerAddress = _("127.0.0.1");
sp.qmlServerPort = runConfiguration->debuggerAspect()->qmlDebugServerPort(); sp.qmlServerPort = aspect->qmlDebugServerPort();
sp.languages |= QmlLanguage; sp.languages |= QmlLanguage;
// Makes sure that all bindings go through the JavaScript engine, so that // Makes sure that all bindings go through the JavaScript engine, so that
......
...@@ -61,6 +61,7 @@ public: ...@@ -61,6 +61,7 @@ public:
attachPID(-1), attachPID(-1),
useTerminal(false), useTerminal(false),
breakOnMain(false), breakOnMain(false),
multiProcess(false),
languages(AnyLanguage), languages(AnyLanguage),
qmlServerAddress(QLatin1String("127.0.0.1")), qmlServerAddress(QLatin1String("127.0.0.1")),
qmlServerPort(ProjectExplorer::Constants::QML_DEFAULT_DEBUG_SERVER_PORT), qmlServerPort(ProjectExplorer::Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
...@@ -88,6 +89,7 @@ public: ...@@ -88,6 +89,7 @@ public:
qint64 attachPID; qint64 attachPID;
bool useTerminal; bool useTerminal;
bool breakOnMain; bool breakOnMain;
bool multiProcess;
DebuggerLanguages languages; DebuggerLanguages languages;
// Used by AttachCrashedExternal. // Used by AttachCrashedExternal.
......
...@@ -423,6 +423,7 @@ void GdbEngine::handleResponse(const QByteArray &buff) ...@@ -423,6 +423,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
} }
if (pid) if (pid)
notifyInferiorPid(pid); notifyInferiorPid(pid);
handleThreadGroupCreated(result);
} else if (asyncClass == "thread-created") { } else if (asyncClass == "thread-created") {
//"{id="1",group-id="28902"}" //"{id="1",group-id="28902"}"
QByteArray id = result.findChild("id").data(); QByteArray id = result.findChild("id").data();
...@@ -431,6 +432,7 @@ void GdbEngine::handleResponse(const QByteArray &buff) ...@@ -431,6 +432,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
// Archer has "{id="28902"}" // Archer has "{id="28902"}"
QByteArray id = result.findChild("id").data(); QByteArray id = result.findChild("id").data();
showStatusMessage(tr("Thread group %1 exited").arg(_(id)), 1000); showStatusMessage(tr("Thread group %1 exited").arg(_(id)), 1000);
handleThreadGroupExited(result);
} else if (asyncClass == "thread-exited") { } else if (asyncClass == "thread-exited") {
//"{id="1",group-id="28902"}" //"{id="1",group-id="28902"}"
QByteArray id = result.findChild("id").data(); QByteArray id = result.findChild("id").data();
...@@ -1725,6 +1727,9 @@ void GdbEngine::handleShowVersion(const GdbResponse &response) ...@@ -1725,6 +1727,9 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
postCommand("set target-async on", ConsoleCommand); postCommand("set target-async on", ConsoleCommand);
else else
postCommand("set target-async off", ConsoleCommand); postCommand("set target-async off", ConsoleCommand);
if (startParameters().multiProcess)
postCommand("set detach-on-fork off", ConsoleCommand);
} }
} }
...@@ -1988,6 +1993,18 @@ void GdbEngine::handleDetach(const GdbResponse &response) ...@@ -1988,6 +1993,18 @@ void GdbEngine::handleDetach(const GdbResponse &response)
notifyInferiorExited(); notifyInferiorExited();
} }
void GdbEngine::handleThreadGroupCreated(const GdbMi &result)
{
QByteArray id = result.findChild("id").data();
QByteArray pid = result.findChild("pid").data();
Q_UNUSED(pid);
}
void GdbEngine::handleThreadGroupExited(const GdbMi &result)
{
QByteArray id = result.findChild("id").data();
}
int GdbEngine::currentFrame() const int GdbEngine::currentFrame() const
{ {
return stackHandler()->currentIndex(); return stackHandler()->currentIndex();
......
...@@ -655,6 +655,9 @@ private: ////////// View & Data Stuff ////////// ...@@ -655,6 +655,9 @@ private: ////////// View & Data Stuff //////////
void handleDebuggingHelperVersionCheckClassic(const GdbResponse &response); void handleDebuggingHelperVersionCheckClassic(const GdbResponse &response);
void handleDetach(const GdbResponse &response); void handleDetach(const GdbResponse &response);
void handleThreadGroupCreated(const GdbMi &result);
void handleThreadGroupExited(const GdbMi &result);
Q_SLOT void createFullBacktrace(); Q_SLOT void createFullBacktrace();
void handleCreateFullBacktrace(const GdbResponse &response); void handleCreateFullBacktrace(const GdbResponse &response);
......
...@@ -64,6 +64,7 @@ const char USE_CPP_DEBUGGER_KEY[] = "RunConfiguration.UseCppDebugger"; ...@@ -64,6 +64,7 @@ const char USE_CPP_DEBUGGER_KEY[] = "RunConfiguration.UseCppDebugger";
const char USE_QML_DEBUGGER_KEY[] = "RunConfiguration.UseQmlDebugger"; const char USE_QML_DEBUGGER_KEY[] = "RunConfiguration.UseQmlDebugger";
const char USE_QML_DEBUGGER_AUTO_KEY[] = "RunConfiguration.UseQmlDebuggerAuto"; const char USE_QML_DEBUGGER_AUTO_KEY[] = "RunConfiguration.UseQmlDebuggerAuto";
const char QML_DEBUG_SERVER_PORT_KEY[] = "RunConfiguration.QmlDebugServerPort"; const char QML_DEBUG_SERVER_PORT_KEY[] = "RunConfiguration.QmlDebugServerPort";
const char USE_MULTIPROCESS_KEY[] = "RunConfiguration.UseMultiProcess";
// Function objects: // Function objects:
...@@ -203,6 +204,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(RunConfiguration ...@@ -203,6 +204,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(RunConfiguration
m_useCppDebugger(true), m_useCppDebugger(true),
m_useQmlDebugger(AutoEnableQmlDebugger), m_useQmlDebugger(AutoEnableQmlDebugger),
m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT), m_qmlDebugServerPort(Constants::QML_DEFAULT_DEBUG_SERVER_PORT),
m_useMultiProcess(false),
m_suppressDisplay(false), m_suppressDisplay(false),
m_suppressQmlDebuggingOptions(false), m_suppressQmlDebuggingOptions(false),
m_suppressCppDebuggingOptions(false), m_suppressCppDebuggingOptions(false),
...@@ -214,6 +216,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(DebuggerRunConfig ...@@ -214,6 +216,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(DebuggerRunConfig
m_useCppDebugger(other->m_useCppDebugger), m_useCppDebugger(other->m_useCppDebugger),
m_useQmlDebugger(other->m_useQmlDebugger), m_useQmlDebugger(other->m_useQmlDebugger),
m_qmlDebugServerPort(other->m_qmlDebugServerPort), m_qmlDebugServerPort(other->m_qmlDebugServerPort),
m_useMultiProcess(other->m_useMultiProcess),
m_suppressDisplay(other->m_suppressDisplay), m_suppressDisplay(other->m_suppressDisplay),
m_suppressQmlDebuggingOptions(other->m_suppressQmlDebuggingOptions), m_suppressQmlDebuggingOptions(other->m_suppressQmlDebuggingOptions),
m_suppressCppDebuggingOptions(other->m_suppressCppDebuggingOptions), m_suppressCppDebuggingOptions(other->m_suppressCppDebuggingOptions),
...@@ -266,6 +269,16 @@ void DebuggerRunConfigurationAspect::setQmllDebugServerPort(uint port) ...@@ -266,6 +269,16 @@ void DebuggerRunConfigurationAspect::setQmllDebugServerPort(uint port)
m_qmlDebugServerPort = port; m_qmlDebugServerPort = port;
} }
bool DebuggerRunConfigurationAspect::useMultiProcess() const
{
return m_useMultiProcess;
}
void DebuggerRunConfigurationAspect::setUseMultiProcess(bool value)
{
m_useMultiProcess = value;
}
void DebuggerRunConfigurationAspect::suppressDisplay() void DebuggerRunConfigurationAspect::suppressDisplay()
{ {
m_suppressDisplay = true; m_suppressDisplay = true;
...@@ -318,6 +331,7 @@ QVariantMap DebuggerRunConfigurationAspect::toMap() const ...@@ -318,6 +331,7 @@ QVariantMap DebuggerRunConfigurationAspect::toMap() const
map.insert(QLatin1String(USE_QML_DEBUGGER_KEY), m_useQmlDebugger == EnableQmlDebugger); map.insert(QLatin1String(USE_QML_DEBUGGER_KEY), m_useQmlDebugger == EnableQmlDebugger);
map.insert(QLatin1String(USE_QML_DEBUGGER_AUTO_KEY), m_useQmlDebugger == AutoEnableQmlDebugger); map.insert(QLatin1String(USE_QML_DEBUGGER_AUTO_KEY), m_useQmlDebugger == AutoEnableQmlDebugger);
map.insert(QLatin1String(QML_DEBUG_SERVER_PORT_KEY), m_qmlDebugServerPort); map.insert(QLatin1String(QML_DEBUG_SERVER_PORT_KEY), m_qmlDebugServerPort);
map.insert(QLatin1String(USE_MULTIPROCESS_KEY), m_useMultiProcess);
return map; return map;
} }
...@@ -330,6 +344,7 @@ void DebuggerRunConfigurationAspect::fromMap(const QVariantMap &map) ...@@ -330,6 +344,7 @@ void DebuggerRunConfigurationAspect::fromMap(const QVariantMap &map)
bool useQml = map.value(QLatin1String(USE_QML_DEBUGGER_KEY), false).toBool(); bool useQml = map.value(QLatin1String(USE_QML_DEBUGGER_KEY), false).toBool();
m_useQmlDebugger = useQml ? EnableQmlDebugger : DisableQmlDebugger; m_useQmlDebugger = useQml ? EnableQmlDebugger : DisableQmlDebugger;
} }
m_useMultiProcess = map.value(QLatin1String(USE_MULTIPROCESS_KEY), false).toBool();
} }
......
...@@ -106,12 +106,14 @@ public: ...@@ -106,12 +106,14 @@ public:
QString displayName() const; QString displayName() const;
void setUseQmlDebugger(bool value);
void setUseCppDebugger(bool value);
bool useCppDebugger() const; bool useCppDebugger() const;
void setUseCppDebugger(bool value);
bool useQmlDebugger() const; bool useQmlDebugger() const;
void setUseQmlDebugger(bool value);
uint qmlDebugServerPort() const; uint qmlDebugServerPort() const;
void setQmllDebugServerPort(uint port); void setQmllDebugServerPort(uint port);
bool useMultiProcess() const;
void setUseMultiProcess(bool on);
void suppressDisplay(); void suppressDisplay();
void suppressQmlDebuggingOptions(); void suppressQmlDebuggingOptions();
void suppressCppDebuggingOptions(); void suppressCppDebuggingOptions();
...@@ -130,6 +132,8 @@ public: ...@@ -130,6 +132,8 @@ public:
bool m_useCppDebugger; bool m_useCppDebugger;
QmlDebuggerStatus m_useQmlDebugger; QmlDebuggerStatus m_useQmlDebugger;
uint m_qmlDebugServerPort; uint m_qmlDebugServerPort;
bool m_useMultiProcess;
bool m_suppressDisplay; bool m_suppressDisplay;
bool m_suppressQmlDebuggingOptions; bool m_suppressQmlDebuggingOptions;
bool m_suppressCppDebuggingOptions; bool m_suppressCppDebuggingOptions;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment