-
-
Notifications
You must be signed in to change notification settings - Fork 659
Base your stack tracing / "symbolization" on Boost stack_trace #146
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
Comments
Good to know - I'll most likely use that! |
I should mention that last year I created a de-boostified version of libstacktrace. |
@eyalroz Do you think this is still relevant? Personally, whenever I have a bug I just drop into a debugger and figure things out that way. |
@cdeln : This is a testing framework. Its most common mode of operation is running all the way through and collecting errors and information about where/how/when/why they occurred. A stack trace is important information in that regard. If one is working in C++23, there's |
I'm well aware that it's a testing framework ;) I believe this is only useful when the user code throws an exception or have a failing assertion right?
I still don't see why this is helpful in a test case though, which nails down the exact point of failure for you already. This is my typical workflow. Compile this test with g++ -g
|
its good to have as much information as possible when running on CI and especially if the failure is hard to reproduce IMHO |
I agree, CI can be extremely difficult to debug and might be a good use case for the feature. If there are simple workarounds, isn't that preferable to implementing it as part of this library? This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.ubuntu.com>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[doctest] doctest version is "2.4.11"
[doctest] run with "--help" for options
===============================================================================
main.cpp:9:
TEST CASE: my-test
main.cpp:10: FATAL ERROR: REQUIRE( f() ) is NOT correct!
values: REQUIRE( 0 )
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00005555555706f8 in DOCTEST_ANON_FUNC_14 () at main.cpp:10
10 REQUIRE(f());
#0 0x00005555555706f8 in DOCTEST_ANON_FUNC_14 () at main.cpp:10
#1 0x000055555556fac8 in doctest::Context::run (this=0x7fffffffdd50) at /usr/include/doctest/doctest.h:7007
#2 0x0000555555570571 in main (argc=1, argv=0x7fffffffde88) at /usr/include/doctest/doctest.h:7085 Again, I think the stacktrace is useless for my example, if you can provide a good example then that would help me understand the feature request better. |
No, also with
... // You could do the stacktrace here? I suppose - but why should users of DOCTEST have to set up their own assertion handlers to be able to see stack traces printed? I think that's not reasonable.
Ah, but it doesn't:
if you only tell me an assertion failed at line 3, I may not know which call it is to Bottom line: Remember that this issue is not about whether or not to introduce stack trace support - that had already been added to the roadmap; this one is about what base the implementation on. |
This is exactly what I mean, this feature only makes sense when there is an assertion in the user code as you just described (that is, in the Haven't thought about CHECK and WARN, but that would not be possible to do with gdb as I described in my workaround. It's not in the current and updated roadmap (I understand it might have been 6 years ago): #600 . I see the value of this feature, not arguing on that, I'm just trying to understand how this should work and possible implementation paths. We might now have to make it part of doctest, but could be possible to do as a plugin integration thingie.... that would imply less maintenance burden on doctest, and allow users to use different ways to do stacktracing. |
Regardless of whether this is added, I'd argue against introducing third-party dependencies into doctest, unless they are entirely optional. The main appeal of doctest for me is the ability to quickly drop it into a project without much hassle. If suddenly it now depends on This feature was noted in the original |
@mitchgrout : Certainly agree that no dependence should be mandatory; either an opportunistic dependence on a third-party library / standard library in C++23, or a "vendored" stack trace library as part of doctest.
Well, the user should be able to choose whether or not stack traces are printed, but yes. The motivation is that you might not know where exactly the check failed just by the location of the check - if the function is called from many places. In fact, you might have a |
@mitchgrout Good points @eyalroz I start to grok why this is a good feature I suggest to split the feature into two steps
What do you think? |
@cdeln : If you start with (1.), there will be almost no work to be done for (2.) , I think. But perhaps we could start with configurable stack tracing based on C++23, and have the boost-for-before-C++23 as a second bug. |
Exactly! The art of breaking down problems into easy sub-problems ;) |
Since the implementations in Boost and the standard library are slightly different, to allow "any" stracktrace implementation one would need to abstract. But - eventually it will be up to whoever implements to decide what's easier for them to do first and I'm just speculating. Anyway, remember that this particular issue is not about the feature itself - it was part of the roadmap already. Bottom line: I am ok with any splitting / renaming / rearranging of stack-trace-related issues - go right ahead. |
Uh oh!
There was an error while loading. Please reload this page.
The roadmap includes the following item:
Facebook's folly is by now pretty old. Instead, you should base this work on Antony Polukhin's excellent and extensive work for the Boost Stack Trace library (now officially released as part of Boost, and with documentation, too).
The text was updated successfully, but these errors were encountered: