has_addr2line.cpp 578 B

12345678910111213141516171819202122232425
  1. // Copyright Antony Polukhin, 2016-2019.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #include <cstdlib>
  7. #include <string>
  8. #include <boost/config.hpp>
  9. #include <unwind.h>
  10. #include <sys/types.h>
  11. #include <sys/wait.h>
  12. int main() {
  13. #ifdef BOOST_STACKTRACE_ADDR2LINE_LOCATION
  14. std::string s = BOOST_STRINGIZE( BOOST_STACKTRACE_ADDR2LINE_LOCATION );
  15. s += " -h";
  16. #else
  17. std::string s = "/usr/bin/addr2line -h";
  18. #endif
  19. return std::system(s.c_str());
  20. }