Sun Studio 12: Debugging a Program With dbx

module Command

The module command reads debugging information for one or more modules. It is valid only in native mode.

Syntax

module [-v]

Print the name of the current module.

module [-f] [-v] [-q] name

Read in debugging information for the module called name.

module [-f] [-v] [-q] -a

Read in debugging information for all modules.

where:

name is the name of a module for which to read debugging information.

-a specifies all modules.

-f forces reading of debugging information, even if the file is newer than the executable (use with caution!).

-v specifies verbose mode, which prints language, file names, etc.

-q specifies quiet mode.

Example

Read-only data segments typically occur when an application memory maps a database. For example:

caddr_t vaddr = NULL;
off_t offset = 0;
size_t = 10 * 1024;
int fd;
fd = open("../DATABASE", ...)
vaddr = mmap(vaddr, size, PROT_READ, MAP_SHARED, fd, offset);
index = (DBIndex *) vaddr;

To be able to access the database through the debugger as memory you would type:

mmapfile ../DATABASE $[vaddr] $[offset] $[size]

Then you could look at your database contents in a structured way by typing:

print *index