From ad36b8533c9f765e6dea0c44184ec253b4923ad6 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Tue, 5 Nov 2024 10:19:12 +0000 Subject: 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@ --- sys/ddb/db_break.c | 4 ++-- sys/ddb/db_run.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/ddb') 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 -- cgit v1.2.3