The load, unload, and file Commands

Using the load (dbx) and file (gdb) 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.

DBX Mode

 

load_command

        : load filename [ filename ]

 

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

or

(idb) listobj

Program is not active

(idb) load /home/user/examples/x_list

Reading symbolic information from /home/user/examples/x_list...done

(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

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.

Example:

% idb -gdb /usr/examples/x_list

or:

(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

 

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.

DBX Mode

 

unload_command

        : unload [ pid ,... ]

        | unload [ filename ]

 

pid

 : integer_constant

 

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

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 19436.

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

(idb) file

No executable file now.

No symbol file now.

(idb) info files