backward-cpp
backward-cpp copied to clipboard
Improvement to examples for correctness
This is with VS2019, latest version.
I noticed that the first time I attempted to print a stack trace it was always empty, but on subsequent prints it did work.
After investigating I discovered it was because I was using the example code as is-- and this code is not really correct.
using namespace backward;
StackTrace st; st.load_here(32);
Printer p; p.print(st);
This does not work because the symbols are not loaded until Printer is constructed, but it generates the stacktrace prior to that.
Simply rearranging this code fixes this bug
Printer p;
StackTrace st; st.load_here(32);
p.print(st);
Maybe update the examples ? Thanks