This is the mail archive of the
mailing list for the elfutils project.
Re: [patch] readelf.c: Use real output width [Re: [patch] Implement reglocs for s390/s390x]
- From: Roland McGrath <roland at hack dot frob dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 10 Oct 2012 15:04:01 -0700
- Subject: Re: [patch] readelf.c: Use real output width [Re: [patch] Implement reglocs for s390/s390x]
> Yes, bad will happen:
> info.si_signo: 6, info.si_code: 0, info.si_errno: 0, cursig: 6
> info.si_signo: 6, info.si_code: 0
> info.si_errno: 0, cursig: 6
> etc., everything gets too narrow.
> Because max_width is very exaggerated there while the values here like "0" or
> "6" are in reality much shorter.
Ah, right. We don't wrap based on the actual output, but based on an
expectation of the potential size of each field. I think that's right
so that each field appears on the same line regardless of the values.
I don't seem to be understanding your code. The comment still says that
it's avoiding having the wrapping depend on the particular values. But I
can't see in the code what does that. print_core_item itself clearly now
depends on the size of the formatted string for each value. The comment
says, "the FORMAT strings typically already contain their maximum width."
But I don't see how that's so. What am I missing?
> I find the output with applied patch fine, do you see a problem there?
I prefer the old output: sigpend and sighold on separate lines,
sid on the same like with *id, pgrp.
I wonder what would happen if we just set the format-max values for the
decimal formats smaller, so they're not really the maximum width but
something more like the "common" width.
> + int i = vasprintf (&out, format, ap);
> + assert (i >= 0);
assert is questionable for what could be an ENOMEM failure.
> + va_end (ap);
> + size_t n = name_width + sizeof ": " - 1 + strlen (out);
i == strlen (out) unless the format delivered a '\0'.