From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11314 invoked by alias); 28 Jan 2011 02:40:23 -0000 Received: (qmail 11302 invoked by uid 22791); 28 Jan 2011 02:40:22 -0000 X-SWARE-Spam-Status: No, hits=-6.8 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; Fri, 28 Jan 2011 02:40:18 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0S2eBIZ031565 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Jan 2011 21:40:12 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0S2e6sG009015; Thu, 27 Jan 2011 21:40:07 -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 p0S2e6LK008422; Thu, 27 Jan 2011 21:40:06 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 23DF437887A; Thu, 27 Jan 2011 19:40:06 -0700 (MST) From: Tom Tromey To: gdb-patches@sourceware.org Subject: FYI: add user_breakpoint_p Date: Fri, 28 Jan 2011 05:52:00 -0000 Message-ID: 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/msg00527.txt.bz2 I am planning to check this in. I needed a `user_breakpoint_p' function for async breakpoint notifications in MI. While writing this, I noticed similar code in breakpoint.c, so this patch introduces the function and changes everyplace to use it. There was some inconsistency about whether the test should be ">= 0" or "> 0". The latter seems more correct to me, since I think user breakpoints always begin with 1. Built and regtested on x86-64 (compile farm). Tom 2011-01-27 Tom Tromey * breakpoint.h (user_breakpoint_p): Declare. * breakpoint.c (user_breakpoint_p): New function. (breakpoint_1): Use it. (save_breakpoints): Likewise. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8d0692b..c7a6484 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5064,6 +5064,15 @@ user_settable_breakpoint (const struct breakpoint *b) || is_watchpoint (b)); } +/* Return true if this breakpoint was set by the user, false if it is + internal or momentary. */ + +int +user_breakpoint_p (struct breakpoint *b) +{ + return user_settable_breakpoint (b) && b->number > 0; +} + /* Print information on user settable breakpoint (watchpoint, etc) number BNUM. If BNUM is -1 print all user-settable breakpoints. If ALLFLAG is non-zero, include non-user-settable breakpoints. If @@ -5096,8 +5105,7 @@ breakpoint_1 (int bnum, int allflag, if (filter && !filter (b)) continue; - if (allflag || (user_settable_breakpoint (b) - && b->number > 0)) + if (allflag || user_breakpoint_p (b)) { int addr_bit, type_len; @@ -5169,8 +5177,7 @@ breakpoint_1 (int bnum, int allflag, /* We only print out user settable breakpoints unless the allflag is set. */ - if (allflag || (user_settable_breakpoint (b) - && b->number > 0)) + if (allflag || user_breakpoint_p (b)) print_one_breakpoint (b, &last_loc, print_address_bits, allflag); } } @@ -11727,7 +11734,7 @@ save_breakpoints (char *filename, int from_tty, ALL_BREAKPOINTS (tp) { /* Skip internal and momentary breakpoints. */ - if (!user_settable_breakpoint (tp) || tp->number < 0) + if (! user_breakpoint_p (tp)) continue; /* If we have a filter, only save the breakpoints it accepts. */ @@ -11765,7 +11772,7 @@ save_breakpoints (char *filename, int from_tty, ALL_BREAKPOINTS (tp) { /* Skip internal and momentary breakpoints. */ - if (!user_settable_breakpoint (tp) || tp->number < 0) + if (! user_breakpoint_p (tp)) continue; /* If we have a filter, only save the breakpoints it accepts. */ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 69598a7..6eed2cd 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1184,4 +1184,6 @@ extern void end_rbreak_breakpoints (void); extern struct breakpoint *iterate_over_breakpoints (int (*) (struct breakpoint *, void *), void *); +extern int user_breakpoint_p (struct breakpoint *); + #endif /* !defined (BREAKPOINT_H) */