Debugger: Fix Attach to Unstarted Application.

Use paths with native directory separator when comparing
application names. Also disable the "Continue on Attach"
combo box when a kit with a cdb is selected. The cdbengine
always continues after an attach.

Task-number: QTCREATORBUG-13517
Change-Id: I3dd9cca98f9b4255cafc318836377d802413eace
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
David Schulz
2014-11-25 10:33:51 +01:00
committed by hjk
parent 3f7db88ffd
commit 28907f76e4
2 changed files with 21 additions and 3 deletions

View File

@@ -31,6 +31,7 @@
#include "unstartedappwatcherdialog.h"
#include "debuggerdialogs.h"
#include "debuggerkitinformation.h"
#include <utils/pathchooser.h>
@@ -151,6 +152,9 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
connect(m_pathChooser, SIGNAL(pathChanged(QString)), this, SLOT(stopAndCheckExecutable()));
connect(m_closePushButton, SIGNAL(clicked()), this, SLOT(reject()));
connect(&m_timer, SIGNAL(timeout()), this, SLOT(findProcess()));
connect(m_kitChooser, &ProjectExplorer::KitChooser::currentIndexChanged,
this, &UnstartedAppWatcherDialog::kitChanged);
kitChanged();
setWaitingState(checkExecutableString() ? NotWatchingState : InvalidWacherState);
}
@@ -224,10 +228,10 @@ void UnstartedAppWatcherDialog::startStopTimer(bool start)
void UnstartedAppWatcherDialog::findProcess()
{
QString appName = m_pathChooser->path();
const QString &appName = Utils::FileUtils::normalizePathName(m_pathChooser->path());
DeviceProcessItem fallback;
foreach (const DeviceProcessItem &p, DeviceProcessList::localProcesses()) {
if (p.exe == appName) {
if (Utils::FileUtils::normalizePathName(p.exe) == appName) {
pidFound(p);
return;
}
@@ -244,6 +248,19 @@ void UnstartedAppWatcherDialog::stopAndCheckExecutable()
setWaitingState(checkExecutableString() ? NotWatchingState : InvalidWacherState);
}
void UnstartedAppWatcherDialog::kitChanged()
{
const DebuggerItem *debugger = DebuggerKitInformation::debugger(m_kitChooser->currentKit());
if (!debugger)
return;
if (debugger->engineType() == Debugger::CdbEngineType) {
m_continueOnAttachCheckBox->setEnabled(false);
m_continueOnAttachCheckBox->setChecked(true);
} else {
m_continueOnAttachCheckBox->setEnabled(true);
}
}
bool UnstartedAppWatcherDialog::checkExecutableString() const
{
if (!m_pathChooser->path().isEmpty()) {
@@ -270,7 +287,7 @@ bool UnstartedAppWatcherDialog::hideOnAttach() const
bool UnstartedAppWatcherDialog::continueOnAttach() const
{
return m_continueOnAttachCheckBox->isChecked();
return m_continueOnAttachCheckBox->isEnabled() && m_continueOnAttachCheckBox->isChecked();
}
void UnstartedAppWatcherDialog::setWaitingState(UnstartedAppWacherState state)

View File

@@ -70,6 +70,7 @@ public slots:
void startStopWatching(bool start);
void findProcess();
void stopAndCheckExecutable();
void kitChanged();
signals:
void processFound();