public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "david.docteur at intel dot com" <sourceware-bugzilla@sourceware.org> 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 [thread overview] Message-ID: <bug-18282-4717@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2015-04-20 14:32 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-04-20 14:32 david.docteur at intel dot com [this message] 2015-04-20 14:40 ` [Bug mi/18282] Pretty Printers - unable to create variable object (string value from children()) david.docteur at intel dot com 2015-04-20 15:37 ` xdje42 at gmail dot com 2015-04-21 13:03 ` david.docteur at intel dot com 2021-07-02 20:32 ` alex.zhigay at yandex dot ru 2023-08-31 16:13 ` tromey at sourceware dot org 2023-08-31 17:17 ` [Bug varobj/18282] " tromey at sourceware dot org 2023-08-31 17:54 ` tromey at sourceware dot org 2023-08-31 18:21 ` tromey at sourceware dot org 2023-09-07 20:06 ` cvs-commit at gcc dot gnu.org 2023-09-07 20:07 ` tromey at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-18282-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).