]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/AT386/model_dep.c
xnu-3789.1.32.tar.gz
[apple/xnu.git] / osfmk / i386 / AT386 / model_dep.c
index a697ebe0f0818f7ff5fecf287cd79640331b0a2b..63daa801942fb6c51b21206e1816f4b7e7c14158 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
 #include <pexpert/i386/boot.h>
 
 #include <kdp/kdp_dyld.h>
+#include <kdp/kdp_core.h>
 #include <vm/pmap.h>
 #include <vm/vm_map.h>
 #include <vm/vm_kern.h>
 static void machine_conf(void);
 void panic_print_symbol_name(vm_address_t search);
 
-extern boolean_t init_task_died;
 extern const char      version[];
 extern char    osversion[];
 extern int             max_unsafe_quanta;
@@ -270,7 +270,9 @@ machine_startup(void)
 
        if (PE_parse_boot_argn("debug", &debug_boot_arg, sizeof (debug_boot_arg))) {
                panicDebugging = TRUE;
+#if DEVELOPMENT || DEBUG
                if (debug_boot_arg & DB_HALT) halt_in_debugger=1;
+#endif
                if (debug_boot_arg & DB_PRT) disable_debug_output=FALSE; 
                if (debug_boot_arg & DB_SLOG) systemLogDiags=TRUE; 
                if (debug_boot_arg & DB_LOG_PI_SCRN) logPanicDataToScreen=TRUE;
@@ -805,6 +807,7 @@ int reset_mem_on_reboot = 1;
 /*
  * Halt the system or reboot.
  */
+__attribute__((noreturn))
 void
 halt_all_cpus(boolean_t reboot)
 {
@@ -880,8 +883,13 @@ void
 DebuggerWithContext(
        __unused unsigned int   reason,
        __unused void           *ctx,
-       const char              *message)
+       const char              *message,
+       uint64_t                debugger_options_mask)
 {
+       if (debugger_options_mask != DEBUGGER_OPTION_NONE) {
+               kprintf("debugger options (%llx) not supported for desktop.\n", debugger_options_mask);
+       }
+
        Debugger(message);
 }
 
@@ -892,8 +900,7 @@ Debugger(
        unsigned long pi_size = 0;
        void *stackptr;
        int cn = cpu_number();
-       task_t task = current_task();
-       int     task_pid = pid_from_task(task);
+
        boolean_t old_doprnt_hide_pointers = doprnt_hide_pointers;
 
        hw_atomic_add(&debug_mode, 1);   
@@ -926,7 +933,7 @@ Debugger(
                __asm__ volatile("movq %%rbp, %0" : "=m" (stackptr));
 
                /* Print backtrace - callee is internally synchronized */
-               if (task_pid == 1 && (init_task_died)) {
+               if (strncmp(panicstr, LAUNCHD_CRASHED_PREFIX, strlen(LAUNCHD_CRASHED_PREFIX)) == 0) {
                        /* Special handling of launchd died panics */
                        print_launchd_info();
                } else {
@@ -991,7 +998,7 @@ Debugger(
                     }
                 }
 
-               if (!panicDebugging) {
+               if (!panicDebugging && !kdp_has_polled_corefile()) {
                        unsigned cnum;
                        /* Clear the MP rendezvous function lock, in the event
                         * that a panic occurred while in that codepath.
@@ -1342,9 +1349,10 @@ print_tasks_user_threads(task_t task)
                pmap = get_task_pmap(task);
                savestate = get_user_regs(thread);
                rbp = savestate->ss_64.rbp;
+               kdb_printf("\t0x%016llx\n", savestate->ss_64.isf.rip);
                print_one_backtrace(pmap, (vm_offset_t)rbp, cur_marker, TRUE, TRUE);
                kdb_printf("\n");
-               }
+       }
 }
 
 void