-
Notifications
You must be signed in to change notification settings - Fork 465
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
Don't get the pretty stack trace, only the basic one #52
Comments
It looks like you are not collecting all the trace details in your
It does, read again :) And as far as I can tell, your
If you never catch an exception, eventually your program will call So your idea of storing a stacktrace alongside the Exception is perfectly good, but make sure to collect all the details :) I would advise you to collect the stacktrace in the exception without resolving anything yet, and use the stacktrace printer whenever you want to resolve and print details about the exception stacktrace. Best, |
I was not sure if set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lbfd") is the correct way to link against the library, so i added: target_link_libraries(PfTEngineTest "libbfd.so") now when calling abort in f() i get a pretty nice stacktrace. `i=0
i=1
i=2
i=3
i=4
i=5
i=6
i=7
i=8
i=9
i=10
i=11
i=12
i=13
i=14
i=15
i=16
i=17
i=18
i=19
i=20
i=21
i=22
i=23
i=24
i=25
i=26
i=27
i=28
i=29
i=30
i=31
i=32
i=33
i=34
i=35
i=36
i=37
i=38
i=39
i=40
i=41
Stack trace (most recent call last):
#31 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#30 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#29 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#28 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#27 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#26 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#25 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#24 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#23 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#22 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#21 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#20 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#19 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#18 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#17 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#16 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#15 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#14 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#13 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#12 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#11 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#10 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#9 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#8 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#7 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#6 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#5 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#4 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#3 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 50, in f(int) [0x4be574]
47: else
48: {
49: std::cout << "i=" << i << "\n";
> 50: f(i + 1);
51: }
52: }
#2 Source "/home/gitlab-runner/builds/0c2717af/0/PfTTech/PfTEngine/src/test/pfthread.cpp", line 44, in f(int) [0x4be53b]
41: {
42: if (i >= 42)
43: {
> 44: abort();
45: throw TracedException();
46: }
47: else
#1 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7faf86b13029, in abort
#0 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7faf86b11428, in gsignal
Aborted (Signal sent by tkill() 19122 999)
Aborted |
I am glad that it works now :) |
So the pretty output only shows up if you link against the right libraries? I think there's a bug in the conan recipe then :( |
Only if you link to one of the two lib and of course you set the right
defines for it so that backward-cpp can include the headers and make use of
them.
I have no clue how Conan works. It was a contribution. Maybe there is way
to setup optional dependencies in Conan? Or maybe what you did was the
right way as the Conan recipie did setup the right defines automatically
perhaps?
…On Fri, Jan 13, 2017, 04:47 Manu Sánchez ***@***.***> wrote:
So the pretty output only shows up if you link against the right
libraries? I think there's a bug in the conan recipe then :(
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#52 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANMjCfDclFL3JvNTlzP5X97A1YsAJceks5rR3JfgaJpZM4LeXau>
.
|
From the package recipe perspective, conan is just a python script that tells how to get your project sources, build them, and what build artifacts must be packaged (In this way it works very similar to some system package managers). The only thing that makes it special is that conan is specifically designed for C++, so it keeps track of compiler versioning, abi, platform, etc when building and resolving the dependencies. With this in mind, if there's a bug in the way optional libraries are handled is because I didn't take this right into account when writing the recipe. Specifically, I put one conan option (A package can define multiple options that result in different "variants" of the same package, for example "MyFooLib" Debug vs Release) for each backward-cpp option. Then conan build() method just invokes your CMakeLists.txt with those options. What I forgot is to tell the library (Maybe by modifying how the cmake library target is handled in the CMakeLists.txt) to link against different optional libraries depending on the options. |
Hi, i followed the Readme but i don't get to the pretty stacktrace, only the simple one:
I copied the source from the _test_main.cpp file to my project
I use the following CMAKE settings.
I have installed backward-cpp as subdirectory in my cmake script.
I installed the gnu binutils package under ubuntu 16.04LTS with gcc 5.4.
I neither set the define (-DBACKWARD_HAS_...=1) flag nor used #define BACKWARD_HAS_BFD 1 because it seems that your cmake script automaticly detects the library:
i compile with:
So my question is: What do i have to do to get the full pretty code style?
Have i installed all dependencys correclty ?
Have i forgot something ?
The README doesn't specify what needs to be in code for pretty code ? is it enough just to compile backward.cpp with my target ?
Or do i have to create some classes ?
Do i need to throw special Exceptions or is everything catched ?
Do i need a TRY/CATCH block in main which covers everything ?
Thanks for any help :)
PS: I used the changed code from #51
The text was updated successfully, but these errors were encountered: