Sun Studio 12: Debugging a Program With dbx


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