+
+#if CONFIG_ZLEAKS
+extern boolean_t panic_include_ztrace;
+extern struct ztrace* top_ztrace;
+/*
+ * Prints the backtrace most suspected of being a leaker, if we paniced in the zone allocator.
+ * top_ztrace and panic_include_ztrace comes from osfmk/kern/zalloc.c
+ */
+__private_extern__ void panic_display_ztrace(void)
+{
+ if(panic_include_ztrace == TRUE) {
+ unsigned int i = 0;
+ struct ztrace top_ztrace_copy;
+
+ /* Make sure not to trip another panic if there's something wrong with memory */
+ if(ml_nofault_copy((vm_offset_t)top_ztrace, (vm_offset_t)&top_ztrace_copy, sizeof(struct ztrace)) == sizeof(struct ztrace)) {
+ kdb_printf("\nBacktrace suspected of leaking: (outstanding bytes: %lu)\n", (uintptr_t)top_ztrace_copy.zt_size);
+ /* Print the backtrace addresses */
+ for (i = 0; (i < top_ztrace_copy.zt_depth && i < MAX_ZTRACE_DEPTH) ; i++) {
+ kdb_printf("%p\n", top_ztrace_copy.zt_stack[i]);
+ }
+ /* Print any kexts in that backtrace, along with their link addresses so we can properly blame them */
+ kmod_panic_dump((vm_offset_t *)&top_ztrace_copy.zt_stack[0], top_ztrace_copy.zt_depth);
+ }
+ else {
+ kdb_printf("\nCan't access top_ztrace...\n");
+ }
+ kdb_printf("\n");
+ }
+}
+#endif /* CONFIG_ZLEAKS */
+
+#if !MACH_KDP
+static struct kdp_ether_addr kdp_current_mac_address = {{0, 0, 0, 0, 0, 0}};
+
+/* XXX ugly forward declares to stop warnings */
+void *kdp_get_interface(void);
+void kdp_set_ip_and_mac_addresses(struct kdp_in_addr *, struct kdp_ether_addr *);
+void kdp_set_gateway_mac(void *);
+void kdp_set_interface(void *);
+void kdp_register_send_receive(void *, void *);
+void kdp_unregister_send_receive(void *, void *);
+void kdp_snapshot_preflight(int, void *, uint32_t, uint32_t);
+int kdp_stack_snapshot_geterror(void);
+int kdp_stack_snapshot_bytes_traced(void);
+
+void *
+kdp_get_interface( void)
+{
+ return(void *)0;
+}
+
+unsigned int
+kdp_get_ip_address(void )
+{ return 0; }
+
+struct kdp_ether_addr
+kdp_get_mac_addr(void)
+{
+ return kdp_current_mac_address;
+}
+
+void
+kdp_set_ip_and_mac_addresses(
+ __unused struct kdp_in_addr *ipaddr,
+ __unused struct kdp_ether_addr *macaddr)
+{}
+
+void
+kdp_set_gateway_mac(__unused void *gatewaymac)
+{}
+
+void
+kdp_set_interface(__unused void *ifp)
+{}
+
+void
+kdp_register_send_receive(__unused void *send, __unused void *receive)
+{}
+
+void
+kdp_unregister_send_receive(__unused void *send, __unused void *receive)
+{}
+
+void
+kdp_snapshot_preflight(__unused int pid, __unused void * tracebuf,
+ __unused uint32_t tracebuf_size, __unused uint32_t options)
+{}
+
+int
+kdp_stack_snapshot_geterror(void)
+{
+ return -1;
+}
+
+int
+kdp_stack_snapshot_bytes_traced(void)
+{
+ return 0;
+}
+
+#endif
+
+#if !CONFIG_TELEMETRY
+int telemetry_gather(user_addr_t buffer __unused, uint32_t *length __unused, boolean_t mark __unused)
+{
+ return KERN_NOT_SUPPORTED;
+}
+#endif