Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GDB shows No stack

Tags:

c++

gdb

I am trying to run a test program to see how gdb (backtrace) shows the call stack. I have the following program

#include<iostream>
#include<assert.h>

void fun2()
{
        assert(0);
}
void fun1()
{
        fun2();
}
int main()
{
        fun1();
        return 0;
}

And i do the following:

g++ -g dump.cpp -o out 
./out
out: dump.cpp:16: void fun2(): Assertion `0' failed.
Abort (core dumped)
gdb out core.28149



(gdb) bt
No stack. //Why does it show no stack here

I was expecting it to show the call stack as :

fun2
fun1
main

Edit: I edited the code and compiled as g++ -g -O0 dump.cpp -o out

But still i have No Stack

void fun2(int num)
{

        int h=23;
        if(h*num>100)
        {
                assert(0);
        }
        else
        {
                cout<<"Hello";
        }
}
void fun1(int num)
{
        {
                fun2(num);
        }
}
int main()
{
        int num;
        cin>>num;
        fun1(num);
        return 0;
}

Assembly code shows me this time the separate code for fun1,fun2(assert),main. But still I see No Stack in gdb

like image 528
anurag86 Avatar asked Oct 17 '22 19:10

anurag86


1 Answers

Reading symbols from /somepath here../tmp/out...done. "/somepath here/core.30117" is not a core dump: File format not recognized

Your core dump is somehow corrupted. Actually it was not loaded by gdb so typing bt has no effect.

Try to examine it, these command should give you some info about core dump:

  • file core.28149
  • strings core.28149
like image 100
ks1322 Avatar answered Oct 21 '22 04:10

ks1322