From cc25120377165fce305ea48d00c0513fc9b5d973 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 19 Mar 2019 15:09:37 +0100 Subject: [PATCH] Debugger: Fix gdb command line usage of dumpers Change-Id: I9d5924b6cac707372a95b2b31e270722a6202fc0 Reviewed-by: Joerg Bornemann --- share/qtcreator/debugger/gdbbridge.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index 295d178d585..cf3518d1e6d 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -79,12 +79,12 @@ def registerCommand(name, func): # ####################################################################### -# Just convienience for 'python print ...' +# For CLI dumper use, see README.txt class PPCommand(gdb.Command): def __init__(self): super(PPCommand, self).__init__('pp', gdb.COMMAND_OBSCURE) def invoke(self, args, from_tty): - print(eval(args)) + print(theCliDumper.fetchVariable(args)) PPCommand() @@ -1407,7 +1407,7 @@ class CliDumper(Dumper): self.chidrenSuffix = '] ' self.indent = 0 self.isCli = True - + self.setupDumpers({}) def put(self, line): if self.output.endswith('\n'): @@ -1420,26 +1420,25 @@ class CliDumper(Dumper): def putOriginalAddress(self, address): pass - def fetchVariables(self, args): + def fetchVariable(self, name): + args = {} args['fancy'] = 1 args['passexception'] = 1 args['autoderef'] = 1 args['qobjectnames'] = 1 - name = args['varlist'] + args['varlist'] = name self.prepare(args) self.output = name + ' = ' - frame = gdb.selected_frame() - value = frame.read_var(name) + value = self.parseAndEvaluate(name) with TopLevelItem(self, name): self.putItem(value) return self.output -# Global instance. -#if gdb.parameter('height') is None: + +# Global instances. theDumper = Dumper() -#else: -# import codecs -# theDumper = CliDumper() +theCliDumper = CliDumper() + ###################################################################### #