K
K
kuzko2020-01-07 22:36:38
linux
kuzko, 2020-01-07 22:36:38

How to find out the specific place where the program crashed in the Release configuration in Linux?

Tell me, is it possible somehow on Linux to find out from the release configuration and the core file the place where the error occurred in the program (specifically, the number of the assembler instruction that led to the error)?
When using gdb, it is not clear where exactly the program crashed:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00005633bd506050 in ?? ()

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
jcmvbkbc, 2020-01-07
@kuzko

When using gdb, it is not clear where exactly the program crashed:
#0 0x00005633bd506050 in ?? ()

So here is the address: 0x00005633bd506050
No need to remove the option -gfrom the release build. After assembly, you can copy the resulting ELF, cut off the debug symbols from it and run it. When something falls, it will be possible to load a core dump with ELF, in which debug symbols are present, so as not to guess where this address is.

C
CityCat4, 2020-01-09
@CityCat4

And what will a specific asmo instruction give you? Memory protection violation, the program accessed an address that does not belong to it. Most likely a function from libc was executed. If there is no debug version, you can try strace / dtrace and guess where it crashes.

A
Alexey Shumkin, 2020-01-18
@ashumkin

The number / address of the assembler instruction, as already noted, is shown to you.
But to get the line number in the source code, you need debugging information.
As, again, we noticed, you can download a release build dump with a debug binary. The question arises "where to get it?" Potentially, if the same sources are compiled by the same compiler with the same settings in the same environment as the release one (which allows you to do the build server, for example ...), but with debugging information enabled, then from the point From the point of view of logic, the binary should turn out to be identical in terms of instruction addresses. It's something you can use.
I did this for Windows applications. But I don't think the OS difference makes a difference...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question