This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH 3/5] addr2line: Add -a, --address. Print address before for each entry.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 21 May 2015 15:46:17 +0200
- Subject: Re: [PATCH 3/5] addr2line: Add -a, --address. Print address before for each entry.
On Wed, 2015-05-20 at 11:22 -0700, Roland McGrath wrote:
> > static int
> > +get_addr_width (Dwfl_Module *mod)
> > +{
> > + // Try to find the address wide if possible.
>
> s/wide/width/
Fixed. One day I will learn this funky English language...
> > + if (width == 0 && mod)
>
> mod != NULL please, and other cases like that below.
Fixed 3 times.
> > + if (print_addresses)
> > + {
> > + int width = get_addr_width (mod);
> > + printf ("0x%0*" PRIx64 "\n", width, addr);
> > + }
>
> I tend to prefer %.* though it has the same effect for hex. I also tend to
> prefer %# to 0x%. IIRC, that includes the 0x in the width but not in the
> precision, so "%#.*" PRIx64 is probably best. The only real difference is
> 0x0 vs 0, but for some reason I really hate seeing "0x%".
Changed to use %.* but kept the 0x sorry. The reason is indeed the
different treatment of 0. With %# that is just inconsistent. You could
write printf ("%s%#0*" PRIx64 "\n", addr == 0 ? "0x" : "", width, addr);
but that seems silly.
Cheers,
Mark