[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1/5] common/vsprintf: Add %ps and %pS format specifier support
>>> On 04.11.13 at 11:55, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote: > @@ -392,6 +393,47 @@ int vsnprintf(char *buf, size_t size, const char *fmt, > va_list args) > continue; > > case 'p': > + > + /* > + * Custom %p suffixes, compatible with Linux. > + * See Linux:Documentation/printk-formats.txt > + */ > + switch ( fmt[1] ) > + { > + case 's': /* Symbol name */ > + case 'S': /* Symbol name with offset and size */ > + { > + unsigned long sym_size, sym_offset, > + addr = (unsigned long)va_arg(args, void *); > + char namebuf[KSYM_NAME_LEN+1]; > + > + s = symbols_lookup(addr, &sym_size, &sym_offset, namebuf); > + > + if ( !s || fmt[1] == 's' ) > + { > + if ( !s ) > + s = "???"; Oh, and - perhaps better to print the hex value here than hide the information on the pointer value altogether. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |