*/
#include <debug.h>
-#include <mach_kdb.h>
#include <mach_kdp.h>
-#include <platforms.h>
#include <mach/boolean.h>
#include <kern/cpu_number.h>
-#include <kern/lock.h>
#include <kern/thread.h>
#include <kern/sched_prim.h>
#include <kern/misc_protos.h>
#endif
#include <console/serial_protos.h>
-#ifdef __ppc__
-#include <ppc/Firmware.h>
-#endif
-
#define isdigit(d) ((d) >= '0' && (d) <= '9')
#define Ctod(c) ((c) - '0')
#define MAXBUF (sizeof(long long int) * 8) /* enough for binary */
static char digs[] = "0123456789abcdef";
-
#if CONFIG_NO_PRINTF_STRINGS
/* Prevent CPP from breaking the definition below */
#undef printf
boolean_t _doprnt_truncates = FALSE;
+#if (DEVELOPMENT || DEBUG)
+boolean_t doprnt_hide_pointers = FALSE;
+#else
+boolean_t doprnt_hide_pointers = TRUE;
+#endif
+
int
__doprnt(
const char *fmt,
/* character output routine */
void (*putc)(int, void *arg),
void *arg,
- int radix) /* default radix - for '%r' */
+ int radix, /* default radix - for '%r' */
+ int is_log)
{
int length;
int prec;
if (truncate) u = (long long)((int)(u));
+ if (doprnt_hide_pointers && is_log) {
+ const char str[] = "<ptr>";
+ const char* strp = str;
+ int strl = sizeof(str) - 1;
+
+ if (u >= VM_MIN_KERNEL_AND_KEXT_ADDRESS && u <= VM_MAX_KERNEL_ADDRESS) {
+ while(*strp != '\0') {
+ (*putc)(*strp, arg);
+ strp++;
+ }
+ nprinted += strl;
+ break;
+ }
+ }
+
if (u != 0 && altfmt) {
if (base == 8)
prefix = "0";
void (*putc)(char),
int radix) /* default radix - for '%r' */
{
- __doprnt(fmt, *argp, dummy_putc, putc, radix);
+ __doprnt(fmt, *argp, dummy_putc, putc, radix, FALSE);
+}
+
+void
+_doprnt_log(
+ register const char *fmt,
+ va_list *argp,
+ /* character output routine */
+ void (*putc)(char),
+ int radix) /* default radix - for '%r' */
+{
+ __doprnt(fmt, *argp, dummy_putc, putc, radix, TRUE);
}
#if MP_PRINTF
#endif
}
-#if MACH_KDB
-extern void db_putchar(char c);
-#endif
-
void
-dbugprintf(__unused const char *fmt, ...)
+cons_putc_locked(
+ char c)
{
-
-#if MACH_KDB
- va_list listp;
-
- va_start(listp, fmt);
- _doprnt(fmt, &listp, db_putchar, 16);
- va_end(listp);
-#endif
- return;
+ if ((debug_mode && !disable_debug_output) || !disableConsoleOutput)
+ cnputc(c);
}
int
if (fmt) {
disable_preemption();
va_start(listp, fmt);
- _doprnt(fmt, &listp, conslog_putc, 16);
+ _doprnt_log(fmt, &listp, conslog_putc, 16);
va_end(listp);
enable_preemption();
}
va_list listp;
va_start(listp, fmt);
- _doprnt(fmt, &listp, consdebug_putc, 16);
+ _doprnt_log(fmt, &listp, consdebug_putc, 16);
va_end(listp);
return 0;
}
return 0;
}
+
static void
copybyte(int c, void *arg)
{
va_start(listp, fmt);
copybyte_str = buf;
- __doprnt(fmt, listp, copybyte, ©byte_str, 16);
+ __doprnt(fmt, listp, copybyte, ©byte_str, 16, FALSE);
va_end(listp);
*copybyte_str = '\0';
return (int)strlen(buf);