forked from qt-creator/qt-creator
Debugger: Add python command to add dumpers
More flexible than hacking on the C++ side. Also registers the custom dumper path to make it reloadable like the "built-in" dumpers. Change-Id: I0405f7278e28eb75d83fdd4a861f5a5c32d97a0e Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1930,8 +1930,14 @@ registerCommand("stackListFrames", stackListFrames)
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Mixed C++/Qml debugging
|
||||
# AddExtraDumpers Command
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
bbsetup()
|
||||
def addExtraDumper(args):
|
||||
(head, tail) = os.path.split(args)
|
||||
sys.path.insert(1, head)
|
||||
dumpermodules.append(os.path.splitext(tail)[0])
|
||||
return str((head, tail))
|
||||
|
||||
registerCommand("addExtraDumper", addExtraDumper)
|
||||
|
@@ -1727,25 +1727,6 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
|
||||
{
|
||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
bool needSetup = false;
|
||||
|
||||
const QString path = stringSetting(ExtraDumperFile);
|
||||
if (!path.isEmpty()) {
|
||||
QFileInfo fi(path);
|
||||
postCommand("python sys.path.insert(1, '" + fi.absolutePath().toUtf8() + "')");
|
||||
postCommand("python from " + fi.baseName().toUtf8() + " import *");
|
||||
needSetup = true;
|
||||
}
|
||||
|
||||
const QString commands = stringSetting(ExtraDumperCommands);
|
||||
if (!commands.isEmpty()) {
|
||||
postCommand(commands.toLocal8Bit());
|
||||
needSetup = true;
|
||||
}
|
||||
|
||||
if (needSetup)
|
||||
postCommand("bbsetup");
|
||||
|
||||
GdbMi data;
|
||||
data.fromStringMultiple(response.consoleStreamOutput);
|
||||
const GdbMi dumpers = data["dumpers"];
|
||||
@@ -4350,14 +4331,23 @@ void GdbEngine::startGdb(const QStringList &args)
|
||||
const GdbCommandFlags flags = ConsoleCommand | Immediate;
|
||||
postCommand("python sys.path.insert(1, '" + dumperSourcePath + "')", flags);
|
||||
postCommand("python sys.path.append('" + uninstalledData + "')", flags);
|
||||
postCommand("python from gdbbridge import *", flags, CB(handlePythonSetup));
|
||||
postCommand("python from gdbbridge import *", flags);
|
||||
|
||||
const QString path = stringSetting(ExtraDumperFile);
|
||||
if (!path.isEmpty())
|
||||
postCommand("python addExtraDumper('" + path.toUtf8() + "')", flags);
|
||||
|
||||
const QString commands = stringSetting(ExtraDumperCommands);
|
||||
if (!commands.isEmpty())
|
||||
postCommand(commands.toLocal8Bit(), flags);
|
||||
|
||||
postCommand("bbsetup", flags, CB(handlePythonSetup));
|
||||
}
|
||||
|
||||
void GdbEngine::handleGdbStartFailed()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GdbEngine::loadInitScript()
|
||||
{
|
||||
const QString script = startParameters().overrideStartScript;
|
||||
|
Reference in New Issue
Block a user