forked from qt-creator/qt-creator
Debugger: Fix gdb command line usage of dumpers
Change-Id: I9d5924b6cac707372a95b2b31e270722a6202fc0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -79,12 +79,12 @@ def registerCommand(name, func):
|
|||||||
#
|
#
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
# Just convienience for 'python print ...'
|
# For CLI dumper use, see README.txt
|
||||||
class PPCommand(gdb.Command):
|
class PPCommand(gdb.Command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(PPCommand, self).__init__('pp', gdb.COMMAND_OBSCURE)
|
super(PPCommand, self).__init__('pp', gdb.COMMAND_OBSCURE)
|
||||||
def invoke(self, args, from_tty):
|
def invoke(self, args, from_tty):
|
||||||
print(eval(args))
|
print(theCliDumper.fetchVariable(args))
|
||||||
|
|
||||||
PPCommand()
|
PPCommand()
|
||||||
|
|
||||||
@@ -1407,7 +1407,7 @@ class CliDumper(Dumper):
|
|||||||
self.chidrenSuffix = '] '
|
self.chidrenSuffix = '] '
|
||||||
self.indent = 0
|
self.indent = 0
|
||||||
self.isCli = True
|
self.isCli = True
|
||||||
|
self.setupDumpers({})
|
||||||
|
|
||||||
def put(self, line):
|
def put(self, line):
|
||||||
if self.output.endswith('\n'):
|
if self.output.endswith('\n'):
|
||||||
@@ -1420,26 +1420,25 @@ class CliDumper(Dumper):
|
|||||||
def putOriginalAddress(self, address):
|
def putOriginalAddress(self, address):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def fetchVariables(self, args):
|
def fetchVariable(self, name):
|
||||||
|
args = {}
|
||||||
args['fancy'] = 1
|
args['fancy'] = 1
|
||||||
args['passexception'] = 1
|
args['passexception'] = 1
|
||||||
args['autoderef'] = 1
|
args['autoderef'] = 1
|
||||||
args['qobjectnames'] = 1
|
args['qobjectnames'] = 1
|
||||||
name = args['varlist']
|
args['varlist'] = name
|
||||||
self.prepare(args)
|
self.prepare(args)
|
||||||
self.output = name + ' = '
|
self.output = name + ' = '
|
||||||
frame = gdb.selected_frame()
|
value = self.parseAndEvaluate(name)
|
||||||
value = frame.read_var(name)
|
|
||||||
with TopLevelItem(self, name):
|
with TopLevelItem(self, name):
|
||||||
self.putItem(value)
|
self.putItem(value)
|
||||||
return self.output
|
return self.output
|
||||||
|
|
||||||
# Global instance.
|
|
||||||
#if gdb.parameter('height') is None:
|
# Global instances.
|
||||||
theDumper = Dumper()
|
theDumper = Dumper()
|
||||||
#else:
|
theCliDumper = CliDumper()
|
||||||
# import codecs
|
|
||||||
# theDumper = CliDumper()
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user