Go to file
Dominik 'Disconnect3d' Czarnota 29ef4c0699 gdb/linux-tdep.c: Add Perms to the 'info proc mappings' output
Fixes #28914 and so it adds a 'Perms' (permissions) column to the
'info proc mappings' command output. This will allow users to know
the memory pages permissions right away from GDB instead of having
to fetch them from the /proc/$pid/maps file (which is also what GDB
does internally, but it just did not print that column).

Below I am also showing how an example output looks like before and
after this commit in case someone wonders.

On i386 targets - before this commit:
```
(gdb) info proc mappings
process 3461464
Mapped address spaces:

    Start Addr   End Addr        Size     Offset objfile
    0x56555000 0x56556000      0x1000        0x0 /home/dc/src/binutils-gdb/build/a.out
    0x56556000 0x56557000      0x1000     0x1000 /home/dc/src/binutils-gdb/build/a.out
    0x56557000 0x56558000      0x1000     0x2000 /home/dc/src/binutils-gdb/build/a.out
    0x56558000 0x5655a000      0x2000     0x2000 /home/dc/src/binutils-gdb/build/a.out
    0xf7fc4000 0xf7fc8000      0x4000        0x0 [vvar]
    0xf7fc8000 0xf7fca000      0x2000        0x0 [vdso]
    0xf7fca000 0xf7fcb000      0x1000        0x0 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xf7fcb000 0xf7fee000     0x23000     0x1000 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xf7fee000 0xf7ffb000      0xd000    0x24000 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xf7ffb000 0xf7ffe000      0x3000    0x30000 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xfffdc000 0xffffe000     0x22000        0x0 [stack]
(gdb)
```

On i386 targets - after this commit:
```
(gdb) info proc mappings
process 3461464
Mapped address spaces:

    Start Addr   End Addr   Perms       Size     Offset objfile
    0x56555000 0x56556000   r--p      0x1000        0x0 /home/dc/src/binutils-gdb/build/a.out
    0x56556000 0x56557000   r-xp      0x1000     0x1000 /home/dc/src/binutils-gdb/build/a.out
    0x56557000 0x56558000   r--p      0x1000     0x2000 /home/dc/src/binutils-gdb/build/a.out
    0x56558000 0x5655a000   rw-p      0x2000     0x2000 /home/dc/src/binutils-gdb/build/a.out
    0xf7fc4000 0xf7fc8000   r--p      0x4000        0x0 [vvar]
    0xf7fc8000 0xf7fca000   r-xp      0x2000        0x0 [vdso]
    0xf7fca000 0xf7fcb000   r--p      0x1000        0x0 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xf7fcb000 0xf7fee000   r-xp     0x23000     0x1000 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xf7fee000 0xf7ffb000   r--p      0xd000    0x24000 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xf7ffb000 0xf7ffe000   rw-p      0x3000    0x30000 /usr/lib/i386-linux-gnu/ld-2.33.so
    0xfffdc000 0xffffe000   rw-p     0x22000        0x0 [stack]
(gdb)
```

On amd64 targets - after this commit:
```
(gdb) info proc mappings
process 3461869
Mapped address spaces:

          Start Addr           End Addr   Perms       Size     Offset objfile
      0x555555554000     0x555555555000   r--p      0x1000        0x0 /home/dc/src/binutils-gdb/build/a.out
      0x555555555000     0x555555556000   r-xp      0x1000     0x1000 /home/dc/src/binutils-gdb/build/a.out
      0x555555556000     0x555555557000   r--p      0x1000     0x2000 /home/dc/src/binutils-gdb/build/a.out
      0x555555557000     0x555555559000   rw-p      0x2000     0x2000 /home/dc/src/binutils-gdb/build/a.out
      0x7ffff7fc3000     0x7ffff7fc7000   r--p      0x4000        0x0 [vvar]
      0x7ffff7fc7000     0x7ffff7fc9000   r-xp      0x2000        0x0 [vdso]
      0x7ffff7fc9000     0x7ffff7fca000   r--p      0x1000        0x0 /usr/lib/x86_64-linux-gnu/ld-2.33.so
      0x7ffff7fca000     0x7ffff7ff1000   r-xp     0x27000     0x1000 /usr/lib/x86_64-linux-gnu/ld-2.33.so
      0x7ffff7ff1000     0x7ffff7ffb000   r--p      0xa000    0x28000 /usr/lib/x86_64-linux-gnu/ld-2.33.so
      0x7ffff7ffb000     0x7ffff7fff000   rw-p      0x4000    0x31000 /usr/lib/x86_64-linux-gnu/ld-2.33.so
      0x7ffffffdd000     0x7ffffffff000   rw-p     0x22000        0x0 [stack]
  0xffffffffff600000 0xffffffffff601000   --xp      0x1000        0x0 [vsyscall]
(gdb)
```

Signed-off-by: Dominik 'Disconnect3d' Czarnota <dominik.b.czarnota@gmail.com>
Change-Id: I4991f6cc758cd532eae3ae98c29d22e7bd9d9c36
2022-02-23 09:10:43 -05:00
bfd RISC-V: PR28733, add missing extension info to 'unrecognized opcode' error 2022-02-23 19:45:52 +08:00
binutils Update the obsolete list and how-to-make-a-release documentation now that the 2.38 release is out. 2022-02-09 13:44:14 +00:00
config
contrib
cpu
elfcpp
etc
gas RISC-V: PR28733, add missing extension info to 'unrecognized opcode' error 2022-02-23 19:45:52 +08:00
gdb gdb/linux-tdep.c: Add Perms to the 'info proc mappings' output 2022-02-23 09:10:43 -05:00
gdbserver gdbserver linux-low: Convert linux_event_pipe to the event_pipe class. 2022-02-22 11:22:14 -08:00
gdbsupport gdbsupport: Add an event-pipe class. 2022-02-22 11:22:14 -08:00
gnulib
gold Updated Serbian translations for the bfd, gold, ld and opcodes directories 2022-02-17 15:18:59 +00:00
gprof
include RISC-V: Updated CSRs to privileged spec v1.12 and debug spec v1.0. 2022-02-23 14:54:34 +08:00
intl
ld Fix typo in ld.texi 2022-02-18 11:42:09 -08:00
libbacktrace
libctf libctf: delete unused libctf_TEXINFOS 2022-02-11 04:20:49 -05:00
libdecnumber
libiberty Import patch from mainline GCC to fix an infinite recusion in the Rust demangler. 2022-01-31 14:36:31 +00:00
opcodes Updated Serbian translations for the bfd, gold, ld and opcodes directories 2022-02-17 15:18:59 +00:00
readline
sim sim: gdbinit: hoist setup to common code 2022-02-21 13:57:33 -05:00
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore
ar-lib
ChangeLog
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
setup.com
src-release.sh
symlink-tree
test-driver
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.