3.12 Handling UNIX signals

When debugging a Linux application you can configure the debugger to stop or report when a UNIX signal is raised.

To manage UNIX signals in the debugger, either:
  • Select Manage Signals from the Breakpoints view menu.
    Select the individual Signal you want to Stop or Print information, and click OK. The results are displayed in the Command view.
  • Use the handle command and view the results in the Command view.

Tip

HandYou can also use the info signals command to display the current signal handler settings.
Figure 3-8 Manage signals dialog (UNIX signals)
Manage signals dialog (UNIX signals)

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.

Example 3-3 Managing signals

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.
Ignoring a SIGHUP 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 debugged application ignores the signal and continues to operate.
handle SIGHUP stop print                # Enable stop and print on SIGHUP signal
Debugging a 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.
handle SIGHUP nostop noprint             # Disable stop and print on SIGHUP signal
Related concepts
6.9 About debugging shared libraries
6.10.2 About debugging a Linux kernel
6.10.3 About debugging Linux kernel modules
Related reference
3.2 Running, stopping, and stepping through an application
5.1 Examining the target execution environment
5.2 Examining the call stack
3.13 Handling processor exceptions
11.4 Breakpoints view
11.6 Commands view
11.35 Manage Signals dialog box
Related information
DS-5 Debugger commands
Non-ConfidentialPDF file icon PDF versionARM DUI0446W
Copyright © 2010-2015 ARM. All rights reserved.