From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31309 invoked by alias); 31 Jan 2011 15:11:51 -0000 Received: (qmail 31289 invoked by uid 22791); 31 Jan 2011 15:11:49 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 31 Jan 2011 15:11:34 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0VFBA24030845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 31 Jan 2011 10:11:11 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0VFBAhm015858; Mon, 31 Jan 2011 10:11:10 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0VFB9NR030106; Mon, 31 Jan 2011 10:11:10 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 7B1553782CA; Mon, 31 Jan 2011 08:11:09 -0700 (MST) From: Tom Tromey To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: FYI: add some breakpoint setter methods References: <20110131021033.GC2384@adacore.com> Date: Mon, 31 Jan 2011 15:12:00 -0000 In-Reply-To: <20110131021033.GC2384@adacore.com> (Joel Brobecker's message of "Mon, 31 Jan 2011 06:10:33 +0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00584.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Tom> As an aside, it seems to me that the breakpoint observers should Tom> probably take a 'struct breakpoint *' as an argument, rather than a Tom> breakpoint number. Joel> Seems like a good idea. It turns out that Volodya also wrote a patch to do async breakpoint notifications. I think he is going to post his soon; his includes this observer change. [...] Joel> Missing empty line after variable declaration (it's happening multiple Joel> times throughout the patch). Thanks. Here is what I am checking in. Tom 2011-01-31 Tom Tromey * infcmd.c (finish_backward): Use breakpoint_set_silent. * python/py-breakpoint.c (bppy_set_silent): Use breakpoint_set_silent. (bppy_set_thread): Use breakpoint_set_thread. (bppy_set_task): Use breakpoint_set_task. * breakpoint.h (breakpoint_set_silent, breakpoint_set_thread) (breakpoint_set_task): Declare. (make_breakpoint_silent): Remove. * breakpoint.c (breakpoint_set_silent): New function. (breakpoint_set_thread): Likewise. (breakpoint_set_task): Likewise. (make_breakpoint_silent): Remove. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.530 diff -u -r1.530 breakpoint.c --- breakpoint.c 31 Jan 2011 15:07:49 -0000 1.530 +++ breakpoint.c 31 Jan 2011 15:10:42 -0000 @@ -940,6 +940,46 @@ observer_notify_breakpoint_modified (b->number); } +/* Set the internal `silent' flag on the breakpoint. Note that this + is not the same as the "silent" that may appear in the breakpoint's + commands. */ + +void +breakpoint_set_silent (struct breakpoint *b, int silent) +{ + int old_silent = b->silent; + + b->silent = silent; + if (old_silent != silent) + observer_notify_breakpoint_modified (b->number); +} + +/* Set the thread for this breakpoint. If THREAD is -1, make the + breakpoint work for any thread. */ + +void +breakpoint_set_thread (struct breakpoint *b, int thread) +{ + int old_thread = b->thread; + + b->thread = thread; + if (old_thread != thread) + observer_notify_breakpoint_modified (b->number); +} + +/* Set the task for this breakpoint. If TASK is 0, make the + breakpoint work for any task. */ + +void +breakpoint_set_task (struct breakpoint *b, int task) +{ + int old_task = b->task; + + b->task = task; + if (old_task != task) + observer_notify_breakpoint_modified (b->number); +} + void check_tracepoint_command (char *line, void *closure) { @@ -10738,13 +10778,6 @@ error (_("No breakpoint number %d."), bptnum); } -void -make_breakpoint_silent (struct breakpoint *b) -{ - /* Silence the breakpoint. */ - b->silent = 1; -} - /* Command to set ignore-count of breakpoint N to COUNT. */ static void Index: breakpoint.h =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.h,v retrieving revision 1.133 diff -u -r1.133 breakpoint.h --- breakpoint.h 31 Jan 2011 15:07:49 -0000 1.133 +++ breakpoint.h 31 Jan 2011 15:10:42 -0000 @@ -1063,6 +1063,12 @@ extern void breakpoint_set_commands (struct breakpoint *b, struct command_line *commands); +extern void breakpoint_set_silent (struct breakpoint *b, int silent); + +extern void breakpoint_set_thread (struct breakpoint *b, int thread); + +extern void breakpoint_set_task (struct breakpoint *b, int task); + /* Clear the "inserted" flag in all breakpoints. */ extern void mark_breakpoints_out (void); @@ -1140,9 +1146,6 @@ Returns 0 if not, greater than 0 if we are. */ extern int catching_syscall_number (int syscall_number); -/* Tell a breakpoint to be quiet. */ -extern void make_breakpoint_silent (struct breakpoint *); - /* Return a tracepoint with the given number if found. */ extern struct breakpoint *get_tracepoint (int num); Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.276 diff -u -r1.276 infcmd.c --- infcmd.c 25 Jan 2011 17:58:59 -0000 1.276 +++ infcmd.c 31 Jan 2011 15:10:42 -0000 @@ -1545,7 +1545,7 @@ bp_breakpoint); /* Tell the breakpoint to keep quiet. We won't be done until we've done another reverse single-step. */ - make_breakpoint_silent (breakpoint); + breakpoint_set_silent (breakpoint, 1); old_chain = make_cleanup_delete_breakpoint (breakpoint); proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); /* We will be stopped when proceed returns. */ Index: python/py-breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/python/py-breakpoint.c,v retrieving revision 1.12 diff -u -r1.12 py-breakpoint.c --- python/py-breakpoint.c 26 Jan 2011 20:53:45 -0000 1.12 +++ python/py-breakpoint.c 31 Jan 2011 15:10:42 -0000 @@ -201,7 +201,7 @@ if (cmp < 0) return -1; else - self_bp->bp->silent = cmp; + breakpoint_set_silent (self_bp->bp, cmp); return 0; } @@ -242,7 +242,7 @@ return -1; } - self_bp->bp->thread = id; + breakpoint_set_thread (self_bp->bp, id); return 0; } @@ -283,7 +283,7 @@ return -1; } - self_bp->bp->task = id; + breakpoint_set_task (self_bp->bp, id); return 0; }