forked from qt-creator/qt-creator
Fix debugger detection when attaching from output pane.
Obtain RunConfiguration from RunControl add logic to use the ABI if that fails. Task-number: QTCREATORBUG-7677 Change-Id: Iebf053e6b7a25644a4d4c02b80bf952ef9e6a078 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -637,15 +637,21 @@ private:
|
||||
void fillParameters(DebuggerStartParameters *sp, const Profile *profile /* = 0 */)
|
||||
{
|
||||
if (!profile) {
|
||||
// This code can only be reached when starting via the command
|
||||
// (-debug pid or executable) without specifying a profile.
|
||||
// Try to find a profile via ABI.
|
||||
// This code can only be reached when starting via the command line
|
||||
// (-debug pid or executable) or attaching from runconfiguration
|
||||
// without specifying a profile. Try to find a profile via ABI.
|
||||
QList<Abi> abis;
|
||||
if (sp->toolChainAbi.isValid()) {
|
||||
abis.push_back(sp->toolChainAbi);
|
||||
} else {
|
||||
// Try via executable.
|
||||
if (sp->executable.isEmpty()
|
||||
&& (sp->startMode == AttachExternal || sp->startMode == AttachCrashedExternal)) {
|
||||
sp->executable = executableForPid(sp->attachPID);
|
||||
}
|
||||
if (!sp->executable.isEmpty()) {
|
||||
const QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(sp->executable));
|
||||
if (!sp->executable.isEmpty())
|
||||
abis = Abi::abisOfBinary(Utils::FileName::fromString(sp->executable));
|
||||
}
|
||||
if (!abis.isEmpty()) {
|
||||
AbiProfileMatcher matcher(abis);
|
||||
profile = ProfileManager::instance()->find(&matcher);
|
||||
@@ -654,7 +660,6 @@ void fillParameters(DebuggerStartParameters *sp, const Profile *profile /* = 0 *
|
||||
profile = ProfileManager::instance()->find(&matcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!profile)
|
||||
profile = ProfileManager::instance()->defaultProfile();
|
||||
}
|
||||
@@ -1694,12 +1699,16 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly)
|
||||
void DebuggerPluginPrivate::attachExternalApplication(ProjectExplorer::RunControl *rc)
|
||||
{
|
||||
DebuggerStartParameters sp;
|
||||
fillParameters(&sp);
|
||||
sp.attachPID = rc->applicationProcessHandle().pid();
|
||||
sp.displayName = tr("Process %1").arg(sp.attachPID);
|
||||
sp.startMode = AttachExternal;
|
||||
sp.closeMode = DetachAtClose;
|
||||
sp.toolChainAbi = rc->abi();
|
||||
Profile *profile = 0;
|
||||
if (const RunConfiguration *runConfiguration = rc->runConfiguration())
|
||||
if (const Target *target = runConfiguration->target())
|
||||
profile = target->profile();
|
||||
fillParameters(&sp, profile);
|
||||
DebuggerRunControlFactory::createAndScheduleRun(sp);
|
||||
}
|
||||
|
||||
|
@@ -558,6 +558,11 @@ Abi RunControl::abi() const
|
||||
return Abi();
|
||||
}
|
||||
|
||||
RunConfiguration *RunControl::runConfiguration() const
|
||||
{
|
||||
return m_runConfiguration.data();
|
||||
}
|
||||
|
||||
ProcessHandle RunControl::applicationProcessHandle() const
|
||||
{
|
||||
return m_applicationProcessHandle;
|
||||
|
@@ -274,6 +274,7 @@ public:
|
||||
void setApplicationProcessHandle(const ProcessHandle &handle);
|
||||
Abi abi() const;
|
||||
|
||||
RunConfiguration *runConfiguration() const;
|
||||
bool sameRunConfiguration(const RunControl *other) const;
|
||||
|
||||
Utils::OutputFormatter *outputFormatter();
|
||||
|
Reference in New Issue
Block a user