Skip to content
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

Add backtrace to type erasure casting to quickly identify where the issue location #1012

Conversation

Levi-Armstrong
Copy link
Contributor

Now when you have an invalid cast exception with the type erasure you will get a detailed backtrace like what is shown below.

C++ exception with description "TypeErasureBase, tried to cast 'N16tesseract_common10JointStateE' to 'd'
Backtrace:
 0# double& tesseract_common::TypeErasureBase<tesseract_common::TypeErasureInterface, tesseract_common::detail_any::AnyInstance>::as<double>() at ~/catkin_ws/tesseract_ws/src/tesseract-1/tesseract_common/include/tesseract_common/type_erasure.h:225
 1# TesseractCommonUnit_anyUnit_Test::TestBody() at ~/catkin_ws/tesseract_ws/src/tesseract-1/tesseract_common/test/tesseract_common_unit.cpp:378
 2# void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) at ./googletest/src/gtest.cc:2493
 3# testing::Test::Run() at ./googletest/src/gtest.cc:2498
 4# testing::TestInfo::Run() at ./googletest/src/gtest.cc:2657
 5# testing::TestSuite::Run() at ./googletest/src/gtest.cc:2795
 6# testing::internal::UnitTestImpl::RunAllTests() at ./googletest/src/gtest.cc:5336
 7# bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) at ./googletest/src/gtest.cc:2493
 8# testing::UnitTest::Run() at ./googletest/src/gtest.cc:4928
 9# main at ~/catkin_ws/tesseract_ws/src/tesseract-1/tesseract_common/test/tesseract_common_unit.cpp:2479
10# __libc_start_main at ../csu/libc-start.c:342
11# _start in ./tesseract_common_unit

@Levi-Armstrong Levi-Armstrong force-pushed the feature/add-backtrace-type-erasure-cast branch from 2b39526 to 63f9a4b Compare June 7, 2024 16:50
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.13%. Comparing base (6f9582d) to head (de8b39d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1012      +/-   ##
==========================================
- Coverage   90.13%   90.13%   -0.01%     
==========================================
  Files         280      280              
  Lines       15859    15859              
==========================================
- Hits        14295    14294       -1     
- Misses       1564     1565       +1     

see 3 files with indirect coverage changes

@Levi-Armstrong Levi-Armstrong force-pushed the feature/add-backtrace-type-erasure-cast branch 3 times, most recently from 05c8cb6 to de21f2c Compare June 7, 2024 18:50
@Levi-Armstrong
Copy link
Contributor Author

@johnwason Do you know why the if(WIN32) is not working, because it is still adding the other boost library?

@Levi-Armstrong Levi-Armstrong force-pushed the feature/add-backtrace-type-erasure-cast branch 3 times, most recently from 3b2a449 to 2fd7f5a Compare June 7, 2024 20:24
@marip8
Copy link
Contributor

marip8 commented Jun 7, 2024

It would be nice to add demangling to the class names to make the output more readable. That should be available in boost and I think also in the C++ STL

@Levi-Armstrong
Copy link
Contributor Author

It would be nice to add demangling to the class names to make the output more readable. That should be available in boost and I think also in the C++ STL

New output

C++ exception with description "TypeErasureBase, tried to cast 'tesseract_common::JointState' to 'double'

@Levi-Armstrong Levi-Armstrong force-pushed the feature/add-backtrace-type-erasure-cast branch from 2fd7f5a to de8b39d Compare June 7, 2024 22:41
@Levi-Armstrong Levi-Armstrong merged commit bd58a0f into tesseract-robotics:master Jun 8, 2024
9 of 13 checks passed
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