Handling Unix signals

For Linux applications, ARM processors have the facility to trap Unix signals. These are managed in the debugger by selecting Manage Signals from the Breakpoints view menu or you can use the handle command. You can also use the info signals command to display the current handler settings.

The default handler settings are dependant on the type of debug activity. For example, by default on a Linux kernel connection, all signals are handled by Linux on the target.

Figure 12. Managing signal handler settings

Managing signal handler settings


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.


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 3. Ignoring a SIGHUP signal

handle SIGHUP stop print                # 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 signal to the registered handler. If no handler is registered then the default handler runs and the application generally exits.

Example 4. Debugging a SIGHUP signal

handle SIGHUP nostop noprint             # Disable stop and print on SIGHUP signal

Show/hideSee also

Copyright © 2010-2012 ARM. All rights reserved.ARM DUI 0446J