Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the general causes of abort signal?

I have an application, in C++ over running linux, which on exit gets abort signal. Before I go after the code to hunt down the problem, I need to know what could be the cases in which I shall get an abort signal from kernel. This could give me proper direction to debug.

Please mention each and every potential scenario in which an application could get an abort signal.

@ specifics of execution scenario are,

  • process is in exit mode, i.e exit() routine is called for graceful shutdown of process.
  • consequently all the global object destructors are called.

TIA

like image 531
Mandar Avatar asked Apr 20 '11 04:04

Mandar


2 Answers

  • Compile it with -g
  • Run it from a debugger

When the application crashes, the debugger will give you the line, let you inspect thread, variables...

Other solution:

  • change your core dump generation with ulimit
  • load the core dump in gdb post mortem

Root cause can be multiple : reading outside of your memory space, division by 0, dereferencing invalid pointer...

like image 70
Bruce Avatar answered Nov 15 '22 03:11

Bruce


I would try running under valgrind. There could be a memory error even before the abort and valgrind could notice that and tell you. If this is the case, you will find the error much easier than with a conventional debugger like gdb.

like image 40
Peter G. Avatar answered Nov 15 '22 05:11

Peter G.