summaryrefslogtreecommitdiff
path: root/sys/ddb
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2024-11-05 10:19:12 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2024-11-05 10:19:12 +0000
commitad36b8533c9f765e6dea0c44184ec253b4923ad6 (patch)
tree75318fd9e75ff9e027f7adbab261894d8eea9330 /sys/ddb
parent8341d924bc979781d662db3a73f06779aeb150ea (diff)
Correctly honour the count optional argument of the break command, by
actually not causing execution to stop until the breakpoint is hit at least count times. Noticed and fix by Nir Lichtman on tech@
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_break.c4
-rw-r--r--sys/ddb/db_run.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/ddb/db_break.c b/sys/ddb/db_break.c
index bf5253d1dd8..488c682f5e1 100644
--- a/sys/ddb/db_break.c
+++ b/sys/ddb/db_break.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_break.c,v 1.23 2023/03/08 04:43:07 guenther Exp $ */
+/* $OpenBSD: db_break.c,v 1.24 2024/11/05 10:19:11 miod Exp $ */
/* $NetBSD: db_break.c,v 1.7 1996/03/30 22:30:03 christos Exp $ */
/*
@@ -248,7 +248,7 @@ db_delete_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
void
db_breakpoint_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
- if (count == -1)
+ if (count < 1)
count = 1;
db_set_breakpoint((vaddr_t)addr, count);
diff --git a/sys/ddb/db_run.c b/sys/ddb/db_run.c
index b34a8a06591..2247549bcdb 100644
--- a/sys/ddb/db_run.c
+++ b/sys/ddb/db_run.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_run.c,v 1.31 2023/03/08 04:43:07 guenther Exp $ */
+/* $OpenBSD: db_run.c,v 1.32 2024/11/05 10:19:11 miod Exp $ */
/* $NetBSD: db_run.c,v 1.8 1996/02/05 01:57:12 christos Exp $ */
/*
@@ -98,6 +98,8 @@ db_stop_at_pc(db_regs_t *regs, int *is_breakpoint)
bkpt->count = bkpt->init_count;
*is_breakpoint = 1;
return 1; /* stop here */
+ } else {
+ return 0; /* continue */
}
} else if (*is_breakpoint
#ifdef SOFTWARE_SSTEP