├── .clang-format ├── .gitattributes ├── .github └── workflows │ └── main.yml ├── .gitignore ├── .gitmodules ├── .gn ├── .style.yapf ├── .vpython3 ├── AUTHORS ├── BUILD.gn ├── CMakeLists.txt ├── CONTRIBUTORS ├── DEPS ├── LICENSE ├── OWNERS ├── README.md ├── backtrace ├── save_artifacts.rb └── test │ ├── Gemfile │ ├── crashpad_utils.rb │ ├── test.rb │ ├── test_linux.rb │ ├── test_macos.rb │ └── test_windows.rb ├── build ├── BUILD.gn ├── BUILDCONFIG.gn ├── config │ └── fuchsia │ │ └── gn_configs.gni ├── crashpad_buildconfig.gni ├── crashpad_fuzzer_test.gni ├── fuchsia_envs.py ├── install_linux_sysroot.py ├── ios │ ├── Default.png │ ├── Unittest-Info.plist │ ├── convert_gn_xcodeproj.py │ ├── setup_ios_gn.config │ ├── setup_ios_gn.py │ ├── xcodescheme-testable.template │ └── xcodescheme.template ├── run_tests.py └── test.gni ├── client ├── BUILD.gn ├── CMakeLists.txt ├── annotation.cc ├── annotation.h ├── annotation_list.cc ├── annotation_list.h ├── annotation_list_test.cc ├── annotation_test.cc ├── client_argv_handling.cc ├── client_argv_handling.h ├── crash_report_database.cc ├── crash_report_database.h ├── crash_report_database_generic.cc ├── crash_report_database_mac.mm ├── crash_report_database_test.cc ├── crash_report_database_win.cc ├── crashpad_client.h ├── crashpad_client_fuchsia.cc ├── crashpad_client_ios.cc ├── crashpad_client_ios_test.mm ├── crashpad_client_linux.cc ├── crashpad_client_linux_test.cc ├── crashpad_client_mac.cc ├── crashpad_client_win.cc ├── crashpad_client_win_test.cc ├── crashpad_info.cc ├── crashpad_info.h ├── crashpad_info_note.S ├── crashpad_info_test.cc ├── ios_handler │ ├── exception_processor.h │ ├── exception_processor.mm │ ├── exception_processor_test.mm │ ├── in_process_handler.cc │ ├── in_process_handler.h │ ├── in_process_handler_test.cc │ ├── in_process_intermediate_dump_handler.cc │ ├── in_process_intermediate_dump_handler.h │ ├── in_process_intermediate_dump_handler_test.cc │ ├── prune_intermediate_dumps_and_crash_reports_thread.cc │ └── prune_intermediate_dumps_and_crash_reports_thread.h ├── length_delimited_ring_buffer.h ├── length_delimited_ring_buffer_test.cc ├── prune_crash_reports.cc ├── prune_crash_reports.h ├── prune_crash_reports_test.cc ├── pthread_create_linux.cc ├── ring_buffer_annotation.h ├── ring_buffer_annotation_load_test_main.cc ├── ring_buffer_annotation_test.cc ├── settings.cc ├── settings.h ├── settings_test.cc ├── simple_address_range_bag.h ├── simple_address_range_bag_test.cc ├── simple_string_dictionary.h ├── simple_string_dictionary_test.cc ├── simulate_crash.h ├── simulate_crash_ios.h ├── simulate_crash_linux.h ├── simulate_crash_mac.cc ├── simulate_crash_mac.h ├── simulate_crash_mac_test.cc ├── simulate_crash_win.h └── upload_behavior_ios.h ├── codereview.settings ├── compat ├── BUILD.gn ├── CMakeLists.txt ├── android │ ├── dlfcn_internal.cc │ ├── dlfcn_internal.h │ ├── elf.h │ ├── linux │ │ ├── elf.h │ │ ├── prctl.h │ │ └── ptrace.h │ ├── sched.h │ └── sys │ │ ├── epoll.cc │ │ ├── epoll.h │ │ ├── mman.h │ │ ├── mman_mmap.cc │ │ ├── syscall.h │ │ └── user.h ├── ios │ └── mach │ │ ├── exc.defs │ │ ├── mach_exc.defs │ │ ├── mach_types.defs │ │ ├── machine │ │ └── machine_types.defs │ │ └── std_types.defs ├── linux │ ├── signal.h │ └── sys │ │ ├── mman.h │ │ ├── mman_memfd_create.cc │ │ ├── ptrace.h │ │ └── user.h ├── mac │ ├── Availability.h │ ├── AvailabilityVersions.h │ ├── kern │ │ └── exc_resource.h │ ├── mach-o │ │ └── loader.h │ ├── mach │ │ ├── i386 │ │ │ └── thread_state.h │ │ └── mach.h │ └── sys │ │ └── resource.h ├── non_mac │ ├── mach-o │ │ └── loader.h │ └── mach │ │ ├── mach.h │ │ ├── machine.h │ │ └── vm_prot.h ├── non_win │ ├── dbghelp.h │ ├── minwinbase.h │ ├── timezoneapi.h │ ├── verrsrc.h │ ├── windows.h │ └── winnt.h └── win │ ├── getopt.h │ ├── strings.cc │ ├── strings.h │ ├── sys │ ├── time.h │ └── types.h │ ├── time.cc │ ├── time.h │ ├── winbase.h │ ├── winnt.h │ └── winternl.h ├── doc ├── .gitignore ├── appengine │ ├── README │ ├── go.mod │ ├── go.sum │ └── src │ │ └── crashpad-home │ │ ├── app.yaml │ │ └── main.go ├── developing.md ├── favicon.ico ├── ios_overview_design.md ├── layering.png ├── man.md ├── overview.png ├── overview_design.md ├── status.md └── support │ ├── compat.sh │ ├── crashpad.doxy │ ├── crashpad.doxy.h │ ├── crashpad_doxygen.css │ ├── generate.sh │ ├── generate_doxygen.py │ └── generate_git.sh ├── examples ├── CMakeLists.txt ├── linux │ ├── crash_loop_detection │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ └── crash_loop_detection.cpp │ └── demo │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ └── demo.cpp ├── macos │ └── demo │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ └── demo.cpp └── windows │ ├── demo │ ├── CMakeLists.txt │ ├── README.md │ └── demo.cpp │ └── qt-window-app │ ├── CMakeLists.txt │ ├── app.rc │ ├── backtrace.cpp │ ├── backtrace.hpp │ ├── backtrace.qrc │ ├── icon.ico │ ├── icon.png │ ├── logo.png │ ├── main.cpp │ ├── mainwindow.cpp │ ├── mainwindow.hpp │ └── mainwindow.ui ├── handler ├── BUILD.gn ├── CMakeLists.txt ├── crash_report_upload_thread.cc ├── crash_report_upload_thread.h ├── crashpad_handler.md ├── crashpad_handler_main.cc ├── crashpad_handler_test.cc ├── crashpad_handler_test_extended_handler.cc ├── handler_main.cc ├── handler_main.h ├── linux │ ├── capture_snapshot.cc │ ├── capture_snapshot.h │ ├── crash_report_exception_handler.cc │ ├── crash_report_exception_handler.h │ ├── cros_crash_report_exception_handler.cc │ ├── cros_crash_report_exception_handler.h │ ├── exception_handler_server.cc │ ├── exception_handler_server.h │ ├── exception_handler_server_test.cc │ └── handler_trampoline.cc ├── mac │ ├── crash_report_exception_handler.cc │ ├── crash_report_exception_handler.h │ ├── exception_handler_server.cc │ ├── exception_handler_server.h │ ├── file_limit_annotation.cc │ └── file_limit_annotation.h ├── main.cc ├── minidump_to_upload_parameters.cc ├── minidump_to_upload_parameters.h ├── minidump_to_upload_parameters_test.cc ├── prune_crash_reports_thread.cc ├── prune_crash_reports_thread.h ├── user_stream_data_source.cc ├── user_stream_data_source.h └── win │ ├── .gitattributes │ ├── crash_other_program.cc │ ├── crash_report_exception_handler.cc │ ├── crash_report_exception_handler.h │ ├── crashy_signal.cc │ ├── crashy_test_program.cc │ ├── crashy_test_z7_loader.cc │ ├── fake_handler_that_crashes_at_startup.cc │ ├── fastfail_test_program.cc │ ├── hanging_program.cc │ ├── heap_corrupting_program.cc │ ├── loader_lock_dll.cc │ ├── self_destroying_test_program.cc │ ├── wer │ ├── BUILD.gn │ ├── crashpad_wer.cc │ ├── crashpad_wer.def │ ├── crashpad_wer.h │ ├── crashpad_wer.ver │ ├── crashpad_wer_main.cc │ └── crashpad_wer_module_unittest.cc │ ├── z7_test.cpp │ └── z7_test.dll ├── infra └── config │ ├── PRESUBMIT.py │ ├── generated │ ├── commit-queue.cfg │ ├── cr-buildbucket.cfg │ ├── luci-logdog.cfg │ ├── luci-milo.cfg │ ├── luci-scheduler.cfg │ ├── project.cfg │ └── realms.cfg │ └── main.star ├── minidump ├── BUILD.gn ├── CMakeLists.txt ├── minidump_annotation_writer.cc ├── minidump_annotation_writer.h ├── minidump_annotation_writer_test.cc ├── minidump_byte_array_writer.cc ├── minidump_byte_array_writer.h ├── minidump_byte_array_writer_test.cc ├── minidump_context.h ├── minidump_context_writer.cc ├── minidump_context_writer.h ├── minidump_context_writer_test.cc ├── minidump_crashpad_info_writer.cc ├── minidump_crashpad_info_writer.h ├── minidump_crashpad_info_writer_test.cc ├── minidump_exception_writer.cc ├── minidump_exception_writer.h ├── minidump_exception_writer_test.cc ├── minidump_extensions.cc ├── minidump_extensions.h ├── minidump_file_writer.cc ├── minidump_file_writer.h ├── minidump_file_writer_test.cc ├── minidump_handle_writer.cc ├── minidump_handle_writer.h ├── minidump_handle_writer_test.cc ├── minidump_memory_info_writer.cc ├── minidump_memory_info_writer.h ├── minidump_memory_info_writer_test.cc ├── minidump_memory_writer.cc ├── minidump_memory_writer.h ├── minidump_memory_writer_test.cc ├── minidump_misc_info_writer.cc ├── minidump_misc_info_writer.h ├── minidump_misc_info_writer_test.cc ├── minidump_module_crashpad_info_writer.cc ├── minidump_module_crashpad_info_writer.h ├── minidump_module_crashpad_info_writer_test.cc ├── minidump_module_writer.cc ├── minidump_module_writer.h ├── minidump_module_writer_test.cc ├── minidump_rva_list_writer.cc ├── minidump_rva_list_writer.h ├── minidump_rva_list_writer_test.cc ├── minidump_simple_string_dictionary_writer.cc ├── minidump_simple_string_dictionary_writer.h ├── minidump_simple_string_dictionary_writer_test.cc ├── minidump_stream_writer.cc ├── minidump_stream_writer.h ├── minidump_string_writer.cc ├── minidump_string_writer.h ├── minidump_string_writer_test.cc ├── minidump_system_info_writer.cc ├── minidump_system_info_writer.h ├── minidump_system_info_writer_test.cc ├── minidump_thread_id_map.cc ├── minidump_thread_id_map.h ├── minidump_thread_id_map_test.cc ├── minidump_thread_name_list_writer.cc ├── minidump_thread_name_list_writer.h ├── minidump_thread_name_list_writer_test.cc ├── minidump_thread_writer.cc ├── minidump_thread_writer.h ├── minidump_thread_writer_test.cc ├── minidump_unloaded_module_writer.cc ├── minidump_unloaded_module_writer.h ├── minidump_unloaded_module_writer_test.cc ├── minidump_user_extension_stream_data_source.cc ├── minidump_user_extension_stream_data_source.h ├── minidump_user_stream_writer.cc ├── minidump_user_stream_writer.h ├── minidump_user_stream_writer_test.cc ├── minidump_writable.cc ├── minidump_writable.h ├── minidump_writable_test.cc ├── minidump_writer_util.cc ├── minidump_writer_util.h └── test │ ├── minidump_byte_array_writer_test_util.cc │ ├── minidump_byte_array_writer_test_util.h │ ├── minidump_context_test_util.cc │ ├── minidump_context_test_util.h │ ├── minidump_file_writer_test_util.cc │ ├── minidump_file_writer_test_util.h │ ├── minidump_memory_writer_test_util.cc │ ├── minidump_memory_writer_test_util.h │ ├── minidump_rva_list_test_util.cc │ ├── minidump_rva_list_test_util.h │ ├── minidump_string_writer_test_util.cc │ ├── minidump_string_writer_test_util.h │ ├── minidump_user_extension_stream_util.cc │ ├── minidump_user_extension_stream_util.h │ ├── minidump_writable_test_util.cc │ └── minidump_writable_test_util.h ├── navbar.md ├── package.h ├── snapshot ├── BUILD.gn ├── CMakeLists.txt ├── annotation_snapshot.cc ├── annotation_snapshot.h ├── capture_memory.cc ├── capture_memory.h ├── cpu_architecture.h ├── cpu_context.cc ├── cpu_context.h ├── cpu_context_test.cc ├── crashpad_info_client_options.cc ├── crashpad_info_client_options.h ├── crashpad_info_client_options_test.cc ├── crashpad_info_client_options_test_module.cc ├── crashpad_info_size_test_module.cc ├── crashpad_info_size_test_note.S ├── crashpad_types │ ├── crashpad_info_reader.cc │ ├── crashpad_info_reader.h │ ├── crashpad_info_reader_test.cc │ ├── image_annotation_reader.cc │ ├── image_annotation_reader.h │ └── image_annotation_reader_test.cc ├── elf │ ├── elf_dynamic_array_reader.cc │ ├── elf_dynamic_array_reader.h │ ├── elf_image_reader.cc │ ├── elf_image_reader.h │ ├── elf_image_reader_fuzzer.cc │ ├── elf_image_reader_fuzzer_corpus │ │ ├── .gitattributes │ │ ├── crashpad_snapshot_test_both_dt_hash_styles.so │ │ └── ret42 │ ├── elf_image_reader_test.cc │ ├── elf_image_reader_test_note.S │ ├── elf_symbol_table_reader.cc │ ├── elf_symbol_table_reader.h │ ├── module_snapshot_elf.cc │ ├── module_snapshot_elf.h │ └── test_exported_symbols.sym ├── exception_snapshot.h ├── fuchsia │ ├── cpu_context_fuchsia.cc │ ├── cpu_context_fuchsia.h │ ├── exception_snapshot_fuchsia.cc │ ├── exception_snapshot_fuchsia.h │ ├── memory_map_fuchsia.cc │ ├── memory_map_fuchsia.h │ ├── memory_map_region_snapshot_fuchsia.cc │ ├── memory_map_region_snapshot_fuchsia.h │ ├── process_reader_fuchsia.cc │ ├── process_reader_fuchsia.h │ ├── process_reader_fuchsia_test.cc │ ├── process_snapshot_fuchsia.cc │ ├── process_snapshot_fuchsia.h │ ├── process_snapshot_fuchsia_test.cc │ ├── system_snapshot_fuchsia.cc │ ├── system_snapshot_fuchsia.h │ ├── thread_snapshot_fuchsia.cc │ └── thread_snapshot_fuchsia.h ├── handle_snapshot.cc ├── handle_snapshot.h ├── hash_types_test.cc ├── ios │ ├── exception_snapshot_ios_intermediate_dump.cc │ ├── exception_snapshot_ios_intermediate_dump.h │ ├── intermediate_dump_reader_util.cc │ ├── intermediate_dump_reader_util.h │ ├── memory_snapshot_ios_intermediate_dump.cc │ ├── memory_snapshot_ios_intermediate_dump.h │ ├── memory_snapshot_ios_intermediate_dump_test.cc │ ├── module_snapshot_ios_intermediate_dump.cc │ ├── module_snapshot_ios_intermediate_dump.h │ ├── process_snapshot_ios_intermediate_dump.cc │ ├── process_snapshot_ios_intermediate_dump.h │ ├── process_snapshot_ios_intermediate_dump_test.cc │ ├── system_snapshot_ios_intermediate_dump.cc │ ├── system_snapshot_ios_intermediate_dump.h │ ├── testdata │ │ ├── crash-1fa088dda0adb41459d063078a0f384a0bb8eefa │ │ ├── crash-5726011582644224 │ │ ├── crash-6605504629637120 │ │ └── crash-c44acfcbccd8c7a8 │ ├── thread_snapshot_ios_intermediate_dump.cc │ └── thread_snapshot_ios_intermediate_dump.h ├── linux │ ├── capture_memory_delegate_linux.cc │ ├── capture_memory_delegate_linux.h │ ├── cpu_context_linux.cc │ ├── cpu_context_linux.h │ ├── debug_rendezvous.cc │ ├── debug_rendezvous.h │ ├── debug_rendezvous_test.cc │ ├── exception_snapshot_linux.cc │ ├── exception_snapshot_linux.h │ ├── exception_snapshot_linux_test.cc │ ├── process_reader_linux.cc │ ├── process_reader_linux.h │ ├── process_reader_linux_test.cc │ ├── process_snapshot_linux.cc │ ├── process_snapshot_linux.h │ ├── signal_context.h │ ├── system_snapshot_linux.cc │ ├── system_snapshot_linux.h │ ├── system_snapshot_linux_test.cc │ ├── test_modules.cc │ ├── test_modules.h │ ├── thread_snapshot_linux.cc │ └── thread_snapshot_linux.h ├── mac │ ├── cpu_context_mac.cc │ ├── cpu_context_mac.h │ ├── cpu_context_mac_test.cc │ ├── exception_snapshot_mac.cc │ ├── exception_snapshot_mac.h │ ├── mach_o_image_annotations_reader.cc │ ├── mach_o_image_annotations_reader.h │ ├── mach_o_image_annotations_reader_test.cc │ ├── mach_o_image_annotations_reader_test_module_crashy_initializer.cc │ ├── mach_o_image_annotations_reader_test_no_op.cc │ ├── mach_o_image_reader.cc │ ├── mach_o_image_reader.h │ ├── mach_o_image_reader_test.cc │ ├── mach_o_image_segment_reader.cc │ ├── mach_o_image_segment_reader.h │ ├── mach_o_image_segment_reader_test.cc │ ├── mach_o_image_symbol_table_reader.cc │ ├── mach_o_image_symbol_table_reader.h │ ├── module_snapshot_mac.cc │ ├── module_snapshot_mac.h │ ├── process_reader_mac.cc │ ├── process_reader_mac.h │ ├── process_reader_mac_test.cc │ ├── process_snapshot_mac.cc │ ├── process_snapshot_mac.h │ ├── process_types.cc │ ├── process_types.h │ ├── process_types │ │ ├── all.proctype │ │ ├── annotation.proctype │ │ ├── crashpad_info.proctype │ │ ├── crashreporterclient.proctype │ │ ├── custom.cc │ │ ├── dyld_images.proctype │ │ ├── flavors.h │ │ ├── internal.h │ │ ├── loader.proctype │ │ ├── nlist.proctype │ │ └── traits.h │ ├── process_types_test.cc │ ├── system_snapshot_mac.cc │ ├── system_snapshot_mac.h │ ├── system_snapshot_mac_test.cc │ ├── thread_snapshot_mac.cc │ └── thread_snapshot_mac.h ├── memory_map_region_snapshot.h ├── memory_snapshot.cc ├── memory_snapshot.h ├── memory_snapshot_generic.h ├── memory_snapshot_test.cc ├── minidump │ ├── exception_snapshot_minidump.cc │ ├── exception_snapshot_minidump.h │ ├── memory_snapshot_minidump.cc │ ├── memory_snapshot_minidump.h │ ├── minidump_annotation_reader.cc │ ├── minidump_annotation_reader.h │ ├── minidump_context_converter.cc │ ├── minidump_context_converter.h │ ├── minidump_simple_string_dictionary_reader.cc │ ├── minidump_simple_string_dictionary_reader.h │ ├── minidump_stream.h │ ├── minidump_string_list_reader.cc │ ├── minidump_string_list_reader.h │ ├── minidump_string_reader.cc │ ├── minidump_string_reader.h │ ├── module_snapshot_minidump.cc │ ├── module_snapshot_minidump.h │ ├── process_snapshot_minidump.cc │ ├── process_snapshot_minidump.h │ ├── process_snapshot_minidump_test.cc │ ├── system_snapshot_minidump.cc │ ├── system_snapshot_minidump.h │ ├── thread_snapshot_minidump.cc │ └── thread_snapshot_minidump.h ├── module_snapshot.h ├── posix │ ├── timezone.cc │ ├── timezone.h │ └── timezone_test.cc ├── process_snapshot.h ├── sanitized │ ├── memory_snapshot_sanitized.cc │ ├── memory_snapshot_sanitized.h │ ├── module_snapshot_sanitized.cc │ ├── module_snapshot_sanitized.h │ ├── process_snapshot_sanitized.cc │ ├── process_snapshot_sanitized.h │ ├── process_snapshot_sanitized_test.cc │ ├── sanitization_information.cc │ ├── sanitization_information.h │ ├── sanitization_information_test.cc │ ├── thread_snapshot_sanitized.cc │ └── thread_snapshot_sanitized.h ├── snapshot_constants.h ├── system_snapshot.h ├── test │ ├── test_cpu_context.cc │ ├── test_cpu_context.h │ ├── test_exception_snapshot.cc │ ├── test_exception_snapshot.h │ ├── test_memory_map_region_snapshot.cc │ ├── test_memory_map_region_snapshot.h │ ├── test_memory_snapshot.cc │ ├── test_memory_snapshot.h │ ├── test_module_snapshot.cc │ ├── test_module_snapshot.h │ ├── test_process_snapshot.cc │ ├── test_process_snapshot.h │ ├── test_system_snapshot.cc │ ├── test_system_snapshot.h │ ├── test_thread_snapshot.cc │ └── test_thread_snapshot.h ├── thread_snapshot.h ├── unloaded_module_snapshot.cc ├── unloaded_module_snapshot.h ├── win │ ├── capture_memory_delegate_win.cc │ ├── capture_memory_delegate_win.h │ ├── cpu_context_win.cc │ ├── cpu_context_win.h │ ├── cpu_context_win_test.cc │ ├── crashpad_snapshot_test_annotations.cc │ ├── crashpad_snapshot_test_crashing_child.cc │ ├── crashpad_snapshot_test_dump_without_crashing.cc │ ├── crashpad_snapshot_test_extra_memory_ranges.cc │ ├── crashpad_snapshot_test_image_reader.cc │ ├── crashpad_snapshot_test_image_reader_module.cc │ ├── end_to_end_test.py │ ├── exception_snapshot_win.cc │ ├── exception_snapshot_win.h │ ├── exception_snapshot_win_test.cc │ ├── extra_memory_ranges_test.cc │ ├── memory_map_region_snapshot_win.cc │ ├── memory_map_region_snapshot_win.h │ ├── module_snapshot_win.cc │ ├── module_snapshot_win.h │ ├── module_snapshot_win_test.cc │ ├── pe_image_annotations_reader.cc │ ├── pe_image_annotations_reader.h │ ├── pe_image_reader.cc │ ├── pe_image_reader.h │ ├── pe_image_reader_test.cc │ ├── pe_image_resource_reader.cc │ ├── pe_image_resource_reader.h │ ├── process_reader_win.cc │ ├── process_reader_win.h │ ├── process_reader_win_test.cc │ ├── process_snapshot_win.cc │ ├── process_snapshot_win.h │ ├── process_snapshot_win_test.cc │ ├── process_subrange_reader.cc │ ├── process_subrange_reader.h │ ├── system_snapshot_win.cc │ ├── system_snapshot_win.h │ ├── system_snapshot_win_test.cc │ ├── thread_snapshot_win.cc │ └── thread_snapshot_win.h └── x86 │ ├── cpuid_reader.cc │ └── cpuid_reader.h ├── test ├── BUILD.gn ├── errors.cc ├── errors.h ├── file.cc ├── file.h ├── filesystem.cc ├── filesystem.h ├── fuchsia_crashpad_tests.cml ├── gtest_death.h ├── gtest_main.cc ├── hex_string.cc ├── hex_string.h ├── hex_string_test.cc ├── ios │ ├── BUILD.gn │ ├── cptest_google_test_runner.mm │ ├── cptest_google_test_runner_delegate.h │ ├── crash_type_xctest.mm │ ├── google_test_setup.h │ ├── google_test_setup.mm │ └── host │ │ ├── BUILD.gn │ │ ├── Info.plist │ │ ├── cptest_application_delegate.h │ │ ├── cptest_application_delegate.mm │ │ ├── cptest_crash_view_controller.h │ │ ├── cptest_crash_view_controller.mm │ │ ├── cptest_shared_object.h │ │ ├── handler_forbidden_allocators.cc │ │ ├── handler_forbidden_allocators.h │ │ └── main.mm ├── linux │ ├── fake_ptrace_connection.cc │ ├── fake_ptrace_connection.h │ ├── get_tls.cc │ └── get_tls.h ├── mac │ ├── dyld.cc │ ├── dyld.h │ ├── exception_swallower.cc │ ├── exception_swallower.h │ ├── mach_errors.cc │ ├── mach_errors.h │ ├── mach_multiprocess.cc │ ├── mach_multiprocess.h │ └── mach_multiprocess_test.cc ├── main_arguments.cc ├── main_arguments.h ├── main_arguments_test.cc ├── multiprocess.h ├── multiprocess_exec.cc ├── multiprocess_exec.h ├── multiprocess_exec_fuchsia.cc ├── multiprocess_exec_posix.cc ├── multiprocess_exec_test.cc ├── multiprocess_exec_test_child.cc ├── multiprocess_exec_win.cc ├── multiprocess_posix.cc ├── multiprocess_posix_test.cc ├── process_type.cc ├── process_type.h ├── scoped_guarded_page.h ├── scoped_guarded_page_posix.cc ├── scoped_guarded_page_test.cc ├── scoped_guarded_page_win.cc ├── scoped_module_handle.cc ├── scoped_module_handle.h ├── scoped_set_thread_name.h ├── scoped_set_thread_name_fuchsia.cc ├── scoped_set_thread_name_posix.cc ├── scoped_set_thread_name_win.cc ├── scoped_temp_dir.cc ├── scoped_temp_dir.h ├── scoped_temp_dir_posix.cc ├── scoped_temp_dir_test.cc ├── scoped_temp_dir_win.cc ├── test_paths.cc ├── test_paths.h ├── test_paths_test.cc ├── test_paths_test_data_root.txt └── win │ ├── child_launcher.cc │ ├── child_launcher.h │ ├── win_child_process.cc │ ├── win_child_process.h │ ├── win_child_process_test.cc │ ├── win_multiprocess.cc │ ├── win_multiprocess.h │ ├── win_multiprocess_test.cc │ ├── win_multiprocess_with_temp_dir.cc │ └── win_multiprocess_with_temp_dir.h ├── third_party ├── cpp-httplib │ ├── BUILD.gn │ ├── README.crashpad │ └── cpp-httplib │ │ ├── LICENSE │ │ ├── README.md │ │ └── httplib.h ├── edo │ ├── BUILD.gn │ └── README.crashpad ├── fuchsia │ ├── BUILD.gn │ ├── README.crashpad │ └── runner.py ├── getopt │ ├── BUILD.gn │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.crashpad │ ├── getopt.cc │ └── getopt.h ├── googletest │ ├── BUILD.gn │ └── README.crashpad ├── libfuzzer │ └── BUILD.gn ├── linux │ └── README.crashpad ├── lss │ ├── BUILD.gn │ ├── README.crashpad │ └── lss.h ├── mini_chromium │ ├── BUILD.gn │ ├── CMakeLists.txt │ └── README.crashpad ├── ninja │ ├── README.crashpad │ └── ninja ├── xnu │ ├── APPLE_LICENSE │ ├── BUILD.gn │ ├── EXTERNAL_HEADERS │ │ └── mach-o │ │ │ └── loader.h │ ├── README.crashpad │ └── osfmk │ │ └── mach │ │ ├── exc.defs │ │ ├── mach_exc.defs │ │ ├── mach_types.defs │ │ ├── machine │ │ └── machine_types.defs │ │ └── std_types.defs └── zlib │ ├── BUILD.gn │ ├── CMakeLists.txt │ ├── README.crashpad │ └── zlib_crashpad.h ├── tools ├── BUILD.gn ├── CMakeLists.txt ├── base94_encoder.cc ├── base94_encoder.md ├── crashpad_database_util.cc ├── crashpad_database_util.md ├── crashpad_http_upload.cc ├── crashpad_http_upload.md ├── dump_minidump_annotations.cc ├── generate_dump.cc ├── generate_dump.md ├── mac │ ├── catch_exception_tool.cc │ ├── catch_exception_tool.md │ ├── exception_port_tool.cc │ ├── exception_port_tool.md │ ├── on_demand_service_tool.md │ ├── on_demand_service_tool.mm │ └── sectaskaccess_info.plist ├── run_with_crashpad.cc ├── run_with_crashpad.md ├── tool_support.cc └── tool_support.h └── util ├── BUILD.gn ├── CMakeLists.txt ├── backtrace ├── android_cert_store.cc ├── android_cert_store.h ├── certs.pem ├── certs_pem.h ├── crash_loop_detection.cc └── crash_loop_detection.h ├── file ├── delimited_file_reader.cc ├── delimited_file_reader.h ├── delimited_file_reader_test.cc ├── directory_reader.h ├── directory_reader_posix.cc ├── directory_reader_test.cc ├── directory_reader_win.cc ├── file_helper.cc ├── file_helper.h ├── file_io.cc ├── file_io.h ├── file_io_posix.cc ├── file_io_test.cc ├── file_io_win.cc ├── file_reader.cc ├── file_reader.h ├── file_reader_test.cc ├── file_seeker.cc ├── file_seeker.h ├── file_writer.cc ├── file_writer.h ├── filesystem.h ├── filesystem_posix.cc ├── filesystem_test.cc ├── filesystem_win.cc ├── output_stream_file_writer.cc ├── output_stream_file_writer.h ├── scoped_remove_file.cc ├── scoped_remove_file.h ├── string_file.cc ├── string_file.h └── string_file_test.cc ├── fuchsia ├── koid_utilities.cc ├── koid_utilities.h ├── scoped_task_suspend.cc ├── scoped_task_suspend.h └── traits.h ├── ios ├── ios_intermediate_dump_data.cc ├── ios_intermediate_dump_data.h ├── ios_intermediate_dump_format.h ├── ios_intermediate_dump_interface.cc ├── ios_intermediate_dump_interface.h ├── ios_intermediate_dump_list.cc ├── ios_intermediate_dump_list.h ├── ios_intermediate_dump_map.cc ├── ios_intermediate_dump_map.h ├── ios_intermediate_dump_object.cc ├── ios_intermediate_dump_object.h ├── ios_intermediate_dump_reader.cc ├── ios_intermediate_dump_reader.h ├── ios_intermediate_dump_reader_test.cc ├── ios_intermediate_dump_writer.cc ├── ios_intermediate_dump_writer.h ├── ios_intermediate_dump_writer_test.cc ├── ios_system_data_collector.h ├── ios_system_data_collector.mm ├── raw_logging.cc ├── raw_logging.h ├── scoped_background_task.h ├── scoped_background_task.mm ├── scoped_vm_map.cc ├── scoped_vm_map.h ├── scoped_vm_map_test.cc ├── scoped_vm_read.cc ├── scoped_vm_read.h └── scoped_vm_read_test.cc ├── linux ├── address_types.h ├── auxiliary_vector.cc ├── auxiliary_vector.h ├── auxiliary_vector_test.cc ├── checked_linux_address_range.h ├── direct_ptrace_connection.cc ├── direct_ptrace_connection.h ├── exception_handler_client.cc ├── exception_handler_client.h ├── exception_handler_protocol.cc ├── exception_handler_protocol.h ├── exception_information.h ├── initial_signal_dispositions.cc ├── initial_signal_dispositions.h ├── memory_map.cc ├── memory_map.h ├── memory_map_test.cc ├── pac_helper.cc ├── pac_helper.h ├── proc_stat_reader.cc ├── proc_stat_reader.h ├── proc_stat_reader_test.cc ├── proc_task_reader.cc ├── proc_task_reader.h ├── proc_task_reader_test.cc ├── ptrace_broker.cc ├── ptrace_broker.h ├── ptrace_broker_test.cc ├── ptrace_client.cc ├── ptrace_client.h ├── ptrace_connection.h ├── ptracer.cc ├── ptracer.h ├── ptracer_test.cc ├── scoped_pr_set_dumpable.cc ├── scoped_pr_set_dumpable.h ├── scoped_pr_set_ptracer.cc ├── scoped_pr_set_ptracer.h ├── scoped_ptrace_attach.cc ├── scoped_ptrace_attach.h ├── scoped_ptrace_attach_test.cc ├── socket.cc ├── socket.h ├── socket_test.cc ├── thread_info.cc ├── thread_info.h └── traits.h ├── mac ├── checked_mach_address_range.h ├── checked_mach_address_range_test.cc ├── launchd.h ├── launchd.mm ├── launchd_test.mm ├── mac_util.cc ├── mac_util.h ├── mac_util_test.mm ├── service_management.cc ├── service_management.h ├── service_management_test.mm ├── sysctl.cc ├── sysctl.h ├── sysctl_test.cc ├── xattr.cc ├── xattr.h └── xattr_test.cc ├── mach ├── bootstrap.cc ├── bootstrap.h ├── bootstrap_test.cc ├── child_port.defs ├── child_port_handshake.cc ├── child_port_handshake.h ├── child_port_handshake_test.cc ├── child_port_server.cc ├── child_port_server.h ├── child_port_server_test.cc ├── child_port_types.h ├── composite_mach_message_server.cc ├── composite_mach_message_server.h ├── composite_mach_message_server_test.cc ├── exc_client_variants.cc ├── exc_client_variants.h ├── exc_client_variants_test.cc ├── exc_server_variants.cc ├── exc_server_variants.h ├── exc_server_variants_test.cc ├── exception_behaviors.cc ├── exception_behaviors.h ├── exception_behaviors_test.cc ├── exception_ports.cc ├── exception_ports.h ├── exception_ports_test.cc ├── exception_types.cc ├── exception_types.h ├── exception_types_test.cc ├── mach_extensions.cc ├── mach_extensions.h ├── mach_extensions_test.cc ├── mach_message.cc ├── mach_message.h ├── mach_message_server.cc ├── mach_message_server.h ├── mach_message_server_test.cc ├── mach_message_test.cc ├── mig.py ├── mig_fix.py ├── mig_gen.py ├── notify_server.cc ├── notify_server.h ├── notify_server_test.cc ├── scoped_task_suspend.cc ├── scoped_task_suspend.h ├── scoped_task_suspend_test.cc ├── symbolic_constants_mach.cc ├── symbolic_constants_mach.h ├── symbolic_constants_mach_test.cc ├── task_for_pid.cc └── task_for_pid.h ├── misc ├── address_sanitizer.h ├── address_types.h ├── arm64_pac_bti.S ├── arraysize.h ├── arraysize_test.cc ├── as_underlying_type.h ├── capture_context.h ├── capture_context_linux.S ├── capture_context_mac.S ├── capture_context_test.cc ├── capture_context_test_util.h ├── capture_context_test_util_linux.cc ├── capture_context_test_util_mac.cc ├── capture_context_test_util_win.cc ├── capture_context_win.asm ├── capture_context_win_arm64.asm ├── capture_context_win_arm64.obj ├── clock.h ├── clock_mac.cc ├── clock_posix.cc ├── clock_test.cc ├── clock_win.cc ├── elf_note_types.h ├── from_pointer_cast.h ├── from_pointer_cast_test.cc ├── implicit_cast.h ├── initialization_state.h ├── initialization_state_dcheck.cc ├── initialization_state_dcheck.h ├── initialization_state_dcheck_test.cc ├── initialization_state_test.cc ├── lexing.cc ├── lexing.h ├── memory_sanitizer.h ├── metrics.cc ├── metrics.h ├── no_cfi_icall.h ├── no_cfi_icall_test.cc ├── paths.h ├── paths_fuchsia.cc ├── paths_linux.cc ├── paths_mac.cc ├── paths_test.cc ├── paths_win.cc ├── pdb_structures.cc ├── pdb_structures.h ├── random_string.cc ├── random_string.h ├── random_string_test.cc ├── range_set.cc ├── range_set.h ├── range_set_test.cc ├── reinterpret_bytes.cc ├── reinterpret_bytes.h ├── reinterpret_bytes_test.cc ├── scoped_forbid_return.cc ├── scoped_forbid_return.h ├── scoped_forbid_return_test.cc ├── symbolic_constants_common.h ├── time.cc ├── time.h ├── time_linux.cc ├── time_test.cc ├── time_win.cc ├── tri_state.h ├── uuid.cc ├── uuid.h ├── uuid_test.cc ├── zlib.cc └── zlib.h ├── net ├── generate_test_server_key.py ├── http_body.cc ├── http_body.h ├── http_body_gzip.cc ├── http_body_gzip.h ├── http_body_gzip_test.cc ├── http_body_test.cc ├── http_body_test_util.cc ├── http_body_test_util.h ├── http_headers.h ├── http_multipart_builder.cc ├── http_multipart_builder.h ├── http_multipart_builder_test.cc ├── http_transport.cc ├── http_transport.h ├── http_transport_libcurl.cc ├── http_transport_mac.mm ├── http_transport_socket.cc ├── http_transport_test.cc ├── http_transport_test_server.cc ├── http_transport_win.cc ├── testdata │ ├── ascii_http_body.txt │ ├── binary_http_body.dat │ ├── crashpad_util_test_cert.pem │ └── crashpad_util_test_key.pem ├── tls.gni ├── url.cc ├── url.h └── url_test.cc ├── numeric ├── checked_address_range.cc ├── checked_address_range.h ├── checked_address_range_test.cc ├── checked_range.h ├── checked_range_test.cc ├── checked_vm_address_range.h ├── in_range_cast.h ├── in_range_cast_test.cc ├── int128.h ├── int128_test.cc └── safe_assignment.h ├── posix ├── close_multiple.cc ├── close_multiple.h ├── close_stdio.cc ├── close_stdio.h ├── drop_privileges.cc ├── drop_privileges.h ├── process_info.h ├── process_info_linux.cc ├── process_info_mac.cc ├── process_info_test.cc ├── scoped_dir.cc ├── scoped_dir.h ├── scoped_mmap.cc ├── scoped_mmap.h ├── scoped_mmap_test.cc ├── signals.cc ├── signals.h ├── signals_test.cc ├── spawn_subprocess.cc ├── spawn_subprocess.h ├── symbolic_constants_posix.cc ├── symbolic_constants_posix.h └── symbolic_constants_posix_test.cc ├── process ├── process_id.h ├── process_memory.cc ├── process_memory.h ├── process_memory_fuchsia.cc ├── process_memory_fuchsia.h ├── process_memory_linux.cc ├── process_memory_linux.h ├── process_memory_mac.cc ├── process_memory_mac.h ├── process_memory_mac_test.cc ├── process_memory_native.h ├── process_memory_range.cc ├── process_memory_range.h ├── process_memory_range_test.cc ├── process_memory_sanitized.cc ├── process_memory_sanitized.h ├── process_memory_sanitized_test.cc ├── process_memory_test.cc ├── process_memory_win.cc └── process_memory_win.h ├── stdlib ├── aligned_allocator.cc ├── aligned_allocator.h ├── aligned_allocator_test.cc ├── map_insert.h ├── map_insert_test.cc ├── objc.h ├── string_number_conversion.cc ├── string_number_conversion.h ├── string_number_conversion_test.cc ├── strlcpy.cc ├── strlcpy.h ├── strlcpy_test.cc ├── strnlen.cc ├── strnlen.h ├── strnlen_test.cc ├── thread_safe_vector.h └── thread_safe_vector_test.cc ├── stream ├── base94_output_stream.cc ├── base94_output_stream.h ├── base94_output_stream_test.cc ├── file_encoder.cc ├── file_encoder.h ├── file_encoder_test.cc ├── file_output_stream.cc ├── file_output_stream.h ├── log_output_stream.cc ├── log_output_stream.h ├── log_output_stream_test.cc ├── output_stream_interface.h ├── test_output_stream.cc ├── test_output_stream.h ├── zlib_output_stream.cc ├── zlib_output_stream.h └── zlib_output_stream_test.cc ├── string ├── split_string.cc ├── split_string.h └── split_string_test.cc ├── synchronization ├── scoped_spin_guard.h ├── scoped_spin_guard_test.cc ├── semaphore.h ├── semaphore_mac.cc ├── semaphore_posix.cc ├── semaphore_test.cc └── semaphore_win.cc ├── thread ├── stoppable.h ├── thread.cc ├── thread.h ├── thread_log_messages.cc ├── thread_log_messages.h ├── thread_log_messages_test.cc ├── thread_posix.cc ├── thread_test.cc ├── thread_win.cc ├── worker_thread.cc ├── worker_thread.h └── worker_thread_test.cc └── win ├── address_types.h ├── checked_win_address_range.h ├── command_line.cc ├── command_line.h ├── command_line_test.cc ├── context_wrappers.h ├── critical_section_with_debug_info.cc ├── critical_section_with_debug_info.h ├── critical_section_with_debug_info_test.cc ├── exception_codes.h ├── exception_handler_server.cc ├── exception_handler_server.h ├── exception_handler_server_test.cc ├── get_function.cc ├── get_function.h ├── get_function_test.cc ├── get_module_information.cc ├── get_module_information.h ├── handle.cc ├── handle.h ├── handle_test.cc ├── initial_client_data.cc ├── initial_client_data.h ├── initial_client_data_test.cc ├── loader_lock.cc ├── loader_lock.h ├── loader_lock_test.cc ├── loader_lock_test_dll.cc ├── module_version.cc ├── module_version.h ├── nt_internals.cc ├── nt_internals.h ├── ntstatus_logging.cc ├── ntstatus_logging.h ├── process_info.cc ├── process_info.h ├── process_info_test.cc ├── process_info_test_child.cc ├── process_structs.h ├── registration_protocol_win.cc ├── registration_protocol_win.h ├── registration_protocol_win_structs.h ├── registration_protocol_win_test.cc ├── safe_terminate_process.asm ├── safe_terminate_process.h ├── safe_terminate_process_test.cc ├── safe_terminate_process_test_child.cc ├── scoped_handle.cc ├── scoped_handle.h ├── scoped_local_alloc.cc ├── scoped_local_alloc.h ├── scoped_process_suspend.cc ├── scoped_process_suspend.h ├── scoped_process_suspend_test.cc ├── scoped_registry_key.h ├── scoped_set_event.cc ├── scoped_set_event.h ├── session_end_watcher.cc ├── session_end_watcher.h ├── session_end_watcher_test.cc ├── termination_codes.h ├── traits.h └── xp_compat.h /.clang-format: -------------------------------------------------------------------------------- 1 | # Copyright 2014 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | { 16 | BasedOnStyle: Chromium, 17 | AlignTrailingComments: false, 18 | BinPackArguments: false, 19 | } 20 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/mini_chromium/mini_chromium"] 2 | path = third_party/mini_chromium/mini_chromium 3 | url = https://chromium.googlesource.com/chromium/mini_chromium 4 | [submodule "third_party/zlib/zlib"] 5 | path = third_party/zlib/zlib 6 | url = https://chromium.googlesource.com/chromium/src/third_party/zlib 7 | [submodule "third_party/linux-syscall-support"] 8 | path = third_party/linux-syscall-support 9 | url = https://chromium.googlesource.com/linux-syscall-support.git 10 | [submodule "third_party/lss/lss"] 11 | path = third_party/lss/lss 12 | url = https://chromium.googlesource.com/linux-syscall-support.git 13 | [submodule "third_party/openssl-android-binary"] 14 | path = third_party/openssl-android-binary 15 | url = https://github.com/backtrace-labs/openssl-android-binary.git 16 | -------------------------------------------------------------------------------- /.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | buildconfig = "//build/BUILDCONFIG.gn" 16 | script_executable = "python3" 17 | -------------------------------------------------------------------------------- /.style.yapf: -------------------------------------------------------------------------------- 1 | # Copyright 2020 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [style] 16 | based_on_style = google 17 | -------------------------------------------------------------------------------- /.vpython3: -------------------------------------------------------------------------------- 1 | # Copyright 2022 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This is a vpython "spec" file. 16 | # 17 | # It describes patterns for python wheel dependencies of the python scripts. 18 | # 19 | # Read more about `vpython` and how to modify this file here: 20 | # https://chromium.googlesource.com/infra/infra/+/master/doc/users/vpython.md 21 | 22 | # This is needed for snapshot/win/end_to_end_test.py. 23 | wheel: < 24 | name: "infra/python/wheels/pywin32/${vpython_platform}" 25 | version: "version:300" 26 | match_tag: < 27 | platform: "win32" 28 | > 29 | match_tag: < 30 | platform: "win_amd64" 31 | > 32 | > 33 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Crashpad authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as: 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | Google Inc. 10 | Intel Corporation 11 | Opera Software ASA 12 | Vewd Software AS 13 | LG Electronics, Inc. 14 | MIPS Technologies, Inc. 15 | Darshan Sen 16 | Ho Cheung 17 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # People who have agreed to one of the CLAs and can contribute patches. 2 | # The AUTHORS file lists the copyright holders; this file 3 | # lists people. For example, Google employees are listed here 4 | # but not in AUTHORS, because Google holds the copyright. 5 | # 6 | # https://developers.google.com/open-source/cla/individual 7 | # https://developers.google.com/open-source/cla/corporate 8 | # 9 | # Names should be added to this file as: 10 | # Name 11 | 12 | Mark Mentovai 13 | Robert Sesek 14 | Scott Graham 15 | Joshua Peraza 16 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | # Copyright 2025 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | jperaza@chromium.org 16 | justincohen@chromium.org 17 | lgrey@chromium.org 18 | mark@chromium.org 19 | pbos@chromium.org 20 | wfh@chromium.org 21 | -------------------------------------------------------------------------------- /backtrace/test/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'httpclient' 4 | gem 'minitest' 5 | gem 'os' 6 | gem 'webrick' 7 | -------------------------------------------------------------------------------- /backtrace/test/test.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require 'minitest/autorun' 4 | require 'os' 5 | 6 | require_relative 'test_linux' if OS.linux? 7 | require_relative 'test_macos' if OS.mac? 8 | require_relative 'test_windows' if OS.windows? 9 | -------------------------------------------------------------------------------- /backtrace/test/test_linux.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require_relative 'crashpad_utils' 4 | 5 | class TestLinux < Minitest::Test 6 | def test_crashpad_uploads 7 | result = Crashpad::perform_test executable: 'examples/linux/demo/demo_linux' 8 | assert result 9 | assert result.has_key? :upload 10 | 11 | payload = result[:upload].params 12 | 13 | assert_equal payload.keys.sort, %w(format guid upload_file_minidump) 14 | 15 | assert_equal payload['format'], 'minidump' 16 | end 17 | 18 | def test_crash_loop_detection 19 | exe = 'examples/linux/crash_loop_detection/crash_loop_detection_linux' 20 | ce = Crashpad::Execution.new executable: exe 21 | 22 | Dir.mktmpdir do |dir| 23 | 10.times do |n| 24 | out = ce.execute tmp_dir: dir 25 | assert_match /Last Runs crashed: #{n}/, out[:stdout] 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /backtrace/test/test_macos.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require_relative 'crashpad_utils' 4 | 5 | class TestMacOS < Minitest::Test 6 | def test_crashpad_uploads 7 | result = Crashpad::perform_test executable: 'examples/macos/demo/demo_macos' 8 | assert result 9 | assert result.has_key? :upload 10 | 11 | payload = result[:upload].params 12 | 13 | assert_equal payload.keys.sort, %w(format guid upload_file_minidump) 14 | 15 | assert_equal payload['format'], 'minidump' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /backtrace/test/test_windows.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require_relative 'crashpad_utils' 4 | 5 | class TestWindows < Minitest::Test 6 | def test_crashpad_uploads 7 | exe = if File.exist?("#{__dir__}/../../cbuild/examples/windows/demo/Debug/demo_windows.exe") 8 | 'examples/windows/demo/Debug/demo_windows.exe' 9 | else 10 | 'examples/windows/demo/demo_windows.exe' 11 | end 12 | 13 | result = Crashpad::perform_test executable: exe 14 | assert result 15 | assert result.has_key? :upload 16 | 17 | payload = result[:upload].params 18 | 19 | assert_equal payload.keys.sort, %w(format guid upload_file_minidump) 20 | 21 | assert_equal payload['format'], 'minidump' 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /build/ios/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/build/ios/Default.png -------------------------------------------------------------------------------- /build/ios/Unittest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | ${IOS_BUNDLE_ID_PREFIX}.${GTEST_BUNDLE_ID_SUFFIX:rfc1034identifier} 7 | UIApplicationDelegate 8 | CrashpadUnitTestDelegate 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/ios/setup_ios_gn.config: -------------------------------------------------------------------------------- 1 | # Copyright 2020 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [xcode] 16 | # Controls settings for the generated Xcode project. If jobs is non-zero 17 | # it will be passed to the ninja invocation in Xcode project. 18 | jobs = 0 19 | 20 | [build] 21 | # Controls the build output. The only supported values are "64-bit", "32-bit" 22 | # and "fat" (for a fat binary supporting both "32-bit" and "64-bit" cpus). 23 | arch = "64-bit" 24 | 25 | [gn_args] 26 | # Values in that section will be copied verbatim in the generated args.gn file. 27 | target_os = "ios" 28 | 29 | [filters] 30 | # List of target files to pass to --filters argument of gn gen when generating 31 | # the Xcode project. By default, list all targets from ios/ and ios_internal/ 32 | # and the targets corresponding to the unit tests run on the bots. 33 | -------------------------------------------------------------------------------- /client/simulate_crash.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_CLIENT_SIMULATE_CRASH_H_ 16 | #define CRASHPAD_CLIENT_SIMULATE_CRASH_H_ 17 | 18 | #include "build/build_config.h" 19 | 20 | #if BUILDFLAG(IS_MAC) 21 | #include "client/simulate_crash_mac.h" 22 | #elif BUILDFLAG(IS_IOS) 23 | #include "client/simulate_crash_ios.h" 24 | #elif BUILDFLAG(IS_WIN) 25 | #include "client/simulate_crash_win.h" 26 | #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) 27 | #include "client/simulate_crash_linux.h" 28 | #endif 29 | 30 | #endif // CRASHPAD_CLIENT_SIMULATE_CRASH_H_ 31 | -------------------------------------------------------------------------------- /client/upload_behavior_ios.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_CLIENT_UPLOAD_BEHAVIOR_IOS_H_ 16 | #define CRASHPAD_CLIENT_UPLOAD_BEHAVIOR_IOS_H_ 17 | 18 | namespace crashpad { 19 | 20 | //! \brief Enum to control upload behavior when processing pending reports. 21 | enum class UploadBehavior { 22 | //! \brief Only upload reports while the application is active (e.g., in the 23 | //! foreground). 24 | kUploadWhenAppIsActive = 1, 25 | 26 | //! \brief Upload reports immediately, regardless of whether or not the 27 | //! application is active. 28 | kUploadImmediately = 2, 29 | }; 30 | 31 | } // namespace crashpad 32 | 33 | #endif // CRASHPAD_CLIENT_UPLOAD_BEHAVIOR_IOS_H_ 34 | -------------------------------------------------------------------------------- /codereview.settings: -------------------------------------------------------------------------------- 1 | # Copyright 2014 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | GERRIT_HOST: True 16 | CODE_REVIEW_SERVER: https://chromium-review.googlesource.com/ 17 | VIEW_VC: https://chromium.googlesource.com/crashpad/crashpad/+/ 18 | PROJECT: crashpad 19 | -------------------------------------------------------------------------------- /compat/android/linux/elf.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_ANDROID_LINUX_ELF_H_ 16 | #define CRASHPAD_COMPAT_ANDROID_LINUX_ELF_H_ 17 | 18 | #include_next 19 | 20 | // Android 5.0.0 (API 21) NDK 21 | 22 | #if defined(__i386__) || defined(__x86_64__) 23 | #if !defined(NT_386_TLS) 24 | #define NT_386_TLS 0x200 25 | #endif 26 | #endif // __i386__ || __x86_64__ 27 | 28 | #if defined(__ARMEL__) || defined(__aarch64__) 29 | #if !defined(NT_ARM_VFP) 30 | #define NT_ARM_VFP 0x400 31 | #endif 32 | 33 | #if !defined(NT_ARM_TLS) 34 | #define NT_ARM_TLS 0x401 35 | #endif 36 | #endif // __ARMEL__ || __aarch64__ 37 | 38 | #endif // CRASHPAD_COMPAT_ANDROID_LINUX_ELF_H_ 39 | -------------------------------------------------------------------------------- /compat/android/linux/prctl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_ANDROID_LINUX_PRCTL_H_ 16 | #define CRASHPAD_COMPAT_ANDROID_LINUX_PRCTL_H_ 17 | 18 | #include_next 19 | 20 | // Android 5.0.0 (API 21) NDK 21 | #if !defined(PR_SET_PTRACER) 22 | #define PR_SET_PTRACER 0x59616d61 23 | #endif 24 | 25 | #endif // CRASHPAD_COMPAT_ANDROID_LINUX_PRCTL_H_ 26 | -------------------------------------------------------------------------------- /compat/android/linux/ptrace.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_ANDROID_LINUX_PTRACE_H_ 16 | #define CRASHPAD_COMPAT_ANDROID_LINUX_PTRACE_H_ 17 | 18 | #include_next 19 | 20 | // Android 5.0.0 (API 21) NDK 21 | #if !defined(PTRACE_GETREGSET) 22 | #define PTRACE_GETREGSET 0x4204 23 | #endif 24 | 25 | #endif // CRASHPAD_COMPAT_ANDROID_LINUX_PTRACE_H_ 26 | -------------------------------------------------------------------------------- /compat/android/sched.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_ANDROID_SCHED_H_ 16 | #define CRASHPAD_COMPAT_ANDROID_SCHED_H_ 17 | 18 | #include_next 19 | 20 | // Android 5.0.0 (API 21) NDK 21 | 22 | #if !defined(SCHED_BATCH) 23 | #define SCHED_BATCH 3 24 | #endif 25 | 26 | #if !defined(SCHED_IDLE) 27 | #define SCHED_IDLE 5 28 | #endif 29 | 30 | #endif // CRASHPAD_COMPAT_ANDROID_SCHED_H_ 31 | -------------------------------------------------------------------------------- /compat/android/sys/epoll.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include "dlfcn_internal.h" 22 | #include "util/misc/no_cfi_icall.h" 23 | 24 | #if __ANDROID_API__ < 21 25 | 26 | extern "C" { 27 | 28 | int epoll_create1(int flags) { 29 | static const crashpad::NoCfiIcall epoll_create1_p( 30 | crashpad::internal::Dlsym(RTLD_DEFAULT, "epoll_create1")); 31 | return epoll_create1_p ? epoll_create1_p(flags) 32 | : syscall(SYS_epoll_create1, flags); 33 | } 34 | 35 | } // extern "C" 36 | 37 | #endif // __ANDROID_API__ < 21 38 | -------------------------------------------------------------------------------- /compat/android/sys/syscall.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_ANDROID_SYS_SYSCALL_H_ 16 | #define CRASHPAD_COMPAT_ANDROID_SYS_SYSCALL_H_ 17 | 18 | #include_next 19 | 20 | // Android 5.0.0 (API 21) NDK 21 | 22 | #if !defined(SYS_epoll_create1) 23 | #define SYS_epoll_create1 __NR_epoll_create1 24 | #endif 25 | 26 | #if !defined(SYS_gettid) 27 | #define SYS_gettid __NR_gettid 28 | #endif 29 | 30 | #if !defined(SYS_timer_create) 31 | #define SYS_timer_create __NR_timer_create 32 | #endif 33 | 34 | #if !defined(SYS_timer_getoverrun) 35 | #define SYS_timer_getoverrun __NR_timer_getoverrun 36 | #endif 37 | 38 | #if !defined(SYS_timer_settime) 39 | #define SYS_timer_settime __NR_timer_settime 40 | #endif 41 | 42 | #endif // CRASHPAD_COMPAT_ANDROID_SYS_SYSCALL_H_ 43 | -------------------------------------------------------------------------------- /compat/android/sys/user.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_ANDROID_SYS_USER_H_ 16 | #define CRASHPAD_COMPAT_ANDROID_SYS_USER_H_ 17 | 18 | // This is needed for traditional headers. 19 | #include 20 | 21 | #include_next 22 | 23 | #endif // CRASHPAD_COMPAT_ANDROID_SYS_USER_H_ 24 | -------------------------------------------------------------------------------- /compat/ios/mach/exc.defs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_IOS_MACH_EXC_DEFS_ 16 | #define CRASHPAD_COMPAT_IOS_MACH_EXC_DEFS_ 17 | 18 | #include "third_party/xnu/osfmk/mach/exc.defs" 19 | 20 | #endif // CRASHPAD_COMPAT_IOS_MACH_EXC_DEFS_ 21 | -------------------------------------------------------------------------------- /compat/ios/mach/mach_exc.defs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_IOS_MACH_MACH_EXC_DEFS_ 16 | #define CRASHPAD_COMPAT_IOS_MACH_MACH_EXC_DEFS_ 17 | 18 | #include "third_party/xnu/osfmk/mach/mach_exc.defs" 19 | 20 | #endif // CRASHPAD_COMPAT_IOS_MACH_MACH_EXC_DEFS_ 21 | -------------------------------------------------------------------------------- /compat/ios/mach/mach_types.defs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_IOS_MACH_MACH_TYPES_DEFS_ 16 | #define CRASHPAD_COMPAT_IOS_MACH_MACH_TYPES_DEFS_ 17 | 18 | #include "third_party/xnu/osfmk/mach/mach_types.defs" 19 | 20 | #endif // CRASHPAD_COMPAT_IOS_MACH_MACH_TYPES_DEFS_ 21 | -------------------------------------------------------------------------------- /compat/ios/mach/machine/machine_types.defs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_IOS_MACH_MACHINE_MACHINE_TYPES_DEFS_ 16 | #define CRASHPAD_COMPAT_IOS_MACH_MACHINE_MACHINE_TYPES_DEFS_ 17 | 18 | #include "third_party/xnu/osfmk/mach/machine/machine_types.defs" 19 | 20 | #endif // CRASHPAD_COMPAT_IOS_MACH_MACHINE_MACHINE_TYPES_DEFS_ 21 | -------------------------------------------------------------------------------- /compat/ios/mach/std_types.defs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_IOS_MACH_STD_TYPES_DEFS_ 16 | #define CRASHPAD_COMPAT_IOS_MACH_STD_TYPES_DEFS_ 17 | 18 | #include "third_party/xnu/osfmk/mach/std_types.defs" 19 | 20 | #endif // CRASHPAD_COMPAT_IOS_MACH_STD_TYPES_DEFS_ 21 | -------------------------------------------------------------------------------- /compat/linux/sys/mman.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_LINUX_SYS_MMAN_H_ 16 | #define CRASHPAD_COMPAT_LINUX_SYS_MMAN_H_ 17 | 18 | #include_next 19 | 20 | #include 21 | 22 | // There's no memfd_create() wrapper before glibc 2.27. 23 | // This can't select for glibc < 2.27 because linux-chromeos-rel bots build this 24 | // code using a sysroot which has glibc 2.27, but then run it on Ubuntu 16.04, 25 | // which doesn't. 26 | #if defined(__GLIBC__) 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | int memfd_create(const char* name, unsigned int flags) __THROW; 33 | 34 | #ifdef __cplusplus 35 | } // extern "C" 36 | #endif 37 | 38 | #endif // __GLIBC__ 39 | 40 | #endif // CRASHPAD_COMPAT_LINUX_SYS_MMAN_H_ 41 | -------------------------------------------------------------------------------- /compat/linux/sys/mman_memfd_create.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include "util/misc/no_cfi_icall.h" 22 | 23 | #if defined(__GLIBC__) 24 | 25 | extern "C" { 26 | 27 | int memfd_create(const char* name, unsigned int flags) __THROW { 28 | static const crashpad::NoCfiIcall next_memfd_create( 29 | dlsym(RTLD_NEXT, "memfd_create")); 30 | return next_memfd_create ? next_memfd_create(name, flags) 31 | : syscall(SYS_memfd_create, name, flags); 32 | } 33 | 34 | } // extern "C" 35 | 36 | #endif // __GLIBC__ 37 | -------------------------------------------------------------------------------- /compat/linux/sys/user.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_ 16 | #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_ 17 | 18 | #include_next 19 | 20 | #include 21 | 22 | // glibc for 64-bit ARM uses different names for these structs prior to 2.20. 23 | // However, Debian's glibc 2.19-8 backported the change so it's not sufficient 24 | // to only test the version. user_pt_regs and user_fpsimd_state are actually 25 | // defined in so we use the include guard here. 26 | #if defined(__aarch64__) && defined(__GLIBC__) 27 | #if !__GLIBC_PREREQ(2, 20) && defined(__ASM_PTRACE_H) 28 | using user_regs_struct = user_pt_regs; 29 | using user_fpsimd_struct = user_fpsimd_state; 30 | #endif 31 | #endif 32 | 33 | #endif // CRASHPAD_COMPAT_LINUX_SYS_USER_H_ 34 | -------------------------------------------------------------------------------- /compat/mac/Availability.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_MAC_AVAILABILITY_H_ 16 | #define CRASHPAD_COMPAT_MAC_AVAILABILITY_H_ 17 | 18 | // Until the 10.15 SDK, the contents of was in-line in 19 | // , but since then, it was broken out into its own header. 20 | // This compat version of allows these macros to always appear 21 | // to be provided by the new header, , even when an 22 | // older SDK is in use. 23 | 24 | #include_next 25 | 26 | #include 27 | 28 | #endif // CRASHPAD_COMPAT_MAC_AVAILABILITY_H_ 29 | -------------------------------------------------------------------------------- /compat/mac/mach-o/loader.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_MAC_MACH_O_LOADER_H_ 16 | #define CRASHPAD_COMPAT_MAC_MACH_O_LOADER_H_ 17 | 18 | #include_next 19 | 20 | // 10.7 SDK 21 | 22 | #ifndef S_THREAD_LOCAL_ZEROFILL 23 | #define S_THREAD_LOCAL_ZEROFILL 0x12 24 | #endif 25 | 26 | // 10.8 SDK 27 | 28 | #ifndef LC_SOURCE_VERSION 29 | #define LC_SOURCE_VERSION 0x2a 30 | #endif 31 | 32 | #endif // CRASHPAD_COMPAT_MAC_MACH_O_LOADER_H_ 33 | -------------------------------------------------------------------------------- /compat/mac/mach/i386/thread_state.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_MAC_MACH_I386_THREAD_STATE_H_ 16 | #define CRASHPAD_COMPAT_MAC_MACH_I386_THREAD_STATE_H_ 17 | 18 | #include_next 19 | 20 | // 10.13 SDK 21 | // 22 | // This was defined as 244 in the 10.7 through 10.12 SDKs, and 144 previously. 23 | #if I386_THREAD_STATE_MAX < 614 24 | #undef I386_THREAD_STATE_MAX 25 | #define I386_THREAD_STATE_MAX (614) 26 | #endif 27 | 28 | #endif // CRASHPAD_COMPAT_MAC_MACH_I386_THREAD_STATE_H_ 29 | -------------------------------------------------------------------------------- /compat/mac/sys/resource.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_MAC_SYS_RESOURCE_H_ 16 | #define CRASHPAD_COMPAT_MAC_SYS_RESOURCE_H_ 17 | 18 | #include_next 19 | 20 | // 10.9 SDK 21 | 22 | #ifndef WAKEMON_MAKE_FATAL 23 | #define WAKEMON_MAKE_FATAL 0x10 24 | #endif 25 | 26 | #endif // CRASHPAD_COMPAT_MAC_SYS_RESOURCE_H_ 27 | -------------------------------------------------------------------------------- /compat/non_mac/mach-o/loader.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_NON_MAC_MACH_O_LOADER_H_ 16 | #define CRASHPAD_COMPAT_NON_MAC_MACH_O_LOADER_H_ 17 | 18 | #include "third_party/xnu/EXTERNAL_HEADERS/mach-o/loader.h" 19 | 20 | #endif // CRASHPAD_COMPAT_NON_MAC_MACH_O_LOADER_H_ 21 | -------------------------------------------------------------------------------- /compat/non_mac/mach/mach.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_NON_MAC_MACH_MACH_H_ 16 | #define CRASHPAD_COMPAT_NON_MAC_MACH_MACH_H_ 17 | 18 | //! \file 19 | 20 | // 21 | 22 | //! \anchor EXC_x 23 | //! \name EXC_* 24 | //! 25 | //! \brief Mach exception type definitions. 26 | //! \{ 27 | #define EXC_BAD_ACCESS 1 28 | #define EXC_BAD_INSTRUCTION 2 29 | #define EXC_ARITHMETIC 3 30 | #define EXC_EMULATION 4 31 | #define EXC_SOFTWARE 5 32 | #define EXC_BREAKPOINT 6 33 | #define EXC_SYSCALL 7 34 | #define EXC_MACH_SYSCALL 8 35 | #define EXC_RPC_ALERT 9 36 | #define EXC_CRASH 10 37 | #define EXC_RESOURCE 11 38 | #define EXC_GUARD 12 39 | #define EXC_CORPSE_NOTIFY 13 40 | 41 | #define EXC_TYPES_COUNT 14 42 | //! \} 43 | 44 | #endif // CRASHPAD_COMPAT_NON_MAC_MACH_MACH_H_ 45 | -------------------------------------------------------------------------------- /compat/non_mac/mach/machine.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_NON_MAC_MACH_MACHINE_H_ 16 | #define CRASHPAD_COMPAT_NON_MAC_MACH_MACHINE_H_ 17 | 18 | typedef int cpu_type_t; 19 | typedef int cpu_subtype_t; 20 | 21 | #endif // CRASHPAD_COMPAT_NON_MAC_MACH_MACHINE_H_ 22 | -------------------------------------------------------------------------------- /compat/non_mac/mach/vm_prot.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_NON_MAC_MACH_VM_PROT_H_ 16 | #define CRASHPAD_COMPAT_NON_MAC_MACH_VM_PROT_H_ 17 | 18 | typedef int vm_prot_t; 19 | 20 | #endif // CRASHPAD_COMPAT_NON_MAC_MACH_VM_PROT_H_ 21 | -------------------------------------------------------------------------------- /compat/non_win/windows.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // dbghelp.h on Windows requires inclusion of windows.h before it. To avoid 16 | // cluttering all inclusions of dbghelp.h with #ifdefs, always include windows.h 17 | // and have an empty one on non-Windows platforms. 18 | -------------------------------------------------------------------------------- /compat/win/getopt.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_WIN_GETOPT_H_ 16 | #define CRASHPAD_COMPAT_WIN_GETOPT_H_ 17 | 18 | #include "third_party/getopt/getopt.h" 19 | 20 | #endif // CRASHPAD_COMPAT_WIN_GETOPT_H_ 21 | -------------------------------------------------------------------------------- /compat/win/strings.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | extern "C" { 20 | 21 | int strcasecmp(const char* s1, const char* s2) { 22 | return _stricmp(s1, s2); 23 | } 24 | 25 | } // extern "C" 26 | -------------------------------------------------------------------------------- /compat/win/strings.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_WIN_STRINGS_H_ 16 | #define CRASHPAD_COMPAT_WIN_STRINGS_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | int strcasecmp(const char* s1, const char* s2); 23 | 24 | #ifdef __cplusplus 25 | } // extern "C" 26 | #endif 27 | 28 | #endif // CRASHPAD_COMPAT_WIN_STRINGS_H_ 29 | -------------------------------------------------------------------------------- /compat/win/sys/time.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_WIN_SYS_TIME_H_ 16 | #define CRASHPAD_COMPAT_WIN_SYS_TIME_H_ 17 | 18 | #include 19 | 20 | #endif // CRASHPAD_COMPAT_WIN_SYS_TIME_H_ 21 | -------------------------------------------------------------------------------- /compat/win/sys/types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_WIN_SYS_TYPES_H_ 16 | #define CRASHPAD_COMPAT_WIN_SYS_TYPES_H_ 17 | 18 | // This is intended to be roughly equivalent to #include_next. 19 | #include <../ucrt/sys/types.h> 20 | 21 | #include 22 | 23 | #endif // CRASHPAD_COMPAT_WIN_SYS_TYPES_H_ 24 | -------------------------------------------------------------------------------- /compat/win/time.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | extern "C" { 18 | 19 | struct tm* gmtime_r(const time_t* timep, struct tm* result) { 20 | if (gmtime_s(result, timep) != 0) 21 | return nullptr; 22 | return result; 23 | } 24 | 25 | struct tm* localtime_r(const time_t* timep, struct tm* result) { 26 | if (localtime_s(result, timep) != 0) 27 | return nullptr; 28 | return result; 29 | } 30 | 31 | const char* strptime(const char* buf, const char* format, struct tm* tm) { 32 | // TODO(scottmg): strptime implementation. 33 | return nullptr; 34 | } 35 | 36 | time_t timegm(struct tm* tm) { 37 | return _mkgmtime(tm); 38 | } 39 | 40 | } // extern "C" 41 | -------------------------------------------------------------------------------- /compat/win/time.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_WIN_TIME_H_ 16 | #define CRASHPAD_COMPAT_WIN_TIME_H_ 17 | 18 | // This is intended to be roughly equivalent to #include_next. 19 | #include <../ucrt/time.h> 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | struct tm* gmtime_r(const time_t* timep, struct tm* result); 26 | 27 | struct tm* localtime_r(const time_t* timep, struct tm* result); 28 | 29 | const char* strptime(const char* buf, const char* format, struct tm* tm); 30 | 31 | time_t timegm(struct tm* tm); 32 | 33 | #ifdef __cplusplus 34 | } // extern "C" 35 | #endif 36 | 37 | #endif // CRASHPAD_COMPAT_WIN_TIME_H_ 38 | -------------------------------------------------------------------------------- /compat/win/winbase.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_WIN_WINBASE_H_ 16 | #define CRASHPAD_COMPAT_WIN_WINBASE_H_ 17 | 18 | // include_next 19 | #include <../um/winbase.h> 20 | 21 | // 10.0.15063.0 SDK 22 | 23 | #ifndef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE 24 | #define SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE (0x2) 25 | #endif 26 | 27 | #endif // CRASHPAD_COMPAT_WIN_WINBASE_H_ 28 | -------------------------------------------------------------------------------- /compat/win/winternl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_COMPAT_WIN_WINTERNL_H_ 16 | #define CRASHPAD_COMPAT_WIN_WINTERNL_H_ 17 | 18 | // include_next 19 | #include <../um/winternl.h> 20 | 21 | // 10.0.16299.0 SDK 22 | 23 | typedef struct _CLIENT_ID CLIENT_ID; 24 | 25 | #endif // CRASHPAD_COMPAT_WIN_WINTERNL_H_ 26 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | /generated 2 | -------------------------------------------------------------------------------- /doc/appengine/go.mod: -------------------------------------------------------------------------------- 1 | module src/crashpad-home 2 | 3 | go 1.21.6 4 | 5 | require google.golang.org/appengine/v2 v2.0.5 6 | 7 | require ( 8 | github.com/golang/protobuf v1.5.2 // indirect 9 | google.golang.org/protobuf v1.30.0 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /doc/appengine/src/crashpad-home/app.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | runtime: go121 16 | app_engine_apis: true 17 | 18 | handlers: 19 | - url: /.* 20 | script: auto 21 | secure: always 22 | -------------------------------------------------------------------------------- /doc/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/doc/favicon.ico -------------------------------------------------------------------------------- /doc/layering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/doc/layering.png -------------------------------------------------------------------------------- /doc/man.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # Man Pages 18 | 19 | ## Section 1: User Commands 20 | 21 | * [crashpad_database_util](../tools/crashpad_database_util.md) 22 | * [crashpad_http_upload](../tools/crashpad_http_upload.md) 23 | * [generate_dump](../tools/generate_dump.md) 24 | 25 | ### macOS-Specific 26 | 27 | * [catch_exception_tool](../tools/mac/catch_exception_tool.md) 28 | * [exception_port_tool](../tools/mac/exception_port_tool.md) 29 | * [on_demand_service_tool](../tools/mac/on_demand_service_tool.md) 30 | * [run_with_crashpad](../tools/run_with_crashpad.md) 31 | 32 | ## Section 8: Dӕmons 33 | 34 | * [crashpad_handler](../handler/crashpad_handler.md) 35 | -------------------------------------------------------------------------------- /doc/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/doc/overview.png -------------------------------------------------------------------------------- /doc/support/compat.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then 16 | echo "${0}: this file must be sourced, not run directly" >& 2 17 | exit 1 18 | fi 19 | 20 | # Some extensions of command-line tools behave differently on different systems. 21 | # $sed_ext should be a sed invocation that enables extended regular expressions. 22 | # $date_time_t should be a date invocation that causes it to print the date and 23 | # time corresponding to a time_t string that immediately follows it. 24 | case "$(uname -s)" in 25 | Darwin) 26 | sed_ext="sed -E" 27 | date_time_t="date -r" 28 | ;; 29 | Linux) 30 | sed_ext="sed -r" 31 | date_time_t="date -d@" 32 | ;; 33 | *) 34 | echo "${0}: unknown operating system" >& 2 35 | exit 1 36 | ;; 37 | esac 38 | -------------------------------------------------------------------------------- /doc/support/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2015 The Crashpad Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | function maybe_mkdir() { 20 | local dir="${1}" 21 | if [[ ! -d "${dir}" ]]; then 22 | mkdir "${dir}" 23 | fi 24 | } 25 | 26 | # Run from the Crashpad project root directory. 27 | cd "$(dirname "${0}")/../.." 28 | 29 | source doc/support/compat.sh 30 | 31 | doc/support/generate_doxygen.py 32 | 33 | output_dir=doc/generated 34 | maybe_mkdir "${output_dir}" 35 | 36 | maybe_mkdir "${output_dir}/doxygen" 37 | rsync -Ilr --delete --exclude .git "out/doc/doxygen/html/" \ 38 | "${output_dir}/doxygen" 39 | 40 | # Ensure a favicon exists at the root since the browser will always request it. 41 | cp doc/favicon.ico "${output_dir}/" 42 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if (APPLE) 3 | add_subdirectory(macos/demo) 4 | endif (APPLE) 5 | 6 | if (WIN32) 7 | find_package(Qt5 COMPONENTS Widgets) 8 | 9 | add_subdirectory(windows/demo) 10 | if (Qt5_FOUND) 11 | add_subdirectory(windows/qt-window-app) 12 | endif () 13 | endif (WIN32) 14 | 15 | if (LINUX) 16 | add_subdirectory(linux/demo) 17 | add_subdirectory(linux/crash_loop_detection) 18 | endif (LINUX) 19 | -------------------------------------------------------------------------------- /examples/linux/crash_loop_detection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(crash_loop_detection_linux LANGUAGES CXX) 3 | 4 | if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 5 | add_subdirectory(crashpad) 6 | endif () 7 | 8 | add_executable(crash_loop_detection_linux crash_loop_detection.cpp) 9 | target_compile_features(crash_loop_detection_linux PRIVATE cxx_std_14) 10 | target_link_libraries(crash_loop_detection_linux PRIVATE client) 11 | -------------------------------------------------------------------------------- /examples/linux/crash_loop_detection/README.md: -------------------------------------------------------------------------------- 1 | # Linux demo app for crash loop detection 2 | 3 | This demo app immediately crashes and sends report to the Backtrace universe 4 | selected by the user. This demo enables Backtrace's Safe Mode/crash loop 5 | detection feature. 6 | 7 | # Build instructions 8 | 9 | Assumptions: 10 | - crashpad is checked out to `~/crashpad` 11 | - the demo app has been copied to `~/crash_loop_detection` 12 | 13 | 1. Update your handler path: 14 | ```cpp 15 | std::string handler_path("/home/myusername/crash_loop_detection/build/crashpad/handler/handler"); 16 | ``` 17 | 2. Update your upload URL 18 | ```cpp 19 | std::string url("http://submit.backtrace.io/myuniverse/mysubmittoken/minidump"); 20 | ``` 21 | 3. Ensure that crashpad is a subdirectory of this project (a symbolic link will do), for example: 22 | ```sh 23 | ln -s ~/crashpad ~/backtrace/crashpad 24 | ``` 25 | -------------------------------------------------------------------------------- /examples/linux/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(demo_linux LANGUAGES CXX) 3 | 4 | if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 5 | add_subdirectory(crashpad) 6 | endif () 7 | 8 | add_executable(demo_linux demo.cpp) 9 | target_compile_features(demo_linux PRIVATE cxx_std_14) 10 | target_link_libraries(demo_linux PRIVATE client) 11 | -------------------------------------------------------------------------------- /examples/linux/demo/README.md: -------------------------------------------------------------------------------- 1 | # Linux demo app for Crashpad with CMAKE 2 | 3 | This demo app immediately crashes and sends report to the Backtrace universe 4 | selected by the user. 5 | 6 | # Build instructions 7 | 8 | Assumptions: 9 | - crashpad is checked out to `~/crashpad` 10 | - the demo app has been copied to `~/demo_crashpad_cmake` 11 | 12 | 1. Update your handler path: 13 | ```cpp 14 | std::string handler_path("/home/myusername/demo_crashpad_cmake/build/crashpad/handler/handler"); 15 | ``` 16 | 2. Update your upload URL 17 | ```cpp 18 | std::string url("http://submit.backtrace.io/myuniverse/mysubmittoken/minidump"); 19 | ``` 20 | 3. Ensure that crashpad is a subdirectory of this project (a symbolic link will do), for example: 21 | ```sh 22 | ln -s ~/crashpad ~/demo_crashpad_cmake/crashpad 23 | ``` 24 | -------------------------------------------------------------------------------- /examples/macos/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | project(demo_macos LANGUAGES CXX) 3 | 4 | if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 5 | add_subdirectory(crashpad) 6 | endif () 7 | 8 | add_executable(demo_macos demo.cpp) 9 | target_compile_features(demo_macos PRIVATE cxx_std_14) 10 | target_link_libraries(demo_macos PRIVATE client) 11 | -------------------------------------------------------------------------------- /examples/macos/demo/README.md: -------------------------------------------------------------------------------- 1 | # MacOS demo app for Crashpad with CMAKE 2 | 3 | This demo app immediately crashes and sends report to the Backtrace universe 4 | selected by the user. 5 | 6 | # Build instructions 7 | 8 | Assumptions: 9 | - crashpad is checked out to `~/crashpad` 10 | - the demo app has been copied to `~/demo_crashpad_cmake` 11 | 12 | 1. Update your handler path: 13 | ```cpp 14 | std::string handler_path("/Users/myusername/demo_crashpad_cmake/build/crashpad/handler/handler"); 15 | ``` 16 | 2. Update your upload URL 17 | ```cpp 18 | std::string url("https://submit.backtrace.io/myuniverse/mysubmittoken/minidump"); 19 | ``` 20 | 3. Ensure that crashpad is a subdirectory of this project (a symbolic link will do), for example: 21 | ```sh 22 | ln -s ~/crashpad ~/demo_crashpad_cmake/crashpad 23 | ``` 24 | -------------------------------------------------------------------------------- /examples/windows/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(demo_windows LANGUAGES CXX) 3 | 4 | if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 5 | add_subdirectory(crashpad) 6 | endif () 7 | 8 | add_executable(demo_windows demo.cpp) 9 | target_compile_features(demo_windows PRIVATE cxx_std_14) 10 | target_link_libraries(demo_windows PRIVATE client) 11 | -------------------------------------------------------------------------------- /examples/windows/demo/README.md: -------------------------------------------------------------------------------- 1 | # Windows demo app for Crashpad with CMAKE 2 | 3 | This demo app immediately crashes and sends report to the Backtrace universe 4 | selected by the user. 5 | 6 | # Build instructions 7 | 8 | Assumptions: 9 | - crashpad is checked out to `C:\demo-crashpad-cmake\crashpad` 10 | - the demo app has been copied to `C:\demo-crashpad-cmake` 11 | 12 | 1. Update your handler path: 13 | ```cpp 14 | std::wstring handler_path(L"c:/demo-crashpad-cmake/build/crashpad/handler/Debug/handler.exe"); 15 | ``` 16 | 2. Update your upload URL 17 | ```cpp 18 | std::string url("http://submit.backtrace.io/myuniverse/mysubmittoken/minidump"); 19 | ``` 20 | -------------------------------------------------------------------------------- /examples/windows/qt-window-app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.17) 2 | 3 | # project(qt_window_app VERSION 0.1 LANGUAGES CXX) 4 | 5 | set(CMAKE_AUTOUIC ON) 6 | set(CMAKE_AUTOMOC ON) 7 | set(CMAKE_AUTORCC ON) 8 | 9 | if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 10 | add_subdirectory(crashpad) 11 | endif () 12 | 13 | find_package(Qt5 REQUIRED COMPONENTS Widgets) 14 | 15 | set(PROJECT_SOURCES 16 | backtrace.cpp 17 | backtrace.hpp 18 | backtrace.qrc 19 | main.cpp 20 | mainwindow.cpp 21 | mainwindow.hpp 22 | mainwindow.ui 23 | ) 24 | 25 | add_executable(qt_window_app ${PROJECT_SOURCES}) 26 | 27 | target_link_libraries(qt_window_app PRIVATE Qt5::Gui Qt5::Core Qt5::Widgets client) 28 | target_compile_features(qt_window_app PRIVATE cxx_std_17) 29 | 30 | if (WIN32) 31 | set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/app.rc") 32 | set_target_properties(qt_window_app PROPERTIES WIN32_EXECUTABLE TRUE) 33 | target_sources(qt_window_app PRIVATE ${APP_ICON_RESOURCE_WINDOWS}) 34 | endif () 35 | -------------------------------------------------------------------------------- /examples/windows/qt-window-app/app.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "icon.ico" 2 | -------------------------------------------------------------------------------- /examples/windows/qt-window-app/backtrace.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace backtrace 6 | { 7 | bool initialize_crashpad(std::string_view url); 8 | void crash_memset(); 9 | } 10 | -------------------------------------------------------------------------------- /examples/windows/qt-window-app/backtrace.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon.png 4 | logo.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/windows/qt-window-app/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/examples/windows/qt-window-app/icon.ico -------------------------------------------------------------------------------- /examples/windows/qt-window-app/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/examples/windows/qt-window-app/icon.png -------------------------------------------------------------------------------- /examples/windows/qt-window-app/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/examples/windows/qt-window-app/logo.png -------------------------------------------------------------------------------- /examples/windows/qt-window-app/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /examples/windows/qt-window-app/mainwindow.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { class MainWindow; } 8 | QT_END_NAMESPACE 9 | 10 | class MainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | MainWindow(QWidget *parent = nullptr); 16 | ~MainWindow(); 17 | 18 | 19 | private: 20 | void initializeCrashpad(); 21 | void selectHandlerPath(); 22 | 23 | void saveState(); 24 | void loadState(); 25 | 26 | Ui::MainWindow *ui; 27 | }; 28 | #endif // MAINWINDOW_H 29 | -------------------------------------------------------------------------------- /handler/crashpad_handler_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "handler/handler_main.h" 16 | 17 | namespace crashpad { 18 | 19 | extern "C" { 20 | 21 | __attribute__((visibility("default"), used)) int CrashpadHandlerMain( 22 | int argc, 23 | char* argv[]) { 24 | return HandlerMain(argc, argv, nullptr); 25 | } 26 | 27 | } // extern "C" 28 | 29 | } // namespace crashpad 30 | -------------------------------------------------------------------------------- /handler/win/.gitattributes: -------------------------------------------------------------------------------- 1 | # Copyright 2019 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This should be a .cc file, which would allow its attributes to be controlled 16 | # by the *.cc pattern in the root .gitattributes file, but it’s named with a 17 | # .cpp extension instead. This file needs to be built with VC++6, a vintage 1998 18 | # compiler, which might not understand .cc to mean C++. Rather than setting 19 | # attributes globally for .cpp files, which are undesirable (.cc should be used 20 | # in its place), provide a file-specific mapping here. 21 | /z7_test.cpp text eol=lf 22 | -------------------------------------------------------------------------------- /handler/win/fake_handler_that_crashes_at_startup.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This is used to test a crashpad_handler that launches successfully, but then 16 | // crashes before setting up. 17 | int wmain() { 18 | __debugbreak(); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /handler/win/wer/crashpad_wer.def: -------------------------------------------------------------------------------- 1 | ; Copyright 2022 The Crashpad Authors 2 | ; 3 | ; Licensed under the Apache License, Version 2.0 (the "License"); 4 | ; you may not use this file except in compliance with the License. 5 | ; You may obtain a copy of the License at 6 | ; 7 | ; http://www.apache.org/licenses/LICENSE-2.0 8 | ; 9 | ; Unless required by applicable law or agreed to in writing, software 10 | ; distributed under the License is distributed on an "AS IS" BASIS, 11 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | ; See the License for the specific language governing permissions and 13 | ; limitations under the License. 14 | LIBRARY "crashpad_wer.dll" 15 | 16 | EXPORTS 17 | ; These are required for the WER api. 18 | OutOfProcessExceptionEventCallback 19 | OutOfProcessExceptionEventSignatureCallback 20 | OutOfProcessExceptionEventDebuggerLaunchCallback 21 | -------------------------------------------------------------------------------- /handler/win/wer/crashpad_wer.ver: -------------------------------------------------------------------------------- 1 | INTERNAL_NAME=crashpad_wer 2 | ORIGINAL_FILENAME=crashpad_wer.dll 3 | -------------------------------------------------------------------------------- /handler/win/z7_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Build in VC++6 or older command prompt with: 16 | // 17 | // cl /nologo /W4 /MT /Z7 z7_test.cpp /link /dll /out:z7_test.dll /debugtype:cv /pdb:none 18 | // 19 | // Given that this is quite tedious to build, the result is also checked in. 20 | 21 | #include 22 | #include 23 | 24 | extern "C" __declspec(dllexport) void CrashMe() { 25 | volatile int* foo = reinterpret_cast(7); 26 | *foo = 42; 27 | } 28 | 29 | BOOL WINAPI DllMain(HINSTANCE hinstance, DWORD reason, LPVOID) { 30 | printf("%p %d\n", hinstance, reason); 31 | return TRUE; 32 | } 33 | -------------------------------------------------------------------------------- /handler/win/z7_test.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/handler/win/z7_test.dll -------------------------------------------------------------------------------- /infra/config/PRESUBMIT.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | USE_PYTHON3 = True 17 | PRESUBMIT_VERSION = '2.0.0' 18 | 19 | 20 | def CheckChangedLUCIConfigs(input_api, output_api): 21 | return input_api.canned_checks.CheckChangedLUCIConfigs( 22 | input_api, output_api) 23 | 24 | 25 | def CheckLucicfgGenOutputMain(input_api, output_api): 26 | return input_api.RunTests( 27 | input_api.canned_checks.CheckLucicfgGenOutput(input_api, output_api, 28 | 'main.star')) 29 | -------------------------------------------------------------------------------- /infra/config/generated/luci-logdog.cfg: -------------------------------------------------------------------------------- 1 | # Auto-generated by lucicfg. 2 | # Do not modify manually. 3 | # 4 | # For the schema of this file, see ProjectConfig message: 5 | # https://config.luci.app/schemas/projects:luci-logdog.cfg 6 | 7 | reader_auth_groups: "all" 8 | writer_auth_groups: "luci-logdog-chromium-writers" 9 | archive_gs_bucket: "chromium-luci-logdog" 10 | -------------------------------------------------------------------------------- /infra/config/generated/project.cfg: -------------------------------------------------------------------------------- 1 | # Auto-generated by lucicfg. 2 | # Do not modify manually. 3 | # 4 | # For the schema of this file, see ProjectCfg message: 5 | # https://config.luci.app/schemas/projects:project.cfg 6 | 7 | name: "crashpad" 8 | access: "group:all" 9 | lucicfg { 10 | version: "1.43.6" 11 | package_dir: ".." 12 | config_dir: "generated" 13 | entry_point: "main.star" 14 | experiments: "crbug.com/1182002" 15 | } 16 | -------------------------------------------------------------------------------- /minidump/minidump_extensions.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "minidump/minidump_extensions.h" 16 | 17 | namespace crashpad { 18 | 19 | constexpr uint32_t MinidumpModuleCrashpadInfo::kVersion; 20 | constexpr uint32_t MinidumpCrashpadInfo::kVersion; 21 | 22 | } // namespace crashpad 23 | -------------------------------------------------------------------------------- /minidump/minidump_user_extension_stream_data_source.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "minidump/minidump_user_extension_stream_data_source.h" 16 | 17 | namespace crashpad { 18 | 19 | MinidumpUserExtensionStreamDataSource::MinidumpUserExtensionStreamDataSource( 20 | uint32_t stream_type) 21 | : stream_type_(static_cast(stream_type)) {} 22 | 23 | MinidumpUserExtensionStreamDataSource:: 24 | ~MinidumpUserExtensionStreamDataSource() {} 25 | 26 | } // namespace crashpad 27 | -------------------------------------------------------------------------------- /navbar.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # Crashpad 18 | 19 | * [Home][home] 20 | * [Developing](/doc/developing.md) 21 | * [Interface Docs](https://crashpad.chromium.org/doxygen/) 22 | * [Man Pages](/doc/man.md) 23 | * [Source Code](https://chromium.googlesource.com/crashpad/crashpad/) 24 | 25 | [home]: /README.md 26 | -------------------------------------------------------------------------------- /package.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_PACKAGE_H_ 16 | #define CRASHPAD_PACKAGE_H_ 17 | 18 | #define PACKAGE_BUGREPORT "https://crashpad.chromium.org/bug/new" 19 | #define PACKAGE_COPYRIGHT \ 20 | "Copyright " PACKAGE_COPYRIGHT_YEAR " " PACKAGE_COPYRIGHT_OWNER 21 | #define PACKAGE_COPYRIGHT_OWNER "The Crashpad Authors" 22 | #define PACKAGE_COPYRIGHT_YEAR "2018" 23 | #define PACKAGE_NAME "Crashpad" 24 | #define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION 25 | #define PACKAGE_TARNAME "crashpad" 26 | #define PACKAGE_VERSION "0.8.0" 27 | #define PACKAGE_URL "https://crashpad.chromium.org/" 28 | 29 | #endif // CRASHPAD_PACKAGE_H_ 30 | -------------------------------------------------------------------------------- /snapshot/annotation_snapshot.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "snapshot/annotation_snapshot.h" 16 | 17 | namespace crashpad { 18 | 19 | AnnotationSnapshot::AnnotationSnapshot() : name(), type(0), value() {} 20 | 21 | AnnotationSnapshot::AnnotationSnapshot(const std::string& name, 22 | uint16_t type, 23 | const std::vector& value) 24 | : name(name), type(type), value(value) {} 25 | 26 | AnnotationSnapshot::~AnnotationSnapshot() = default; 27 | 28 | bool AnnotationSnapshot::operator==(const AnnotationSnapshot& other) const { 29 | return name == other.name && type == other.type && value == other.value; 30 | } 31 | 32 | } // namespace crashpad 33 | -------------------------------------------------------------------------------- /snapshot/elf/elf_image_reader_fuzzer_corpus/.gitattributes: -------------------------------------------------------------------------------- 1 | # Copyright 2019 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # ELF executables normally don’t have any extension, so there’s no pattern to 16 | # match in the root .gitattributes file. 17 | /ret42 binary 18 | -------------------------------------------------------------------------------- /snapshot/elf/elf_image_reader_fuzzer_corpus/crashpad_snapshot_test_both_dt_hash_styles.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/snapshot/elf/elf_image_reader_fuzzer_corpus/crashpad_snapshot_test_both_dt_hash_styles.so -------------------------------------------------------------------------------- /snapshot/elf/elf_image_reader_fuzzer_corpus/ret42: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/snapshot/elf/elf_image_reader_fuzzer_corpus/ret42 -------------------------------------------------------------------------------- /snapshot/elf/elf_image_reader_test_note.S: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/elf_note_types.h" 16 | #include "util/misc/arm64_pac_bti.S" 17 | 18 | #define NOTE_ALIGN 4 19 | .section .note.crashpad.test,"a",%note 20 | .balign NOTE_ALIGN 21 | .type testnote, %object 22 | testnote: 23 | .long name_end - name // namesz 24 | .long desc_end - desc // descsz 25 | .long CRASHPAD_ELF_NOTE_TYPE_SNAPSHOT_TEST // type 26 | name: 27 | .asciz CRASHPAD_ELF_NOTE_NAME 28 | name_end: 29 | .balign NOTE_ALIGN 30 | desc: 31 | .long 42 32 | desc_end: 33 | .size testnote, .-testnote 34 | -------------------------------------------------------------------------------- /snapshot/elf/test_exported_symbols.sym: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This symbol is used by elf_image_reader_test.cc. 16 | { 17 | ElfImageReaderTestExportedSymbol; 18 | }; 19 | -------------------------------------------------------------------------------- /snapshot/handle_snapshot.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "snapshot/handle_snapshot.h" 16 | 17 | namespace crashpad { 18 | 19 | HandleSnapshot::HandleSnapshot() 20 | : type_name(), 21 | handle(0), 22 | attributes(0), 23 | granted_access(0), 24 | pointer_count(0), 25 | handle_count(0) { 26 | } 27 | 28 | HandleSnapshot::~HandleSnapshot() { 29 | } 30 | 31 | } // namespace crashpad 32 | -------------------------------------------------------------------------------- /snapshot/hash_types_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | int main() { 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa -------------------------------------------------------------------------------- /snapshot/ios/testdata/crash-5726011582644224: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/snapshot/ios/testdata/crash-5726011582644224 -------------------------------------------------------------------------------- /snapshot/ios/testdata/crash-6605504629637120: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/snapshot/ios/testdata/crash-6605504629637120 -------------------------------------------------------------------------------- /snapshot/ios/testdata/crash-c44acfcbccd8c7a8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/snapshot/ios/testdata/crash-c44acfcbccd8c7a8 -------------------------------------------------------------------------------- /snapshot/mac/mach_o_image_annotations_reader_test_module_crashy_initializer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace crashpad { 16 | namespace test { 17 | namespace { 18 | 19 | class CrashyClass { 20 | public: 21 | CrashyClass() { 22 | __builtin_trap(); 23 | } 24 | }; 25 | 26 | // __attribute__((used)) keeps the dead code stripper away. 27 | __attribute__((used)) CrashyClass g_crashy_object; 28 | 29 | } // namespace 30 | } // namespace test 31 | } // namespace crashpad 32 | -------------------------------------------------------------------------------- /snapshot/mac/mach_o_image_annotations_reader_test_no_op.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | int main(int argc, char* argv[]) { 18 | return EXIT_SUCCESS; 19 | } 20 | -------------------------------------------------------------------------------- /snapshot/mac/process_types/all.proctype: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file is intended to be included multiple times in the same translation 16 | // unit, so #include guards are intentionally absent. 17 | // 18 | // This file is included by snapshot/mac/process_types.h and 19 | // snapshot/mac/process_types.cc to produce process type struct definitions and 20 | // accessors. 21 | 22 | #include "snapshot/mac/process_types/annotation.proctype" 23 | #include "snapshot/mac/process_types/crashpad_info.proctype" 24 | #include "snapshot/mac/process_types/crashreporterclient.proctype" 25 | #include "snapshot/mac/process_types/dyld_images.proctype" 26 | #include "snapshot/mac/process_types/loader.proctype" 27 | #include "snapshot/mac/process_types/nlist.proctype" 28 | -------------------------------------------------------------------------------- /snapshot/mac/process_types/annotation.proctype: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | PROCESS_TYPE_STRUCT_BEGIN(Annotation) 16 | PROCESS_TYPE_STRUCT_MEMBER(Pointer, link_node) 17 | PROCESS_TYPE_STRUCT_MEMBER(Pointer, name) 18 | PROCESS_TYPE_STRUCT_MEMBER(Pointer, value) 19 | PROCESS_TYPE_STRUCT_MEMBER(uint32_t, size) 20 | PROCESS_TYPE_STRUCT_MEMBER(uint16_t, type) 21 | PROCESS_TYPE_STRUCT_END(Annotation) 22 | 23 | #if !defined(PROCESS_TYPE_STRUCT_IMPLEMENT_ARRAY) 24 | 25 | PROCESS_TYPE_STRUCT_BEGIN(AnnotationList) 26 | PROCESS_TYPE_STRUCT_MEMBER(Pointer, tail_pointer) 27 | PROCESS_TYPE_STRUCT_MEMBER(crashpad::process_types::Annotation, head) 28 | PROCESS_TYPE_STRUCT_MEMBER(crashpad::process_types::Annotation, tail) 29 | PROCESS_TYPE_STRUCT_END(AnnotationList) 30 | 31 | #endif // !defined(PROCESS_TYPE_STRUCT_IMPLEMENT_ARRAY) 32 | -------------------------------------------------------------------------------- /snapshot/mac/process_types/flavors.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file is intended to be included multiple times in the same translation 16 | // unit, so #include guards are intentionally absent. 17 | // 18 | // This file is included by snapshot/mac/process_types/internal.h to produce 19 | // process type flavor traits class declarations and by 20 | // snapshot/mac/process_types/custom.cc to provide explicit instantiation of 21 | // flavored implementations. 22 | 23 | PROCESS_TYPE_FLAVOR_TRAITS(32) 24 | PROCESS_TYPE_FLAVOR_TRAITS(64) 25 | -------------------------------------------------------------------------------- /snapshot/mac/process_types/nlist.proctype: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file corresponds to the system’s . 16 | // 17 | // This file is intended to be included multiple times in the same translation 18 | // unit, so #include guards are intentionally absent. 19 | // 20 | // This file is included by snapshot/mac/process_types.h and 21 | // snapshot/mac/process_types.cc to produce process type struct definitions and 22 | // accessors. 23 | 24 | PROCESS_TYPE_STRUCT_BEGIN(nlist) 25 | PROCESS_TYPE_STRUCT_MEMBER(uint32_t, n_strx) // n_un.n_strx 26 | PROCESS_TYPE_STRUCT_MEMBER(uint8_t, n_type) 27 | PROCESS_TYPE_STRUCT_MEMBER(uint8_t, n_sect) 28 | PROCESS_TYPE_STRUCT_MEMBER(uint16_t, n_desc) // 32-bit: int16_t 29 | PROCESS_TYPE_STRUCT_MEMBER(ULong, n_value) 30 | PROCESS_TYPE_STRUCT_END(nlist) 31 | -------------------------------------------------------------------------------- /snapshot/memory_map_region_snapshot.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_SNAPSHOT_MEMORY_MAP_REGION_SNAPSHOT_H_ 16 | #define CRASHPAD_SNAPSHOT_MEMORY_MAP_REGION_SNAPSHOT_H_ 17 | 18 | #include 19 | #include 20 | 21 | namespace crashpad { 22 | 23 | //! \brief An abstract interface to a snapshot representing a region of the 24 | //! memory map present in the snapshot process. 25 | class MemoryMapRegionSnapshot { 26 | public: 27 | virtual ~MemoryMapRegionSnapshot() {} 28 | 29 | //! \brief Gets a MINIDUMP_MEMORY_INFO representing the region. 30 | virtual const MINIDUMP_MEMORY_INFO& AsMinidumpMemoryInfo() const = 0; 31 | }; 32 | 33 | } // namespace crashpad 34 | 35 | #endif // CRASHPAD_SNAPSHOT_MEMORY_MAP_REGION_SNAPSHOT_H_ 36 | -------------------------------------------------------------------------------- /snapshot/snapshot_constants.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef SNAPSHOT_SNAPSHOT_CONSTANTS_H_ 16 | #define SNAPSHOT_SNAPSHOT_CONSTANTS_H_ 17 | 18 | namespace crashpad { 19 | 20 | //! \brief The maximum number of crashpad::Annotations that will be read from 21 | //! a client process. 22 | //! 23 | //! \note This maximum was chosen arbitrarily and may change in the future. 24 | constexpr size_t kMaxNumberOfAnnotations = 400; 25 | 26 | } // namespace crashpad 27 | 28 | #endif // SNAPSHOT_SNAPSHOT_CONSTANTS_H_ 29 | -------------------------------------------------------------------------------- /snapshot/test/test_memory_map_region_snapshot.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "snapshot/test/test_memory_map_region_snapshot.h" 16 | 17 | namespace crashpad { 18 | namespace test { 19 | 20 | TestMemoryMapRegionSnapshot::TestMemoryMapRegionSnapshot() : memory_info_() { 21 | } 22 | 23 | TestMemoryMapRegionSnapshot::~TestMemoryMapRegionSnapshot() { 24 | } 25 | 26 | void TestMemoryMapRegionSnapshot::SetMindumpMemoryInfo( 27 | const MINIDUMP_MEMORY_INFO& mmi) { 28 | memory_info_ = mmi; 29 | } 30 | 31 | const MINIDUMP_MEMORY_INFO& TestMemoryMapRegionSnapshot::AsMinidumpMemoryInfo() 32 | const { 33 | return memory_info_; 34 | } 35 | 36 | } // namespace test 37 | } // namespace crashpad 38 | -------------------------------------------------------------------------------- /snapshot/unloaded_module_snapshot.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "snapshot/unloaded_module_snapshot.h" 16 | 17 | namespace crashpad { 18 | 19 | UnloadedModuleSnapshot::UnloadedModuleSnapshot(uint64_t address, 20 | uint64_t size, 21 | uint32_t checksum, 22 | uint32_t timestamp, 23 | const std::string& name) 24 | : name_(name), 25 | address_(address), 26 | size_(size), 27 | checksum_(checksum), 28 | timestamp_(timestamp) {} 29 | 30 | UnloadedModuleSnapshot::~UnloadedModuleSnapshot() { 31 | } 32 | 33 | } // namespace crashpad 34 | -------------------------------------------------------------------------------- /snapshot/win/crashpad_snapshot_test_image_reader_module.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | BOOL WINAPI DllMain(HINSTANCE hinstance, DWORD reason, LPVOID reserved) { 18 | return TRUE; 19 | } 20 | -------------------------------------------------------------------------------- /test/hex_string.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/hex_string.h" 16 | 17 | #include "base/strings/stringprintf.h" 18 | 19 | namespace crashpad { 20 | namespace test { 21 | 22 | std::string BytesToHexString(const void* bytes, size_t length) { 23 | const unsigned char* bytes_c = reinterpret_cast(bytes); 24 | 25 | std::string hex_string; 26 | hex_string.reserve(length * 2); 27 | for (size_t index = 0; index < length; ++index) { 28 | hex_string.append(base::StringPrintf("%02x", bytes_c[index])); 29 | } 30 | 31 | return hex_string; 32 | } 33 | 34 | } // namespace test 35 | } // namespace crashpad 36 | -------------------------------------------------------------------------------- /test/hex_string.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_TEST_HEX_STRING_H_ 16 | #define CRASHPAD_TEST_HEX_STRING_H_ 17 | 18 | #include 19 | 20 | #include 21 | 22 | namespace crashpad { 23 | namespace test { 24 | 25 | //! \brief Returns a hexadecimal string corresponding to \a bytes and \a length. 26 | //! 27 | //! Example usage: 28 | //! \code 29 | //! uint8_t expected[10]; 30 | //! uint8_t observed[10]; 31 | //! // … 32 | //! EXPECT_EQ(BytesToHexString(observed, std::size(observed)), 33 | //! BytesToHexString(expected, std::size(expected))); 34 | //! \endcode 35 | std::string BytesToHexString(const void* bytes, size_t length); 36 | 37 | } // namespace test 38 | } // namespace crashpad 39 | 40 | #endif // CRASHPAD_TEST_HEX_STRING_H_ 41 | -------------------------------------------------------------------------------- /test/hex_string_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/hex_string.h" 16 | 17 | #include 18 | 19 | #include "gtest/gtest.h" 20 | 21 | namespace crashpad { 22 | namespace test { 23 | namespace { 24 | 25 | TEST(HexString, HexString) { 26 | EXPECT_EQ(BytesToHexString(nullptr, 0), ""); 27 | 28 | static constexpr char kBytes[] = "Abc123xyz \x0a\x7f\xf0\x9f\x92\xa9_"; 29 | EXPECT_EQ(BytesToHexString(kBytes, std::size(kBytes)), 30 | "41626331323378797a200a7ff09f92a95f00"); 31 | } 32 | 33 | } // namespace 34 | } // namespace test 35 | } // namespace crashpad 36 | -------------------------------------------------------------------------------- /test/ios/cptest_google_test_runner.mm: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #import 16 | #import 17 | 18 | #include "base/check.h" 19 | #import "test/ios/cptest_google_test_runner_delegate.h" 20 | 21 | @interface CPTestGoogleTestRunner : XCTestCase 22 | @end 23 | 24 | @implementation CPTestGoogleTestRunner 25 | 26 | - (void)testRunGoogleTests { 27 | id appDelegate = UIApplication.sharedApplication.delegate; 28 | DCHECK([appDelegate 29 | conformsToProtocol:@protocol(CPTestGoogleTestRunnerDelegate)]); 30 | 31 | id runnerDelegate = 32 | static_cast>(appDelegate); 33 | DCHECK(runnerDelegate.supportsRunningGoogleTestsWithXCTest); 34 | XCTAssertTrue([runnerDelegate runGoogleTests] == 0); 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /test/ios/cptest_google_test_runner_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_TEST_IOS_CPTEST_GOOGLE_TEST_RUNNER_DELEGATE_ 16 | #define CRASHPAD_TEST_IOS_CPTEST_GOOGLE_TEST_RUNNER_DELEGATE_ 17 | 18 | @protocol CPTestGoogleTestRunnerDelegate 19 | 20 | // Returns YES if this delegate supports running Google Test tests via a call to 21 | // |runGoogleTests|. 22 | @property(nonatomic, readonly, assign) 23 | BOOL supportsRunningGoogleTestsWithXCTest; 24 | 25 | // Runs Google Test tests and returns the final exit code. 26 | - (int)runGoogleTests; 27 | 28 | @end 29 | 30 | #endif // CRASHPAD_TEST_IOS_CPTEST_GOOGLE_TEST_RUNNER_DELEGATE_H_ 31 | -------------------------------------------------------------------------------- /test/ios/host/cptest_application_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_TEST_IOS_HOST_CPTEST_APPLICATION_DELEGATE_H_ 16 | #define CRASHPAD_TEST_IOS_HOST_CPTEST_APPLICATION_DELEGATE_H_ 17 | 18 | #import 19 | 20 | @interface CPTestApplicationDelegate : UIResponder 21 | @end 22 | 23 | #endif // CRASHPAD_TEST_IOS_HOST_CPTEST_APPLICATION_DELEGATE_H_ 24 | -------------------------------------------------------------------------------- /test/ios/host/cptest_crash_view_controller.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_TEST_IOS_HOST_CPTEST_CRASH_VIEW_CONTROLLER_H_ 16 | #define CRASHPAD_TEST_IOS_HOST_CPTEST_CRASH_VIEW_CONTROLLER_H_ 17 | 18 | #import 19 | 20 | @interface CPTestCrashViewController : UIViewController 21 | @end 22 | 23 | #endif // CRASHPAD_TEST_IOS_HOST_CPTEST_CRASH_VIEW_CONTROLLER_H_ 24 | -------------------------------------------------------------------------------- /test/ios/host/handler_forbidden_allocators.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_TEST_IOS_HANDLER_FORBIDDEN_ALLOCATIONS_H_ 16 | #define CRASHPAD_TEST_IOS_HANDLER_FORBIDDEN_ALLOCATIONS_H_ 17 | 18 | namespace crashpad { 19 | namespace test { 20 | 21 | // Override malloc_default_zone and malloc_default_purgeable_zone with functions 22 | // that immediately exit if called from the same thread that this helper is 23 | // called from or from the Crashpad Mach exception handler thread indicated by 24 | // GetThreadIdForTesting. This is used to ensure the allocator is not used by 25 | // the Crashpad InProcessHandler. 26 | void ReplaceAllocatorsWithHandlerForbidden(); 27 | 28 | } // namespace test 29 | } // namespace crashpad 30 | 31 | #endif // CRASHPAD_TEST_IOS_HANDLER_FORBIDDEN_ALLOCATIONS_H_ 32 | -------------------------------------------------------------------------------- /test/ios/host/main.mm: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #import 16 | 17 | #import "test/ios/host/cptest_application_delegate.h" 18 | 19 | int main(int argc, char* argv[]) { 20 | NSString* appDelegateClassName; 21 | @autoreleasepool { 22 | // Setup code that might create autoreleased objects goes here. 23 | appDelegateClassName = NSStringFromClass([CPTestApplicationDelegate class]); 24 | } 25 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 26 | } 27 | -------------------------------------------------------------------------------- /test/linux/get_tls.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_TEST_LINUX_GET_TLS_H_ 16 | #define CRASHPAD_TEST_LINUX_GET_TLS_H_ 17 | 18 | #include "util/linux/address_types.h" 19 | 20 | namespace crashpad { 21 | namespace test { 22 | 23 | //! \brief Return the thread-local storage address for the current thread. 24 | LinuxVMAddress GetTLS(); 25 | 26 | } // namespace test 27 | } // namespace crashpad 28 | 29 | #endif // CRASHPAD_TEST_LINUX_GET_TLS_H_ 30 | -------------------------------------------------------------------------------- /test/mac/dyld.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_TEST_MAC_DYLD_H_ 16 | #define CRASHPAD_TEST_MAC_DYLD_H_ 17 | 18 | #include 19 | 20 | namespace crashpad { 21 | namespace test { 22 | 23 | //! \brief Calls or emulates the `_dyld_get_all_image_infos()` private/internal 24 | //! function. 25 | //! 26 | //! \return A pointer to this process’ dyld_all_image_infos structure, or 27 | //! `nullptr` on failure with a message logged. 28 | const dyld_all_image_infos* DyldGetAllImageInfos(); 29 | 30 | } // namespace test 31 | } // namespace crashpad 32 | 33 | #endif // CRASHPAD_TEST_MAC_DYLD_H_ 34 | -------------------------------------------------------------------------------- /test/main_arguments.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/main_arguments.h" 16 | 17 | #include "base/check.h" 18 | 19 | namespace crashpad { 20 | namespace test { 21 | 22 | const std::vector* g_arguments; 23 | 24 | void InitializeMainArguments(int argc, char* argv[]) { 25 | CHECK(!g_arguments); 26 | CHECK(argc); 27 | CHECK(argv); 28 | 29 | g_arguments = new const std::vector(argv, argv + argc); 30 | } 31 | 32 | const std::vector& GetMainArguments() { 33 | CHECK(g_arguments); 34 | return *g_arguments; 35 | } 36 | 37 | } // namespace test 38 | } // namespace crashpad 39 | -------------------------------------------------------------------------------- /test/main_arguments_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/main_arguments.h" 16 | 17 | #include "gtest/gtest.h" 18 | 19 | namespace crashpad { 20 | namespace test { 21 | namespace { 22 | 23 | TEST(MainArguments, GetMainArguments) { 24 | // Make sure that InitializeMainArguments() has been called and that 25 | // GetMainArguments() provides reasonable values. 26 | const std::vector& arguments = GetMainArguments(); 27 | 28 | ASSERT_FALSE(arguments.empty()); 29 | EXPECT_FALSE(arguments[0].empty()); 30 | } 31 | 32 | } // namespace 33 | } // namespace test 34 | } // namespace crashpad 35 | -------------------------------------------------------------------------------- /test/process_type.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/process_type.h" 16 | 17 | #include "build/build_config.h" 18 | 19 | #if BUILDFLAG(IS_FUCHSIA) 20 | #include 21 | #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) 22 | #include 23 | #endif 24 | 25 | namespace crashpad { 26 | namespace test { 27 | 28 | ProcessType GetSelfProcess() { 29 | #if BUILDFLAG(IS_FUCHSIA) 30 | return zx::process::self(); 31 | #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) 32 | return getpid(); 33 | #elif BUILDFLAG(IS_WIN) 34 | return GetCurrentProcess(); 35 | #elif BUILDFLAG(IS_APPLE) 36 | return mach_task_self(); 37 | #endif 38 | } 39 | 40 | } // namespace test 41 | } // namespace crashpad 42 | -------------------------------------------------------------------------------- /test/scoped_guarded_page_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/scoped_guarded_page.h" 16 | 17 | #include "base/memory/page_size.h" 18 | #include "gtest/gtest.h" 19 | #include "test/gtest_death.h" 20 | 21 | namespace crashpad { 22 | namespace test { 23 | namespace { 24 | 25 | TEST(ScopedGuardedPage, BasicFunctionality) { 26 | GTEST_FLAG_SET(death_test_style, "threadsafe"); 27 | 28 | ScopedGuardedPage page; 29 | char* address = (char*)page.Pointer(); 30 | EXPECT_NE(address, nullptr); 31 | address[0] = 0; 32 | address[base::GetPageSize() - 1] = 0; 33 | EXPECT_DEATH_CRASH({ address[base::GetPageSize()] = 0; }, ""); 34 | } 35 | 36 | } // namespace 37 | } // namespace test 38 | } // namespace crashpad 39 | -------------------------------------------------------------------------------- /test/scoped_guarded_page_win.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/scoped_guarded_page.h" 16 | 17 | #include 18 | 19 | #include "base/check.h" 20 | #include "base/memory/page_size.h" 21 | 22 | namespace crashpad { 23 | namespace test { 24 | 25 | ScopedGuardedPage::ScopedGuardedPage() { 26 | const size_t page_size = base::GetPageSize(); 27 | ptr_ = VirtualAlloc(nullptr, page_size * 2, MEM_RESERVE, PAGE_NOACCESS); 28 | PCHECK(ptr_ != nullptr) << "VirtualAlloc"; 29 | 30 | PCHECK(VirtualAlloc(ptr_, page_size, MEM_COMMIT, PAGE_READWRITE) != nullptr) 31 | << "VirtualAlloc"; 32 | } 33 | 34 | ScopedGuardedPage::~ScopedGuardedPage() { 35 | PCHECK(VirtualFree(ptr_, 0, MEM_RELEASE)) << "VirtualFree"; 36 | } 37 | 38 | } // namespace test 39 | } // namespace crashpad 40 | -------------------------------------------------------------------------------- /test/test_paths_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test/test_paths.h" 16 | 17 | #include "base/files/file_path.h" 18 | #include "gtest/gtest.h" 19 | #include "util/file/file_io.h" 20 | 21 | namespace crashpad { 22 | namespace test { 23 | namespace { 24 | 25 | TEST(TestPaths, TestDataRoot) { 26 | base::FilePath test_data_root = TestPaths::TestDataRoot(); 27 | ScopedFileHandle file(LoggingOpenFileForRead( 28 | test_data_root.Append(FILE_PATH_LITERAL("test")) 29 | .Append(FILE_PATH_LITERAL("test_paths_test_data_root.txt")))); 30 | EXPECT_TRUE(file.is_valid()); 31 | } 32 | 33 | } // namespace 34 | } // namespace test 35 | } // namespace crashpad 36 | -------------------------------------------------------------------------------- /test/test_paths_test_data_root.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | This file is used by TestPaths::TestDataRoot() to locate the test data root. It 16 | is present at a known path from the test data root. 17 | -------------------------------------------------------------------------------- /third_party/cpp-httplib/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | source_set("cpp-httplib") { 16 | testonly = true 17 | include_dirs = [ "cpp-httplib" ] 18 | sources = [ "cpp-httplib/httplib.h" ] 19 | deps = [ "../zlib" ] 20 | } 21 | -------------------------------------------------------------------------------- /third_party/cpp-httplib/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: cpp-httplib 2 | Short Name: cpp-httplib 3 | URL: https://github.com/yhirose/cpp-httplib 4 | Version: 0.19.0 (+22 commits) 5 | Revision: 71ba7e7b1b328fe0de6cfbd3e94e5e0ddd4b4073 6 | License: MIT 7 | License File: cpp-httplib/LICENSE 8 | Security Critical: no (test only) 9 | Shipped: no 10 | 11 | Description: 12 | A C++11 single-file header-only cross-platform HTTP/HTTPS library. 13 | 14 | Local Modifications: 15 | - Exclude benchmark/, docker/, example/, and test/ subdirectories, and 16 | build-related files. 17 | - Patch httplib.h to use #include "third_party/zlib/zlib_crashpad.h" instead of 18 | . 19 | - #define CPPHTTPLIB_NO_EXCEPTIONS 1. 20 | -------------------------------------------------------------------------------- /third_party/cpp-httplib/cpp-httplib/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 yhirose 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /third_party/edo/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: eDistantObject 2 | Short Name: EDO 3 | URL: https://github.com/google/eDistantObject 4 | Revision: See DEPS 5 | License: Apache 2.0 6 | License File: edo/LICENSE 7 | Security Critical: no 8 | Shipped: no 9 | 10 | Description: 11 | iOS remote method invocations (distant object) over Inter-process communication layer. 12 | -------------------------------------------------------------------------------- /third_party/fuchsia/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import("../../build/crashpad_buildconfig.gni") 16 | 17 | if (crashpad_is_in_fuchsia) { 18 | group("fuchsia") { 19 | public_deps = [ 20 | "//sdk/lib/fdio", 21 | "//zircon/system/ulib/zx", 22 | ] 23 | } 24 | } else if (crashpad_is_in_chromium) { 25 | group("fuchsia") { 26 | public_deps = [ 27 | "//third_party/fuchsia-sdk/sdk/pkg/fdio", 28 | "//third_party/fuchsia-sdk/sdk/pkg/zx", 29 | ] 30 | } 31 | } else { 32 | group("fuchsia") { 33 | public_deps = [ 34 | "//third_party/fuchsia/sdk/$host_os-amd64/pkg/fdio", 35 | "//third_party/fuchsia/sdk/$host_os-amd64/pkg/zx", 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /third_party/fuchsia/README.crashpad: -------------------------------------------------------------------------------- 1 | This directory is a placeholder for Fuchsia tools that will be downloaded by 2 | CIPD (https://github.com/luci/luci-go/tree/master/cipd). The CIPD update happens 3 | as part of gclient runhooks. 4 | -------------------------------------------------------------------------------- /third_party/fuchsia/runner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright 2018 The Crashpad Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | import os 18 | import sys 19 | 20 | os.execv(sys.argv[1], sys.argv[1:]) 21 | -------------------------------------------------------------------------------- /third_party/getopt/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2014 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | static_library("getopt") { 16 | sources = [ 17 | "getopt.cc", 18 | "getopt.h", 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /third_party/getopt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CRASHPAD_GETOPT_LIBRARY_FILES 2 | getopt.cc 3 | getopt.h 4 | ) 5 | 6 | add_library(crashpad_getopt OBJECT) 7 | target_sources(crashpad_getopt PRIVATE 8 | ${CRASHPAD_GETOPT_LIBRARY_FILES}) 9 | target_compile_features(crashpad_getopt PUBLIC cxx_std_14) 10 | target_include_directories(crashpad_getopt PUBLIC crashpad_getopt) 11 | 12 | -------------------------------------------------------------------------------- /third_party/getopt/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 1997 Gregory Pietsch 2 | 3 | [These files] are hereby placed in the public domain without restrictions. Just 4 | give the author credit, don't claim you wrote it or prevent anyone else from 5 | using it. 6 | -------------------------------------------------------------------------------- /third_party/getopt/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: Gregory Pietsch getopt 2 | Short Name: getopt 3 | URL: https://sourceware.org/ml/newlib/2005/msg00758.html 4 | License: Public domain 5 | License File: LICENSE 6 | Security Critical: no 7 | Shipped: yes 8 | 9 | Description: 10 | A public domain implementation of getopt. 11 | 12 | Local Modifications: 13 | - Minor compilation fixes applied for Windows. 14 | - NO_ARG, REQUIRED_ARG, and OPTIONAL_ARG were renamed to the more traditional 15 | no_argument, required_argument, and optional_argument for source 16 | compatibility with BSD and glibc getopt_long(). 17 | - Add copy of copyright (Public domain) to the top of both files for Chromium's 18 | checklicenses step. 19 | - Compiled as .cc, and wrapped in namespace crashpad. 20 | - memcmp() -> strncmp() in getopt.cc to make ASan happier about some string 21 | manipulation. 22 | -------------------------------------------------------------------------------- /third_party/googletest/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: Google Test 2 | Short Name: googletest 3 | URL: https://github.com/google/googletest/ 4 | Revision: See DEPS 5 | License: BSD 3-clause 6 | License File: googletest/googletest/LICENSE 7 | Security Critical: no 8 | Shipped: no 9 | 10 | Description: 11 | Google Test (Google C++ Testing Framework) is Google’s framework for writing C++ 12 | tests on a variety of platforms. It includes Google Mock, an extension for 13 | writing and using C++ mock classes. 14 | 15 | Local Modifications: 16 | None 17 | -------------------------------------------------------------------------------- /third_party/linux/README.crashpad: -------------------------------------------------------------------------------- 1 | This directory is a placeholder for Fuchsia tools that will be downloaded by 2 | CIPD (https://github.com/luci/luci-go/tree/master/cipd). The CIPD update happens 3 | as part of gclient runhooks. 4 | -------------------------------------------------------------------------------- /third_party/lss/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import("../../build/crashpad_buildconfig.gni") 16 | 17 | config("lss_config") { 18 | if (crashpad_is_in_chromium) { 19 | defines = [ "CRASHPAD_LSS_SOURCE_EXTERNAL" ] 20 | } else if (crashpad_is_in_fuchsia) { 21 | defines = [ "CRASHPAD_LSS_SOURCE_FUCHSIA" ] 22 | } else { 23 | defines = [ "CRASHPAD_LSS_SOURCE_EMBEDDED" ] 24 | } 25 | } 26 | 27 | source_set("lss") { 28 | public_configs = [ ":lss_config" ] 29 | 30 | sources = [ "lss.h" ] 31 | } 32 | -------------------------------------------------------------------------------- /third_party/lss/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: linux-syscall-support 2 | Short Name: lss 3 | URL: https://chromium.googlesource.com/linux-syscall-support/ 4 | Revision: See DEPS 5 | License: BSD 3-clause 6 | License File: lss/linux_syscall_support.h 7 | Security Critical: yes 8 | Shipped: yes 9 | 10 | Description: 11 | Every so often, projects need to directly embed Linux system calls instead of 12 | calling the implementations in the system runtime library. This project 13 | provides a header file that can be included into your application whenever you 14 | need to make direct system calls. 15 | 16 | Local Modifications: 17 | None. 18 | -------------------------------------------------------------------------------- /third_party/lss/lss.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_THIRD_PARTY_LSS_LSS_H_ 16 | #define CRASHPAD_THIRD_PARTY_LSS_LSS_H_ 17 | 18 | #if defined(CRASHPAD_LSS_SOURCE_EXTERNAL) 19 | #include "third_party/lss/linux_syscall_support.h" 20 | #elif defined(CRASHPAD_LSS_SOURCE_EMBEDDED) 21 | #include "third_party/lss/lss/linux_syscall_support.h" 22 | #elif defined(CRASHPAD_LSS_SOURCE_FUCHSIA) 23 | #include "../../../../../third_party/linux-syscall-support/src/linux_syscall_support.h" 24 | #else 25 | #error Unknown lss source 26 | #endif 27 | 28 | #endif // CRASHPAD_THIRD_PARTY_LSS_LSS_H_ 29 | -------------------------------------------------------------------------------- /third_party/mini_chromium/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: mini_chromium 2 | Short Name: mini_chromium 3 | URL: https://chromium.googlesource.com/chromium/mini_chromium/ 4 | Revision: See DEPS 5 | License: BSD 3-clause 6 | License File: mini_chromium/LICENSE 7 | Security Critical: yes 8 | Shipped in Chromium: no 9 | 10 | Description: 11 | mini_chromium is a small collection of useful low-level (“base”) routines from 12 | the Chromium open-source project at https://www.chromium.org/Home. Chromium is 13 | large, sprawling, full of dependencies, and a web browser. mini_chromium is 14 | small, self-contained, and a library. mini_chromium is especially useful as a 15 | dependency of other code that wishes to use Chromium’s base routines. 16 | 17 | Local Modifications: 18 | None 19 | -------------------------------------------------------------------------------- /third_party/ninja/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: ninja 2 | Short Name: ninja 3 | URL: https://github.com/ninja-build/ninja 4 | Revision: See the CIPD version in DEPS 5 | License: Apache License 2.0 6 | License File: https://github.com/ninja-build/ninja/blob/master/COPYING 7 | Security Critical: no 8 | Shipped: no 9 | 10 | Description: 11 | Ninja is a small build system with a focus on speed, and is used to build 12 | this project. 13 | 14 | The CIPD packages are built using the 3pp pipeline. 15 | https://chromium.googlesource.com/infra/infra/+/refs/heads/main/3pp/ninja/ 16 | 17 | Local Modifications: 18 | None 19 | -------------------------------------------------------------------------------- /third_party/ninja/ninja: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 2022 Google Inc. All rights reserved 4 | # Use of this source code is governed by a BSD-style license that can be 5 | # found in the LICENSE file. 6 | 7 | set -eu 8 | 9 | OS="$(uname -s)" 10 | THIS_DIR="$(dirname "${0}")" 11 | 12 | print_help() { 13 | cat <&2 14 | No ninja binary is available for this system. 15 | Try building your own binary by doing: 16 | cd ~ 17 | git clone https://github.com/ninja-build/ninja.git 18 | cd ninja && ./configure.py --bootstrap 19 | Then add ~/ninja/ to your PATH. 20 | EOF 21 | } 22 | 23 | case "${OS}" in 24 | Linux) 25 | exec "${THIS_DIR}/linux/ninja" "$@";; 26 | Darwin) 27 | ARCH="$(uname -m)" 28 | case "${ARCH}" in 29 | x86_64) 30 | exec "${THIS_DIR}/mac-amd64/ninja" "$@";; 31 | arm64) 32 | exec "${THIS_DIR}/mac-arm64/ninja" "$@";; 33 | *) 34 | echo "Unsupported architecture ${ARCH}" >&2 35 | print_help 36 | exit 1;; 37 | esac 38 | ;; 39 | *) 40 | echo "Unsupported OS ${OS}" >&2 41 | print_help 42 | exit 1;; 43 | esac 44 | -------------------------------------------------------------------------------- /third_party/xnu/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | source_set("xnu") { 16 | sources = [ "EXTERNAL_HEADERS/mach-o/loader.h" ] 17 | } 18 | -------------------------------------------------------------------------------- /third_party/xnu/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: XNU 2 | Short Name: xnu 3 | URL: https://github.com/apple-oss-distributions/xnu/ 4 | Version: 6153.11.26 (from macOS 10.15.0) 5 | Revision: a5e7219620fa69943647714baaf632196f37249e 6 | License: APSL 2.0 7 | License File: APPLE_LICENSE 8 | Security Critical: no 9 | Shipped: yes 10 | 11 | Description: 12 | XNU is the operating system kernel used on macOS and other Apple systems. 13 | 14 | Local Modifications: 15 | - EXTERNAL_HEADERS/mach-o/loader.h is present. Its #includes of 16 | and have been 17 | commented out as unnecessary. Note that its #includes of and 18 | have been retained but these headers have not been provided. 19 | External headers must be made available to provide the cpu_type_t, 20 | cpu_subtype_t, and vm_prot_t types. 21 | - osfmk/mach/exc.defs and osfmk/mach/mach_exc.defs are present, to fill in 22 | for and on iOS, where they are missing. 23 | The .defs files they depend on, , 24 | , and are also 25 | included. 26 | - Anything not listed above is omitted. 27 | -------------------------------------------------------------------------------- /third_party/zlib/README.crashpad: -------------------------------------------------------------------------------- 1 | Name: zlib 2 | Short Name: zlib 3 | URL: https://zlib.net/ 4 | Revision: See zlib/README.chromium 5 | License: zlib 6 | License File: zlib/LICENSE 7 | Security Critical: yes 8 | Shipped: yes 9 | 10 | Description: 11 | “A massively spiffy yet delicately unobtrusive compression library.” 12 | 13 | zlib is a free, general-purpose, legally unencumbered lossless data-compression 14 | library. zlib implements the “deflate” compression algorithm described by RFC 15 | 1951, which combines the LZ77 (Lempel-Ziv) algorithm with Huffman coding. zlib 16 | also implements the zlib (RFC 1950) and gzip (RFC 1952) wrapper formats. 17 | 18 | Local Modifications: 19 | See zlib/README.chromium. 20 | -------------------------------------------------------------------------------- /third_party/zlib/zlib_crashpad.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_THIRD_PARTY_ZLIB_ZLIB_CRASHPAD_H_ 16 | #define CRASHPAD_THIRD_PARTY_ZLIB_ZLIB_CRASHPAD_H_ 17 | 18 | // #include this file instead of the system version of or equivalent 19 | // available at any other location in the source tree. It will #include the 20 | // proper depending on how the build has been configured. 21 | 22 | #if defined(CRASHPAD_ZLIB_SOURCE_SYSTEM) || \ 23 | defined(CRASHPAD_ZLIB_SOURCE_EXTERNAL) || \ 24 | defined(CRASHPAD_ZLIB_SOURCE_EXTERNAL_WITH_EMBEDDED_BUILD) 25 | #include 26 | #elif defined(CRASHPAD_ZLIB_SOURCE_EMBEDDED) 27 | #include "third_party/zlib/zlib/zlib.h" 28 | #else 29 | #error Unknown zlib source 30 | #endif 31 | 32 | #endif // CRASHPAD_THIRD_PARTY_ZLIB_ZLIB_CRASHPAD_H_ 33 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CRASHPAD_TOOLS_LIBRARY_FILES 2 | ./tool_support.cc 3 | ./tool_support.h 4 | ) 5 | 6 | add_library(tools OBJECT ${CRASHPAD_TOOLS_LIBRARY_FILES}) 7 | target_compile_features(tools PUBLIC cxx_std_14) 8 | 9 | target_include_directories(tools PUBLIC ..) 10 | target_link_libraries(tools PUBLIC mini_chromium backtrace_common util compat snapshot) 11 | -------------------------------------------------------------------------------- /tools/mac/sectaskaccess_info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleInfoDictionaryVersion 6 | 6.0 7 | SecTaskAccess 8 | 9 | allowed 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /util/backtrace/android_cert_store.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Sauce Labs. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "base/files/file_path.h" 18 | #include "util/misc/uuid.h" 19 | 20 | namespace crashpad { 21 | namespace backtrace { 22 | namespace android_cert_store { 23 | 24 | enum class create_result { 25 | success, 26 | failure, 27 | already_exists, 28 | }; 29 | 30 | create_result create(const base::FilePath& database); 31 | 32 | } // android_cert_store 33 | } // backtrace 34 | } // crashpad 35 | -------------------------------------------------------------------------------- /util/backtrace/crash_loop_detection.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Sauce Labs. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "base/files/file_path.h" 18 | #include "util/misc/uuid.h" 19 | 20 | namespace crashpad { 21 | namespace backtrace { 22 | namespace crash_loop_detection { 23 | 24 | static constexpr int crash_loop_detection_max_entries = 10; 25 | 26 | bool CrashLoopDetectionAppend(const base::FilePath& database, 27 | UUID uuid, 28 | int max_entries = crash_loop_detection_max_entries); 29 | 30 | bool CrashLoopDetectionSetCrashed(const base::FilePath& database, UUID uuid); 31 | 32 | int ConsecutiveCrashesCount(const base::FilePath& database); 33 | 34 | } // crash_loop_detection 35 | } // backtrace 36 | } // crashpad 37 | -------------------------------------------------------------------------------- /util/file/file_helper.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/file/file_helper.h" 16 | 17 | namespace crashpad { 18 | 19 | void CopyFileContent(FileReaderInterface* file_reader, 20 | FileWriterInterface* file_writer) { 21 | char buf[4096]; 22 | FileOperationResult read_result; 23 | do { 24 | read_result = file_reader->Read(buf, sizeof(buf)); 25 | if (read_result < 0) { 26 | break; 27 | } 28 | if (read_result > 0 && !file_writer->Write(buf, read_result)) { 29 | break; 30 | } 31 | } while (read_result > 0); 32 | } 33 | 34 | } // namespace crashpad 35 | -------------------------------------------------------------------------------- /util/file/file_helper.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_FILE_FILE_HELPER_H_ 16 | #define CRASHPAD_UTIL_FILE_FILE_HELPER_H_ 17 | 18 | #include "util/file/file_reader.h" 19 | #include "util/file/file_writer.h" 20 | 21 | namespace crashpad { 22 | 23 | //! \brief Copy the file content from file_reader to file_writer 24 | void CopyFileContent(FileReaderInterface* file_reader, 25 | FileWriterInterface* file_writer); 26 | 27 | } // namespace crashpad 28 | 29 | #endif // CRASHPAD_UTIL_FILE_FILE_HELPER_H_ 30 | -------------------------------------------------------------------------------- /util/file/file_seeker.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/file/file_seeker.h" 16 | 17 | #include "base/logging.h" 18 | 19 | namespace crashpad { 20 | 21 | FileOffset FileSeekerInterface::SeekGet() { 22 | return Seek(0, SEEK_CUR); 23 | } 24 | 25 | bool FileSeekerInterface::SeekSet(FileOffset offset) { 26 | FileOffset rv = Seek(offset, SEEK_SET); 27 | if (rv < 0) { 28 | // Seek() will have logged its own error. 29 | return false; 30 | } else if (rv != offset) { 31 | LOG(ERROR) << "SeekSet(): expected " << offset << ", observed " << rv; 32 | return false; 33 | } 34 | return true; 35 | } 36 | 37 | } // namespace crashpad 38 | -------------------------------------------------------------------------------- /util/file/scoped_remove_file.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/file/scoped_remove_file.h" 16 | 17 | #include "util/file/filesystem.h" 18 | 19 | namespace crashpad { 20 | 21 | void ScopedRemoveFileTraits::Free(const base::FilePath& path) { 22 | LoggingRemoveFile(path); 23 | } 24 | 25 | } // namespace crashpad 26 | -------------------------------------------------------------------------------- /util/file/scoped_remove_file.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_FILE_SCOPED_REMOVE_FILE_H_ 16 | #define CRASHPAD_UTIL_FILE_SCOPED_REMOVE_FILE_H_ 17 | 18 | #include "base/files/file_path.h" 19 | #include "base/scoped_generic.h" 20 | 21 | namespace crashpad { 22 | 23 | struct ScopedRemoveFileTraits { 24 | static base::FilePath InvalidValue() { return base::FilePath(); } 25 | static void Free(const base::FilePath& path); 26 | }; 27 | 28 | using ScopedRemoveFile = 29 | base::ScopedGeneric; 30 | 31 | } // namespace crashpad 32 | 33 | #endif // CRASHPAD_UTIL_FILE_SCOPED_REMOVE_FILE_H_ 34 | -------------------------------------------------------------------------------- /util/fuchsia/traits.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_FUCHSIA_TRAITS_H_ 16 | #define CRASHPAD_UTIL_FUCHSIA_TRAITS_H_ 17 | 18 | #include 19 | 20 | namespace crashpad { 21 | 22 | struct Traits32 { 23 | using Address = uint32_t; 24 | }; 25 | 26 | struct Traits64 { 27 | using Address = uint64_t; 28 | }; 29 | 30 | } // namespace crashpad 31 | 32 | #endif // CRASHPAD_UTIL_FUCHSIA_TRAITS_H_ 33 | -------------------------------------------------------------------------------- /util/ios/ios_intermediate_dump_list.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/ios/ios_intermediate_dump_list.h" 16 | 17 | namespace crashpad { 18 | namespace internal { 19 | 20 | IOSIntermediateDumpList::IOSIntermediateDumpList() : list_() {} 21 | 22 | IOSIntermediateDumpList::~IOSIntermediateDumpList() {} 23 | 24 | IOSIntermediateDumpObject::Type IOSIntermediateDumpList::GetType() const { 25 | return Type::kList; 26 | } 27 | 28 | } // namespace internal 29 | } // namespace crashpad 30 | -------------------------------------------------------------------------------- /util/ios/ios_intermediate_dump_object.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/ios/ios_intermediate_dump_object.h" 16 | 17 | namespace crashpad { 18 | namespace internal { 19 | 20 | IOSIntermediateDumpObject::IOSIntermediateDumpObject() = default; 21 | 22 | IOSIntermediateDumpObject::~IOSIntermediateDumpObject() {} 23 | 24 | } // namespace internal 25 | } // namespace crashpad 26 | -------------------------------------------------------------------------------- /util/linux/address_types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_LINUX_ADDRESS_TYPES_H_ 16 | #define CRASHPAD_UTIL_LINUX_ADDRESS_TYPES_H_ 17 | 18 | #include 19 | 20 | namespace crashpad { 21 | 22 | //! \brief Type used to represent an address in a process, potentially across 23 | //! bitness. 24 | using LinuxVMAddress = uint64_t; 25 | 26 | //! \brief Type used to represent the size of a memory range (with a 27 | //! LinuxVMAddress), potentially across bitness. 28 | using LinuxVMSize = uint64_t; 29 | 30 | //! \brief Type used to represent an offset from a LinuxVMAddress, potentially 31 | //! across bitness. 32 | using LinuxVMOffset = int64_t; 33 | 34 | } // namespace crashpad 35 | 36 | #endif // CRASHPAD_UTIL_LINUX_ADDRESS_TYPES_H_ 37 | -------------------------------------------------------------------------------- /util/linux/exception_handler_protocol.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/linux/exception_handler_protocol.h" 16 | 17 | #include "build/build_config.h" 18 | 19 | namespace crashpad { 20 | 21 | ExceptionHandlerProtocol::ClientInformation::ClientInformation() 22 | : exception_information_address(0), 23 | sanitization_information_address(0) 24 | #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) 25 | , 26 | crash_loop_before_time(0) 27 | #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) 28 | { 29 | } 30 | 31 | ExceptionHandlerProtocol::ClientToServerMessage::ClientToServerMessage() 32 | : version(kVersion), 33 | type(kTypeCrashDumpRequest), 34 | requesting_thread_stack_address(0), 35 | client_info() {} 36 | 37 | } // namespace crashpad 38 | -------------------------------------------------------------------------------- /util/linux/pac_helper.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_LINUX_PAC_HELPER_H_ 16 | #define CRASHPAD_UTIL_LINUX_PAC_HELPER_H_ 17 | 18 | #include "util/misc/address_types.h" 19 | 20 | namespace crashpad { 21 | 22 | //! \brief Strips PAC bits from an address 23 | VMAddress StripPACBits(VMAddress address); 24 | 25 | } // namespace crashpad 26 | 27 | 28 | #endif // CRASHPAD_UTIL_LINUX_PAC_HELPER_H_ 29 | 30 | -------------------------------------------------------------------------------- /util/linux/proc_task_reader.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_LINUX_PROC_TASK_READER_H_ 16 | #define CRASHPAD_UTIL_LINUX_PROC_TASK_READER_H_ 17 | 18 | #include 19 | 20 | #include 21 | 22 | namespace crashpad { 23 | 24 | //! \brief Enumerates the thread IDs of a process by reading 25 | //! /proc/pid/task. 26 | //! 27 | //! \param[in] pid The process ID for which to read thread IDs. 28 | //! \param[out] tids The read thread IDs. 29 | //! \return `true` if the task directory was successfully read. Format errors 30 | //! are logged, but won't cause this function to return `false`. 31 | bool ReadThreadIDs(pid_t pid, std::vector* tids); 32 | 33 | } // namespace crashpad 34 | 35 | #endif // CRASHPAD_UTIL_LINUX_PROC_TASK_READER_H_ 36 | -------------------------------------------------------------------------------- /util/linux/scoped_pr_set_ptracer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/linux/scoped_pr_set_ptracer.h" 16 | 17 | #include 18 | #include 19 | 20 | #include "base/logging.h" 21 | 22 | namespace crashpad { 23 | 24 | ScopedPrSetPtracer::ScopedPrSetPtracer(pid_t pid, bool may_log) 25 | : success_(false), may_log_(may_log) { 26 | success_ = prctl(PR_SET_PTRACER, pid, 0, 0, 0) == 0; 27 | PLOG_IF(ERROR, !success_ && may_log && errno != EINVAL) << "prctl"; 28 | } 29 | 30 | ScopedPrSetPtracer::~ScopedPrSetPtracer() { 31 | if (success_) { 32 | int res = prctl(PR_SET_PTRACER, 0, 0, 0, 0); 33 | PLOG_IF(ERROR, res != 0 && may_log_) << "prctl"; 34 | } 35 | } 36 | 37 | } // namespace crashpad 38 | -------------------------------------------------------------------------------- /util/linux/thread_info.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/linux/thread_info.h" 16 | 17 | #include 18 | 19 | namespace crashpad { 20 | 21 | ThreadContext::ThreadContext() { 22 | memset(this, 0, sizeof(*this)); 23 | } 24 | 25 | ThreadContext::~ThreadContext() {} 26 | 27 | FloatContext::FloatContext() { 28 | memset(this, 0, sizeof(*this)); 29 | } 30 | 31 | FloatContext::~FloatContext() {} 32 | 33 | ThreadInfo::ThreadInfo() 34 | : thread_context(), float_context(), thread_specific_data_address(0) {} 35 | 36 | ThreadInfo::~ThreadInfo() {} 37 | 38 | } // namespace crashpad 39 | -------------------------------------------------------------------------------- /util/mac/sysctl_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/mac/sysctl.h" 16 | 17 | #include "gtest/gtest.h" 18 | 19 | namespace crashpad { 20 | namespace test { 21 | namespace { 22 | 23 | TEST(Sysctl, ReadStringSysctlByName) { 24 | // kern.ostype is always provided by the kernel, and it’s a constant across 25 | // all versions, so it makes for a good test. 26 | EXPECT_EQ(ReadStringSysctlByName("kern.ostype", true), "Darwin"); 27 | 28 | // Names expected to not exist. 29 | EXPECT_TRUE(ReadStringSysctlByName("kern.scheisskopf", true).empty()); 30 | EXPECT_TRUE(ReadStringSysctlByName("kern.sanders", false).empty()); 31 | } 32 | 33 | } // namespace 34 | } // namespace test 35 | } // namespace crashpad 36 | -------------------------------------------------------------------------------- /util/mach/child_port_types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_MACH_CHILD_PORT_TYPES_H_ 16 | #define CRASHPAD_UTIL_MACH_CHILD_PORT_TYPES_H_ 17 | 18 | #include 19 | #include 20 | 21 | // This file is #included by C (non-C++) files, and must remain strictly C. 22 | 23 | typedef mach_port_t child_port_server_t; 24 | typedef uint64_t child_port_token_t; 25 | 26 | #endif // CRASHPAD_UTIL_MACH_CHILD_PORT_TYPES_H_ 27 | -------------------------------------------------------------------------------- /util/mach/scoped_task_suspend.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/mach/scoped_task_suspend.h" 16 | 17 | #include "base/apple/mach_logging.h" 18 | #include "base/check_op.h" 19 | #include "base/logging.h" 20 | 21 | namespace crashpad { 22 | 23 | ScopedTaskSuspend::ScopedTaskSuspend(task_t task) : task_(task) { 24 | DCHECK_NE(task_, mach_task_self()); 25 | 26 | kern_return_t kr = task_suspend(task_); 27 | if (kr != KERN_SUCCESS) { 28 | task_ = TASK_NULL; 29 | MACH_LOG(ERROR, kr) << "task_suspend"; 30 | } 31 | } 32 | 33 | ScopedTaskSuspend::~ScopedTaskSuspend() { 34 | if (task_ != TASK_NULL) { 35 | kern_return_t kr = task_resume(task_); 36 | MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr) << "task_resume"; 37 | } 38 | } 39 | 40 | } // namespace crashpad 41 | -------------------------------------------------------------------------------- /util/misc/address_sanitizer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_MISC_ADDRESS_SANITIZER_H_ 16 | #define CRASHPAD_UTIL_MISC_ADDRESS_SANITIZER_H_ 17 | 18 | #include "base/compiler_specific.h" 19 | #include "build/build_config.h" 20 | 21 | #if !defined(ADDRESS_SANITIZER) 22 | #if HAS_FEATURE(address_sanitizer) || \ 23 | (defined(COMPILER_GCC) && defined(__SANITIZE_ADDRESS__)) 24 | #define ADDRESS_SANITIZER 1 25 | #endif 26 | #endif // !defined(ADDRESS_SANITIZER) 27 | 28 | #endif // CRASHPAD_UTIL_MISC_ADDRESS_SANITIZER_H_ 29 | -------------------------------------------------------------------------------- /util/misc/as_underlying_type.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_MISC_AS_UNDERLYING_TYPE_H_ 16 | #define CRASHPAD_UTIL_MISC_AS_UNDERLYING_TYPE_H_ 17 | 18 | #include 19 | 20 | namespace crashpad { 21 | 22 | //! \brief Casts a value to its underlying type. 23 | //! 24 | //! \param[in] from The value to be casted. 25 | //! \return \a from casted to its underlying type. 26 | template 27 | constexpr typename std::underlying_type::type AsUnderlyingType( 28 | From from) { 29 | return static_cast::type>(from); 30 | } 31 | 32 | } // namespace crashpad 33 | 34 | #endif // CRASHPAD_UTIL_MISC_AS_UNDERLYING_TYPE_H_ 35 | -------------------------------------------------------------------------------- /util/misc/capture_context_win_arm64.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/util/misc/capture_context_win_arm64.obj -------------------------------------------------------------------------------- /util/misc/clock_mac.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/clock.h" 16 | 17 | #include 18 | 19 | namespace crashpad { 20 | 21 | uint64_t ClockMonotonicNanoseconds() { 22 | return clock_gettime_nsec_np(CLOCK_UPTIME_RAW); 23 | } 24 | 25 | } // namespace crashpad 26 | -------------------------------------------------------------------------------- /util/misc/initialization_state_dcheck.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/initialization_state_dcheck.h" 16 | 17 | namespace crashpad { 18 | 19 | #if DCHECK_IS_ON() 20 | 21 | InitializationStateDcheck::State InitializationStateDcheck::SetInitializing() { 22 | State old_state = state(); 23 | if (old_state == kStateUninitialized) { 24 | set_invalid(); 25 | } 26 | 27 | return old_state; 28 | } 29 | 30 | InitializationStateDcheck::State InitializationStateDcheck::SetValid() { 31 | State old_state = state(); 32 | if (old_state == kStateInvalid) { 33 | set_valid(); 34 | } 35 | 36 | return old_state; 37 | } 38 | 39 | #endif 40 | 41 | } // namespace crashpad 42 | -------------------------------------------------------------------------------- /util/misc/memory_sanitizer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_MISC_MEMORY_SANITIZER_H_ 16 | #define CRASHPAD_UTIL_MISC_MEMORY_SANITIZER_H_ 17 | 18 | #include "base/compiler_specific.h" 19 | #include "build/build_config.h" 20 | 21 | #if !defined(MEMORY_SANITIZER) 22 | #if HAS_FEATURE(memory_sanitizer) 23 | #define MEMORY_SANITIZER 1 24 | #endif // HAS_FEATURE(memory_sanitizer) 25 | #endif // !defined(MEMORY_SANITIZER) 26 | 27 | #endif // CRASHPAD_UTIL_MISC_MEMORY_SANITIZER_H_ 28 | -------------------------------------------------------------------------------- /util/misc/paths_fuchsia.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/paths.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | namespace crashpad { 23 | 24 | // static 25 | bool Paths::Executable(base::FilePath* path) { 26 | // Assume the environment has been set up following 27 | // https://fuchsia.googlesource.com/docs/+/master/the-book/namespaces.md#typical-directory-structure 28 | // . 29 | *path = base::FilePath("/pkg/bin/app"); 30 | return true; 31 | } 32 | 33 | } // namespace crashpad 34 | -------------------------------------------------------------------------------- /util/misc/paths_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/paths.h" 16 | 17 | #include "base/files/file_path.h" 18 | #include "gtest/gtest.h" 19 | #include "test/test_paths.h" 20 | 21 | namespace crashpad { 22 | namespace test { 23 | namespace { 24 | 25 | TEST(Paths, Executable) { 26 | base::FilePath executable_path; 27 | ASSERT_TRUE(Paths::Executable(&executable_path)); 28 | const base::FilePath executable_name(executable_path.BaseName()); 29 | const base::FilePath expected_name(TestPaths::ExpectedExecutableBasename( 30 | FILE_PATH_LITERAL("crashpad_util_test"))); 31 | 32 | EXPECT_EQ(executable_name.value(), expected_name.value()); 33 | } 34 | 35 | } // namespace 36 | } // namespace test 37 | } // namespace crashpad 38 | -------------------------------------------------------------------------------- /util/misc/paths_win.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/paths.h" 16 | 17 | #include 18 | 19 | #include 20 | 21 | #include "base/logging.h" 22 | 23 | namespace crashpad { 24 | 25 | // static 26 | bool Paths::Executable(base::FilePath* path) { 27 | wchar_t executable_path[_MAX_PATH]; 28 | unsigned int len = GetModuleFileName( 29 | nullptr, executable_path, static_cast(std::size(executable_path))); 30 | if (len == 0) { 31 | PLOG(ERROR) << "GetModuleFileName"; 32 | return false; 33 | } else if (len >= std::size(executable_path)) { 34 | LOG(ERROR) << "GetModuleFileName"; 35 | return false; 36 | } 37 | 38 | *path = base::FilePath(executable_path); 39 | return true; 40 | } 41 | 42 | } // namespace crashpad 43 | -------------------------------------------------------------------------------- /util/misc/pdb_structures.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/pdb_structures.h" 16 | 17 | namespace crashpad { 18 | 19 | const uint32_t CodeViewRecordPDB20::kSignature; 20 | const uint32_t CodeViewRecordPDB70::kSignature; 21 | const uint32_t CodeViewRecordBuildID::kSignature; 22 | 23 | } // namespace crashpad 24 | -------------------------------------------------------------------------------- /util/misc/random_string.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/random_string.h" 16 | 17 | #include "base/rand_util.h" 18 | 19 | namespace crashpad { 20 | 21 | std::string RandomString() { 22 | std::string random_string; 23 | for (int index = 0; index < 16; ++index) { 24 | random_string.append(1, static_cast(base::RandInt('A', 'Z'))); 25 | } 26 | return random_string; 27 | } 28 | 29 | } // namespace crashpad 30 | -------------------------------------------------------------------------------- /util/misc/random_string.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_MISC_RANDOM_STRING_H_ 16 | #define CRASHPAD_UTIL_MISC_RANDOM_STRING_H_ 17 | 18 | #include 19 | 20 | namespace crashpad { 21 | 22 | //! \brief Returns a random string. 23 | //! 24 | //! The string consists of 16 uppercase characters chosen at random. The 25 | //! returned string has over 75 bits of randomness (2616 > 26 | //! 275). 27 | std::string RandomString(); 28 | 29 | } // namespace crashpad 30 | 31 | #endif // CRASHPAD_UTIL_MISC_RANDOM_STRING_H_ 32 | -------------------------------------------------------------------------------- /util/misc/scoped_forbid_return.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/scoped_forbid_return.h" 16 | 17 | #include "base/logging.h" 18 | 19 | namespace crashpad { 20 | 21 | ScopedForbidReturn::~ScopedForbidReturn() { 22 | if (armed_) { 23 | LOG(FATAL) << "attempt to exit scope forbidden"; 24 | } 25 | } 26 | 27 | } // namespace crashpad 28 | -------------------------------------------------------------------------------- /util/misc/time_linux.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/time.h" 16 | 17 | #include "base/logging.h" 18 | 19 | namespace crashpad { 20 | 21 | bool GetBootTime(timespec* boot_time) { 22 | timespec uptime; 23 | if (clock_gettime(CLOCK_BOOTTIME, &uptime) != 0) { 24 | PLOG(ERROR) << "clock_gettime"; 25 | return false; 26 | } 27 | 28 | timespec current_time; 29 | if (clock_gettime(CLOCK_REALTIME, ¤t_time) != 0) { 30 | PLOG(ERROR) << "clock_gettime"; 31 | return false; 32 | } 33 | 34 | SubtractTimespec(current_time, uptime, boot_time); 35 | return true; 36 | } 37 | 38 | } // namespace crashpad 39 | -------------------------------------------------------------------------------- /util/misc/zlib.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/misc/zlib.h" 16 | 17 | #include 18 | 19 | #include "base/check.h" 20 | #include "base/strings/stringprintf.h" 21 | #include "third_party/zlib/zlib_crashpad.h" 22 | 23 | namespace crashpad { 24 | 25 | int ZlibWindowBitsWithGzipWrapper(int window_bits) { 26 | // See the documentation for deflateInit2() and inflateInit2() in . 0 27 | // is only valid during decompression. 28 | 29 | DCHECK(window_bits == 0 || (window_bits >= 8 && window_bits <= 15)) 30 | << window_bits; 31 | 32 | return 16 + window_bits; 33 | } 34 | 35 | std::string ZlibErrorString(int zr) { 36 | return base::StringPrintf("%s (%d)", zError(zr), zr); 37 | } 38 | 39 | } // namespace crashpad 40 | -------------------------------------------------------------------------------- /util/net/http_headers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_NET_HTTP_HEADERS_H_ 16 | #define CRASHPAD_UTIL_NET_HTTP_HEADERS_H_ 17 | 18 | #include 19 | #include 20 | 21 | namespace crashpad { 22 | 23 | //! \brief A map of HTTP header fields to their values. 24 | using HTTPHeaders = std::map; 25 | 26 | //! \brief The header name `"Content-Type"`. 27 | constexpr char kContentType[] = "Content-Type"; 28 | 29 | //! \brief The header name `"Content-Length"`. 30 | constexpr char kContentLength[] = "Content-Length"; 31 | 32 | //! \brief The header name `"Content-Encoding"`. 33 | constexpr char kContentEncoding[] = "Content-Encoding"; 34 | 35 | } // namespace crashpad 36 | 37 | #endif // CRASHPAD_UTIL_NET_HTTP_HEADERS_H_ 38 | -------------------------------------------------------------------------------- /util/net/testdata/ascii_http_body.txt: -------------------------------------------------------------------------------- 1 | This is a test. 2 | -------------------------------------------------------------------------------- /util/net/testdata/binary_http_body.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backtrace-labs/crashpad/dcfbd00c3392367c5c21362aa9a4d3003246c5e4/util/net/testdata/binary_http_body.dat -------------------------------------------------------------------------------- /util/net/testdata/crashpad_util_test_cert.pem: -------------------------------------------------------------------------------- 1 | DO NOT EDIT: This file was auto-generated by ./util/net/generate_test_server_key.py 2 | 3 | -----BEGIN CERTIFICATE----- 4 | MIIDCDCCAfCgAwIBAgITF9h5BaPfzje590HrE1UF+f9PVDANBgkqhkiG9w0BAQsF 5 | ADAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwHhcNMTkxMDMwMjIyNDE4WhcNMjkxMDI3 6 | MjIyNDE4WjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUA 7 | A4IBDwAwggEKAoIBAQCrT0iXfixTPH6nBxgvCgiKkSTeVTSvfhcoUYA7yPZj/1XH 8 | VYfECoGyvFN4/5g/GL4c721XZmI92Twg2Oa3HksRY8VlNXGNwqbt+wftSLOz+dOE 9 | bsJ3+NsBtXuaIphFPA9u0h+yrplBtM/dxLTW5v8e3OuEMBXa+94dp4y78u21UkzM 10 | uWB66tduT7/f0S9P68XhksYwwwvCn5lu258wHKNM5mb4CTwOcUgyyprlS2FS3Fsx 11 | pIsg9wDfQy5rHINxcZGZZ8Ht4KOJ7egwhfiP4XEiLK6+5DZoOQtrkEUFfLL4i5sx 12 | +eOeD12GP+Dxs6KHYoejGftNx/7U0E2GVMWwWzstAgMBAAGjUzBRMB0GA1UdDgQW 13 | BBT8y2bnyty/YWcvzlE9JIAPG7/q4DAfBgNVHSMEGDAWgBT8y2bnyty/YWcvzlE9 14 | JIAPG7/q4DAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCF+R21 15 | Cd1fgITfhYJE7JAV3jLfact5h/2MP5UwgtODfZt2Idwxs8qqwPB0g7WQqEjrPfTv 16 | 6y90AEwr2L8e+wXGnTKtWelCqzztFGov4Hj+rd158eOmEo0IPGrx8dwqLQbw91uU 17 | cq4onf5iuHkOt99TmIqVYn2zaOHbOF2YYyU052X+9XE/Z5fhibX5THfEG3w0+XM6 18 | aKEGIM/MxfVaLA8yDXFxhDXHBrH+QAAXTQaC8exnp+po/psyJARD0sM509MeTdAv 19 | po9JyIzesNAsLW4I7kL8I5i8e+WN79lX2jgwaWMxPmHadYN3mtoltpmFM40oFN6q 20 | 8wjuU07eN/G79c3B 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /util/net/tls.gni: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Crashpad Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import("../../build/crashpad_buildconfig.gni") 16 | 17 | declare_args() { 18 | if (crashpad_is_fuchsia || crashpad_is_android) { 19 | crashpad_http_transport_impl = "socket" 20 | } else if (crashpad_is_linux) { 21 | crashpad_http_transport_impl = "libcurl" 22 | } else { 23 | crashpad_http_transport_impl = "" 24 | } 25 | 26 | # TODO(scottmg): https://crbug.com/crashpad/266 fuchsia:DX-690: BoringSSL 27 | # was removed from the Fuchsia SDK. Re-enable it when we have a way to acquire 28 | # a BoringSSL lib again. 29 | crashpad_use_boringssl_for_http_transport_socket = 30 | crashpad_is_in_fuchsia || (crashpad_is_linux && crashpad_is_in_chromium) 31 | } 32 | -------------------------------------------------------------------------------- /util/posix/scoped_dir.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/posix/scoped_dir.h" 16 | 17 | #include "base/logging.h" 18 | #include "base/posix/eintr_wrapper.h" 19 | 20 | namespace crashpad { 21 | namespace internal { 22 | 23 | void ScopedDIRCloseTraits::Free(DIR* dir) { 24 | if (dir && IGNORE_EINTR(closedir(dir)) != 0) { 25 | PLOG(ERROR) << "closedir"; 26 | } 27 | } 28 | 29 | } // namespace internal 30 | } // namespace crashpad 31 | -------------------------------------------------------------------------------- /util/posix/scoped_dir.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_POSIX_SCOPED_DIR_H_ 16 | #define CRASHPAD_UTIL_POSIX_SCOPED_DIR_H_ 17 | 18 | #include 19 | 20 | #include "base/scoped_generic.h" 21 | 22 | namespace crashpad { 23 | namespace internal { 24 | 25 | struct ScopedDIRCloseTraits { 26 | static DIR* InvalidValue() { return nullptr; } 27 | static void Free(DIR* dir); 28 | }; 29 | 30 | } // namespace internal 31 | 32 | //! \brief Maintains a directory opened by `opendir`. 33 | //! 34 | //! On destruction, the directory will be closed by calling `closedir`. 35 | using ScopedDIR = base::ScopedGeneric; 36 | 37 | } // namespace crashpad 38 | 39 | #endif // CRASHPAD_UTIL_POSIX_SCOPED_DIR_H_ 40 | -------------------------------------------------------------------------------- /util/stdlib/strlcpy.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/stdlib/strlcpy.h" 16 | 17 | #include 18 | 19 | namespace crashpad { 20 | 21 | size_t c16lcpy(char16_t* destination, const char16_t* source, size_t length) { 22 | size_t source_length = std::char_traits::length(source); 23 | if (source_length < length) { 24 | std::char_traits::copy(destination, source, source_length + 1); 25 | } else if (length != 0) { 26 | std::char_traits::copy(destination, source, length - 1); 27 | destination[length - 1] = '\0'; 28 | } 29 | return source_length; 30 | } 31 | 32 | } // namespace crashpad 33 | -------------------------------------------------------------------------------- /util/thread/stoppable.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_THREAD_STOPPABLE_H_ 16 | #define CRASHPAD_UTIL_THREAD_STOPPABLE_H_ 17 | 18 | 19 | namespace crashpad { 20 | 21 | //! \brief An interface for operations that may be Started and Stopped. 22 | class Stoppable { 23 | public: 24 | virtual ~Stoppable() = default; 25 | 26 | //! \brief Starts the operation. 27 | virtual void Start() = 0; 28 | 29 | //! \brief Stops the operation. 30 | virtual void Stop() = 0; 31 | 32 | protected: 33 | Stoppable() = default; 34 | }; 35 | 36 | } // namespace crashpad 37 | 38 | #endif // CRASHPAD_UTIL_THREAD_STOPPABLE_H_ 39 | -------------------------------------------------------------------------------- /util/thread/thread.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/thread/thread.h" 16 | 17 | #include "base/check.h" 18 | 19 | namespace crashpad { 20 | 21 | Thread::Thread() : platform_thread_(0) { 22 | } 23 | 24 | Thread::~Thread() { 25 | DCHECK(!platform_thread_); 26 | } 27 | 28 | } // namespace crashpad 29 | -------------------------------------------------------------------------------- /util/win/address_types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_WIN_ADDRESS_TYPES_H_ 16 | #define CRASHPAD_UTIL_WIN_ADDRESS_TYPES_H_ 17 | 18 | #include 19 | 20 | namespace crashpad { 21 | 22 | //! \brief Type used to represent an address in a process, potentially across 23 | //! bitness. 24 | using WinVMAddress = uint64_t; 25 | 26 | //! \brief Type used to represent the size of a memory range (with a 27 | //! WinVMAddress), potentially across bitness. 28 | using WinVMSize = uint64_t; 29 | 30 | } // namespace crashpad 31 | 32 | #endif // CRASHPAD_UTIL_WIN_ADDRESS_TYPES_H_ 33 | -------------------------------------------------------------------------------- /util/win/critical_section_with_debug_info_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/win/critical_section_with_debug_info.h" 16 | 17 | #include "gtest/gtest.h" 18 | 19 | namespace crashpad { 20 | namespace test { 21 | namespace { 22 | 23 | TEST(CriticalSectionWithDebugInfo, CriticalSectionWithDebugInfo) { 24 | CRITICAL_SECTION critical_section; 25 | ASSERT_TRUE( 26 | InitializeCriticalSectionWithDebugInfoIfPossible(&critical_section)); 27 | EnterCriticalSection(&critical_section); 28 | LeaveCriticalSection(&critical_section); 29 | DeleteCriticalSection(&critical_section); 30 | } 31 | 32 | } // namespace 33 | } // namespace test 34 | } // namespace crashpad 35 | -------------------------------------------------------------------------------- /util/win/get_module_information.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/win/get_module_information.h" 16 | 17 | #include "util/win/get_function.h" 18 | 19 | namespace crashpad { 20 | 21 | BOOL CrashpadGetModuleInformation(HANDLE process, 22 | HMODULE module, 23 | MODULEINFO* module_info, 24 | DWORD cb) { 25 | #if PSAPI_VERSION == 1 26 | static const auto get_module_information = 27 | GET_FUNCTION_REQUIRED(L"psapi.dll", GetModuleInformation); 28 | return get_module_information(process, module, module_info, cb); 29 | #elif PSAPI_VERSION == 2 30 | return GetModuleInformation(process, module, module_info, cb); 31 | #endif 32 | } 33 | 34 | } // namespace crashpad 35 | -------------------------------------------------------------------------------- /util/win/get_module_information.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_WIN_GET_MODULE_INFORMATION_H_ 16 | #define CRASHPAD_UTIL_WIN_GET_MODULE_INFORMATION_H_ 17 | 18 | #include 19 | 20 | #ifndef PSAPI_VERSION 21 | #define PSAPI_VERSION 2 22 | #endif 23 | #include 24 | 25 | namespace crashpad { 26 | 27 | //! \brief Proxy function for `GetModuleInformation()`. 28 | BOOL CrashpadGetModuleInformation(HANDLE process, 29 | HMODULE module, 30 | MODULEINFO* module_info, 31 | DWORD cb); 32 | 33 | } // namespace crashpad 34 | 35 | #endif // CRASHPAD_UTIL_WIN_GET_MODULE_INFORMATION_H_ 36 | -------------------------------------------------------------------------------- /util/win/handle.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/win/handle.h" 16 | 17 | #include 18 | 19 | #include "base/numerics/safe_conversions.h" 20 | #include "util/misc/from_pointer_cast.h" 21 | 22 | namespace crashpad { 23 | 24 | // These functions use “int” for the 32-bit integer handle type because 25 | // sign-extension needs to work correctly. INVALID_HANDLE_VALUE is defined as 26 | // ((HANDLE)(LONG_PTR)-1), and this needs to round-trip through an integer and 27 | // back to the same HANDLE value. 28 | 29 | int HandleToInt(HANDLE handle) { 30 | return FromPointerCast(handle); 31 | } 32 | 33 | HANDLE IntToHandle(int handle_int) { 34 | return reinterpret_cast(static_cast(handle_int)); 35 | } 36 | 37 | } // namespace crashpad 38 | -------------------------------------------------------------------------------- /util/win/loader_lock.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_WIN_LOADER_LOCK_H_ 16 | #define CRASHPAD_UTIL_WIN_LOADER_LOCK_H_ 17 | 18 | namespace crashpad { 19 | 20 | //! \return `true` if the current thread holds the loader lock. 21 | bool IsThreadInLoaderLock(); 22 | 23 | } // namespace crashpad 24 | 25 | #endif // CRASHPAD_UTIL_WIN_LOADER_LOCK_H_ 26 | -------------------------------------------------------------------------------- /util/win/loader_lock_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/win/loader_lock.h" 16 | 17 | #include "gtest/gtest.h" 18 | #include "util/win/get_function.h" 19 | 20 | extern "C" bool LoaderLockDetected(); 21 | 22 | namespace crashpad { 23 | namespace test { 24 | namespace { 25 | 26 | TEST(LoaderLock, Detected) { 27 | EXPECT_FALSE(IsThreadInLoaderLock()); 28 | auto* loader_lock_detected = GET_FUNCTION_REQUIRED( 29 | L"crashpad_util_test_loader_lock_test.dll", LoaderLockDetected); 30 | EXPECT_TRUE(loader_lock_detected()); 31 | EXPECT_FALSE(IsThreadInLoaderLock()); 32 | } 33 | 34 | } // namespace 35 | } // namespace test 36 | } // namespace crashpad 37 | -------------------------------------------------------------------------------- /util/win/loader_lock_test_dll.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include "util/win/loader_lock.h" 18 | 19 | namespace { 20 | 21 | bool g_loader_lock_detected = false; 22 | 23 | } // namespace 24 | 25 | extern "C" { 26 | 27 | __declspec(dllexport) bool LoaderLockDetected() { 28 | return g_loader_lock_detected; 29 | } 30 | 31 | } // extern "C" 32 | 33 | BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID) { 34 | switch (reason) { 35 | case DLL_PROCESS_ATTACH: 36 | g_loader_lock_detected = crashpad::IsThreadInLoaderLock(); 37 | break; 38 | } 39 | 40 | return TRUE; 41 | } 42 | -------------------------------------------------------------------------------- /util/win/safe_terminate_process_test_child.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | int wmain(int argc, wchar_t** argv) { 20 | Sleep(INFINITE); 21 | return EXIT_FAILURE; 22 | } 23 | -------------------------------------------------------------------------------- /util/win/scoped_handle.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/win/scoped_handle.h" 16 | 17 | #include "base/check.h" 18 | #include "util/file/file_io.h" 19 | 20 | namespace crashpad { 21 | namespace internal { 22 | 23 | void ScopedFileHANDLECloseTraits::Free(HANDLE handle) { 24 | CheckedCloseFile(handle); 25 | } 26 | 27 | void ScopedKernelHANDLECloseTraits::Free(HANDLE handle) { 28 | PCHECK(CloseHandle(handle)) << "CloseHandle"; 29 | } 30 | 31 | void ScopedSearchHANDLECloseTraits::Free(HANDLE handle) { 32 | PCHECK(FindClose(handle)) << "FindClose"; 33 | } 34 | 35 | void ScopedVectoredExceptionRegistrationCloseTraits::Free(PVOID handle) { 36 | PCHECK(::RemoveVectoredExceptionHandler(handle)); 37 | } 38 | 39 | } // namespace internal 40 | } // namespace crashpad 41 | -------------------------------------------------------------------------------- /util/win/scoped_local_alloc.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/win/scoped_local_alloc.h" 16 | 17 | #include "base/logging.h" 18 | 19 | namespace crashpad { 20 | namespace internal { 21 | 22 | // static 23 | void LocalAllocTraits::Free(HLOCAL memory) { 24 | PLOG_IF(ERROR, LocalFree(memory) != nullptr) << "LocalFree"; 25 | } 26 | 27 | } // namespace internal 28 | } // namespace crashpad 29 | -------------------------------------------------------------------------------- /util/win/scoped_local_alloc.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_WIN_SCOPED_LOCAL_ALLOC_H_ 16 | #define CRASHPAD_UTIL_WIN_SCOPED_LOCAL_ALLOC_H_ 17 | 18 | #include 19 | 20 | #include "base/scoped_generic.h" 21 | 22 | namespace crashpad { 23 | 24 | namespace internal { 25 | 26 | struct LocalAllocTraits { 27 | static HLOCAL InvalidValue() { return nullptr; } 28 | static void Free(HLOCAL mem); 29 | }; 30 | 31 | } // namespace internal 32 | 33 | using ScopedLocalAlloc = 34 | base::ScopedGeneric; 35 | 36 | } // namespace crashpad 37 | 38 | #endif // CRASHPAD_UTIL_WIN_SCOPED_LOCAL_ALLOC_H_ 39 | -------------------------------------------------------------------------------- /util/win/scoped_registry_key.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_WIN_SCOPED_REGISTRY_KEY_H_ 16 | #define CRASHPAD_UTIL_WIN_SCOPED_REGISTRY_KEY_H_ 17 | 18 | #include 19 | 20 | #include "base/scoped_generic.h" 21 | 22 | namespace crashpad { 23 | 24 | struct ScopedRegistryKeyCloseTraits { 25 | static HKEY InvalidValue() { return nullptr; } 26 | static void Free(HKEY key) { RegCloseKey(key); } 27 | }; 28 | 29 | using ScopedRegistryKey = 30 | base::ScopedGeneric; 31 | 32 | } // namespace crashpad 33 | 34 | #endif // CRASHPAD_UTIL_WIN_SCOPED_REGISTRY_KEY_H_ 35 | -------------------------------------------------------------------------------- /util/win/scoped_set_event.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "util/win/scoped_set_event.h" 16 | 17 | #include "base/check.h" 18 | #include "base/logging.h" 19 | 20 | namespace crashpad { 21 | 22 | ScopedSetEvent::ScopedSetEvent(HANDLE event) : event_(event) { 23 | DCHECK(event_); 24 | } 25 | 26 | ScopedSetEvent::~ScopedSetEvent() { 27 | if (event_) { 28 | Set(); 29 | } 30 | } 31 | 32 | bool ScopedSetEvent::Set() { 33 | bool rv = !!SetEvent(event_); 34 | if (!rv) { 35 | PLOG(ERROR) << "SetEvent"; 36 | } 37 | event_ = nullptr; 38 | return rv; 39 | } 40 | 41 | } // namespace crashpad 42 | -------------------------------------------------------------------------------- /util/win/traits.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Crashpad Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CRASHPAD_UTIL_WIN_TRAITS_H_ 16 | #define CRASHPAD_UTIL_WIN_TRAITS_H_ 17 | 18 | #include 19 | 20 | namespace crashpad { 21 | 22 | struct Traits32 { 23 | using Address = DWORD; 24 | }; 25 | 26 | struct Traits64 { 27 | using Address = DWORD64; 28 | }; 29 | 30 | } // namespace crashpad 31 | 32 | #endif // CRASHPAD_UTIL_WIN_TRAITS_H_ 33 | --------------------------------------------------------------------------------