0

Can we check the base and limit addresses using cat /proc/<pid>/?. I read the man page of proc but I couldn't find or missed which file contains the mentioned addresses.

What I mean with base and limit

ja212
  • 91
  • 1
  • 9
  • `the base and limit addresses` What is a "base address" and a "limit address"? What are these? – KamilCuk Feb 14 '21 at 20:49
  • The linked doc refers to physical address. A user process does not have any information about physical addresses. – stark Feb 15 '21 at 01:40

1 Answers1

3

What you have linked to is a vastly simplified address space concept more suited to a microcontroller. It is far more complex in Linux and a modern CPU.

But you can get information like this from /proc/<pid>/. Look in maps and smaps. maps will have lines like this:

55bf12c35000-55bf12c62000 r--p 00000000 103:02 548822                    /usr/bin/bash

The first two numbers are the base and limit of this individual mapping. But there is not just one address space mapping per process. There are dozens if not hundreds.

smaps will have these lines plus additional information on each mapping.

There already a question about these files with a good answer, Understanding Linux /proc/id/maps. Also look at the docs in the man page for proc(5).

TrentP
  • 4,240
  • 24
  • 35
  • Thanks. I also have sort of unrelated question. If I check the GDTR, then I should find a base and limit values. In my case it is always returning the same value. Should it do so? and assume the values where changing, if I understand your question correctly, we have multiple base and limit for the same program, so which ones should show in the GDTR? – ja212 Feb 15 '21 at 02:40