This section gives information on
Specifying an executable file on the command line or executing the load (dbx) or file (gdb) command identifies the current program.
In the background, the debugger immediately creates a process executing the program, stalls it, and uses it to answer questions about which dynamic libraries are mapped, and so on. This process never continues, and is killed when:
The debugger exits
You unload this executable file
Using the run command causes the debugger to create a new process running the loaded program.
Specifying pid <process id> on the command line or executing the attach command causes the debugger to take control of the process indicated.
The debugger supports concurrently debugging multiple processes at the same time, but at any given time is only operating on a single process, known as the current process. The debugger variable $curprocess contains the process id for this process. Naming and switching the debugger between processes is described in Multiprocess Debugging.
Processes contain one or more threads of execution. The threads execute functions. Functions are sequences of instructions that are generated by compilers from source lines within source files.
As you enter the debugger commands to manipulate your process, it would be very tedious to have to repeatedly specify which thread, source file, and so on, to which you wish the command to be applied. To prevent this, each time the debugger stops the process, it re-establishes a static context and a dynamic context for your commands. The components of the static context are independent of this run of your program; the components of the dynamic context are dependent on this run.
The components of these contexts can be displayed as debugger variables or by other commands:
Current program - info sharedlibrary (gdb) or listobj (dbx), info file
The debugger keeps the components of the static and dynamic contexts consistent as the contexts change. The current file and line are determined by where the debugger stops the process, but the dynamic context can be changed directly, using the frame (gdb) or up or down, func (dbx), process (dbx), and thread commands. The program can be unloaded using the file (gdb) or unload (dbx) command.