Documentation
¶
Overview ¶
Package pmap implements the pmap builtin command.
pmap — report per-process virtual memory mappings
Usage: pmap [-x] [-h|--help] PID...
Display the virtual memory mappings of one or more running processes: start address, size, permission mode, and a mapping label (a file base name, a bracketed special region such as "[heap]"/"[stack]", or "[ anon ]" for anonymous private memory).
Mapping enumeration is delegated to the internal procmaps package via callCtx.Proc, which reads <ProcPath>/<pid>/maps (or smaps for -x) on Linux directly, bypassing the AllowedPaths sandbox — the same documented exception the ss, ip route, df, free, and ps builtins use. ProcPath is fixed by the embedding application and the remaining path is derived only from the numeric PID, never arbitrary script input. On Windows, mappings are enumerated with VirtualQueryEx. On macOS, mappings are enumerated via proc_pidinfo(PROC_PIDREGIONINFO) (see the procmaps package doc comment for details).
The header line printed before each process's mappings shows its short comm/executable name, never its full command line — pmap does not read or expose process argv, matching the same restriction the ps builtin already enforces.
Accepted flags:
-x, --extended
Extended format: also show per-mapping RSS and Dirty (Linux only;
exits 1 with "not supported" on Windows and macOS rather than
reporting fabricated zeros).
-h, --help
Print usage to stdout and exit 0.
Rejected flags (intentionally not registered, rejected as unknown by pflag with exit 1): -p/--show-path (full mapping paths), -d/--device (device format), -q/--quiet, -A/--range, -k/--use-kernel-name, -c/--read-rc, -C/--read-rc-from, -n/--create-rc, -N/--create-rc-to (rc-file-driven filtering), -X/-XX (kernel-footprint extended stats), and -V/--version. pmap is scoped to a single read-only snapshot per PID; deferred to a later version if evidenced.
Exit codes:
0 Success — every requested PID's mappings were written. 1 Error — invalid PID, unsupported platform/mode, a PID that does not name a running process, or no PID given.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Cmd = builtins.Command{
Name: "pmap",
Description: "report per-process virtual memory mappings",
MakeFlags: makeFlags,
}
Cmd is the pmap builtin command descriptor.
Functions ¶
This section is empty.
Types ¶
This section is empty.