Debugging

From LQWiki
Jump to navigation Jump to search

Debugging is the process whereby an application under development is tested, errors are identified, and then corrections are made so that the software performs as required by the specification. Debugging is an essential part of software development and generally comprises the majority of the time spent on a project.

Debugging tools

A program can be debugged simply by inserting "print" statements at key parts of the code in order to reveal the contents of program variables. However this can be a time-consuming process, and there are a number of tools that facilitate the debugging process.

Also choose the right tool for the right job, some bebuggers specialise in only certain ares, others are more general, but can lack more detialed info others can get, feel free to combine bebugging tools as needed.

  • gdb - the GNU debugger.
  • strace - reveals the system calls made by a running program.
  • ltrace - show the library calls made by a running progam.
  • IDE debuggers - many Integrated Development Environments contain their own debuggers which allow code to be executed one line at a time and provide real-time updates of program variables.
  • kdb - the kernel debugger.

core files

When a Linux program is aborted with the SIGQUIT signal, it leaves a file in the working directory called core, which contains binary information about the state of the processor at the time the signal was caught. This information may be of use to assembly programmers but is not normally helpful to users of higher-level languages such as C or Java, but can be used sometimes by other programs.

See also