-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem: cannot get stack trace #1965
Comments
Also making an assert to print the full stack trace will also help |
-g should be enabled by default. Try appending to ./configure: CFLAGS="-g" CXXFLAGS="-g" |
Also if you run make V=1, is the -g flag passed by default? |
still same output Attached are the configure output and make output I run the following commands
|
Yeah just checked here, default ./configure and -g is passed when compiling and when linking both the test and the library. |
So what I'm I missing? I'm trying to check what is causing the mutex to be recursive, so I changed the type to PTHREAD_MUTEX_ERRORCHECK. Now I'm running the tests, and tests failed as expected, however assert only give the line number and file and I need the stack trace, so I'm using this:
Which doesn't print the method names. I suspect the test binaries are missing the symbols files or debug argument. [1] https://github.com/zeromq/libzmq/blob/master/src/mutex.hpp#L104 |
Yeah I can reproduce your problem:
Curiously glibc symbols are there. I wonder if the backtrace functionality in glibc needs the symbols installed in /usr/lib/dbg, rather than in the binary itself? I don't think it's a problem of our build system, since running the same test in GDB and using the backtrace command it works just fine:
|
manpage says that you need rdynamic, and with optimization the symbol names might not be available. |
thanks, your stack trace actually gave me a direction. But it would be nice to see the stack trace |
Now that I remember, some of our stuff uses libunwind and it works, let me try and dig up an example |
Ta-dan :-)
|
@bluca great!!! what do I need to change? |
This uses libunwind. I can clear up the snippet, and add a print_backtrace() helper function, maybe in zmq_utils. |
sounds good, thanks!!!! |
Will send as soon as I clean it up. Also managed to get demangled names:
|
I'm trying to debug libzmq and cannot stack trace on assert, I'm trying the following:
But I don't get the methods names, for example:
I try to configure with --enable-debug, but output is the same.
I'm actually using the libzmq tests (make check), so how do I compile the tests with symbols of libzmq?
Platform is Ubuntu and using autotools.
The text was updated successfully, but these errors were encountered: