From: "Jan Beulich" Subject: Re: [PATCH 1/5] common/vsprintf: Add %ps and %pS format specifier support Date: Mon, 04 Nov 2013 14:54:30 +0000 Message-ID: <5277C33602000078000FF204@nat28.tlf.novell.com> References: <1383562539-16085-1-git-send-email-andrew.cooper3@citrix.com> <1383562539-16085-2-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VdLY5-0000pL-5v for xen-devel@lists.xenproject.org; Mon, 04 Nov 2013 14:54:37 +0000 In-Reply-To: <1383562539-16085-2-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 04.11.13 at 11:55, Andrew Cooper 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