What are the general causes of abort signal?

10,489

Solution 1

  • 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...

Solution 2

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.

Share:
10,489
Mandar
Author by

Mandar

Updated on June 18, 2022

Comments

  • Mandar
    Mandar almost 2 years

    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

  • Mandar
    Mandar about 13 years
    I have tried that but was unable to get the stack trace. The process, upon getting the abort, si simply detached from the gdb.