Debugger[CDB]: Add setting for additional command line arguments.

to CDB, allowing for extensions, etc.
This commit is contained in:
Friedemann Kleint
2011-01-19 13:01:50 +01:00
parent 205268fb15
commit c1228d0c67
5 changed files with 50 additions and 17 deletions

View File

@@ -591,6 +591,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
{
if (debug)
qDebug("launchCDB startMode=%d", sp.startMode);
const QChar blank(QLatin1Char(' '));
// Start engine which will run until initial breakpoint:
// Determine extension lib name and path to use
// The extension is passed as relative name with the path variable set
@@ -621,10 +622,14 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
arguments << QLatin1String("-y") << m_options->symbolPaths.join(QString(QLatin1Char(';')));
if (!m_options->sourcePaths.isEmpty())
arguments << QLatin1String("-srcpath") << m_options->sourcePaths.join(QString(QLatin1Char(';')));
// Compile argument string preserving quotes
QString nativeArguments = m_options->additionalArguments;
switch (sp.startMode) {
case StartInternal:
case StartExternal:
arguments << QDir::toNativeSeparators(sp.executable);
if (!nativeArguments.isEmpty())
nativeArguments.push_back(blank);
nativeArguments += QDir::toNativeSeparators(sp.executable);
break;
case AttachToRemote:
break;
@@ -638,19 +643,26 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
*errorMessage = QString::fromLatin1("Internal error: Unsupported start mode %1.").arg(sp.startMode);
return false;
}
if (!sp.processArgs.isEmpty()) { // Complete native argument string.
if (!nativeArguments.isEmpty())
nativeArguments.push_back(blank);
nativeArguments += sp.processArgs;
}
const QString executable = m_options->executable;
const QString msg = QString::fromLatin1("Launching %1 %2\nusing %3 of %4.").
arg(QDir::toNativeSeparators(executable),
arguments.join(QString(QLatin1Char(' '))),
arguments.join(QString(blank)) + blank + nativeArguments,
QDir::toNativeSeparators(extensionFi.absoluteFilePath()),
extensionFi.lastModified().toString(Qt::SystemLocaleShortDate));
showMessage(msg, LogMisc);
m_outputBuffer.clear();
m_process.setEnvironment(mergeEnvironment(sp.environment.toStringList(), extensionFi.absolutePath()));
#ifdef Q_OS_WIN
if (!sp.processArgs.isEmpty()) // Appends
m_process.setNativeArguments(sp.processArgs);
if (!nativeArguments.isEmpty()) // Appends
m_process.setNativeArguments(nativeArguments);
#endif
m_process.start(executable, arguments);
if (!m_process.waitForStarted()) {

View File

@@ -50,6 +50,7 @@ static const char symbolPathsKeyC[] = "SymbolPaths";
static const char sourcePathsKeyC[] = "SourcePaths";
static const char breakEventKeyC[] = "BreakEvent";
static const char is64bitKeyC[] = "64bit";
static const char additionalArgumentsKeyC[] = "AdditionalArguments";
namespace Debugger {
namespace Internal {
@@ -148,6 +149,7 @@ void CdbOptions::fromSettings(QSettings *s)
enabled = s->value(enabledKey, false).toBool();
is64bit = s->value(keyRoot + QLatin1String(is64bitKeyC), is64bit).toBool();
executable = s->value(keyRoot + QLatin1String(pathKeyC), executable).toString();
additionalArguments = s->value(keyRoot + QLatin1String(additionalArgumentsKeyC), QString()).toString();
symbolPaths = s->value(keyRoot + QLatin1String(symbolPathsKeyC), QStringList()).toStringList();
sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList();
breakEvents = s->value(keyRoot + QLatin1String(breakEventKeyC), QStringList()).toStringList();
@@ -162,6 +164,7 @@ void CdbOptions::toSettings(QSettings *s) const
s->setValue(QLatin1String(symbolPathsKeyC), symbolPaths);
s->setValue(QLatin1String(sourcePathsKeyC), sourcePaths);
s->setValue(QLatin1String(breakEventKeyC), breakEvents);
s->setValue(QLatin1String(additionalArgumentsKeyC), additionalArguments);
s->endGroup();
}
@@ -169,6 +172,7 @@ bool CdbOptions::equals(const CdbOptions &rhs) const
{
return enabled == rhs.enabled && is64bit == rhs.is64bit
&& executable == rhs.executable
&& additionalArguments == rhs.additionalArguments
&& symbolPaths == rhs.symbolPaths
&& sourcePaths == rhs.sourcePaths
&& breakEvents == rhs.breakEvents;

View File

@@ -68,6 +68,7 @@ public:
bool enabled;
bool is64bit;
QString executable;
QString additionalArguments;
QStringList symbolPaths;
QStringList sourcePaths;
// Events to break on (Command 'sxe' with abbreviation and optional parameter)

View File

@@ -210,6 +210,7 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) :
void CdbOptionsPageWidget::setOptions(CdbOptions &o)
{
m_ui.pathChooser->setPath(o.executable);
m_ui.additionalArgumentsLineEdit->setText(o.additionalArguments);
m_ui.is64BitCheckBox->setChecked(o.is64bit);
m_ui.cdbPathGroupBox->setChecked(o.enabled);
setSymbolPaths(o.symbolPaths);
@@ -231,6 +232,7 @@ CdbOptions CdbOptionsPageWidget::options() const
{
CdbOptions rc;
rc.executable = path();
rc.additionalArguments = m_ui.additionalArgumentsLineEdit->text().trimmed();
rc.enabled = m_ui.cdbPathGroupBox->isChecked();
rc.is64bit = is64Bit();
rc.symbolPaths = symbolPaths();

View File

@@ -1,15 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger::Internal::CdbOptionsPageWidget</class>
<widget class="QWidget" name="Debugger::Cdb::CdbOptionsPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>347</width>
<height>358</height>
</rect>
</property>
<widget class="QWidget" name="Debugger::Internal::CdbOptionsPageWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -25,7 +17,10 @@
<item row="1" column="0">
<widget class="QLabel" name="pathLabel">
<property name="text">
<string>Path:</string>
<string>&amp;Path:</string>
</property>
<property name="buddy">
<cstring>pathChooser</cstring>
</property>
</widget>
</item>
@@ -39,7 +34,20 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0">
<widget class="QLabel" name="additionalArgumentsLabel">
<property name="text">
<string>Additional &amp;arguments:</string>
</property>
<property name="buddy">
<cstring>additionalArgumentsLineEdit</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="additionalArgumentsLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="is64BitCheckBox">
<property name="text">
<string>64 bit</string>
@@ -63,7 +71,10 @@
<item row="0" column="0">
<widget class="QLabel" name="symbolPathLabel">
<property name="text">
<string>Symbol paths:</string>
<string>&amp;Symbol paths:</string>
</property>
<property name="buddy">
<cstring>symbolPathListEditor</cstring>
</property>
</widget>
</item>
@@ -73,7 +84,10 @@
<item row="1" column="0">
<widget class="QLabel" name="sourcePathLabel">
<property name="text">
<string>Source paths:</string>
<string>S&amp;ource paths:</string>
</property>
<property name="buddy">
<cstring>sourcePathListEditor</cstring>
</property>
</widget>
</item>