Docker: mount python dumpers to device

Change-Id: Ic0d67b4a18247439f5797a0dcf74df945ef6f61e
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2021-10-18 09:44:10 +02:00
parent 6f26a1545c
commit 12bc192422
9 changed files with 28 additions and 7 deletions

View File

@@ -2753,7 +2753,7 @@ void CdbEngine::setupScripting(const DebuggerResponse &response)
return;
}
QString dumperPath = Core::ICore::resourcePath("debugger").toUserOutput();
QString dumperPath = runParameters().dumperPath.toUserOutput();
dumperPath.replace('\\', "\\\\");
runCommand({"sys.path.insert(1, '" + dumperPath + "')", ScriptCommand});
runCommand({"from cdbbridge import Dumper", ScriptCommand});

View File

@@ -1056,6 +1056,8 @@ void DebuggerEngine::setRunTool(DebuggerRunTool *runTool)
d->m_device = runControl->device();
if (!d->m_device)
d->m_device = d->m_runParameters.inferior.device;
if (d->m_device)
d->m_runParameters.dumperPath = d->m_device->debugDumperPath();
d->m_terminalRunner = runTool->terminalRunner();
validateRunParameters(d->m_runParameters);

View File

@@ -203,6 +203,8 @@ public:
int testCase = 0;
QStringList validationErrors;
Utils::FilePath dumperPath;
};
class UpdateParameters

View File

@@ -946,6 +946,8 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
m_engine = createPdbEngine();
}
}
m_runParameters.dumperPath = Core::ICore::resourcePath("debugger/");
}
void DebuggerRunTool::startRunControl()

View File

@@ -3985,7 +3985,6 @@ void GdbEngine::setupEngine()
// We need to guarantee a roundtrip before the adapter proceeds.
// Make sure this stays the last command in startGdb().
// Don't use ConsoleCommand, otherwise Mac won't markup the output.
const QString dumperSourcePath = ICore::resourcePath("debugger/").toString();
//if (terminal()->isUsable())
// runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())});
@@ -3993,7 +3992,7 @@ void GdbEngine::setupEngine()
const QString uninstalledData =
rp.debugger.command.executable().pathAppended("data-directory/python").path();
runCommand({"python sys.path.insert(1, '" + dumperSourcePath + "')"});
runCommand({"python sys.path.insert(1, '" + rp.dumperPath.path() + "')"});
runCommand({"python sys.path.append('" + uninstalledData + "')"});
runCommand({"python from gdbbridge import *"});

View File

@@ -237,9 +237,9 @@ void LldbEngine::setupEngine()
showStatusMessage(tr("Setting up inferior..."));
const QByteArray dumperSourcePath = ICore::resourcePath("debugger/").toString().toLocal8Bit();
const DebuggerRunParameters &rp = runParameters();
executeCommand("script sys.path.insert(1, '" + dumperSourcePath + "')");
executeCommand("script sys.path.insert(1, '" + rp.dumperPath.path().toLocal8Bit() + "')");
// This triggers reportState("enginesetupok") or "enginesetupfailed":
executeCommand("script from lldbbridge import *");
@@ -268,8 +268,6 @@ void LldbEngine::setupEngine()
};
runCommand(cmd1);
const DebuggerRunParameters &rp = runParameters();
const SourcePathMap sourcePathMap =
mergePlatformQtPath(rp, debuggerSettings()->sourcePathMap.value());
for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd();

View File

@@ -839,6 +839,9 @@ void DockerDevicePrivate::startContainer()
mount = q->mapToDevicePath(FilePath::fromUserInput(mount));
dockerCreate.addArgs({"-v", mount + ':' + mount});
}
FilePath dumperPath = FilePath::fromString("/tmp/qtcreator/debugger");
dockerCreate.addArgs({"-v", q->debugDumperPath().toUserOutput() + ':' + dumperPath.path()});
q->setDebugDumperPath(dumperPath);
dockerCreate.addArgs({"--entrypoint", "/bin/sh", m_data.imageId});

View File

@@ -33,6 +33,7 @@
#include "../kitinformation.h"
#include "../runconfiguration.h"
#include <coreplugin/icore.h>
#include <ssh/sshconnection.h>
#include <utils/displayname.h>
#include <utils/icon.h>
@@ -153,6 +154,7 @@ public:
QSsh::SshConnectionParameters sshParameters;
PortList freePorts;
FilePath debugServerPath;
FilePath debugDumperPath = Core::ICore::resourcePath("debugger/");
FilePath qmlRunCommand;
bool emptyCommandAllowed = false;
@@ -763,6 +765,16 @@ void IDevice::setDebugServerPath(const FilePath &path)
d->debugServerPath = path;
}
FilePath IDevice::debugDumperPath() const
{
return d->debugDumperPath;
}
void IDevice::setDebugDumperPath(const Utils::FilePath &path)
{
d->debugDumperPath = path;
}
FilePath IDevice::qmlRunCommand() const
{
return d->qmlRunCommand;

View File

@@ -217,6 +217,9 @@ public:
Utils::FilePath debugServerPath() const;
void setDebugServerPath(const Utils::FilePath &path);
Utils::FilePath debugDumperPath() const;
void setDebugDumperPath(const Utils::FilePath &path);
Utils::FilePath qmlRunCommand() const;
void setQmlRunCommand(const Utils::FilePath &path);