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