Tuesday, September 7, 2010

Debug cores generated by release mode executables

Debug cores generated by release mode executables

Release mode executables are generated by either compiling the code without using the -g compiler switch or by stripping the final executable. When a core (due to say, SIGSEGV) is generated by such an executable how do we obtain a backtrace using GDB. The solution is pretty simple; Compile a debug version of the same executable using the -g switch (the rest of the compiler options must be the same as those passed during the generation of the release mode executable). Use this executable when examining the core file using GDB. This works because the .text section of both executables (release mode and debug mode) remains the same. The debug mode executable has .debug* sections along with the .symtab section; The other sections are an exact replica as those found in the release mode executable.

Author: mwnn <mwnnlin AT gmail DOT com>

Date: 2010-09-07 23:43:35 IST

HTML generated by org-mode 6.33x in emacs 23

No comments:

Post a Comment