gdb bt gives only ??, how can I debug?












1















/var/log/message:



segfault at 0 ip 00007fcd16e5853a sp 00007ffd98e37e58 error 4 in libc-2.24.so[7fcd16dc9000+195000]


addr2line -e a.out 00007fcd16e5853a



??:0


gdb bt



Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fcd16e5853a in ?? ()
(gdb) bt
#0 0x00007fcd16e5853a in ?? ()
#1 0x000055f2f45fe95b in ?? ()
#2 0x000055f200000080 in ?? ()
#3 0x00007fcd068c2040 in ?? ()
#4 0x000055f2f6109c48 in ?? ()
#5 0x0000000000000000 in ?? ()


build with gcc -Wall -O0 -g



How can I debug this, are there more methods?










share|improve this question























  • Corrupted stack? Use e.g. Valgrind or similar to help you find the problem?

    – Some programmer dude
    Nov 24 '18 at 13:34






  • 1





    Do you link with -g? Does gdb say that debuginfo has been loaded?

    – Maxim Egorushkin
    Nov 24 '18 at 14:04











  • Oh and you don't strip the debug info once you've built the program?

    – Some programmer dude
    Nov 24 '18 at 14:05











  • @Someprogrammerdude no, I didn't strip, and don't know why, if I run it use valgrind, it's too slow, so the bug just does not appear.

    – gacopu
    Nov 25 '18 at 2:26











  • @MaximEgorushkin yes, linked with -g and debuginfo installed

    – gacopu
    Nov 25 '18 at 2:26
















1















/var/log/message:



segfault at 0 ip 00007fcd16e5853a sp 00007ffd98e37e58 error 4 in libc-2.24.so[7fcd16dc9000+195000]


addr2line -e a.out 00007fcd16e5853a



??:0


gdb bt



Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fcd16e5853a in ?? ()
(gdb) bt
#0 0x00007fcd16e5853a in ?? ()
#1 0x000055f2f45fe95b in ?? ()
#2 0x000055f200000080 in ?? ()
#3 0x00007fcd068c2040 in ?? ()
#4 0x000055f2f6109c48 in ?? ()
#5 0x0000000000000000 in ?? ()


build with gcc -Wall -O0 -g



How can I debug this, are there more methods?










share|improve this question























  • Corrupted stack? Use e.g. Valgrind or similar to help you find the problem?

    – Some programmer dude
    Nov 24 '18 at 13:34






  • 1





    Do you link with -g? Does gdb say that debuginfo has been loaded?

    – Maxim Egorushkin
    Nov 24 '18 at 14:04











  • Oh and you don't strip the debug info once you've built the program?

    – Some programmer dude
    Nov 24 '18 at 14:05











  • @Someprogrammerdude no, I didn't strip, and don't know why, if I run it use valgrind, it's too slow, so the bug just does not appear.

    – gacopu
    Nov 25 '18 at 2:26











  • @MaximEgorushkin yes, linked with -g and debuginfo installed

    – gacopu
    Nov 25 '18 at 2:26














1












1








1


1






/var/log/message:



segfault at 0 ip 00007fcd16e5853a sp 00007ffd98e37e58 error 4 in libc-2.24.so[7fcd16dc9000+195000]


addr2line -e a.out 00007fcd16e5853a



??:0


gdb bt



Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fcd16e5853a in ?? ()
(gdb) bt
#0 0x00007fcd16e5853a in ?? ()
#1 0x000055f2f45fe95b in ?? ()
#2 0x000055f200000080 in ?? ()
#3 0x00007fcd068c2040 in ?? ()
#4 0x000055f2f6109c48 in ?? ()
#5 0x0000000000000000 in ?? ()


build with gcc -Wall -O0 -g



How can I debug this, are there more methods?










share|improve this question














/var/log/message:



segfault at 0 ip 00007fcd16e5853a sp 00007ffd98e37e58 error 4 in libc-2.24.so[7fcd16dc9000+195000]


addr2line -e a.out 00007fcd16e5853a



??:0


gdb bt



Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fcd16e5853a in ?? ()
(gdb) bt
#0 0x00007fcd16e5853a in ?? ()
#1 0x000055f2f45fe95b in ?? ()
#2 0x000055f200000080 in ?? ()
#3 0x00007fcd068c2040 in ?? ()
#4 0x000055f2f6109c48 in ?? ()
#5 0x0000000000000000 in ?? ()


build with gcc -Wall -O0 -g



How can I debug this, are there more methods?







c debugging gcc segmentation-fault gdb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 13:30









gacopugacopu

1459




1459













  • Corrupted stack? Use e.g. Valgrind or similar to help you find the problem?

    – Some programmer dude
    Nov 24 '18 at 13:34






  • 1





    Do you link with -g? Does gdb say that debuginfo has been loaded?

    – Maxim Egorushkin
    Nov 24 '18 at 14:04











  • Oh and you don't strip the debug info once you've built the program?

    – Some programmer dude
    Nov 24 '18 at 14:05











  • @Someprogrammerdude no, I didn't strip, and don't know why, if I run it use valgrind, it's too slow, so the bug just does not appear.

    – gacopu
    Nov 25 '18 at 2:26











  • @MaximEgorushkin yes, linked with -g and debuginfo installed

    – gacopu
    Nov 25 '18 at 2:26



















  • Corrupted stack? Use e.g. Valgrind or similar to help you find the problem?

    – Some programmer dude
    Nov 24 '18 at 13:34






  • 1





    Do you link with -g? Does gdb say that debuginfo has been loaded?

    – Maxim Egorushkin
    Nov 24 '18 at 14:04











  • Oh and you don't strip the debug info once you've built the program?

    – Some programmer dude
    Nov 24 '18 at 14:05











  • @Someprogrammerdude no, I didn't strip, and don't know why, if I run it use valgrind, it's too slow, so the bug just does not appear.

    – gacopu
    Nov 25 '18 at 2:26











  • @MaximEgorushkin yes, linked with -g and debuginfo installed

    – gacopu
    Nov 25 '18 at 2:26

















Corrupted stack? Use e.g. Valgrind or similar to help you find the problem?

– Some programmer dude
Nov 24 '18 at 13:34





Corrupted stack? Use e.g. Valgrind or similar to help you find the problem?

– Some programmer dude
Nov 24 '18 at 13:34




1




1





Do you link with -g? Does gdb say that debuginfo has been loaded?

– Maxim Egorushkin
Nov 24 '18 at 14:04





Do you link with -g? Does gdb say that debuginfo has been loaded?

– Maxim Egorushkin
Nov 24 '18 at 14:04













Oh and you don't strip the debug info once you've built the program?

– Some programmer dude
Nov 24 '18 at 14:05





Oh and you don't strip the debug info once you've built the program?

– Some programmer dude
Nov 24 '18 at 14:05













@Someprogrammerdude no, I didn't strip, and don't know why, if I run it use valgrind, it's too slow, so the bug just does not appear.

– gacopu
Nov 25 '18 at 2:26





@Someprogrammerdude no, I didn't strip, and don't know why, if I run it use valgrind, it's too slow, so the bug just does not appear.

– gacopu
Nov 25 '18 at 2:26













@MaximEgorushkin yes, linked with -g and debuginfo installed

– gacopu
Nov 25 '18 at 2:26





@MaximEgorushkin yes, linked with -g and debuginfo installed

– gacopu
Nov 25 '18 at 2:26












1 Answer
1






active

oldest

votes


















1















gdb bt




Surely that is not the command you actually executed.



Most likely you did something like this:



gdb /path/to/core
(gdb) bt


Don't do that. Do this instead:



gdb /path/to/a.out /path/to/core
(gdb) bt


If you already did invoke GDB correctly, other likely reasons why bt did not work:




  1. You are analyzing the core on a different machine from the one on which it was produced. See this answer.

  2. You rebuilt a.out with different flags. Use the exact binary that crashed.

  3. You have updated libc after the core was produced. Restore it to the version that was current as of when the core was produced.


P.S. This command




addr2line -e a.out 00007fcd16e5853a




makes no sense: the error message told you that the address 00007fcd16e5853a is in libc-2.24.so. The a.out has nothing to do with that address.



The command you want to use is:



addr2line -fe /path/to/libc-2.24.so 195000


P.P.S.




segfault at 0 ip 00007fcd16e5853a ...




This means: NULL pointer dereference inside libc. The most probable cause: not checking for error return, e.g. something like:



FILE *fp = fopen("/some/file", "r");
fscanf(fp, buffer, sizeof(buffer)); // Oops: didn't check for NULL.





share|improve this answer


























  • Thanks, the gdb part is correct, I just simplified that. I'll check the libc part NULL check

    – gacopu
    Nov 25 '18 at 2:28











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458636%2fgdb-bt-gives-only-how-can-i-debug%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1















gdb bt




Surely that is not the command you actually executed.



Most likely you did something like this:



gdb /path/to/core
(gdb) bt


Don't do that. Do this instead:



gdb /path/to/a.out /path/to/core
(gdb) bt


If you already did invoke GDB correctly, other likely reasons why bt did not work:




  1. You are analyzing the core on a different machine from the one on which it was produced. See this answer.

  2. You rebuilt a.out with different flags. Use the exact binary that crashed.

  3. You have updated libc after the core was produced. Restore it to the version that was current as of when the core was produced.


P.S. This command




addr2line -e a.out 00007fcd16e5853a




makes no sense: the error message told you that the address 00007fcd16e5853a is in libc-2.24.so. The a.out has nothing to do with that address.



The command you want to use is:



addr2line -fe /path/to/libc-2.24.so 195000


P.P.S.




segfault at 0 ip 00007fcd16e5853a ...




This means: NULL pointer dereference inside libc. The most probable cause: not checking for error return, e.g. something like:



FILE *fp = fopen("/some/file", "r");
fscanf(fp, buffer, sizeof(buffer)); // Oops: didn't check for NULL.





share|improve this answer


























  • Thanks, the gdb part is correct, I just simplified that. I'll check the libc part NULL check

    – gacopu
    Nov 25 '18 at 2:28
















1















gdb bt




Surely that is not the command you actually executed.



Most likely you did something like this:



gdb /path/to/core
(gdb) bt


Don't do that. Do this instead:



gdb /path/to/a.out /path/to/core
(gdb) bt


If you already did invoke GDB correctly, other likely reasons why bt did not work:




  1. You are analyzing the core on a different machine from the one on which it was produced. See this answer.

  2. You rebuilt a.out with different flags. Use the exact binary that crashed.

  3. You have updated libc after the core was produced. Restore it to the version that was current as of when the core was produced.


P.S. This command




addr2line -e a.out 00007fcd16e5853a




makes no sense: the error message told you that the address 00007fcd16e5853a is in libc-2.24.so. The a.out has nothing to do with that address.



The command you want to use is:



addr2line -fe /path/to/libc-2.24.so 195000


P.P.S.




segfault at 0 ip 00007fcd16e5853a ...




This means: NULL pointer dereference inside libc. The most probable cause: not checking for error return, e.g. something like:



FILE *fp = fopen("/some/file", "r");
fscanf(fp, buffer, sizeof(buffer)); // Oops: didn't check for NULL.





share|improve this answer


























  • Thanks, the gdb part is correct, I just simplified that. I'll check the libc part NULL check

    – gacopu
    Nov 25 '18 at 2:28














1












1








1








gdb bt




Surely that is not the command you actually executed.



Most likely you did something like this:



gdb /path/to/core
(gdb) bt


Don't do that. Do this instead:



gdb /path/to/a.out /path/to/core
(gdb) bt


If you already did invoke GDB correctly, other likely reasons why bt did not work:




  1. You are analyzing the core on a different machine from the one on which it was produced. See this answer.

  2. You rebuilt a.out with different flags. Use the exact binary that crashed.

  3. You have updated libc after the core was produced. Restore it to the version that was current as of when the core was produced.


P.S. This command




addr2line -e a.out 00007fcd16e5853a




makes no sense: the error message told you that the address 00007fcd16e5853a is in libc-2.24.so. The a.out has nothing to do with that address.



The command you want to use is:



addr2line -fe /path/to/libc-2.24.so 195000


P.P.S.




segfault at 0 ip 00007fcd16e5853a ...




This means: NULL pointer dereference inside libc. The most probable cause: not checking for error return, e.g. something like:



FILE *fp = fopen("/some/file", "r");
fscanf(fp, buffer, sizeof(buffer)); // Oops: didn't check for NULL.





share|improve this answer
















gdb bt




Surely that is not the command you actually executed.



Most likely you did something like this:



gdb /path/to/core
(gdb) bt


Don't do that. Do this instead:



gdb /path/to/a.out /path/to/core
(gdb) bt


If you already did invoke GDB correctly, other likely reasons why bt did not work:




  1. You are analyzing the core on a different machine from the one on which it was produced. See this answer.

  2. You rebuilt a.out with different flags. Use the exact binary that crashed.

  3. You have updated libc after the core was produced. Restore it to the version that was current as of when the core was produced.


P.S. This command




addr2line -e a.out 00007fcd16e5853a




makes no sense: the error message told you that the address 00007fcd16e5853a is in libc-2.24.so. The a.out has nothing to do with that address.



The command you want to use is:



addr2line -fe /path/to/libc-2.24.so 195000


P.P.S.




segfault at 0 ip 00007fcd16e5853a ...




This means: NULL pointer dereference inside libc. The most probable cause: not checking for error return, e.g. something like:



FILE *fp = fopen("/some/file", "r");
fscanf(fp, buffer, sizeof(buffer)); // Oops: didn't check for NULL.






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 25 '18 at 3:52

























answered Nov 24 '18 at 16:31









Employed RussianEmployed Russian

125k20168238




125k20168238













  • Thanks, the gdb part is correct, I just simplified that. I'll check the libc part NULL check

    – gacopu
    Nov 25 '18 at 2:28



















  • Thanks, the gdb part is correct, I just simplified that. I'll check the libc part NULL check

    – gacopu
    Nov 25 '18 at 2:28

















Thanks, the gdb part is correct, I just simplified that. I'll check the libc part NULL check

– gacopu
Nov 25 '18 at 2:28





Thanks, the gdb part is correct, I just simplified that. I'll check the libc part NULL check

– gacopu
Nov 25 '18 at 2:28




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458636%2fgdb-bt-gives-only-how-can-i-debug%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

To store a contact into the json file from server.js file using a class in NodeJS

Marschland