forked from qt-creator/qt-creator
Debugger: Move common dumper module code to DumperBase
Change-Id: Id411edcefbb56c480b87829062395dcb5244d2a5 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -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",
|
||||
]
|
||||
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -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):
|
||||
|
Reference in New Issue
Block a user