diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 063ece1..84cf036 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,9 +17,6 @@ add_library( process-cpp SHARED - core/posix/backtrace.h - core/posix/backtrace.cpp - core/posix/child_process.cpp core/posix/exec.cpp core/posix/fork.cpp diff --git a/src/core/posix/fork.cpp b/src/core/posix/fork.cpp index 1c9c1f3..a638da6 100644 --- a/src/core/posix/fork.cpp +++ b/src/core/posix/fork.cpp @@ -19,8 +19,6 @@ #include #include -#include "backtrace.h" - #include #include #include @@ -35,16 +33,6 @@ void redirect_stream_to_fd(int fd, int stream) if (rc == -1) throw std::system_error(errno, std::system_category()); } - -void print_backtrace(std::ostream& out, const std::string& line_prefix) -{ - core::posix::backtrace::visit_with_handler([&out, line_prefix](const core::posix::backtrace::Frame& frame) - { - out << line_prefix << std::dec << std::setw(2) << frame.depth() << "@" << std::hex << std::setw(14) << frame.frame_pointer() << ": " - << (frame.symbol().is_cxx() ? frame.symbol().demangled() : frame.symbol().raw()) << std::endl; - return true; - }); -} } namespace core @@ -95,11 +83,9 @@ ChildProcess fork(const std::function& main, { std::cerr << "core::posix::fork(): An unhandled std::exception occured in the child process:" << std::endl << " what(): " << e.what() << std::endl; - print_backtrace(std::cerr, " "); } catch(...) { std::cerr << "core::posix::fork(): An unhandled exception occured in the child process." << std::endl; - print_backtrace(std::cerr, " "); } // We have to ensure that we exit here. Otherwise, we run into @@ -152,11 +138,9 @@ ChildProcess vfork(const std::function& main, { std::cerr << "core::posix::fork(): An unhandled std::exception occured in the child process:" << std::endl << " what(): " << e.what() << std::endl; - print_backtrace(std::cerr, " "); } catch(...) { std::cerr << "core::posix::fork(): An unhandled exception occured in the child process." << std::endl; - print_backtrace(std::cerr, " "); } // We have to ensure that we exit here. Otherwise, we run into diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ef289ac..ed04104 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -44,7 +44,6 @@ add_executable( # We include an external source file to prevent from leaking # symbols to the outside world - ${CMAKE_SOURCE_DIR}/src/core/posix/backtrace.cpp ) add_executable( diff --git a/tests/fork_and_run_test.cpp b/tests/fork_and_run_test.cpp index 0a44161..117e0e4 100644 --- a/tests/fork_and_run_test.cpp +++ b/tests/fork_and_run_test.cpp @@ -146,15 +146,3 @@ TESTP_F(TestingMacrosFixture, DISABLED_test_fp_macro_reports_success_for_failing return core::posix::exit::Status::failure; }) -#include - -TEST(BacktraceSymbolDemangling, demangling_a_cpp_symbol_works) -{ - const char* ref = "tests/fork_and_run_test(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc+0x4b) [0x4591f8]"; - const char* ref_demangled = "bool testing::internal::HandleExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)"; - auto symbol = core::posix::backtrace::Frame::Symbol::for_testing_from_raw_symbol(ref); - - EXPECT_TRUE(symbol->is_cxx()); - EXPECT_EQ(ref, symbol->raw()); - EXPECT_EQ(ref_demangled, symbol->demangled()); -}