Event Callbacks in MDB
The ::evset
dcmd and event tracing dcmds allow you
to associate an event callback (using the -c
option) with
each event specifier. The event callbacks are strings that represent MDB commands
to execute when the corresponding event occurs in the target. These commands
are executed as if they had been typed at the command prompt. Prior to executing
each callback, the dot variable is set to the value of
the representative thread's program counter and the hits variable
is set to the number of times this specifier has been matched, including the
current match.
If the event callbacks themselves contain one or more commands to continue
the target (for example, ::cont
or ::step
),
these commands do not immediately continue the target
and wait for it to stop again. Instead, inside of an event callback, the
continue dcmds note that a continue operation is now pending, and then return
immediately. Therefore, if multiple dcmds are included in an event callback,
the step or continue dcmd should be the last command specified. Following
the execution of all event callbacks, the target will
immediately resume execution if all matching event callbacks
requested a continue. If conflicting continue operations are requested, the
operation with the highest precedence determines what type of continue will
occur. The order of precedence from highest to lowest is: step, step-over
(next), step-out, continue.