2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990 Carnegie Mellon University
31 * All Rights Reserved.
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
57 * Interface to new debugger.
60 #include <platforms.h>
61 #include <time_stamp.h>
62 #include <mach_mp_debug.h>
63 #include <mach_ldebug.h>
65 #include <kern/cpu_number.h>
66 #include <kern/kern_types.h>
67 #include <kern/misc_protos.h>
70 #include <i386/thread.h>
71 #include <i386/db_machdep.h>
73 #include <i386/trap.h>
74 #include <i386/setjmp.h>
75 #include <i386/pmap.h>
76 #include <i386/misc_protos.h>
78 #include <mach/vm_param.h>
79 #include <vm/vm_map.h>
80 #include <kern/thread.h>
81 #include <kern/task.h>
83 #include <ddb/db_command.h>
84 #include <ddb/db_task_thread.h>
85 #include <ddb/db_run.h>
86 #include <ddb/db_trap.h>
87 #include <ddb/db_output.h>
88 #include <ddb/db_access.h>
89 #include <ddb/db_sym.h>
90 #include <ddb/db_break.h>
91 #include <ddb/db_watch.h>
94 int db_pass_thru
[NCPUS
];
95 struct i386_saved_state
*i386_last_saved_statep
;
96 struct i386_saved_state i386_nested_saved_state
;
97 unsigned i386_last_kdb_sp
;
99 vm_offset_t db_stacks
[NCPUS
];
101 extern thread_act_t db_default_act
;
104 extern int masked_state_cnt
[];
105 #endif /* MACH_MP_DEBUG */
108 * Enter KDB through a keyboard trap.
109 * We show the registers as of the keyboard interrupt
110 * instead of those at its call to KDB.
119 struct i386_interrupt_state
*is
;
122 extern char * trap_type
[];
123 extern int TRAP_TYPES
;
127 extern void kdbprinttrap(
132 extern void kdb_kentry(
133 struct int_regs
*int_regs
);
134 extern int db_user_to_kernel_address(
139 extern void db_write_bytes_user_space(
144 extern int db_search_null(
150 extern int kdb_enter(int);
151 extern void kdb_leave(void);
152 extern void lock_kdb(void);
153 extern void unlock_kdb(void);
156 * kdb_trap - field a TRACE or BPT trap
160 extern jmp_buf_t
*db_recover
;
161 spl_t saved_ipl
[NCPUS
]; /* just to know what IPL was before trap */
162 struct i386_saved_state
*saved_state
[NCPUS
];
165 * Translate the state saved in a task state segment into an
166 * exception frame. Since we "know" we always want the state
167 * in a ktss, we hard-wire that in, rather than indexing the gdt
168 * with tss_sel to derive a pointer to the desired tss.
173 struct i386_saved_state
*regs
)
175 extern struct i386_tss ktss
;
176 int mycpu
= cpu_number();
177 struct i386_tss
*tss
;
180 tss
= &ktss
; /* XXX */
181 #else /* NCPUS > 1 */
182 tss
= mp_ktss
[mycpu
]; /* XXX */
183 #endif /* NCPUS > 1 */
186 * ddb will overwrite whatever's in esp, so put esp0 elsewhere, too.
188 regs
->esp
= tss
->esp0
;
189 regs
->efl
= tss
->eflags
;
190 regs
->eip
= tss
->eip
;
191 regs
->trapno
= tss
->ss0
; /* XXX */
192 regs
->err
= tss
->esp0
; /* XXX */
193 regs
->eax
= tss
->eax
;
194 regs
->ecx
= tss
->ecx
;
195 regs
->edx
= tss
->edx
;
196 regs
->ebx
= tss
->ebx
;
197 regs
->uesp
= tss
->esp
;
198 regs
->ebp
= tss
->ebp
;
199 regs
->esi
= tss
->esi
;
200 regs
->edi
= tss
->edi
;
210 * Compose a call to the debugger from the saved state in regs. (No
211 * reason not to do this in C.)
215 struct i386_saved_state
*regs
)
222 return (kdb_trap(type
, code
, regs
));
229 struct i386_saved_state
*regs
)
232 boolean_t trap_from_user
;
236 case T_DEBUG
: /* single_step */
238 extern int dr_addr
[];
242 if (status
& 0xf) { /* hmm hdw break */
243 addr
= status
& 0x8 ? dr_addr
[3] :
244 status
& 0x4 ? dr_addr
[2] :
245 status
& 0x2 ? dr_addr
[1] :
248 db_single_step_cmd(addr
, 0, 1, "p");
251 case T_INT3
: /* breakpoint */
252 case T_WATCHPOINT
: /* watchpoint */
253 case -1: /* keyboard interrupt */
258 i386_nested_saved_state
= *regs
;
259 db_printf("Caught ");
260 if (type
< 0 || type
> TRAP_TYPES
)
261 db_printf("type %d", type
);
263 db_printf("%s", trap_type
[type
]);
264 db_printf(" trap, code = %x, pc = %x\n",
270 kdbprinttrap(type
, code
, (int *)®s
->eip
, regs
->uesp
);
274 disable_preemption();
275 #endif /* NCPUS > 1 */
277 saved_ipl
[cpu_number()] = s
;
278 saved_state
[cpu_number()] = regs
;
280 i386_last_saved_statep
= regs
;
281 i386_last_kdb_sp
= (unsigned) &type
;
284 if (!kdb_enter(regs
->eip
))
286 #endif /* NCPUS > 1 */
288 /* Should switch to kdb's own stack here. */
290 if (!IS_USER_TRAP(regs
, &etext
)) {
291 bzero((char *)&ddb_regs
, sizeof (ddb_regs
));
292 *(struct i386_saved_state_from_kernel
*)&ddb_regs
=
293 *(struct i386_saved_state_from_kernel
*)regs
;
294 trap_from_user
= FALSE
;
298 trap_from_user
= TRUE
;
300 if (!trap_from_user
) {
302 * Kernel mode - esp and ss not saved
304 ddb_regs
.uesp
= (int)®s
->uesp
; /* kernel stack pointer */
305 ddb_regs
.ss
= KERNEL_DS
;
309 db_task_trap(type
, code
, trap_from_user
);
312 regs
->eip
= ddb_regs
.eip
;
313 regs
->efl
= ddb_regs
.efl
;
314 regs
->eax
= ddb_regs
.eax
;
315 regs
->ecx
= ddb_regs
.ecx
;
316 regs
->edx
= ddb_regs
.edx
;
317 regs
->ebx
= ddb_regs
.ebx
;
318 if (trap_from_user
) {
320 * user mode - saved esp and ss valid
322 regs
->uesp
= ddb_regs
.uesp
; /* user stack pointer */
323 regs
->ss
= ddb_regs
.ss
& 0xffff; /* user stack segment */
325 regs
->ebp
= ddb_regs
.ebp
;
326 regs
->esi
= ddb_regs
.esi
;
327 regs
->edi
= ddb_regs
.edi
;
328 regs
->es
= ddb_regs
.es
& 0xffff;
329 regs
->cs
= ddb_regs
.cs
& 0xffff;
330 regs
->ds
= ddb_regs
.ds
& 0xffff;
331 regs
->fs
= ddb_regs
.fs
& 0xffff;
332 regs
->gs
= ddb_regs
.gs
& 0xffff;
334 if ((type
== T_INT3
) &&
335 (db_get_task_value(regs
->eip
,
338 db_target_space(current_act(),
341 regs
->eip
+= BKPT_SIZE
;
346 #endif /* NCPUS > 1 */
348 saved_state
[cpu_number()] = 0;
351 masked_state_cnt
[cpu_number()] = 0;
352 #endif /* MACH_MP_DEBUG */
356 #endif /* NCPUS > 1 */
360 /* Allow continue to upper layers of exception handling if
361 * trap was not a debugging trap.
364 if (trap_from_user
&& type
!= T_DEBUG
&& type
!= T_INT3
365 && type
!= T_WATCHPOINT
)
372 * Enter KDB through a keyboard trap.
373 * We show the registers as of the keyboard interrupt
374 * instead of those at its call to KDB.
381 struct int_regs
*int_regs
)
384 boolean_t trap_from_user
;
385 struct i386_interrupt_state
*is
= int_regs
->is
;
386 struct i386_saved_state regs
;
392 if (IS_USER_TRAP(is
, &etext
))
394 regs
.uesp
= ((int *)(is
+1))[0];
395 regs
.ss
= ((int *)(is
+1))[1];
399 regs
.uesp
= (int)(is
+1);
407 regs
.ebx
= int_regs
->ebx
;
408 regs
.ebp
= int_regs
->ebp
;
409 regs
.esi
= int_regs
->esi
;
410 regs
.edi
= int_regs
->edi
;
413 regs
.fs
= int_regs
->fs
;
414 regs
.gs
= int_regs
->gs
;
417 disable_preemption();
418 #endif /* NCPUS > 1 */
420 saved_state
[cpu_number()] = ®s
;
423 if (!kdb_enter(regs
.eip
))
425 #endif /* NCPUS > 1 */
427 bcopy((char *)®s
, (char *)&ddb_regs
, sizeof (ddb_regs
));
428 trap_from_user
= IS_USER_TRAP(&ddb_regs
, &etext
);
431 db_task_trap(-1, 0, trap_from_user
);
434 if (trap_from_user
) {
435 ((int *)(is
+1))[0] = ddb_regs
.uesp
;
436 ((int *)(is
+1))[1] = ddb_regs
.ss
& 0xffff;
438 is
->efl
= ddb_regs
.efl
;
439 is
->cs
= ddb_regs
.cs
& 0xffff;
440 is
->eip
= ddb_regs
.eip
;
441 is
->eax
= ddb_regs
.eax
;
442 is
->ecx
= ddb_regs
.ecx
;
443 is
->edx
= ddb_regs
.edx
;
444 int_regs
->ebx
= ddb_regs
.ebx
;
445 int_regs
->ebp
= ddb_regs
.ebp
;
446 int_regs
->esi
= ddb_regs
.esi
;
447 int_regs
->edi
= ddb_regs
.edi
;
448 is
->ds
= ddb_regs
.ds
& 0xffff;
449 is
->es
= ddb_regs
.es
& 0xffff;
450 int_regs
->fs
= ddb_regs
.fs
& 0xffff;
451 int_regs
->gs
= ddb_regs
.gs
& 0xffff;
456 #endif /* NCPUS > 1 */
457 saved_state
[cpu_number()] = 0;
461 #endif /* NCPUS > 1 */
478 if (type
< 0 || type
> TRAP_TYPES
)
479 db_printf("type %d", type
);
481 db_printf("%s", trap_type
[type
]);
482 db_printf(" trap, code=%x eip@%x = %x esp=%x\n",
483 code
, pc
, *(int *)pc
, sp
);
484 db_run_mode
= STEP_CONTINUE
;
488 db_user_to_kernel_address(
494 register pt_entry_t
*ptp
;
496 ptp
= pmap_pte(task
->map
->pmap
, addr
);
497 if (ptp
== PT_ENTRY_NULL
|| (*ptp
& INTEL_PTE_VALID
) == 0) {
499 db_printf("\nno memory is assigned to address %08x\n", addr
);
505 *kaddr
= (unsigned)ptetokv(*ptp
) + (addr
& (INTEL_PGBYTES
-1));
510 * Read bytes from kernel address space for debugger.
525 if (task
== kernel_task
|| task
== TASK_NULL
) {
526 while (--size
>= 0) {
527 if (addr
++ > VM_MAX_KERNEL_ADDRESS
) {
528 db_printf("\nbad address %x\n", addr
);
537 if (db_user_to_kernel_address(task
, addr
, &kern_addr
, 1) < 0)
539 src
= (char *)kern_addr
;
540 n
= intel_trunc_page(addr
+INTEL_PGBYTES
) - addr
;
551 * Write bytes to kernel address space for debugger.
563 register pt_entry_t
*ptep0
= 0;
564 pt_entry_t oldmap0
= 0;
566 register pt_entry_t
*ptep1
= 0;
567 pt_entry_t oldmap1
= 0;
570 if (task
&& task
!= kernel_task
) {
571 db_write_bytes_user_space(addr
, size
, data
, task
);
576 if (addr
>= VM_MIN_KERNEL_LOADED_ADDRESS
) {
577 db_write_bytes_user_space(addr
, size
, data
, kernel_task
);
581 if (addr
>= VM_MIN_KERNEL_ADDRESS
&&
582 addr
<= (vm_offset_t
)&etext
)
584 ptep0
= pmap_pte(kernel_pmap
, addr
);
586 *ptep0
|= INTEL_PTE_WRITE
;
588 addr1
= i386_trunc_page(addr
+ size
- 1);
589 if (i386_trunc_page(addr
) != addr1
) {
590 /* data crosses a page boundary */
592 ptep1
= pmap_pte(kernel_pmap
, addr1
);
594 *ptep1
|= INTEL_PTE_WRITE
;
601 while (--size
>= 0) {
602 if (addr
++ > VM_MAX_KERNEL_ADDRESS
) {
603 db_printf("\nbad address %x\n", addr
);
620 db_write_bytes_user_space(
631 if (db_user_to_kernel_address(task
, addr
, &kern_addr
, 1) < 0)
633 dst
= (char *)kern_addr
;
634 n
= intel_trunc_page(addr
+INTEL_PGBYTES
) - addr
;
653 if (task
== kernel_task
|| task
== TASK_NULL
) {
654 if (kernel_task
== TASK_NULL
)
657 } else if (task
== TASK_NULL
) {
658 if (current_act() == THR_ACT_NULL
)
660 task
= current_act()->task
;
663 if (db_user_to_kernel_address(task
, addr
, &kern_addr
, 0) < 0)
665 n
= intel_trunc_page(addr
+INTEL_PGBYTES
) - addr
;
681 unsigned kern_addr1
, kern_addr2
;
683 if ((addr1
& (INTEL_PGBYTES
-1)) != (addr2
& (INTEL_PGBYTES
-1)))
685 if (task1
== TASK_NULL
) {
686 if (current_act() == THR_ACT_NULL
)
688 task1
= current_act()->task
;
690 if (db_user_to_kernel_address(task1
, addr1
, &kern_addr1
, 0) < 0 ||
691 db_user_to_kernel_address(task2
, addr2
, &kern_addr2
, 0) < 0)
693 return(kern_addr1
== kern_addr2
);
696 #define DB_USER_STACK_ADDR (VM_MIN_KERNEL_ADDRESS)
697 #define DB_NAME_SEARCH_LIMIT (DB_USER_STACK_ADDR-(INTEL_PGBYTES*3))
707 register unsigned vaddr
;
708 register unsigned *kaddr
;
710 kaddr
= (unsigned *)*skaddr
;
711 for (vaddr
= *svaddr
; vaddr
> evaddr
; vaddr
-= sizeof(unsigned)) {
712 if (vaddr
% INTEL_PGBYTES
== 0) {
713 vaddr
-= sizeof(unsigned);
714 if (db_user_to_kernel_address(task
, vaddr
, skaddr
, 0) < 0)
716 kaddr
= (unsigned *)*skaddr
;
718 vaddr
-= sizeof(unsigned);
721 if ((*kaddr
== 0) ^ (flag
== 0)) {
723 *skaddr
= (unsigned)kaddr
;
736 unsigned vaddr
, kaddr
;
738 vaddr
= DB_USER_STACK_ADDR
;
742 * skip nulls at the end
744 if (db_search_null(task
, &vaddr
, DB_NAME_SEARCH_LIMIT
, &kaddr
, 0) < 0) {
745 db_printf(DB_NULL_TASK_NAME
);
749 * search start of args
751 if (db_search_null(task
, &vaddr
, DB_NAME_SEARCH_LIMIT
, &kaddr
, 1) < 0) {
752 db_printf(DB_NULL_TASK_NAME
);
756 n
= DB_TASK_NAME_LEN
-1;
757 p
= (char *)kaddr
+ sizeof(unsigned);
758 for (vaddr
+= sizeof(int); vaddr
< DB_USER_STACK_ADDR
&& n
> 0;
760 if (vaddr
% INTEL_PGBYTES
== 0) {
761 (void)db_user_to_kernel_address(task
, vaddr
, &kaddr
, 0);
764 db_printf("%c", (*p
< ' ' || *p
> '~')? ' ': *p
);
766 while (n
-- >= 0) /* compare with >= 0 for one more space */
773 db_machdep_init(void)
775 db_stacks
[0] = (vm_offset_t
)(db_stack_store
+
776 INTSTACK_SIZE
- sizeof (natural_t
));
777 dbtss
.esp0
= (int)(db_task_stack_store
+
778 INTSTACK_SIZE
- sizeof (natural_t
));
779 dbtss
.esp
= dbtss
.esp0
;
780 dbtss
.eip
= (int)&db_task_start
;
783 #else /* NCPUS > 1 */
786 * Code used to synchronize kdb among all cpus, one active at a time, switch
787 * from on to another using kdb_on! #cpu or cpu #cpu
790 decl_simple_lock_data(, kdb_lock
) /* kdb lock */
792 #define db_simple_lock_init(l, e) hw_lock_init(&((l)->interlock))
793 #define db_simple_lock_try(l) hw_lock_try(&((l)->interlock))
794 #define db_simple_unlock(l) hw_lock_unlock(&((l)->interlock))
796 int kdb_cpu
= -1; /* current cpu running kdb */
798 int kdb_is_slave
[NCPUS
];
799 int kdb_active
[NCPUS
];
800 volatile unsigned int cpus_holding_bkpts
; /* counter for number of cpus holding
801 breakpoints (ie: cpus that did not
802 insert back breakpoints) */
803 extern boolean_t db_breakpoints_inserted
;
806 db_machdep_init(void)
810 db_simple_lock_init(&kdb_lock
, ETAP_MISC_KDB
);
811 for (c
= 0; c
< NCPUS
; ++c
) {
812 db_stacks
[c
] = (vm_offset_t
) (db_stack_store
+
813 (INTSTACK_SIZE
* (c
+ 1)) - sizeof (natural_t
));
814 if (c
== master_cpu
) {
815 dbtss
.esp0
= (int)(db_task_stack_store
+
816 (INTSTACK_SIZE
* (c
+ 1)) - sizeof (natural_t
));
817 dbtss
.esp
= dbtss
.esp0
;
818 dbtss
.eip
= (int)&db_task_start
;
820 * The TSS for the debugging task on each slave CPU
821 * is set up in mp_desc_init().
828 * Called when entering kdb:
829 * Takes kdb lock. If if we were called remotely (slave state) we just
830 * wait for kdb_cpu to be equal to cpu_number(). Otherwise enter kdb if
831 * not active on another cpu.
832 * If db_pass_thru[cpu_number()] > 0, then kdb can't stop now.
842 disable_preemption();
843 #endif /* NCPUS > 1 */
845 my_cpu
= cpu_number();
847 if (db_pass_thru
[my_cpu
]) {
852 kdb_active
[my_cpu
]++;
856 db_printf("kdb_enter: cpu %d, is_slave %d, kdb_cpu %d, run mode %d pc %x (%x) holds %d\n",
857 my_cpu
, kdb_is_slave
[my_cpu
], kdb_cpu
,
858 db_run_mode
, pc
, *(int *)pc
, cpus_holding_bkpts
);
859 if (db_breakpoints_inserted
)
860 cpus_holding_bkpts
++;
861 if (kdb_cpu
== -1 && !kdb_is_slave
[my_cpu
]) {
863 remote_kdb(); /* stop other cpus */
865 } else if (kdb_cpu
== my_cpu
)
873 #endif /* NCPUS > 1 */
882 boolean_t wait
= FALSE
;
885 disable_preemption();
886 #endif /* NCPUS > 1 */
888 my_cpu
= cpu_number();
890 if (db_run_mode
== STEP_CONTINUE
) {
894 if (db_breakpoints_inserted
)
895 cpus_holding_bkpts
--;
896 if (kdb_is_slave
[my_cpu
])
897 kdb_is_slave
[my_cpu
]--;
899 db_printf("kdb_leave: cpu %d, kdb_cpu %d, run_mode %d pc %x (%x) holds %d\n",
900 my_cpu
, kdb_cpu
, db_run_mode
,
901 ddb_regs
.eip
, *(int *)ddb_regs
.eip
,
905 kdb_active
[my_cpu
]--;
909 #endif /* NCPUS > 1 */
912 while(cpus_holding_bkpts
);
921 extern void kdb_console(void);
924 disable_preemption();
925 #endif /* NCPUS > 1 */
927 my_cpu
= cpu_number();
931 if (kdb_cpu
!= -1 && kdb_cpu
!= my_cpu
) {
934 if (db_simple_lock_try(&kdb_lock
)) {
935 if (kdb_cpu
== -1 || kdb_cpu
== my_cpu
)
937 db_simple_unlock(&kdb_lock
);
943 #endif /* NCPUS > 1 */
947 extern unsigned old_time_stamp
;
948 #endif /* TIME_STAMP */
953 db_simple_unlock(&kdb_lock
);
956 #endif /* TIME_STAMP */
961 #define KDB_SAVE(type, name) extern type name; type name##_save = name
962 #define KDB_RESTORE(name) name = name##_save
964 #define KDB_SAVE(type, name) extern type name; type name/**/_save = name
965 #define KDB_RESTORE(name) name = name/**/_save
966 #endif /* __STDC__ */
968 #define KDB_SAVE_CTXT() \
969 KDB_SAVE(int, db_run_mode); \
970 KDB_SAVE(boolean_t, db_sstep_print); \
971 KDB_SAVE(int, db_loop_count); \
972 KDB_SAVE(int, db_call_depth); \
973 KDB_SAVE(int, db_inst_count); \
974 KDB_SAVE(int, db_last_inst_count); \
975 KDB_SAVE(int, db_load_count); \
976 KDB_SAVE(int, db_store_count); \
977 KDB_SAVE(boolean_t, db_cmd_loop_done); \
978 KDB_SAVE(jmp_buf_t *, db_recover); \
979 KDB_SAVE(db_addr_t, db_dot); \
980 KDB_SAVE(db_addr_t, db_last_addr); \
981 KDB_SAVE(db_addr_t, db_prev); \
982 KDB_SAVE(db_addr_t, db_next); \
983 KDB_SAVE(db_regs_t, ddb_regs);
985 #define KDB_RESTORE_CTXT() \
986 KDB_RESTORE(db_run_mode); \
987 KDB_RESTORE(db_sstep_print); \
988 KDB_RESTORE(db_loop_count); \
989 KDB_RESTORE(db_call_depth); \
990 KDB_RESTORE(db_inst_count); \
991 KDB_RESTORE(db_last_inst_count); \
992 KDB_RESTORE(db_load_count); \
993 KDB_RESTORE(db_store_count); \
994 KDB_RESTORE(db_cmd_loop_done); \
995 KDB_RESTORE(db_recover); \
996 KDB_RESTORE(db_dot); \
997 KDB_RESTORE(db_last_addr); \
998 KDB_RESTORE(db_prev); \
999 KDB_RESTORE(db_next); \
1000 KDB_RESTORE(ddb_regs);
1003 * switch to another cpu
1011 if (cpu
< 0 || cpu
>= NCPUS
|| !kdb_active
[cpu
])
1013 db_set_breakpoints();
1014 db_set_watchpoints();
1018 db_clear_breakpoints();
1019 db_clear_watchpoints();
1021 if (kdb_cpu
== -1) {/* someone continued */
1022 kdb_cpu
= cpu_number();
1023 db_continue_cmd(0, 0, 0, "");
1027 #endif /* NCPUS > 1 */
1031 boolean_t have_addr
,
1035 boolean_t reboot
= TRUE
;
1039 while ((c
= *cp
++) != 0) {
1040 if (c
== 'r') /* reboot */
1042 if (c
== 'h') /* halt */
1045 halt_all_cpus(reboot
);