Tuesday, February 6, 2024

[SOLVED] What are the addresses in core files?

Issue

This is part of my core file:

[New Thread 30385]
[New Thread 30383]
[New Thread 30381]
[New Thread 30379]
[New Thread 30378]
[New Thread 30270]
[New Thread 30268]
Core was generated by `test'.
Program terminated with signal 11, Segmentation fault.
#0  0x001cd1a6 in ?? ()

Does it mean my program crashes at 0x001cd1a6 or the program crashes while trying to read/write to that address?
There is no executable code at that address.
Another thing is it gives a different address every time it crashes.


Solution

Does it mean my program crashes at 0x001cd1a6

Yes.

There is no executable code at that address.

Well, that would certainly cause a crash (due to illegal instruction).

Another thing is it gives a different address every time it crashes.

Your program has threads, so its allocation pattern is likely different every time it runs, as threads are scheduled differently.

Also, Linux uses address randomization, so if you run even non-threaded program multiple times, you'll end up with different addresses. On the other hand, GDB disables that randomization, so if you run non-threaded program under GDB, it should crash in the same place every time.

You are likely calling a virtual function on an object that has been invalidated (e.g. deleted). Use where GDB command to find out how you end up on invalid address.

Also, don't ever call your executable test on UNIX: this conflicts with /usr/bin/test, which many shell scripts will use.



Answered By - Employed Russian
Answer Checked By - Gilberto Lyons (WPSolving Admin)