The mechanism by which the Collector collects profiling data uses two signals, SIGPROF and SIGEMT. To ensure that profiling signals are not lost or mishandled, the Collector installs its own signal handler as the primary signal handler. If the program on which data is being collected installs its own signal handler, the Collector re-installs its signal handler as the primary signal handler. The Collector's signal handler passes on any signals it does not handle to the program's signal handler.
The signal handler from the Collector sets a flag that ensures that system calls are not interrupted for signal delivery. This could change the behavior of the program if the program's signal handler sets the flag to permit interruption of system calls. One important example of a change in behavior occurs for the asynchronous I/O library, libaio.so, which uses SIGPROF for asynchronous cancel operations, and which does interrupt system calls. If the collector library, libcollector.so, is installed, the cancel signal arrives late.
In one case the Collector does not re-install its signal handler. If you attach dbx to a process without preloading the collector library and enable performance data collection, and the program subsequently installs its own signal handler, the Collector does not re- install its own signal handler. In this case, the program's signal handler must ensure that the SIGPROF and SIGEMT signals are passed on so that perfomance data is not lost. If the program's signal handler interrupts system calls, both the program behavior and the profiling behavior will be different from when the collector library is preloaded.
See also | |
---|---|
Collecting Performance Data on a Running Process |