Commit fe0bddbd authored by hjk's avatar hjk
Browse files

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: default avatarDavid Schulz <david.schulz@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent a66f0734
...@@ -520,7 +520,6 @@ class Dumper(DumperBase): ...@@ -520,7 +520,6 @@ class Dumper(DumperBase):
#warn("WATCHERS: %s" % watchers) #warn("WATCHERS: %s" % watchers)
#warn("PARTIAL: %s" % self.partialUpdate) #warn("PARTIAL: %s" % self.partialUpdate)
#warn("NO LOCALS: %s" % self.noLocals) #warn("NO LOCALS: %s" % self.noLocals)
module = sys.modules[__name__]
# #
# Locals # Locals
...@@ -1759,13 +1758,12 @@ class Dumper(DumperBase): ...@@ -1759,13 +1758,12 @@ class Dumper(DumperBase):
self.qqFormats = {} self.qqFormats = {}
self.qqEditable = {} self.qqEditable = {}
self.typeCache = {} self.typeCache = {}
module = sys.modules[__name__]
#warn("KEYS: %s " % module.__dict__.keys()) # It's __main__ from gui, gdbbridge from test. Brush over it...
for name in module.__dict__.keys(): for modname in ['__main__', 'gdbbridge']:
#warn("KEY: %s " % name) dic = sys.modules[modname].__dict__
#warn("FUNCT: %s " % module.__dict__[name]) for name in dic.keys():
self.registerDumper(name, module.__dict__[name]) self.registerDumper(name, dic[name])
result = "dumpers=[" result = "dumpers=["
for key, value in self.qqFormats.items(): for key, value in self.qqFormats.items():
......
...@@ -4936,7 +4936,12 @@ void GdbEngine::tryLoadPythonDumpers() ...@@ -4936,7 +4936,12 @@ void GdbEngine::tryLoadPythonDumpers()
const QByteArray dumperSourcePath = const QByteArray dumperSourcePath =
Core::ICore::resourcePath().toLocal8Bit() + "/debugger/"; 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.insert(1, '" + dumperSourcePath + "')", ConsoleCommand);
postCommand("python sys.path.append('" + uninstalledData + "')", ConsoleCommand);
postCommand("python from gdbbridge import *", ConsoleCommand, CB(handlePythonSetup)); postCommand("python from gdbbridge import *", ConsoleCommand, CB(handlePythonSetup));
} }
......
...@@ -893,6 +893,10 @@ void tst_Dumpers::dumper() ...@@ -893,6 +893,10 @@ void tst_Dumpers::dumper()
if (m_debuggerEngine == DumpTestGdbEngine) { if (m_debuggerEngine == DumpTestGdbEngine) {
exe = m_debuggerBinary; exe = m_debuggerBinary;
const QFileInfo gdbBinaryFile(QString::fromLatin1(exe));
const QByteArray uninstalledData = gdbBinaryFile.absolutePath().toLocal8Bit() + "/data-directory/python";
args << QLatin1String("-i") args << QLatin1String("-i")
<< QLatin1String("mi") << QLatin1String("mi")
<< QLatin1String("-quiet") << QLatin1String("-quiet")
...@@ -907,6 +911,7 @@ void tst_Dumpers::dumper() ...@@ -907,6 +911,7 @@ void tst_Dumpers::dumper()
if (m_usePython) { if (m_usePython) {
cmds += "python sys.path.insert(1, '" + dumperDir + "')\n" cmds += "python sys.path.insert(1, '" + dumperDir + "')\n"
"python sys.path.append('" + uninstalledData + "')\n"
"python from gdbbridge import *\n" "python from gdbbridge import *\n"
"run " + nograb + "\n" "run " + nograb + "\n"
"up\n" "up\n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment