Received: from eggs.gnu.org ([2001:4830:134:3::10]:60066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLzZC-0005mq-3T for qemu-devel@nongnu.org; Tue, 17 Sep 2013 14:00:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLzZ7-0008Jp-8O for qemu-devel@nongnu.org; Tue, 17 Sep 2013 14:00:01 -0400 Message-ID: <5238988F.8050807@weilnetz.de> Date: Tue, 17 Sep 2013 19:59:43 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1379188061-7634-1-git-send-email-mjt@msgid.tls.msk.ru> <1379188061-7634-6-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1379188061-7634-6-git-send-email-mjt@msgid.tls.msk.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PULL 05/15] translate-all: Fix formatting of dump output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Anthony Liguori Am 14.09.2013 21:47, schrieb Michael Tokarev: > From: Stefan Weil > > The page dump writes a table with 3 abi_ulong values in each row. > These values take 8 or 16 characters (depending on sizeof abi_ulong). > > Fix the table headings to be aligned with the table columns. > > old: > start end size prot > 0000000120000000-000000012021e000 000000000021e000 rwx > 0000004000000000-0000004000002000 0000000000002000 --- > 0000004000002000-0000004000802000 0000000000800000 rw- > > new: > start end size prot > 0000000120000000-000000012021e000 000000000021e000 rwx > 0000004000000000-0000004000002000 0000000000002000 --- > 0000004000002000-0000004000802000 0000000000800000 rw- > > Signed-off-by: Stefan Weil > Signed-off-by: Michael Tokarev > --- > translate-all.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/translate-all.c b/translate-all.c > index 2c923c6..3b97c66 100644 > --- a/translate-all.c > +++ b/translate-all.c > @@ -1679,8 +1679,9 @@ static int dump_region(void *priv, abi_ulong star= t, > /* dump memory mappings */ > void page_dump(FILE *f) > { > - (void) fprintf(f, "%-8s %-8s %-8s %s\n", > - "start", "end", "size", "prot"); > + const size_t length =3D sizeof(abi_ulong) * 2; > + (void) fprintf(f, "%-*s %-*s %-*s %s\n", > + length, "start", length, "end", length, "size", "prot"); > walk_memory_regions(f, dump_region); > } > =20 Sorry, I just noticed that this patch causes compiler warnings on some systems: translate-all.c:1684:13: error: field width specifier =E2=80=98*=E2=80=99= expects argument of type =E2=80=98int=E2=80=99, but argument 3 has type =E2=80=98= size_t=E2=80=99 [-Werror=3Dformat] translate-all.c:1684:13: error: field width specifier =E2=80=98*=E2=80=99= expects argument of type =E2=80=98int=E2=80=99, but argument 5 has type =E2=80=98= size_t=E2=80=99 [-Werror=3Dformat] translate-all.c:1684:13: error: field width specifier =E2=80=98*=E2=80=99= expects argument of type =E2=80=98int=E2=80=99, but argument 7 has type =E2=80=98= size_t=E2=80=99 [-Werror=3Dformat] Changing the type of variable 'length' to int fixes this: + const int length =3D sizeof(abi_ulong) * 2; Regards, Stefan