Skip to content

Comments

[Proposal] Use Backward for printing pretty stack trace#706

Open
splhack wants to merge 6 commits intordaly525:masterfrom
splhack:backward
Open

[Proposal] Use Backward for printing pretty stack trace#706
splhack wants to merge 6 commits intordaly525:masterfrom
splhack:backward

Conversation

@splhack
Copy link
Contributor

@splhack splhack commented Mar 2, 2019

The current ASSERT stack trace is not demangled, so it is hard to debug. This proposal is introducing https://github.com/bombela/backward-cpp to print pretty stack trace instead. This PR uses libdw from elfutils because it supports Linux and macOS (I think.)

Sample output on unit test.

Stack trace (most recent call last):
#6    Object "", at 0xffffffffffffffff, in
#5    Object "/home/kaz/coreir/tests/unit/build/blackbox_verilog", at 0x56310e758419, in _start
#4    Source "../csu/libc-start.c", line 310, in __libc_start_main
#3    Source "/home/kaz/coreir/tests/unit/blackbox_verilog.cpp", line 41, in main
         38: }
         39:
         40: int main() {
      >  41:   testBlackboxVerilog();
         42: }
#2    Source "/home/kaz/coreir/tests/unit/blackbox_verilog.cpp", line 34, in testBlackboxVerilog
         31:   std::ifstream golden_stream("blackbox_verilog_golden.v");
         32:   std::string golden((std::istreambuf_iterator<char>(golden_stream)),
         33:                      std::istreambuf_iterator<char>());
      >  34:   ASSERT(golden == verilog,
         35:          "Expected '" + golden + "' but got '" + verilog + "'");
         36:
         37:   deleteContext(c);
#1    Source "../../include/coreir/tools/backward.hpp", line 751, in load_here

splhack and others added 5 commits March 2, 2019 14:33
@rdaly525
Copy link
Owner

This looks great! I just want to confirm that if someone does not have libdw, it will still work correctly.

@splhack
Copy link
Contributor Author

splhack commented Mar 15, 2019

Yeah it works without libdw (less information though, just the same as the current stack trace).
And CMakefying(#654) would help to enable linking libdw by user easily!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants