From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15196 invoked by alias); 10 Oct 2011 18:47:14 -0000 Received: (qmail 15187 invoked by uid 22791); 10 Oct 2011 18:47:13 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Oct 2011 18:46:57 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RDKsK-0001Xb-EX from pedro_alves@mentor.com ; Mon, 10 Oct 2011 11:46:56 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 Oct 2011 19:46:54 +0100 From: Pedro Alves To: pmuldoon@redhat.com Subject: Re: Python and structured output from breakpoint_ops Date: Mon, 10 Oct 2011 18:47:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: gdb@sourceware.org, Tom Tromey References: <201110071704.27691.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201110101946.52154.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00049.txt.bz2 On Monday 10 October 2011 10:22:20, Phil Muldoon wrote: > Pedro Alves writes: > > > I still think we should cleanup the breakpoint printing machinery before > > exporting it to python. These methods were not converted to > > breakpoint_ops yet. By only considering a single string, you're leaving > > out breakpoints with multiple locations. And those will become even more > > important with Tom's linespec/multi-location rework. > > I've no problem with this as long as we have a plan in place, when we > think it will be released, etc. Right now (you) did an excellent > refactor internally, but what are the future plans? The next step is to make breakpoint_ops->print_one work with regular breakpoints. print_one_breakpoint / print_one_breakpoint_location were never converted to breakpoint_ops. This is not a case of the internal abstractions being too detailed/internal to want to expose to python. Rather it's a case of the internal abstraction not being good even for GDBs own internals! If we fix this (pick print_one_breakpoint / print_one_breakpoint_location apart in a way that the core breakpoint print code doesn't know about specific breakpoint types), then you win a good python abstraction as a co/by-product. IOW, or from a different angle, if you come up with a nice python abstraction for this, there's no reason that the core wouldn't want the same nice abstraction too. But only by cleaning up the core can you know you _have_ a good abstraction. > When do we plan to have them in place? The usual tricky question ;) Ah, if days had infinite hours... :-) I don't have time presently to work on that myself until next January. > I guess I am asking what you mean by clean-ups in this context? See above. > >> It seems like it could have multiple lines, just nothing does this yet. > > > > Yeah. Random catchpoints are likely to want it. > > In a deeper context, fully implementing catchpoint creation in Python > seems quite tricky. Many of the catchpoint APIs seem to need to know > about deep internal GDB state. Do we want to expose those decisions > coupled with that information externally? We made a promise with the > Python API that it will be stable. I've not really though about this > too much yet; there might be a clean answer just around the corner. Catchpoints that I'd find useful to write in python would for example be things like putting a breakpoint in a special routine in your special domain specific or embedded OS runtime -- "catch my-special-event". You'd want to hide the fact that that's implemented by placing a breakpoint, and the support is all there (I believe). > >> Phil> In fact, if you look at the mi command -break-list, it just maps > >> Phil> to info break and captures that output. Maybe that conversation > >> Phil> is what Jan was talking about when there is an explicit mention > >> Phil> that any field change has to be made by Vlad? > > > > The thing is that the fields that are output aren't constrained at all > > by the "address" / "what" columns you see in the CLI. Look at all > > the "ui_out_*" calls. It seems quite reasonable to me to be able to > > output random fields from python too, so you could implement new > > breakpoint/catchpoints in python and forward whatever necessary info > > to the frontend through MI. > > Doing that from Python would be a good idea, I agree. We could have a > field:data structure for the user to output whatever they wish, and MI > could be taught to learn, beyond the usual fields it expects, there are > "extra" fields: ignore them or print them. I'm not sure why the > explicit field creations needs express approval from Vlad. Are MI > clients parsing expected only fields? Order of fields? I'm not really sure I understand what you're asking. -- Pedro Alves