-
Notifications
You must be signed in to change notification settings - Fork 77
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
Not getting line numbers with addr2line #97
Comments
I'm getting the same problem and have tried everything. There should be an addendum in the documentation because the default behaviour I get doesn't match what I see in the docs output (just the binary name, not filename:lineno). #include <iostream>
#include <boost/stacktrace.hpp>
int foo(bool xx)
{
std::cout << boost::stacktrace::stacktrace();
return 22;
}
int main()
{
foo(false);
return 0;
} $ g++ -DBOOST_STACKTRACE_USE_ADDR2LINE -ggdb -rdynamic bb.cpp -o bb -lboost_stacktrace_addr2line -ldl -O0 -fno-omit-frame-pointer -lboost_stacktrace_addr2line && ./bb
0# foo(bool) in ./bb
1# main in ./bb
2# __libc_start_main in /usr/lib/libc.so.6
3# _start in ./bb $ g++ -g -rdynamic bb.cpp -o bb -ldl && ./bb
0# foo(bool) in ./bb
1# main in ./bb
2# __libc_start_main in /usr/lib/libc.so.6
3# _start in ./bb I tried many different variations of the switches and so on but always the output is the same. |
The code that uses addr2line to get a source file and line is broken:
To be honest, I'm not sure that this feature has ever worked. |
@ivanarh :
Then...
|
I don't know exactly. But I suspect that it's happened because boost stacktrace uses GNU libbacktrace from gcc to determine line numbers. Addr2line is used as a fallback when libbacktrace is disabled during compilation or getting a line number has failed.
It's a question for stacktrace maintainer(s). I hope it may be fixed easily, all we need is to perform easy arithmetic with Dl_info structure fields: https://man7.org/linux/man-pages/man3/dladdr.3.html |
I find that on linux, if I only use header-only version. Everything works fine. If linking with library is the only option, do not link with |
It did (and still does) work for binaries that aren't position independent.
With There are two, somewhat separate problems I see with current boost_stacktrace_addr2line on linux (assuming gcc, but clang seems to work the same in that regard):
Here are options for anyone wanting to just get stacktraces:
|
Related discussion: https://stackoverflow.com/q/62973197/7325599 |
I'm building this program based on the first example in the documentation:
I'm using Boost 1.73.0, downloaded built and installed on my Devuan GNU/Linux Beowulf (~= Debian Buster but without systemd) machine. I have both libbacktrace and addr2line installed, and the default compiler is g++-8.3.0 . I'm compiling with
-g
.I get:
I expect to get the line numbers... shouldn't I get them?
The text was updated successfully, but these errors were encountered: