X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/316670eb35587141e969394ae8537d66b9211e80..c7d2c2c6ee645e10cbccdd01c6191873ec77239d:/osfmk/kern/printf.c diff --git a/osfmk/kern/printf.c b/osfmk/kern/printf.c index 88813d844..82ad32bb9 100644 --- a/osfmk/kern/printf.c +++ b/osfmk/kern/printf.c @@ -156,10 +156,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -216,6 +214,12 @@ printnum( 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, @@ -223,7 +227,8 @@ __doprnt( /* 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; @@ -568,6 +573,21 @@ __doprnt( if (truncate) u = (long long)((int)(u)); + if (doprnt_hide_pointers && is_log) { + const char str[] = ""; + 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"; @@ -655,7 +675,18 @@ _doprnt( 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 @@ -772,7 +803,7 @@ printf(const char *fmt, ...) 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(); } @@ -817,7 +848,7 @@ kdb_printf(const char *fmt, ...) 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; } @@ -844,7 +875,6 @@ kdb_printf_unbuffered(const char *fmt, ...) return 0; } -#if !CONFIG_EMBEDDED static void copybyte(int c, void *arg) @@ -872,9 +902,8 @@ sprintf(char *buf, const char *fmt, ...) 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); } -#endif /* !CONFIG_EMBEDDED */