diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 16dc5d2d52c..158a75691db 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -421,6 +421,16 @@ class DumperBase: self.childrenPrefix = 'children=[' self.childrenSuffix = '],' + self.dumpermodules = [ + "qttypes", + "stdtypes", + "misctypes", + "boosttypes", + "creatortypes", + "personaltypes", + ] + + def putNewline(self): pass @@ -1668,7 +1678,7 @@ class DumperBase: self.qqEditable = {} self.typeCache = {} - for mod in dumpermodules: + for mod in self.dumpermodules: m = importlib.import_module(mod) dic = m.__dict__ for name in dic.keys(): @@ -1688,7 +1698,7 @@ class DumperBase: return result def reloadDumper(self): - for mod in dumpermodules: + for mod in self.dumpermodules: m = sys.modules[mod] if sys.version_info[0] >= 3: importlib.reload(m) @@ -1697,6 +1707,11 @@ class DumperBase: findDumperFunctions() + def addDumperModule(self, path): + (head, tail) = os.path.split(path) + sys.path.insert(1, head) + self.dumpermodules.append(os.path.splitext(tail)[0]) + # Some "Enums" # Encodings. Keep that synchronized with DebuggerEncoding in debuggerprotocol.h @@ -1742,12 +1757,3 @@ DisplayUtf8String \ = range(6) -dumpermodules = [ - "qttypes", - "stdtypes", - "misctypes", - "boosttypes", - "creatortypes", - "personaltypes", -] - diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index 061ff9a239b..8840f606d1e 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -2012,10 +2012,7 @@ registerCommand("stackListFrames", stackListFrames) ####################################################################### 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)) + theDumper.addDumperModule(args) registerCommand("addExtraDumper", addExtraDumper) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 630e1fe00f0..8ac4413d512 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -43,12 +43,6 @@ currentDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentfram sys.path.insert(1, currentDir) from dumper import * -from qttypes import * -from stdtypes import * -from misctypes import * -from boosttypes import * -from creatortypes import * -from personaltypes import * lldbCmd = 'lldb' if len(sys.argv) > 1: @@ -1579,10 +1573,7 @@ class Dumper(DumperBase): self.report('success="%d",output="%s",error="%s"' % (success, output, error)) def addExtraDumper(self, args): - path = args['path'] - (head, tail) = os.path.split(path) - sys.path.insert(1, head) - dumpermodules.append(os.path.splitext(tail)[0]) + addDumperModule(args['path']) self.report('ok') def updateData(self, args):