diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index 101ff39dbab6..dd6a93a12a6e 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -91,6 +91,7 @@ struct db_variable db_regs[] = { { "r15", DB_OFFSET(tf_r15), db_frame }, { "rip", DB_OFFSET(tf_rip), db_frame }, { "rflags", DB_OFFSET(tf_rflags), db_frame }, +#define DB_N_SHOW_REGS 20 /* Don't show registers after here. */ { "dr0", NULL, db_dr0 }, { "dr1", NULL, db_dr1 }, { "dr2", NULL, db_dr2 }, @@ -100,7 +101,7 @@ struct db_variable db_regs[] = { { "dr6", NULL, db_dr6 }, { "dr7", NULL, db_dr7 }, }; -struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); +struct db_variable *db_eregs = db_regs + DB_N_SHOW_REGS; #define DB_DRX_FUNC(reg) \ static int \ diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index c3ea8ac5c9d1..3bcb795fd14b 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -80,6 +80,7 @@ struct db_variable db_regs[] = { { "edi", DB_OFFSET(tf_edi), db_frame }, { "eip", DB_OFFSET(tf_eip), db_frame }, { "efl", DB_OFFSET(tf_eflags), db_frame }, +#define DB_N_SHOW_REGS 15 /* Don't show registers after here. */ { "dr0", NULL, db_dr0 }, { "dr1", NULL, db_dr1 }, { "dr2", NULL, db_dr2 }, @@ -89,7 +90,7 @@ struct db_variable db_regs[] = { { "dr6", NULL, db_dr6 }, { "dr7", NULL, db_dr7 }, }; -struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); +struct db_variable *db_eregs = db_regs + DB_N_SHOW_REGS; #define DB_DRX_FUNC(reg) \ static int \