aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-08-30 09:49:12 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-08-30 09:49:12 +0000
commit5760d0ab881d22289d73d350db0109a060ad0136 (patch)
treedec79bf35cf96e2a2ae8064c14700bcd6f22987d /gdb/breakpoint.c
parent35e7447c0ea29b918b50b51fb2146c95d55e65d0 (diff)
downloadgdb-5760d0ab881d22289d73d350db0109a060ad0136.zip
gdb-5760d0ab881d22289d73d350db0109a060ad0136.tar.gz
gdb-5760d0ab881d22289d73d350db0109a060ad0136.tar.bz2
gdb/
Code cleanup. * breakpoint.c (bpstat_alloc): Remove unused prototype. (bpstat_alloc): Change parameters cbs to bs_link_pointer. Adjust the code. (bpstat_stop_status): Change root_bs into bs_head and bs_link. Adjust calls of bpstat_alloc. Remove explicit bs chain termination.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6d59583..a034d6a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -133,8 +133,6 @@ static void watchpoints_info (char *, int);
static int breakpoint_1 (int, int, int (*) (const struct breakpoint *));
-static bpstat bpstat_alloc (struct bp_location *, bpstat);
-
static int breakpoint_cond_eval (void *);
static void cleanup_executing_breakpoints (void *);
@@ -3436,15 +3434,17 @@ breakpoint_cond_eval (void *exp)
return i;
}
-/* Allocate a new bpstat and chain it to the current one. */
+/* Allocate a new bpstat. Link it to the FIFO list by BS_LINK_POINTER. */
static bpstat
-bpstat_alloc (struct bp_location *bl, bpstat cbs /* Current "bs" value */ )
+bpstat_alloc (struct bp_location *bl, bpstat **bs_link_pointer)
{
bpstat bs;
bs = (bpstat) xmalloc (sizeof (*bs));
- cbs->next = bs;
+ bs->next = NULL;
+ **bs_link_pointer = bs;
+ *bs_link_pointer = &bs->next;
bs->breakpoint_at = bl->owner;
bs->bp_location_at = bl;
incref_bp_location (bl);
@@ -4016,10 +4016,10 @@ bpstat_stop_status (struct address_space *aspace,
struct breakpoint *b = NULL;
struct bp_location *bl;
struct bp_location *loc;
- /* Root of the chain of bpstat's */
- struct bpstats root_bs[1];
+ /* First item of allocated bpstat's. */
+ bpstat bs_head = NULL, *bs_link = &bs_head;
/* Pointer to the last thing in the chain currently. */
- bpstat bs = root_bs;
+ bpstat bs;
int ix;
int need_remove_insert;
int removed_any;
@@ -4054,7 +4054,7 @@ bpstat_stop_status (struct address_space *aspace,
/* Come here if it's a watchpoint, or if the break address matches */
- bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
+ bs = bpstat_alloc (bl, &bs_link); /* Alloc a bpstat to explain stop */
/* Assume we stop. Should we find a watchpoint that is not
actually triggered, or if the condition of the breakpoint
@@ -4076,7 +4076,7 @@ bpstat_stop_status (struct address_space *aspace,
if (breakpoint_address_match (loc->pspace->aspace, loc->address,
aspace, bp_addr))
{
- bs = bpstat_alloc (loc, bs);
+ bs = bpstat_alloc (loc, &bs_link);
/* For hits of moribund locations, we should just proceed. */
bs->stop = 0;
bs->print = 0;
@@ -4084,16 +4084,13 @@ bpstat_stop_status (struct address_space *aspace,
}
}
- /* Terminate the chain. */
- bs->next = NULL;
-
/* Now go through the locations that caused the target to stop, and
check whether we're interested in reporting this stop to higher
layers, or whether we should resume the target transparently. */
removed_any = 0;
- for (bs = root_bs->next; bs != NULL; bs = bs->next)
+ for (bs = bs_head; bs != NULL; bs = bs->next)
{
if (!bs->stop)
continue;
@@ -4149,8 +4146,8 @@ bpstat_stop_status (struct address_space *aspace,
watching may have. Don't bother if we're stopping; this will get
done later. */
need_remove_insert = 0;
- if (! bpstat_causes_stop (root_bs->next))
- for (bs = root_bs->next; bs != NULL; bs = bs->next)
+ if (! bpstat_causes_stop (bs_head))
+ for (bs = bs_head; bs != NULL; bs = bs->next)
if (!bs->stop
&& bs->breakpoint_at
&& is_hardware_watchpoint (bs->breakpoint_at))
@@ -4164,7 +4161,7 @@ bpstat_stop_status (struct address_space *aspace,
else if (removed_any)
update_global_location_list (0);
- return root_bs->next;
+ return bs_head;
}
static void