summaryrefslogtreecommitdiffstats
path: root/sys/ddb
diff options
context:
space:
mode:
authorzbb <zbb@FreeBSD.org>2015-11-27 19:03:59 +0000
committerzbb <zbb@FreeBSD.org>2015-11-27 19:03:59 +0000
commit486953399a5b9ac2d5d2e6af4189733f3a7f04cb (patch)
tree891713b60c46fa1427c7d0e19f619f334253671e /sys/ddb
parentab35544b83d7494b58b4327d7a9e6d66da7ab579 (diff)
downloadFreeBSD-src-486953399a5b9ac2d5d2e6af4189733f3a7f04cb.zip
FreeBSD-src-486953399a5b9ac2d5d2e6af4189733f3a7f04cb.tar.gz
Add helper to catch single step debug event and distinguish it from bkpt
Some architectures (including ARMv6/v7) do not have separate single step events and cannot see difference between breakpoint and single step. Add db_pc_is_singlestep() to avoid skipping instruction we stepped on to trigger debug event. This commit does not change the existing functionality but adds possibility to implement custom db_pc_is_singlestep(). Reviewed by: imp Submitted by: Zbigniew Bodek <zbb@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4036
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_run.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/ddb/db_run.c b/sys/ddb/db_run.c
index 026a9b6..5250651 100644
--- a/sys/ddb/db_run.c
+++ b/sys/ddb/db_run.c
@@ -65,16 +65,28 @@ int db_inst_count;
int db_load_count;
int db_store_count;
+#ifdef SOFTWARE_SSTEP
+db_breakpoint_t db_not_taken_bkpt = 0;
+db_breakpoint_t db_taken_bkpt = 0;
+#endif
+
#ifndef db_set_single_step
void db_set_single_step(void);
#endif
#ifndef db_clear_single_step
void db_clear_single_step(void);
#endif
-
+#ifndef db_pc_is_singlestep
+static bool
+db_pc_is_singlestep(db_addr_t pc)
+{
#ifdef SOFTWARE_SSTEP
-db_breakpoint_t db_not_taken_bkpt = 0;
-db_breakpoint_t db_taken_bkpt = 0;
+ if ((db_not_taken_bkpt != 0 && pc == db_not_taken_bkpt->address)
+ || (db_taken_bkpt != 0 && pc == db_taken_bkpt->address))
+ return (true);
+#endif
+ return (false);
+}
#endif
bool
@@ -84,11 +96,9 @@ db_stop_at_pc(bool *is_breakpoint)
db_breakpoint_t bkpt;
pc = PC_REGS();
-#ifdef SOFTWARE_SSTEP
- if ((db_not_taken_bkpt != 0 && pc == db_not_taken_bkpt->address)
- || (db_taken_bkpt != 0 && pc == db_taken_bkpt->address))
+
+ if (db_pc_is_singlestep(pc))
*is_breakpoint = false;
-#endif
db_clear_single_step();
db_clear_breakpoints();
OpenPOWER on IntegriCloud