Skip to content

Print stacktraces with error messages #2632

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

Merged
merged 7 commits into from
Jan 30, 2020
Merged

Conversation

umar456
Copy link
Member

@umar456 umar456 commented Sep 3, 2019

  • Prints the stacktrace with error messages.
  • Relies on boost::stacktrace
  • Adds the af_set_enable_stacktrace call to enable and disable
    stacktraces at runtime
  • Adds the AF_WITH_STACKTRACE CMake variable to enable and disable
    stacktraces at compile time

Currently the error messages look like this:

In function void af_approx1_common(void**, af_array, af_array, int, double, double, af_interp_type, float, bool)
In file src/api/c/approx.cpp:51
Invalid argument at index 2
Expected: xo != 0

With this PR and linking without libbacktrace.so the error messages will look like this:

In function void af_approx1_common(void**, af_array, af_array, int, double, double, af_interp_type, float, bool)
In file src/api/c/approx.cpp:51
Invalid argument at index 2
Expected: xo != 0
 0# 0x00007F08FB6815B1 in /home/umar/devel/arrayfire/build/src/backend/opencl/libafopencl.so.3
 1# af_approx1_uniform_v2 in /home/umar/devel/arrayfire/build/src/backend/opencl/libafopencl.so.3
 2# 0x000056388E723600 in ./test/approx1_opencl
 3# void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 4# void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 5# testing::Test::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 6# testing::TestInfo::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 7# testing::TestCase::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 8# testing::internal::UnitTestImpl::RunAllTests() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 9# bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
10# bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
11# testing::UnitTest::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
12# RUN_ALL_TESTS() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtest_maind.so
13# main in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtest_maind.so
14# __libc_start_main in /usr/lib/libc.so.6
15# 0x000056388E714C4E in ./test/approx1_opencl

With this PR and with libbacktrace.so the error messages look like this:

In function void af_approx1_common(void**, af_array, af_array, int, double, double, af_interp_type, float, bool)
In file src/api/c/approx.cpp:51
Invalid argument at index 2
Expected: xo != 0
 0# 0x00007F08FB6815B1 in /home/umar/devel/arrayfire/build/src/backend/opencl/libafopencl.so.3
 1# af_approx1_uniform_v2 in /home/umar/devel/arrayfire/build/src/backend/opencl/libafopencl.so.3
 2# 0x000056388E723600 in ./test/approx1_opencl
 3# void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 4# void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 5# testing::Test::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 6# testing::TestInfo::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 7# testing::TestCase::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 8# testing::internal::UnitTestImpl::RunAllTests() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
 9# bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
10# bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
11# testing::UnitTest::Run() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtestd.so
12# RUN_ALL_TESTS() in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtest_maind.so
13# main in /home/umar/devel/arrayfire/build/test/gtest/googlemock/gtest/libgtest_maind.so
14# __libc_start_main in /usr/lib/libc.so.6
15# 0x000056388E714C4E in ./test/approx1_opencl

9prady9
9prady9 previously requested changes Sep 3, 2019
Copy link
Member

@9prady9 9prady9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, I did check whats the compiler error but there are few in all the builds.

Copy link
Contributor

@WilliamTambellini WilliamTambellini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, so are you using :

* Prints the stacktrace with error messages.
* Relies on boost::stacktrace
* Adds the af_set_enable_stacktrace call to enable and disable
  stacktraces at runtime
* Adds the AF_WITH_STACKTRACE CMake variable to enable and disable
  stacktraces at compile time
CMP0074)
CMP0074
CMP0077
CMP0079)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would throw error with CMake versions < 3.13.0

@umar456 umar456 dismissed 9prady9’s stale review January 30, 2020 23:58

Addressed feedback

@umar456 umar456 merged commit 106b258 into arrayfire:master Jan 30, 2020
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.

4 participants