From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3583 invoked by alias); 6 Jan 2012 22:14:51 -0000 Received: (qmail 3545 invoked by uid 22791); 6 Jan 2012 22:14:50 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Jan 2012 22:14:36 +0000 From: "ratmice at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug python/11688] wrap MI commands in python Date: Fri, 06 Jan 2012 22:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ratmice at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 7.1 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-q1/txt/msg00018.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=11688 --- Comment #6 from matt rice 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.