From 50e303cb4449bb9bb5ed2578aba9b899de91da74 Mon Sep 17 00:00:00 2001 From: micio Date: Mon, 13 Feb 2012 23:54:57 +0000 Subject: [PATCH] ide/Debuggers/Gdb_MI2 : fixed printing of pointer and references to strings and values git-svn-id: svn://ultimatepp.org/upp/trunk@4593 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Debuggers/PrettyPrinters.py | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/uppsrc/ide/Debuggers/PrettyPrinters.py b/uppsrc/ide/Debuggers/PrettyPrinters.py index fc01e883b..4508d854f 100644 --- a/uppsrc/ide/Debuggers/PrettyPrinters.py +++ b/uppsrc/ide/Debuggers/PrettyPrinters.py @@ -195,6 +195,19 @@ class UppValuePrinter(object): else: return "" +# Upp::Value* printer +class UppValuePtrPrinter(object): + "Print an Upp::Value *" + + def __init__(self, val): + self.val = val + + def to_string(self): + return '@' + str(self.val.address) + ': ' + UppValuePrinter(self.val.dereference()).to_string() + + def display_hint(self): + return 'String' + # Upp::One<> printer class UppOnePrinter(object): @@ -210,12 +223,39 @@ def UppLookupFunction(val): if typeStr == 'Upp::String *': return UppStringPtrPrinter(val) + if typeStr == 'const Upp::String *': + return UppStringPtrPrinter(val) + + if typeStr == 'Upp::String &': + return UppStringPtrPrinter(val.address) + + if typeStr == 'const Upp::String &': + return UppStringPtrPrinter(val.address) + if typeStr == 'Upp::String': return UppStringPrinter(val) + if typeStr == 'const Upp::String': + return UppStringPrinter(val) + + if typeStr == 'Upp::Value *' and Upp_Value_Inspectors: + return UppValuePtrPrinter(val) + + if typeStr == 'const Upp::Value *' and Upp_Value_Inspectors: + return UppValuePtrPrinter(val) + + if typeStr == 'Upp::Value &' and Upp_Value_Inspectors: + return UppValuePtrPrinter(val.address) + + if typeStr == 'const Upp::Value &' and Upp_Value_Inspectors: + return UppValuePtrPrinter(val.address) + if typeStr == 'Upp::Value' and Upp_Value_Inspectors: return UppValuePrinter(val) + if typeStr == 'const Upp::Value' and Upp_Value_Inspectors: + return UppValuePrinter(val) + lookup_tag = val.type.tag if lookup_tag == None: return None