summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrgad Shaneh <orgads@gmail.com>2012-02-17 12:32:57 +0200
committerhjk <qthjk@ovi.com>2012-02-20 11:56:32 +0100
commit266da3568d2db185f67227d38e29cd20d28fb2bd (patch)
tree4a69fd4a9f7d9f9d6bb0f5a32e4fcd78d15354f1
parent66341196f89d911ef814fd23ba1fee2e3de15f7f (diff)
downloadqt-creator-266da3568d2db185f67227d38e29cd20d28fb2bd.tar.gz
Debugger: New syntax for command-line launching
Documentation needs to be updated to reflect this Task-number: QTCREATORBUG-6868 Change-Id: I84591c28a13708b7435175b69b1c970aeea09a7f Reviewed-by: hjk <qthjk@ovi.com>
-rw-r--r--src/plugins/debugger/Debugger.pluginspec.in9
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp76
2 files changed, 43 insertions, 42 deletions
diff --git a/src/plugins/debugger/Debugger.pluginspec.in b/src/plugins/debugger/Debugger.pluginspec.in
index 68d3c25773..1b4327cc0a 100644
--- a/src/plugins/debugger/Debugger.pluginspec.in
+++ b/src/plugins/debugger/Debugger.pluginspec.in
@@ -24,9 +24,12 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<argument name=\"-disable-cdb\">Disable Cdb debugger engine</argument>
<argument name=\"-disable-gdb\">Disable Gdb debugger engine</argument>
<argument name=\"-disable-sdb\">Disable Qt Script debugger engine</argument>
- <argument name=\"-debug\"
- parameter=\"pid or corefile or server:port@executable@architecture\">
- Attach to local process or core file or remote gdb server</argument>
+ <argument name=\"-debug\" parameter=\"pid\">Attach to local process</argument>
+ <argument name=\"-debug\" parameter=\"executable\">Start and debug executable</argument>
+ <argument name=\"-debug [executable,]core=&lt;corefile&gt;[,sysroot=&lt;sysroot&gt;]\">
+ Attach to core file</argument>
+ <argument name=\"-debug &lt;executable&gt;,server=&lt;server:port&gt;[,sysroot=&lt;sysroot&gt;][,arch=&lt;arch&gt;]\">
+ Attach to remote debug server</argument>
<argument name=\"-wincrashevent\"
parameter=\"eventhandle:pid\">
Event handle used for attaching to crashed processes</argument>
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 9e2b0d2a11..5794376538 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1330,8 +1330,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
{
const QString &option = *it;
// '-debug <pid>'
- // '-debug <corefile>'
- // '-debug <server:port>@<exe>@<arch>'
+ // '-debug <exe>[,server=<server:port>|,core=<core>][,arch=<arch>][,sysroot=<sysroot>]'
if (*it == _("-debug")) {
++it;
if (it == cend) {
@@ -1340,51 +1339,50 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
}
DebuggerStartParameters sp;
qulonglong pid = it->toULongLong();
- QString remoteChannel = it->contains(QLatin1Char('@')) ?
- it->section(QLatin1Char('@'), 0, 0) : *it;
- uint port = 0;
- int pos = remoteChannel.indexOf(QLatin1Char(':'));
- if (pos != -1)
- port = remoteChannel.mid(pos + 1).toUInt();
if (pid) {
sp.startMode = AttachExternal;
sp.attachPID = pid;
sp.displayName = tr("Process %1").arg(sp.attachPID);
sp.startMessage = tr("Attaching to local process %1.").arg(sp.attachPID);
sp.toolChainAbi = Abi::hostAbi();
- } else if (port) {
- sp.startMode = AttachToRemoteServer;
- sp.remoteChannel = remoteChannel;
- sp.executable = it->section(QLatin1Char('@'), 1, 1);
- if (sp.remoteChannel.isEmpty()) {
- *errorMessage = DebuggerPlugin::tr("The parameter '%1' of option "
- "'%2' does not match the pattern <server:port>@<executable>@<architecture>.")
- .arg(*it, option);
- return false;
- }
- sp.remoteArchitecture = it->section(QLatin1Char('@'), 2, 2);
- sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
- sp.startMessage = tr("Attaching to remote server %1.")
- .arg(sp.remoteChannel);
- sp.toolChainAbi = anyAbiOfBinary(sp.executable);
} else {
- // Fixme: Distinguish between core-file and executable by argument syntax?
- // (default up to 2.2 was core-file (".dmp on Windows)).
- const bool isExecutable = Abi::hostAbi().os() == Abi::WindowsOS ?
- !it->endsWith(QLatin1String(".dmp"), Qt::CaseInsensitive) :
- QFileInfo(*it).isExecutable();
- if (isExecutable) {
- sp.startMode = StartExternal;
- sp.executable = *it;
- sp.displayName = tr("Executable file \"%1\"").arg(sp.executable);
- sp.startMessage = tr("Debugging file %1.").arg(sp.executable);
- } else {
- sp.startMode = AttachCore;
- sp.coreFile = *it;
- sp.displayName = tr("Core file \"%1\"").arg(sp.coreFile);
- sp.startMessage = tr("Attaching to core file %1.").arg(sp.coreFile);
+ QStringList args = it->split(QLatin1Char(','));
+ sp.startMode = StartExternal;
+ foreach (const QString &arg, args) {
+ QString key = arg.section(QLatin1Char('='), 0, 0);
+ QString val = arg.section(QLatin1Char('='), 1, 1);
+ if (val.isEmpty()) {
+ if (key.isEmpty())
+ continue;
+ else if (sp.executable.isEmpty())
+ sp.executable = key;
+ else {
+ *errorMessage = DebuggerPlugin::tr("Only one executable allowed!");
+ return false;
+ }
+ }
+ if (key == QLatin1String("server")) {
+ sp.startMode = AttachToRemoteServer;
+ sp.remoteChannel = val;
+ sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
+ sp.startMessage = tr("Attaching to remote server %1.").arg(sp.remoteChannel);
+ }
+ else if (key == QLatin1String("arch"))
+ sp.remoteArchitecture = val;
+ else if (key == QLatin1String("core")) {
+ sp.startMode = AttachCore;
+ sp.coreFile = val;
+ sp.displayName = tr("Core file \"%1\"").arg(sp.coreFile);
+ sp.startMessage = tr("Attaching to core file %1.").arg(sp.coreFile);
+ }
+ else if (key == QLatin1String("sysroot"))
+ sp.sysroot = val;
}
- sp.toolChainAbi = anyAbiOfBinary(*it);
+ sp.toolChainAbi = anyAbiOfBinary(sp.executable);
+ }
+ if (sp.startMode == StartExternal) {
+ sp.displayName = tr("Executable file \"%1\"").arg(sp.executable);
+ sp.startMessage = tr("Debugging file %1.").arg(sp.executable);
}
m_scheduledStarts.append(sp);
return true;