Debugger: Rework dumper detection

Recent versions of GDB seem to require 'make install' to find their
Python bits. Given that this is not really an option, check the
usual suspects, too.

Change-Id: I5217c0184681d4a86992fe0b8989498843b26cea
Reviewed-by: David Schulz <david.schulz@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hjk
2013-10-31 16:04:18 +01:00
parent a66f07344b
commit fe0bddbd63
3 changed files with 15 additions and 7 deletions

View File

@@ -520,7 +520,6 @@ class Dumper(DumperBase):
#warn("WATCHERS: %s" % watchers)
#warn("PARTIAL: %s" % self.partialUpdate)
#warn("NO LOCALS: %s" % self.noLocals)
module = sys.modules[__name__]
#
# Locals
@@ -1759,13 +1758,12 @@ class Dumper(DumperBase):
self.qqFormats = {}
self.qqEditable = {}
self.typeCache = {}
module = sys.modules[__name__]
#warn("KEYS: %s " % module.__dict__.keys())
for name in module.__dict__.keys():
#warn("KEY: %s " % name)
#warn("FUNCT: %s " % module.__dict__[name])
self.registerDumper(name, module.__dict__[name])
# It's __main__ from gui, gdbbridge from test. Brush over it...
for modname in ['__main__', 'gdbbridge']:
dic = sys.modules[modname].__dict__
for name in dic.keys():
self.registerDumper(name, dic[name])
result = "dumpers=["
for key, value in self.qqFormats.items():

View File

@@ -4936,7 +4936,12 @@ void GdbEngine::tryLoadPythonDumpers()
const QByteArray dumperSourcePath =
Core::ICore::resourcePath().toLocal8Bit() + "/debugger/";
const QFileInfo gdbBinaryFile(m_gdb);
const QByteArray uninstalledData = gdbBinaryFile.absolutePath().toLocal8Bit()
+ "/data-directory/python";
postCommand("python sys.path.insert(1, '" + dumperSourcePath + "')", ConsoleCommand);
postCommand("python sys.path.append('" + uninstalledData + "')", ConsoleCommand);
postCommand("python from gdbbridge import *", ConsoleCommand, CB(handlePythonSetup));
}

View File

@@ -893,6 +893,10 @@ void tst_Dumpers::dumper()
if (m_debuggerEngine == DumpTestGdbEngine) {
exe = m_debuggerBinary;
const QFileInfo gdbBinaryFile(QString::fromLatin1(exe));
const QByteArray uninstalledData = gdbBinaryFile.absolutePath().toLocal8Bit() + "/data-directory/python";
args << QLatin1String("-i")
<< QLatin1String("mi")
<< QLatin1String("-quiet")
@@ -907,6 +911,7 @@ void tst_Dumpers::dumper()
if (m_usePython) {
cmds += "python sys.path.insert(1, '" + dumperDir + "')\n"
"python sys.path.append('" + uninstalledData + "')\n"
"python from gdbbridge import *\n"
"run " + nograb + "\n"
"up\n"