The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.

4.5 Debugging Applications

Many powerful tools are available on Oracle Linux for debugging software. These debugging tools can be broadly categorized as follows:

  • Kernel-mode debuggers, which allow you to debug code that runs in the privilege mode of the CPU. Examples of kernel modules include file system kernel modules, device drivers, and so on.

    Adding printk() statements to code can be a simple and effective way to locate problems. The crash utility allows you to examine the live kernel, user processes, system dumps, memory leaks, and application core dumps. The kernels that are shipped with Oracle Linux are stripped so you need to build a non-stripped version of the kernel if you want to use the kdb or kdbg debuggers on it.

  • User-mode debuggers, which allow you to debug code that runs in the non-privilege mode of the CPU. User applications execute in user mode and the applications use system calls to interface to the kernel. Code that runs in kernel mode code has a different address space from code that runs in user mode.

    You can use also use GDB for source-level symbolic debugging and execution of programs written in ANSI C and C++, and other programming languages are partially supported. Useful features of GDB include stepping through programs one source line or one machine instruction at a time. In addition to simply viewing the operation of the program, you can manipulate variables and evaluate and display a wide range of expressions. You can debug a program, a running process, or a core file. To use GDB effectively, you build your source code with the -g compiler flag to create a debug binary. Full debugging information also requires that you select no compiler optimization. Only partial debugging support is available for optimized code. GDB allows you to modify and recompile a native source file and continue executing without rebuilding the entire program. You can resume running from the code fix location. You do not need to relink or reload to continue debugging. You can also navigate between threads, suspend or step a thread, and display the stack and any locks.