public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "ratmice at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug python/11688] wrap MI commands in python Date: Fri, 06 Jan 2012 22:14:00 -0000 [thread overview] Message-ID: <bug-11688-4717-UMJubBaLjN@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-11688-4717@http.sourceware.org/bugzilla/> http://sourceware.org/bugzilla/show_bug.cgi?id=11688 --- Comment #6 from matt rice <ratmice at gmail dot com> 2012-01-06 22:14:29 UTC --- Created attachment 6151 --> http://sourceware.org/bugzilla/attachment.cgi?id=6151 2nd implementation of ui-out for python here's the ui-out portion from my latest attempt at this separated from the mi_execute stuff, I'm not entirely pleased with the python objects this creates, as it does not always return consistent types. break-list is a nice easy way to hit all of the edge cases where ui-out does this. # first it returns None... for no breakpoints gdb.mi_execute("break-list", None)['body'] == None gdb.mi_execute("break-insert", ("main")) # then it returns a dictionary gdb.mi_execute("break-list", None)['body']['bkpt']['number'] gdb.mi_execute("break-insert", ("main")) # now its been promoted to a list as there are 2 breakpoints. gdb.mi_execute("break-list", None)['body']['bkpt'][-1]['number'] thus i am hesitant to think it returns objects of acceptable quality, unless used in a fashion which doesn't hit these edge cases. It does seem possible that we might be able to rid ourselves of these by expanding the existing ui_out_type, enum ui_out_type { ui_out_type_tuple, ui_out_type_list }; the necessary additions would be something along the lines of: ui_out_type_tuple_with_duplicate_keys ui_out_type_deprecated_tuple_list ui_out_type_deprecated_tuple_list_with_duplicate_keys (duplicate keys are the cause of object->array promotion, and empty lists/tuples are the cause of None.) that would also mean updating all callers, which seems like quite the endeavor. Other than that the code still needs lots of error handling, but alas I don't really want to finish that if the type schizophrenia means its a dead end. all of this does make me think that a 'py-mi-version' independent of mi-version for the return values might be warranted. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
next prev parent reply other threads:[~2012-01-06 22:14 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-11688-4717@http.sourceware.org/bugzilla/> 2011-08-26 7:08 ` ratmice at gmail dot com 2011-08-26 12:31 ` ratmice at gmail dot com 2011-08-28 10:34 ` tromey at redhat dot com 2011-08-29 21:06 ` ratmice at gmail dot com 2012-01-02 19:44 ` tromey at redhat dot com 2012-01-03 21:59 ` ratmice at gmail dot com 2012-01-06 22:14 ` ratmice at gmail dot com [this message] 2012-01-06 22:17 ` ratmice at gmail dot com 2012-01-06 22:18 ` ratmice at gmail dot com 2023-03-23 18:04 ` tromey at sourceware dot org 2023-03-24 12:11 ` ratmice at gmail dot com 2023-03-24 16:18 ` tromey at sourceware dot org 2023-04-04 17:10 ` tromey at sourceware dot org 2023-05-23 19:48 ` cvs-commit at gcc dot gnu.org 2023-05-24 17:00 ` 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-11688-4717-UMJubBaLjN@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).