Handling Unix signals

In Eclipse, you can use the Manage Signals dialog box in the Breakpoints view menu to modify the default handler settings.

Figure 5. Managing signal handler settings

Managing signal handler settings

Note

Unix signals SIGINT and SIGTRAP cannot be debugged in the same way as other signals because they are used internally by the debugger for asynchronous stopping of the process and breakpoints respectively.

Show/hideExample

If you want the application to ignore a signal but log the event when it is triggered then you must enable stopping on a signal. In the following example, a SIGHUP signal occurs causing the debugger to stop and print a message. No signal handler is invoked when using this setting and the application being debugged ignores the signal and continues.

Example 1. Ignoring a SIGHUP signal

handle SIGHUP stop                # Enable stop and print on SIGHUP signal

The following example shows how to debug a signal handler. To do this you must disable stopping on a signal and then set a breakpoint in the signal handler. This is because if stopping on a signal is disabled then the handling of that signal is performed by the process that passes the signal to the registered handler. If no handler is registered then the default handler runs and the application generally exits.

Example 2. Debugging a SIGHUP signal

handle SIGHUP nostop              # Disable print on SIGHUP signal

Show/hideSee also

Copyright © 2010 ARM. All rights reserved.ARM DUI 0446A
Non-ConfidentialID070310