public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28914] New: 'info proc mappings' does not display memory protections
@ 2022-02-21 9:55 dominik.b.czarnota+bugzilla at gmail dot com
2022-02-21 11:28 ` [Bug gdb/28914] " dominik.b.czarnota+bugzilla at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dominik.b.czarnota+bugzilla at gmail dot com @ 2022-02-21 9:55 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28914
Bug ID: 28914
Summary: 'info proc mappings' does not display memory
protections
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: dominik.b.czarnota+bugzilla at gmail dot com
Target Milestone: ---
Hello,
The `info proc mappings` command does not display the memory pages memory
protections which are present in the `/proc/$pid/maps` file fetched by GDB and
which is sometimes helpful to understand what the memory page refers to or why
a certain exception happened (e.g. segfault on memory access to a page with no
permissions).
Said all of this, I think that the `info proc mappings` command should simply
display an additional command with memory page protections if those are
available.
This would also simplify the implementation of commands like `vmmap` in plugins
that help with low-level debugging such as Pwndbg [0] or Gef [1] which
currently does parse /proc/$pid/maps by themselves (and have to do weird hacks
when doing this on remote targets like those run with qemu-user emulation).
Below we can see the output of `info proc mappings` and the corresponding
/proc/$pid/maps file:
```
(gdb) info proc mappings
process 21673
Mapped address spaces:
Start Addr End Addr Size Offset objfile
0x555555554000 0x555555555000 0x1000 0x0 /home/dc/a.out
0x555555754000 0x555555756000 0x2000 0x0 /home/dc/a.out
0x7ffff7dd3000 0x7ffff7dfc000 0x29000 0x0
/lib/x86_64-linux-gnu/ld-2.27.so
0x7ffff7ff7000 0x7ffff7ffa000 0x3000 0x0 [vvar]
0x7ffff7ffa000 0x7ffff7ffc000 0x2000 0x0 [vdso]
0x7ffff7ffc000 0x7ffff7ffe000 0x2000 0x29000
/lib/x86_64-linux-gnu/ld-2.27.so
0x7ffff7ffe000 0x7ffff7fff000 0x1000 0x0
0x7ffffffde000 0x7ffffffff000 0x21000 0x0 [stack]
0xffffffffff600000 0xffffffffff601000 0x1000 0x0 [vsyscall]
```
Versus:
```
(gdb) !cat /proc/21673/maps
555555554000-555555555000 r-xp 00000000 fc:01 256615
/home/dc/a.out
555555754000-555555756000 rw-p 00000000 fc:01 256615
/home/dc/a.out
7ffff7dd3000-7ffff7dfc000 r-xp 00000000 fc:01 1444636
/lib/x86_64-linux-gnu/ld-2.27.so
7ffff7ff7000-7ffff7ffa000 r--p 00000000 00:00 0 [vvar]
7ffff7ffa000-7ffff7ffc000 r-xp 00000000 00:00 0 [vdso]
7ffff7ffc000-7ffff7ffe000 rw-p 00029000 fc:01 1444636
/lib/x86_64-linux-gnu/ld-2.27.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0
[stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
(gdb)
```
[0] https://github.com/pwndbg/pwndbg/
[1] https://github.com/hugsy/gef
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/28914] 'info proc mappings' does not display memory protections
2022-02-21 9:55 [Bug gdb/28914] New: 'info proc mappings' does not display memory protections dominik.b.czarnota+bugzilla at gmail dot com
@ 2022-02-21 11:28 ` dominik.b.czarnota+bugzilla at gmail dot com
2022-02-21 14:48 ` dominik.b.czarnota+bugzilla at gmail dot com
2022-02-23 14:11 ` simark at simark dot ca
2 siblings, 0 replies; 4+ messages in thread
From: dominik.b.czarnota+bugzilla at gmail dot com @ 2022-02-21 11:28 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28914
--- Comment #1 from Disconnect3d <dominik.b.czarnota+bugzilla at gmail dot com> ---
Created attachment 13991
--> https://sourceware.org/bugzilla/attachment.cgi?id=13991&action=edit
Patch that implements the feature requested in this bug report
It seems that implementing this is straightforward and so please see the
attached patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/28914] 'info proc mappings' does not display memory protections
2022-02-21 9:55 [Bug gdb/28914] New: 'info proc mappings' does not display memory protections dominik.b.czarnota+bugzilla at gmail dot com
2022-02-21 11:28 ` [Bug gdb/28914] " dominik.b.czarnota+bugzilla at gmail dot com
@ 2022-02-21 14:48 ` dominik.b.czarnota+bugzilla at gmail dot com
2022-02-23 14:11 ` simark at simark dot ca
2 siblings, 0 replies; 4+ messages in thread
From: dominik.b.czarnota+bugzilla at gmail dot com @ 2022-02-21 14:48 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28914
Disconnect3d <dominik.b.czarnota+bugzilla at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |HEAD
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/28914] 'info proc mappings' does not display memory protections
2022-02-21 9:55 [Bug gdb/28914] New: 'info proc mappings' does not display memory protections dominik.b.czarnota+bugzilla at gmail dot com
2022-02-21 11:28 ` [Bug gdb/28914] " dominik.b.czarnota+bugzilla at gmail dot com
2022-02-21 14:48 ` dominik.b.czarnota+bugzilla at gmail dot com
@ 2022-02-23 14:11 ` simark at simark dot ca
2 siblings, 0 replies; 4+ messages in thread
From: simark at simark dot ca @ 2022-02-23 14:11 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28914
Simon Marchi <simark at simark dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simark at simark dot ca
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Simon Marchi <simark at simark dot ca> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=29ef4c0699e1b46d41ade00ae07a54f979ea21cc
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-23 14:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 9:55 [Bug gdb/28914] New: 'info proc mappings' does not display memory protections dominik.b.czarnota+bugzilla at gmail dot com
2022-02-21 11:28 ` [Bug gdb/28914] " dominik.b.czarnota+bugzilla at gmail dot com
2022-02-21 14:48 ` dominik.b.czarnota+bugzilla at gmail dot com
2022-02-23 14:11 ` simark at simark dot ca
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).