wiki:LibcPanic

Version 1 (modified by bird, 18 years ago) (diff)

--

Debugging Libc Panics

When process crashes in an unexpected way, LIBC will terminate the process after showing a short panic message. (It will not envoke any just-in-time debugger which you might have installed.) So, if you want to debug a crashing process, you either have to start it with(/in) the debugger, or you have to set the LIBC_PANIC env.var. to "breakpoint". When the "breakpoint" flag is set, or the process is begin debugged, LIBC will execute a breakpoint instruction before proceeding to dump and terminate the process. This give the debugger a chance to kick in and for you to have a look at why and where it paniced.

The LIBC_PANIC environment variable knows more flags than just "breakpoint". All flags are, well flags, and they are either set or cleared. To clear a flag you usually prefix the flag name with "no". So, if you fancy to debug a process but *not* to execute a breakpoint instruction when libc panics, set LIBC_PANIC to "nobreakpoint". These are the flags:

  • quiet / noquiet - don't print any panic message, just fail. This flag is cleared by default.
  • breakpoint / nobreakpoint - execute breakpoint instruction. This flag is by default cleared when not debugged and set if debugged (*).
  • verbose / terse - display pid, ppid, tid, prioity and such. This flag is set (verbose) by default.
  • dump / nodump - attempt a process dump (similar to core dump). This flag is set by default.

(*) The diffent breakpoint default when the process is being debugged was introduced with LIBC 0.6.1.