From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/2] gdb/linux-tdep: move "Perms" column right
Date: Wed, 23 Feb 2022 16:26:17 -0500 [thread overview]
Message-ID: <20220223212617.909465-2-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20220223212617.909465-1-simon.marchi@polymtl.ca>
Commit 29ef4c0699e1 ("gdb/linux-tdep.c: Add Perms to the 'info proc
mappings' output") has broken test gdb.base/info-proc.exp on Linux,
because it changes the output of "info proc mappings" in a way that the
test does not expect (my bad for not testing before pushing).
I looked at how FreeBSD handles this, since I remembered it did show
permission flags. It looks like this:
Start Addr End Addr Size Offset Flags File
0x200000 0x243000 0x43000 0x0 r-- CN-- /usr/local/bin/tmux
(I think that `Flags` and the flags not being aligned is not
intentional)
The test passes on FreeBSD, because the test looks for four hex numbers
in a row and ignores the rest:
".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*"
I suggest fixing it on Linux by moving the flags column to the same
place as in the FreeBSD output. It makes things a bit more consistent
between OSes, and we don't have to touch the test.
At the same time, make use of the actual length of the permission's
string to specify the number of characters to print.
Before this patch, the output looks like:
Start Addr End Addr Perms Size Offset objfile
0x55dd4b544000 0x55dd4b546000 r--p 0x2000 0x0 /usr/bin/sleep
and after, it looks like:
Start Addr End Addr Size Offset Perms objfile
0x5622ae662000 0x5622ae664000 0x2000 0x0 r--p /usr/bin/sleep
Change-Id: If0fc167b010b25f97a3c54e2f491df4973ccde8f
---
gdb/linux-tdep.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 4b94a442e566..dc153e565374 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -890,15 +890,15 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
printf_filtered (_("Mapped address spaces:\n\n"));
if (gdbarch_addr_bit (gdbarch) == 32)
{
- printf_filtered ("\t%10s %10s %7s %10s %10s %s\n",
- "Start Addr", " End Addr", "Perms",
- " Size", " Offset", "objfile");
+ printf_filtered ("\t%10s %10s %10s %10s %s %s\n",
+ "Start Addr", " End Addr", " Size",
+ " Offset", "Perms ", "objfile");
}
else
{
- printf_filtered (" %18s %18s %7s %10s %10s %s\n",
- "Start Addr", " End Addr", "Perms",
- " Size", " Offset", "objfile");
+ printf_filtered (" %18s %18s %10s %10s %s %s\n",
+ "Start Addr", " End Addr", " Size",
+ " Offset", "Perms ", "objfile");
}
char *saveptr;
@@ -910,22 +910,24 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (gdbarch_addr_bit (gdbarch) == 32)
{
- printf_filtered ("\t%10s %10s %7.5s %10s %10s %s\n",
+ printf_filtered ("\t%10s %10s %10s %10s %-5.*s %s\n",
paddress (gdbarch, m.addr),
paddress (gdbarch, m.endaddr),
- m.permissions.data (),
hex_string (m.endaddr - m.addr),
hex_string (m.offset),
+ (int) m.permissions.size (),
+ m.permissions.data (),
m.filename);
}
else
{
- printf_filtered (" %18s %18s %7.5s %10s %10s %s\n",
+ printf_filtered (" %18s %18s %10s %10s %-5.*s %s\n",
paddress (gdbarch, m.addr),
paddress (gdbarch, m.endaddr),
- m.permissions.data (),
hex_string (m.endaddr - m.addr),
hex_string (m.offset),
+ (int) m.permissions.size (),
+ m.permissions.data (),
m.filename);
}
}
--
2.35.1
next prev parent reply other threads:[~2022-02-23 21:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 21:26 [PATCH 1/2] gdb/linux-tdep: make read_mapping return a structure Simon Marchi
2022-02-23 21:26 ` Simon Marchi [this message]
2022-02-23 21:41 ` [PATCH 2/2] gdb/linux-tdep: move "Perms" column right John Baldwin
2022-02-24 12:17 ` Simon Marchi
2022-02-24 12:22 ` Dominik Czarnota
2022-02-24 12:29 ` Simon Marchi
2022-05-04 22:04 ` Dominik Czarnota
2022-05-05 13:01 ` Simon Marchi
2022-02-25 18:25 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220223212617.909465-2-simon.marchi@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).