diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index c4c7011ea84557fee8bf4bf32c9cdeafbbbfea7d..787a84252c806006897f3be031bef20f31761472 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -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(): diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index a8dc104cb410f088a8062d911ff68102d72c9610..b0beedef7d699904065ee9ec08a260db92332fbf 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -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)); } diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index fe35584485cb0973a09cf7afadac8d85864cba39..89e9e0a507a81a7312504e9600cebec5d04cb49f 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -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"