From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: FYI: add user_breakpoint_p
Date: Fri, 28 Jan 2011 05:52:00 -0000 [thread overview]
Message-ID: <m362t9lpix.fsf@fleche.redhat.com> (raw)
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 <tromey@redhat.com>
* 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) */
next reply other threads:[~2011-01-28 2:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-28 5:52 Tom Tromey [this message]
2011-01-31 2:10 ` Joel Brobecker
2011-01-31 15:11 ` Tom Tromey
2011-02-01 3:05 ` Joel Brobecker
2011-02-01 14:31 ` Tom Tromey
2011-02-01 15:21 ` Pedro Alves
2011-02-02 14:42 ` Tom Tromey
2011-02-03 4:59 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m362t9lpix.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox