MDB Interaction With exec
When a controlled user process performs a successful exec
(2), the behavior of the debugger is controlled by the ::set -o follow_exec_mode
option, as described in the
mdb
(1) man page. If the debugger and victim process (or victim process) have the same data model, then the stop
and follow
modes determine whether MDB automatically continues the target or returns to the debugger prompt following the exec
. If the debugger and victim process have a different data model, then the follow
behavior causes MDB to automatically re-exec the MDB binary with the appropriate data model and reattach to the process, still stopped on return from the exec
. Not all debugger state is preserved across this re-exec.
If a 32-bit victim process execs a 64-bit program,
then stop
will return to the command prompt, but the debugger
will no longer be able to examine the process because it is now using the
64-bit data model. To resume debugging, execute the ::release -a
dcmd,
quit MDB, and then execute mdb -p
pid to
re-attach the 64-bit debugger to the process.
If a 64-bit victim process execs a 32-bit program, then stop
will
return to the command prompt, but the debugger will only provide limited capabilities
for examining the new process. All built-in dcmds will work as advertised,
but loadable dcmds will not since they do not perform data model conversion
of structures. The user should release and reattach the debugger to the process
as described above in order to restore full debugging capabilities.