top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

While debugging CORE file with GDB, Why we have to use executable file also along with that?

+1 vote
395 views

As far as I know, CORE file contains all the information till Segmentation fault. Then, while debugging core file why we are using executable file(binary) with it.?

posted Jul 1, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

You require binary (with debugging symbols included) identical to the one that generated the core, so that you can debug it. Core file does not have debug symbol it is supplied by the binary file (compiled with -g option).

When it starts up, you can use bt (for backtrace) to get a stack trace from the time of the crash. In the backtrace, each function invocation is given a number. You can use frame number (replacing number with the corresponding number in the stack trace) to select a particular stack frame. You can then use list to see code around that function, and info locals to see the local variables. If you done supply the binary then you can not see the code around and local variable information.

answer Jul 1, 2015 by Salil Agrawal
Similar Questions
+4 votes

in case if is it possible, how you can change and pls explain with some example.

+1 vote

I am working on some JIT compiler and I am using GDB to debut it, my code crashes at some point (segment fault), but it crashes at the jitted code (they are generated on the fly) so I do not get the stack frame information, But I got the following backtrace:

#0 0x**********d98f22 in ?? () // JITTED CODE
#1 0x000000000000001d in ?? () // JITTED CODE
#2 ...callattribuite function....

I am wondering if it is possible for GDB to disassemble the code at location 0x**********d98f22 and display it to me. I tried disas 0x**********d98f22 but GDB complained No function contains specified address.

Any clue?

...