From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNctE-0002PE-Un for qemu-devel@nongnu.org; Sun, 22 Sep 2013 02:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VNctA-0003kS-1p for qemu-devel@nongnu.org; Sun, 22 Sep 2013 02:11:28 -0400 From: Stefan Weil Date: Sun, 22 Sep 2013 08:11:19 +0200 Message-Id: <1379830279-23376-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH v2] translate-all: Fix formatting of dump output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: qemu-trivial@nongnu.org, 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 --- v2: 'length' is now an int value instead of a size_t. Compilers require an int for the '*' flag. size_t causes a compiler warning in some configurations. translate-all.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/translate-all.c b/translate-all.c index 2c923c6..e7aff92 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1679,8 +1679,9 @@ static int dump_region(void *priv, abi_ulong start, /* dump memory mappings */ void page_dump(FILE *f) { - (void) fprintf(f, "%-8s %-8s %-8s %s\n", - "start", "end", "size", "prot"); + const int length = 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); } -- 1.7.10.4