]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/i386/i386/db_trace.c
Merge ntpd & friends 4.2.4p5 from vendor/ntp/dist into head. Next commit
[FreeBSD/FreeBSD.git] / sys / i386 / i386 / db_trace.c
1 /*-
2  * Mach Operating System
3  * Copyright (c) 1991,1990 Carnegie Mellon University
4  * All Rights Reserved.
5  *
6  * Permission to use, copy, modify and distribute this software and its
7  * documentation is hereby granted, provided that both the copyright
8  * notice and this permission notice appear in all copies of the
9  * software, derivative works or modified versions, and any portions
10  * thereof, and that both notices appear in supporting documentation.
11  *
12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15  *
16  * Carnegie Mellon requests users of this software to return to
17  *
18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
19  *  School of Computer Science
20  *  Carnegie Mellon University
21  *  Pittsburgh PA 15213-3890
22  *
23  * any improvements or extensions that they make and grant Carnegie the
24  * rights to redistribute these changes.
25  */
26
27 #include <sys/cdefs.h>
28 __FBSDID("$FreeBSD$");
29
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/kdb.h>
33 #include <sys/proc.h>
34 #include <sys/sysent.h>
35
36 #include <machine/cpu.h>
37 #include <machine/md_var.h>
38 #include <machine/pcb.h>
39 #include <machine/reg.h>
40 #include <machine/stack.h>
41
42 #include <vm/vm.h>
43 #include <vm/vm_param.h>
44 #include <vm/pmap.h>
45
46 #include <ddb/ddb.h>
47 #include <ddb/db_access.h>
48 #include <ddb/db_sym.h>
49 #include <ddb/db_variables.h>
50
51 static db_varfcn_t db_dr0;
52 static db_varfcn_t db_dr1;
53 static db_varfcn_t db_dr2;
54 static db_varfcn_t db_dr3;
55 static db_varfcn_t db_dr4;
56 static db_varfcn_t db_dr5;
57 static db_varfcn_t db_dr6;
58 static db_varfcn_t db_dr7;
59 static db_varfcn_t db_esp;
60 static db_varfcn_t db_frame;
61 static db_varfcn_t db_ss;
62
63 /*
64  * Machine register set.
65  */
66 #define DB_OFFSET(x)    (db_expr_t *)offsetof(struct trapframe, x)
67 struct db_variable db_regs[] = {
68         { "cs",         DB_OFFSET(tf_cs),       db_frame },
69         { "ds",         DB_OFFSET(tf_ds),       db_frame },
70         { "es",         DB_OFFSET(tf_es),       db_frame },
71         { "fs",         DB_OFFSET(tf_fs),       db_frame },
72         { "ss",         NULL,                   db_ss },
73         { "eax",        DB_OFFSET(tf_eax),      db_frame },
74         { "ecx",        DB_OFFSET(tf_ecx),      db_frame },
75         { "edx",        DB_OFFSET(tf_edx),      db_frame },
76         { "ebx",        DB_OFFSET(tf_ebx),      db_frame },
77         { "esp",        NULL,                   db_esp },
78         { "ebp",        DB_OFFSET(tf_ebp),      db_frame },
79         { "esi",        DB_OFFSET(tf_esi),      db_frame },
80         { "edi",        DB_OFFSET(tf_edi),      db_frame },
81         { "eip",        DB_OFFSET(tf_eip),      db_frame },
82         { "efl",        DB_OFFSET(tf_eflags),   db_frame },
83 #define DB_N_SHOW_REGS  15      /* Don't show registers after here. */
84         { "dr0",        NULL,                   db_dr0 },
85         { "dr1",        NULL,                   db_dr1 },
86         { "dr2",        NULL,                   db_dr2 },
87         { "dr3",        NULL,                   db_dr3 },
88         { "dr4",        NULL,                   db_dr4 },
89         { "dr5",        NULL,                   db_dr5 },
90         { "dr6",        NULL,                   db_dr6 },
91         { "dr7",        NULL,                   db_dr7 },
92 };
93 struct db_variable *db_eregs = db_regs + DB_N_SHOW_REGS;
94
95 #define DB_DRX_FUNC(reg)                \
96 static int                              \
97 db_ ## reg (vp, valuep, op)             \
98         struct db_variable *vp;         \
99         db_expr_t * valuep;             \
100         int op;                         \
101 {                                       \
102         if (op == DB_VAR_GET)           \
103                 *valuep = r ## reg ();  \
104         else                            \
105                 load_ ## reg (*valuep); \
106         return (1);                     \
107 }
108
109 DB_DRX_FUNC(dr0)
110 DB_DRX_FUNC(dr1)
111 DB_DRX_FUNC(dr2)
112 DB_DRX_FUNC(dr3)
113 DB_DRX_FUNC(dr4)
114 DB_DRX_FUNC(dr5)
115 DB_DRX_FUNC(dr6)
116 DB_DRX_FUNC(dr7)
117
118 static __inline int
119 get_esp(struct trapframe *tf)
120 {
121         return ((ISPL(tf->tf_cs)) ? tf->tf_esp :
122             (db_expr_t)tf + (uintptr_t)DB_OFFSET(tf_esp));
123 }
124
125 static int
126 db_frame(struct db_variable *vp, db_expr_t *valuep, int op)
127 {
128         int *reg;
129
130         if (kdb_frame == NULL)
131                 return (0);
132
133         reg = (int *)((uintptr_t)kdb_frame + (db_expr_t)vp->valuep);
134         if (op == DB_VAR_GET)
135                 *valuep = *reg;
136         else
137                 *reg = *valuep;
138         return (1);
139 }
140
141 static int
142 db_esp(struct db_variable *vp, db_expr_t *valuep, int op)
143 {
144
145         if (kdb_frame == NULL)
146                 return (0);
147
148         if (op == DB_VAR_GET)
149                 *valuep = get_esp(kdb_frame);
150         else if (ISPL(kdb_frame->tf_cs))
151                 kdb_frame->tf_esp = *valuep;
152         return (1);
153 }
154
155 static int
156 db_ss(struct db_variable *vp, db_expr_t *valuep, int op)
157 {
158
159         if (kdb_frame == NULL)
160                 return (0);
161
162         if (op == DB_VAR_GET)
163                 *valuep = (ISPL(kdb_frame->tf_cs)) ? kdb_frame->tf_ss : rss();
164         else if (ISPL(kdb_frame->tf_cs))
165                 kdb_frame->tf_ss = *valuep;
166         return (1);
167 }
168
169 #define NORMAL          0
170 #define TRAP            1
171 #define INTERRUPT       2
172 #define SYSCALL         3
173 #define DOUBLE_FAULT    4
174 #define TRAP_INTERRUPT  5
175
176 static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *);
177 static int db_numargs(struct i386_frame *);
178 static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t);
179 static void decode_syscall(int, struct thread *);
180
181 static const char * watchtype_str(int type);
182 int  i386_set_watch(int watchnum, unsigned int watchaddr, int size, int access,
183                     struct dbreg *d);
184 int  i386_clr_watch(int watchnum, struct dbreg *d);
185
186 /*
187  * Figure out how many arguments were passed into the frame at "fp".
188  */
189 static int
190 db_numargs(fp)
191         struct i386_frame *fp;
192 {
193         char   *argp;
194         int     inst;
195         int     args;
196
197         argp = (char *)db_get_value((int)&fp->f_retaddr, 4, FALSE);
198         /*
199          * XXX etext is wrong for LKMs.  We should attempt to interpret
200          * the instruction at the return address in all cases.  This
201          * may require better fault handling.
202          */
203         if (argp < btext || argp >= etext) {
204                 args = -1;
205         } else {
206 retry:
207                 inst = db_get_value((int)argp, 4, FALSE);
208                 if ((inst & 0xff) == 0x59)      /* popl %ecx */
209                         args = 1;
210                 else if ((inst & 0xffff) == 0xc483)     /* addl $Ibs, %esp */
211                         args = ((inst >> 16) & 0xff) / 4;
212                 else if ((inst & 0xf8ff) == 0xc089) {   /* movl %eax, %Reg */
213                         argp += 2;
214                         goto retry;
215                 } else
216                         args = -1;
217         }
218         return (args);
219 }
220
221 static void
222 db_print_stack_entry(name, narg, argnp, argp, callpc)
223         const char *name;
224         int narg;
225         char **argnp;
226         int *argp;
227         db_addr_t callpc;
228 {
229         int n = narg >= 0 ? narg : 5;
230
231         db_printf("%s(", name);
232         while (n) {
233                 if (argnp)
234                         db_printf("%s=", *argnp++);
235                 db_printf("%r", db_get_value((int)argp, 4, FALSE));
236                 argp++;
237                 if (--n != 0)
238                         db_printf(",");
239         }
240         if (narg < 0)
241                 db_printf(",...");
242         db_printf(") at ");
243         db_printsym(callpc, DB_STGY_PROC);
244         db_printf("\n");
245 }
246
247 static void
248 decode_syscall(int number, struct thread *td)
249 {
250         struct proc *p;
251         c_db_sym_t sym;
252         db_expr_t diff;
253         sy_call_t *f;
254         const char *symname;
255
256         db_printf(" (%d", number);
257         p = (td != NULL) ? td->td_proc : NULL;
258         if (p != NULL && 0 <= number && number < p->p_sysent->sv_size) {
259                 f = p->p_sysent->sv_table[number].sy_call;
260                 sym = db_search_symbol((db_addr_t)f, DB_STGY_ANY, &diff);
261                 if (sym != DB_SYM_NULL && diff == 0) {
262                         db_symbol_values(sym, &symname, NULL);
263                         db_printf(", %s, %s", p->p_sysent->sv_name, symname);
264                 }
265         }
266         db_printf(")");
267 }
268
269 /*
270  * Figure out the next frame up in the call stack.
271  */
272 static void
273 db_nextframe(struct i386_frame **fp, db_addr_t *ip, struct thread *td)
274 {
275         struct trapframe *tf;
276         int frame_type;
277         int eip, esp, ebp;
278         db_expr_t offset;
279         c_db_sym_t sym;
280         const char *name;
281
282         eip = db_get_value((int) &(*fp)->f_retaddr, 4, FALSE);
283         ebp = db_get_value((int) &(*fp)->f_frame, 4, FALSE);
284
285         /*
286          * Figure out frame type.  We look at the address just before
287          * the saved instruction pointer as the saved EIP is after the
288          * call function, and if the function being called is marked as
289          * dead (such as panic() at the end of dblfault_handler()), then
290          * the instruction at the saved EIP will be part of a different
291          * function (syscall() in this example) rather than the one that
292          * actually made the call.
293          */
294         frame_type = NORMAL;
295         sym = db_search_symbol(eip - 1, DB_STGY_ANY, &offset);
296         db_symbol_values(sym, &name, NULL);
297         if (name != NULL) {
298                 if (strcmp(name, "calltrap") == 0 ||
299                     strcmp(name, "fork_trampoline") == 0)
300                         frame_type = TRAP;
301                 else if (strncmp(name, "Xatpic_intr", 11) == 0 ||
302                     strncmp(name, "Xapic_isr", 9) == 0)
303                         frame_type = INTERRUPT;
304                 else if (strcmp(name, "Xlcall_syscall") == 0 ||
305                     strcmp(name, "Xint0x80_syscall") == 0)
306                         frame_type = SYSCALL;
307                 else if (strcmp(name, "dblfault_handler") == 0)
308                         frame_type = DOUBLE_FAULT;
309                 /* XXX: These are interrupts with trap frames. */
310                 else if (strcmp(name, "Xtimerint") == 0 ||
311                     strcmp(name, "Xcpustop") == 0 ||
312                     strcmp(name, "Xrendezvous") == 0 ||
313                     strcmp(name, "Xipi_intr_bitmap_handler") == 0 ||
314                     strcmp(name, "Xlazypmap") == 0)
315                         frame_type = TRAP_INTERRUPT;
316         }
317
318         /*
319          * Normal frames need no special processing.
320          */
321         if (frame_type == NORMAL) {
322                 *ip = (db_addr_t) eip;
323                 *fp = (struct i386_frame *) ebp;
324                 return;
325         }
326
327         db_print_stack_entry(name, 0, 0, 0, eip);
328
329         /*
330          * For a double fault, we have to snag the values from the
331          * previous TSS since a double fault uses a task gate to
332          * switch to a known good state.
333          */
334         if (frame_type == DOUBLE_FAULT) {
335                 esp = PCPU_GET(common_tss.tss_esp);
336                 eip = PCPU_GET(common_tss.tss_eip);
337                 ebp = PCPU_GET(common_tss.tss_ebp);
338                 db_printf(
339                     "--- trap 0x17, eip = %#r, esp = %#r, ebp = %#r ---\n",
340                     eip, esp, ebp);
341                 *ip = (db_addr_t) eip;
342                 *fp = (struct i386_frame *) ebp;
343                 return;
344         }
345
346         /*
347          * Point to base of trapframe which is just above the
348          * current frame.
349          */
350         if (frame_type == INTERRUPT)
351                 tf = (struct trapframe *)((int)*fp + 16);
352         else
353                 tf = (struct trapframe *)((int)*fp + 12);
354
355         if (INKERNEL((int) tf)) {
356                 esp = get_esp(tf);
357                 eip = tf->tf_eip;
358                 ebp = tf->tf_ebp;
359                 switch (frame_type) {
360                 case TRAP:
361                         db_printf("--- trap %#r", tf->tf_trapno);
362                         break;
363                 case SYSCALL:
364                         db_printf("--- syscall");
365                         decode_syscall(tf->tf_eax, td);
366                         break;
367                 case TRAP_INTERRUPT:
368                 case INTERRUPT:
369                         db_printf("--- interrupt");
370                         break;
371                 default:
372                         panic("The moon has moved again.");
373                 }
374                 db_printf(", eip = %#r, esp = %#r, ebp = %#r ---\n", eip,
375                     esp, ebp);
376         }
377
378         *ip = (db_addr_t) eip;
379         *fp = (struct i386_frame *) ebp;
380 }
381
382 static int
383 db_backtrace(struct thread *td, struct trapframe *tf, struct i386_frame *frame,
384     db_addr_t pc, int count)
385 {
386         struct i386_frame *actframe;
387 #define MAXNARG 16
388         char *argnames[MAXNARG], **argnp = NULL;
389         const char *name;
390         int *argp;
391         db_expr_t offset;
392         c_db_sym_t sym;
393         int instr, narg;
394         boolean_t first;
395
396         /*
397          * If an indirect call via an invalid pointer caused a trap,
398          * %pc contains the invalid address while the return address
399          * of the unlucky caller has been saved by CPU on the stack
400          * just before the trap frame.  In this case, try to recover
401          * the caller's address so that the first frame is assigned
402          * to the right spot in the right function, for that is where
403          * the failure actually happened.
404          *
405          * This trick depends on the fault address stashed in tf_err
406          * by trap_fatal() before entering KDB.
407          */
408         if (kdb_frame && pc == kdb_frame->tf_err) {
409                 /*
410                  * Find where the trap frame actually ends.
411                  * It won't contain tf_esp or tf_ss unless crossing rings.
412                  */
413                 if (ISPL(kdb_frame->tf_cs))
414                         instr = (int)(kdb_frame + 1);
415                 else
416                         instr = (int)&kdb_frame->tf_esp;
417                 pc = db_get_value(instr, 4, FALSE);
418         }
419
420         if (count == -1)
421                 count = 1024;
422
423         first = TRUE;
424         while (count-- && !db_pager_quit) {
425                 sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
426                 db_symbol_values(sym, &name, NULL);
427
428                 /*
429                  * Attempt to determine a (possibly fake) frame that gives
430                  * the caller's pc.  It may differ from `frame' if the
431                  * current function never sets up a standard frame or hasn't
432                  * set one up yet or has just discarded one.  The last two
433                  * cases can be guessed fairly reliably for code generated
434                  * by gcc.  The first case is too much trouble to handle in
435                  * general because the amount of junk on the stack depends
436                  * on the pc (the special handling of "calltrap", etc. in
437                  * db_nextframe() works because the `next' pc is special).
438                  */
439                 actframe = frame;
440                 if (first) {
441                         if (tf != NULL) {
442                                 instr = db_get_value(pc, 4, FALSE);
443                                 if ((instr & 0xffffff) == 0x00e58955) {
444                                         /* pushl %ebp; movl %esp, %ebp */
445                                         actframe = (void *)(get_esp(tf) - 4);
446                                 } else if ((instr & 0xffff) == 0x0000e589) {
447                                         /* movl %esp, %ebp */
448                                         actframe = (void *)get_esp(tf);
449                                         if (tf->tf_ebp == 0) {
450                                                 /* Fake frame better. */
451                                                 frame = actframe;
452                                         }
453                                 } else if ((instr & 0xff) == 0x000000c3) {
454                                         /* ret */
455                                         actframe = (void *)(get_esp(tf) - 4);
456                                 } else if (offset == 0) {
457                                         /* Probably an assembler symbol. */
458                                         actframe = (void *)(get_esp(tf) - 4);
459                                 }
460                         } else if (strcmp(name, "fork_trampoline") == 0) {
461                                 /*
462                                  * Don't try to walk back on a stack for a
463                                  * process that hasn't actually been run yet.
464                                  */
465                                 db_print_stack_entry(name, 0, 0, 0, pc);
466                                 break;
467                         }
468                         first = FALSE;
469                 }
470
471                 argp = &actframe->f_arg0;
472                 narg = MAXNARG;
473                 if (sym != NULL && db_sym_numargs(sym, &narg, argnames)) {
474                         argnp = argnames;
475                 } else {
476                         narg = db_numargs(frame);
477                 }
478
479                 db_print_stack_entry(name, narg, argnp, argp, pc);
480
481                 if (actframe != frame) {
482                         /* `frame' belongs to caller. */
483                         pc = (db_addr_t)
484                             db_get_value((int)&actframe->f_retaddr, 4, FALSE);
485                         continue;
486                 }
487
488                 db_nextframe(&frame, &pc, td);
489
490                 if (INKERNEL((int)pc) && !INKERNEL((int) frame)) {
491                         sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
492                         db_symbol_values(sym, &name, NULL);
493                         db_print_stack_entry(name, 0, 0, 0, pc);
494                         break;
495                 }
496                 if (!INKERNEL((int) frame)) {
497                         break;
498                 }
499         }
500
501         return (0);
502 }
503
504 void
505 db_trace_self(void)
506 {
507         struct i386_frame *frame;
508         db_addr_t callpc;
509         register_t ebp;
510
511         __asm __volatile("movl %%ebp,%0" : "=r" (ebp));
512         frame = (struct i386_frame *)ebp;
513         callpc = (db_addr_t)db_get_value((int)&frame->f_retaddr, 4, FALSE);
514         frame = frame->f_frame;
515         db_backtrace(curthread, NULL, frame, callpc, -1);
516 }
517
518 int
519 db_trace_thread(struct thread *thr, int count)
520 {
521         struct pcb *ctx;
522
523         ctx = kdb_thr_ctx(thr);
524         return (db_backtrace(thr, NULL, (struct i386_frame *)ctx->pcb_ebp,
525                     ctx->pcb_eip, count));
526 }
527
528 int
529 i386_set_watch(watchnum, watchaddr, size, access, d)
530         int watchnum;
531         unsigned int watchaddr;
532         int size;
533         int access;
534         struct dbreg *d;
535 {
536         int i, len;
537
538         if (watchnum == -1) {
539                 for (i = 0; i < 4; i++)
540                         if (!DBREG_DR7_ENABLED(d->dr[7], i))
541                                 break;
542                 if (i < 4)
543                         watchnum = i;
544                 else
545                         return (-1);
546         }
547
548         switch (access) {
549         case DBREG_DR7_EXEC:
550                 size = 1; /* size must be 1 for an execution breakpoint */
551                 /* fall through */
552         case DBREG_DR7_WRONLY:
553         case DBREG_DR7_RDWR:
554                 break;
555         default:
556                 return (-1);
557         }
558
559         /*
560          * we can watch a 1, 2, or 4 byte sized location
561          */
562         switch (size) {
563         case 1:
564                 len = DBREG_DR7_LEN_1;
565                 break;
566         case 2:
567                 len = DBREG_DR7_LEN_2;
568                 break;
569         case 4:
570                 len = DBREG_DR7_LEN_4;
571                 break;
572         default:
573                 return (-1);
574         }
575
576         /* clear the bits we are about to affect */
577         d->dr[7] &= ~DBREG_DR7_MASK(watchnum);
578
579         /* set drN register to the address, N=watchnum */
580         DBREG_DRX(d, watchnum) = watchaddr;
581
582         /* enable the watchpoint */
583         d->dr[7] |= DBREG_DR7_SET(watchnum, len, access,
584             DBREG_DR7_GLOBAL_ENABLE);
585
586         return (watchnum);
587 }
588
589
590 int
591 i386_clr_watch(watchnum, d)
592         int watchnum;
593         struct dbreg *d;
594 {
595
596         if (watchnum < 0 || watchnum >= 4)
597                 return (-1);
598
599         d->dr[7] &= ~DBREG_DR7_MASK(watchnum);
600         DBREG_DRX(d, watchnum) = 0;
601
602         return (0);
603 }
604
605
606 int
607 db_md_set_watchpoint(addr, size)
608         db_expr_t addr;
609         db_expr_t size;
610 {
611         struct dbreg d;
612         int avail, i, wsize;
613
614         fill_dbregs(NULL, &d);
615
616         avail = 0;
617         for(i = 0; i < 4; i++) {
618                 if (!DBREG_DR7_ENABLED(d.dr[7], i))
619                         avail++;
620         }
621
622         if (avail * 4 < size)
623                 return (-1);
624
625         for (i = 0; i < 4 && (size > 0); i++) {
626                 if (!DBREG_DR7_ENABLED(d.dr[7], i)) {
627                         if (size > 2)
628                                 wsize = 4;
629                         else
630                                 wsize = size;
631                         i386_set_watch(i, addr, wsize,
632                                        DBREG_DR7_WRONLY, &d);
633                         addr += wsize;
634                         size -= wsize;
635                 }
636         }
637
638         set_dbregs(NULL, &d);
639
640         return(0);
641 }
642
643
644 int
645 db_md_clr_watchpoint(addr, size)
646         db_expr_t addr;
647         db_expr_t size;
648 {
649         struct dbreg d;
650         int i;
651
652         fill_dbregs(NULL, &d);
653
654         for(i = 0; i < 4; i++) {
655                 if (DBREG_DR7_ENABLED(d.dr[7], i)) {
656                         if ((DBREG_DRX((&d), i) >= addr) &&
657                             (DBREG_DRX((&d), i) < addr+size))
658                                 i386_clr_watch(i, &d);
659
660                 }
661         }
662
663         set_dbregs(NULL, &d);
664
665         return(0);
666 }
667
668
669 static const char *
670 watchtype_str(type)
671         int type;
672 {
673         switch (type) {
674                 case DBREG_DR7_EXEC   : return "execute";    break;
675                 case DBREG_DR7_RDWR   : return "read/write"; break;
676                 case DBREG_DR7_WRONLY : return "write";      break;
677                 default               : return "invalid";    break;
678         }
679 }
680
681
682 void
683 db_md_list_watchpoints()
684 {
685         struct dbreg d;
686         int i, len, type;
687
688         fill_dbregs(NULL, &d);
689
690         db_printf("\nhardware watchpoints:\n");
691         db_printf("  watch    status        type  len     address\n");
692         db_printf("  -----  --------  ----------  ---  ----------\n");
693         for (i = 0; i < 4; i++) {
694                 if (DBREG_DR7_ENABLED(d.dr[7], i)) {
695                         type = DBREG_DR7_ACCESS(d.dr[7], i);
696                         len = DBREG_DR7_LEN(d.dr[7], i);
697                         db_printf("  %-5d  %-8s  %10s  %3d  ",
698                             i, "enabled", watchtype_str(type), len + 1);
699                         db_printsym((db_addr_t)DBREG_DRX((&d), i), DB_STGY_ANY);
700                         db_printf("\n");
701                 } else {
702                         db_printf("  %-5d  disabled\n", i);
703                 }
704         }
705
706         db_printf("\ndebug register values:\n");
707         for (i = 0; i < 8; i++) {
708                 db_printf("  dr%d 0x%08x\n", i, DBREG_DRX((&d), i));
709         }
710         db_printf("\n");
711 }
712
713