summaryrefslogtreecommitdiff
path: root/usr.bin/pmdb
diff options
context:
space:
mode:
authorVincent Labrecque <vincent@cvs.openbsd.org>2002-10-07 23:02:35 +0000
committerVincent Labrecque <vincent@cvs.openbsd.org>2002-10-07 23:02:35 +0000
commit855a50740f169e7b58cae5423247b6a6771b2e05 (patch)
treeb71c1918ee38b7586101c2cf0c403772e631cc0d /usr.bin/pmdb
parenta0bd6c792f6011e38ae85763d31c76f2a8d2837b (diff)
do not crash when a breakpoint can't get set (remove it
from the list when we free it.) ok art@
Diffstat (limited to 'usr.bin/pmdb')
-rw-r--r--usr.bin/pmdb/break.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/pmdb/break.c b/usr.bin/pmdb/break.c
index e87a7d516f9..94b77b5fbe3 100644
--- a/usr.bin/pmdb/break.c
+++ b/usr.bin/pmdb/break.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: break.c,v 1.5 2002/07/31 02:34:30 art Exp $ */
+/* $OpenBSD: break.c,v 1.6 2002/10/07 23:02:34 vincent Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -64,10 +64,10 @@ bkpt_find_at_pc(struct pstate *ps, reg pc)
{
struct breakpoint *bkpt;
- TAILQ_FOREACH(bkpt, &ps->ps_bkpts, bkpt_list)
+ TAILQ_FOREACH(bkpt, &ps->ps_bkpts, bkpt_list) {
if (bkpt->bkpt_pc == pc)
break;
-
+ }
return (bkpt);
}
@@ -108,6 +108,7 @@ bkpt_add_cb(struct pstate *ps, reg pc, int (*fun)(struct pstate *, void *),
TAILQ_INSERT_TAIL(&ps->ps_bkpts, bkpt, bkpt_list);
bkpt->bkpt_pc = pc;
if (bkpt_enable(ps, bkpt)) {
+ TAILQ_REMOVE(&ps->ps_bkpts, bkpt, bkpt_list);
free(bkpt);
return (-1);
}