svn commit: r305665 - head/sys/ddb

Bruce Evans bde at FreeBSD.org
Fri Sep 9 15:53:43 UTC 2016


Author: bde
Date: Fri Sep  9 15:53:42 2016
New Revision: 305665
URL: https://svnweb.freebsd.org/changeset/base/305665

Log:
  Pass the trap type and code down from db_trap() to db_stop_at_pc() so
  that the latter can easily determine what the trap type actually is
  after callers are fixed to encode the type unambigously.
  
  ddb currently barely understands breakpoints, and it treats all
  non-breakpoints as single-step traps.  This works OK for stopping
  after every instruction when single-stepping, but is broken for
  single-stepping with a count > 1 (especially with a large count).
  ddb needs to stop on the first non-single-step trap while single-
  stepping.  Otherwise, ddb doesn't even stop the first time for
  fatal traps and external breakpoints like the one in kdb_enter().

Modified:
  head/sys/ddb/db_main.c
  head/sys/ddb/db_run.c
  head/sys/ddb/ddb.h

Modified: head/sys/ddb/db_main.c
==============================================================================
--- head/sys/ddb/db_main.c	Fri Sep  9 14:50:44 2016	(r305664)
+++ head/sys/ddb/db_main.c	Fri Sep  9 15:53:42 2016	(r305665)
@@ -226,10 +226,7 @@ db_trap(int type, int code)
 	if (cnunavailable())
 		return (0);
 
-	bkpt = IS_BREAKPOINT_TRAP(type, code);
-	watchpt = IS_WATCHPOINT_TRAP(type, code);
-
-	if (db_stop_at_pc(&bkpt)) {
+	if (db_stop_at_pc(type, code, &bkpt, &watchpt)) {
 		if (db_inst_count) {
 			db_printf("After %d instructions (%d loads, %d stores),\n",
 			    db_inst_count, db_load_count, db_store_count);

Modified: head/sys/ddb/db_run.c
==============================================================================
--- head/sys/ddb/db_run.c	Fri Sep  9 14:50:44 2016	(r305664)
+++ head/sys/ddb/db_run.c	Fri Sep  9 15:53:42 2016	(r305665)
@@ -90,13 +90,14 @@ db_pc_is_singlestep(db_addr_t pc)
 #endif
 
 bool
-db_stop_at_pc(bool *is_breakpoint)
+db_stop_at_pc(int type, int code, bool *is_breakpoint, bool *is_watchpoint)
 {
 	db_addr_t	pc;
 	db_breakpoint_t bkpt;
 
+	*is_breakpoint = IS_BREAKPOINT_TRAP(type, code);
+	*is_watchpoint = IS_WATCHPOINT_TRAP(type, code);
 	pc = PC_REGS();
-
 	if (db_pc_is_singlestep(pc))
 		*is_breakpoint = false;
 

Modified: head/sys/ddb/ddb.h
==============================================================================
--- head/sys/ddb/ddb.h	Fri Sep  9 14:50:44 2016	(r305664)
+++ head/sys/ddb/ddb.h	Fri Sep  9 15:53:42 2016	(r305665)
@@ -215,7 +215,8 @@ void		db_restart_at_pc(bool watchpt);
 int		db_set_variable(db_expr_t value);
 void		db_set_watchpoints(void);
 void		db_skip_to_eol(void);
-bool		db_stop_at_pc(bool *is_breakpoint);
+bool		db_stop_at_pc(int type, int code, bool *is_breakpoint,
+		    bool *is_watchpoint);
 #define		db_strcpy	strcpy
 void		db_trace_self(void);
 int		db_trace_thread(struct thread *, int);


More information about the svn-src-all mailing list