OS Information - Debugging with GDB

Next: Memory Region Attributes, Previous: Vector Unit, Up: Data

### 10.15 Operating System Auxiliary Information

gdb provides interfaces to useful OS facilities that can help you debug your program.

When gdb runs on a Posix system (such as GNU or Unix machines), it interfaces with the inferior via the `ptrace` system call. The operating system creates a special sata structure, called `struct user`, for this interface. You can use the command `info udot` to display the contents of this data structure.

`info udot`
  Display the contents of the `struct user` maintained by the OS kernel for the program being debugged. gdb displays the contents of `struct user` as a list of hex numbers, similar to the `examine` command.

Some operating systems supply an auxiliary vector to programs at startup. This is akin to the arguments and environment that you specify for a program, but contains a system-dependent variety of binary values that tell system libraries important details about the hardware, operating system, and process. Each value's purpose is identified by an integer tag; the meanings are well-known but system-specific. Depending on the configuration and operating system facilities, gdb may be able to show you this information. For remote targets, this functionality may further depend on the remote stub's support of the ‘`qXfer:auxv:read`’ packet, see qXfer auxiliary vector read.

`info auxv`
  Display the auxiliary vector of the inferior, which can be either a live process or a core dump file. gdb prints each tag value numerically, and also shows names and text descriptions for recognized tags. Some values in the vector are numbers, some bit masks, and some pointers to strings or other data. gdb displays each value in the most appropriate form for a recognized tag, and in hexadecimal for an unrecognized tag.

On some targets, gdb can access operating-system-specific information and display it to user, without interpretation. For remote targets, this functionality depends on the remote stub's support of the ‘`qXfer:osdata:read`’ packet, see qXfer osdata read.

`info os`
  List the types of OS information available for the target. If the target does not return a list of possible types, this command will report an error.

`info os processes`
  Display the list of processes on the target. For each process, gdb prints the process identifier, the name of the user, and the command corresponding to the process.