├── .gitmodules ├── .gitignore ├── cmake ├── crashpad-tools.cmake ├── CTestCustom.cmake ├── crashpad-client-test.cmake ├── crashpad-handler-test.cmake ├── crashpad-test-test.cmake ├── crashpad-client.cmake ├── gtest.cmake ├── crashpad-minidump.cmake ├── crashpad-compat.cmake ├── crashpad-common.cmake ├── crashpad-mig.cmake ├── crashpad-handler.cmake ├── minichromium.cmake ├── crashpad-minidump-test.cmake ├── crashpad-test.cmake ├── crashpad-snapshot.cmake ├── crashpad-util-test.cmake ├── crashpad-util.cmake └── crashpad-snapshot-test.cmake ├── .github └── workflows │ ├── macos.yml │ ├── windows.yml │ └── linux.yml ├── README.md ├── CMakeLists.txt └── LICENSE /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.ncb 3 | /build* 4 | nbproject/ 5 | project/ 6 | doxygen/ 7 | *.a 8 | *.o 9 | CMakeCache.txt 10 | CMakeFiles 11 | Makefile 12 | cmake_install.cmake 13 | install_manifest.txt 14 | compile_commands.json 15 | *.so* 16 | CPackConfig.cmake 17 | CPackSourceConfig.cmake 18 | *.spec 19 | *.ncb 20 | *.sdf 21 | *.suo 22 | *.sln 23 | *.vcxproj* 24 | *.vcproj 25 | .cproject 26 | .project 27 | *~ 28 | !*.exe 29 | *.lastbuildstate 30 | *.unsuccessfulbuild 31 | *.tlog 32 | *.idb 33 | *.cd 34 | *.tmp 35 | *.bak 36 | thumbs.db 37 | -------------------------------------------------------------------------------- /cmake/crashpad-tools.cmake: -------------------------------------------------------------------------------- 1 | # Tools library 2 | add_library(crashpad_tools STATIC) 3 | 4 | set_target_properties(crashpad_tools 5 | PROPERTIES 6 | CXX_STANDARD 14 7 | POSITION_INDEPENDENT_CODE ON 8 | CXX_VISIBILITY_PRESET "hidden" 9 | C_VISIBILITY_PRESET "hidden" 10 | VISIBILITY_INLINES_HIDDEN ON 11 | ) 12 | 13 | target_link_libraries(crashpad_tools PRIVATE 14 | minichromium 15 | crashpad_common 16 | ) 17 | 18 | target_sources(crashpad_tools PRIVATE 19 | ${crashpad_git_SOURCE_DIR}/tools/tool_support.cc 20 | ) 21 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: macos 2 | 3 | on: 4 | pull_request: 5 | push: 6 | release: 7 | types: published 8 | 9 | jobs: 10 | macos: 11 | runs-on: macos-10.15 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | with: 16 | submodules: 'true' 17 | fetch-depth: 0 18 | ref: ${{ github.event.pull_request.head.sha }} 19 | 20 | - name: Configure CrashPad 21 | run: | 22 | cmake -DCMAKE_BUILD_TYPE=Release -B build 23 | 24 | - name: Build CrashPad 25 | run: | 26 | cmake --build build -- -j 4 27 | -------------------------------------------------------------------------------- /cmake/CTestCustom.cmake: -------------------------------------------------------------------------------- 1 | set(CTEST_CUSTOM_TESTS_IGNORE 2 | example 3 | example64 4 | SystemSnapshotWinTest.TimeZone 5 | FileReaderHTTPBodyStream.ReadASCIIFile 6 | FileReaderHTTPBodyStream.ReadBinaryFile 7 | HTTPMultipartBuilder.ThreeFileAttachments 8 | HTTPMultipartBuilder.OverwriteFileAttachment 9 | HTTPMultipartBuilder.SharedFormDataAndAttachmentKeyNamespace 10 | VariableBufferSize/CompositeHTTPBodyStreamBufferSize.StringsAndFile/1 11 | VariableBufferSize/CompositeHTTPBodyStreamBufferSize.StringsAndFile/2 12 | VariableBufferSize/CompositeHTTPBodyStreamBufferSize.StringsAndFile/9 13 | VariableBufferSize/CompositeHTTPBodyStreamBufferSize.StringsAndFile/16 14 | VariableBufferSize/CompositeHTTPBodyStreamBufferSize.StringsAndFile/31 15 | VariableBufferSize/CompositeHTTPBodyStreamBufferSize.StringsAndFile/128 16 | VariableBufferSize/CompositeHTTPBodyStreamBufferSize.StringsAndFile/1024 17 | ) -------------------------------------------------------------------------------- /cmake/crashpad-client-test.cmake: -------------------------------------------------------------------------------- 1 | crashpad_add_test(crashpad_client_test) 2 | 3 | target_sources(crashpad_client_test PRIVATE 4 | ${crashpad_git_SOURCE_DIR}/client/annotation_list_test.cc 5 | ${crashpad_git_SOURCE_DIR}/client/annotation_test.cc 6 | ${crashpad_git_SOURCE_DIR}/client/crash_report_database_test.cc 7 | ${crashpad_git_SOURCE_DIR}/client/prune_crash_reports_test.cc 8 | ${crashpad_git_SOURCE_DIR}/client/settings_test.cc 9 | ${crashpad_git_SOURCE_DIR}/client/simple_address_range_bag_test.cc 10 | ${crashpad_git_SOURCE_DIR}/client/simple_string_dictionary_test.cc 11 | ) 12 | 13 | if(APPLE) 14 | target_sources(crashpad_client_test PRIVATE 15 | ${crashpad_git_SOURCE_DIR}/client/simulate_crash_mac_test.cc 16 | ) 17 | endif() 18 | 19 | target_link_libraries(crashpad_client_test PRIVATE 20 | crashpad_util 21 | crashpad_snapshot 22 | crashpad_client 23 | crashpad_test 24 | crashpad_handler_obj 25 | snapshot_test_support 26 | gtest 27 | gtest_main 28 | gmock 29 | minichromium 30 | ZLIB::ZLIB 31 | ) -------------------------------------------------------------------------------- /.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: windows 2 | 3 | on: 4 | pull_request: 5 | push: 6 | release: 7 | types: published 8 | 9 | jobs: 10 | windows_msvc: 11 | runs-on: windows-2019 12 | strategy: 13 | matrix: 14 | platform: [x86, amd64] 15 | steps: 16 | - uses: actions/checkout@v2 17 | with: 18 | submodules: 'true' 19 | fetch-depth: 0 20 | ref: ${{ github.event.pull_request.head.sha }} 21 | 22 | - uses: ilammy/msvc-dev-cmd@v1.4.1 23 | with: 24 | arch: ${{ matrix.platform }} 25 | 26 | - name: Install Dependencies 27 | run: | 28 | Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile $Env:TEMP\ninja-win.zip 29 | Expand-Archive $Env:TEMP\ninja-win.zip -DestinationPath $Env:TEMP\ninja 30 | echo "$Env:TEMP\ninja" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append 31 | ninja --version 32 | 33 | - name: Configure CrashPad 34 | run: | 35 | cmake -G Ninja -B build 36 | 37 | - name: Build CrashPad 38 | run: | 39 | cmake --build build --config Release 40 | -------------------------------------------------------------------------------- /.github/workflows/linux.yml: -------------------------------------------------------------------------------- 1 | name: linux 2 | 3 | on: 4 | pull_request: 5 | push: 6 | release: 7 | types: published 8 | 9 | jobs: 10 | linux: 11 | runs-on: ${{ matrix.os }} 12 | strategy: 13 | matrix: 14 | platform: [clang, gcc] 15 | os: [ubuntu-18.04, ubuntu-20.04] 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | with: 20 | submodules: 'true' 21 | fetch-depth: 0 22 | ref: ${{ github.event.pull_request.head.sha }} 23 | 24 | - name: Set variables 25 | id: vars 26 | run: | 27 | if [ "${{ matrix.platform }}" = "clang" ] 28 | then 29 | echo "::set-output name=cc::clang" 30 | echo "::set-output name=cxx::clang++" 31 | else 32 | echo "::set-output name=cc::gcc" 33 | echo "::set-output name=cxx::g++" 34 | fi 35 | 36 | - name: Configure CrashPad 37 | env: 38 | CC: ${{ steps.vars.outputs.cc }} 39 | CXX: ${{ steps.vars.outputs.cxx }} 40 | run: | 41 | cmake -DCMAKE_BUILD_TYPE=Release -B build 42 | 43 | - name: Build CrashPad 44 | run: | 45 | cmake --build build -- -j 4 46 | -------------------------------------------------------------------------------- /cmake/crashpad-handler-test.cmake: -------------------------------------------------------------------------------- 1 | add_executable(crashpad_handler_test_extended_handler) 2 | 3 | set_target_properties(crashpad_handler_test_extended_handler PROPERTIES 4 | CXX_STANDARD 14 5 | POSITION_INDEPENDENT_CODE ON 6 | CXX_VISIBILITY_PRESET "hidden" 7 | C_VISIBILITY_PRESET "hidden" 8 | VISIBILITY_INLINES_HIDDEN ON 9 | ) 10 | 11 | target_sources(crashpad_handler_test_extended_handler PRIVATE 12 | ${crashpad_git_SOURCE_DIR}/handler/crashpad_handler_test_extended_handler.cc 13 | ) 14 | 15 | target_link_libraries(crashpad_handler_test_extended_handler PRIVATE 16 | gtest 17 | crashpad_common 18 | crashpad_compat 19 | crashpad_test 20 | crashpad_minidump 21 | minidump_test_support 22 | crashpad_snapshot 23 | snapshot_test_support 24 | crashpad_util 25 | crashpad_handler_obj 26 | minichromium 27 | AppleFrameworks 28 | crashpad_tools 29 | crashpad_client 30 | ZLIB::ZLIB 31 | ) 32 | 33 | crashpad_add_test(crashpad_handler_test) 34 | 35 | target_sources(crashpad_handler_test PRIVATE 36 | ${crashpad_git_SOURCE_DIR}/handler/minidump_to_upload_parameters_test.cc 37 | ) 38 | 39 | target_link_libraries(crashpad_handler_test PRIVATE 40 | gtest 41 | gtest_main 42 | crashpad_test 43 | crashpad_client 44 | crashpad_snapshot 45 | snapshot_test_support 46 | crashpad_util 47 | crashpad_handler_obj 48 | minichromium 49 | ZLIB::ZLIB 50 | ) 51 | 52 | add_dependencies(crashpad_handler_test crashpad_handler_test_extended_handler) -------------------------------------------------------------------------------- /cmake/crashpad-test-test.cmake: -------------------------------------------------------------------------------- 1 | add_executable(crashpad_test_test_multiprocess_exec_test_child) 2 | 3 | set_target_properties(crashpad_test_test_multiprocess_exec_test_child 4 | PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_sources(crashpad_test_test_multiprocess_exec_test_child PRIVATE 13 | ${crashpad_git_SOURCE_DIR}/test/multiprocess_exec_test_child.cc 14 | ) 15 | 16 | target_link_libraries(crashpad_test_test_multiprocess_exec_test_child PRIVATE 17 | crashpad_common 18 | minichromium 19 | gtest 20 | ) 21 | 22 | if(APPLE) 23 | target_link_libraries(crashpad_test_test_multiprocess_exec_test_child PRIVATE 24 | AppleFrameworks 25 | ) 26 | endif() 27 | 28 | 29 | crashpad_add_test(crashpad_test_test) 30 | target_sources(crashpad_test_test PRIVATE 31 | ${crashpad_git_SOURCE_DIR}/test/hex_string_test.cc 32 | ${crashpad_git_SOURCE_DIR}/test/main_arguments_test.cc 33 | ${crashpad_git_SOURCE_DIR}/test/multiprocess_exec_test.cc 34 | ${crashpad_git_SOURCE_DIR}/test/scoped_guarded_page_test.cc 35 | ${crashpad_git_SOURCE_DIR}/test/scoped_temp_dir_test.cc 36 | ${crashpad_git_SOURCE_DIR}/test/test_paths_test.cc 37 | ) 38 | 39 | if(UNIX) 40 | target_sources(crashpad_test_test PRIVATE 41 | ${crashpad_git_SOURCE_DIR}/test/multiprocess_posix_test.cc 42 | ) 43 | endif() 44 | 45 | if(APPLE) 46 | target_sources(crashpad_test_test PRIVATE 47 | ${crashpad_git_SOURCE_DIR}/test/mac/mach_multiprocess_test.cc 48 | ) 49 | endif() 50 | 51 | target_link_libraries(crashpad_test_test 52 | PRIVATE 53 | gtest 54 | gtest_main 55 | gmock 56 | crashpad_util 57 | minichromium 58 | crashpad_test 59 | crashpad_handler_obj 60 | crashpad_client 61 | ZLIB::ZLIB 62 | ) -------------------------------------------------------------------------------- /cmake/crashpad-client.cmake: -------------------------------------------------------------------------------- 1 | # Crashpad client library 2 | add_library(crashpad_client STATIC) 3 | 4 | set_target_properties(crashpad_client PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_include_directories(crashpad_client PUBLIC 13 | ${mini_chromium_git_SOURCE_DIR} 14 | ${crashpad_git_SOURCE_DIR} 15 | ) 16 | 17 | target_link_libraries(crashpad_client PRIVATE 18 | minichromium 19 | crashpad_common 20 | crashpad_compat 21 | crashpad_util 22 | ) 23 | 24 | target_sources(crashpad_client PRIVATE 25 | ${crashpad_git_SOURCE_DIR}/client/annotation.cc 26 | ${crashpad_git_SOURCE_DIR}/client/annotation_list.cc 27 | ${crashpad_git_SOURCE_DIR}/client/crash_report_database.cc 28 | ${crashpad_git_SOURCE_DIR}/client/crashpad_info.cc 29 | ${crashpad_git_SOURCE_DIR}/client/prune_crash_reports.cc 30 | ${crashpad_git_SOURCE_DIR}/client/settings.cc 31 | ) 32 | 33 | if(APPLE) 34 | target_sources(crashpad_client PRIVATE 35 | ${crashpad_git_SOURCE_DIR}/client/crash_report_database_mac.mm 36 | ${crashpad_git_SOURCE_DIR}/client/crashpad_client_mac.cc 37 | ${crashpad_git_SOURCE_DIR}/client/simulate_crash_mac.cc 38 | ) 39 | endif() 40 | 41 | if (UNIX AND NOT APPLE) 42 | target_sources(crashpad_client PRIVATE 43 | ${crashpad_git_SOURCE_DIR}/client/crashpad_client_linux.cc 44 | ${crashpad_git_SOURCE_DIR}/client/client_argv_handling.cc 45 | ${crashpad_git_SOURCE_DIR}/client/crashpad_info_note.S 46 | ${crashpad_git_SOURCE_DIR}/client/crash_report_database_generic.cc 47 | ) 48 | endif() 49 | 50 | if(WIN32) 51 | target_sources(crashpad_client PRIVATE 52 | ${crashpad_git_SOURCE_DIR}/client/crash_report_database_win.cc 53 | ${crashpad_git_SOURCE_DIR}/client/crashpad_client_win.cc 54 | ) 55 | endif() 56 | -------------------------------------------------------------------------------- /cmake/gtest.cmake: -------------------------------------------------------------------------------- 1 | add_library(gtest OBJECT) 2 | set_target_properties(gtest 3 | PROPERTIES 4 | CXX_STANDARD 14 5 | POSITION_INDEPENDENT_CODE ON 6 | CXX_VISIBILITY_PRESET "hidden" 7 | C_VISIBILITY_PRESET "hidden" 8 | VISIBILITY_INLINES_HIDDEN ON 9 | ) 10 | target_link_libraries(gtest PRIVATE crashpad_common) 11 | target_include_directories(gtest PUBLIC ${googletest_SOURCE_DIR}/googletest/include PRIVATE ${googletest_SOURCE_DIR}/googletest) 12 | target_compile_definitions(gtest PUBLIC GUNIT_NO_GOOGLE3=1) 13 | 14 | target_sources(gtest 15 | PRIVATE 16 | ${googletest_SOURCE_DIR}/googletest/src/gtest-death-test.cc 17 | ${googletest_SOURCE_DIR}/googletest/src/gtest-filepath.cc 18 | ${googletest_SOURCE_DIR}/googletest/src/gtest-internal-inl.h 19 | ${googletest_SOURCE_DIR}/googletest/src/gtest-matchers.cc 20 | ${googletest_SOURCE_DIR}/googletest/src/gtest-port.cc 21 | ${googletest_SOURCE_DIR}/googletest/src/gtest-printers.cc 22 | ${googletest_SOURCE_DIR}/googletest/src/gtest-test-part.cc 23 | ${googletest_SOURCE_DIR}/googletest/src/gtest-typed-test.cc 24 | ${googletest_SOURCE_DIR}/googletest/src/gtest.cc 25 | ) 26 | 27 | add_library(gmock OBJECT) 28 | set_target_properties(gmock 29 | PROPERTIES 30 | CXX_STANDARD 14 31 | POSITION_INDEPENDENT_CODE ON 32 | CXX_VISIBILITY_PRESET "hidden" 33 | C_VISIBILITY_PRESET "hidden" 34 | VISIBILITY_INLINES_HIDDEN ON 35 | ) 36 | target_include_directories(gmock PUBLIC ${googletest_SOURCE_DIR}/googlemock/include) 37 | target_link_libraries(gmock PRIVATE crashpad_common gtest) 38 | 39 | if(NOT MSVC) 40 | target_compile_options(gmock PUBLIC -Wno-inconsistent-missing-override) 41 | endif() 42 | 43 | target_sources(gmock 44 | PRIVATE 45 | ${googletest_SOURCE_DIR}/googlemock/src/gmock-cardinalities.cc 46 | ${googletest_SOURCE_DIR}/googlemock/src/gmock-internal-utils.cc 47 | ${googletest_SOURCE_DIR}/googlemock/src/gmock-matchers.cc 48 | ${googletest_SOURCE_DIR}/googlemock/src/gmock-spec-builders.cc 49 | ${googletest_SOURCE_DIR}/googlemock/src/gmock.cc 50 | ) -------------------------------------------------------------------------------- /cmake/crashpad-minidump.cmake: -------------------------------------------------------------------------------- 1 | # Minidump library 2 | add_library(crashpad_minidump STATIC) 3 | 4 | set_target_properties(crashpad_minidump PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_link_libraries(crashpad_minidump PRIVATE 13 | minichromium 14 | crashpad_common 15 | crashpad_compat 16 | crashpad_util 17 | ) 18 | 19 | target_sources(crashpad_minidump PRIVATE 20 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_annotation_writer.cc 21 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_byte_array_writer.cc 22 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_context_writer.cc 23 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_crashpad_info_writer.cc 24 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_exception_writer.cc 25 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_extensions.cc 26 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_file_writer.cc 27 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_handle_writer.cc 28 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_memory_info_writer.cc 29 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_memory_writer.cc 30 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_misc_info_writer.cc 31 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_module_crashpad_info_writer.cc 32 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_module_writer.cc 33 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_rva_list_writer.cc 34 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_simple_string_dictionary_writer.cc 35 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_stream_writer.cc 36 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_string_writer.cc 37 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_system_info_writer.cc 38 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_thread_id_map.cc 39 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_thread_writer.cc 40 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_unloaded_module_writer.cc 41 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_user_extension_stream_data_source.cc 42 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_user_stream_writer.cc 43 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_writable.cc 44 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_writer_util.cc 45 | ) 46 | -------------------------------------------------------------------------------- /cmake/crashpad-compat.cmake: -------------------------------------------------------------------------------- 1 | # Compat library. 2 | if(APPLE) 3 | add_library(crashpad_compat INTERFACE) 4 | else() 5 | add_library(crashpad_compat STATIC) 6 | target_link_libraries(crashpad_compat PRIVATE crashpad_common) 7 | 8 | set_target_properties(crashpad_compat 9 | PROPERTIES 10 | CXX_STANDARD 14 11 | POSITION_INDEPENDENT_CODE ON 12 | CXX_VISIBILITY_PRESET "hidden" 13 | C_VISIBILITY_PRESET "hidden" 14 | VISIBILITY_INLINES_HIDDEN ON 15 | ) 16 | endif() 17 | 18 | 19 | if(WIN32) 20 | target_sources(crashpad_compat PRIVATE 21 | ${crashpad_git_SOURCE_DIR}/compat/win/strings.cc 22 | ${crashpad_git_SOURCE_DIR}/compat/win/time.cc 23 | ${crashpad_git_SOURCE_DIR}/third_party/getopt/getopt.cc 24 | ) 25 | 26 | target_include_directories(crashpad_compat PUBLIC 27 | ${crashpad_git_SOURCE_DIR}/compat/win 28 | ${crashpad_git_SOURCE_DIR}/third_party/getopt 29 | ) 30 | else() 31 | target_include_directories(crashpad_compat INTERFACE 32 | ${crashpad_git_SOURCE_DIR}/compat/non_win 33 | ) 34 | endif() 35 | 36 | # Linux mostly. 37 | if(UNIX AND NOT APPLE) 38 | target_sources(crashpad_compat PRIVATE 39 | ${crashpad_git_SOURCE_DIR}/compat/linux/sys/mman_memfd_create.cc 40 | ) 41 | 42 | target_include_directories(crashpad_compat PUBLIC 43 | ${crashpad_git_SOURCE_DIR}/compat/linux 44 | ) 45 | else() 46 | target_include_directories(crashpad_compat INTERFACE 47 | ${crashpad_git_SOURCE_DIR}/compat/non_elf 48 | ) 49 | endif() 50 | 51 | if(APPLE) 52 | target_include_directories(crashpad_compat INTERFACE 53 | ${crashpad_git_SOURCE_DIR}/compat/mac 54 | ) 55 | else() 56 | target_include_directories(crashpad_compat PUBLIC 57 | ${crashpad_git_SOURCE_DIR}/compat/non_mac 58 | ) 59 | endif() 60 | 61 | if(ANDROID) 62 | target_sources(crashpad_compat PRIVATE 63 | ${crashpad_git_SOURCE_DIR}/compat/android/android/api-level.cc 64 | ${crashpad_git_SOURCE_DIR}/compat/android/dlfcn_internal.cc 65 | ${crashpad_git_SOURCE_DIR}/compat/android/sys/epoll.cc 66 | ${crashpad_git_SOURCE_DIR}/compat/android/sys/mman.cc 67 | ) 68 | 69 | target_include_directories(crashpad_compat PUBLIC 70 | ${crashpad_git_SOURCE_DIR}/compat/android 71 | ) 72 | endif() 73 | -------------------------------------------------------------------------------- /cmake/crashpad-common.cmake: -------------------------------------------------------------------------------- 1 | # Crashpad compile options interface target. 2 | add_library(crashpad_common INTERFACE) 3 | 4 | if(NOT MSVC) 5 | target_compile_options(crashpad_common INTERFACE 6 | -Wall 7 | -Wendif-labels 8 | -Werror 9 | -Wextra 10 | -Wno-missing-field-initializers 11 | -Wno-noexcept-type 12 | -Wno-unused-parameter 13 | -Wno-implicit-fallthrough 14 | -Wsign-compare 15 | -Wno-multichar 16 | -fno-exceptions 17 | -fno-rtti 18 | -fno-strict-aliasing 19 | -fstack-protector-all 20 | -fdata-sections 21 | -ffunction-sections 22 | ) 23 | 24 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") 25 | target_compile_options(crashpad_common INTERFACE 26 | -Wno-attributes 27 | -Wno-ignored-qualifiers 28 | -Wno-stringop-truncation 29 | -Wno-restrict 30 | ) 31 | endif() 32 | else() 33 | target_compile_options(crashpad_common INTERFACE 34 | $<$: 35 | /FS 36 | /W4 37 | /WX 38 | /Zi 39 | /bigobj 40 | /wd4100 41 | /wd4127 42 | /wd4324 43 | /wd4351 44 | /wd4577 45 | /wd4996 46 | /wd4201 47 | /Zc:inline 48 | /d2Zi+ 49 | > 50 | ) 51 | endif() 52 | 53 | if(WIN32) 54 | target_compile_definitions(crashpad_common INTERFACE 55 | NOMINMAX 56 | UNICODE 57 | WIN32_LEAN_AND_MEAN 58 | _CRT_SECURE_NO_WARNINGS 59 | _HAS_EXCEPTIONS=0 60 | _UNICODE 61 | ) 62 | 63 | target_link_libraries(crashpad_common INTERFACE 64 | advapi32.lib 65 | winhttp.lib 66 | version.lib 67 | user32.lib 68 | PowrProf.lib 69 | ) 70 | else() 71 | target_link_libraries(crashpad_common INTERFACE 72 | Threads::Threads 73 | ${CMAKE_DL_LIBS} 74 | ) 75 | endif() 76 | 77 | if(APPLE) 78 | target_link_options(crashpad_common INTERFACE -Wl,-dead_strip) 79 | endif() 80 | 81 | if(ANDROID) 82 | target_link_libraries(crashpad_common INTERFACE -llog) 83 | endif() 84 | 85 | target_compile_definitions(crashpad_common INTERFACE 86 | -D_FILE_OFFSET_BITS=64 87 | -DCRASHPAD_ZLIB_SOURCE_SYSTEM 88 | -DCRASHPAD_LSS_SOURCE_EXTERNAL 89 | ) 90 | 91 | target_include_directories(crashpad_common INTERFACE 92 | ${crashpad_git_SOURCE_DIR} 93 | ${mini_chromium_git_SOURCE_DIR} 94 | ) 95 | -------------------------------------------------------------------------------- /cmake/crashpad-mig.cmake: -------------------------------------------------------------------------------- 1 | find_package(Python2 COMPONENTS Interpreter REQUIRED) 2 | find_program(MIG_EXE mig REQUIRED) 3 | message("Found mig at ${MIG_EXE}") 4 | 5 | function(target_add_mig_sources target filename) 6 | cmake_parse_arguments(MIG "COMPILE_SERVER;COMPILE_CLIENT" "ARCH;TARGET_DIR" "" ${ARGN}) 7 | 8 | if(NOT MIG_USER_SOURCE_SUFFIX) 9 | set(MIG_USER_SOURCE_SUFFIX User.c) 10 | endif() 11 | if(NOT MIG_USER_HEADER_SUFFIX) 12 | set(MIG_USER_HEADER_SUFFIX .h) 13 | endif() 14 | if(NOT MIG_SERVER_SOURCE_SUFFIX) 15 | set(MIG_SERVER_SOURCE_SUFFIX Server.c) 16 | endif() 17 | if(NOT MIG_SERVER_HEADER_SUFFIX) 18 | set(MIG_SERVER_HEADER_SUFFIX Server.h) 19 | endif() 20 | if(NOT MIG_TARGET_DIR) 21 | set(MIG_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}) 22 | endif() 23 | 24 | get_target_property(_incs ${target} INCLUDE_DIRECTORIES) 25 | 26 | foreach(inc ${_incs}) 27 | list(APPEND MIG_INCLUDE --include "${inc}") 28 | endforeach() 29 | 30 | if(NOT MIG_ARCH) 31 | set(MIG_ARCH x86_64) 32 | endif() 33 | 34 | get_filename_component(basename ${filename} NAME_WE) 35 | add_custom_command( 36 | OUTPUT 37 | ${MIG_TARGET_DIR}/${basename}${MIG_USER_SOURCE_SUFFIX} 38 | ${MIG_TARGET_DIR}/${basename}${MIG_SERVER_SOURCE_SUFFIX} 39 | ${MIG_TARGET_DIR}/${basename}${MIG_USER_HEADER_SUFFIX} 40 | ${MIG_TARGET_DIR}/${basename}${MIG_SERVER_HEADER_SUFFIX} 41 | COMMAND ${Python2_EXECUTABLE} 42 | ARGS ${crashpad_git_SOURCE_DIR}/util/mach/mig.py 43 | ${filename} 44 | ${MIG_TARGET_DIR}/${basename}${MIG_USER_SOURCE_SUFFIX} 45 | ${MIG_TARGET_DIR}/${basename}${MIG_SERVER_SOURCE_SUFFIX} 46 | ${MIG_TARGET_DIR}/${basename}${MIG_USER_HEADER_SUFFIX} 47 | ${MIG_TARGET_DIR}/${basename}${MIG_SERVER_HEADER_SUFFIX} 48 | --mig-path ${MIG_EXE} 49 | --arch ${MIG_ARCH} 50 | ${MIG_INCLUDE} 51 | COMMENT "Mig ${filename}" VERBATIM 52 | ) 53 | 54 | if(MIG_COMPILE_SERVER) 55 | target_sources(${target} PRIVATE 56 | ${MIG_TARGET_DIR}/${basename}${MIG_SERVER_SOURCE_SUFFIX} 57 | ${MIG_TARGET_DIR}/${basename}${MIG_SERVER_HEADER_SUFFIX} 58 | ) 59 | endif() 60 | if(MIG_COMPILE_CLIENT) 61 | target_sources(${target} PRIVATE 62 | ${MIG_TARGET_DIR}/${basename}${MIG_USER_SOURCE_SUFFIX} 63 | ${MIG_TARGET_DIR}/${basename}${MIG_USER_HEADER_SUFFIX} 64 | ) 65 | endif() 66 | endfunction() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # crashpad-cmake 2 | Wanting a CMake wrapper around Google's Crashpad library and the supporting mini_chromium library to make it easy to integrate into CMake projects? 3 | 4 | Based on existing works to provide a CMake solution for Crashpad we've put this together mainly for use as a submodule by [Assembly Armarda](https://github.com/TheAssemblyArmada) projects. 5 | 6 | ## Getting started 7 | 8 | There are various ways to include this in your own project. One is to just add it to your soruce tree if you want to customise it or maintain it yourself. Another is to add this repository as a submodule of your CMake project and then add it using the `add_submodule` directive. Finally you could use the CMake FetchContent module as follows: 9 | 10 | ```CMake 11 | include(FetchContent) 12 | FetchContent_Declare( 13 | crashpad_cmake 14 | GIT_REPOSITORY https://github.com/TheAssemblyArmada/crashpad-cmake.git 15 | GIT_TAG deadbeef # Put the commit ref you want to build here. 16 | ) 17 | FetchContent_MakeAvailable(crashpad_cmake) 18 | ``` 19 | 20 | Next, initialize Crashpad using something similar to this example. Refer to [the Crashpad documentation](https://crashpad.chromium.org/doxygen/index.html) if in doubt. 21 | 22 | ```c++ 23 | #include 24 | #include 25 | #include 26 | 27 | bool InitializeCrashpad() 28 | { 29 | // Cache directory that will store crashpad information and minidumps 30 | base::FilePath database("path/to/crashpad/db"); 31 | // Path to the out-of-process handler executable 32 | base::FilePath handler("path/to/crashpad_handler.exe"); 33 | // URL used to submit minidumps to 34 | std::string url("https://error-handler.local"); 35 | // Optional annotations passed via --annotations to the handler 36 | std::map annotations; 37 | // Optional arguments to pass to the handler 38 | std::vector arguments; 39 | 40 | CrashpadClient client; 41 | bool success = client.StartHandler( 42 | handler, 43 | database, 44 | database, 45 | url, 46 | annotations, 47 | arguments, 48 | /* restartable */ true, 49 | /* asynchronous_start */ false); 50 | 51 | return success; 52 | } 53 | ``` 54 | 55 | You will also need to link your target against crashpad_client. 56 | 57 | ```CMake 58 | add_executable(MyProgram myprogram.cpp) 59 | target_link_libraries(MyProgram PRIVATE crashpad_client) 60 | ``` 61 | 62 | Finally you will want to distribute the crashpad_handler with your program so it can run in the background catch your program crashing. 63 | 64 | ## Contributing 65 | Crashpad is under continuous development so feel free to submit pull requests to update the underlying submodules. 66 | -------------------------------------------------------------------------------- /cmake/crashpad-handler.cmake: -------------------------------------------------------------------------------- 1 | # Handler executable 2 | add_library(crashpad_handler_obj OBJECT) 3 | 4 | set_target_properties(crashpad_handler_obj PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_link_libraries(crashpad_handler_obj PRIVATE 13 | minichromium 14 | crashpad_common 15 | crashpad_compat 16 | crashpad_client 17 | crashpad_minidump 18 | crashpad_snapshot 19 | crashpad_tools 20 | ZLIB::ZLIB 21 | AppleFrameworks 22 | ) 23 | 24 | target_sources(crashpad_handler_obj PRIVATE 25 | ${crashpad_git_SOURCE_DIR}/handler/crash_report_upload_thread.cc 26 | ${crashpad_git_SOURCE_DIR}/handler/handler_main.cc 27 | ${crashpad_git_SOURCE_DIR}/handler/minidump_to_upload_parameters.cc 28 | ${crashpad_git_SOURCE_DIR}/handler/prune_crash_reports_thread.cc 29 | ${crashpad_git_SOURCE_DIR}/handler/user_stream_data_source.cc 30 | ) 31 | 32 | if(APPLE) 33 | target_sources(crashpad_handler_obj PRIVATE 34 | ${crashpad_git_SOURCE_DIR}/handler/mac/crash_report_exception_handler.cc 35 | ${crashpad_git_SOURCE_DIR}/handler/mac/exception_handler_server.cc 36 | ${crashpad_git_SOURCE_DIR}/handler/mac/file_limit_annotation.cc 37 | ) 38 | # Hack to fix upstream backtrace fork not updating this var in line with minichromium. 39 | target_compile_definitions(crashpad_handler_obj PRIVATE OS_MACOSX=1) 40 | endif() 41 | 42 | if(UNIX AND NOT APPLE) 43 | target_sources(crashpad_handler_obj PRIVATE 44 | ${crashpad_git_SOURCE_DIR}/handler/linux/capture_snapshot.cc 45 | ${crashpad_git_SOURCE_DIR}/handler/linux/crash_report_exception_handler.cc 46 | ${crashpad_git_SOURCE_DIR}/handler/linux/exception_handler_server.cc 47 | ) 48 | 49 | if(NOT ANDROID) 50 | target_sources(crashpad_handler_obj PRIVATE 51 | ${crashpad_git_SOURCE_DIR}/handler/linux/cros_crash_report_exception_handler.cc 52 | ) 53 | endif() 54 | endif() 55 | 56 | if(WIN32) 57 | target_sources(crashpad_handler_obj PRIVATE 58 | ${crashpad_git_SOURCE_DIR}/handler/win/crash_report_exception_handler.cc 59 | ) 60 | endif() 61 | 62 | add_executable(crashpad_handler ${crashpad_git_SOURCE_DIR}/handler/main.cc) 63 | 64 | set_target_properties(crashpad_handler PROPERTIES 65 | CXX_STANDARD 14 66 | POSITION_INDEPENDENT_CODE ON 67 | CXX_VISIBILITY_PRESET "hidden" 68 | C_VISIBILITY_PRESET "hidden" 69 | VISIBILITY_INLINES_HIDDEN ON 70 | ) 71 | 72 | target_link_libraries(crashpad_handler PRIVATE 73 | minichromium 74 | crashpad_common 75 | crashpad_compat 76 | crashpad_client 77 | crashpad_minidump 78 | crashpad_snapshot 79 | crashpad_tools 80 | crashpad_handler_obj 81 | ZLIB::ZLIB 82 | AppleFrameworks 83 | ) 84 | -------------------------------------------------------------------------------- /cmake/minichromium.cmake: -------------------------------------------------------------------------------- 1 | add_library(minichromium STATIC) 2 | 3 | set_target_properties(minichromium 4 | PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_link_libraries(minichromium PRIVATE 13 | crashpad_common 14 | AppleFrameworks 15 | ) 16 | 17 | target_sources(minichromium PRIVATE 18 | ${mini_chromium_git_SOURCE_DIR}/base/debug/alias.cc 19 | ${mini_chromium_git_SOURCE_DIR}/base/files/file_path.cc 20 | ${mini_chromium_git_SOURCE_DIR}/base/files/scoped_file.cc 21 | ${mini_chromium_git_SOURCE_DIR}/base/logging.cc 22 | ${mini_chromium_git_SOURCE_DIR}/base/process/memory.cc 23 | ${mini_chromium_git_SOURCE_DIR}/base/rand_util.cc 24 | ${mini_chromium_git_SOURCE_DIR}/base/strings/string_number_conversions.cc 25 | ${mini_chromium_git_SOURCE_DIR}/base/strings/stringprintf.cc 26 | ${mini_chromium_git_SOURCE_DIR}/base/strings/utf_string_conversion_utils.cc 27 | ${mini_chromium_git_SOURCE_DIR}/base/strings/utf_string_conversions.cc 28 | ${mini_chromium_git_SOURCE_DIR}/base/synchronization/lock.cc 29 | ${mini_chromium_git_SOURCE_DIR}/base/third_party/icu/icu_utf.cc 30 | ${mini_chromium_git_SOURCE_DIR}/base/threading/thread_local_storage.cc 31 | ) 32 | 33 | if(WIN32) 34 | target_sources(minichromium PRIVATE 35 | ${mini_chromium_git_SOURCE_DIR}/base/scoped_clear_last_error_win.cc 36 | ${mini_chromium_git_SOURCE_DIR}/base/memory/page_size_win.cc 37 | ${mini_chromium_git_SOURCE_DIR}/base/strings/string_util_win.cc 38 | ${mini_chromium_git_SOURCE_DIR}/base/synchronization/lock_impl_win.cc 39 | ${mini_chromium_git_SOURCE_DIR}/base/threading/thread_local_storage_win.cc 40 | ) 41 | endif() 42 | 43 | if(UNIX) 44 | target_sources(minichromium PRIVATE 45 | ${mini_chromium_git_SOURCE_DIR}/base/files/file_util_posix.cc 46 | ${mini_chromium_git_SOURCE_DIR}/base/memory/page_size_posix.cc 47 | ${mini_chromium_git_SOURCE_DIR}/base/posix/safe_strerror.cc 48 | ${mini_chromium_git_SOURCE_DIR}/base/synchronization/condition_variable_posix.cc 49 | ${mini_chromium_git_SOURCE_DIR}/base/synchronization/lock_impl_posix.cc 50 | ${mini_chromium_git_SOURCE_DIR}/base/threading/thread_local_storage_posix.cc 51 | ) 52 | endif() 53 | 54 | if(APPLE) 55 | target_sources(minichromium PRIVATE 56 | ${mini_chromium_git_SOURCE_DIR}/base/mac/close_nocancel.cc 57 | ${mini_chromium_git_SOURCE_DIR}/base/mac/foundation_util.mm 58 | ${mini_chromium_git_SOURCE_DIR}/base/mac/mach_logging.cc 59 | ${mini_chromium_git_SOURCE_DIR}/base/mac/scoped_mach_port.cc 60 | ${mini_chromium_git_SOURCE_DIR}/base/mac/scoped_mach_vm.cc 61 | ${mini_chromium_git_SOURCE_DIR}/base/mac/scoped_nsautorelease_pool.mm 62 | ${mini_chromium_git_SOURCE_DIR}/base/strings/sys_string_conversions_mac.mm 63 | ) 64 | endif() 65 | -------------------------------------------------------------------------------- /cmake/crashpad-minidump-test.cmake: -------------------------------------------------------------------------------- 1 | add_library(minidump_test_support OBJECT) 2 | 3 | set_target_properties(minidump_test_support 4 | PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_link_libraries(minidump_test_support PRIVATE 13 | crashpad_common 14 | crashpad_compat 15 | ) 16 | 17 | target_sources(minidump_test_support PRIVATE 18 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_byte_array_writer_test_util.cc 19 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_byte_array_writer_test_util.h 20 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_context_test_util.cc 21 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_context_test_util.h 22 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_file_writer_test_util.cc 23 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_file_writer_test_util.h 24 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_memory_writer_test_util.cc 25 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_memory_writer_test_util.h 26 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_rva_list_test_util.cc 27 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_rva_list_test_util.h 28 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_string_writer_test_util.cc 29 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_string_writer_test_util.h 30 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_user_extension_stream_util.cc 31 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_user_extension_stream_util.h 32 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_writable_test_util.cc 33 | ${crashpad_git_SOURCE_DIR}/minidump/test/minidump_writable_test_util.h 34 | ) 35 | 36 | target_link_libraries(minidump_test_support PRIVATE gtest) 37 | 38 | crashpad_add_test(crashpad_minidump_test) 39 | target_sources(crashpad_minidump_test PRIVATE 40 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_annotation_writer_test.cc 41 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_byte_array_writer_test.cc 42 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_context_writer_test.cc 43 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_crashpad_info_writer_test.cc 44 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_exception_writer_test.cc 45 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_file_writer_test.cc 46 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_handle_writer_test.cc 47 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_memory_info_writer_test.cc 48 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_memory_writer_test.cc 49 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_misc_info_writer_test.cc 50 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_module_crashpad_info_writer_test.cc 51 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_module_writer_test.cc 52 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_rva_list_writer_test.cc 53 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_simple_string_dictionary_writer_test.cc 54 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_string_writer_test.cc 55 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_system_info_writer_test.cc 56 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_thread_id_map_test.cc 57 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_thread_writer_test.cc 58 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_unloaded_module_writer_test.cc 59 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_user_stream_writer_test.cc 60 | ${crashpad_git_SOURCE_DIR}/minidump/minidump_writable_test.cc 61 | ) 62 | 63 | if(NOT MSVC) 64 | target_compile_options(crashpad_minidump_test PRIVATE 65 | -Wno-maybe-uninitialized 66 | ) 67 | endif() 68 | 69 | target_link_libraries(crashpad_minidump_test PRIVATE 70 | crashpad_minidump 71 | minidump_test_support 72 | crashpad_test 73 | gtest 74 | gtest_main 75 | crashpad_util 76 | minichromium 77 | snapshot_test_support 78 | crashpad_snapshot 79 | crashpad_handler_obj 80 | crashpad_client 81 | ZLIB::ZLIB 82 | ) -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.11) 2 | project(crashpad LANGUAGES C CXX) 3 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") 4 | 5 | if(MSVC) 6 | enable_language(ASM_MASM) 7 | else() 8 | enable_language(ASM) 9 | endif() 10 | 11 | # Option to build unit tests. 12 | option(CRASHPAD_BUILD_TESTS "Build unit tests." OFF) 13 | 14 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) 15 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) 16 | 17 | # We are going to use the FetchContent module to grab crashpad and its dependencies. 18 | include(FetchContent) 19 | 20 | # Try to find prebuilt zlib on the system to link against first before building it ourselves. 21 | find_package(ZLIB 1.2.8) 22 | 23 | # If not found, we fetch it and build it ourselves. 24 | if(NOT ZLIB_FOUND AND NOT TARGET ZLIB::ZLIB) 25 | FetchContent_Declare( 26 | zlib 27 | GIT_REPOSITORY https://github.com/madler/zlib.git 28 | GIT_TAG v1.2.11 29 | ) 30 | 31 | # We don't use FetchContent_MakeAvailable here because we don't want all zlib targets including, just our dependency. 32 | FetchContent_GetProperties(zlib) 33 | if(NOT zlib_POPULATED) 34 | FetchContent_Populate(zlib) 35 | add_subdirectory(${zlib_SOURCE_DIR} ${zlib_BINARY_DIR} EXCLUDE_FROM_ALL) 36 | endif() 37 | 38 | # Make sure headers are available for the static target and make an alias to match the Find module output. 39 | target_include_directories(zlibstatic INTERFACE ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) 40 | add_library(ZLIB::ZLIB ALIAS zlibstatic) 41 | endif() 42 | 43 | find_package(Threads) 44 | 45 | add_library(AppleFrameworks INTERFACE) 46 | 47 | if(APPLE) 48 | set(FRAMEWORKS CoreFoundation;ApplicationServices;Foundation;IOKit;Security;bsm;OpenCL) 49 | foreach(FW ${FRAMEWORKS}) 50 | find_library(FW_PATH_${FW} ${FW}) 51 | target_link_libraries(AppleFrameworks INTERFACE ${FW_PATH_${FW}}) 52 | endforeach() 53 | endif() 54 | 55 | # Mini-Chromium 56 | FetchContent_Declare( 57 | mini_chromium_git 58 | GIT_REPOSITORY https://github.com/chromium/mini_chromium.git 59 | GIT_TAG 9cdc2a7 60 | ) 61 | 62 | if(NOT mini_chromium_git_POPULATED) 63 | FetchContent_Populate(mini_chromium_git) 64 | endif() 65 | 66 | # Crashpad 67 | FetchContent_Declare( 68 | crashpad_git 69 | GIT_REPOSITORY https://github.com/backtrace-labs/crashpad.git 70 | GIT_TAG 7b9686b 71 | ) 72 | 73 | if(NOT crashpad_git_POPULATED) 74 | FetchContent_Populate(crashpad_git) 75 | endif() 76 | 77 | # LSS dependency for linux syscalls. 78 | FetchContent_Declare( 79 | lss_git 80 | GIT_REPOSITORY https://chromium.googlesource.com/linux-syscall-support 81 | GIT_TAG e1e7b0a 82 | ) 83 | 84 | if(NOT lss_git_POPULATED) 85 | FetchContent_Populate(lss_git) 86 | endif() 87 | 88 | file(COPY ${lss_git_SOURCE_DIR}/linux_syscall_support.h DESTINATION ${crashpad_git_SOURCE_DIR}/third_party/lss) 89 | 90 | include(crashpad-common) 91 | include(minichromium) 92 | include(crashpad-compat) 93 | include(crashpad-tools) 94 | include(crashpad-util) 95 | include(crashpad-client) 96 | include(crashpad-minidump) 97 | include(crashpad-snapshot) 98 | include(crashpad-handler) 99 | 100 | # If we want unit tests, build them. 101 | if(CRASHPAD_BUILD_TESTS) 102 | # Disable tests supplied by zlib source incase we have to build it. 103 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CTestCustom.cmake ${CMAKE_BINARY_DIR}) 104 | 105 | enable_testing() 106 | 107 | # Fetch googletest code. 108 | include(GoogleTest) 109 | FetchContent_Declare( 110 | googletest 111 | GIT_REPOSITORY https://github.com/google/googletest.git 112 | GIT_TAG release-1.10.0 113 | ) 114 | 115 | # We don't use FetchContent_MakeAvailable here because we don't want all googletest targets including, just our dependencies. 116 | FetchContent_GetProperties(googletest) 117 | if(NOT googletest_POPULATED) 118 | FetchContent_Populate(googletest) 119 | endif() 120 | include(gtest) 121 | include(crashpad-test) 122 | include(crashpad-test-test) 123 | include(crashpad-util-test) 124 | include(crashpad-snapshot-test) 125 | include(crashpad-minidump-test) 126 | include(crashpad-client-test) 127 | include(crashpad-handler-test) 128 | endif() 129 | -------------------------------------------------------------------------------- /cmake/crashpad-test.cmake: -------------------------------------------------------------------------------- 1 | # Server exe for tests to run against 2 | add_executable(http_transport_test_server 3 | ${crashpad_git_SOURCE_DIR}/util/net/http_transport_test_server.cc 4 | ) 5 | 6 | set_target_properties(http_transport_test_server 7 | PROPERTIES 8 | CXX_STANDARD 14 9 | POSITION_INDEPENDENT_CODE ON 10 | CXX_VISIBILITY_PRESET "hidden" 11 | C_VISIBILITY_PRESET "hidden" 12 | VISIBILITY_INLINES_HIDDEN ON 13 | ) 14 | 15 | target_link_libraries(http_transport_test_server 16 | PRIVATE 17 | crashpad_common 18 | crashpad_compat 19 | ZLIB::ZLIB 20 | crashpad_util 21 | crashpad_tools 22 | minichromium 23 | AppleFrameworks 24 | $<$:ws2_32.lib> 25 | ) 26 | 27 | # Shared test library 28 | add_library(crashpad_test OBJECT) 29 | 30 | set_target_properties(crashpad_test 31 | PROPERTIES 32 | CXX_STANDARD 14 33 | POSITION_INDEPENDENT_CODE ON 34 | CXX_VISIBILITY_PRESET "hidden" 35 | C_VISIBILITY_PRESET "hidden" 36 | VISIBILITY_INLINES_HIDDEN ON 37 | ) 38 | 39 | target_link_libraries(crashpad_test PRIVATE crashpad_common crashpad_compat) 40 | target_link_libraries(crashpad_test PUBLIC gtest) 41 | 42 | target_sources(crashpad_test 43 | PRIVATE 44 | ${crashpad_git_SOURCE_DIR}/test/errors.cc 45 | ${crashpad_git_SOURCE_DIR}/test/file.cc 46 | ${crashpad_git_SOURCE_DIR}/test/filesystem.cc 47 | ${crashpad_git_SOURCE_DIR}/test/hex_string.cc 48 | ${crashpad_git_SOURCE_DIR}/test/main_arguments.cc 49 | ${crashpad_git_SOURCE_DIR}/test/multiprocess_exec.cc 50 | ${crashpad_git_SOURCE_DIR}/test/process_type.cc 51 | ${crashpad_git_SOURCE_DIR}/test/scoped_module_handle.cc 52 | ${crashpad_git_SOURCE_DIR}/test/scoped_temp_dir.cc 53 | ${crashpad_git_SOURCE_DIR}/test/test_paths.cc 54 | ) 55 | 56 | if(UNIX) 57 | target_sources(crashpad_test 58 | PRIVATE 59 | ${crashpad_git_SOURCE_DIR}/test/scoped_guarded_page_posix.cc 60 | ${crashpad_git_SOURCE_DIR}/test/scoped_temp_dir_posix.cc 61 | ${crashpad_git_SOURCE_DIR}/test/multiprocess_exec_posix.cc 62 | ${crashpad_git_SOURCE_DIR}/test/multiprocess_posix.cc 63 | ) 64 | endif() 65 | 66 | if(APPLE) 67 | target_sources(crashpad_test 68 | PRIVATE 69 | ${crashpad_git_SOURCE_DIR}/test/mac/dyld.cc 70 | ${crashpad_git_SOURCE_DIR}/test/mac/exception_swallower.cc 71 | ${crashpad_git_SOURCE_DIR}/test/mac/mach_errors.cc 72 | ${crashpad_git_SOURCE_DIR}/test/mac/mach_multiprocess.cc 73 | ) 74 | endif() 75 | 76 | if(UNIX AND NOT APPLE) 77 | target_sources(crashpad_test 78 | PRIVATE 79 | ${crashpad_git_SOURCE_DIR}/test/linux/fake_ptrace_connection.cc 80 | ${crashpad_git_SOURCE_DIR}/test/linux/get_tls.cc 81 | ) 82 | endif() 83 | 84 | if(WIN32) 85 | target_sources(crashpad_test 86 | PRIVATE 87 | ${crashpad_git_SOURCE_DIR}/test/multiprocess_exec_win.cc 88 | ${crashpad_git_SOURCE_DIR}/test/scoped_guarded_page_win.cc 89 | ${crashpad_git_SOURCE_DIR}/test/scoped_temp_dir_win.cc 90 | ${crashpad_git_SOURCE_DIR}/test/win/child_launcher.cc 91 | ${crashpad_git_SOURCE_DIR}/test/win/win_child_process.cc 92 | ${crashpad_git_SOURCE_DIR}/test/win/win_multiprocess.cc 93 | ${crashpad_git_SOURCE_DIR}/test/win/win_multiprocess_with_temp_dir.cc 94 | ) 95 | endif() 96 | 97 | # This file is required for the tests to work - but 98 | # the ctest launcher seems to run it from the subdirectory 99 | # always - so let's make sure we copy it to two different places 100 | file( 101 | COPY ${crashpad_git_SOURCE_DIR}/test/test_paths_test_data_root.txt 102 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test 103 | ) 104 | 105 | file( 106 | COPY ${crashpad_git_SOURCE_DIR}/test/test_paths_test_data_root.txt 107 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR} 108 | ) 109 | 110 | add_library(gtest_main OBJECT) 111 | set_target_properties(gtest_main 112 | PROPERTIES 113 | CXX_STANDARD 14 114 | POSITION_INDEPENDENT_CODE ON 115 | CXX_VISIBILITY_PRESET "hidden" 116 | C_VISIBILITY_PRESET "hidden" 117 | VISIBILITY_INLINES_HIDDEN ON 118 | ) 119 | target_sources(gtest_main PRIVATE ${crashpad_git_SOURCE_DIR}/test/gtest_main.cc) 120 | target_link_libraries(gtest_main PUBLIC gtest PRIVATE crashpad_common minichromium) 121 | target_compile_definitions(gtest_main PUBLIC CRASHPAD_TEST_LAUNCHER_GOOGLETEST) 122 | 123 | add_library(gmock_main OBJECT) 124 | set_target_properties(gmock_main 125 | PROPERTIES 126 | CXX_STANDARD 14 127 | POSITION_INDEPENDENT_CODE ON 128 | CXX_VISIBILITY_PRESET "hidden" 129 | C_VISIBILITY_PRESET "hidden" 130 | VISIBILITY_INLINES_HIDDEN ON 131 | ) 132 | target_sources(gmock_main PRIVATE ${crashpad_git_SOURCE_DIR}/test/gtest_main.cc) 133 | target_link_libraries(gmock_main PUBLIC gmock gtest PRIVATE crashpad_common minichromium) 134 | target_compile_definitions(gmock_main PUBLIC CRASHPAD_TEST_LAUNCHER_GOOGLEMOCK) 135 | 136 | # Catch all target and macro to build tests 137 | add_custom_target(build_tests) 138 | 139 | macro(crashpad_add_test NAME) 140 | add_executable(${NAME}) 141 | set_target_properties(${NAME} 142 | PROPERTIES 143 | CXX_STANDARD 14 144 | POSITION_INDEPENDENT_CODE ON 145 | CXX_VISIBILITY_PRESET "hidden" 146 | C_VISIBILITY_PRESET "hidden" 147 | VISIBILITY_INLINES_HIDDEN ON 148 | ) 149 | 150 | target_link_libraries(${NAME} PRIVATE crashpad_common crashpad_compat) 151 | 152 | if(APPLE) 153 | target_link_libraries(${NAME} PRIVATE AppleFrameworks) 154 | endif() 155 | 156 | if(NOT ANDROID) 157 | gtest_discover_tests(${NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) 158 | endif() 159 | add_dependencies(build_tests ${NAME}) 160 | endmacro() 161 | -------------------------------------------------------------------------------- /cmake/crashpad-snapshot.cmake: -------------------------------------------------------------------------------- 1 | # Snapshot library 2 | add_library(crashpad_snapshot STATIC) 3 | 4 | set_target_properties(crashpad_snapshot PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_link_libraries(crashpad_snapshot PRIVATE 13 | minichromium 14 | crashpad_common 15 | crashpad_compat 16 | crashpad_client 17 | crashpad_util 18 | ) 19 | 20 | target_sources(crashpad_snapshot PRIVATE 21 | ${crashpad_git_SOURCE_DIR}/snapshot/annotation_snapshot.cc 22 | ${crashpad_git_SOURCE_DIR}/snapshot/capture_memory.cc 23 | ${crashpad_git_SOURCE_DIR}/snapshot/cpu_context.cc 24 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_info_client_options.cc 25 | ${crashpad_git_SOURCE_DIR}/snapshot/handle_snapshot.cc 26 | ${crashpad_git_SOURCE_DIR}/snapshot/memory_snapshot.cc 27 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/exception_snapshot_minidump.cc 28 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/memory_snapshot_minidump.cc 29 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/minidump_annotation_reader.cc 30 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/minidump_context_converter.cc 31 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/minidump_simple_string_dictionary_reader.cc 32 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/minidump_string_list_reader.cc 33 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/minidump_string_reader.cc 34 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/module_snapshot_minidump.cc 35 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/process_snapshot_minidump.cc 36 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/system_snapshot_minidump.cc 37 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/thread_snapshot_minidump.cc 38 | ${crashpad_git_SOURCE_DIR}/snapshot/unloaded_module_snapshot.cc 39 | ) 40 | 41 | if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)") 42 | target_sources(crashpad_snapshot PRIVATE 43 | ${crashpad_git_SOURCE_DIR}/snapshot/x86/cpuid_reader.cc 44 | ) 45 | endif() 46 | 47 | if(UNIX) 48 | target_sources(crashpad_snapshot PRIVATE 49 | ${crashpad_git_SOURCE_DIR}/snapshot/posix/timezone.cc 50 | ) 51 | endif() 52 | 53 | if(APPLE) 54 | target_sources(crashpad_snapshot PRIVATE 55 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/cpu_context_mac.cc 56 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/exception_snapshot_mac.cc 57 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_annotations_reader.cc 58 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_reader.cc 59 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_segment_reader.cc 60 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_symbol_table_reader.cc 61 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/module_snapshot_mac.cc 62 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/process_reader_mac.cc 63 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/process_snapshot_mac.cc 64 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/process_types.cc 65 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/process_types/custom.cc 66 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/system_snapshot_mac.cc 67 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/thread_snapshot_mac.cc 68 | ) 69 | endif() 70 | 71 | if(UNIX AND NOT APPLE) 72 | target_sources(crashpad_snapshot PRIVATE 73 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_types/image_annotation_reader.cc 74 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/cpu_context_linux.cc 75 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/debug_rendezvous.cc 76 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/exception_snapshot_linux.cc 77 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/process_reader_linux.cc 78 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/process_snapshot_linux.cc 79 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/system_snapshot_linux.cc 80 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/thread_snapshot_linux.cc 81 | ${crashpad_git_SOURCE_DIR}/snapshot/sanitized/memory_snapshot_sanitized.cc 82 | ${crashpad_git_SOURCE_DIR}/snapshot/sanitized/module_snapshot_sanitized.cc 83 | ${crashpad_git_SOURCE_DIR}/snapshot/sanitized/process_snapshot_sanitized.cc 84 | ${crashpad_git_SOURCE_DIR}/snapshot/sanitized/sanitization_information.cc 85 | ${crashpad_git_SOURCE_DIR}/snapshot/sanitized/thread_snapshot_sanitized.cc 86 | ${crashpad_git_SOURCE_DIR}/snapshot/elf/elf_dynamic_array_reader.cc 87 | ${crashpad_git_SOURCE_DIR}/snapshot/elf/elf_image_reader.cc 88 | ${crashpad_git_SOURCE_DIR}/snapshot/elf/elf_symbol_table_reader.cc 89 | ${crashpad_git_SOURCE_DIR}/snapshot/elf/module_snapshot_elf.cc 90 | ) 91 | endif() 92 | 93 | if(WIN32) 94 | target_sources(crashpad_snapshot PRIVATE 95 | ${crashpad_git_SOURCE_DIR}/snapshot/win/capture_memory_delegate_win.cc 96 | ${crashpad_git_SOURCE_DIR}/snapshot/win/cpu_context_win.cc 97 | ${crashpad_git_SOURCE_DIR}/snapshot/win/exception_snapshot_win.cc 98 | ${crashpad_git_SOURCE_DIR}/snapshot/win/memory_map_region_snapshot_win.cc 99 | ${crashpad_git_SOURCE_DIR}/snapshot/win/module_snapshot_win.cc 100 | ${crashpad_git_SOURCE_DIR}/snapshot/win/pe_image_annotations_reader.cc 101 | ${crashpad_git_SOURCE_DIR}/snapshot/win/pe_image_reader.cc 102 | ${crashpad_git_SOURCE_DIR}/snapshot/win/pe_image_resource_reader.cc 103 | ${crashpad_git_SOURCE_DIR}/snapshot/win/process_reader_win.cc 104 | ${crashpad_git_SOURCE_DIR}/snapshot/win/process_snapshot_win.cc 105 | ${crashpad_git_SOURCE_DIR}/snapshot/win/process_subrange_reader.cc 106 | ${crashpad_git_SOURCE_DIR}/snapshot/win/system_snapshot_win.cc 107 | ${crashpad_git_SOURCE_DIR}/snapshot/win/thread_snapshot_win.cc 108 | ) 109 | endif() 110 | 111 | if(NOT APPLE) 112 | target_sources(crashpad_snapshot PRIVATE 113 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_types/crashpad_info_reader.cc 114 | ) 115 | endif() 116 | -------------------------------------------------------------------------------- /cmake/crashpad-util-test.cmake: -------------------------------------------------------------------------------- 1 | # Crashpad util test 2 | crashpad_add_test(crashpad_util_test) 3 | add_dependencies(crashpad_util_test http_transport_test_server) 4 | 5 | target_sources(crashpad_util_test PRIVATE 6 | ${crashpad_git_SOURCE_DIR}/util/file/delimited_file_reader_test.cc 7 | ${crashpad_git_SOURCE_DIR}/util/file/directory_reader_test.cc 8 | ${crashpad_git_SOURCE_DIR}/util/file/file_io_test.cc 9 | ${crashpad_git_SOURCE_DIR}/util/file/file_reader_test.cc 10 | ${crashpad_git_SOURCE_DIR}/util/file/filesystem_test.cc 11 | ${crashpad_git_SOURCE_DIR}/util/file/string_file_test.cc 12 | ${crashpad_git_SOURCE_DIR}/util/misc/arraysize_test.cc 13 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_test.cc 14 | ${crashpad_git_SOURCE_DIR}/util/misc/clock_test.cc 15 | ${crashpad_git_SOURCE_DIR}/util/misc/from_pointer_cast_test.cc 16 | ${crashpad_git_SOURCE_DIR}/util/misc/initialization_state_dcheck_test.cc 17 | ${crashpad_git_SOURCE_DIR}/util/misc/initialization_state_test.cc 18 | ${crashpad_git_SOURCE_DIR}/util/misc/paths_test.cc 19 | ${crashpad_git_SOURCE_DIR}/util/misc/random_string_test.cc 20 | ${crashpad_git_SOURCE_DIR}/util/misc/range_set_test.cc 21 | ${crashpad_git_SOURCE_DIR}/util/misc/reinterpret_bytes_test.cc 22 | ${crashpad_git_SOURCE_DIR}/util/misc/scoped_forbid_return_test.cc 23 | ${crashpad_git_SOURCE_DIR}/util/misc/time_test.cc 24 | ${crashpad_git_SOURCE_DIR}/util/misc/uuid_test.cc 25 | ${crashpad_git_SOURCE_DIR}/util/net/http_body_gzip_test.cc 26 | ${crashpad_git_SOURCE_DIR}/util/net/http_body_test.cc 27 | ${crashpad_git_SOURCE_DIR}/util/net/http_body_test_util.cc 28 | ${crashpad_git_SOURCE_DIR}/util/net/http_body_test_util.h 29 | ${crashpad_git_SOURCE_DIR}/util/net/http_multipart_builder_test.cc 30 | ${crashpad_git_SOURCE_DIR}/util/net/url_test.cc 31 | ${crashpad_git_SOURCE_DIR}/util/numeric/checked_address_range_test.cc 32 | ${crashpad_git_SOURCE_DIR}/util/numeric/checked_range_test.cc 33 | ${crashpad_git_SOURCE_DIR}/util/numeric/in_range_cast_test.cc 34 | ${crashpad_git_SOURCE_DIR}/util/numeric/int128_test.cc 35 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_range_test.cc 36 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_test.cc 37 | ${crashpad_git_SOURCE_DIR}/util/stdlib/aligned_allocator_test.cc 38 | ${crashpad_git_SOURCE_DIR}/util/stdlib/map_insert_test.cc 39 | ${crashpad_git_SOURCE_DIR}/util/stdlib/string_number_conversion_test.cc 40 | ${crashpad_git_SOURCE_DIR}/util/stdlib/strlcpy_test.cc 41 | ${crashpad_git_SOURCE_DIR}/util/stdlib/strnlen_test.cc 42 | ${crashpad_git_SOURCE_DIR}/util/stdlib/thread_safe_vector_test.cc 43 | ${crashpad_git_SOURCE_DIR}/util/stream/base94_output_stream_test.cc 44 | ${crashpad_git_SOURCE_DIR}/util/stream/file_encoder_test.cc 45 | ${crashpad_git_SOURCE_DIR}/util/stream/log_output_stream_test.cc 46 | ${crashpad_git_SOURCE_DIR}/util/stream/test_output_stream.cc 47 | ${crashpad_git_SOURCE_DIR}/util/stream/test_output_stream.h 48 | ${crashpad_git_SOURCE_DIR}/util/stream/zlib_output_stream_test.cc 49 | ${crashpad_git_SOURCE_DIR}/util/string/split_string_test.cc 50 | ${crashpad_git_SOURCE_DIR}/util/synchronization/semaphore_test.cc 51 | ${crashpad_git_SOURCE_DIR}/util/thread/thread_log_messages_test.cc 52 | ${crashpad_git_SOURCE_DIR}/util/thread/thread_test.cc 53 | ${crashpad_git_SOURCE_DIR}/util/thread/worker_thread_test.cc 54 | ${crashpad_git_SOURCE_DIR}/util/net/http_transport_test.cc 55 | ) 56 | 57 | 58 | if(UNIX) 59 | target_sources(crashpad_util_test PRIVATE 60 | ${crashpad_git_SOURCE_DIR}/util/posix/process_info_test.cc 61 | ${crashpad_git_SOURCE_DIR}/util/posix/signals_test.cc 62 | ${crashpad_git_SOURCE_DIR}/util/posix/symbolic_constants_posix_test.cc 63 | ${crashpad_git_SOURCE_DIR}/util/posix/scoped_mmap_test.cc 64 | ) 65 | 66 | if(NOT APPLE) 67 | target_sources(crashpad_util_test PRIVATE 68 | ${crashpad_git_SOURCE_DIR}/util/linux/auxiliary_vector_test.cc 69 | ${crashpad_git_SOURCE_DIR}/util/linux/memory_map_test.cc 70 | ${crashpad_git_SOURCE_DIR}/util/linux/proc_stat_reader_test.cc 71 | ${crashpad_git_SOURCE_DIR}/util/linux/proc_task_reader_test.cc 72 | ${crashpad_git_SOURCE_DIR}/util/linux/ptrace_broker_test.cc 73 | ${crashpad_git_SOURCE_DIR}/util/linux/ptracer_test.cc 74 | ${crashpad_git_SOURCE_DIR}/util/linux/scoped_ptrace_attach_test.cc 75 | ${crashpad_git_SOURCE_DIR}/util/linux/socket_test.cc 76 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_test_util_linux.cc 77 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_sanitized_test.cc 78 | ) 79 | endif() 80 | endif() 81 | 82 | if(APPLE) 83 | target_sources(crashpad_util_test PRIVATE 84 | ${crashpad_git_SOURCE_DIR}/util/mac/launchd_test.mm 85 | ${crashpad_git_SOURCE_DIR}/util/mac/mac_util_test.mm 86 | ${crashpad_git_SOURCE_DIR}/util/mac/service_management_test.mm 87 | ${crashpad_git_SOURCE_DIR}/util/mac/xattr_test.cc 88 | ${crashpad_git_SOURCE_DIR}/util/mach/child_port_handshake_test.cc 89 | ${crashpad_git_SOURCE_DIR}/util/mach/child_port_server_test.cc 90 | ${crashpad_git_SOURCE_DIR}/util/mach/composite_mach_message_server_test.cc 91 | ${crashpad_git_SOURCE_DIR}/util/mach/exc_client_variants_test.cc 92 | ${crashpad_git_SOURCE_DIR}/util/mach/exc_server_variants_test.cc 93 | ${crashpad_git_SOURCE_DIR}/util/mach/exception_behaviors_test.cc 94 | ${crashpad_git_SOURCE_DIR}/util/mach/exception_ports_test.cc 95 | ${crashpad_git_SOURCE_DIR}/util/mach/exception_types_test.cc 96 | ${crashpad_git_SOURCE_DIR}/util/mach/mach_extensions_test.cc 97 | ${crashpad_git_SOURCE_DIR}/util/mach/mach_message_server_test.cc 98 | ${crashpad_git_SOURCE_DIR}/util/mach/mach_message_test.cc 99 | ${crashpad_git_SOURCE_DIR}/util/mach/notify_server_test.cc 100 | ${crashpad_git_SOURCE_DIR}/util/mach/scoped_task_suspend_test.cc 101 | ${crashpad_git_SOURCE_DIR}/util/mach/symbolic_constants_mach_test.cc 102 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_test_util_mac.cc 103 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_mac_test.cc 104 | ) 105 | endif() 106 | 107 | if(WIN32) 108 | target_sources(crashpad_util_test PRIVATE 109 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_test_util_win.cc 110 | ${crashpad_git_SOURCE_DIR}/util/win/command_line_test.cc 111 | ${crashpad_git_SOURCE_DIR}/util/win/critical_section_with_debug_info_test.cc 112 | ${crashpad_git_SOURCE_DIR}/util/win/exception_handler_server_test.cc 113 | ${crashpad_git_SOURCE_DIR}/util/win/get_function_test.cc 114 | ${crashpad_git_SOURCE_DIR}/util/win/handle_test.cc 115 | ${crashpad_git_SOURCE_DIR}/util/win/initial_client_data_test.cc 116 | ${crashpad_git_SOURCE_DIR}/util/win/loader_lock_test.cc 117 | ${crashpad_git_SOURCE_DIR}/util/win/process_info_test.cc 118 | ${crashpad_git_SOURCE_DIR}/util/win/registration_protocol_win_test.cc 119 | ${crashpad_git_SOURCE_DIR}/util/win/safe_terminate_process_test.cc 120 | ${crashpad_git_SOURCE_DIR}/util/win/scoped_process_suspend_test.cc 121 | ${crashpad_git_SOURCE_DIR}/util/win/session_end_watcher_test.cc 122 | ) 123 | endif() 124 | 125 | target_link_libraries(crashpad_util_test PRIVATE 126 | crashpad_test 127 | gmock 128 | gtest 129 | gtest_main 130 | crashpad_client 131 | crashpad_handler_obj 132 | minichromium 133 | ZLIB::ZLIB 134 | $<$:rpcrt4.lib> 135 | $<$:dbghelp.lib> 136 | ) 137 | 138 | if(WIN32) 139 | add_executable(crashpad_util_test_process_info_test_child 140 | ${crashpad_git_SOURCE_DIR}/util/win/process_info_test_child.cc 141 | ) 142 | 143 | set_target_properties(crashpad_util_test_process_info_test_child 144 | PROPERTIES 145 | CXX_STANDARD 14 146 | POSITION_INDEPENDENT_CODE ON 147 | CXX_VISIBILITY_PRESET "hidden" 148 | C_VISIBILITY_PRESET "hidden" 149 | VISIBILITY_INLINES_HIDDEN ON 150 | ) 151 | 152 | target_link_libraries(crashpad_util_test_process_info_test_child PRIVATE 153 | crashpad_common 154 | crashpad_compat 155 | ) 156 | 157 | add_executable(crashpad_util_test_safe_terminate_process_test_child 158 | ${crashpad_git_SOURCE_DIR}/util/win/safe_terminate_process_test_child.cc 159 | ) 160 | 161 | set_target_properties(crashpad_util_test_safe_terminate_process_test_child 162 | PROPERTIES 163 | CXX_STANDARD 14 164 | POSITION_INDEPENDENT_CODE ON 165 | CXX_VISIBILITY_PRESET "hidden" 166 | C_VISIBILITY_PRESET "hidden" 167 | VISIBILITY_INLINES_HIDDEN ON 168 | ) 169 | 170 | target_link_libraries(crashpad_util_test_safe_terminate_process_test_child PRIVATE 171 | crashpad_common 172 | crashpad_compat 173 | ) 174 | 175 | add_library(crashpad_util_test_loader_lock_test MODULE 176 | ${crashpad_git_SOURCE_DIR}/util/win/loader_lock_test_dll.cc 177 | ) 178 | 179 | set_target_properties(crashpad_util_test_loader_lock_test 180 | PROPERTIES 181 | CXX_STANDARD 14 182 | POSITION_INDEPENDENT_CODE ON 183 | CXX_VISIBILITY_PRESET "hidden" 184 | C_VISIBILITY_PRESET "hidden" 185 | VISIBILITY_INLINES_HIDDEN ON 186 | ) 187 | 188 | target_link_libraries(crashpad_util_test_loader_lock_test PRIVATE 189 | crashpad_common 190 | crashpad_compat 191 | crashpad_util 192 | minichromium 193 | ) 194 | endif() 195 | 196 | execute_process( 197 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/util/net/testdata 198 | COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/util/net 199 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${crashpad_git_SOURCE_DIR}/util/net/testdata ${CMAKE_BINARY_DIR}/util/net/testdata 200 | ) -------------------------------------------------------------------------------- /cmake/crashpad-util.cmake: -------------------------------------------------------------------------------- 1 | # Utils library 2 | add_library(crashpad_util STATIC) 3 | 4 | set_target_properties(crashpad_util PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_compile_definitions(crashpad_util PRIVATE 13 | -DZLIB_CONST 14 | ) 15 | 16 | target_link_libraries(crashpad_util PRIVATE 17 | minichromium 18 | crashpad_common 19 | crashpad_compat 20 | AppleFrameworks 21 | PUBLIC 22 | ZLIB::ZLIB 23 | ) 24 | 25 | target_sources(crashpad_util PRIVATE 26 | ${crashpad_git_SOURCE_DIR}/util/file/delimited_file_reader.cc 27 | ${crashpad_git_SOURCE_DIR}/util/file/file_helper.cc 28 | ${crashpad_git_SOURCE_DIR}/util/file/file_io.cc 29 | ${crashpad_git_SOURCE_DIR}/util/file/file_reader.cc 30 | ${crashpad_git_SOURCE_DIR}/util/file/file_seeker.cc 31 | ${crashpad_git_SOURCE_DIR}/util/file/file_writer.cc 32 | ${crashpad_git_SOURCE_DIR}/util/file/output_stream_file_writer.cc 33 | ${crashpad_git_SOURCE_DIR}/util/file/scoped_remove_file.cc 34 | ${crashpad_git_SOURCE_DIR}/util/file/string_file.cc 35 | ${crashpad_git_SOURCE_DIR}/util/misc/initialization_state_dcheck.cc 36 | ${crashpad_git_SOURCE_DIR}/util/misc/lexing.cc 37 | ${crashpad_git_SOURCE_DIR}/util/misc/metrics.cc 38 | ${crashpad_git_SOURCE_DIR}/util/misc/pdb_structures.cc 39 | ${crashpad_git_SOURCE_DIR}/util/misc/random_string.cc 40 | ${crashpad_git_SOURCE_DIR}/util/misc/range_set.cc 41 | ${crashpad_git_SOURCE_DIR}/util/misc/reinterpret_bytes.cc 42 | ${crashpad_git_SOURCE_DIR}/util/misc/scoped_forbid_return.cc 43 | ${crashpad_git_SOURCE_DIR}/util/misc/time.cc 44 | ${crashpad_git_SOURCE_DIR}/util/misc/uuid.cc 45 | ${crashpad_git_SOURCE_DIR}/util/misc/zlib.cc 46 | ${crashpad_git_SOURCE_DIR}/util/net/http_body.cc 47 | ${crashpad_git_SOURCE_DIR}/util/net/http_body_gzip.cc 48 | ${crashpad_git_SOURCE_DIR}/util/net/http_multipart_builder.cc 49 | ${crashpad_git_SOURCE_DIR}/util/net/http_transport.cc 50 | ${crashpad_git_SOURCE_DIR}/util/net/url.cc 51 | ${crashpad_git_SOURCE_DIR}/util/numeric/checked_address_range.cc 52 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory.cc 53 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_range.cc 54 | ${crashpad_git_SOURCE_DIR}/util/stdlib/aligned_allocator.cc 55 | ${crashpad_git_SOURCE_DIR}/util/stdlib/string_number_conversion.cc 56 | ${crashpad_git_SOURCE_DIR}/util/stdlib/strlcpy.cc 57 | ${crashpad_git_SOURCE_DIR}/util/stdlib/strnlen.cc 58 | ${crashpad_git_SOURCE_DIR}/util/stream/base94_output_stream.cc 59 | ${crashpad_git_SOURCE_DIR}/util/stream/file_encoder.cc 60 | ${crashpad_git_SOURCE_DIR}/util/stream/file_output_stream.cc 61 | ${crashpad_git_SOURCE_DIR}/util/stream/log_output_stream.cc 62 | ${crashpad_git_SOURCE_DIR}/util/stream/zlib_output_stream.cc 63 | ${crashpad_git_SOURCE_DIR}/util/string/split_string.cc 64 | ${crashpad_git_SOURCE_DIR}/util/thread/thread.cc 65 | ${crashpad_git_SOURCE_DIR}/util/thread/thread_log_messages.cc 66 | ${crashpad_git_SOURCE_DIR}/util/thread/worker_thread.cc 67 | ) 68 | 69 | if(UNIX) 70 | target_sources(crashpad_util PRIVATE 71 | ${crashpad_git_SOURCE_DIR}/util/file/directory_reader_posix.cc 72 | ${crashpad_git_SOURCE_DIR}/util/file/file_io_posix.cc 73 | ${crashpad_git_SOURCE_DIR}/util/file/filesystem_posix.cc 74 | ${crashpad_git_SOURCE_DIR}/util/misc/clock_posix.cc 75 | ${crashpad_git_SOURCE_DIR}/util/posix/close_stdio.cc 76 | ${crashpad_git_SOURCE_DIR}/util/posix/scoped_dir.cc 77 | ${crashpad_git_SOURCE_DIR}/util/posix/scoped_mmap.cc 78 | ${crashpad_git_SOURCE_DIR}/util/posix/signals.cc 79 | ${crashpad_git_SOURCE_DIR}/util/synchronization/semaphore_posix.cc 80 | ${crashpad_git_SOURCE_DIR}/util/thread/thread_posix.cc 81 | ${crashpad_git_SOURCE_DIR}/util/posix/close_multiple.cc 82 | ${crashpad_git_SOURCE_DIR}/util/posix/double_fork_and_exec.cc 83 | ${crashpad_git_SOURCE_DIR}/util/posix/drop_privileges.cc 84 | ${crashpad_git_SOURCE_DIR}/util/posix/symbolic_constants_posix.cc 85 | ) 86 | endif() 87 | 88 | if(APPLE) 89 | # The Apple target needs files generating with python 90 | find_file(EXC_DEFS exc.defs PATH_SUFFIXES /mach) 91 | find_file(MACH_EXC_DEFS mach_exc.defs PATH_SUFFIXES /mach) 92 | find_file(NOTIFY_DEFS notify.defs PATH_SUFFIXES /mach) 93 | include(crashpad-mig) 94 | 95 | target_add_mig_sources(crashpad_util ${EXC_DEFS} 96 | COMPILE_SERVER TRUE 97 | COMPILE_CLIENT TRUE 98 | TARGET_DIR "${crashpad_git_SOURCE_DIR}/util/mach" 99 | ) 100 | 101 | target_add_mig_sources(crashpad_util ${MACH_EXC_DEFS} 102 | COMPILE_SERVER TRUE 103 | COMPILE_CLIENT TRUE 104 | TARGET_DIR "${crashpad_git_SOURCE_DIR}/util/mach" 105 | ) 106 | 107 | target_add_mig_sources(crashpad_util ${NOTIFY_DEFS} 108 | COMPILE_SERVER TRUE 109 | COMPILE_CLIENT TRUE 110 | TARGET_DIR "${crashpad_git_SOURCE_DIR}/util/mach" 111 | ) 112 | 113 | target_add_mig_sources(crashpad_util ${crashpad_git_SOURCE_DIR}/util/mach/child_port.defs 114 | COMPILE_SERVER TRUE 115 | COMPILE_CLIENT TRUE 116 | TARGET_DIR "${crashpad_git_SOURCE_DIR}/util/mach" 117 | ) 118 | 119 | target_sources(crashpad_util PRIVATE 120 | ${crashpad_git_SOURCE_DIR}/util/mac/launchd.mm 121 | ${crashpad_git_SOURCE_DIR}/util/mac/mac_util.cc 122 | ${crashpad_git_SOURCE_DIR}/util/mac/service_management.cc 123 | ${crashpad_git_SOURCE_DIR}/util/mac/sysctl.cc 124 | ${crashpad_git_SOURCE_DIR}/util/mac/xattr.cc 125 | ${crashpad_git_SOURCE_DIR}/util/mach/bootstrap.cc 126 | ${crashpad_git_SOURCE_DIR}/util/mach/child_port_handshake.cc 127 | ${crashpad_git_SOURCE_DIR}/util/mach/child_port_server.cc 128 | ${crashpad_git_SOURCE_DIR}/util/mach/composite_mach_message_server.cc 129 | ${crashpad_git_SOURCE_DIR}/util/mach/exc_client_variants.cc 130 | ${crashpad_git_SOURCE_DIR}/util/mach/exc_server_variants.cc 131 | ${crashpad_git_SOURCE_DIR}/util/mach/exception_behaviors.cc 132 | ${crashpad_git_SOURCE_DIR}/util/mach/exception_ports.cc 133 | ${crashpad_git_SOURCE_DIR}/util/mach/exception_types.cc 134 | ${crashpad_git_SOURCE_DIR}/util/mach/mach_extensions.cc 135 | ${crashpad_git_SOURCE_DIR}/util/mach/mach_message.cc 136 | ${crashpad_git_SOURCE_DIR}/util/mach/mach_message_server.cc 137 | ${crashpad_git_SOURCE_DIR}/util/mach/notify_server.cc 138 | ${crashpad_git_SOURCE_DIR}/util/mach/scoped_task_suspend.cc 139 | ${crashpad_git_SOURCE_DIR}/util/mach/symbolic_constants_mach.cc 140 | ${crashpad_git_SOURCE_DIR}/util/mach/task_for_pid.cc 141 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_mac.S 142 | ${crashpad_git_SOURCE_DIR}/util/misc/clock_mac.cc 143 | ${crashpad_git_SOURCE_DIR}/util/misc/paths_mac.cc 144 | ${crashpad_git_SOURCE_DIR}/util/net/http_transport_mac.mm 145 | ${crashpad_git_SOURCE_DIR}/util/posix/process_info_mac.cc 146 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_mac.cc 147 | ${crashpad_git_SOURCE_DIR}/util/synchronization/semaphore_mac.cc 148 | ) 149 | endif() 150 | 151 | if(UNIX AND NOT APPLE) 152 | target_sources(crashpad_util PRIVATE 153 | ${crashpad_git_SOURCE_DIR}/util/net/http_transport_socket.cc 154 | ${crashpad_git_SOURCE_DIR}/util/linux/auxiliary_vector.cc 155 | ${crashpad_git_SOURCE_DIR}/util/linux/direct_ptrace_connection.cc 156 | ${crashpad_git_SOURCE_DIR}/util/linux/exception_handler_client.cc 157 | ${crashpad_git_SOURCE_DIR}/util/linux/exception_handler_protocol.cc 158 | ${crashpad_git_SOURCE_DIR}/util/linux/memory_map.cc 159 | ${crashpad_git_SOURCE_DIR}/util/linux/proc_stat_reader.cc 160 | ${crashpad_git_SOURCE_DIR}/util/linux/proc_task_reader.cc 161 | ${crashpad_git_SOURCE_DIR}/util/linux/ptrace_broker.cc 162 | ${crashpad_git_SOURCE_DIR}/util/linux/ptrace_client.cc 163 | ${crashpad_git_SOURCE_DIR}/util/linux/ptracer.cc 164 | ${crashpad_git_SOURCE_DIR}/util/linux/scoped_pr_set_dumpable.cc 165 | ${crashpad_git_SOURCE_DIR}/util/linux/scoped_pr_set_ptracer.cc 166 | ${crashpad_git_SOURCE_DIR}/util/linux/scoped_ptrace_attach.cc 167 | ${crashpad_git_SOURCE_DIR}/util/linux/socket.cc 168 | ${crashpad_git_SOURCE_DIR}/util/linux/thread_info.cc 169 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_linux.S 170 | ${crashpad_git_SOURCE_DIR}/util/misc/paths_linux.cc 171 | ${crashpad_git_SOURCE_DIR}/util/misc/time_linux.cc 172 | ${crashpad_git_SOURCE_DIR}/util/posix/process_info_linux.cc 173 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_linux.cc 174 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_sanitized.cc 175 | ) 176 | endif() 177 | 178 | if(WIN32) 179 | target_sources(crashpad_util PRIVATE 180 | ${crashpad_git_SOURCE_DIR}/util/file/directory_reader_win.cc 181 | ${crashpad_git_SOURCE_DIR}/util/file/file_io_win.cc 182 | ${crashpad_git_SOURCE_DIR}/util/file/filesystem_win.cc 183 | ${crashpad_git_SOURCE_DIR}/util/misc/clock_win.cc 184 | ${crashpad_git_SOURCE_DIR}/util/misc/paths_win.cc 185 | ${crashpad_git_SOURCE_DIR}/util/misc/time_win.cc 186 | ${crashpad_git_SOURCE_DIR}/util/net/http_transport_win.cc 187 | ${crashpad_git_SOURCE_DIR}/util/synchronization/semaphore_win.cc 188 | ${crashpad_git_SOURCE_DIR}/util/thread/thread_win.cc 189 | ${crashpad_git_SOURCE_DIR}/util/win/command_line.cc 190 | ${crashpad_git_SOURCE_DIR}/util/win/critical_section_with_debug_info.cc 191 | ${crashpad_git_SOURCE_DIR}/util/win/exception_handler_server.cc 192 | ${crashpad_git_SOURCE_DIR}/util/win/get_function.cc 193 | ${crashpad_git_SOURCE_DIR}/util/win/get_module_information.cc 194 | ${crashpad_git_SOURCE_DIR}/util/win/handle.cc 195 | ${crashpad_git_SOURCE_DIR}/util/win/initial_client_data.cc 196 | ${crashpad_git_SOURCE_DIR}/util/win/loader_lock.cc 197 | ${crashpad_git_SOURCE_DIR}/util/win/module_version.cc 198 | ${crashpad_git_SOURCE_DIR}/util/win/nt_internals.cc 199 | ${crashpad_git_SOURCE_DIR}/util/win/ntstatus_logging.cc 200 | ${crashpad_git_SOURCE_DIR}/util/win/process_info.cc 201 | ${crashpad_git_SOURCE_DIR}/util/win/registration_protocol_win.cc 202 | ${crashpad_git_SOURCE_DIR}/util/win/scoped_handle.cc 203 | ${crashpad_git_SOURCE_DIR}/util/win/scoped_local_alloc.cc 204 | ${crashpad_git_SOURCE_DIR}/util/win/scoped_process_suspend.cc 205 | ${crashpad_git_SOURCE_DIR}/util/win/scoped_set_event.cc 206 | ${crashpad_git_SOURCE_DIR}/util/win/session_end_watcher.cc 207 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_win.asm 208 | ${crashpad_git_SOURCE_DIR}/util/win/safe_terminate_process.asm 209 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory.cc 210 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_range.cc 211 | ${crashpad_git_SOURCE_DIR}/util/process/process_memory_win.cc 212 | ) 213 | 214 | if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4) 215 | set_source_files_properties( 216 | ${crashpad_git_SOURCE_DIR}/util/misc/capture_context_win.asm 217 | PROPERTIES 218 | COMPILE_FLAGS "/safeseh" 219 | ) 220 | 221 | set_source_files_properties( 222 | ${crashpad_git_SOURCE_DIR}/util/win/safe_terminate_process.asm 223 | PROPERTIES 224 | COMPILE_FLAGS "/safeseh" 225 | ) 226 | endif() 227 | endif() 228 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /cmake/crashpad-snapshot-test.cmake: -------------------------------------------------------------------------------- 1 | add_library(snapshot_test_support OBJECT) 2 | 3 | set_target_properties(snapshot_test_support 4 | PROPERTIES 5 | CXX_STANDARD 14 6 | POSITION_INDEPENDENT_CODE ON 7 | CXX_VISIBILITY_PRESET "hidden" 8 | C_VISIBILITY_PRESET "hidden" 9 | VISIBILITY_INLINES_HIDDEN ON 10 | ) 11 | 12 | target_sources(snapshot_test_support 13 | PRIVATE 14 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_cpu_context.cc 15 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_cpu_context.h 16 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_exception_snapshot.cc 17 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_exception_snapshot.h 18 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_memory_map_region_snapshot.cc 19 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_memory_map_region_snapshot.h 20 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_memory_snapshot.cc 21 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_memory_snapshot.h 22 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_module_snapshot.cc 23 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_module_snapshot.h 24 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_process_snapshot.cc 25 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_process_snapshot.h 26 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_system_snapshot.cc 27 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_system_snapshot.h 28 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_thread_snapshot.cc 29 | ${crashpad_git_SOURCE_DIR}/snapshot/test/test_thread_snapshot.h 30 | ) 31 | 32 | target_link_libraries(snapshot_test_support PRIVATE 33 | crashpad_common 34 | crashpad_compat 35 | minichromium 36 | crashpad_util 37 | ) 38 | 39 | crashpad_add_test(crashpad_snapshot_test) 40 | 41 | if(NOT MSVC) 42 | target_compile_options(crashpad_snapshot_test PRIVATE 43 | -Wno-maybe-uninitialized 44 | ) 45 | endif() 46 | 47 | target_sources(crashpad_snapshot_test PRIVATE 48 | ${crashpad_git_SOURCE_DIR}/snapshot/cpu_context_test.cc 49 | ${crashpad_git_SOURCE_DIR}/snapshot/memory_snapshot_test.cc 50 | ${crashpad_git_SOURCE_DIR}/snapshot/minidump/process_snapshot_minidump_test.cc 51 | ) 52 | 53 | if(APPLE) 54 | target_sources(crashpad_snapshot_test PRIVATE 55 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/cpu_context_mac_test.cc 56 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_annotations_reader_test.cc 57 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_reader_test.cc 58 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_segment_reader_test.cc 59 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/process_reader_mac_test.cc 60 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/process_types_test.cc 61 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/system_snapshot_mac_test.cc 62 | ) 63 | endif() 64 | 65 | if(UNIX AND NOT APPLE) 66 | target_sources(crashpad_snapshot_test PRIVATE 67 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/debug_rendezvous_test.cc 68 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/exception_snapshot_linux_test.cc 69 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/process_reader_linux_test.cc 70 | ${crashpad_git_SOURCE_DIR}/snapshot/linux/system_snapshot_linux_test.cc 71 | ${crashpad_git_SOURCE_DIR}/snapshot/sanitized/process_snapshot_sanitized_test.cc 72 | ${crashpad_git_SOURCE_DIR}/snapshot/sanitized/sanitization_information_test.cc 73 | ) 74 | else() 75 | target_sources(crashpad_snapshot_test PRIVATE 76 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_info_client_options_test.cc 77 | ) 78 | endif() 79 | 80 | if(NOT APPLE) 81 | target_sources(crashpad_snapshot_test PRIVATE 82 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_types/crashpad_info_reader_test.cc 83 | ) 84 | endif() 85 | 86 | if(WIN32) 87 | target_sources(crashpad_snapshot_test PRIVATE 88 | ${crashpad_git_SOURCE_DIR}/snapshot/win/cpu_context_win_test.cc 89 | ${crashpad_git_SOURCE_DIR}/snapshot/win/exception_snapshot_win_test.cc 90 | ${crashpad_git_SOURCE_DIR}/snapshot/win/extra_memory_ranges_test.cc 91 | ${crashpad_git_SOURCE_DIR}/snapshot/win/module_snapshot_win_test.cc 92 | ${crashpad_git_SOURCE_DIR}/snapshot/win/pe_image_reader_test.cc 93 | ${crashpad_git_SOURCE_DIR}/snapshot/win/process_reader_win_test.cc 94 | ${crashpad_git_SOURCE_DIR}/snapshot/win/process_snapshot_win_test.cc 95 | ${crashpad_git_SOURCE_DIR}/snapshot/win/system_snapshot_win_test.cc 96 | ) 97 | else() 98 | target_sources(crashpad_snapshot_test PRIVATE 99 | ${crashpad_git_SOURCE_DIR}/snapshot/posix/timezone_test.cc 100 | ) 101 | endif() 102 | 103 | target_link_libraries(crashpad_snapshot_test PRIVATE 104 | snapshot_test_support 105 | crashpad_client 106 | crashpad_test 107 | minichromium 108 | crashpad_util 109 | gtest 110 | gtest_main 111 | crashpad_handler_obj 112 | ZLIB::ZLIB 113 | ) 114 | 115 | add_dependencies(crashpad_snapshot_test 116 | crashpad_snapshot_test_module 117 | crashpad_snapshot_test_module_large 118 | crashpad_snapshot_test_module_small 119 | ) 120 | 121 | set(CMAKE_SHARED_MODULE_PREFIX "") 122 | 123 | add_library(crashpad_snapshot_test_module MODULE 124 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_info_client_options_test_module.cc 125 | ) 126 | 127 | set_target_properties(crashpad_snapshot_test_module 128 | PROPERTIES 129 | CXX_STANDARD 14 130 | POSITION_INDEPENDENT_CODE ON 131 | CXX_VISIBILITY_PRESET "hidden" 132 | C_VISIBILITY_PRESET "hidden" 133 | VISIBILITY_INLINES_HIDDEN ON 134 | ) 135 | 136 | target_link_libraries(crashpad_snapshot_test_module PRIVATE 137 | crashpad_common 138 | crashpad_client 139 | AppleFrameworks 140 | ) 141 | 142 | add_library(crashpad_snapshot_test_module_large MODULE 143 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_info_size_test_module.cc 144 | ) 145 | 146 | set_target_properties(crashpad_snapshot_test_module_large 147 | PROPERTIES 148 | CXX_STANDARD 14 149 | POSITION_INDEPENDENT_CODE ON 150 | CXX_VISIBILITY_PRESET "hidden" 151 | C_VISIBILITY_PRESET "hidden" 152 | VISIBILITY_INLINES_HIDDEN ON 153 | ) 154 | 155 | target_compile_definitions(crashpad_snapshot_test_module_large PRIVATE 156 | -DCRASHPAD_INFO_SIZE_TEST_MODULE_LARGE 157 | ) 158 | 159 | target_link_libraries(crashpad_snapshot_test_module_large PRIVATE 160 | crashpad_common 161 | minichromium 162 | AppleFrameworks 163 | ) 164 | 165 | if(UNIX) 166 | target_link_libraries(crashpad_snapshot_test_module_large PRIVATE crashpad_util) 167 | endif() 168 | 169 | add_library(crashpad_snapshot_test_module_small MODULE 170 | ${crashpad_git_SOURCE_DIR}/snapshot/crashpad_info_size_test_module.cc 171 | ) 172 | 173 | set_target_properties(crashpad_snapshot_test_module_small 174 | PROPERTIES 175 | CXX_STANDARD 14 176 | POSITION_INDEPENDENT_CODE ON 177 | CXX_VISIBILITY_PRESET "hidden" 178 | C_VISIBILITY_PRESET "hidden" 179 | VISIBILITY_INLINES_HIDDEN ON 180 | ) 181 | 182 | target_compile_definitions(crashpad_snapshot_test_module_small PRIVATE 183 | CRASHPAD_INFO_SIZE_TEST_MODULE_SMALL 184 | ) 185 | 186 | target_link_libraries(crashpad_snapshot_test_module_small PRIVATE 187 | crashpad_common 188 | AppleFrameworks 189 | ) 190 | if(UNIX) 191 | target_link_libraries(crashpad_snapshot_test_module_small PRIVATE crashpad_util) 192 | endif() 193 | 194 | if(UNIX AND NOT APPLE) 195 | add_library(crashpad_snapshot_test_both_dt_hash_styles MODULE 196 | ${crashpad_git_SOURCE_DIR}/snapshot/hash_types_test.cc 197 | ) 198 | 199 | set_target_properties(crashpad_snapshot_test_both_dt_hash_styles 200 | PROPERTIES 201 | CXX_STANDARD 14 202 | POSITION_INDEPENDENT_CODE ON 203 | CXX_VISIBILITY_PRESET "hidden" 204 | C_VISIBILITY_PRESET "hidden" 205 | VISIBILITY_INLINES_HIDDEN ON 206 | ) 207 | 208 | target_link_libraries(crashpad_snapshot_test_both_dt_hash_styles PRIVATE crashpad_common) 209 | 210 | target_link_options(crashpad_snapshot_test_both_dt_hash_styles PRIVATE 211 | "-Wl,--hash-style=both" 212 | ) 213 | endif() 214 | 215 | if(APPLE) 216 | add_library(crashpad_snapshot_test_module_crashy_initializer MODULE 217 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_annotations_reader_test_module_crashy_initializer.cc 218 | ) 219 | 220 | set_target_properties(crashpad_snapshot_test_module_crashy_initializer 221 | PROPERTIES 222 | CXX_STANDARD 14 223 | POSITION_INDEPENDENT_CODE ON 224 | CXX_VISIBILITY_PRESET "hidden" 225 | C_VISIBILITY_PRESET "hidden" 226 | VISIBILITY_INLINES_HIDDEN ON 227 | ) 228 | 229 | target_link_libraries(crashpad_snapshot_test_module_crashy_initializer PRIVATE 230 | crashpad_common 231 | ) 232 | 233 | add_executable(crashpad_snapshot_test_no_op 234 | ${crashpad_git_SOURCE_DIR}/snapshot/mac/mach_o_image_annotations_reader_test_no_op.cc 235 | ) 236 | 237 | set_target_properties(crashpad_snapshot_test_no_op 238 | PROPERTIES 239 | CXX_STANDARD 14 240 | POSITION_INDEPENDENT_CODE ON 241 | CXX_VISIBILITY_PRESET "hidden" 242 | C_VISIBILITY_PRESET "hidden" 243 | VISIBILITY_INLINES_HIDDEN ON 244 | ) 245 | 246 | target_link_libraries(crashpad_snapshot_test_no_op PRIVATE 247 | crashpad_common 248 | ) 249 | 250 | add_dependencies(crashpad_snapshot_test 251 | crashpad_snapshot_test_module_crashy_initializer 252 | crashpad_snapshot_test_no_op 253 | ) 254 | endif() 255 | 256 | if(WIN32) 257 | add_executable(crashpad_snapshot_test_annotations 258 | ${crashpad_git_SOURCE_DIR}/snapshot/win/crashpad_snapshot_test_annotations.cc 259 | ) 260 | 261 | set_target_properties(crashpad_snapshot_test_annotations 262 | PROPERTIES 263 | CXX_STANDARD 14 264 | POSITION_INDEPENDENT_CODE ON 265 | CXX_VISIBILITY_PRESET "hidden" 266 | C_VISIBILITY_PRESET "hidden" 267 | VISIBILITY_INLINES_HIDDEN ON 268 | ) 269 | 270 | target_link_libraries(crashpad_snapshot_test_annotations PRIVATE 271 | crashpad_common 272 | crashpad_client 273 | minichromium 274 | ) 275 | 276 | add_executable(crashpad_snapshot_test_crashing_child 277 | ${crashpad_git_SOURCE_DIR}/snapshot/win/crashpad_snapshot_test_crashing_child.cc 278 | ) 279 | 280 | set_target_properties(crashpad_snapshot_test_crashing_child 281 | PROPERTIES 282 | CXX_STANDARD 14 283 | POSITION_INDEPENDENT_CODE ON 284 | CXX_VISIBILITY_PRESET "hidden" 285 | C_VISIBILITY_PRESET "hidden" 286 | VISIBILITY_INLINES_HIDDEN ON 287 | ) 288 | 289 | target_link_libraries(crashpad_snapshot_test_crashing_child PRIVATE 290 | crashpad_common 291 | crashpad_client 292 | minichromium 293 | crashpad_util 294 | ) 295 | 296 | add_executable(crashpad_snapshot_test_dump_without_crashing 297 | ${crashpad_git_SOURCE_DIR}/snapshot/win/crashpad_snapshot_test_dump_without_crashing.cc 298 | ) 299 | 300 | set_target_properties(crashpad_snapshot_test_dump_without_crashing 301 | PROPERTIES 302 | CXX_STANDARD 14 303 | POSITION_INDEPENDENT_CODE ON 304 | CXX_VISIBILITY_PRESET "hidden" 305 | C_VISIBILITY_PRESET "hidden" 306 | VISIBILITY_INLINES_HIDDEN ON 307 | ) 308 | target_link_libraries(crashpad_snapshot_test_dump_without_crashing PRIVATE 309 | crashpad_common 310 | crashpad_client 311 | minichromium 312 | crashpad_util 313 | ) 314 | 315 | add_executable(crashpad_snapshot_test_extra_memory_ranges 316 | ${crashpad_git_SOURCE_DIR}/snapshot/win/crashpad_snapshot_test_extra_memory_ranges.cc 317 | ) 318 | 319 | set_target_properties(crashpad_snapshot_test_extra_memory_ranges 320 | PROPERTIES 321 | CXX_STANDARD 14 322 | POSITION_INDEPENDENT_CODE ON 323 | CXX_VISIBILITY_PRESET "hidden" 324 | C_VISIBILITY_PRESET "hidden" 325 | VISIBILITY_INLINES_HIDDEN ON 326 | ) 327 | 328 | target_link_libraries(crashpad_snapshot_test_extra_memory_ranges PRIVATE 329 | crashpad_common 330 | crashpad_client 331 | minichromium 332 | ) 333 | 334 | add_executable(crashpad_snapshot_test_image_reader 335 | ${crashpad_git_SOURCE_DIR}/snapshot/win/crashpad_snapshot_test_image_reader.cc 336 | ) 337 | 338 | set_target_properties(crashpad_snapshot_test_image_reader 339 | PROPERTIES 340 | CXX_STANDARD 14 341 | POSITION_INDEPENDENT_CODE ON 342 | CXX_VISIBILITY_PRESET "hidden" 343 | C_VISIBILITY_PRESET "hidden" 344 | VISIBILITY_INLINES_HIDDEN ON 345 | ) 346 | 347 | target_link_libraries(crashpad_snapshot_test_image_reader PRIVATE 348 | crashpad_common 349 | crashpad_client 350 | minichromium 351 | crashpad_util 352 | ) 353 | 354 | add_library(crashpad_snapshot_test_image_reader_module MODULE 355 | ${crashpad_git_SOURCE_DIR}/snapshot/win/crashpad_snapshot_test_image_reader_module.cc 356 | ) 357 | 358 | set_target_properties(crashpad_snapshot_test_image_reader_module 359 | PROPERTIES 360 | CXX_STANDARD 14 361 | POSITION_INDEPENDENT_CODE ON 362 | CXX_VISIBILITY_PRESET "hidden" 363 | C_VISIBILITY_PRESET "hidden" 364 | VISIBILITY_INLINES_HIDDEN ON 365 | ) 366 | 367 | target_link_libraries(crashpad_snapshot_test_image_reader_module PRIVATE 368 | crashpad_common 369 | crashpad_client 370 | minichromium 371 | ) 372 | 373 | add_dependencies(crashpad_snapshot_test 374 | crashpad_snapshot_test_annotations 375 | crashpad_snapshot_test_crashing_child 376 | crashpad_snapshot_test_dump_without_crashing 377 | crashpad_snapshot_test_extra_memory_ranges 378 | crashpad_snapshot_test_image_reader 379 | crashpad_snapshot_test_image_reader_module 380 | ) 381 | endif() --------------------------------------------------------------------------------