From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30957 invoked by alias); 6 Feb 2006 23:29:22 -0000 Received: (qmail 30948 invoked by uid 22791); 6 Feb 2006 23:29:21 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 06 Feb 2006 23:29:20 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F6FnF-0008Tj-Mc; Mon, 06 Feb 2006 18:29:13 -0500 Date: Mon, 06 Feb 2006 23:29:00 -0000 From: Daniel Jacobowitz To: Markus Schiltknecht Cc: gdb-patches@sourceware.org Subject: Re: minimalistic MI catch support Message-ID: <20060206232913.GD29510@nevyn.them.org> Mail-Followup-To: Markus Schiltknecht , gdb-patches@sourceware.org References: <1138453464.15400.9.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1138453464.15400.9.camel@localhost.localdomain> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00143.txt.bz2 On Sat, Jan 28, 2006 at 02:04:24PM +0100, Markus Schiltknecht wrote: > Hello gdb hackers, > > working on an automated debugging layer on top of gdb I figured the > catchpoint functions in the MI interface is missing. The attached patch > against current CVS at least makes gdb report a catchpoint-break via MI. > This is already sufficient for my application. However, I would > appreciate a complete catchpoint implementation for the MI interface. I > haven't figured out how to implement the '-break-catch' command. If > somebody more knowledgable could do that I'd be thankfull. > > Please CC me in responses, as I'm not subscribed. Hi Markus, For the -break-catch command, I recommend you file an issue in our bug system; that won't help it get done any sooner, but at least it won't get lost. For the patch, in general it's better to avoid ui_out_is_mi_like_p when we can. Because the text outputs are ignored in non-MI mode, this is usually pretty easy; see the attached. This changes from: *stopped,thread-id="0",frame={addr="0x00002aaaaaeb6462",func="fork",args=[],from="/lib/libc.so.6"} to: *stopped,reason="breakpoint-hit",bkptno="1",forked-process="6570",thread-id="0",frame={addr="0x00002aaaaaeb6462",func="fork",args=[],from="/lib/libc.so.6"} You used fork and vfork for the reasons; I'm not sure whether these should have separate reasons or be marked as catchpoint-hit. Bob, Nick, any opinions on that? -- Daniel Jacobowitz CodeSourcery Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.221 diff -u -p -r1.221 breakpoint.c --- breakpoint.c 6 Feb 2006 21:55:05 -0000 1.221 +++ breakpoint.c 6 Feb 2006 23:28:32 -0000 @@ -2167,17 +2167,29 @@ print_it_typical (bpstat bs) case bp_catch_fork: annotate_catchpoint (bs->breakpoint_at->number); - printf_filtered (_("\nCatchpoint %d (forked process %d), "), - bs->breakpoint_at->number, - bs->breakpoint_at->forked_inferior_pid); + ui_out_text (uiout, "\nCatchpoint "); + if (ui_out_is_mi_like_p (uiout)) + ui_out_field_string (uiout, "reason", + async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT)); + ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number); + ui_out_text (uiout, " (forked process "); + ui_out_field_int (uiout, "forked-process", + bs->breakpoint_at->forked_inferior_pid); + ui_out_text (uiout, "), "); return PRINT_SRC_AND_LOC; break; case bp_catch_vfork: annotate_catchpoint (bs->breakpoint_at->number); - printf_filtered (_("\nCatchpoint %d (vforked process %d), "), - bs->breakpoint_at->number, - bs->breakpoint_at->forked_inferior_pid); + ui_out_text (uiout, "\nCatchpoint "); + if (ui_out_is_mi_like_p (uiout)) + ui_out_field_string (uiout, "reason", + async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT)); + ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number); + ui_out_text (uiout, " (vforked process "); + ui_out_field_int (uiout, "vforked-process", + bs->breakpoint_at->forked_inferior_pid); + ui_out_text (uiout, "), "); return PRINT_SRC_AND_LOC; break;