Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb backtrace is not showing full stack-trace with main()

Tags:

c++

gdb

I am using Xalan library. My program is crashing somewhere inside Xalan calls. I would like to see a full stack-trace from main() all the way to crash point. I am using the following command line to compile

g++ -o program.out -g -O0 -lxalan-c myprogram.out

I am using 'backtrace full' command and getting the following output

 #0  0xb79313b4 in xalanc_1_11::XPath::findRoot(xalanc_1_11::XPathExecutionContext&,    xalanc_1_11::XalanNode*, int const*, int, xalanc_1_11::MutableNodeRefList&) const () from     /usr/lib/libxalan-c.so.111
No symbol table info available.
#1  0xb793afa9 in xalanc_1_11::XPath::step(xalanc_1_11::XPathExecutionContext&, xalanc_1_11::XalanNode*, int const*, xalanc_1_11::MutableNodeRefList&) const
() from /usr/lib/libxalan-c.so.111
No symbol table info available.
#2  0xb793d350 in xalanc_1_11::XPath::locationPath(xalanc_1_11::XalanNode*, int const*,  xalanc_1_11::XPathExecutionContext&) const ()
from /usr/lib/libxalan-c.so.111
No symbol table info available.
#3  0xb7937d22 in xalanc_1_11::XPath::executeMore(xalanc_1_11::XalanNode*, int const*,  xalanc_1_11::XPathExecutionContext&) const ()
from /usr/lib/libxalan-c.so.111
 No symbol table info available.
 #4  0xbffff02c in ?? ()
 No symbol table info available.

The above stack-trace is obviously not showing the full stack-trace starting from main(), what am I missing ?

There is only one thread running, here is the output of show threads

  Id   Target Id         Frame
 * 1    Thread 0xb6f79980 (LWP 8888) "xmltest.out" 0xb79313b4 in xalanc_1_11::XPath::findRoot(xalanc_1_11::XPathExecutionContext&, xalanc_1_11::XalanNode*, int const*, int, xalanc_1_11::MutableNodeRefList&) const () from /usr/lib/libxalan-c.so.111
like image 917
fahadash Avatar asked Oct 03 '22 10:10

fahadash


1 Answers

Rebuild libxalan-c with -g and you should see backtraces through it.

As mentioned in the comments -ggdb or -ggdb3 may be needed instead of -g for some targets.

like image 128
Paul Beusterien Avatar answered Oct 13 '22 11:10

Paul Beusterien