projects/aports·blob master · refs

120 lines · 4.4 KiB

1diff --git a/CMakeLists.txt b/CMakeLists.txt
2index bfb5ff3..681da79 100644
3--- a/CMakeLists.txt
4+++ b/CMakeLists.txt
5@@ -22,7 +22,6 @@ find_package(Boost COMPONENTS iostreams REQUIRED)
6 find_package(PkgConfig REQUIRED)
7 set(THREADS_PREFER_PTHREAD_FLAG ON)
8 find_package(Threads REQUIRED)
9-find_package(Backtrace)
10
11 pkg_check_modules(PROPERTIES_CPP properties-cpp)
12
13diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
14index 872b4f0..41dfec4 100644
15--- a/src/CMakeLists.txt
16+++ b/src/CMakeLists.txt
17@@ -17,9 +17,6 @@
18 add_library(
19 process-cpp SHARED
20
21- core/posix/backtrace.h
22- core/posix/backtrace.cpp
23-
24 core/posix/child_process.cpp
25 core/posix/exec.cpp
26 core/posix/fork.cpp
27@@ -46,7 +43,6 @@ target_link_libraries(
28 Threads::Threads
29
30 ${Boost_LIBRARIES}
31- ${Backtrace_LIBRARIES}
32 )
33
34 # We compile with all symbols visible by default. For the shipping library, we strip
35diff --git a/src/core/posix/fork.cpp b/src/core/posix/fork.cpp
36index 989d647..1b7b2fd 100644
37--- a/src/core/posix/fork.cpp
38+++ b/src/core/posix/fork.cpp
39@@ -19,8 +19,6 @@
40 #include <core/posix/exit.h>
41 #include <core/posix/fork.h>
42
43-#include "backtrace.h"
44-
45 #include <iomanip>
46 #include <iostream>
47 #include <system_error>
48@@ -35,16 +33,6 @@ void redirect_stream_to_fd(int fd, int stream)
49 if (rc == -1)
50 throw std::system_error(errno, std::system_category());
51 }
52-
53-void print_backtrace(std::ostream& out, const std::string& line_prefix)
54-{
55- core::posix::backtrace::visit_with_handler([&out, line_prefix](const core::posix::backtrace::Frame& frame)
56- {
57- out << line_prefix << std::dec << std::setw(2) << frame.depth() << "@" << std::hex << std::setw(14) << frame.frame_pointer() << ": "
58- << (frame.symbol().is_cxx() ? frame.symbol().demangled() : frame.symbol().raw()) << std::endl;
59- return true;
60- });
61-}
62 }
63
64 namespace core
65@@ -95,11 +83,9 @@ ChildProcess fork(const std::function<posix::exit::Status()>& main,
66 {
67 std::cerr << "core::posix::fork(): An unhandled std::exception occurred in the child process:" << std::endl
68 << " what(): " << e.what() << std::endl;
69- print_backtrace(std::cerr, " ");
70 } catch(...)
71 {
72 std::cerr << "core::posix::fork(): An unhandled exception occurred in the child process." << std::endl;
73- print_backtrace(std::cerr, " ");
74 }
75
76 // We have to ensure that we exit here. Otherwise, we run into
77@@ -155,11 +141,9 @@ ChildProcess vfork(const std::function<posix::exit::Status()>& main,
78 {
79 std::cerr << "core::posix::fork(): An unhandled std::exception occurred in the child process:" << std::endl
80 << " what(): " << e.what() << std::endl;
81- print_backtrace(std::cerr, " ");
82 } catch(...)
83 {
84 std::cerr << "core::posix::fork(): An unhandled exception occurred in the child process." << std::endl;
85- print_backtrace(std::cerr, " ");
86 }
87
88 // We have to ensure that we exit here. Otherwise, we run into
89diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
90index e116a7f..78bcd05 100644
91--- a/tests/CMakeLists.txt
92+++ b/tests/CMakeLists.txt
93@@ -38,7 +38,6 @@ add_executable(
94
95 # We include an external source file to prevent from leaking
96 # symbols to the outside world
97- ${CMAKE_SOURCE_DIR}/src/core/posix/backtrace.cpp
98 )
99
100 add_executable(
101diff --git a/tests/fork_and_run_test.cpp b/tests/fork_and_run_test.cpp
102index 0a44161..117e0e4 100644
103--- a/tests/fork_and_run_test.cpp
104+++ b/tests/fork_and_run_test.cpp
105@@ -146,15 +146,3 @@ TESTP_F(TestingMacrosFixture, DISABLED_test_fp_macro_reports_success_for_failing
106 return core::posix::exit::Status::failure;
107 })
108
109-#include <core/posix/backtrace.h>
110-
111-TEST(BacktraceSymbolDemangling, demangling_a_cpp_symbol_works)
112-{
113- const char* ref = "tests/fork_and_run_test(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc+0x4b) [0x4591f8]";
114- const char* ref_demangled = "bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)";
115- auto symbol = core::posix::backtrace::Frame::Symbol::for_testing_from_raw_symbol(ref);
116-
117- EXPECT_TRUE(symbol->is_cxx());
118- EXPECT_EQ(ref, symbol->raw());
119- EXPECT_EQ(ref_demangled, symbol->demangled());
120-}