From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113073 invoked by alias); 20 Apr 2015 14:32:50 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 113037 invoked by uid 48); 20 Apr 2015 14:32:50 -0000 From: "david.docteur at intel dot com" To: gdb-prs@sourceware.org Subject: [Bug mi/18282] New: Pretty Printers - prints string value as char[] from children() Date: Mon, 20 Apr 2015 14:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: mi X-Bugzilla-Version: 7.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.docteur at intel dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q2/txt/msg00072.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18282 Bug ID: 18282 Summary: Pretty Printers - prints string value as char[] from children() Product: gdb Version: 7.3 Status: NEW Severity: normal Priority: P2 Component: mi Assignee: unassigned at sourceware dot org Reporter: david.docteur at intel dot com Created attachment 8255 --> https://sourceware.org/bugzilla/attachment.cgi?id=8255&action=edit Unable to create variable object issue Hi guys, I am using Eclipse Kepler, GDB 7.3.1 and working on a project with pretty printers (Python 2.7). The problem is that I am trying to display a "prettyfied" object having children and the string type is displayed as characters array. Types such as int or long are displayed properly. Those children are obtained from a Python list object such as follow: class TestPrinter: "Print a test printer" def __init__(self, val): self.val = val def to_string(self): return "map" def children(self): streetno = {"1":"testing", "2":"Dravid", "3":"Sehwag", "4":"Laxman","5":"Kohli"} for field in sorted(streetno.keys()): if field is not None: yield field, str(streetno[field]) def str_lookup_function(val): lookup_tag = val.type.tag if lookup_tag == None: return None regex = re.compile("^test$") if regex.match(lookup_tag): return TestPrinter(val) If I return a simple string from to_string() (without calling the children() function) then it works well, and displayed as a string within Eclipse in the "Value" column. But in this case, the children of my object are displayed as char[]. I can expand the content of each, which displays character by character and its ASCII value. Then, once I click on the child itself I get the following error: 1 char [33] Error: Multiple errors reported.\ Failed to execute MI command: -var-create - * &((((this)->test_object)).1) Error message from debugger back end: -var-create: unable to create variable object\ Failed to execute MI command: -var-create - * &((((this)->test_object)).1) Error message from debugger back end: -var-create: unable to create variable object\ Unable to create variable object The expected behavior would be, of course, to see the full string instead of "Error: Failed to execute MI ..." Thank you very much for your help ! -- You are receiving this mail because: You are on the CC list for the bug.