Using the file (gdb) or load (dbx) commands, you specify which executable file you intend to execute under control of the debugger. (This is done automatically when you give the debugger a file name on the command line.) These commands read the symbolic information for an executable file and the shared libraries it uses (if available). Objects compiled without debug information will not have symbols to load. The load (dbx) command can optionally load a core file.
GDB Mode
file_command
: file [ filename ]
If filename is specified, the debugger loads the specified executable. Without an argument, the debugger unloads the current executable file.
Examples:
% idb -gdb /usr/examples/x_list
(idb) info files
(idb) file /home/user/examples/x_list
Reading symbols from /home/user/examples/x_list...done.
(idb) info files
Symbols from "/home/user/examples/x_list".
Unix child process:
Using the running image of child process 19438.
While running this, IDB does not access memory from...
Local exec file:
'/home/user/examples/x_list', file type <unknown>
0x8048000 - 0x8056e40 is .text
0x8057000 - 0x805deec is .data
0x805deec - 0x805dfb4 is .bss
DBX Mode
load_command
The second file name is used to specify a core file. If you specify a core file, the debugger acts as though it is attached to the process at the point just before it died, except that you cannot execute commands that require a runnable process, such as commands that try to continue the process or evaluate function calls.
Examples:
% idb /home/user/examples/x_list
(idb) listobj
Program is not active
(idb) load /home/user/examples/x_list
Reading symbolic information from /home/user/examples/test/idb/Examples/exp/i686-Linux-currstable/debuggable/x_list...done
(idb) listobj
section Start Addr End Addr
------------------------------------------------------------------------------
/home/user/examples/test/idb/Examples/exp/i686-Linux-currstable/debuggable/x_list
.text 0x8048000 0x80555cf
.data 0x8056000 0x805be07
.bss 0x805be08 0x805bebf
/lib/libdl-2.3.2.so
.text 0xb73b1000 0xb73b2dc3
.data 0xb73b3dc4 0xb73b3f53
.bss 0xb73b3f54 0xb73b3f73
/lib/tls/libc-2.3.2.so
.text 0xb73b4000 0xb74e44f5
.data 0xb74e5500 0xb74e7fdb
.bss 0xb74e7fdc 0xb74eaa8b
/nfs/cmplr/icc-9.1.043/lib/libunwind.so.5
.text 0xb74eb000 0xb74ef28c
.data 0xb74f0290 0xb74f0a1b
.bss 0xb74f0a1c 0xb74f0b7b
/nfs/cmplr/icc-9.1.043/lib/libcxa.so.5
.text 0xb74f1000 0xb750cd5e
.data 0xb750d000 0xb7513bcb
.bss 0xb7513bcc 0xb7513d4f
/nfs/cmplr/icc-9.1.043/lib/libcprts.so.5
.text 0xb7514000 0xb7594aaf
.data 0xb7595000 0xb75b3d23
.bss 0xb75b3d24 0xb75b469f
/lib/tls/libm-2.3.2.so
.text 0xb75b5000 0xb75d5dbf
.data 0xb75d6dc0 0xb75d6f43
.bss 0xb75d6f44 0xb75d6f8f
/lib/ld-2.3.2.so
.text 0xb75eb000 0xb75fffcf
.data 0xb7600000 0xb7600533
.bss 0xb7600534 0xb7600753
Loading a process both creates the debugger's knowledge of it and makes it the current process that the debugger is controlling.
The opposite of loading an executable file is unloading an executable file, when the debugger removes all related symbol table information that the debugger associated with the process being debugged.
GDB Mode
Use the file command without an argument to unload an executable file.
(idb) info files
Symbols from "/home/user/examples/x_list"".
Unix child process:
Using the running image of child process 17560.
While running this, IDB does not access memory from...
Local exec file:
'/home/user/examples/test/idb/Examples/exp/i686-Linux-currstable/debuggable/x_list', file type <unknown>
0x8048000 - 0x80555d0 is .text
0x8056000 - 0x805be08 is .data
0x805be08 - 0x805bec0 is .bss
(idb) file
No executable file now.
No symbol file now.
(idb) info files
DBX Mode
unload_command
: unload [ pid ,... ]
Process for unloading can be specified by either a process id or an executable file name.
(idb) listobj
section Start Addr End Addr
------------------------------------------------------------------------------
/home/user/examples/x_list
.text 0x8048000 0x8056e3f
.data 0x8057000 0x805deeb
.bss 0x805deec 0x805dfb3
/lib/libdl-2.3.2.so
.text 0xb7386000 0xb7387dc3
.data 0xb7388dc4 0xb7388f53
.bss 0xb7388f54 0xb7388f73
/lib/tls/libc-2.3.2.so
.text 0xb7389000 0xb74b94f5
.data 0xb74ba500 0xb74bcfdb
.bss 0xb74bcfdc 0xb74bfa8b
/nfs/cmplr/icc-9.0.031/lib/libunwind.so.5
.text 0xb74c0000 0xb74c433f
.data 0xb74c5340 0xb74c5abb
.bss 0xb74c5abc 0xb74c5c1b
/nfs/cmplr/icc-9.0.031/lib/libcxa.so.5
.text 0xb74c6000 0xb74e62b3
.data 0xb74e7000 0xb74eed37
.bss 0xb74eed38 0xb74eeeaf
/nfs/cmplr/icc-9.0.031/lib/libcprts.so.5
.text 0xb74ef000 0xb758d933
.data 0xb758e000 0xb75b422f
.bss 0xb75b4230 0xb75b4c27
/lib/tls/libm-2.3.2.so
.text 0xb75b5000 0xb75d5dbf
.data 0xb75d6dc0 0xb75d6f43
.bss 0xb75d6f44 0xb75d6f8f
/lib/ld-2.3.2.so
.text 0xb75eb000 0xb75fffcf
.data 0xb7600000 0xb7600533
.bss 0xb7600534 0xb7600753
(idb) unload
(idb) listobj
Program is not active