Merge branch 'master' into clean-up-1
This commit is contained in:
commit
15aef522be
27 changed files with 4004 additions and 2083 deletions
|
|
@ -70,7 +70,7 @@ Installing the Anbox snap is very simple:
|
|||
$ snap install --devmode --beta anbox
|
||||
```
|
||||
|
||||
If you didn't logged into the Ubuntu Store yet, the `snap` command will
|
||||
If you haven't logged into the Ubuntu Store yet, the `snap` command will
|
||||
ask you to use `sudo snap ...` in order to install the snap:
|
||||
|
||||
```
|
||||
|
|
|
|||
2
external/CMakeLists.txt
vendored
2
external/CMakeLists.txt
vendored
|
|
@ -1,5 +1,5 @@
|
|||
add_subdirectory(process-cpp-minimal)
|
||||
add_subdirectory(android-emugl)
|
||||
add_subdirectory(xdg)
|
||||
add_subdirectory(backtrace-cpp)
|
||||
add_subdirectory(backward-cpp)
|
||||
add_subdirectory(cpu_features)
|
||||
|
|
|
|||
1998
external/backtrace-cpp/backward.hpp
vendored
1998
external/backtrace-cpp/backward.hpp
vendored
File diff suppressed because it is too large
Load diff
15
external/backtrace-cpp/test_package/conanfile.py
vendored
15
external/backtrace-cpp/test_package/conanfile.py
vendored
|
|
@ -1,15 +0,0 @@
|
|||
from conans import ConanFile, CMake
|
||||
import os
|
||||
|
||||
class TestBackward(ConanFile):
|
||||
settings = 'os', 'compiler', 'build_type', 'arch'
|
||||
requires = 'cmake-utils/0.0.0@Manu343726/testing', 'backward/0.0.0@Manu343726/testing'
|
||||
generators = 'cmake'
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self.settings)
|
||||
self.run('cmake {} {}'.format(self.conanfile_directory, cmake.command_line))
|
||||
self.run('cmake --build . {}'.format(cmake.build_config))
|
||||
|
||||
def test(self):
|
||||
self.run(os.path.join('.', 'bin', 'example'))
|
||||
|
|
@ -22,4 +22,4 @@ install:
|
|||
|
||||
script:
|
||||
- valgrind ctest .. --verbose
|
||||
- cd ${TRAVIS_BUILD_DIR} && conan test_package --build=outdated
|
||||
- cd ${TRAVIS_BUILD_DIR} && conan create . Manu343726/testing --build=outdated
|
||||
|
|
@ -38,6 +38,10 @@ set(STACK_DETAILS_DW FALSE CACHE BOOL
|
|||
"Use libdw to read debug info")
|
||||
set(STACK_DETAILS_BFD FALSE CACHE BOOL
|
||||
"Use libbfd to read debug info")
|
||||
set(STACK_DETAILS_DWARF FALSE CACHE BOOL
|
||||
"Use libdwarf/libelf to read debug info")
|
||||
|
||||
set(BACKWARD_TESTS FALSE CACHE BOOL "Enable tests")
|
||||
|
||||
###############################################################################
|
||||
# CONFIGS
|
||||
|
|
@ -67,77 +71,132 @@ if (${STACK_DETAILS_AUTO_DETECT})
|
|||
mark_as_advanced(LIBBFD_INCLUDE_DIR LIBBFD_LIBRARY
|
||||
LIBDL_INCLUDE_DIR LIBDL_LIBRARY)
|
||||
|
||||
# find libdwarf
|
||||
find_path(LIBDWARF_INCLUDE_DIR NAMES "libdwarf.h" PATH_SUFFIXES libdwarf)
|
||||
find_path(LIBELF_INCLUDE_DIR NAMES "libelf.h")
|
||||
find_path(LIBDL_INCLUDE_DIR NAMES "dlfcn.h")
|
||||
find_library(LIBDWARF_LIBRARY dwarf)
|
||||
find_library(LIBELF_LIBRARY elf)
|
||||
find_library(LIBDL_LIBRARY dl)
|
||||
set(LIBDWARF_INCLUDE_DIRS ${LIBDWARF_INCLUDE_DIR} ${LIBELF_INCLUDE_DIR} ${LIBDL_INCLUDE_DIR})
|
||||
set(LIBDWARF_LIBRARIES ${LIBDWARF_LIBRARY} ${LIBELF_LIBRARY} ${LIBDL_LIBRARY})
|
||||
find_package_handle_standard_args(libdwarf DEFAULT_MSG
|
||||
LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR
|
||||
LIBELF_LIBRARY LIBELF_INCLUDE_DIR
|
||||
LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
|
||||
mark_as_advanced(LIBDWARF_INCLUDE_DIR LIBDWARF_LIBRARY
|
||||
LIBELF_INCLUDE_DIR LIBELF_LIBRARY
|
||||
LIBDL_INCLUDE_DIR LIBDL_LIBRARY)
|
||||
|
||||
if (LIBDW_FOUND)
|
||||
LIST(APPEND _BACKWARD_INCLUDE_DIRS ${LIBDW_INCLUDE_DIRS})
|
||||
LIST(APPEND BACKWARD_LIBRARIES ${LIBDW_LIBRARIES})
|
||||
LIST(APPEND _BACKWARD_LIBRARIES ${LIBDW_LIBRARIES})
|
||||
set(STACK_DETAILS_DW TRUE)
|
||||
set(STACK_DETAILS_BFD FALSE)
|
||||
set(STACK_DETAILS_DWARF FALSE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL FALSE)
|
||||
elseif(LIBBFD_FOUND)
|
||||
LIST(APPEND _BACKWARD_INCLUDE_DIRS ${LIBBFD_INCLUDE_DIRS})
|
||||
LIST(APPEND BACKWARD_LIBRARIES ${LIBBFD_LIBRARIES})
|
||||
LIST(APPEND _BACKWARD_LIBRARIES ${LIBBFD_LIBRARIES})
|
||||
|
||||
# If we attempt to link against static bfd, make sure to link its dependencies, too
|
||||
get_filename_component(bfd_lib_ext "${LIBBFD_LIBRARY}" EXT)
|
||||
if (bfd_lib_ext STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
list(APPEND _BACKWARD_LIBRARIES iberty z)
|
||||
endif()
|
||||
|
||||
set(STACK_DETAILS_DW FALSE)
|
||||
set(STACK_DETAILS_BFD TRUE)
|
||||
set(STACK_DETAILS_DWARF FALSE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL FALSE)
|
||||
elseif(LIBDWARF_FOUND)
|
||||
LIST(APPEND _BACKWARD_INCLUDE_DIRS ${LIBDWARF_INCLUDE_DIRS})
|
||||
LIST(APPEND BACKWARD_LIBRARIES ${LIBDWARF_LIBRARIES})
|
||||
|
||||
set(STACK_DETAILS_DW FALSE)
|
||||
set(STACK_DETAILS_BFD FALSE)
|
||||
set(STACK_DETAILS_DWARF TRUE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL FALSE)
|
||||
else()
|
||||
set(STACK_DETAILS_DW FALSE)
|
||||
set(STACK_DETAILS_BFD FALSE)
|
||||
set(STACK_DETAILS_DWARF FALSE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL TRUE)
|
||||
endif()
|
||||
else()
|
||||
if (STACK_DETAILS_DW)
|
||||
LIST(APPEND BACKWARD_LIBRARIES dw)
|
||||
LIST(APPEND _BACKWARD_LIBRARIES dw)
|
||||
endif()
|
||||
|
||||
if (STACK_DETAILS_BFD)
|
||||
LIST(APPEND BACKWARD_LIBRARIES bfd dl)
|
||||
LIST(APPEND _BACKWARD_LIBRARIES bfd dl)
|
||||
endif()
|
||||
|
||||
if (STACK_DETAILS_DWARF)
|
||||
LIST(APPEND _BACKWARD_LIBRARIES dwarf elf)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(map_definitions var_prefix define_prefix)
|
||||
foreach(def ${ARGN})
|
||||
if (${${var_prefix}${def}})
|
||||
LIST(APPEND BACKWARD_DEFINITIONS "${define_prefix}${def}=1")
|
||||
LIST(APPEND _BACKWARD_DEFINITIONS "${define_prefix}${def}=1")
|
||||
else()
|
||||
LIST(APPEND BACKWARD_DEFINITIONS "${define_prefix}${def}=0")
|
||||
LIST(APPEND _BACKWARD_DEFINITIONS "${define_prefix}${def}=0")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
if (NOT BACKWARD_DEFINITIONS)
|
||||
if (NOT _BACKWARD_DEFINITIONS)
|
||||
map_definitions("STACK_WALKING_" "BACKWARD_HAS_" UNWIND BACKTRACE)
|
||||
map_definitions("STACK_DETAILS_" "BACKWARD_HAS_" BACKTRACE_SYMBOL DW BFD)
|
||||
map_definitions("STACK_DETAILS_" "BACKWARD_HAS_" BACKTRACE_SYMBOL DW BFD DWARF)
|
||||
endif()
|
||||
|
||||
foreach(def ${BACKWARD_DEFINITIONS})
|
||||
message(STATUS "${def}")
|
||||
endforeach()
|
||||
set(BACKWARD_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
find_path(BACKWARD_INCLUDE_DIR backward.hpp PATHS ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(BACKWARD_HAS_EXTERNAL_LIBRARIES FALSE)
|
||||
set(FIND_PACKAGE_REQUIRED_VARS BACKWARD_INCLUDE_DIR)
|
||||
if(DEFINED _BACKWARD_LIBRARIES)
|
||||
set(BACKWARD_HAS_EXTERNAL_LIBRARIES TRUE)
|
||||
list(APPEND FIND_PACKAGE_REQUIRED_VARS _BACKWARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Backward
|
||||
REQUIRED_VARS
|
||||
BACKWARD_INCLUDE_DIR
|
||||
BACKWARD_LIBRARIES
|
||||
REQUIRED_VARS ${FIND_PACKAGE_REQUIRED_VARS}
|
||||
)
|
||||
list(APPEND _BACKWARD_INCLUDE_DIRS ${BACKWARD_INCLUDE_DIR})
|
||||
|
||||
macro(add_backward target)
|
||||
target_include_directories(${target} PRIVATE ${_BACKWARD_INCLUDE_DIRS})
|
||||
target_include_directories(${target} PRIVATE ${BACKWARD_INCLUDE_DIRS})
|
||||
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${BACKWARD_DEFINITIONS})
|
||||
set_property(TARGET ${target} APPEND PROPERTY LINK_LIBRARIES ${BACKWARD_LIBRARIES})
|
||||
endmacro()
|
||||
|
||||
set(BACKWARD_INCLUDE_DIRS ${_BACKWARD_INCLUDE_DIRS} CACHE INTERNAL "_BACKWARD_INCLUDE_DIRS")
|
||||
set(BACKWARD_DEFINITIONS ${BACKWARD_DEFINITIONS} CACHE INTERNAL "BACKWARD_DEFINITIONS")
|
||||
set(BACKWARD_LIBRARIES ${BACKWARD_LIBRARIES} CACHE INTERNAL "BACKWARD_LIBRARIES")
|
||||
mark_as_advanced(_BACKWARD_INCLUDE_DIRS BACKWARD_DEFINITIONS BACKWARD_LIBRARIES)
|
||||
set(BACKWARD_DEFINITIONS ${_BACKWARD_DEFINITIONS} CACHE INTERNAL "BACKWARD_DEFINITIONS")
|
||||
set(BACKWARD_LIBRARIES ${_BACKWARD_LIBRARIES} CACHE INTERNAL "BACKWARD_LIBRARIES")
|
||||
mark_as_advanced(BACKWARD_INCLUDE_DIRS BACKWARD_DEFINITIONS BACKWARD_LIBRARIES)
|
||||
|
||||
# Expand each definition in BACKWARD_DEFINITIONS to its own cmake var and export
|
||||
# to outer scope
|
||||
foreach(var ${BACKWARD_DEFINITIONS})
|
||||
string(REPLACE "=" ";" var_as_list ${var})
|
||||
list(GET var_as_list 0 var_name)
|
||||
list(GET var_as_list 1 var_value)
|
||||
set(${var_name} ${var_value})
|
||||
mark_as_advanced(${var_name})
|
||||
endforeach()
|
||||
|
||||
if (NOT TARGET Backward::Backward)
|
||||
add_library(Backward::Backward INTERFACE IMPORTED)
|
||||
set_target_properties(Backward::Backward PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_BACKWARD_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${BACKWARD_LIBRARIES}"
|
||||
INTERFACE_COMPILE_DEFINITIONS "${BACKWARD_DEFINITIONS}"
|
||||
)
|
||||
endif()
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${BACKWARD_INCLUDE_DIRS}"
|
||||
INTERFACE_COMPILE_DEFINITIONS "${BACKWARD_DEFINITIONS}"
|
||||
)
|
||||
if(BACKWARD_HAS_EXTERNAL_LIBRARIES)
|
||||
set_target_properties(Backward::Backward PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${BACKWARD_LIBRARIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -25,20 +25,35 @@ project(backward CXX)
|
|||
|
||||
include(BackwardConfig.cmake)
|
||||
|
||||
# check if compiler is nvcc or nvcc_wrapper
|
||||
set(COMPILER_IS_NVCC false)
|
||||
get_filename_component(COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME)
|
||||
if (COMPILER_NAME MATCHES "^nvcc")
|
||||
set(COMPILER_IS_NVCC true)
|
||||
endif()
|
||||
|
||||
# set CXX standard
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
if (${COMPILER_IS_NVCC})
|
||||
# GNU CXX extensions are not supported by nvcc
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
# COMPILER FLAGS
|
||||
###############################################################################
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic-errors")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
if (NOT ${COMPILER_IS_NVCC})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
endif()
|
||||
|
||||
# ANBOX: allow old-style casts
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=old-style-cast -Wno-error=switch-default")
|
||||
# Anbox: allow old-style cast, unknown pragmas
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=old-style-cast -Wno-error=unknown-pragmas")
|
||||
|
||||
###############################################################################
|
||||
# BACKWARD OBJECT
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Backward-cpp [](http://www.conan.io/source/backward/0.0.0/Manu343726/testing) [](https://travis-ci.org/cwbombela/backward-cpp)
|
||||
Backward-cpp [](http://www.conan.io/source/backward/1.3.0/Manu343726/testing) [](https://travis-ci.org/bombela/backward-cpp)
|
||||
============
|
||||
|
||||
Backward is a beautiful stack trace pretty printer for C++.
|
||||
|
|
@ -21,7 +21,7 @@ You can see that for the trace #1 in the example, the function
|
|||
`you_shall_not_pass()` was inlined in the function `...read2::do_test()` by the
|
||||
compiler.
|
||||
|
||||
##Installation
|
||||
## Installation
|
||||
|
||||
#### Install backward.hpp
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ errors (segfault, abort, un-handled exception...), simply add a copy of
|
|||
The code in `backward.cpp` is trivial anyway, you can simply copy what it's
|
||||
doing at your convenience.
|
||||
|
||||
##Configuration & Dependencies
|
||||
## Configuration & Dependencies
|
||||
|
||||
### Integration with CMake
|
||||
|
||||
|
|
@ -127,7 +127,10 @@ easiest for you to install, so pick your poison:
|
|||
|
||||
apt-get install binutils-dev (or equivalent)
|
||||
|
||||
And do not forget to link with the lib: `g++/clang++ -lbfd ...`
|
||||
And do not forget to link with the lib: `g++/clang++ -lbfd -ldl ...`
|
||||
|
||||
This library requires dynamic loading. Which is provided by the library `dl`.
|
||||
Hence why we also link with `-ldl`.
|
||||
|
||||
Then define the following before every inclusion of `backward.hpp` (don't
|
||||
forget to update `backward.cpp` as well):
|
||||
|
|
@ -146,7 +149,29 @@ Of course you can simply add the define (`-DBACKWARD_HAS_...=1`) and the
|
|||
linkage details in your build system and even auto-detect which library is
|
||||
installed, it's up to you.
|
||||
|
||||
That'ss it, you are all set, you should be getting nice stack traces like the
|
||||
#### [libdwarf](https://sourceforge.net/projects/libdwarf/) and [libelf](http://www.mr511.de/software/english.html)
|
||||
|
||||
apt-get install libdwarf-dev (or equivalent)
|
||||
|
||||
And do not forget to link with the lib and inform Backward to use it:
|
||||
|
||||
#define BACKWARD_HAS_DWARF 1
|
||||
|
||||
There are several alternative implementations of libdwarf and libelf that
|
||||
are API compatible so it's possible, although it hasn't been tested, to
|
||||
replace the ones used when developing backward (in bold, below):
|
||||
|
||||
* **_libelf_** by [Michael "Tired" Riepe](http://www.mr511.de/software/english.html)
|
||||
* **_libdwarf_** by [David Anderson](https://www.prevanders.net/dwarf.html)
|
||||
* libelf from [elfutils](https://fedorahosted.org/elfutils/)
|
||||
* libelf and libdwarf from FreeBSD's [ELF Tool Chain](https://sourceforge.net/p/elftoolchain/wiki/Home/) project
|
||||
|
||||
|
||||
Of course you can simply add the define (`-DBACKWARD_HAS_...=1`) and the
|
||||
linkage details in your build system and even auto-detect which library is
|
||||
installed, it's up to you.
|
||||
|
||||
That's it, you are all set, you should be getting nice stack traces like the
|
||||
one at the beginning of this document.
|
||||
|
||||
## API
|
||||
|
|
@ -267,7 +292,7 @@ using namespace backward;
|
|||
StackTrace st; st.load_here(32);
|
||||
Printer p;
|
||||
p.object = true;
|
||||
p.color = false;
|
||||
p.color_mode = ColorMode::always;
|
||||
p.address = true;
|
||||
p.print(st, stderr);
|
||||
```
|
||||
|
|
@ -279,21 +304,29 @@ class Printer { public:
|
|||
// Print a little snippet of code if possible.
|
||||
bool snippet = true;
|
||||
|
||||
// Colorize the trace (only set a color when printing on a terminal)
|
||||
bool color = true;
|
||||
// Colorize the trace
|
||||
// - ColorMode::automatic: Activate colors if possible. For example, when using a TTY on linux.
|
||||
// - ColorMode::always: Always use colors.
|
||||
// - ColorMode::never: Never use colors.
|
||||
bool color_mode = ColorMode::automatic;
|
||||
|
||||
// Add the addresses of every source location to the trace.
|
||||
bool address = false;
|
||||
|
||||
// Even if there is a source location, prints the object the trace comes
|
||||
// from as well.
|
||||
// Even if there is a source location, also prints the object
|
||||
// from where the trace came from.
|
||||
bool object = false;
|
||||
|
||||
// Resolve and print a stack trace. It takes a C FILE* object, only because
|
||||
// it is possible to access the underalying OS-level file descriptor, which
|
||||
// is then used to determine if the output is a terminal to print in color.
|
||||
// Resolve and print a stack trace to the given C FILE* object.
|
||||
// On linux, if the FILE* object is attached to a TTY,
|
||||
// color will be used if color_mode is set to automatic.
|
||||
template <typename StackTrace>
|
||||
FILE* print(StackTrace& st, FILE* os = stderr)
|
||||
FILE* print(StackTrace& st, FILE* fp = stderr);
|
||||
|
||||
// Resolve and print a stack trace to the given std::ostream object.
|
||||
// Color will only be used if color_mode is set to always.
|
||||
template <typename ST>
|
||||
std::ostream& print(ST& st, std::ostream& os);
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -369,7 +402,7 @@ struct ResolvedTrace: public Trace {
|
|||
|
||||
François-Xavier Bourlet <bombela@gmail.com>
|
||||
|
||||
Copyright 2013 Google Inc. All Rights Reserved.
|
||||
Copyright 2013-2017 Google Inc. All Rights Reserved.
|
||||
MIT License.
|
||||
|
||||
### Disclaimer
|
||||
3796
external/backward-cpp/backward.hpp
vendored
Normal file
3796
external/backward-cpp/backward.hpp
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -27,7 +27,7 @@ function mkbuild() {
|
|||
mkdir $builddir 2>/dev/null
|
||||
(
|
||||
cd "$builddir"
|
||||
cmake -DCMAKE_BUILD_TYPE=$buildtype ..
|
||||
cmake -DCMAKE_BUILD_TYPE=$buildtype -DBACKWARD_TESTS=ON ..
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -4,9 +4,9 @@ import os
|
|||
class BackwardCpp(ConanFile):
|
||||
settings = 'os', 'compiler', 'build_type', 'arch'
|
||||
name = 'backward'
|
||||
url = 'https:77github.com/Manu343726/backward-cpp'
|
||||
url = 'https://github.com/bombela/backward-cpp'
|
||||
license = 'MIT'
|
||||
version = '0.0.0'
|
||||
version = '1.3.0'
|
||||
options = {
|
||||
'stack_walking_unwind': [True, False],
|
||||
'stack_walking_backtrace': [True, False],
|
||||
|
|
@ -28,23 +28,11 @@ class BackwardCpp(ConanFile):
|
|||
exports = 'backward.cpp', 'backward.hpp', 'test/*', 'CMakeLists.txt', 'BackwardConfig.cmake'
|
||||
generators = 'cmake'
|
||||
|
||||
def cmake_option(self, option, prefix = ''):
|
||||
return '-D{}{}={}'.format(prefix, option.upper(), self.options[option])
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self.settings)
|
||||
cmake = CMake(self)
|
||||
|
||||
options = ''
|
||||
options += self.cmake_option('stack_walking_unwind')
|
||||
options += self.cmake_option('stack_walking_backtrace')
|
||||
options += self.cmake_option('stack_details_auto_detect')
|
||||
options += self.cmake_option('stack_details_backtrace_symbol')
|
||||
options += self.cmake_option('stack_details_dw')
|
||||
options += self.cmake_option('stack_details_bfd')
|
||||
options += self.cmake_option('shared', prefix = 'BACKWARD_')
|
||||
|
||||
self.run('cmake {} {} {} -DBACKWARD_TESTS=OFF'.format(self.conanfile_directory, cmake.command_line, options))
|
||||
self.run('cmake --build . {}'.format(cmake.build_config))
|
||||
cmake.configure(defs={'BACKWARD_' + name.upper(): value for name, value in self.options.values.as_list()})
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
self.copy('backward.hpp', os.path.join('include', 'backward'))
|
||||
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 6 KiB |
|
|
@ -24,10 +24,35 @@
|
|||
#include "test.hpp"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#ifndef __APPLE__
|
||||
#include <error.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <stdarg.h>
|
||||
|
||||
void error(int status, int errnum, const char *format, ...) {
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: ", getprogname());
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
|
||||
if (errnum != 0) {
|
||||
fprintf(stderr, ": %s\n", strerror(errnum));
|
||||
} else {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (status != 0) {
|
||||
exit(status);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
test::test_registry_t test::test_registry;
|
||||
using namespace test;
|
||||
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "backward.hpp"
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include "test/test.hpp"
|
||||
|
||||
|
|
@ -64,6 +64,8 @@ TEST_ABORT (calling_abort)
|
|||
abort_abort_I_repeat_abort_abort();
|
||||
}
|
||||
|
||||
// aarch64 does not trap Division by zero
|
||||
#ifndef __aarch64__
|
||||
volatile int zero = 0;
|
||||
|
||||
int divide_by_zero()
|
||||
|
|
@ -78,7 +80,10 @@ TEST_DIVZERO (divide_by_zero)
|
|||
int v = divide_by_zero();
|
||||
std::cout << "v=" << v << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Darwin does not allow RLIMIT_STACK to be reduced
|
||||
#ifndef __APPLE__
|
||||
int bye_bye_stack(int i) {
|
||||
return bye_bye_stack(i + 1) + bye_bye_stack(i * 2);
|
||||
}
|
||||
|
|
@ -91,3 +96,4 @@ TEST_SEGFAULT(stackoverflow)
|
|||
int r = bye_bye_stack(42);
|
||||
std::cout << "r=" << r << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -37,8 +37,8 @@ namespace test {
|
|||
struct AssertFailedError: std::exception {
|
||||
~AssertFailedError() throw() {}
|
||||
|
||||
AssertFailedError(const char* filename, int line, const char* errmsg):
|
||||
basename(_basename(filename)), line(line), errmsg(errmsg) {}
|
||||
AssertFailedError(const char* filename, int _line, const char* _errmsg):
|
||||
basename(_basename(filename)), line(_line), errmsg(_errmsg) {}
|
||||
|
||||
const char* what() const throw() {
|
||||
if (not _what.size()) {
|
||||
|
|
@ -2,10 +2,7 @@ project(backward-package-test)
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
include(${CONAN_CMAKE-UTILS_ROOT}/conan.cmake)
|
||||
conan_basic_setup()
|
||||
|
||||
add_conan_library(backward)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_executable(example main.cpp)
|
||||
target_link_libraries(example PRIVATE backward-conan)
|
||||
target_link_libraries(example PRIVATE ${CONAN_TARGETS})
|
||||
14
external/backward-cpp/test_package/conanfile.py
vendored
Normal file
14
external/backward-cpp/test_package/conanfile.py
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from conans import ConanFile, CMake
|
||||
import os
|
||||
|
||||
class TestBackward(ConanFile):
|
||||
settings = 'os', 'compiler', 'build_type', 'arch'
|
||||
generators = 'cmake'
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure(defs={'CMAKE_VERBOSE_MAKEFILE': 'ON'})
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
self.run(os.path.join('.', 'bin', 'example'))
|
||||
Loading…
Add table
Add a link
Reference in a new issue