aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadaf Ebrahimi <sadafebrahimi@google.com>2023-08-22 03:33:37 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-08-22 03:33:37 +0000
commitfb7ac48ff29ea964d93c9fa1f98c368bdaab705d (patch)
tree8bac0eef29fb27b0f8ba28f8aaa4dc8400b43107
parentfe0b979764663486600861261cb885ba27aeb491 (diff)
parentd668033f29b32287c83ee25fac06f62372406dac (diff)
downloadgoogle-breakpad-master.tar.gz
Upgrade google-breakpad to 922d49bdfe3c92e5d35c406f87f2c354637a2f8b am: 8bac876145 am: c5a0c8e46e am: e6b2e13bd8 am: 0b812164b7 am: d668033f29HEADmastermain
Original change: https://android-review.googlesource.com/c/platform/external/google-breakpad/+/2720095 Change-Id: Id854c5af5285fdbb50be3ef10b35ac55d600f98e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--Android.bp2
-rw-r--r--DEPS2
-rw-r--r--METADATA4
-rw-r--r--Makefile.am96
-rw-r--r--Makefile.in642
-rw-r--r--aclocal.m429
-rwxr-xr-xconfigure349
-rw-r--r--configure.ac22
-rw-r--r--src/client/ios/exception_handler_no_mach.cc4
-rw-r--r--src/client/linux/crash_generation/crash_generation_client.cc12
-rw-r--r--src/client/linux/crash_generation/crash_generation_client.h11
-rw-r--r--src/client/linux/crash_generation/crash_generation_server.cc4
-rw-r--r--src/client/linux/dump_writer_common/thread_info.cc34
-rw-r--r--src/client/linux/dump_writer_common/ucontext_reader.cc32
-rw-r--r--src/client/linux/handler/exception_handler.cc4
-rw-r--r--src/client/linux/handler/exception_handler_unittest.cc4
-rw-r--r--src/client/linux/handler/minidump_descriptor.cc4
-rw-r--r--src/client/linux/log/log.cc4
-rw-r--r--src/client/linux/microdump_writer/microdump_writer.cc4
-rw-r--r--src/client/linux/microdump_writer/microdump_writer_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/cpu_set_unittest.cc64
-rw-r--r--src/client/linux/minidump_writer/directory_reader_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/line_reader_unittest.cc45
-rw-r--r--src/client/linux/minidump_writer/linux_core_dumper.cc4
-rw-r--r--src/client/linux/minidump_writer/linux_core_dumper_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/linux_dumper.cc8
-rw-r--r--src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc4
-rw-r--r--src/client/linux/minidump_writer/linux_ptrace_dumper.cc12
-rw-r--r--src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/minidump_writer.cc4
-rw-r--r--src/client/linux/minidump_writer/minidump_writer_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc4
-rw-r--r--src/client/linux/minidump_writer/pe_file.cc4
-rw-r--r--src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc60
-rw-r--r--src/client/linux/sender/google_crash_report_sender.cc4
-rw-r--r--src/client/mac/crash_generation/crash_generation_client.cc4
-rw-r--r--src/client/mac/crash_generation/crash_generation_server.cc4
-rw-r--r--src/client/mac/handler/breakpad_nlist_64.cc4
-rw-r--r--src/client/mac/handler/dynamic_images.cc4
-rw-r--r--src/client/mac/handler/exception_handler.cc4
-rw-r--r--src/client/mac/handler/minidump_generator.cc4
-rw-r--r--src/client/mac/handler/protected_memory_allocator.cc4
-rw-r--r--src/client/mac/handler/testcases/DynamicImagesTests.cc4
-rw-r--r--src/client/mac/handler/testcases/breakpad_nlist_test.cc4
-rw-r--r--src/client/mac/tests/crash_generation_server_test.cc4
-rw-r--r--src/client/mac/tests/exception_handler_test.cc4
-rw-r--r--src/client/mac/tests/minidump_generator_test.cc4
-rw-r--r--src/client/mac/tests/minidump_generator_test_helper.cc4
-rw-r--r--src/client/minidump_file_writer.cc4
-rw-r--r--src/client/minidump_file_writer_unittest.cc4
-rw-r--r--src/client/solaris/handler/exception_handler.cc4
-rw-r--r--src/client/solaris/handler/exception_handler_test.cc4
-rw-r--r--src/client/solaris/handler/minidump_generator.cc4
-rw-r--r--src/client/solaris/handler/minidump_test.cc4
-rw-r--r--src/client/solaris/handler/solaris_lwp.cc4
-rw-r--r--src/client/windows/crash_generation/client_info.cc4
-rw-r--r--src/client/windows/crash_generation/crash_generation_client.cc4
-rw-r--r--src/client/windows/crash_generation/crash_generation_server.cc4
-rw-r--r--src/client/windows/crash_generation/minidump_generator.cc4
-rw-r--r--src/client/windows/handler/exception_handler.cc4
-rw-r--r--src/client/windows/sender/crash_report_sender.cc4
-rw-r--r--src/client/windows/tests/crash_generation_app/abstract_class.cc4
-rw-r--r--src/client/windows/tests/crash_generation_app/crash_generation_app.cc4
-rw-r--r--src/client/windows/unittests/crash_generation_server_test.cc4
-rw-r--r--src/client/windows/unittests/dump_analysis.cc4
-rw-r--r--src/client/windows/unittests/exception_handler_death_test.cc4
-rw-r--r--src/client/windows/unittests/exception_handler_nesting_test.cc4
-rw-r--r--src/client/windows/unittests/exception_handler_test.cc4
-rw-r--r--src/client/windows/unittests/minidump_test.cc4
-rw-r--r--src/common/basictypes.h8
-rw-r--r--src/common/byte_cursor_unittest.cc4
-rw-r--r--src/common/convert_UTF.cc4
-rw-r--r--src/common/dwarf/bytereader.cc4
-rw-r--r--src/common/dwarf/bytereader_unittest.cc4
-rw-r--r--src/common/dwarf/cfi_assembler.cc4
-rw-r--r--src/common/dwarf/dwarf2diehandler.cc4
-rw-r--r--src/common/dwarf/dwarf2diehandler_unittest.cc4
-rw-r--r--src/common/dwarf/dwarf2enums.h6
-rw-r--r--src/common/dwarf/dwarf2reader.cc150
-rw-r--r--src/common/dwarf/dwarf2reader.h82
-rw-r--r--src/common/dwarf/dwarf2reader_cfi_unittest.cc4
-rw-r--r--src/common/dwarf/dwarf2reader_die_unittest.cc7
-rw-r--r--src/common/dwarf/dwarf2reader_lineinfo_unittest.cc4
-rw-r--r--src/common/dwarf/dwarf2reader_splitfunctions_unittest.cc4
-rw-r--r--src/common/dwarf/elf_reader.cc4
-rw-r--r--src/common/dwarf/functioninfo.cc4
-rw-r--r--src/common/dwarf_cfi_to_module.cc27
-rw-r--r--src/common/dwarf_cfi_to_module.h3
-rw-r--r--src/common/dwarf_cfi_to_module_unittest.cc16
-rw-r--r--src/common/dwarf_cu_to_module.cc91
-rw-r--r--src/common/dwarf_cu_to_module.h6
-rw-r--r--src/common/dwarf_cu_to_module_unittest.cc17
-rw-r--r--src/common/dwarf_line_to_module.cc4
-rw-r--r--src/common/dwarf_line_to_module_unittest.cc4
-rw-r--r--src/common/dwarf_range_list_handler.cc4
-rw-r--r--src/common/language.cc4
-rw-r--r--src/common/linux/breakpad_getcontext.h4
-rw-r--r--src/common/linux/breakpad_getcontext_unittest.cc4
-rw-r--r--src/common/linux/crc32.cc4
-rw-r--r--src/common/linux/dump_symbols.cc111
-rw-r--r--src/common/linux/dump_symbols_unittest.cc4
-rw-r--r--src/common/linux/elf_core_dump.cc4
-rw-r--r--src/common/linux/elf_core_dump_unittest.cc4
-rw-r--r--src/common/linux/elf_symbols_to_module.cc4
-rw-r--r--src/common/linux/elf_symbols_to_module_unittest.cc4
-rw-r--r--src/common/linux/elfutils.cc4
-rw-r--r--src/common/linux/file_id.cc4
-rw-r--r--src/common/linux/file_id_unittest.cc4
-rw-r--r--src/common/linux/google_crashdump_uploader.cc4
-rw-r--r--src/common/linux/google_crashdump_uploader_test.cc4
-rw-r--r--src/common/linux/guid_creator.cc2
-rw-r--r--src/common/linux/http_upload.cc4
-rw-r--r--src/common/linux/libcurl_wrapper.cc6
-rw-r--r--src/common/linux/linux_libc_support.cc4
-rw-r--r--src/common/linux/linux_libc_support_unittest.cc4
-rw-r--r--src/common/linux/memory_mapped_file.cc11
-rw-r--r--src/common/linux/memory_mapped_file.h7
-rw-r--r--src/common/linux/memory_mapped_file_unittest.cc4
-rw-r--r--src/common/linux/safe_readlink.cc4
-rw-r--r--src/common/linux/safe_readlink_unittest.cc4
-rw-r--r--src/common/linux/scoped_pipe.cc132
-rw-r--r--src/common/linux/scoped_pipe.h115
-rw-r--r--src/common/linux/scoped_pipe_unittest.cc75
-rw-r--r--src/common/linux/scoped_tmpfile.cc103
-rw-r--r--src/common/linux/scoped_tmpfile.h85
-rw-r--r--src/common/linux/scoped_tmpfile_unittest.cc50
-rw-r--r--src/common/linux/symbol_collector_client.cc4
-rw-r--r--src/common/linux/symbol_upload.cc4
-rw-r--r--src/common/linux/synth_elf.cc4
-rw-r--r--src/common/linux/synth_elf_unittest.cc4
-rw-r--r--src/common/linux/tests/auto_testfile.h123
-rw-r--r--src/common/linux/tests/crash_generator.cc4
-rw-r--r--src/common/long_string_dictionary.cc4
-rw-r--r--src/common/long_string_dictionary_unittest.cc4
-rw-r--r--src/common/mac/arch_utilities.cc256
-rw-r--r--src/common/mac/arch_utilities.h26
-rw-r--r--src/common/mac/bootstrap_compat.cc4
-rw-r--r--src/common/mac/dump_syms.cc201
-rw-r--r--src/common/mac/dump_syms.h56
-rw-r--r--src/common/mac/file_id.cc4
-rw-r--r--src/common/mac/launch_reporter.cc4
-rw-r--r--src/common/mac/macho_id.cc4
-rw-r--r--src/common/mac/macho_reader.cc4
-rw-r--r--src/common/mac/macho_reader_unittest.cc4
-rw-r--r--src/common/mac/macho_utilities.cc4
-rw-r--r--src/common/mac/macho_walker.cc13
-rw-r--r--src/common/mac/string_utilities.cc4
-rw-r--r--src/common/md5.cc4
-rw-r--r--src/common/memory_allocator_unittest.cc4
-rw-r--r--src/common/memory_range_unittest.cc4
-rw-r--r--src/common/module.cc36
-rw-r--r--src/common/module.h24
-rw-r--r--src/common/module_unittest.cc39
-rw-r--r--src/common/path_helper.cc4
-rw-r--r--src/common/safe_math_unittest.cc4
-rw-r--r--src/common/simple_string_dictionary.cc4
-rw-r--r--src/common/simple_string_dictionary.h8
-rw-r--r--src/common/simple_string_dictionary_unittest.cc4
-rw-r--r--src/common/solaris/dump_symbols.cc4
-rw-r--r--src/common/solaris/file_id.cc4
-rw-r--r--src/common/solaris/guid_creator.cc4
-rw-r--r--src/common/stabs_reader.cc4
-rw-r--r--src/common/stabs_reader.h4
-rw-r--r--src/common/stabs_reader_unittest.cc4
-rw-r--r--src/common/stabs_to_module.cc4
-rw-r--r--src/common/stabs_to_module_unittest.cc4
-rw-r--r--src/common/string_conversion.cc4
-rw-r--r--src/common/string_conversion_unittest.cc4
-rw-r--r--src/common/test_assembler.cc4
-rw-r--r--src/common/test_assembler_unittest.cc4
-rw-r--r--src/common/tests/file_utils.cc4
-rw-r--r--src/common/windows/dia_util.cc4
-rw-r--r--src/common/windows/guid_string.cc4
-rw-r--r--src/common/windows/http_upload.cc4
-rw-r--r--src/common/windows/omap.cc4
-rw-r--r--src/common/windows/omap_unittest.cc4
-rw-r--r--src/common/windows/pdb_source_line_writer.cc4
-rw-r--r--src/common/windows/pe_source_line_writer.cc4
-rw-r--r--src/common/windows/pe_source_line_writer.h7
-rw-r--r--src/common/windows/pe_util.cc4
-rw-r--r--src/common/windows/string_utils.cc4
-rw-r--r--src/common/windows/sym_upload_v2_protocol.cc4
-rw-r--r--src/common/windows/symbol_collector_client.cc4
-rw-r--r--src/config.h.in3
-rw-r--r--src/google_breakpad/common/minidump_cpu_amd64.h2
-rw-r--r--src/google_breakpad/common/minidump_cpu_riscv.h38
-rw-r--r--src/google_breakpad/common/minidump_exception_linux.h5
-rw-r--r--src/google_breakpad/common/minidump_format.h4
-rw-r--r--src/google_breakpad/processor/minidump.h191
-rw-r--r--src/google_breakpad/processor/minidump_processor.h20
-rw-r--r--src/processor/address_map_unittest.cc4
-rw-r--r--src/processor/basic_code_modules.cc4
-rw-r--r--src/processor/basic_source_line_resolver.cc4
-rw-r--r--src/processor/basic_source_line_resolver_unittest.cc4
-rw-r--r--src/processor/call_stack.cc4
-rw-r--r--src/processor/cfi_frame_info.cc4
-rw-r--r--src/processor/cfi_frame_info_unittest.cc4
-rw-r--r--src/processor/contained_range_map_unittest.cc4
-rw-r--r--src/processor/convert_old_arm64_context.cc4
-rw-r--r--src/processor/disassembler_objdump.cc197
-rw-r--r--src/processor/disassembler_objdump_unittest.cc4
-rw-r--r--src/processor/disassembler_x86.cc4
-rw-r--r--src/processor/disassembler_x86_unittest.cc4
-rw-r--r--src/processor/dump_context.cc53
-rw-r--r--src/processor/dump_object.cc4
-rw-r--r--src/processor/exploitability.cc4
-rw-r--r--src/processor/exploitability_linux.cc10
-rw-r--r--src/processor/exploitability_unittest.cc6
-rw-r--r--src/processor/exploitability_win.cc4
-rw-r--r--src/processor/fast_source_line_resolver.cc4
-rw-r--r--src/processor/fast_source_line_resolver_unittest.cc4
-rw-r--r--src/processor/logging.cc4
-rw-r--r--src/processor/map_serializers_unittest.cc4
-rw-r--r--src/processor/microdump.cc4
-rw-r--r--src/processor/microdump_processor.cc4
-rw-r--r--src/processor/microdump_processor_unittest.cc4
-rw-r--r--src/processor/microdump_stackwalk.cc4
-rw-r--r--src/processor/minidump.cc48
-rw-r--r--src/processor/minidump_dump.cc4
-rw-r--r--src/processor/minidump_processor.cc53
-rw-r--r--src/processor/minidump_processor_unittest.cc4
-rw-r--r--src/processor/minidump_stackwalk.cc16
-rw-r--r--src/processor/minidump_unittest.cc4
-rw-r--r--src/processor/module_comparer.cc6
-rw-r--r--src/processor/module_serializer.cc21
-rw-r--r--src/processor/module_serializer.h4
-rw-r--r--src/processor/pathname_stripper.cc4
-rw-r--r--src/processor/pathname_stripper_unittest.cc4
-rw-r--r--src/processor/postfix_evaluator_unittest.cc4
-rw-r--r--src/processor/proc_maps_linux.cc4
-rw-r--r--src/processor/proc_maps_linux_unittest.cc4
-rw-r--r--src/processor/process_state.cc4
-rw-r--r--src/processor/range_map_truncate_lower_unittest.cc4
-rw-r--r--src/processor/range_map_truncate_upper_unittest.cc4
-rw-r--r--src/processor/range_map_unittest.cc4
-rw-r--r--src/processor/simple_symbol_supplier.cc4
-rw-r--r--src/processor/source_line_resolver_base.cc4
-rw-r--r--src/processor/stack_frame_cpu.cc4
-rw-r--r--src/processor/stack_frame_symbolizer.cc4
-rw-r--r--src/processor/stackwalk_common.cc72
-rw-r--r--src/processor/stackwalk_common.h1
-rw-r--r--src/processor/stackwalker.cc4
-rw-r--r--src/processor/stackwalker_address_list.cc4
-rw-r--r--src/processor/stackwalker_address_list.h5
-rw-r--r--src/processor/stackwalker_address_list_unittest.cc4
-rw-r--r--src/processor/stackwalker_amd64.cc4
-rw-r--r--src/processor/stackwalker_amd64_unittest.cc4
-rw-r--r--src/processor/stackwalker_arm.cc4
-rw-r--r--src/processor/stackwalker_arm64.cc4
-rw-r--r--src/processor/stackwalker_arm64_unittest.cc4
-rw-r--r--src/processor/stackwalker_arm_unittest.cc4
-rw-r--r--src/processor/stackwalker_mips.cc4
-rw-r--r--src/processor/stackwalker_mips64_unittest.cc4
-rw-r--r--src/processor/stackwalker_mips_unittest.cc4
-rw-r--r--src/processor/stackwalker_ppc.cc4
-rw-r--r--src/processor/stackwalker_ppc64.cc4
-rw-r--r--src/processor/stackwalker_riscv.cc4
-rw-r--r--src/processor/stackwalker_riscv64.cc4
-rw-r--r--src/processor/stackwalker_riscv64_unittest.cc4
-rw-r--r--src/processor/stackwalker_riscv_unittest.cc4
-rw-r--r--src/processor/stackwalker_selftest.cc4
-rw-r--r--src/processor/stackwalker_sparc.cc4
-rw-r--r--src/processor/stackwalker_x86.cc4
-rw-r--r--src/processor/stackwalker_x86_unittest.cc4
-rw-r--r--src/processor/static_address_map_unittest.cc4
-rw-r--r--src/processor/static_contained_range_map_unittest.cc4
-rw-r--r--src/processor/static_map_unittest.cc4
-rw-r--r--src/processor/static_range_map_unittest.cc4
-rw-r--r--src/processor/symbolic_constants_win.cc4
-rw-r--r--src/processor/synth_minidump.cc4
-rw-r--r--src/processor/synth_minidump_unittest.cc4
-rw-r--r--src/processor/testdata/linux_test_app.cc4
-rw-r--r--src/processor/testdata/test_app.cc4
-rw-r--r--src/processor/tokenize.cc4
-rw-r--r--src/third_party/libdisasm/x86_format.c2
-rw-r--r--src/third_party/mac_headers/README27
-rw-r--r--src/third_party/mac_headers/architecture/byte_order.h16
-rw-r--r--src/third_party/mac_headers/arm/_types.h16
-rw-r--r--src/third_party/mac_headers/i386/_types.h22
-rw-r--r--src/third_party/mac_headers/mach-o/arch.h51
-rw-r--r--src/third_party/mac_headers/mach-o/fat.h25
-rw-r--r--src/third_party/mac_headers/mach-o/loader.h236
-rw-r--r--src/third_party/mac_headers/mach-o/nlist.h20
-rw-r--r--src/third_party/mac_headers/mach/arm/boolean.h74
-rw-r--r--src/third_party/mac_headers/mach/arm/vm_types.h159
-rw-r--r--src/third_party/mac_headers/mach/boolean.h42
-rw-r--r--src/third_party/mac_headers/mach/i386/boolean.h32
-rw-r--r--src/third_party/mac_headers/mach/i386/vm_param.h157
-rw-r--r--src/third_party/mac_headers/mach/i386/vm_types.h83
-rw-r--r--src/third_party/mac_headers/mach/machine.h424
-rw-r--r--src/third_party/mac_headers/mach/machine/boolean.h12
-rw-r--r--src/third_party/mac_headers/mach/machine/thread_state.h2
-rw-r--r--src/third_party/mac_headers/mach/machine/thread_status.h2
-rw-r--r--src/third_party/mac_headers/mach/machine/vm_types.h12
-rw-r--r--src/third_party/mac_headers/mach/thread_status.h42
-rw-r--r--src/third_party/mac_headers/mach/vm_prot.h109
-rw-r--r--src/tools/linux/core2md/core2md.cc4
-rw-r--r--src/tools/linux/core_handler/core_handler.cc4
-rw-r--r--src/tools/linux/dump_syms/dump_syms.cc6
-rw-r--r--src/tools/linux/md2core/minidump-2-core.cc76
-rw-r--r--src/tools/linux/md2core/minidump_memory_range_unittest.cc4
-rw-r--r--src/tools/linux/pid2md/pid2md.cc4
-rw-r--r--src/tools/linux/symupload/minidump_upload.cc4
-rw-r--r--src/tools/linux/symupload/sym_upload.cc4
-rw-r--r--src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj4
-rw-r--r--src/tools/mac/dump_syms/dump_syms_tool.cc88
-rw-r--r--src/tools/mac/dump_syms/macho_dump.cc202
-rw-r--r--src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj4
-rw-r--r--src/tools/mac/upload_system_symbols/upload_system_symbols.go25
-rwxr-xr-xsrc/tools/mac/upload_system_symbols/upload_system_symbols.sh114
-rwxr-xr-xsrc/tools/python/deps-to-manifest.py7
-rw-r--r--src/tools/python/filter_syms.py9
-rw-r--r--src/tools/python/tests/filter_syms_unittest.py11
-rw-r--r--src/tools/solaris/dump_syms/dump_syms.cc4
-rw-r--r--src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc4
-rw-r--r--src/tools/windows/converter/ms_symbol_server_converter.cc4
-rw-r--r--src/tools/windows/converter_exe/converter.cc4
-rw-r--r--src/tools/windows/converter_exe/escaping.cc4
-rw-r--r--src/tools/windows/converter_exe/http_download.cc4
-rw-r--r--src/tools/windows/converter_exe/tokenizer.cc4
-rw-r--r--src/tools/windows/converter_exe/winhttp_client.cc4
-rw-r--r--src/tools/windows/converter_exe/wininet_client.cc4
-rw-r--r--src/tools/windows/dump_syms/dump_syms.cc4
-rw-r--r--src/tools/windows/dump_syms/dump_syms_unittest.cc4
-rw-r--r--src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc5
-rw-r--r--src/tools/windows/symupload/symupload.cc4
326 files changed, 4806 insertions, 2276 deletions
diff --git a/Android.bp b/Android.bp
index 622af101..ff6a1231 100644
--- a/Android.bp
+++ b/Android.bp
@@ -277,6 +277,8 @@ cc_binary_host {
"-Wno-unused-parameter",
],
srcs: [
+ "src/common/linux/scoped_pipe.cc",
+ "src/common/linux/scoped_tmpfile.cc",
"src/common/path_helper.cc",
"src/processor/basic_code_modules.cc",
"src/processor/basic_source_line_resolver.cc",
diff --git a/DEPS b/DEPS
index e08dbd4c..3fcd524d 100644
--- a/DEPS
+++ b/DEPS
@@ -52,7 +52,7 @@ deps = {
hooks = [
{
# Keep the manifest up to date.
- "action": ["python", "src/src/tools/python/deps-to-manifest.py",
+ "action": ["src/src/tools/python/deps-to-manifest.py",
"src/DEPS", "src/default.xml"],
},
]
diff --git a/METADATA b/METADATA
index 509ee6eb..b075e613 100644
--- a/METADATA
+++ b/METADATA
@@ -13,12 +13,12 @@ third_party {
type: GIT
value: "https://chromium.googlesource.com/breakpad/breakpad"
}
- version: "v2023.01.27"
+ version: "922d49bdfe3c92e5d35c406f87f2c354637a2f8b"
license_type: RECIPROCAL
license_note: "would be NOTICE save for APSL in:\n src/third_party/mac_handler/breakpad_nlist_64.cc\n src/third_party/mac_headers/"
last_upgrade_date {
year: 2023
month: 8
- day: 10
+ day: 21
}
}
diff --git a/Makefile.am b/Makefile.am
index 9b7f7247..06f34ce8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -193,7 +193,6 @@ check_PROGRAMS += \
src/processor/basic_source_line_resolver_unittest \
src/processor/cfi_frame_info_unittest \
src/processor/contained_range_map_unittest \
- src/processor/disassembler_objdump_unittest \
src/processor/disassembler_x86_unittest \
src/processor/exploitability_unittest \
src/processor/fast_source_line_resolver_unittest \
@@ -221,6 +220,12 @@ check_PROGRAMS += \
src/processor/stackwalker_riscv64_unittest \
src/processor/stackwalker_x86_unittest \
src/processor/synth_minidump_unittest
+if LINUX_HOST
+check_PROGRAMS += \
+ src/processor/disassembler_objdump_unittest \
+ src/common/linux/scoped_pipe_unittest \
+ src/common/linux/scoped_tmpfile_unittest
+endif LINUX_HOST
if SELFTEST
check_PROGRAMS += \
src/processor/stackwalker_selftest
@@ -366,8 +371,6 @@ src_libbreakpad_a_SOURCES = \
src/processor/contained_range_map.h \
src/processor/convert_old_arm64_context.cc \
src/processor/convert_old_arm64_context.h \
- src/processor/disassembler_objdump.h \
- src/processor/disassembler_objdump.cc \
src/processor/disassembler_x86.h \
src/processor/disassembler_x86.cc \
src/processor/dump_context.cc \
@@ -449,6 +452,15 @@ src_libbreakpad_a_SOURCES = \
src/processor/symbolic_constants_win.h \
src/processor/tokenize.cc \
src/processor/tokenize.h
+if LINUX_HOST
+src_libbreakpad_a_SOURCES += \
+ src/common/linux/scoped_pipe.h \
+ src/common/linux/scoped_pipe.cc \
+ src/common/linux/scoped_tmpfile.h \
+ src/common/linux/scoped_tmpfile.cc \
+ src/processor/disassembler_objdump.h \
+ src/processor/disassembler_objdump.cc
+endif
# libdisasm 3rd party library
src_third_party_libdisasm_libdisasm_a_SOURCES = \
@@ -523,7 +535,6 @@ src_client_linux_libbreakpad_client_a_SOURCES += \
endif
# Client tests
-
src_client_linux_linux_dumper_unittest_helper_SOURCES = \
src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
src_client_linux_linux_dumper_unittest_helper_LDFLAGS=$(PTHREAD_CFLAGS)
@@ -552,7 +563,10 @@ src_client_linux_linux_client_unittest_shlib_SOURCES = \
src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc \
src/common/linux/elf_core_dump.cc \
src/common/linux/linux_libc_support_unittest.cc \
- src/common/linux/tests/auto_testfile.h \
+ src/common/linux/scoped_pipe.h \
+ src/common/linux/scoped_pipe.cc \
+ src/common/linux/scoped_tmpfile.h \
+ src/common/linux/scoped_tmpfile.cc \
src/common/linux/tests/crash_generator.cc \
src/common/memory_allocator_unittest.cc \
src/common/tests/auto_tempdir.h \
@@ -680,9 +694,11 @@ src_tools_linux_dump_syms_dump_syms_SOURCES = \
src/common/linux/safe_readlink.cc \
src/tools/linux/dump_syms/dump_syms.cc
src_tools_linux_dump_syms_dump_syms_CXXFLAGS = \
- $(RUSTC_DEMANGLE_CFLAGS)
+ $(RUSTC_DEMANGLE_CFLAGS) \
+ $(ZSTD_CFLAGS)
src_tools_linux_dump_syms_dump_syms_LDADD = \
$(RUSTC_DEMANGLE_LIBS) \
+ $(ZSTD_CFLAGS) \
-lz
src_tools_linux_md2core_minidump_2_core_SOURCES = \
@@ -807,11 +823,13 @@ src_common_dumper_unittest_SOURCES = \
src_common_dumper_unittest_CPPFLAGS = \
$(AM_CPPFLAGS) $(TEST_CFLAGS) \
$(RUSTC_DEMANGLE_CFLAGS) \
- $(PTHREAD_CFLAGS)
+ $(PTHREAD_CFLAGS) \
+ $(ZSTD_CFLAGS)
src_common_dumper_unittest_LDADD = \
$(TEST_LIBS) \
$(RUSTC_DEMANGLE_LIBS) \
$(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \
+ $(ZSTD_LIBS) \
-lz
src_common_mac_macho_reader_unittest_SOURCES = \
@@ -911,7 +929,6 @@ src_processor_exploitability_unittest_LDADD = \
src/processor/convert_old_arm64_context.o \
src/processor/minidump_processor.o \
src/processor/process_state.o \
- src/processor/disassembler_objdump.o \
src/processor/disassembler_x86.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
@@ -947,12 +964,38 @@ src_processor_exploitability_unittest_LDADD = \
src/third_party/libdisasm/libdisasm.a \
$(TEST_LIBS) \
$(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+if LINUX_HOST
+src_processor_exploitability_unittest_LDADD += \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
+ src/processor/disassembler_objdump.o
+endif
+
+src_common_linux_scoped_pipe_unittest_SOURCES = \
+ src/common/linux/scoped_pipe_unittest.cc
+src_common_linux_scoped_pipe_unittest_CPPFLAGS = \
+ $(AM_CPPFLAGS) $(TEST_CFLAGS)
+src_common_linux_scoped_pipe_unittest_LDADD = \
+ src/common/linux/scoped_pipe.o \
+ $(TEST_LIBS) \
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+
+src_common_linux_scoped_tmpfile_unittest_SOURCES = \
+ src/common/linux/scoped_tmpfile_unittest.cc
+src_common_linux_scoped_tmpfile_unittest_CPPFLAGS = \
+ $(AM_CPPFLAGS) $(TEST_CFLAGS)
+src_common_linux_scoped_tmpfile_unittest_LDADD = \
+ src/common/linux/scoped_tmpfile.o \
+ $(TEST_LIBS) \
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
src_processor_disassembler_objdump_unittest_SOURCES = \
src/processor/disassembler_objdump_unittest.cc
src_processor_disassembler_objdump_unittest_CPPFLAGS = \
$(AM_CPPFLAGS) $(TEST_CFLAGS)
src_processor_disassembler_objdump_unittest_LDADD = \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
src/processor/disassembler_objdump.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
@@ -1033,6 +1076,12 @@ src_processor_microdump_processor_unittest_LDADD = \
src/processor/tokenize.o \
$(TEST_LIBS) \
$(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+if LINUX_HOST
+src_processor_microdump_processor_unittest_LDADD += \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
+ src/processor/disassembler_objdump.o
+endif
src_processor_minidump_processor_unittest_SOURCES = \
src/processor/minidump_processor_unittest.cc
@@ -1044,7 +1093,6 @@ src_processor_minidump_processor_unittest_LDADD = \
src/processor/call_stack.o \
src/processor/cfi_frame_info.o \
src/processor/convert_old_arm64_context.o \
- src/processor/disassembler_objdump.o \
src/processor/disassembler_x86.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
@@ -1077,6 +1125,12 @@ src_processor_minidump_processor_unittest_LDADD = \
src/third_party/libdisasm/libdisasm.a \
$(TEST_LIBS) \
$(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+if LINUX_HOST
+src_processor_minidump_processor_unittest_LDADD += \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
+ src/processor/disassembler_objdump.o
+endif
src_processor_minidump_unittest_SOURCES = \
src/common/test_assembler.cc \
@@ -1194,7 +1248,6 @@ src_processor_stackwalker_selftest_LDADD = \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
src/processor/call_stack.o \
- src/processor/disassembler_objdump.o \
src/processor/disassembler_x86.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
@@ -1220,6 +1273,12 @@ src_processor_stackwalker_selftest_LDADD = \
src/processor/stackwalker_x86.o \
src/processor/tokenize.o \
$(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+if LINUX_HOST
+src_processor_stackwalker_selftest_LDADD += \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
+ src/processor/disassembler_objdump.o
+endif
src_processor_stackwalker_amd64_unittest_SOURCES = \
src/common/test_assembler.cc \
@@ -1406,6 +1465,12 @@ src_processor_microdump_stackwalk_LDADD = \
src/processor/stackwalker_x86.o \
src/processor/tokenize.o \
src/third_party/libdisasm/libdisasm.a
+if LINUX_HOST
+src_processor_microdump_stackwalk_LDADD += \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
+ src/processor/disassembler_objdump.o
+endif
src_processor_minidump_stackwalk_SOURCES = \
src/processor/minidump_stackwalk.cc
@@ -1416,7 +1481,6 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/call_stack.o \
src/processor/cfi_frame_info.o \
src/processor/convert_old_arm64_context.o \
- src/processor/disassembler_objdump.o \
src/processor/disassembler_x86.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
@@ -1449,6 +1513,12 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/symbolic_constants_win.o \
src/processor/tokenize.o \
src/third_party/libdisasm/libdisasm.a
+if LINUX_HOST
+src_processor_minidump_stackwalk_LDADD += \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
+ src/processor/disassembler_objdump.o
+endif LINUX_HOST
## Additional files to be included in a source distribution
##
@@ -1666,10 +1736,12 @@ EXTRA_DIST = \
src/third_party/curl/typecheck-gcc.h \
src/third_party/curl/types.h \
src/third_party/mac_headers/architecture/byte_order.h \
+ src/third_party/mac_headers/arm/_types.h \
src/third_party/mac_headers/i386/_types.h \
src/third_party/mac_headers/mach/boolean.h \
+ src/third_party/mac_headers/mach/arm/boolean.h \
+ src/third_party/mac_headers/mach/arm/vm_types.h \
src/third_party/mac_headers/mach/i386/boolean.h \
- src/third_party/mac_headers/mach/i386/vm_param.h \
src/third_party/mac_headers/mach/i386/vm_types.h \
src/third_party/mac_headers/mach/machine/boolean.h \
src/third_party/mac_headers/mach/machine.h \
diff --git a/Makefile.in b/Makefile.in
index d358b6b1..0c47bf87 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -131,11 +131,11 @@ host_triplet = @host@
# Build as PIC on Linux, for linux_client_unittest_shlib
@LINUX_HOST_TRUE@am__append_2 = -fPIC
@LINUX_HOST_TRUE@am__append_3 = -fPIC
-libexec_PROGRAMS = $(am__EXEEXT_10)
+libexec_PROGRAMS = $(am__EXEEXT_11)
bin_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4)
check_PROGRAMS = src/common/safe_math_unittest$(EXEEXT) \
$(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
- $(am__EXEEXT_8) $(am__EXEEXT_9)
+ $(am__EXEEXT_8) $(am__EXEEXT_9) $(am__EXEEXT_10)
noinst_PROGRAMS =
EXTRA_PROGRAMS = $(am__EXEEXT_1)
@@ -164,7 +164,6 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1)
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_source_line_resolver_unittest \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info_unittest \
@DISABLE_PROCESSOR_FALSE@ src/processor/contained_range_map_unittest \
-@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_objdump_unittest \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86_unittest \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_unittest \
@DISABLE_PROCESSOR_FALSE@ src/processor/fast_source_line_resolver_unittest \
@@ -193,7 +192,12 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1)
@DISABLE_PROCESSOR_FALSE@ src/processor/stackwalker_x86_unittest \
@DISABLE_PROCESSOR_FALSE@ src/processor/synth_minidump_unittest
-@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__append_10 = \
+@DISABLE_PROCESSOR_FALSE@@LINUX_HOST_TRUE@am__append_10 = \
+@DISABLE_PROCESSOR_FALSE@@LINUX_HOST_TRUE@ src/processor/disassembler_objdump_unittest \
+@DISABLE_PROCESSOR_FALSE@@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe_unittest \
+@DISABLE_PROCESSOR_FALSE@@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile_unittest
+
+@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__append_11 = \
@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@ src/processor/stackwalker_selftest
@@ -203,17 +207,17 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1)
# Currently Linux only, the macOS client
# is built using an Xcode project instead.
#
-@LINUX_HOST_TRUE@am__append_11 = src/client/linux/libbreakpad_client.a
-@LINUX_HOST_TRUE@am__append_12 = breakpad-client.pc
-@LINUX_HOST_TRUE@am__append_13 = \
+@LINUX_HOST_TRUE@am__append_12 = src/client/linux/libbreakpad_client.a
+@LINUX_HOST_TRUE@am__append_13 = breakpad-client.pc
+@LINUX_HOST_TRUE@am__append_14 = \
@LINUX_HOST_TRUE@ src/client/linux/linux_client_unittest \
@LINUX_HOST_TRUE@ src/common/linux/google_crashdump_uploader_test
-@LINUX_HOST_TRUE@am__append_14 = \
+@LINUX_HOST_TRUE@am__append_15 = \
@LINUX_HOST_TRUE@ src/client/linux/linux_dumper_unittest_helper \
@LINUX_HOST_TRUE@ src/client/linux/linux_client_unittest_shlib
-@LINUX_HOST_TRUE@am__append_15 = \
+@LINUX_HOST_TRUE@am__append_16 = \
@LINUX_HOST_TRUE@ src/client/linux/linux_dumper_unittest_helper \
@LINUX_HOST_TRUE@ src/client/linux/linux_client_unittest_shlib
@@ -222,7 +226,7 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1)
# Various Breakpad tools
# This includes symbol dumpers and uploaders
#
-@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_16 = \
+@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_17 = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/core2md/core2md \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/pid2md/pid2md \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/dump_syms/dump_syms \
@@ -230,31 +234,69 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1)
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/symupload/minidump_upload \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/symupload/sym_upload
-@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__append_17 = \
+@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__append_18 = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@ src/tools/mac/dump_syms/dump_syms_mac
-@DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@am__append_18 = \
+@DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@am__append_19 = \
@DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@ src/tools/linux/core_handler/core_handler
-@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_19 = \
+@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__append_20 = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/common/dumper_unittest \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/md2core/minidump_2_core_unittest
-@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__append_20 = \
+@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__append_21 = \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@ src/common/mac/macho_reader_unittest
-@HAVE_GETCONTEXT_FALSE@am__append_21 = \
+@LINUX_HOST_TRUE@am__append_22 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.h \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.cc \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.h \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.cc \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.h \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.cc
+
+@HAVE_GETCONTEXT_FALSE@am__append_23 = \
@HAVE_GETCONTEXT_FALSE@ src/common/linux/breakpad_getcontext.S
-@HAVE_GETCONTEXT_FALSE@am__append_22 = \
+@HAVE_GETCONTEXT_FALSE@am__append_24 = \
@HAVE_GETCONTEXT_FALSE@ src/common/linux/breakpad_getcontext.S \
@HAVE_GETCONTEXT_FALSE@ src/common/linux/breakpad_getcontext_unittest.cc
-@ANDROID_HOST_TRUE@am__append_23 = \
+@ANDROID_HOST_TRUE@am__append_25 = \
@ANDROID_HOST_TRUE@ -llog -lm
-@ANDROID_HOST_TRUE@am__append_24 = \
+@ANDROID_HOST_TRUE@am__append_26 = \
@ANDROID_HOST_TRUE@ -llog
+@LINUX_HOST_TRUE@am__append_27 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.o \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.o \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o
+
+@LINUX_HOST_TRUE@am__append_28 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.o \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.o \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o
+
+@LINUX_HOST_TRUE@am__append_29 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.o \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.o \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o
+
+@LINUX_HOST_TRUE@am__append_30 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.o \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.o \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o
+
+@LINUX_HOST_TRUE@am__append_31 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.o \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.o \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o
+
+@LINUX_HOST_TRUE@am__append_32 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.o \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.o \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o
+
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
@@ -306,7 +348,6 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \
@DISABLE_PROCESSOR_FALSE@ src/processor/basic_source_line_resolver_unittest$(EXEEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/cfi_frame_info_unittest$(EXEEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/contained_range_map_unittest$(EXEEXT) \
-@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_objdump_unittest$(EXEEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/disassembler_x86_unittest$(EXEEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/exploitability_unittest$(EXEEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/fast_source_line_resolver_unittest$(EXEEXT) \
@@ -334,13 +375,16 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \
@DISABLE_PROCESSOR_FALSE@ src/processor/stackwalker_riscv64_unittest$(EXEEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/stackwalker_x86_unittest$(EXEEXT) \
@DISABLE_PROCESSOR_FALSE@ src/processor/synth_minidump_unittest$(EXEEXT)
-@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__EXEEXT_6 = src/processor/stackwalker_selftest$(EXEEXT)
-@LINUX_HOST_TRUE@am__EXEEXT_7 = src/client/linux/linux_client_unittest$(EXEEXT) \
+@DISABLE_PROCESSOR_FALSE@@LINUX_HOST_TRUE@am__EXEEXT_6 = src/processor/disassembler_objdump_unittest$(EXEEXT) \
+@DISABLE_PROCESSOR_FALSE@@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe_unittest$(EXEEXT) \
+@DISABLE_PROCESSOR_FALSE@@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile_unittest$(EXEEXT)
+@DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@am__EXEEXT_7 = src/processor/stackwalker_selftest$(EXEEXT)
+@LINUX_HOST_TRUE@am__EXEEXT_8 = src/client/linux/linux_client_unittest$(EXEEXT) \
@LINUX_HOST_TRUE@ src/common/linux/google_crashdump_uploader_test$(EXEEXT)
-@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__EXEEXT_8 = src/common/dumper_unittest$(EXEEXT) \
+@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@am__EXEEXT_9 = src/common/dumper_unittest$(EXEEXT) \
@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@ src/tools/linux/md2core/minidump_2_core_unittest$(EXEEXT)
-@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__EXEEXT_9 = src/common/mac/macho_reader_unittest$(EXEEXT)
-@DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@am__EXEEXT_10 = src/tools/linux/core_handler/core_handler$(EXEEXT)
+@DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@am__EXEEXT_10 = src/common/mac/macho_reader_unittest$(EXEEXT)
+@DISABLE_TOOLS_FALSE@@HAVE_MEMFD_CREATE_TRUE@@LINUX_HOST_TRUE@am__EXEEXT_11 = src/tools/linux/core_handler/core_handler$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) $(noinst_PROGRAMS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -436,13 +480,132 @@ src_client_linux_libbreakpad_client_a_OBJECTS = \
$(am_src_client_linux_libbreakpad_client_a_OBJECTS)
src_libbreakpad_a_AR = $(AR) $(ARFLAGS)
src_libbreakpad_a_LIBADD =
+am__src_libbreakpad_a_SOURCES_DIST = \
+ src/google_breakpad/common/breakpad_types.h \
+ src/google_breakpad/common/minidump_format.h \
+ src/google_breakpad/common/minidump_size.h \
+ src/google_breakpad/processor/basic_source_line_resolver.h \
+ src/google_breakpad/processor/call_stack.h \
+ src/google_breakpad/processor/code_module.h \
+ src/google_breakpad/processor/code_modules.h \
+ src/google_breakpad/processor/dump_context.h \
+ src/google_breakpad/processor/dump_object.h \
+ src/google_breakpad/processor/exploitability.h \
+ src/google_breakpad/processor/fast_source_line_resolver.h \
+ src/google_breakpad/processor/memory_region.h \
+ src/google_breakpad/processor/microdump.h \
+ src/google_breakpad/processor/microdump_processor.h \
+ src/google_breakpad/processor/minidump.h \
+ src/google_breakpad/processor/minidump_processor.h \
+ src/google_breakpad/processor/process_result.h \
+ src/google_breakpad/processor/process_state.h \
+ src/google_breakpad/processor/proc_maps_linux.h \
+ src/google_breakpad/processor/source_line_resolver_base.h \
+ src/google_breakpad/processor/source_line_resolver_interface.h \
+ src/google_breakpad/processor/stack_frame.h \
+ src/google_breakpad/processor/stack_frame_cpu.h \
+ src/google_breakpad/processor/stack_frame_symbolizer.h \
+ src/google_breakpad/processor/stackwalker.h \
+ src/google_breakpad/processor/symbol_supplier.h \
+ src/google_breakpad/processor/system_info.h \
+ src/processor/address_map-inl.h src/processor/address_map.h \
+ src/processor/basic_code_module.h \
+ src/processor/basic_code_modules.cc \
+ src/processor/basic_code_modules.h \
+ src/processor/basic_source_line_resolver_types.h \
+ src/processor/basic_source_line_resolver.cc \
+ src/processor/call_stack.cc src/processor/cfi_frame_info.cc \
+ src/processor/cfi_frame_info.h \
+ src/processor/contained_range_map-inl.h \
+ src/processor/contained_range_map.h \
+ src/processor/convert_old_arm64_context.cc \
+ src/processor/convert_old_arm64_context.h \
+ src/processor/disassembler_x86.h \
+ src/processor/disassembler_x86.cc \
+ src/processor/dump_context.cc src/processor/dump_object.cc \
+ src/processor/exploitability.cc \
+ src/processor/exploitability_linux.h \
+ src/processor/exploitability_linux.cc \
+ src/processor/exploitability_win.h \
+ src/processor/exploitability_win.cc \
+ src/processor/fast_source_line_resolver_types.h \
+ src/processor/fast_source_line_resolver.cc \
+ src/processor/linked_ptr.h src/processor/logging.h \
+ src/processor/logging.cc src/processor/map_serializers-inl.h \
+ src/processor/map_serializers.h src/processor/microdump.cc \
+ src/processor/microdump_processor.cc src/processor/minidump.cc \
+ src/processor/minidump_processor.cc \
+ src/processor/module_comparer.cc \
+ src/processor/module_comparer.h src/processor/module_factory.h \
+ src/processor/module_serializer.cc \
+ src/processor/module_serializer.h \
+ src/processor/pathname_stripper.cc \
+ src/processor/pathname_stripper.h \
+ src/processor/postfix_evaluator-inl.h \
+ src/processor/postfix_evaluator.h \
+ src/processor/process_state.cc \
+ src/processor/proc_maps_linux.cc src/processor/range_map-inl.h \
+ src/processor/range_map.h \
+ src/processor/simple_serializer-inl.h \
+ src/processor/simple_serializer.h \
+ src/processor/simple_symbol_supplier.cc \
+ src/processor/simple_symbol_supplier.h \
+ src/processor/windows_frame_info.h \
+ src/processor/source_line_resolver_base_types.h \
+ src/processor/source_line_resolver_base.cc \
+ src/processor/stack_frame_cpu.cc \
+ src/processor/stack_frame_symbolizer.cc \
+ src/processor/stackwalk_common.cc \
+ src/processor/stackwalk_common.h src/processor/stackwalker.cc \
+ src/processor/stackwalker_amd64.cc \
+ src/processor/stackwalker_amd64.h \
+ src/processor/stackwalker_arm.cc \
+ src/processor/stackwalker_arm.h \
+ src/processor/stackwalker_arm64.cc \
+ src/processor/stackwalker_arm64.h \
+ src/processor/stackwalker_address_list.cc \
+ src/processor/stackwalker_address_list.h \
+ src/processor/stackwalker_mips.cc \
+ src/processor/stackwalker_mips.h \
+ src/processor/stackwalker_ppc.cc \
+ src/processor/stackwalker_ppc.h \
+ src/processor/stackwalker_ppc64.cc \
+ src/processor/stackwalker_ppc64.h \
+ src/processor/stackwalker_riscv.cc \
+ src/processor/stackwalker_riscv.h \
+ src/processor/stackwalker_riscv64.cc \
+ src/processor/stackwalker_riscv64.h \
+ src/processor/stackwalker_sparc.cc \
+ src/processor/stackwalker_sparc.h \
+ src/processor/stackwalker_x86.cc \
+ src/processor/stackwalker_x86.h \
+ src/processor/static_address_map-inl.h \
+ src/processor/static_address_map.h \
+ src/processor/static_contained_range_map-inl.h \
+ src/processor/static_contained_range_map.h \
+ src/processor/static_map_iterator-inl.h \
+ src/processor/static_map_iterator.h \
+ src/processor/static_map-inl.h src/processor/static_map.h \
+ src/processor/static_range_map-inl.h \
+ src/processor/static_range_map.h \
+ src/processor/symbolic_constants_win.cc \
+ src/processor/symbolic_constants_win.h \
+ src/processor/tokenize.cc src/processor/tokenize.h \
+ src/common/linux/scoped_pipe.h src/common/linux/scoped_pipe.cc \
+ src/common/linux/scoped_tmpfile.h \
+ src/common/linux/scoped_tmpfile.cc \
+ src/processor/disassembler_objdump.h \
+ src/processor/disassembler_objdump.cc
+@LINUX_HOST_TRUE@am__objects_2 = \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_pipe.$(OBJEXT) \
+@LINUX_HOST_TRUE@ src/common/linux/scoped_tmpfile.$(OBJEXT) \
+@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.$(OBJEXT)
am_src_libbreakpad_a_OBJECTS = \
src/processor/basic_code_modules.$(OBJEXT) \
src/processor/basic_source_line_resolver.$(OBJEXT) \
src/processor/call_stack.$(OBJEXT) \
src/processor/cfi_frame_info.$(OBJEXT) \
src/processor/convert_old_arm64_context.$(OBJEXT) \
- src/processor/disassembler_objdump.$(OBJEXT) \
src/processor/disassembler_x86.$(OBJEXT) \
src/processor/dump_context.$(OBJEXT) \
src/processor/dump_object.$(OBJEXT) \
@@ -478,7 +641,7 @@ am_src_libbreakpad_a_OBJECTS = \
src/processor/stackwalker_sparc.$(OBJEXT) \
src/processor/stackwalker_x86.$(OBJEXT) \
src/processor/symbolic_constants_win.$(OBJEXT) \
- src/processor/tokenize.$(OBJEXT)
+ src/processor/tokenize.$(OBJEXT) $(am__objects_2)
src_libbreakpad_a_OBJECTS = $(am_src_libbreakpad_a_OBJECTS)
src_testing_libtesting_a_AR = $(AR) $(ARFLAGS)
src_testing_libtesting_a_LIBADD =
@@ -540,7 +703,9 @@ am__src_client_linux_linux_client_unittest_shlib_SOURCES_DIST = \
src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc \
src/common/linux/elf_core_dump.cc \
src/common/linux/linux_libc_support_unittest.cc \
- src/common/linux/tests/auto_testfile.h \
+ src/common/linux/scoped_pipe.h src/common/linux/scoped_pipe.cc \
+ src/common/linux/scoped_tmpfile.h \
+ src/common/linux/scoped_tmpfile.cc \
src/common/linux/tests/crash_generator.cc \
src/common/memory_allocator_unittest.cc \
src/common/tests/auto_tempdir.h src/common/tests/file_utils.cc \
@@ -553,13 +718,13 @@ am__src_client_linux_linux_client_unittest_shlib_SOURCES_DIST = \
src/processor/proc_maps_linux.cc \
src/common/linux/breakpad_getcontext.S \
src/common/linux/breakpad_getcontext_unittest.cc
-@SYSTEM_TEST_LIBS_FALSE@am__objects_2 = src/testing/googletest/src/client_linux_linux_client_unittest_shlib-gtest-all.$(OBJEXT) \
+@SYSTEM_TEST_LIBS_FALSE@am__objects_3 = src/testing/googletest/src/client_linux_linux_client_unittest_shlib-gtest-all.$(OBJEXT) \
@SYSTEM_TEST_LIBS_FALSE@ src/testing/googletest/src/client_linux_linux_client_unittest_shlib-gtest_main.$(OBJEXT) \
@SYSTEM_TEST_LIBS_FALSE@ src/testing/googlemock/src/client_linux_linux_client_unittest_shlib-gmock-all.$(OBJEXT)
-@HAVE_GETCONTEXT_FALSE@am__objects_3 = src/common/linux/client_linux_linux_client_unittest_shlib-breakpad_getcontext.$(OBJEXT) \
+@HAVE_GETCONTEXT_FALSE@am__objects_4 = src/common/linux/client_linux_linux_client_unittest_shlib-breakpad_getcontext.$(OBJEXT) \
@HAVE_GETCONTEXT_FALSE@ src/common/linux/client_linux_linux_client_unittest_shlib-breakpad_getcontext_unittest.$(OBJEXT)
am_src_client_linux_linux_client_unittest_shlib_OBJECTS = \
- $(am__objects_2) \
+ $(am__objects_3) \
src/client/linux/handler/linux_client_unittest_shlib-exception_handler_unittest.$(OBJEXT) \
src/client/linux/microdump_writer/linux_client_unittest_shlib-microdump_writer_unittest.$(OBJEXT) \
src/client/linux/minidump_writer/linux_client_unittest_shlib-directory_reader_unittest.$(OBJEXT) \
@@ -574,6 +739,8 @@ am_src_client_linux_linux_client_unittest_shlib_OBJECTS = \
src/client/linux/minidump_writer/linux_client_unittest_shlib-proc_cpuinfo_reader_unittest.$(OBJEXT) \
src/common/linux/client_linux_linux_client_unittest_shlib-elf_core_dump.$(OBJEXT) \
src/common/linux/client_linux_linux_client_unittest_shlib-linux_libc_support_unittest.$(OBJEXT) \
+ src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.$(OBJEXT) \
+ src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.$(OBJEXT) \
src/common/linux/tests/client_linux_linux_client_unittest_shlib-crash_generator.$(OBJEXT) \
src/common/client_linux_linux_client_unittest_shlib-memory_allocator_unittest.$(OBJEXT) \
src/common/tests/client_linux_linux_client_unittest_shlib-file_utils.$(OBJEXT) \
@@ -585,7 +752,7 @@ am_src_client_linux_linux_client_unittest_shlib_OBJECTS = \
src/processor/client_linux_linux_client_unittest_shlib-minidump.$(OBJEXT) \
src/processor/client_linux_linux_client_unittest_shlib-pathname_stripper.$(OBJEXT) \
src/processor/client_linux_linux_client_unittest_shlib-proc_maps_linux.$(OBJEXT) \
- $(am__objects_3)
+ $(am__objects_4)
src_client_linux_linux_client_unittest_shlib_OBJECTS = \
$(am_src_client_linux_linux_client_unittest_shlib_OBJECTS)
src_client_linux_linux_client_unittest_shlib_LINK = $(CXXLD) \
@@ -677,6 +844,18 @@ src_common_linux_google_crashdump_uploader_test_OBJECTS = \
src_common_linux_google_crashdump_uploader_test_DEPENDENCIES = \
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
+am_src_common_linux_scoped_pipe_unittest_OBJECTS = src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.$(OBJEXT)
+src_common_linux_scoped_pipe_unittest_OBJECTS = \
+ $(am_src_common_linux_scoped_pipe_unittest_OBJECTS)
+src_common_linux_scoped_pipe_unittest_DEPENDENCIES = \
+ src/common/linux/scoped_pipe.o $(am__DEPENDENCIES_2) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_src_common_linux_scoped_tmpfile_unittest_OBJECTS = src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.$(OBJEXT)
+src_common_linux_scoped_tmpfile_unittest_OBJECTS = \
+ $(am_src_common_linux_scoped_tmpfile_unittest_OBJECTS)
+src_common_linux_scoped_tmpfile_unittest_DEPENDENCIES = \
+ src/common/linux/scoped_tmpfile.o $(am__DEPENDENCIES_2) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_src_common_mac_macho_reader_unittest_OBJECTS = src/common/mac_macho_reader_unittest-dwarf_cfi_to_module.$(OBJEXT) \
src/common/mac_macho_reader_unittest-dwarf_cu_to_module.$(OBJEXT) \
src/common/mac_macho_reader_unittest-dwarf_line_to_module.$(OBJEXT) \
@@ -751,6 +930,8 @@ am_src_processor_disassembler_objdump_unittest_OBJECTS = src/processor/disassemb
src_processor_disassembler_objdump_unittest_OBJECTS = \
$(am_src_processor_disassembler_objdump_unittest_OBJECTS)
src_processor_disassembler_objdump_unittest_DEPENDENCIES = \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
src/processor/disassembler_objdump.o \
src/processor/dump_context.o src/processor/dump_object.o \
src/processor/logging.o src/processor/pathname_stripper.o \
@@ -769,9 +950,7 @@ src_processor_exploitability_unittest_OBJECTS = \
src_processor_exploitability_unittest_DEPENDENCIES = \
src/processor/convert_old_arm64_context.o \
src/processor/minidump_processor.o \
- src/processor/process_state.o \
- src/processor/disassembler_objdump.o \
- src/processor/disassembler_x86.o \
+ src/processor/process_state.o src/processor/disassembler_x86.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
src/processor/exploitability_win.o \
@@ -801,7 +980,7 @@ src_processor_exploitability_unittest_DEPENDENCIES = \
src/processor/symbolic_constants_win.o \
src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__append_27)
am_src_processor_fast_source_line_resolver_unittest_OBJECTS = src/processor/fast_source_line_resolver_unittest-fast_source_line_resolver_unittest.$(OBJEXT)
src_processor_fast_source_line_resolver_unittest_OBJECTS = $(am_src_processor_fast_source_line_resolver_unittest_OBJECTS)
src_processor_fast_source_line_resolver_unittest_DEPENDENCIES = \
@@ -849,7 +1028,7 @@ src_processor_microdump_processor_unittest_DEPENDENCIES = \
src/processor/stackwalker_sparc.o \
src/processor/stackwalker_x86.o src/processor/tokenize.o \
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__append_28)
am_src_processor_microdump_stackwalk_OBJECTS = \
src/processor/microdump_stackwalk.$(OBJEXT)
src_processor_microdump_stackwalk_OBJECTS = \
@@ -881,7 +1060,7 @@ src_processor_microdump_stackwalk_DEPENDENCIES = \
src/processor/stackwalker_riscv64.o \
src/processor/stackwalker_sparc.o \
src/processor/stackwalker_x86.o src/processor/tokenize.o \
- src/third_party/libdisasm/libdisasm.a
+ src/third_party/libdisasm/libdisasm.a $(am__append_31)
am_src_processor_minidump_dump_OBJECTS = \
src/processor/minidump_dump.$(OBJEXT)
src_processor_minidump_dump_OBJECTS = \
@@ -901,7 +1080,6 @@ src_processor_minidump_processor_unittest_DEPENDENCIES = \
src/processor/basic_source_line_resolver.o \
src/processor/call_stack.o src/processor/cfi_frame_info.o \
src/processor/convert_old_arm64_context.o \
- src/processor/disassembler_objdump.o \
src/processor/disassembler_x86.o src/processor/dump_context.o \
src/processor/dump_object.o src/processor/exploitability.o \
src/processor/exploitability_linux.o \
@@ -927,7 +1105,7 @@ src_processor_minidump_processor_unittest_DEPENDENCIES = \
src/processor/symbolic_constants_win.o \
src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__append_29)
am_src_processor_minidump_stackwalk_OBJECTS = \
src/processor/minidump_stackwalk.$(OBJEXT)
src_processor_minidump_stackwalk_OBJECTS = \
@@ -937,7 +1115,6 @@ src_processor_minidump_stackwalk_DEPENDENCIES = \
src/processor/basic_source_line_resolver.o \
src/processor/call_stack.o src/processor/cfi_frame_info.o \
src/processor/convert_old_arm64_context.o \
- src/processor/disassembler_objdump.o \
src/processor/disassembler_x86.o src/processor/dump_context.o \
src/processor/dump_object.o src/processor/exploitability.o \
src/processor/exploitability_linux.o \
@@ -962,7 +1139,8 @@ src_processor_minidump_stackwalk_DEPENDENCIES = \
src/processor/stackwalker_sparc.o \
src/processor/stackwalker_x86.o \
src/processor/symbolic_constants_win.o \
- src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a
+ src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \
+ $(am__append_32)
am_src_processor_minidump_unittest_OBJECTS = src/common/processor_minidump_unittest-test_assembler.$(OBJEXT) \
src/processor/minidump_unittest-minidump_unittest.$(OBJEXT) \
src/processor/minidump_unittest-synth_minidump.$(OBJEXT)
@@ -1082,9 +1260,7 @@ src_processor_stackwalker_selftest_OBJECTS = \
src_processor_stackwalker_selftest_DEPENDENCIES = \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
- src/processor/call_stack.o \
- src/processor/disassembler_objdump.o \
- src/processor/disassembler_x86.o \
+ src/processor/call_stack.o src/processor/disassembler_x86.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
src/processor/exploitability_win.o src/processor/logging.o \
@@ -1105,7 +1281,7 @@ src_processor_stackwalker_selftest_DEPENDENCIES = \
src/processor/stackwalker_riscv64.o \
src/processor/stackwalker_sparc.o \
src/processor/stackwalker_x86.o src/processor/tokenize.o \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(am__append_30)
am_src_processor_stackwalker_x86_unittest_OBJECTS = src/common/processor_stackwalker_x86_unittest-test_assembler.$(OBJEXT) \
src/processor/stackwalker_x86_unittest-stackwalker_x86_unittest.$(OBJEXT)
src_processor_stackwalker_x86_unittest_OBJECTS = \
@@ -1394,6 +1570,8 @@ am__depfiles_remade = src/client/$(DEPDIR)/minidump_file_writer.Po \
src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-breakpad_getcontext_unittest.Po \
src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-elf_core_dump.Po \
src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-linux_libc_support_unittest.Po \
+ src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Po \
+ src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Po \
src/common/linux/$(DEPDIR)/dumper_unittest-crc32.Po \
src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols.Po \
src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols_unittest.Po \
@@ -1423,6 +1601,10 @@ am__depfiles_remade = src/client/$(DEPDIR)/minidump_file_writer.Po \
src/common/linux/$(DEPDIR)/linux_libc_support.Po \
src/common/linux/$(DEPDIR)/memory_mapped_file.Po \
src/common/linux/$(DEPDIR)/safe_readlink.Po \
+ src/common/linux/$(DEPDIR)/scoped_pipe.Po \
+ src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Po \
+ src/common/linux/$(DEPDIR)/scoped_tmpfile.Po \
+ src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Po \
src/common/linux/$(DEPDIR)/symbol_collector_client.Po \
src/common/linux/$(DEPDIR)/symbol_upload.Po \
src/common/linux/$(DEPDIR)/tools_linux_dump_syms_dump_syms-crc32.Po \
@@ -1617,6 +1799,8 @@ SOURCES = $(src_client_linux_libbreakpad_client_a_SOURCES) \
$(src_common_dwarf_dwarf2reader_lineinfo_unittest_SOURCES) \
$(src_common_dwarf_dwarf2reader_splitfunctions_unittest_SOURCES) \
$(src_common_linux_google_crashdump_uploader_test_SOURCES) \
+ $(src_common_linux_scoped_pipe_unittest_SOURCES) \
+ $(src_common_linux_scoped_tmpfile_unittest_SOURCES) \
$(src_common_mac_macho_reader_unittest_SOURCES) \
$(src_common_safe_math_unittest_SOURCES) \
$(src_common_test_assembler_unittest_SOURCES) \
@@ -1667,7 +1851,7 @@ SOURCES = $(src_client_linux_libbreakpad_client_a_SOURCES) \
$(src_tools_mac_dump_syms_dump_syms_mac_SOURCES)
DIST_SOURCES = \
$(am__src_client_linux_libbreakpad_client_a_SOURCES_DIST) \
- $(src_libbreakpad_a_SOURCES) \
+ $(am__src_libbreakpad_a_SOURCES_DIST) \
$(am__src_testing_libtesting_a_SOURCES_DIST) \
$(src_third_party_libdisasm_libdisasm_a_SOURCES) \
$(src_client_linux_linux_client_unittest_SOURCES) \
@@ -1677,6 +1861,8 @@ DIST_SOURCES = \
$(src_common_dwarf_dwarf2reader_lineinfo_unittest_SOURCES) \
$(src_common_dwarf_dwarf2reader_splitfunctions_unittest_SOURCES) \
$(src_common_linux_google_crashdump_uploader_test_SOURCES) \
+ $(src_common_linux_scoped_pipe_unittest_SOURCES) \
+ $(src_common_linux_scoped_tmpfile_unittest_SOURCES) \
$(src_common_mac_macho_reader_unittest_SOURCES) \
$(src_common_safe_math_unittest_SOURCES) \
$(src_common_test_assembler_unittest_SOURCES) \
@@ -1999,12 +2185,10 @@ DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
-EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
GMOCK_CFLAGS = @GMOCK_CFLAGS@
GMOCK_LIBS = @GMOCK_LIBS@
-GREP = @GREP@
GTEST_CFLAGS = @GTEST_CFLAGS@
GTEST_LIBS = @GTEST_LIBS@
HAVE_CXX17 = @HAVE_CXX17@
@@ -2132,7 +2316,7 @@ includec_HEADERS = $(top_srcdir)/src/common/*.h
includepdir = $(includedir)/$(PACKAGE)/processor
includep_HEADERS = $(top_srcdir)/src/processor/*.h
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = $(am__append_6) $(am__append_12)
+pkgconfig_DATA = $(am__append_6) $(am__append_13)
@SYSTEM_TEST_LIBS_FALSE@TEST_CFLAGS = \
@SYSTEM_TEST_LIBS_FALSE@ -I$(top_srcdir)/src/testing/include \
@SYSTEM_TEST_LIBS_FALSE@ -I$(top_srcdir)/src/testing/googletest/include \
@@ -2156,9 +2340,9 @@ pkgconfig_DATA = $(am__append_6) $(am__append_12)
@ANDROID_HOST_TRUE@LOG_DRIVER = $(top_srcdir)/android/test-driver
check_LIBRARIES = $(am__append_4)
noinst_LIBRARIES = $(am__append_7)
-lib_LIBRARIES = $(am__append_5) $(am__append_11)
+lib_LIBRARIES = $(am__append_5) $(am__append_12)
noinst_SCRIPTS = $(check_SCRIPTS)
-CLEANFILES = $(am__append_15)
+CLEANFILES = $(am__append_16)
@SYSTEM_TEST_LIBS_FALSE@src_testing_libtesting_a_SOURCES = \
@SYSTEM_TEST_LIBS_FALSE@ src/breakpad_googletest_includes.h \
@SYSTEM_TEST_LIBS_FALSE@ src/testing/googletest/src/gtest-all.cc \
@@ -2196,7 +2380,7 @@ src_common_safe_math_unittest_LDADD = \
# Breakpad processor library
-src_libbreakpad_a_SOURCES = \
+src_libbreakpad_a_SOURCES = \
src/google_breakpad/common/breakpad_types.h \
src/google_breakpad/common/minidump_format.h \
src/google_breakpad/common/minidump_size.h \
@@ -2224,26 +2408,21 @@ src_libbreakpad_a_SOURCES = \
src/google_breakpad/processor/stackwalker.h \
src/google_breakpad/processor/symbol_supplier.h \
src/google_breakpad/processor/system_info.h \
- src/processor/address_map-inl.h \
- src/processor/address_map.h \
+ src/processor/address_map-inl.h src/processor/address_map.h \
src/processor/basic_code_module.h \
src/processor/basic_code_modules.cc \
src/processor/basic_code_modules.h \
src/processor/basic_source_line_resolver_types.h \
src/processor/basic_source_line_resolver.cc \
- src/processor/call_stack.cc \
- src/processor/cfi_frame_info.cc \
+ src/processor/call_stack.cc src/processor/cfi_frame_info.cc \
src/processor/cfi_frame_info.h \
src/processor/contained_range_map-inl.h \
src/processor/contained_range_map.h \
src/processor/convert_old_arm64_context.cc \
src/processor/convert_old_arm64_context.h \
- src/processor/disassembler_objdump.h \
- src/processor/disassembler_objdump.cc \
src/processor/disassembler_x86.h \
src/processor/disassembler_x86.cc \
- src/processor/dump_context.cc \
- src/processor/dump_object.cc \
+ src/processor/dump_context.cc src/processor/dump_object.cc \
src/processor/exploitability.cc \
src/processor/exploitability_linux.h \
src/processor/exploitability_linux.cc \
@@ -2251,18 +2430,13 @@ src_libbreakpad_a_SOURCES = \
src/processor/exploitability_win.cc \
src/processor/fast_source_line_resolver_types.h \
src/processor/fast_source_line_resolver.cc \
- src/processor/linked_ptr.h \
- src/processor/logging.h \
- src/processor/logging.cc \
- src/processor/map_serializers-inl.h \
- src/processor/map_serializers.h \
- src/processor/microdump.cc \
- src/processor/microdump_processor.cc \
- src/processor/minidump.cc \
+ src/processor/linked_ptr.h src/processor/logging.h \
+ src/processor/logging.cc src/processor/map_serializers-inl.h \
+ src/processor/map_serializers.h src/processor/microdump.cc \
+ src/processor/microdump_processor.cc src/processor/minidump.cc \
src/processor/minidump_processor.cc \
src/processor/module_comparer.cc \
- src/processor/module_comparer.h \
- src/processor/module_factory.h \
+ src/processor/module_comparer.h src/processor/module_factory.h \
src/processor/module_serializer.cc \
src/processor/module_serializer.h \
src/processor/pathname_stripper.cc \
@@ -2270,8 +2444,7 @@ src_libbreakpad_a_SOURCES = \
src/processor/postfix_evaluator-inl.h \
src/processor/postfix_evaluator.h \
src/processor/process_state.cc \
- src/processor/proc_maps_linux.cc \
- src/processor/range_map-inl.h \
+ src/processor/proc_maps_linux.cc src/processor/range_map-inl.h \
src/processor/range_map.h \
src/processor/simple_serializer-inl.h \
src/processor/simple_serializer.h \
@@ -2283,8 +2456,7 @@ src_libbreakpad_a_SOURCES = \
src/processor/stack_frame_cpu.cc \
src/processor/stack_frame_symbolizer.cc \
src/processor/stackwalk_common.cc \
- src/processor/stackwalk_common.h \
- src/processor/stackwalker.cc \
+ src/processor/stackwalk_common.h src/processor/stackwalker.cc \
src/processor/stackwalker_amd64.cc \
src/processor/stackwalker_amd64.h \
src/processor/stackwalker_arm.cc \
@@ -2313,15 +2485,13 @@ src_libbreakpad_a_SOURCES = \
src/processor/static_contained_range_map.h \
src/processor/static_map_iterator-inl.h \
src/processor/static_map_iterator.h \
- src/processor/static_map-inl.h \
- src/processor/static_map.h \
+ src/processor/static_map-inl.h src/processor/static_map.h \
src/processor/static_range_map-inl.h \
src/processor/static_range_map.h \
src/processor/symbolic_constants_win.cc \
src/processor/symbolic_constants_win.h \
- src/processor/tokenize.cc \
- src/processor/tokenize.h
-
+ src/processor/tokenize.cc src/processor/tokenize.h \
+ $(am__append_22)
# libdisasm 3rd party library
src_third_party_libdisasm_libdisasm_a_SOURCES = \
@@ -2382,7 +2552,7 @@ src_client_linux_libbreakpad_client_a_SOURCES = \
src/common/linux/guid_creator.h \
src/common/linux/linux_libc_support.cc \
src/common/linux/memory_mapped_file.cc \
- src/common/linux/safe_readlink.cc $(am__append_21)
+ src/common/linux/safe_readlink.cc $(am__append_23)
# Client tests
src_client_linux_linux_dumper_unittest_helper_SOURCES = \
@@ -2410,7 +2580,9 @@ src_client_linux_linux_client_unittest_shlib_SOURCES = \
src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc \
src/common/linux/elf_core_dump.cc \
src/common/linux/linux_libc_support_unittest.cc \
- src/common/linux/tests/auto_testfile.h \
+ src/common/linux/scoped_pipe.h src/common/linux/scoped_pipe.cc \
+ src/common/linux/scoped_tmpfile.h \
+ src/common/linux/scoped_tmpfile.cc \
src/common/linux/tests/crash_generator.cc \
src/common/memory_allocator_unittest.cc \
src/common/tests/auto_tempdir.h src/common/tests/file_utils.cc \
@@ -2420,12 +2592,12 @@ src_client_linux_linux_client_unittest_shlib_SOURCES = \
src/processor/dump_context.cc src/processor/dump_object.cc \
src/processor/logging.cc src/processor/minidump.cc \
src/processor/pathname_stripper.cc \
- src/processor/proc_maps_linux.cc $(am__append_22)
+ src/processor/proc_maps_linux.cc $(am__append_24)
src_client_linux_linux_client_unittest_shlib_CPPFLAGS = \
$(AM_CPPFLAGS) $(TEST_CFLAGS)
src_client_linux_linux_client_unittest_shlib_LDFLAGS = -shared \
- -Wl,-h,linux_client_unittest_shlib $(am__append_23)
+ -Wl,-h,linux_client_unittest_shlib $(am__append_25)
src_client_linux_linux_client_unittest_shlib_LDADD = \
src/client/linux/crash_generation/crash_generation_client.o \
src/client/linux/dump_writer_common/thread_info.o \
@@ -2461,7 +2633,7 @@ src_client_linux_linux_client_unittest_SOURCES =
src_client_linux_linux_client_unittest_LDFLAGS = \
-Wl,-rpath,'$$ORIGIN' \
-Wl,--build-id=0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \
- $(am__append_24)
+ $(am__append_26)
src_client_linux_linux_client_unittest_LDADD = \
src/client/linux/linux_client_unittest_shlib \
$(TEST_LIBS)
@@ -2523,7 +2695,7 @@ src_tools_linux_dump_syms_dump_syms_CXXFLAGS = \
src_tools_linux_dump_syms_dump_syms_LDADD = \
$(RUSTC_DEMANGLE_LIBS) \
- -lz
+ -lz -lzstd
src_tools_linux_md2core_minidump_2_core_SOURCES = \
src/common/linux/memory_mapped_file.cc \
@@ -2656,7 +2828,7 @@ src_common_dumper_unittest_LDADD = \
$(TEST_LIBS) \
$(RUSTC_DEMANGLE_LIBS) \
$(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \
- -lz
+ -lz -lzstd
src_common_mac_macho_reader_unittest_SOURCES = \
src/common/dwarf_cfi_to_module.cc \
@@ -2765,23 +2937,18 @@ src_processor_exploitability_unittest_SOURCES = \
src_processor_exploitability_unittest_CPPFLAGS = \
$(AM_CPPFLAGS) $(TEST_CFLAGS)
-src_processor_exploitability_unittest_LDADD = \
+src_processor_exploitability_unittest_LDADD = \
src/processor/convert_old_arm64_context.o \
src/processor/minidump_processor.o \
- src/processor/process_state.o \
- src/processor/disassembler_objdump.o \
- src/processor/disassembler_x86.o \
+ src/processor/process_state.o src/processor/disassembler_x86.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
src/processor/exploitability_win.o \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
- src/processor/call_stack.o \
- src/processor/cfi_frame_info.o \
- src/processor/dump_context.o \
- src/processor/dump_object.o \
- src/processor/logging.o \
- src/processor/minidump.o \
+ src/processor/call_stack.o src/processor/cfi_frame_info.o \
+ src/processor/dump_context.o src/processor/dump_object.o \
+ src/processor/logging.o src/processor/minidump.o \
src/processor/pathname_stripper.o \
src/processor/proc_maps_linux.o \
src/processor/simple_symbol_supplier.o \
@@ -2801,8 +2968,28 @@ src_processor_exploitability_unittest_LDADD = \
src/processor/stackwalker_sparc.o \
src/processor/stackwalker_x86.o \
src/processor/symbolic_constants_win.o \
- src/processor/tokenize.o \
- src/third_party/libdisasm/libdisasm.a \
+ src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \
+ $(TEST_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \
+ $(am__append_27)
+src_common_linux_scoped_pipe_unittest_SOURCES = \
+ src/common/linux/scoped_pipe_unittest.cc
+
+src_common_linux_scoped_pipe_unittest_CPPFLAGS = \
+ $(AM_CPPFLAGS) $(TEST_CFLAGS)
+
+src_common_linux_scoped_pipe_unittest_LDADD = \
+ src/common/linux/scoped_pipe.o \
+ $(TEST_LIBS) \
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+
+src_common_linux_scoped_tmpfile_unittest_SOURCES = \
+ src/common/linux/scoped_tmpfile_unittest.cc
+
+src_common_linux_scoped_tmpfile_unittest_CPPFLAGS = \
+ $(AM_CPPFLAGS) $(TEST_CFLAGS)
+
+src_common_linux_scoped_tmpfile_unittest_LDADD = \
+ src/common/linux/scoped_tmpfile.o \
$(TEST_LIBS) \
$(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
@@ -2813,6 +3000,8 @@ src_processor_disassembler_objdump_unittest_CPPFLAGS = \
$(AM_CPPFLAGS) $(TEST_CFLAGS)
src_processor_disassembler_objdump_unittest_LDADD = \
+ src/common/linux/scoped_pipe.o \
+ src/common/linux/scoped_tmpfile.o \
src/processor/disassembler_objdump.o \
src/processor/dump_context.o \
src/processor/dump_object.o \
@@ -2870,17 +3059,14 @@ src_processor_microdump_processor_unittest_SOURCES = \
src_processor_microdump_processor_unittest_CPPFLAGS = \
$(AM_CPPFLAGS) $(TEST_CFLAGS)
-src_processor_microdump_processor_unittest_LDADD = \
+src_processor_microdump_processor_unittest_LDADD = \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
src/processor/call_stack.o \
- src/processor/convert_old_arm64_context.o \
- src/processor/cfi_frame_info.o \
- src/processor/dump_context.o \
- src/processor/dump_object.o \
- src/processor/logging.o \
- src/processor/microdump.o \
- src/processor/microdump_processor.o \
+ src/processor/convert_old_arm64_context.o \
+ src/processor/cfi_frame_info.o src/processor/dump_context.o \
+ src/processor/dump_object.o src/processor/logging.o \
+ src/processor/microdump.o src/processor/microdump_processor.o \
src/processor/pathname_stripper.o \
src/processor/process_state.o \
src/processor/simple_symbol_supplier.o \
@@ -2897,36 +3083,27 @@ src_processor_microdump_processor_unittest_LDADD = \
src/processor/stackwalker_riscv.o \
src/processor/stackwalker_riscv64.o \
src/processor/stackwalker_sparc.o \
- src/processor/stackwalker_x86.o \
- src/processor/tokenize.o \
- $(TEST_LIBS) \
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
-
+ src/processor/stackwalker_x86.o src/processor/tokenize.o \
+ $(TEST_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \
+ $(am__append_28)
src_processor_minidump_processor_unittest_SOURCES = \
src/processor/minidump_processor_unittest.cc
src_processor_minidump_processor_unittest_CPPFLAGS = \
$(AM_CPPFLAGS) $(TEST_CFLAGS)
-src_processor_minidump_processor_unittest_LDADD = \
+src_processor_minidump_processor_unittest_LDADD = \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
- src/processor/call_stack.o \
- src/processor/cfi_frame_info.o \
+ src/processor/call_stack.o src/processor/cfi_frame_info.o \
src/processor/convert_old_arm64_context.o \
- src/processor/disassembler_objdump.o \
- src/processor/disassembler_x86.o \
- src/processor/dump_context.o \
- src/processor/dump_object.o \
- src/processor/exploitability.o \
+ src/processor/disassembler_x86.o src/processor/dump_context.o \
+ src/processor/dump_object.o src/processor/exploitability.o \
src/processor/exploitability_linux.o \
- src/processor/exploitability_win.o \
- src/processor/logging.o \
- src/processor/minidump_processor.o \
- src/processor/minidump.o \
+ src/processor/exploitability_win.o src/processor/logging.o \
+ src/processor/minidump_processor.o src/processor/minidump.o \
src/processor/pathname_stripper.o \
- src/processor/process_state.o \
- src/processor/proc_maps_linux.o \
+ src/processor/process_state.o src/processor/proc_maps_linux.o \
src/processor/source_line_resolver_base.o \
src/processor/stack_frame_cpu.o \
src/processor/stack_frame_symbolizer.o \
@@ -2943,11 +3120,9 @@ src_processor_minidump_processor_unittest_LDADD = \
src/processor/stackwalker_sparc.o \
src/processor/stackwalker_x86.o \
src/processor/symbolic_constants_win.o \
- src/processor/tokenize.o \
- src/third_party/libdisasm/libdisasm.a \
- $(TEST_LIBS) \
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
-
+ src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \
+ $(TEST_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \
+ $(am__append_29)
src_processor_minidump_unittest_SOURCES = \
src/common/test_assembler.cc \
src/processor/minidump_unittest.cc \
@@ -3080,18 +3255,14 @@ src_processor_range_map_unittest_LDADD = \
src_processor_stackwalker_selftest_SOURCES = \
src/processor/stackwalker_selftest.cc
-src_processor_stackwalker_selftest_LDADD = \
+src_processor_stackwalker_selftest_LDADD = \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
- src/processor/call_stack.o \
- src/processor/disassembler_objdump.o \
- src/processor/disassembler_x86.o \
+ src/processor/call_stack.o src/processor/disassembler_x86.o \
src/processor/exploitability.o \
src/processor/exploitability_linux.o \
- src/processor/exploitability_win.o \
- src/processor/logging.o \
- src/processor/minidump.o \
- src/processor/pathname_stripper.o \
+ src/processor/exploitability_win.o src/processor/logging.o \
+ src/processor/minidump.o src/processor/pathname_stripper.o \
src/processor/proc_maps_linux.o \
src/processor/source_line_resolver_base.o \
src/processor/stack_frame_cpu.o \
@@ -3107,10 +3278,8 @@ src_processor_stackwalker_selftest_LDADD = \
src/processor/stackwalker_riscv.o \
src/processor/stackwalker_riscv64.o \
src/processor/stackwalker_sparc.o \
- src/processor/stackwalker_x86.o \
- src/processor/tokenize.o \
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
-
+ src/processor/stackwalker_x86.o src/processor/tokenize.o \
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(am__append_30)
src_processor_stackwalker_amd64_unittest_SOURCES = \
src/common/test_assembler.cc \
src/processor/stackwalker_amd64_unittest.cc
@@ -3290,27 +3459,22 @@ src_processor_minidump_dump_LDADD = \
src_processor_microdump_stackwalk_SOURCES = \
src/processor/microdump_stackwalk.cc
-src_processor_microdump_stackwalk_LDADD = \
- src/common/path_helper.o \
+src_processor_microdump_stackwalk_LDADD = src/common/path_helper.o \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
src/processor/call_stack.o \
src/processor/convert_old_arm64_context.o \
src/processor/cfi_frame_info.o \
- src/processor/disassembler_x86.o \
- src/processor/dump_context.o \
- src/processor/dump_object.o \
- src/processor/logging.o \
- src/processor/microdump.o \
- src/processor/microdump_processor.o \
+ src/processor/disassembler_x86.o src/processor/dump_context.o \
+ src/processor/dump_object.o src/processor/logging.o \
+ src/processor/microdump.o src/processor/microdump_processor.o \
src/processor/pathname_stripper.o \
src/processor/process_state.o \
src/processor/simple_symbol_supplier.o \
src/processor/source_line_resolver_base.o \
src/processor/stack_frame_cpu.o \
src/processor/stack_frame_symbolizer.o \
- src/processor/stackwalk_common.o \
- src/processor/stackwalker.o \
+ src/processor/stackwalk_common.o src/processor/stackwalker.o \
src/processor/stackwalker_address_list.o \
src/processor/stackwalker_amd64.o \
src/processor/stackwalker_arm.o \
@@ -3321,39 +3485,28 @@ src_processor_microdump_stackwalk_LDADD = \
src/processor/stackwalker_riscv.o \
src/processor/stackwalker_riscv64.o \
src/processor/stackwalker_sparc.o \
- src/processor/stackwalker_x86.o \
- src/processor/tokenize.o \
- src/third_party/libdisasm/libdisasm.a
-
+ src/processor/stackwalker_x86.o src/processor/tokenize.o \
+ src/third_party/libdisasm/libdisasm.a $(am__append_31)
src_processor_minidump_stackwalk_SOURCES = \
src/processor/minidump_stackwalk.cc
-src_processor_minidump_stackwalk_LDADD = \
- src/common/path_helper.o \
+src_processor_minidump_stackwalk_LDADD = src/common/path_helper.o \
src/processor/basic_code_modules.o \
src/processor/basic_source_line_resolver.o \
- src/processor/call_stack.o \
- src/processor/cfi_frame_info.o \
+ src/processor/call_stack.o src/processor/cfi_frame_info.o \
src/processor/convert_old_arm64_context.o \
- src/processor/disassembler_objdump.o \
- src/processor/disassembler_x86.o \
- src/processor/dump_context.o \
- src/processor/dump_object.o \
- src/processor/exploitability.o \
+ src/processor/disassembler_x86.o src/processor/dump_context.o \
+ src/processor/dump_object.o src/processor/exploitability.o \
src/processor/exploitability_linux.o \
- src/processor/exploitability_win.o \
- src/processor/logging.o \
- src/processor/minidump.o \
- src/processor/minidump_processor.o \
+ src/processor/exploitability_win.o src/processor/logging.o \
+ src/processor/minidump.o src/processor/minidump_processor.o \
src/processor/pathname_stripper.o \
- src/processor/process_state.o \
- src/processor/proc_maps_linux.o \
+ src/processor/process_state.o src/processor/proc_maps_linux.o \
src/processor/simple_symbol_supplier.o \
src/processor/source_line_resolver_base.o \
src/processor/stack_frame_cpu.o \
src/processor/stack_frame_symbolizer.o \
- src/processor/stackwalk_common.o \
- src/processor/stackwalker.o \
+ src/processor/stackwalk_common.o src/processor/stackwalker.o \
src/processor/stackwalker_address_list.o \
src/processor/stackwalker_amd64.o \
src/processor/stackwalker_arm.o \
@@ -3366,9 +3519,8 @@ src_processor_minidump_stackwalk_LDADD = \
src/processor/stackwalker_sparc.o \
src/processor/stackwalker_x86.o \
src/processor/symbolic_constants_win.o \
- src/processor/tokenize.o \
- src/third_party/libdisasm/libdisasm.a
-
+ src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \
+ $(am__append_32)
EXTRA_DIST = \
$(SCRIPTS) \
src/client/linux/data/linux-gate-amd.sym \
@@ -3580,10 +3732,12 @@ EXTRA_DIST = \
src/third_party/curl/typecheck-gcc.h \
src/third_party/curl/types.h \
src/third_party/mac_headers/architecture/byte_order.h \
+ src/third_party/mac_headers/arm/_types.h \
src/third_party/mac_headers/i386/_types.h \
src/third_party/mac_headers/mach/boolean.h \
+ src/third_party/mac_headers/mach/arm/boolean.h \
+ src/third_party/mac_headers/mach/arm/vm_types.h \
src/third_party/mac_headers/mach/i386/boolean.h \
- src/third_party/mac_headers/mach/i386/vm_param.h \
src/third_party/mac_headers/mach/i386/vm_types.h \
src/third_party/mac_headers/mach/machine/boolean.h \
src/third_party/mac_headers/mach/machine.h \
@@ -3965,9 +4119,6 @@ src/processor/cfi_frame_info.$(OBJEXT): src/processor/$(am__dirstamp) \
src/processor/convert_old_arm64_context.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
-src/processor/disassembler_objdump.$(OBJEXT): \
- src/processor/$(am__dirstamp) \
- src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/disassembler_x86.$(OBJEXT): \
src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
@@ -4067,6 +4218,15 @@ src/processor/symbolic_constants_win.$(OBJEXT): \
src/processor/$(DEPDIR)/$(am__dirstamp)
src/processor/tokenize.$(OBJEXT): src/processor/$(am__dirstamp) \
src/processor/$(DEPDIR)/$(am__dirstamp)
+src/common/linux/scoped_pipe.$(OBJEXT): \
+ src/common/linux/$(am__dirstamp) \
+ src/common/linux/$(DEPDIR)/$(am__dirstamp)
+src/common/linux/scoped_tmpfile.$(OBJEXT): \
+ src/common/linux/$(am__dirstamp) \
+ src/common/linux/$(DEPDIR)/$(am__dirstamp)
+src/processor/disassembler_objdump.$(OBJEXT): \
+ src/processor/$(am__dirstamp) \
+ src/processor/$(DEPDIR)/$(am__dirstamp)
src/$(am__dirstamp):
@$(MKDIR_P) src
@: > src/$(am__dirstamp)
@@ -4212,6 +4372,12 @@ src/common/linux/client_linux_linux_client_unittest_shlib-elf_core_dump.$(OBJEXT
src/common/linux/client_linux_linux_client_unittest_shlib-linux_libc_support_unittest.$(OBJEXT): \
src/common/linux/$(am__dirstamp) \
src/common/linux/$(DEPDIR)/$(am__dirstamp)
+src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.$(OBJEXT): \
+ src/common/linux/$(am__dirstamp) \
+ src/common/linux/$(DEPDIR)/$(am__dirstamp)
+src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.$(OBJEXT): \
+ src/common/linux/$(am__dirstamp) \
+ src/common/linux/$(DEPDIR)/$(am__dirstamp)
src/common/linux/tests/$(am__dirstamp):
@$(MKDIR_P) src/common/linux/tests
@: > src/common/linux/tests/$(am__dirstamp)
@@ -4458,6 +4624,20 @@ src/common/linux/google_crashdump_uploader_test-libcurl_wrapper.$(OBJEXT): \
src/common/linux/google_crashdump_uploader_test$(EXEEXT): $(src_common_linux_google_crashdump_uploader_test_OBJECTS) $(src_common_linux_google_crashdump_uploader_test_DEPENDENCIES) $(EXTRA_src_common_linux_google_crashdump_uploader_test_DEPENDENCIES) src/common/linux/$(am__dirstamp)
@rm -f src/common/linux/google_crashdump_uploader_test$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(src_common_linux_google_crashdump_uploader_test_OBJECTS) $(src_common_linux_google_crashdump_uploader_test_LDADD) $(LIBS)
+src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.$(OBJEXT): \
+ src/common/linux/$(am__dirstamp) \
+ src/common/linux/$(DEPDIR)/$(am__dirstamp)
+
+src/common/linux/scoped_pipe_unittest$(EXEEXT): $(src_common_linux_scoped_pipe_unittest_OBJECTS) $(src_common_linux_scoped_pipe_unittest_DEPENDENCIES) $(EXTRA_src_common_linux_scoped_pipe_unittest_DEPENDENCIES) src/common/linux/$(am__dirstamp)
+ @rm -f src/common/linux/scoped_pipe_unittest$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(src_common_linux_scoped_pipe_unittest_OBJECTS) $(src_common_linux_scoped_pipe_unittest_LDADD) $(LIBS)
+src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.$(OBJEXT): \
+ src/common/linux/$(am__dirstamp) \
+ src/common/linux/$(DEPDIR)/$(am__dirstamp)
+
+src/common/linux/scoped_tmpfile_unittest$(EXEEXT): $(src_common_linux_scoped_tmpfile_unittest_OBJECTS) $(src_common_linux_scoped_tmpfile_unittest_DEPENDENCIES) $(EXTRA_src_common_linux_scoped_tmpfile_unittest_DEPENDENCIES) src/common/linux/$(am__dirstamp)
+ @rm -f src/common/linux/scoped_tmpfile_unittest$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(src_common_linux_scoped_tmpfile_unittest_OBJECTS) $(src_common_linux_scoped_tmpfile_unittest_LDADD) $(LIBS)
src/common/mac_macho_reader_unittest-dwarf_cfi_to_module.$(OBJEXT): \
src/common/$(am__dirstamp) \
src/common/$(DEPDIR)/$(am__dirstamp)
@@ -5248,6 +5428,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-breakpad_getcontext_unittest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-elf_core_dump.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-linux_libc_support_unittest.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/dumper_unittest-crc32.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols_unittest.Po@am__quote@ # am--include-marker
@@ -5277,6 +5459,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/linux_libc_support.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/memory_mapped_file.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/safe_readlink.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/scoped_pipe.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/scoped_tmpfile.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/symbol_collector_client.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/symbol_upload.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/common/linux/$(DEPDIR)/tools_linux_dump_syms_dump_syms-crc32.Po@am__quote@ # am--include-marker
@@ -5773,6 +5959,34 @@ src/common/linux/client_linux_linux_client_unittest_shlib-linux_libc_support_uni
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/client_linux_linux_client_unittest_shlib-linux_libc_support_unittest.obj `if test -f 'src/common/linux/linux_libc_support_unittest.cc'; then $(CYGPATH_W) 'src/common/linux/linux_libc_support_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/linux_libc_support_unittest.cc'; fi`
+src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.o: src/common/linux/scoped_pipe.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.o -MD -MP -MF src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Tpo -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.o `test -f 'src/common/linux/scoped_pipe.cc' || echo '$(srcdir)/'`src/common/linux/scoped_pipe.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Tpo src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_pipe.cc' object='src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.o `test -f 'src/common/linux/scoped_pipe.cc' || echo '$(srcdir)/'`src/common/linux/scoped_pipe.cc
+
+src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.obj: src/common/linux/scoped_pipe.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.obj -MD -MP -MF src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Tpo -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.obj `if test -f 'src/common/linux/scoped_pipe.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_pipe.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_pipe.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Tpo src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_pipe.cc' object='src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_pipe.obj `if test -f 'src/common/linux/scoped_pipe.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_pipe.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_pipe.cc'; fi`
+
+src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.o: src/common/linux/scoped_tmpfile.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.o -MD -MP -MF src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Tpo -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.o `test -f 'src/common/linux/scoped_tmpfile.cc' || echo '$(srcdir)/'`src/common/linux/scoped_tmpfile.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Tpo src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_tmpfile.cc' object='src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.o `test -f 'src/common/linux/scoped_tmpfile.cc' || echo '$(srcdir)/'`src/common/linux/scoped_tmpfile.cc
+
+src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.obj: src/common/linux/scoped_tmpfile.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.obj -MD -MP -MF src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Tpo -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.obj `if test -f 'src/common/linux/scoped_tmpfile.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_tmpfile.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_tmpfile.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Tpo src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_tmpfile.cc' object='src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/client_linux_linux_client_unittest_shlib-scoped_tmpfile.obj `if test -f 'src/common/linux/scoped_tmpfile.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_tmpfile.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_tmpfile.cc'; fi`
+
src/common/linux/tests/client_linux_linux_client_unittest_shlib-crash_generator.o: src/common/linux/tests/crash_generator.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_client_linux_linux_client_unittest_shlib_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/tests/client_linux_linux_client_unittest_shlib-crash_generator.o -MD -MP -MF src/common/linux/tests/$(DEPDIR)/client_linux_linux_client_unittest_shlib-crash_generator.Tpo -c -o src/common/linux/tests/client_linux_linux_client_unittest_shlib-crash_generator.o `test -f 'src/common/linux/tests/crash_generator.cc' || echo '$(srcdir)/'`src/common/linux/tests/crash_generator.cc
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/tests/$(DEPDIR)/client_linux_linux_client_unittest_shlib-crash_generator.Tpo src/common/linux/tests/$(DEPDIR)/client_linux_linux_client_unittest_shlib-crash_generator.Po
@@ -6711,6 +6925,34 @@ src/common/linux/google_crashdump_uploader_test-libcurl_wrapper.obj: src/common/
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_google_crashdump_uploader_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/google_crashdump_uploader_test-libcurl_wrapper.obj `if test -f 'src/common/linux/libcurl_wrapper.cc'; then $(CYGPATH_W) 'src/common/linux/libcurl_wrapper.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/libcurl_wrapper.cc'; fi`
+src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.o: src/common/linux/scoped_pipe_unittest.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_pipe_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.o -MD -MP -MF src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Tpo -c -o src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.o `test -f 'src/common/linux/scoped_pipe_unittest.cc' || echo '$(srcdir)/'`src/common/linux/scoped_pipe_unittest.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Tpo src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_pipe_unittest.cc' object='src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_pipe_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.o `test -f 'src/common/linux/scoped_pipe_unittest.cc' || echo '$(srcdir)/'`src/common/linux/scoped_pipe_unittest.cc
+
+src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.obj: src/common/linux/scoped_pipe_unittest.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_pipe_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.obj -MD -MP -MF src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Tpo -c -o src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.obj `if test -f 'src/common/linux/scoped_pipe_unittest.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_pipe_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_pipe_unittest.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Tpo src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_pipe_unittest.cc' object='src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_pipe_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/scoped_pipe_unittest-scoped_pipe_unittest.obj `if test -f 'src/common/linux/scoped_pipe_unittest.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_pipe_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_pipe_unittest.cc'; fi`
+
+src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.o: src/common/linux/scoped_tmpfile_unittest.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_tmpfile_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.o -MD -MP -MF src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Tpo -c -o src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.o `test -f 'src/common/linux/scoped_tmpfile_unittest.cc' || echo '$(srcdir)/'`src/common/linux/scoped_tmpfile_unittest.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Tpo src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_tmpfile_unittest.cc' object='src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_tmpfile_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.o `test -f 'src/common/linux/scoped_tmpfile_unittest.cc' || echo '$(srcdir)/'`src/common/linux/scoped_tmpfile_unittest.cc
+
+src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.obj: src/common/linux/scoped_tmpfile_unittest.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_tmpfile_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.obj -MD -MP -MF src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Tpo -c -o src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.obj `if test -f 'src/common/linux/scoped_tmpfile_unittest.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_tmpfile_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_tmpfile_unittest.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Tpo src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/common/linux/scoped_tmpfile_unittest.cc' object='src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_linux_scoped_tmpfile_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/common/linux/scoped_tmpfile_unittest-scoped_tmpfile_unittest.obj `if test -f 'src/common/linux/scoped_tmpfile_unittest.cc'; then $(CYGPATH_W) 'src/common/linux/scoped_tmpfile_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/common/linux/scoped_tmpfile_unittest.cc'; fi`
+
src/common/mac_macho_reader_unittest-dwarf_cfi_to_module.o: src/common/dwarf_cfi_to_module.cc
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_common_mac_macho_reader_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/common/mac_macho_reader_unittest-dwarf_cfi_to_module.o -MD -MP -MF src/common/$(DEPDIR)/mac_macho_reader_unittest-dwarf_cfi_to_module.Tpo -c -o src/common/mac_macho_reader_unittest-dwarf_cfi_to_module.o `test -f 'src/common/dwarf_cfi_to_module.cc' || echo '$(srcdir)/'`src/common/dwarf_cfi_to_module.cc
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/common/$(DEPDIR)/mac_macho_reader_unittest-dwarf_cfi_to_module.Tpo src/common/$(DEPDIR)/mac_macho_reader_unittest-dwarf_cfi_to_module.Po
@@ -8766,13 +9008,6 @@ src/processor/contained_range_map_unittest.log: src/processor/contained_range_ma
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
-src/processor/disassembler_objdump_unittest.log: src/processor/disassembler_objdump_unittest$(EXEEXT)
- @p='src/processor/disassembler_objdump_unittest$(EXEEXT)'; \
- b='src/processor/disassembler_objdump_unittest'; \
- $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
- --log-file $$b.log --trs-file $$b.trs \
- $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
- "$$tst" $(AM_TESTS_FD_REDIRECT)
src/processor/disassembler_x86_unittest.log: src/processor/disassembler_x86_unittest$(EXEEXT)
@p='src/processor/disassembler_x86_unittest$(EXEEXT)'; \
b='src/processor/disassembler_x86_unittest'; \
@@ -8962,6 +9197,27 @@ src/processor/synth_minidump_unittest.log: src/processor/synth_minidump_unittest
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+src/processor/disassembler_objdump_unittest.log: src/processor/disassembler_objdump_unittest$(EXEEXT)
+ @p='src/processor/disassembler_objdump_unittest$(EXEEXT)'; \
+ b='src/processor/disassembler_objdump_unittest'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+src/common/linux/scoped_pipe_unittest.log: src/common/linux/scoped_pipe_unittest$(EXEEXT)
+ @p='src/common/linux/scoped_pipe_unittest$(EXEEXT)'; \
+ b='src/common/linux/scoped_pipe_unittest'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+src/common/linux/scoped_tmpfile_unittest.log: src/common/linux/scoped_tmpfile_unittest$(EXEEXT)
+ @p='src/common/linux/scoped_tmpfile_unittest$(EXEEXT)'; \
+ b='src/common/linux/scoped_tmpfile_unittest'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
src/processor/stackwalker_selftest.log: src/processor/stackwalker_selftest$(EXEEXT)
@p='src/processor/stackwalker_selftest$(EXEEXT)'; \
b='src/processor/stackwalker_selftest'; \
@@ -9454,6 +9710,8 @@ distclean: distclean-am
-rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-breakpad_getcontext_unittest.Po
-rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-elf_core_dump.Po
-rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-linux_libc_support_unittest.Po
+ -rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Po
+ -rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Po
-rm -f src/common/linux/$(DEPDIR)/dumper_unittest-crc32.Po
-rm -f src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols.Po
-rm -f src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols_unittest.Po
@@ -9483,6 +9741,10 @@ distclean: distclean-am
-rm -f src/common/linux/$(DEPDIR)/linux_libc_support.Po
-rm -f src/common/linux/$(DEPDIR)/memory_mapped_file.Po
-rm -f src/common/linux/$(DEPDIR)/safe_readlink.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_pipe.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_tmpfile.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Po
-rm -f src/common/linux/$(DEPDIR)/symbol_collector_client.Po
-rm -f src/common/linux/$(DEPDIR)/symbol_upload.Po
-rm -f src/common/linux/$(DEPDIR)/tools_linux_dump_syms_dump_syms-crc32.Po
@@ -9808,6 +10070,8 @@ maintainer-clean: maintainer-clean-am
-rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-breakpad_getcontext_unittest.Po
-rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-elf_core_dump.Po
-rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-linux_libc_support_unittest.Po
+ -rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_pipe.Po
+ -rm -f src/common/linux/$(DEPDIR)/client_linux_linux_client_unittest_shlib-scoped_tmpfile.Po
-rm -f src/common/linux/$(DEPDIR)/dumper_unittest-crc32.Po
-rm -f src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols.Po
-rm -f src/common/linux/$(DEPDIR)/dumper_unittest-dump_symbols_unittest.Po
@@ -9837,6 +10101,10 @@ maintainer-clean: maintainer-clean-am
-rm -f src/common/linux/$(DEPDIR)/linux_libc_support.Po
-rm -f src/common/linux/$(DEPDIR)/memory_mapped_file.Po
-rm -f src/common/linux/$(DEPDIR)/safe_readlink.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_pipe.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_pipe_unittest-scoped_pipe_unittest.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_tmpfile.Po
+ -rm -f src/common/linux/$(DEPDIR)/scoped_tmpfile_unittest-scoped_tmpfile_unittest.Po
-rm -f src/common/linux/$(DEPDIR)/symbol_collector_client.Po
-rm -f src/common/linux/$(DEPDIR)/symbol_upload.Po
-rm -f src/common/linux/$(DEPDIR)/tools_linux_dump_syms_dump_syms-crc32.Po
diff --git a/aclocal.m4 b/aclocal.m4
index 009cc48e..31be0bad 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -848,35 +848,6 @@ else
fi
])
-# -*- Autoconf -*-
-# Obsolete and "removed" macros, that must however still report explicit
-# error messages when used, to smooth transition.
-#
-# Copyright (C) 1996-2021 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([AM_CONFIG_HEADER],
-[AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
-AC_CONFIG_HEADERS($@)])
-
-AC_DEFUN([AM_PROG_CC_STDC],
-[AC_PROG_CC
-am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
-AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should simply use the 'AC][_PROG_CC' macro instead.
-Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
-but upon 'ac_cv_prog_cc_stdc'.])])
-
-AC_DEFUN([AM_C_PROTOTYPES],
- [AC_FATAL([automatic de-ANSI-fication support has been removed])])
-AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
-
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
diff --git a/configure b/configure
index 76d4a9f6..3442e796 100755
--- a/configure
+++ b/configure
@@ -182,8 +182,7 @@ test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
- test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1"
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
if (eval "$as_required") 2>/dev/null
then :
as_have_required=yes
@@ -685,8 +684,6 @@ PTHREAD_CFLAGS
PTHREAD_LIBS
PTHREAD_CC
ax_pthread_config
-EGREP
-GREP
RANLIB
am__fastdepCXX_FALSE
am__fastdepCXX_TRUE
@@ -813,6 +810,7 @@ enable_system_test_libs
enable_selftest
with_rustc_demangle
enable_system_rustc_demangle
+enable_zstd
with_tests_as_root
'
ac_precious_vars='build_alias
@@ -1486,6 +1484,7 @@ Optional Features:
is no). This assumes that rustc-demangle is
installed in your sysroot, and all headers from it
are available in your standard include path
+ --enable-zstd Enable decompression of ELF sections with zstd
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1719,39 +1718,6 @@ fi
} # ac_fn_cxx_try_compile
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-printf %s "checking for $2... " >&6; }
-if eval test \${$3+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"
-then :
- eval "$3=yes"
-else $as_nop
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-printf "%s\n" "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_compile
-
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
@@ -1799,6 +1765,39 @@ fi
} # ac_fn_c_try_link
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ eval "$3=yes"
+else $as_nop
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -6597,11 +6596,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
printf %s "checking for $CXX option to enable C++11 features... " >&6; }
-if test ${ac_cv_prog_cxx_11+y}
+if test ${ac_cv_prog_cxx_cxx11+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_11=no
+ ac_cv_prog_cxx_cxx11=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6643,11 +6642,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
printf %s "checking for $CXX option to enable C++98 features... " >&6; }
-if test ${ac_cv_prog_cxx_98+y}
+if test ${ac_cv_prog_cxx_cxx98+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_98=no
+ ac_cv_prog_cxx_cxx98=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6937,180 +6936,6 @@ if test "x$enable_m32" = xyes; then
CXXFLAGS="${CXXFLAGS} -m32"
fi
-# Autoupdate added the next two lines to ensure that your configure
-# script's behavior did not change. They are probably safe to remove.
-ac_header= ac_cache=
-for ac_item in $ac_header_c_list
-do
- if test $ac_cache; then
- ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
- if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
- printf "%s\n" "#define $ac_item 1" >> confdefs.h
- fi
- ac_header= ac_cache=
- elif test $ac_header; then
- ac_cache=$ac_item
- else
- ac_header=$ac_item
- fi
-done
-
-
-
-
-
-
-
-
-if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
-then :
-
-printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-printf %s "checking for grep that handles long lines and -e... " >&6; }
-if test ${ac_cv_path_GREP+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
- if test -z "$GREP"; then
- ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- case $as_dir in #(((
- '') as_dir=./ ;;
- */) ;;
- *) as_dir=$as_dir/ ;;
- esac
- for ac_prog in grep ggrep
- do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- printf %s 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- printf "%s\n" 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_GREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-printf "%s\n" "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-printf %s "checking for egrep... " >&6; }
-if test ${ac_cv_path_EGREP+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- if test -z "$EGREP"; then
- ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- case $as_dir in #(((
- '') as_dir=./ ;;
- */) ;;
- *) as_dir=$as_dir/ ;;
- esac
- for ac_prog in egrep
- do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- printf %s 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- printf "%s\n" 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_EGREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-printf "%s\n" "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-
# Check whether --enable-largefile was given.
if test ${enable_largefile+y}
then :
@@ -7678,6 +7503,35 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_header= ac_cache=
+for ac_item in $ac_header_c_list
+do
+ if test $ac_cache; then
+ ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
+ if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
+ printf "%s\n" "#define $ac_item 1" >> confdefs.h
+ fi
+ ac_header= ac_cache=
+ elif test $ac_header; then
+ ac_cache=$ac_item
+ else
+ ac_header=$ac_item
+ fi
+done
+
+
+
+
+
+
+
+
+if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
+then :
+
+printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
ac_fn_c_check_header_compile "$LINENO" "a.out.h" "ac_cv_header_a_out_h" "$ac_includes_default"
if test "x$ac_cv_header_a_out_h" = xyes
then :
@@ -10652,6 +10506,70 @@ fi
+# Check whether --enable-zstd was given.
+if test ${enable_zstd+y}
+then :
+ enableval=$enable_zstd;
+else $as_nop
+ enable_zstd=no
+fi
+
+if test "x${enable_zstd}" != xno; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ZSTD_decompress in -lzstd" >&5
+printf %s "checking for ZSTD_decompress in -lzstd... " >&6; }
+if test ${ac_cv_lib_zstd_ZSTD_decompress+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lzstd $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+char ZSTD_decompress ();
+int
+main (void)
+{
+return ZSTD_decompress ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+ ac_cv_lib_zstd_ZSTD_decompress=yes
+else $as_nop
+ ac_cv_lib_zstd_ZSTD_decompress=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_decompress" >&5
+printf "%s\n" "$ac_cv_lib_zstd_ZSTD_decompress" >&6; }
+if test "x$ac_cv_lib_zstd_ZSTD_decompress" = xyes
+then :
+ printf "%s\n" "#define HAVE_LIBZSTD 1" >>confdefs.h
+
+ LIBS="-lzstd $LIBS"
+
+else $as_nop
+ as_fn_error $? "zstd library not found." "$LINENO" 5
+fi
+
+ ac_fn_c_check_header_compile "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default"
+if test "x$ac_cv_header_zstd_h" = xyes
+then :
+
+else $as_nop
+ as_fn_error $? "zstd header not found." "$LINENO" 5
+fi
+
+fi
+
# Check whether --with-tests-as-root was given.
if test ${with_tests_as_root+y}
@@ -10767,6 +10685,7 @@ DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
diff --git a/configure.ac b/configure.ac
index ca293669..bfee372a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(subdir-objects tar-ustar 1.13)
-AM_CONFIG_HEADER(src/config.h)
+AC_CONFIG_HEADERS(src/config.h)
AM_MAINTAINER_MODE
AM_PROG_AR
@@ -59,15 +59,6 @@ if test "x$enable_m32" = xyes; then
CXXFLAGS="${CXXFLAGS} -m32"
fi
-m4_warn([obsolete],
-[The preprocessor macro `STDC_HEADERS' is obsolete.
- Except in unusual embedded environments, you can safely include all
- ISO C90 headers unconditionally.])dnl
-# Autoupdate added the next two lines to ensure that your configure
-# script's behavior did not change. They are probably safe to remove.
-AC_CHECK_INCLUDES_DEFAULT
-AC_PROG_EGREP
-
AC_SYS_LARGEFILE
AX_PTHREAD
AC_CHECK_HEADERS([a.out.h sys/mman.h sys/random.h])
@@ -221,6 +212,17 @@ fi
AC_ARG_VAR([RUSTC_DEMANGLE_CFLAGS], [Compiler flags for rustc-demangle])
AC_ARG_VAR([RUSTC_DEMANGLE_LIBS], [Linker flags for rustc-demangle])
+AC_ARG_ENABLE(zstd,
+ AS_HELP_STRING([--enable-zstd],
+ [Enable decompression of ELF sections with zstd]),,
+ [enable_zstd=no])
+if test "x${enable_zstd}" != xno; then
+ AC_CHECK_LIB(zstd, ZSTD_decompress, [],
+ [AC_MSG_ERROR([zstd library not found.])])
+ AC_CHECK_HEADER(zstd.h, [],
+ [AC_MSG_ERROR([zstd header not found.])])
+fi
+
AC_ARG_WITH(tests-as-root,
AS_HELP_STRING([--with-tests-as-root],
[Run the tests as root. Use this on platforms]
diff --git a/src/client/ios/exception_handler_no_mach.cc b/src/client/ios/exception_handler_no_mach.cc
index 6bb41021..0b2182ea 100644
--- a/src/client/ios/exception_handler_no_mach.cc
+++ b/src/client/ios/exception_handler_no_mach.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <signal.h>
#include <TargetConditionals.h>
diff --git a/src/client/linux/crash_generation/crash_generation_client.cc b/src/client/linux/crash_generation/crash_generation_client.cc
index 5a8c6b4c..020c6146 100644
--- a/src/client/linux/crash_generation/crash_generation_client.cc
+++ b/src/client/linux/crash_generation/crash_generation_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/crash_generation/crash_generation_client.h"
#include <stdio.h>
@@ -45,9 +49,11 @@ namespace {
class CrashGenerationClientImpl : public CrashGenerationClient {
public:
explicit CrashGenerationClientImpl(int server_fd) : server_fd_(server_fd) {}
- virtual ~CrashGenerationClientImpl() {}
+ CrashGenerationClientImpl(const CrashGenerationClientImpl&) = delete;
+ void operator=(const CrashGenerationClientImpl&) = delete;
+ ~CrashGenerationClientImpl() override = default;
- virtual bool RequestDump(const void* blob, size_t blob_size) {
+ bool RequestDump(const void* blob, size_t blob_size) override {
int fds[2];
if (sys_pipe(fds) < 0)
return false;
@@ -88,8 +94,6 @@ class CrashGenerationClientImpl : public CrashGenerationClient {
private:
int server_fd_;
-
- DISALLOW_COPY_AND_ASSIGN(CrashGenerationClientImpl);
};
} // namespace
diff --git a/src/client/linux/crash_generation/crash_generation_client.h b/src/client/linux/crash_generation/crash_generation_client.h
index 915b5700..1e4a7a5e 100644
--- a/src/client/linux/crash_generation/crash_generation_client.h
+++ b/src/client/linux/crash_generation/crash_generation_client.h
@@ -29,8 +29,6 @@
#ifndef CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
#define CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
-#include "common/basictypes.h"
-
#include <stddef.h>
namespace google_breakpad {
@@ -41,8 +39,10 @@ namespace google_breakpad {
// via a remote process.
class CrashGenerationClient {
public:
- CrashGenerationClient() {}
- virtual ~CrashGenerationClient() {}
+ CrashGenerationClient() = default;
+ CrashGenerationClient(const CrashGenerationClient&) = delete;
+ void operator=(const CrashGenerationClient&) = delete;
+ virtual ~CrashGenerationClient() = default;
// Request the crash server to generate a dump. |blob| is an opaque
// CrashContext pointer from exception_handler.h.
@@ -54,9 +54,6 @@ class CrashGenerationClient {
// The returned CrashGenerationClient* is owned by the caller of
// this function.
static CrashGenerationClient* TryCreate(int server_fd);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CrashGenerationClient);
};
} // namespace google_breakpad
diff --git a/src/client/linux/crash_generation/crash_generation_server.cc b/src/client/linux/crash_generation/crash_generation_server.cc
index 56cc0cd7..e3270c9d 100644
--- a/src/client/linux/crash_generation/crash_generation_server.cc
+++ b/src/client/linux/crash_generation/crash_generation_server.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <dirent.h>
#include <fcntl.h>
diff --git a/src/client/linux/dump_writer_common/thread_info.cc b/src/client/linux/dump_writer_common/thread_info.cc
index d8bf80b0..6288a056 100644
--- a/src/client/linux/dump_writer_common/thread_info.cc
+++ b/src/client/linux/dump_writer_common/thread_info.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/dump_writer_common/thread_info.h"
#include <string.h>
@@ -318,23 +322,19 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
out->t5 = mcontext.__gregs[30];
out->t6 = mcontext.__gregs[31];
-# if __riscv_flen == 32
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = mcontext.__fpregs.__f.__f[i];
- out->float_save.fpcsr = mcontext.__fpregs.__f.__fcsr;
-# elif __riscv_flen == 64
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = mcontext.__fpregs.__d.__f[i];
- out->float_save.fpcsr = mcontext.__fpregs.__d.__fcsr;
-# elif __riscv_flen == 128
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++) {
- out->float_save.regs[i].high = mcontext.__fpregs.__q.__f[2*i];
- out->float_save.regs[i].low = mcontext.__fpregs.__q.__f[2*i+1];
- }
- out->float_save.fpcsr = mcontext.__fpregs.__q.__fcsr;
-# else
-# error "Unexpected __riscv_flen"
-# endif
+ // Breakpad only supports RISCV32 with 32 bit floating point.
+ // Breakpad only supports RISCV64 with 64 bit floating point.
+#if __riscv_xlen == 32
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = mcontext.__fpregs.__f.__f[i];
+ out->fcsr = mcontext.__fpregs.__f.__fcsr;
+#elif __riscv_xlen == 64
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = mcontext.__fpregs.__d.__f[i];
+ out->fcsr = mcontext.__fpregs.__d.__fcsr;
+#else
+#error "Unexpected __riscv_xlen"
+#endif
}
#endif // __riscv
diff --git a/src/client/linux/dump_writer_common/ucontext_reader.cc b/src/client/linux/dump_writer_common/ucontext_reader.cc
index 97ed2a9f..76497683 100644
--- a/src/client/linux/dump_writer_common/ucontext_reader.cc
+++ b/src/client/linux/dump_writer_common/ucontext_reader.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/dump_writer_common/ucontext_reader.h"
#include "common/linux/linux_libc_support.h"
@@ -306,21 +310,19 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
out->t5 = uc->uc_mcontext.__gregs[30];
out->t6 = uc->uc_mcontext.__gregs[31];
-# if __riscv_flen == 32
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = uc->uc_mcontext.__fpregs.__f.__f[i];
- out->float_save.fpcsr = uc->uc_mcontext.__fpregs.__f.__fcsr;
-# elif __riscv_flen == 64
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = uc->uc_mcontext.__fpregs.__d.__f[i];
- out->float_save.fpcsr = uc->uc_mcontext.__fpregs.__d.__fcsr;
-# elif __riscv_flen == 128
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++) {
- out->float_save.regs[i].high = uc->uc_mcontext.__fpregs.__q.__f[2*i];
- out->float_save.regs[i].low = uc->uc_mcontext.__fpregs.__q.__f[2*i+1];
- }
- out->float_save.fpcsr = uc->uc_mcontext.__fpregs.__q.__fcsr;
-# endif
+ // Breakpad only supports RISCV32 with 32 bit floating point.
+ // Breakpad only supports RISCV64 with 64 bit floating point.
+#if __riscv_xlen == 32
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = uc->uc_mcontext.__fpregs.__f.__f[i];
+ out->fcsr = uc->uc_mcontext.__fpregs.__f.__fcsr;
+#elif __riscv_xlen == 64
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = uc->uc_mcontext.__fpregs.__d.__f[i];
+ out->fcsr = uc->uc_mcontext.__fpregs.__d.__fcsr;
+#else
+#error "Unexpected __riscv_xlen"
+#endif
}
#endif
diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
index bbdb798b..9e23c119 100644
--- a/src/client/linux/handler/exception_handler.cc
+++ b/src/client/linux/handler/exception_handler.cc
@@ -62,6 +62,10 @@
// alternative malloc. Each function should have comment above it detailing the
// context which it runs in.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/handler/exception_handler.h"
#include <errno.h>
diff --git a/src/client/linux/handler/exception_handler_unittest.cc b/src/client/linux/handler/exception_handler_unittest.cc
index 691ea133..b2d8d468 100644
--- a/src/client/linux/handler/exception_handler_unittest.cc
+++ b/src/client/linux/handler/exception_handler_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <poll.h>
#include <pthread.h>
#include <stdint.h>
diff --git a/src/client/linux/handler/minidump_descriptor.cc b/src/client/linux/handler/minidump_descriptor.cc
index 517fce97..db2f9b18 100644
--- a/src/client/linux/handler/minidump_descriptor.cc
+++ b/src/client/linux/handler/minidump_descriptor.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include "client/linux/handler/minidump_descriptor.h"
diff --git a/src/client/linux/log/log.cc b/src/client/linux/log/log.cc
index c45de64b..2a48d7fe 100644
--- a/src/client/linux/log/log.cc
+++ b/src/client/linux/log/log.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/log/log.h"
#if defined(__ANDROID__)
diff --git a/src/client/linux/microdump_writer/microdump_writer.cc b/src/client/linux/microdump_writer/microdump_writer.cc
index 1f19d3bb..93dae35e 100644
--- a/src/client/linux/microdump_writer/microdump_writer.cc
+++ b/src/client/linux/microdump_writer/microdump_writer.cc
@@ -29,6 +29,10 @@
// This translation unit generates microdumps into the console (logcat on
// Android). See crbug.com/410294 for more info and design docs.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/microdump_writer/microdump_writer.h"
#include <limits>
diff --git a/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/src/client/linux/microdump_writer/microdump_writer_unittest.cc
index 84865664..b1d570eb 100644
--- a/src/client/linux/microdump_writer/microdump_writer_unittest.cc
+++ b/src/client/linux/microdump_writer/microdump_writer_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <ctype.h>
#include <sys/syscall.h>
#include <sys/types.h>
diff --git a/src/client/linux/minidump_writer/cpu_set_unittest.cc b/src/client/linux/minidump_writer/cpu_set_unittest.cc
index 1db74410..b99e98de 100644
--- a/src/client/linux/minidump_writer/cpu_set_unittest.cc
+++ b/src/client/linux/minidump_writer/cpu_set_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -35,7 +39,7 @@
#include "breakpad_googletest_includes.h"
#include "client/linux/minidump_writer/cpu_set.h"
-#include "common/linux/tests/auto_testfile.h"
+#include "common/linux/scoped_tmpfile.h"
using namespace google_breakpad;
@@ -43,15 +47,6 @@ namespace {
typedef testing::Test CpuSetTest;
-// Helper class to write test text file to a temporary file and return
-// its file descriptor.
-class ScopedTestFile : public AutoTestFile {
-public:
- explicit ScopedTestFile(const char* text)
- : AutoTestFile("cpu_set", text) {
- }
-};
-
}
TEST(CpuSetTest, EmptyCount) {
@@ -60,8 +55,8 @@ TEST(CpuSetTest, EmptyCount) {
}
TEST(CpuSetTest, OneCpu) {
- ScopedTestFile file("10");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("10"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -69,8 +64,8 @@ TEST(CpuSetTest, OneCpu) {
}
TEST(CpuSetTest, OneCpuTerminated) {
- ScopedTestFile file("10\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("10\n"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -78,8 +73,8 @@ TEST(CpuSetTest, OneCpuTerminated) {
}
TEST(CpuSetTest, TwoCpusWithComma) {
- ScopedTestFile file("1,10");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("1,10"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -87,8 +82,8 @@ TEST(CpuSetTest, TwoCpusWithComma) {
}
TEST(CpuSetTest, TwoCpusWithRange) {
- ScopedTestFile file("1-2");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("1-2"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -96,8 +91,8 @@ TEST(CpuSetTest, TwoCpusWithRange) {
}
TEST(CpuSetTest, TenCpusWithRange) {
- ScopedTestFile file("9-18");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("9-18"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -105,8 +100,8 @@ TEST(CpuSetTest, TenCpusWithRange) {
}
TEST(CpuSetTest, MultiItems) {
- ScopedTestFile file("0, 2-4, 128");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("0, 2-4, 128"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -114,14 +109,16 @@ TEST(CpuSetTest, MultiItems) {
}
TEST(CpuSetTest, IntersectWith) {
- ScopedTestFile file1("9-19");
- ASSERT_TRUE(file1.IsOk());
+ ScopedTmpFile file1;
+ ASSERT_TRUE(file1.InitString("9-19"));
+
CpuSet set1;
ASSERT_TRUE(set1.ParseSysFile(file1.GetFd()));
ASSERT_EQ(11, set1.GetCount());
- ScopedTestFile file2("16-24");
- ASSERT_TRUE(file2.IsOk());
+ ScopedTmpFile file2;
+ ASSERT_TRUE(file2.InitString("16-24"));
+
CpuSet set2;
ASSERT_TRUE(set2.ParseSysFile(file2.GetFd()));
ASSERT_EQ(9, set2.GetCount());
@@ -132,8 +129,9 @@ TEST(CpuSetTest, IntersectWith) {
}
TEST(CpuSetTest, SelfIntersection) {
- ScopedTestFile file1("9-19");
- ASSERT_TRUE(file1.IsOk());
+ ScopedTmpFile file1;
+ ASSERT_TRUE(file1.InitString("9-19"));
+
CpuSet set1;
ASSERT_TRUE(set1.ParseSysFile(file1.GetFd()));
ASSERT_EQ(11, set1.GetCount());
@@ -143,14 +141,16 @@ TEST(CpuSetTest, SelfIntersection) {
}
TEST(CpuSetTest, EmptyIntersection) {
- ScopedTestFile file1("0-19");
- ASSERT_TRUE(file1.IsOk());
+ ScopedTmpFile file1;
+ ASSERT_TRUE(file1.InitString("0-19"));
+
CpuSet set1;
ASSERT_TRUE(set1.ParseSysFile(file1.GetFd()));
ASSERT_EQ(20, set1.GetCount());
- ScopedTestFile file2("20-39");
- ASSERT_TRUE(file2.IsOk());
+ ScopedTmpFile file2;
+ ASSERT_TRUE(file2.InitString("20-39"));
+
CpuSet set2;
ASSERT_TRUE(set2.ParseSysFile(file2.GetFd()));
ASSERT_EQ(20, set2.GetCount());
diff --git a/src/client/linux/minidump_writer/directory_reader_unittest.cc b/src/client/linux/minidump_writer/directory_reader_unittest.cc
index ffc5fbfd..708d586e 100644
--- a/src/client/linux/minidump_writer/directory_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/directory_reader_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <set>
#include <string>
diff --git a/src/client/linux/minidump_writer/line_reader_unittest.cc b/src/client/linux/minidump_writer/line_reader_unittest.cc
index 3062c39f..bc1f9d39 100644
--- a/src/client/linux/minidump_writer/line_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/line_reader_unittest.cc
@@ -26,13 +26,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include "client/linux/minidump_writer/line_reader.h"
#include "breakpad_googletest_includes.h"
-#include "common/linux/tests/auto_testfile.h"
+#include "common/linux/scoped_tmpfile.h"
using namespace google_breakpad;
@@ -40,22 +44,11 @@ namespace {
typedef testing::Test LineReaderTest;
-class ScopedTestFile : public AutoTestFile {
-public:
- explicit ScopedTestFile(const char* text)
- : AutoTestFile("line_reader", text) {
- }
-
- ScopedTestFile(const char* text, size_t text_len)
- : AutoTestFile("line_reader", text, text_len) {
- }
-};
-
}
TEST(LineReaderTest, EmptyFile) {
- ScopedTestFile file("");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString(""));
LineReader reader(file.GetFd());
const char* line;
@@ -64,8 +57,8 @@ TEST(LineReaderTest, EmptyFile) {
}
TEST(LineReaderTest, OneLineTerminated) {
- ScopedTestFile file("a\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a\n"));
LineReader reader(file.GetFd());
const char* line;
@@ -80,8 +73,8 @@ TEST(LineReaderTest, OneLineTerminated) {
}
TEST(LineReaderTest, OneLine) {
- ScopedTestFile file("a");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a"));
LineReader reader(file.GetFd());
const char* line;
@@ -96,8 +89,8 @@ TEST(LineReaderTest, OneLine) {
}
TEST(LineReaderTest, TwoLinesTerminated) {
- ScopedTestFile file("a\nb\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a\nb\n"));
LineReader reader(file.GetFd());
const char* line;
@@ -118,8 +111,8 @@ TEST(LineReaderTest, TwoLinesTerminated) {
}
TEST(LineReaderTest, TwoLines) {
- ScopedTestFile file("a\nb");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a\nb"));
LineReader reader(file.GetFd());
const char* line;
@@ -142,8 +135,8 @@ TEST(LineReaderTest, TwoLines) {
TEST(LineReaderTest, MaxLength) {
char l[LineReader::kMaxLineLen-1];
memset(l, 'a', sizeof(l));
- ScopedTestFile file(l, sizeof(l));
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitData(l, sizeof(l)));
LineReader reader(file.GetFd());
const char* line;
@@ -158,8 +151,8 @@ TEST(LineReaderTest, TooLong) {
// Note: this writes kMaxLineLen 'a' chars in the test file.
char l[LineReader::kMaxLineLen];
memset(l, 'a', sizeof(l));
- ScopedTestFile file(l, sizeof(l));
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitData(l, sizeof(l)));
LineReader reader(file.GetFd());
const char* line;
diff --git a/src/client/linux/minidump_writer/linux_core_dumper.cc b/src/client/linux/minidump_writer/linux_core_dumper.cc
index 2c507c1b..4bf9094e 100644
--- a/src/client/linux/minidump_writer/linux_core_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_core_dumper.cc
@@ -29,6 +29,10 @@
// linux_core_dumper.cc: Implement google_breakpad::LinuxCoreDumper.
// See linux_core_dumper.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/minidump_writer/linux_core_dumper.h"
#include <asm/ptrace.h>
diff --git a/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
index 157e4f89..72790422 100644
--- a/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
+++ b/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
@@ -29,6 +29,10 @@
// linux_core_dumper_unittest.cc:
// Unit tests for google_breakpad::LinuxCoreDumoer.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include "breakpad_googletest_includes.h"
diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc
index 01b06fac..5c4c389c 100644
--- a/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper.cc
@@ -34,6 +34,10 @@
// rules apply as detailed at the top of minidump_writer.h: no libc calls and
// use the alternative allocator.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/minidump_writer/linux_dumper.h"
#include <assert.h>
@@ -342,7 +346,7 @@ LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
return false;
bool filename_modified = HandleDeletedFileInMapping(filename);
- MemoryMappedFile mapped_file(filename, mapping.offset);
+ MemoryMappedFile mapped_file(filename, 0);
if (!mapped_file.data() || mapped_file.size() < SELFMAG)
return false;
@@ -455,7 +459,7 @@ bool ElfFileSoName(const LinuxDumper& dumper,
if (!dumper.GetMappingAbsolutePath(mapping, filename))
return false;
- MemoryMappedFile mapped_file(filename, mapping.offset);
+ MemoryMappedFile mapped_file(filename, 0);
if (!mapped_file.data() || mapped_file.size() < SELFMAG) {
// mmap failed
return false;
diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
index bc1e4fbe..5a135fda 100644
--- a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
@@ -30,6 +30,10 @@
// threads. The first word of each thread's stack is set to the thread
// id.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
index 718fab7c..2adc39e1 100644
--- a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
@@ -35,6 +35,10 @@
// rules apply as detailed at the top of minidump_writer.h: no libc calls and
// use the alternative allocator.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/minidump_writer/linux_ptrace_dumper.h"
#include <asm/ptrace.h>
@@ -175,6 +179,13 @@ bool LinuxPtraceDumper::ReadRegisters(ThreadInfo* info, pid_t tid) {
return false;
}
+ // When running on arm processors the binary may be built with softfp or
+ // hardfp. If built with softfp we have no hardware registers to read from,
+ // so the following read will always fail. gcc defines __SOFTFP__ macro,
+ // clang13 does not do so. see: https://reviews.llvm.org/D135680.
+ // If you are using clang and the macro is NOT defined, please include the
+ // macro define for applicable targets.
+#if !defined(__SOFTFP__)
#if !(defined(__ANDROID__) && defined(__ARM_EABI__))
// When running an arm build on an arm64 device, attempting to get the
// floating point registers fails. On Android, the floating point registers
@@ -186,6 +197,7 @@ bool LinuxPtraceDumper::ReadRegisters(ThreadInfo* info, pid_t tid) {
return false;
}
#endif // !(defined(__ANDROID__) && defined(__ARM_EABI__))
+#endif // !defined(__SOFTFP__)
return true;
#else // PTRACE_GETREGS
return false;
diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
index a8455165..16a9daf1 100644
--- a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
+++ b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
@@ -32,6 +32,10 @@
// This file was renamed from linux_dumper_unittest.cc and modified due
// to LinuxDumper being splitted into two classes.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc
index a5f9b841..a95dd254 100644
--- a/src/client/linux/minidump_writer/minidump_writer.cc
+++ b/src/client/linux/minidump_writer/minidump_writer.cc
@@ -42,6 +42,10 @@
// a canonical instance in the LinuxDumper object. We use the placement
// new form to allocate objects and we don't delete them.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/handler/minidump_descriptor.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include "client/minidump_file_writer-inl.h"
diff --git a/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/src/client/linux/minidump_writer/minidump_writer_unittest.cc
index 2601d29b..effedc5e 100644
--- a/src/client/linux/minidump_writer/minidump_writer_unittest.cc
+++ b/src/client/linux/minidump_writer/minidump_writer_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <poll.h>
#include <sys/stat.h>
diff --git a/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc b/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc
index 92cae92e..399f1a12 100644
--- a/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc
+++ b/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc
@@ -29,6 +29,10 @@
// minidump_writer_unittest_utils.cc:
// Shared routines used by unittests under client/linux/minidump_writer.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <limits.h>
#include <stdlib.h>
diff --git a/src/client/linux/minidump_writer/pe_file.cc b/src/client/linux/minidump_writer/pe_file.cc
index 960b978b..7b3fe6c0 100644
--- a/src/client/linux/minidump_writer/pe_file.cc
+++ b/src/client/linux/minidump_writer/pe_file.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include "client/linux/minidump_writer/pe_file.h"
diff --git a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
index f6d3e285..4ac52569 100644
--- a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -35,33 +39,19 @@
#include "client/linux/minidump_writer/proc_cpuinfo_reader.h"
#include "breakpad_googletest_includes.h"
-#include "common/linux/tests/auto_testfile.h"
+#include "common/linux/scoped_tmpfile.h"
using namespace google_breakpad;
-#if !defined(__ANDROID__)
-#define TEMPDIR "/tmp"
-#else
-#define TEMPDIR "/data/local/tmp"
-#endif
-
-
namespace {
typedef testing::Test ProcCpuInfoReaderTest;
-class ScopedTestFile : public AutoTestFile {
-public:
- explicit ScopedTestFile(const char* text)
- : AutoTestFile("proc_cpuinfo_reader", text) {
- }
-};
-
}
TEST(ProcCpuInfoReaderTest, EmptyFile) {
- ScopedTestFile file("");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString(""));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -69,8 +59,8 @@ TEST(ProcCpuInfoReaderTest, EmptyFile) {
}
TEST(ProcCpuInfoReaderTest, OneLineTerminated) {
- ScopedTestFile file("foo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -82,8 +72,8 @@ TEST(ProcCpuInfoReaderTest, OneLineTerminated) {
}
TEST(ProcCpuInfoReaderTest, OneLine) {
- ScopedTestFile file("foo : bar");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -97,8 +87,8 @@ TEST(ProcCpuInfoReaderTest, OneLine) {
}
TEST(ProcCpuInfoReaderTest, TwoLinesTerminated) {
- ScopedTestFile file("foo : bar\nzoo : tut\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar\nzoo : tut\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -114,8 +104,8 @@ TEST(ProcCpuInfoReaderTest, TwoLinesTerminated) {
}
TEST(ProcCpuInfoReaderTest, SkipMalformedLine) {
- ScopedTestFile file("this line should have a column\nfoo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("this line should have a column\nfoo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -127,8 +117,8 @@ TEST(ProcCpuInfoReaderTest, SkipMalformedLine) {
}
TEST(ProcCpuInfoReaderTest, SkipOneEmptyLine) {
- ScopedTestFile file("\n\nfoo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("\n\nfoo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -140,8 +130,8 @@ TEST(ProcCpuInfoReaderTest, SkipOneEmptyLine) {
}
TEST(ProcCpuInfoReaderTest, SkipEmptyField) {
- ScopedTestFile file(" : bar\nzoo : tut\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString(" : bar\nzoo : tut\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -153,8 +143,8 @@ TEST(ProcCpuInfoReaderTest, SkipEmptyField) {
}
TEST(ProcCpuInfoReaderTest, SkipTwoEmptyLines) {
- ScopedTestFile file("foo : bar\n\n\nfoo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar\n\n\nfoo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -170,8 +160,8 @@ TEST(ProcCpuInfoReaderTest, SkipTwoEmptyLines) {
}
TEST(ProcCpuInfoReaderTest, FieldWithSpaces) {
- ScopedTestFile file("foo bar : zoo\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo bar : zoo\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -183,8 +173,8 @@ TEST(ProcCpuInfoReaderTest, FieldWithSpaces) {
}
TEST(ProcCpuInfoReaderTest, EmptyValue) {
- ScopedTestFile file("foo :\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo :\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
diff --git a/src/client/linux/sender/google_crash_report_sender.cc b/src/client/linux/sender/google_crash_report_sender.cc
index 6f45d831..f6e48193 100644
--- a/src/client/linux/sender/google_crash_report_sender.cc
+++ b/src/client/linux/sender/google_crash_report_sender.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/google_crashdump_uploader.h"
#include <string>
#include <iostream>
diff --git a/src/client/mac/crash_generation/crash_generation_client.cc b/src/client/mac/crash_generation/crash_generation_client.cc
index 32f1c827..7622dddd 100644
--- a/src/client/mac/crash_generation/crash_generation_client.cc
+++ b/src/client/mac/crash_generation/crash_generation_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/crash_generation/crash_generation_client.h"
#include "client/mac/crash_generation/crash_generation_server.h"
diff --git a/src/client/mac/crash_generation/crash_generation_server.cc b/src/client/mac/crash_generation/crash_generation_server.cc
index 6bbd4bb5..8d742f36 100644
--- a/src/client/mac/crash_generation/crash_generation_server.cc
+++ b/src/client/mac/crash_generation/crash_generation_server.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/crash_generation/crash_generation_server.h"
#include <pthread.h>
diff --git a/src/client/mac/handler/breakpad_nlist_64.cc b/src/client/mac/handler/breakpad_nlist_64.cc
index b4f04c91..d59c7b08 100644
--- a/src/client/mac/handler/breakpad_nlist_64.cc
+++ b/src/client/mac/handler/breakpad_nlist_64.cc
@@ -65,6 +65,10 @@
* I've modified it to be compatible with 64-bit images.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_nlist_64.h"
#include <CoreFoundation/CoreFoundation.h>
diff --git a/src/client/mac/handler/dynamic_images.cc b/src/client/mac/handler/dynamic_images.cc
index b1d2c464..3db7467b 100644
--- a/src/client/mac/handler/dynamic_images.cc
+++ b/src/client/mac/handler/dynamic_images.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/handler/dynamic_images.h"
extern "C" { // needed to compile on Leopard
diff --git a/src/client/mac/handler/exception_handler.cc b/src/client/mac/handler/exception_handler.cc
index c091209f..968e551c 100644
--- a/src/client/mac/handler/exception_handler.cc
+++ b/src/client/mac/handler/exception_handler.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <mach/exc.h>
#include <mach/mig.h>
#include <pthread.h>
diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc
index 3738416e..fd863aea 100644
--- a/src/client/mac/handler/minidump_generator.cc
+++ b/src/client/mac/handler/minidump_generator.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <algorithm>
#include <cstdio>
diff --git a/src/client/mac/handler/protected_memory_allocator.cc b/src/client/mac/handler/protected_memory_allocator.cc
index 83383263..8205a214 100644
--- a/src/client/mac/handler/protected_memory_allocator.cc
+++ b/src/client/mac/handler/protected_memory_allocator.cc
@@ -30,6 +30,10 @@
//
// See the header file for documentation
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "protected_memory_allocator.h"
#include <assert.h>
diff --git a/src/client/mac/handler/testcases/DynamicImagesTests.cc b/src/client/mac/handler/testcases/DynamicImagesTests.cc
index 14ea88d2..d7564fc9 100644
--- a/src/client/mac/handler/testcases/DynamicImagesTests.cc
+++ b/src/client/mac/handler/testcases/DynamicImagesTests.cc
@@ -33,6 +33,10 @@
// Copyright 2008 Google LLC
//
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/handler/testcases/DynamicImagesTests.h"
#include "client/mac/handler/dynamic_images.h"
diff --git a/src/client/mac/handler/testcases/breakpad_nlist_test.cc b/src/client/mac/handler/testcases/breakpad_nlist_test.cc
index a89d8c44..3779e357 100644
--- a/src/client/mac/handler/testcases/breakpad_nlist_test.cc
+++ b/src/client/mac/handler/testcases/breakpad_nlist_test.cc
@@ -33,6 +33,10 @@
// Copyright 2008 Google LLC
//
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/handler/testcases/breakpad_nlist_test.h"
#include <mach-o/nlist.h>
#include "client/mac/handler/breakpad_nlist_64.h"
diff --git a/src/client/mac/tests/crash_generation_server_test.cc b/src/client/mac/tests/crash_generation_server_test.cc
index 50825a93..743b268e 100644
--- a/src/client/mac/tests/crash_generation_server_test.cc
+++ b/src/client/mac/tests/crash_generation_server_test.cc
@@ -29,6 +29,10 @@
// crash_generation_server_test.cc
// Unit tests for CrashGenerationServer
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <dirent.h>
#include <glob.h>
#include <stdint.h>
diff --git a/src/client/mac/tests/exception_handler_test.cc b/src/client/mac/tests/exception_handler_test.cc
index eb9aa1bc..91b931b9 100644
--- a/src/client/mac/tests/exception_handler_test.cc
+++ b/src/client/mac/tests/exception_handler_test.cc
@@ -28,6 +28,10 @@
// exception_handler_test.cc: Unit tests for google_breakpad::ExceptionHandler
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <sys/mman.h>
#include <sys/stat.h>
diff --git a/src/client/mac/tests/minidump_generator_test.cc b/src/client/mac/tests/minidump_generator_test.cc
index 1a889dfe..2606e14f 100644
--- a/src/client/mac/tests/minidump_generator_test.cc
+++ b/src/client/mac/tests/minidump_generator_test.cc
@@ -28,6 +28,10 @@
// minidump_generator_test.cc: Unit tests for google_breakpad::MinidumpGenerator
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <AvailabilityMacros.h>
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
diff --git a/src/client/mac/tests/minidump_generator_test_helper.cc b/src/client/mac/tests/minidump_generator_test_helper.cc
index 93cbe1bb..8177eeab 100644
--- a/src/client/mac/tests/minidump_generator_test_helper.cc
+++ b/src/client/mac/tests/minidump_generator_test_helper.cc
@@ -30,6 +30,10 @@
// minidump_generator_test.cc can launch to test certain things
// that require a separate executable.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <unistd.h>
#include "client/mac/handler/exception_handler.h"
diff --git a/src/client/minidump_file_writer.cc b/src/client/minidump_file_writer.cc
index d5193e2c..c00af36c 100644
--- a/src/client/minidump_file_writer.cc
+++ b/src/client/minidump_file_writer.cc
@@ -30,6 +30,10 @@
//
// See minidump_file_writer.h for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
diff --git a/src/client/minidump_file_writer_unittest.cc b/src/client/minidump_file_writer_unittest.cc
index bb3a0269..21e0b8a1 100644
--- a/src/client/minidump_file_writer_unittest.cc
+++ b/src/client/minidump_file_writer_unittest.cc
@@ -36,6 +36,10 @@
-o minidump_file_writer_unittest
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/client/solaris/handler/exception_handler.cc b/src/client/solaris/handler/exception_handler.cc
index b7b702ac..0e5f4497 100644
--- a/src/client/solaris/handler/exception_handler.cc
+++ b/src/client/solaris/handler/exception_handler.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/src/client/solaris/handler/exception_handler_test.cc b/src/client/solaris/handler/exception_handler_test.cc
index a84f2df1..3d656820 100644
--- a/src/client/solaris/handler/exception_handler_test.cc
+++ b/src/client/solaris/handler/exception_handler_test.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <unistd.h>
diff --git a/src/client/solaris/handler/minidump_generator.cc b/src/client/solaris/handler/minidump_generator.cc
index 8f2f6ee2..5d24d0ae 100644
--- a/src/client/solaris/handler/minidump_generator.cc
+++ b/src/client/solaris/handler/minidump_generator.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <sys/frame.h>
#include <sys/stat.h>
diff --git a/src/client/solaris/handler/minidump_test.cc b/src/client/solaris/handler/minidump_test.cc
index 00f8d9a5..a8f69063 100644
--- a/src/client/solaris/handler/minidump_test.cc
+++ b/src/client/solaris/handler/minidump_test.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <unistd.h>
diff --git a/src/client/solaris/handler/solaris_lwp.cc b/src/client/solaris/handler/solaris_lwp.cc
index d707a5b3..02f1c37e 100644
--- a/src/client/solaris/handler/solaris_lwp.cc
+++ b/src/client/solaris/handler/solaris_lwp.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <dirent.h>
#include <elf.h>
#include <errno.h>
diff --git a/src/client/windows/crash_generation/client_info.cc b/src/client/windows/crash_generation/client_info.cc
index f0a4b911..61ee2126 100644
--- a/src/client/windows/crash_generation/client_info.cc
+++ b/src/client/windows/crash_generation/client_info.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/client_info.h"
#include "client/windows/common/ipc_protocol.h"
diff --git a/src/client/windows/crash_generation/crash_generation_client.cc b/src/client/windows/crash_generation/crash_generation_client.cc
index d6da09eb..c3d6a2bc 100644
--- a/src/client/windows/crash_generation/crash_generation_client.cc
+++ b/src/client/windows/crash_generation/crash_generation_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/crash_generation_client.h"
#include <cassert>
#include <utility>
diff --git a/src/client/windows/crash_generation/crash_generation_server.cc b/src/client/windows/crash_generation/crash_generation_server.cc
index bf80ee9c..61b0cbc0 100644
--- a/src/client/windows/crash_generation/crash_generation_server.cc
+++ b/src/client/windows/crash_generation/crash_generation_server.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/crash_generation_server.h"
#include <windows.h>
#include <cassert>
diff --git a/src/client/windows/crash_generation/minidump_generator.cc b/src/client/windows/crash_generation/minidump_generator.cc
index 523db27a..a0454cf9 100644
--- a/src/client/windows/crash_generation/minidump_generator.cc
+++ b/src/client/windows/crash_generation/minidump_generator.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/minidump_generator.h"
#include <assert.h>
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc
index 3b3938aa..64b29799 100644
--- a/src/client/windows/handler/exception_handler.cc
+++ b/src/client/windows/handler/exception_handler.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <objbase.h>
#include <algorithm>
diff --git a/src/client/windows/sender/crash_report_sender.cc b/src/client/windows/sender/crash_report_sender.cc
index 27a7ec39..6ce0026c 100644
--- a/src/client/windows/sender/crash_report_sender.cc
+++ b/src/client/windows/sender/crash_report_sender.cc
@@ -29,6 +29,10 @@
// Disable exception handler warnings.
#pragma warning( disable : 4530 )
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <errno.h>
#include "client/windows/sender/crash_report_sender.h"
diff --git a/src/client/windows/tests/crash_generation_app/abstract_class.cc b/src/client/windows/tests/crash_generation_app/abstract_class.cc
index 28b8ee14..737c817c 100644
--- a/src/client/windows/tests/crash_generation_app/abstract_class.cc
+++ b/src/client/windows/tests/crash_generation_app/abstract_class.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/tests/crash_generation_app/abstract_class.h"
namespace google_breakpad {
diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc
index 883afcc6..9ae4679e 100644
--- a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc
+++ b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc
@@ -29,6 +29,10 @@
// crash_generation_app.cpp : Defines the entry point for the application.
//
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/tests/crash_generation_app/crash_generation_app.h"
#include <windows.h>
diff --git a/src/client/windows/unittests/crash_generation_server_test.cc b/src/client/windows/unittests/crash_generation_server_test.cc
index cd624f07..adb03f40 100644
--- a/src/client/windows/unittests/crash_generation_server_test.cc
+++ b/src/client/windows/unittests/crash_generation_server_test.cc
@@ -27,6 +27,10 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "client/windows/crash_generation/crash_generation_server.h"
#include "client/windows/common/ipc_protocol.h"
diff --git a/src/client/windows/unittests/dump_analysis.cc b/src/client/windows/unittests/dump_analysis.cc
index 24a33769..c403d855 100644
--- a/src/client/windows/unittests/dump_analysis.cc
+++ b/src/client/windows/unittests/dump_analysis.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <objbase.h>
#include <dbghelp.h>
diff --git a/src/client/windows/unittests/exception_handler_death_test.cc b/src/client/windows/unittests/exception_handler_death_test.cc
index a7679dd6..50d3fda9 100644
--- a/src/client/windows/unittests/exception_handler_death_test.cc
+++ b/src/client/windows/unittests/exception_handler_death_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <dbghelp.h>
#include <strsafe.h>
diff --git a/src/client/windows/unittests/exception_handler_nesting_test.cc b/src/client/windows/unittests/exception_handler_nesting_test.cc
index 81ae7dc7..7fa6ac22 100644
--- a/src/client/windows/unittests/exception_handler_nesting_test.cc
+++ b/src/client/windows/unittests/exception_handler_nesting_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <string>
diff --git a/src/client/windows/unittests/exception_handler_test.cc b/src/client/windows/unittests/exception_handler_test.cc
index 237af29d..f658726b 100644
--- a/src/client/windows/unittests/exception_handler_test.cc
+++ b/src/client/windows/unittests/exception_handler_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/unittests/exception_handler_test.h"
#include <windows.h>
diff --git a/src/client/windows/unittests/minidump_test.cc b/src/client/windows/unittests/minidump_test.cc
index 7bfc8d77..741447df 100644
--- a/src/client/windows/unittests/minidump_test.cc
+++ b/src/client/windows/unittests/minidump_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <objbase.h>
#include <dbghelp.h>
diff --git a/src/common/basictypes.h b/src/common/basictypes.h
index 6458a893..79c9b775 100644
--- a/src/common/basictypes.h
+++ b/src/common/basictypes.h
@@ -29,14 +29,6 @@
#ifndef COMMON_BASICTYPES_H_
#define COMMON_BASICTYPES_H_
-// A macro to disallow the copy constructor and operator= functions
-// This should be used in the private: declarations for a class
-#ifndef DISALLOW_COPY_AND_ASSIGN
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
-#endif // DISALLOW_COPY_AND_ASSIGN
-
namespace google_breakpad {
// Used to explicitly mark the return value of a function as unused. If you are
diff --git a/src/common/byte_cursor_unittest.cc b/src/common/byte_cursor_unittest.cc
index 00648f76..41180ca2 100644
--- a/src/common/byte_cursor_unittest.cc
+++ b/src/common/byte_cursor_unittest.cc
@@ -31,6 +31,10 @@
// byte_cursor_unittest.cc: Unit tests for google_breakpad::ByteBuffer
// and google_breakpad::ByteCursor.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include <string.h>
diff --git a/src/common/convert_UTF.cc b/src/common/convert_UTF.cc
index 4a5df1eb..6e95b2f9 100644
--- a/src/common/convert_UTF.cc
+++ b/src/common/convert_UTF.cc
@@ -55,6 +55,10 @@ See the header file "ConvertUTF.h" for complete documentation.
------------------------------------------------------------------------ */
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "convert_UTF.h"
#ifdef CVTUTF_DEBUG
#include <stdio.h>
diff --git a/src/common/dwarf/bytereader.cc b/src/common/dwarf/bytereader.cc
index 46bed6d0..faa7d680 100644
--- a/src/common/dwarf/bytereader.cc
+++ b/src/common/dwarf/bytereader.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/common/dwarf/bytereader_unittest.cc b/src/common/dwarf/bytereader_unittest.cc
index c23c737b..a5eb0da5 100644
--- a/src/common/dwarf/bytereader_unittest.cc
+++ b/src/common/dwarf/bytereader_unittest.cc
@@ -30,6 +30,10 @@
// bytereader_unittest.cc: Unit tests for google_breakpad::ByteReader
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdint.h>
#include <string>
diff --git a/src/common/dwarf/cfi_assembler.cc b/src/common/dwarf/cfi_assembler.cc
index 9ed979b4..b3e064f0 100644
--- a/src/common/dwarf/cfi_assembler.cc
+++ b/src/common/dwarf/cfi_assembler.cc
@@ -31,6 +31,10 @@
// cfi_assembler.cc: Implementation of google_breakpad::CFISection class.
// See cfi_assembler.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/dwarf/cfi_assembler.h"
#include <assert.h>
diff --git a/src/common/dwarf/dwarf2diehandler.cc b/src/common/dwarf/dwarf2diehandler.cc
index ea3ac71c..8aea0f2f 100644
--- a/src/common/dwarf/dwarf2diehandler.cc
+++ b/src/common/dwarf/dwarf2diehandler.cc
@@ -31,6 +31,10 @@
// dwarf2diehandler.cc: Implement the dwarf2reader::DieDispatcher class.
// See dwarf2diehandler.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <stdint.h>
diff --git a/src/common/dwarf/dwarf2diehandler_unittest.cc b/src/common/dwarf/dwarf2diehandler_unittest.cc
index 67c9489d..afcbf625 100644
--- a/src/common/dwarf/dwarf2diehandler_unittest.cc
+++ b/src/common/dwarf/dwarf2diehandler_unittest.cc
@@ -32,6 +32,10 @@
// dwarf2diehander_unittest.cc: Unit tests for google_breakpad::DIEDispatcher.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdint.h>
#include <string>
diff --git a/src/common/dwarf/dwarf2enums.h b/src/common/dwarf/dwarf2enums.h
index 777d9bfc..f1c995f9 100644
--- a/src/common/dwarf/dwarf2enums.h
+++ b/src/common/dwarf/dwarf2enums.h
@@ -580,10 +580,10 @@ enum DwarfSectionId {
DW_SECT_TYPES = 2,
DW_SECT_ABBREV = 3,
DW_SECT_LINE = 4,
- DW_SECT_LOC = 5,
+ DW_SECT_LOCLISTS = 5,
DW_SECT_STR_OFFSETS = 6,
- DW_SECT_MACINFO = 7,
- DW_SECT_MACRO = 8
+ DW_SECT_MACRO = 7,
+ DW_SECT_RNGLISTS = 8
};
// Source languages. These are values for DW_AT_language.
diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc
index b191d78c..8a8bf6f8 100644
--- a/src/common/dwarf/dwarf2reader.cc
+++ b/src/common/dwarf/dwarf2reader.cc
@@ -31,6 +31,10 @@
// Implementation of LineInfo, CompilationUnit,
// and CallFrameInfo. See dwarf2reader.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/dwarf/dwarf2reader.h"
#include <stdint.h>
@@ -76,9 +80,10 @@ CompilationUnit::CompilationUnit(const string& path,
str_offsets_buffer_(NULL), str_offsets_buffer_length_(0),
addr_buffer_(NULL), addr_buffer_length_(0),
is_split_dwarf_(false), is_type_unit_(false), dwo_id_(0), dwo_name_(),
- skeleton_dwo_id_(0), ranges_base_(0), addr_base_(0),
- str_offsets_base_(0), have_checked_for_dwp_(false), dwp_path_(),
- dwp_byte_reader_(), dwp_reader_() {}
+ skeleton_dwo_id_(0), addr_base_(0),
+ str_offsets_base_(0), have_checked_for_dwp_(false),
+ should_process_split_dwarf_(false), low_pc_(0),
+ has_source_line_info_(false), source_line_offset_(0) {}
// Initialize a compilation unit from a .dwo or .dwp file.
// In this case, we need the .debug_addr section from the
@@ -87,16 +92,10 @@ CompilationUnit::CompilationUnit(const string& path,
// the executable file, and call it as if we were still
// processing the original compilation unit.
-void CompilationUnit::SetSplitDwarf(const uint8_t* addr_buffer,
- uint64_t addr_buffer_length,
- uint64_t addr_base,
- uint64_t ranges_base,
+void CompilationUnit::SetSplitDwarf(uint64_t addr_base,
uint64_t dwo_id) {
is_split_dwarf_ = true;
- addr_buffer_ = addr_buffer;
- addr_buffer_length_ = addr_buffer_length;
addr_base_ = addr_base;
- ranges_base_ = ranges_base;
skeleton_dwo_id_ = dwo_id;
}
@@ -396,7 +395,13 @@ uint64_t CompilationUnit::Start() {
// Set up our buffer
buffer_ = iter->second.first + offset_from_section_start_;
- buffer_length_ = iter->second.second - offset_from_section_start_;
+ if (is_split_dwarf_) {
+ iter = GetSectionByName(sections_, ".debug_info_offset");
+ assert(iter != sections_.end());
+ buffer_length_ = iter->second.second;
+ } else {
+ buffer_length_ = iter->second.second - offset_from_section_start_;
+ }
// Read the header
ReadHeader();
@@ -430,6 +435,12 @@ uint64_t CompilationUnit::Start() {
string_buffer_length_ = iter->second.second;
}
+ iter = GetSectionByName(sections_, ".debug_line");
+ if (iter != sections_.end()) {
+ line_buffer_ = iter->second.first;
+ line_buffer_length_ = iter->second.second;
+ }
+
// Set the line string section if we have one.
iter = GetSectionByName(sections_, ".debug_line_str");
if (iter != sections_.end()) {
@@ -457,10 +468,8 @@ uint64_t CompilationUnit::Start() {
// If this is a skeleton compilation unit generated with split DWARF,
// and the client needs the full debug info, we need to find the full
// compilation unit in a .dwo or .dwp file.
- if (!is_split_dwarf_
- && dwo_name_ != NULL
- && handler_->NeedSplitDebugInfo())
- ProcessSplitDwarf();
+ should_process_split_dwarf_ =
+ !is_split_dwarf_ && dwo_name_ != NULL && handler_->NeedSplitDebugInfo();
return ourlength;
}
@@ -881,7 +890,9 @@ const uint8_t* CompilationUnit::ProcessDIE(uint64_t dieoffset,
// DW_AT_str_offsets_base or DW_AT_addr_base. If it does, that attribute must
// be found and processed before trying to process the other attributes;
// otherwise the string or address values will all come out incorrect.
- if (abbrev.tag == DW_TAG_compile_unit && header_.version == 5) {
+ if ((abbrev.tag == DW_TAG_compile_unit ||
+ abbrev.tag == DW_TAG_skeleton_unit) &&
+ header_.version == 5) {
uint64_t dieoffset_copy = dieoffset;
const uint8_t* start_copy = start;
for (AttributeList::const_iterator i = abbrev.attributes.begin();
@@ -990,66 +1001,69 @@ inline int GetElfWidth(const ElfReader& elf) {
return 0;
}
-void CompilationUnit::ProcessSplitDwarf() {
+bool CompilationUnit::ProcessSplitDwarf(std::string& split_file,
+ SectionMap& sections,
+ ByteReader& split_byte_reader,
+ uint64_t& cu_offset) {
+ if (!should_process_split_dwarf_)
+ return false;
struct stat statbuf;
+ bool found_in_dwp = false;
if (!have_checked_for_dwp_) {
// Look for a .dwp file in the same directory as the executable.
have_checked_for_dwp_ = true;
string dwp_suffix(".dwp");
- dwp_path_ = path_ + dwp_suffix;
- if (stat(dwp_path_.c_str(), &statbuf) != 0) {
+ std::string dwp_path = path_ + dwp_suffix;
+ if (stat(dwp_path.c_str(), &statbuf) != 0) {
// Fall back to a split .debug file in the same directory.
string debug_suffix(".debug");
- dwp_path_ = path_;
+ dwp_path = path_;
size_t found = path_.rfind(debug_suffix);
- if (found + debug_suffix.length() == path_.length())
- dwp_path_ = dwp_path_.replace(found, debug_suffix.length(), dwp_suffix);
+ if (found != string::npos &&
+ found + debug_suffix.length() == path_.length())
+ dwp_path = dwp_path.replace(found, debug_suffix.length(), dwp_suffix);
}
- if (stat(dwp_path_.c_str(), &statbuf) == 0) {
- ElfReader* elf = new ElfReader(dwp_path_);
- int width = GetElfWidth(*elf);
+ if (stat(dwp_path.c_str(), &statbuf) == 0) {
+ split_elf_reader_ = std::make_unique<ElfReader>(dwp_path);
+ int width = GetElfWidth(*split_elf_reader_.get());
if (width != 0) {
- dwp_byte_reader_.reset(new ByteReader(reader_->GetEndianness()));
- dwp_byte_reader_->SetAddressSize(width);
- dwp_reader_.reset(new DwpReader(*dwp_byte_reader_, elf));
+ split_byte_reader = ByteReader(reader_->GetEndianness());
+ split_byte_reader.SetAddressSize(width);
+ dwp_reader_ = std::make_unique<DwpReader>(split_byte_reader,
+ split_elf_reader_.get());
dwp_reader_->Initialize();
- } else {
- delete elf;
+ // If we have a .dwp file, read the debug sections for the requested CU.
+ dwp_reader_->ReadDebugSectionsForCU(dwo_id_, &sections);
+ if (!sections.empty()) {
+ SectionMap::const_iterator cu_iter =
+ GetSectionByName(sections, ".debug_info_offset");
+ SectionMap::const_iterator debug_info_iter =
+ GetSectionByName(sections, ".debug_info");
+ assert(cu_iter != sections.end());
+ assert(debug_info_iter != sections.end());
+ cu_offset = cu_iter->second.first - debug_info_iter->second.first;
+ found_in_dwp = true;
+ split_file = dwp_path;
+ }
}
}
}
- bool found_in_dwp = false;
- if (dwp_reader_) {
- // If we have a .dwp file, read the debug sections for the requested CU.
- SectionMap sections;
- dwp_reader_->ReadDebugSectionsForCU(dwo_id_, &sections);
- if (!sections.empty()) {
- found_in_dwp = true;
- CompilationUnit dwp_comp_unit(dwp_path_, sections, 0,
- dwp_byte_reader_.get(), handler_);
- dwp_comp_unit.SetSplitDwarf(addr_buffer_, addr_buffer_length_, addr_base_,
- ranges_base_, dwo_id_);
- dwp_comp_unit.Start();
- }
- }
if (!found_in_dwp) {
// If no .dwp file, try to open the .dwo file.
if (stat(dwo_name_, &statbuf) == 0) {
- ElfReader elf(dwo_name_);
- int width = GetElfWidth(elf);
+ split_elf_reader_ = std::make_unique<ElfReader>(dwo_name_);
+ int width = GetElfWidth(*split_elf_reader_.get());
if (width != 0) {
- ByteReader reader(ENDIANNESS_LITTLE);
- reader.SetAddressSize(width);
- SectionMap sections;
- ReadDebugSectionsFromDwo(&elf, &sections);
- CompilationUnit dwo_comp_unit(dwo_name_, sections, 0, &reader,
- handler_);
- dwo_comp_unit.SetSplitDwarf(addr_buffer_, addr_buffer_length_,
- addr_base_, ranges_base_, dwo_id_);
- dwo_comp_unit.Start();
+ split_byte_reader = ByteReader(ENDIANNESS_LITTLE);
+ split_byte_reader.SetAddressSize(width);
+ ReadDebugSectionsFromDwo(split_elf_reader_.get(), &sections);
+ if (!sections.empty()) {
+ split_file = dwo_name_;
+ }
}
}
}
+ return !split_file.empty();
}
void CompilationUnit::ReadDebugSectionsFromDwo(ElfReader* elf_reader,
@@ -1084,10 +1098,6 @@ DwpReader::DwpReader(const ByteReader& byte_reader, ElfReader* elf_reader)
abbrev_size_(0), info_data_(NULL), info_size_(0),
str_offsets_data_(NULL), str_offsets_size_(0) {}
-DwpReader::~DwpReader() {
- if (elf_reader_) delete elf_reader_;
-}
-
void DwpReader::Initialize() {
cu_index_ = elf_reader_->GetSectionByName(".debug_cu_index",
&cu_index_size_);
@@ -1127,6 +1137,8 @@ void DwpReader::Initialize() {
info_data_ = elf_reader_->GetSectionByName(".debug_info.dwo", &info_size_);
str_offsets_data_ = elf_reader_->GetSectionByName(".debug_str_offsets.dwo",
&str_offsets_size_);
+ rnglist_data_ =
+ elf_reader_->GetSectionByName(".debug_rnglists.dwo", &rnglist_size_);
if (size_table_ >= cu_index_ + cu_index_size_) {
version_ = 0;
}
@@ -1227,13 +1239,24 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id,
} else if (section_id == DW_SECT_INFO) {
sections->insert(std::make_pair(
".debug_info",
- std::make_pair(reinterpret_cast<const uint8_t*> (info_data_)
- + offset, size)));
+ std::make_pair(reinterpret_cast<const uint8_t*>(info_data_), 0)));
+ // .debug_info_offset will points the buffer for the CU with given
+ // dwo_id.
+ sections->insert(std::make_pair(
+ ".debug_info_offset",
+ std::make_pair(
+ reinterpret_cast<const uint8_t*>(info_data_) + offset, size)));
} else if (section_id == DW_SECT_STR_OFFSETS) {
sections->insert(std::make_pair(
".debug_str_offsets",
std::make_pair(reinterpret_cast<const uint8_t*> (str_offsets_data_)
+ offset, size)));
+ } else if (section_id == DW_SECT_RNGLISTS) {
+ sections->insert(std::make_pair(
+ ".debug_rnglists",
+ std::make_pair(
+ reinterpret_cast<const uint8_t*>(rnglist_data_) + offset,
+ size)));
}
}
sections->insert(std::make_pair(
@@ -1819,6 +1842,11 @@ bool RangeListReader::ReadRanges(enum DwarfForm form, uint64_t data) {
return ReadDebugRngList(data);
}
} else if (form == DW_FORM_rnglistx) {
+ if (cu_info_->ranges_base_ == 0) {
+ // In split dwarf, there's no DW_AT_rnglists_base attribute, range_base
+ // will just be the first byte after the header.
+ cu_info_->ranges_base_ = reader_->OffsetSize() == 4? 12: 20;
+ }
offset_array_ = cu_info_->ranges_base_;
uint64_t index_offset = reader_->OffsetSize() * data;
uint64_t range_list_offset =
diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h
index ddcdd801..b6bd2f31 100644
--- a/src/common/dwarf/dwarf2reader.h
+++ b/src/common/dwarf/dwarf2reader.h
@@ -469,8 +469,7 @@ class CompilationUnit {
// compilation unit. We also inherit the Dwarf2Handler from
// the executable file, and call it as if we were still
// processing the original compilation unit.
- void SetSplitDwarf(const uint8_t* addr_buffer, uint64_t addr_buffer_length,
- uint64_t addr_base, uint64_t ranges_base, uint64_t dwo_id);
+ void SetSplitDwarf(uint64_t addr_base, uint64_t dwo_id);
// Begin reading a Dwarf2 compilation unit, and calling the
// callbacks in the Dwarf2Handler
@@ -481,6 +480,36 @@ class CompilationUnit {
// start of the next compilation unit, if there is one.
uint64_t Start();
+ // Process the actual debug information in a split DWARF file.
+ bool ProcessSplitDwarf(std::string& split_file,
+ SectionMap& sections,
+ ByteReader& split_byte_reader,
+ uint64_t& cu_offset);
+
+ const uint8_t* GetAddrBuffer() { return addr_buffer_; }
+
+ uint64_t GetAddrBufferLen() { return addr_buffer_length_; }
+
+ uint64_t GetAddrBase() { return addr_base_; }
+
+ uint64_t GetLowPC() { return low_pc_; }
+
+ uint64_t GetDWOID() { return dwo_id_; }
+
+ const uint8_t* GetLineBuffer() { return line_buffer_; }
+
+ uint64_t GetLineBufferLen() { return line_buffer_length_; }
+
+ const uint8_t* GetLineStrBuffer() { return line_string_buffer_; }
+
+ uint64_t GetLineStrBufferLen() { return line_string_buffer_length_; }
+
+ bool HasSourceLineInfo() { return has_source_line_info_; }
+
+ uint64_t GetSourceLineOffset() { return source_line_offset_; }
+
+ bool ShouldProcessSplitDwarf() { return should_process_split_dwarf_; }
+
private:
// This struct represents a single DWARF2/3 abbreviation
@@ -565,14 +594,12 @@ class CompilationUnit {
else if (attr == DW_AT_str_offsets_base) {
str_offsets_base_ = data;
}
- else if (attr == DW_AT_GNU_ranges_base || attr == DW_AT_rnglists_base) {
- ranges_base_ = data;
+ else if (attr == DW_AT_low_pc) {
+ low_pc_ = data;
}
- // TODO(yunlian): When we add DW_AT_ranges_base from DWARF-5,
- // that base will apply to DW_AT_ranges attributes in the
- // skeleton CU as well as in the .dwo/.dwp files.
- else if (attr == DW_AT_ranges && is_split_dwarf_) {
- data += ranges_base_;
+ else if (attr == DW_AT_stmt_list) {
+ has_source_line_info_ = true;
+ source_line_offset_ = data;
}
handler_->ProcessAttributeUnsigned(offset, attr, form, data);
}
@@ -647,9 +674,6 @@ class CompilationUnit {
// new place to position the stream to.
const uint8_t* SkipAttribute(const uint8_t* start, enum DwarfForm form);
- // Process the actual debug information in a split DWARF file.
- void ProcessSplitDwarf();
-
// Read the debug sections from a .dwo file.
void ReadDebugSectionsFromDwo(ElfReader* elf_reader,
SectionMap* sections);
@@ -658,7 +682,7 @@ class CompilationUnit {
const string path_;
// Offset from section start is the offset of this compilation unit
- // from the beginning of the .debug_info section.
+ // from the beginning of the .debug_info/.debug_info.dwo section.
uint64_t offset_from_section_start_;
// buffer is the buffer for our CU, starting at .debug_info + offset
@@ -688,7 +712,7 @@ class CompilationUnit {
const uint8_t* string_buffer_;
uint64_t string_buffer_length_;
- // Similarly for .debug_line_string.
+ // Similarly for .debug_line_str.
const uint8_t* line_string_buffer_;
uint64_t line_string_buffer_length_;
@@ -702,6 +726,10 @@ class CompilationUnit {
const uint8_t* addr_buffer_;
uint64_t addr_buffer_length_;
+ // .debug_line section buffer and length.
+ const uint8_t* line_buffer_;
+ uint64_t line_buffer_length_;
+
// Flag indicating whether this compilation unit is part of a .dwo
// or .dwp file. If true, we are reading this unit because a
// skeleton compilation unit in an executable file had a
@@ -730,10 +758,6 @@ class CompilationUnit {
// from the skeleton CU.
uint64_t skeleton_dwo_id_;
- // The value of the DW_AT_GNU_ranges_base or DW_AT_rnglists_base attribute,
- // if any.
- uint64_t ranges_base_;
-
// The value of the DW_AT_GNU_addr_base attribute, if any.
uint64_t addr_base_;
@@ -743,14 +767,20 @@ class CompilationUnit {
// True if we have already looked for a .dwp file.
bool have_checked_for_dwp_;
- // Path to the .dwp file.
- string dwp_path_;
-
- // ByteReader for the DWP file.
- std::unique_ptr<ByteReader> dwp_byte_reader_;
+ // ElfReader for the dwo/dwo file.
+ std::unique_ptr<ElfReader> split_elf_reader_;
// DWP reader.
- std::unique_ptr<DwpReader> dwp_reader_;
+ std::unique_ptr<DwpReader> dwp_reader_;
+
+ bool should_process_split_dwarf_;
+
+ // The value of the DW_AT_low_pc attribute, if any.
+ uint64_t low_pc_;
+
+ // The value of DW_AT_stmt_list attribute if any.
+ bool has_source_line_info_;
+ uint64_t source_line_offset_;
};
// A Reader for a .dwp file. Supports the fetching of DWARF debug
@@ -770,8 +800,6 @@ class DwpReader {
public:
DwpReader(const ByteReader& byte_reader, ElfReader* elf_reader);
- ~DwpReader();
-
// Read the CU index and initialize data members.
void Initialize();
@@ -839,6 +867,8 @@ class DwpReader {
size_t info_size_;
const char* str_offsets_data_;
size_t str_offsets_size_;
+ const char* rnglist_data_;
+ size_t rnglist_size_;
};
// This class is a reader for DWARF's Call Frame Information. CFI
diff --git a/src/common/dwarf/dwarf2reader_cfi_unittest.cc b/src/common/dwarf/dwarf2reader_cfi_unittest.cc
index dc4418c7..67b662a3 100644
--- a/src/common/dwarf/dwarf2reader_cfi_unittest.cc
+++ b/src/common/dwarf/dwarf2reader_cfi_unittest.cc
@@ -30,6 +30,10 @@
// dwarf2reader_cfi_unittest.cc: Unit tests for google_breakpad::CallFrameInfo
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/common/dwarf/dwarf2reader_die_unittest.cc b/src/common/dwarf/dwarf2reader_die_unittest.cc
index fc639a64..2b365396 100644
--- a/src/common/dwarf/dwarf2reader_die_unittest.cc
+++ b/src/common/dwarf/dwarf2reader_die_unittest.cc
@@ -30,6 +30,10 @@
// dwarf2reader_die_unittest.cc: Unit tests for google_breakpad::CompilationUnit
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdint.h>
#include <stdlib.h>
@@ -329,7 +333,8 @@ struct DwarfFormsFixture: public DIEFixture {
uint64_t offset=0) {
ByteReader byte_reader(params.endianness == kLittleEndian ?
ENDIANNESS_LITTLE : ENDIANNESS_BIG);
- CompilationUnit parser("", MakeSectionMap(), offset, &byte_reader, &handler);
+ CompilationUnit parser("", MakeSectionMap(), offset, &byte_reader,
+ &handler);
EXPECT_EQ(offset + parser.Start(), info_contents.size());
}
diff --git a/src/common/dwarf/dwarf2reader_lineinfo_unittest.cc b/src/common/dwarf/dwarf2reader_lineinfo_unittest.cc
index 033c6333..7de627d3 100644
--- a/src/common/dwarf/dwarf2reader_lineinfo_unittest.cc
+++ b/src/common/dwarf/dwarf2reader_lineinfo_unittest.cc
@@ -30,6 +30,10 @@
// dwarf2reader_lineinfo_unittest.cc: Unit tests for google_breakpad::LineInfo
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/common/dwarf/dwarf2reader_splitfunctions_unittest.cc b/src/common/dwarf/dwarf2reader_splitfunctions_unittest.cc
index 9ceea109..12b27e68 100644
--- a/src/common/dwarf/dwarf2reader_splitfunctions_unittest.cc
+++ b/src/common/dwarf/dwarf2reader_splitfunctions_unittest.cc
@@ -32,6 +32,10 @@
// information generated when with splitting optimizations such as
// -fsplit-machine-functions (clang) -freorder-blocks-and-partition (gcc).
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/common/dwarf/elf_reader.cc b/src/common/dwarf/elf_reader.cc
index 7664377c..31deb9db 100644
--- a/src/common/dwarf/elf_reader.cc
+++ b/src/common/dwarf/elf_reader.cc
@@ -30,6 +30,10 @@
#define _GNU_SOURCE // needed for pread()
#endif
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <limits.h>
#include <string.h>
diff --git a/src/common/dwarf/functioninfo.cc b/src/common/dwarf/functioninfo.cc
index d8fdb842..5b0ce81a 100644
--- a/src/common/dwarf/functioninfo.cc
+++ b/src/common/dwarf/functioninfo.cc
@@ -29,6 +29,10 @@
// This is a client for the dwarf2reader to extract function and line
// information from the debug info.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <limits.h>
#include <stdio.h>
diff --git a/src/common/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc
index 7da8507d..4c594175 100644
--- a/src/common/dwarf_cfi_to_module.cc
+++ b/src/common/dwarf_cfi_to_module.cc
@@ -33,6 +33,10 @@
// Implementation of google_breakpad::DwarfCFIToModule.
// See dwarf_cfi_to_module.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <memory>
#include <sstream>
#include <utility>
@@ -143,6 +147,29 @@ vector<string> DwarfCFIToModule::RegisterNames::MIPS() {
sizeof(kRegisterNames) / sizeof(kRegisterNames[0]));
}
+vector<string> DwarfCFIToModule::RegisterNames::RISCV() {
+ static const char *const names[] = {
+ "pc", "ra", "sp", "gp", "tp", "t0", "t1", "t2",
+ "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5",
+ "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7",
+ "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6",
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
+ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
+ "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
+ "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
+ };
+
+ return MakeVector(names, sizeof(names) / sizeof(names[0]));
+}
+
bool DwarfCFIToModule::Entry(size_t offset, uint64_t address, uint64_t length,
uint8_t version, const string& augmentation,
unsigned return_address) {
diff --git a/src/common/dwarf_cfi_to_module.h b/src/common/dwarf_cfi_to_module.h
index 42b618d5..19297db9 100644
--- a/src/common/dwarf_cfi_to_module.h
+++ b/src/common/dwarf_cfi_to_module.h
@@ -114,6 +114,9 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
// MIPS.
static vector<string> MIPS();
+ // RISC-V.
+ static vector<string> RISCV();
+
private:
// Given STRINGS, an array of C strings with SIZE elements, return an
// equivalent vector<string>.
diff --git a/src/common/dwarf_cfi_to_module_unittest.cc b/src/common/dwarf_cfi_to_module_unittest.cc
index 0b677b21..52653ec6 100644
--- a/src/common/dwarf_cfi_to_module_unittest.cc
+++ b/src/common/dwarf_cfi_to_module_unittest.cc
@@ -30,6 +30,10 @@
// dwarf_cfi_to_module_unittest.cc: Tests for google_breakpad::DwarfCFIToModule.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include <vector>
@@ -303,3 +307,15 @@ TEST(RegisterNames, X86_64) {
EXPECT_EQ("$rsp", names[7]);
EXPECT_EQ("$rip", names[16]);
}
+
+TEST(RegisterNames, RISCV) {
+ vector<string> names = DwarfCFIToModule::RegisterNames::RISCV();
+
+ EXPECT_EQ("pc", names[0]);
+ EXPECT_EQ("t6", names[31]);
+ EXPECT_EQ("f0", names[32]);
+ EXPECT_EQ("f31", names[63]);
+ EXPECT_EQ("v0", names[96]);
+ EXPECT_EQ("v31", names[127]);
+}
+
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc
index a5a1fd06..94a0d428 100644
--- a/src/common/dwarf_cu_to_module.cc
+++ b/src/common/dwarf_cu_to_module.cc
@@ -35,6 +35,10 @@
#define __STDC_FORMAT_MACROS
#endif /* __STDC_FORMAT_MACROS */
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/dwarf_cu_to_module.h"
#include <assert.h>
@@ -165,19 +169,23 @@ bool DwarfCUToModule::FileContext::IsUnhandledInterCUReference(
// parsing. This is for data shared across the CU's entire DIE tree,
// and parameters from the code invoking the CU parser.
struct DwarfCUToModule::CUContext {
- CUContext(FileContext* file_context_arg, WarningReporter* reporter_arg,
- RangesHandler* ranges_handler_arg)
+ CUContext(FileContext* file_context_arg,
+ WarningReporter* reporter_arg,
+ RangesHandler* ranges_handler_arg,
+ uint64_t low_pc,
+ uint64_t addr_base)
: version(0),
file_context(file_context_arg),
reporter(reporter_arg),
ranges_handler(ranges_handler_arg),
language(Language::CPlusPlus),
- low_pc(0),
+ low_pc(low_pc),
high_pc(0),
ranges_form(DW_FORM_sec_offset),
ranges_data(0),
ranges_base(0),
- str_offsets_base(0) { }
+ addr_base(addr_base),
+ str_offsets_base(0) {}
~CUContext() {
for (vector<Module::Function*>::iterator it = functions.begin();
@@ -326,7 +334,10 @@ class DwarfCUToModule::GenericDIEHandler: public DIEHandler {
// Use this from EndAttributes member functions, not ProcessAttribute*
// functions; only the former can be sure that all the DIE's attributes
// have been seen.
- StringView ComputeQualifiedName();
+ //
+ // On return, if has_qualified_name is non-NULL, *has_qualified_name is set to
+ // true if the DIE includes a fully-qualified name, false otherwise.
+ StringView ComputeQualifiedName(bool* has_qualified_name);
CUContext* cu_context_;
DIEContext* parent_context_;
@@ -462,7 +473,8 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeString(
}
}
-StringView DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
+StringView DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName(
+ bool* has_qualified_name) {
// Use the demangled name, if one is available. Demangled names are
// preferable to those inferred from the DWARF structure because they
// include argument types.
@@ -478,6 +490,15 @@ StringView DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
StringView* unqualified_name = nullptr;
StringView* enclosing_name = nullptr;
if (!qualified_name) {
+ if (has_qualified_name) {
+ // dSYMs built with -gmlt do not include the DW_AT_linkage_name
+ // with the unmangled symbol, but rather include it in the
+ // LC_SYMTAB STABS, which end up in the externs of the module.
+ //
+ // Remember this so the Module can copy over the extern name later.
+ *has_qualified_name = false;
+ }
+
// Find the unqualified name. If the DIE has its own DW_AT_name
// attribute, then use that; otherwise, check the specification.
if (!name_attribute_.empty()) {
@@ -496,6 +517,10 @@ StringView DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() {
} else if (parent_context_) {
enclosing_name = &parent_context_->name;
}
+ } else {
+ if (has_qualified_name) {
+ *has_qualified_name = true;
+ }
}
// Prepare the return value before upcoming mutations possibly invalidate the
@@ -554,6 +579,7 @@ class DwarfCUToModule::InlineHandler : public GenericDIEHandler {
ranges_data_(0),
call_site_line_(0),
inline_nest_level_(inline_nest_level),
+ has_range_data_(false),
inlines_(inlines) {}
void ProcessAttributeUnsigned(enum DwarfAttribute attr,
@@ -575,6 +601,7 @@ class DwarfCUToModule::InlineHandler : public GenericDIEHandler {
int call_site_line_; // DW_AT_call_line
int call_site_file_id_; // DW_AT_call_file
int inline_nest_level_;
+ bool has_range_data_;
// A vector of inlines in the same nest level. It's owned by its parent
// function/inline. At Finish(), add this inline into the vector.
vector<unique_ptr<Module::Inline>>& inlines_;
@@ -595,6 +622,7 @@ void DwarfCUToModule::InlineHandler::ProcessAttributeUnsigned(
high_pc_ = data;
break;
case DW_AT_ranges:
+ has_range_data_ = true;
ranges_data_ = data;
ranges_form_ = form;
break;
@@ -638,7 +666,7 @@ bool DwarfCUToModule::InlineHandler::EndAttributes() {
void DwarfCUToModule::InlineHandler::Finish() {
vector<Module::Range> ranges;
- if (low_pc_ && high_pc_) {
+ if (!has_range_data_) {
if (high_pc_form_ != DW_FORM_addr &&
high_pc_form_ != DW_FORM_GNU_addr_index &&
high_pc_form_ != DW_FORM_addrx &&
@@ -675,11 +703,12 @@ void DwarfCUToModule::InlineHandler::Finish() {
// Every DW_TAG_inlined_subroutine should have a DW_AT_abstract_origin.
assert(specification_offset_ != 0);
- cu_context_->file_context->module_->inline_origin_map.SetReference(
- specification_offset_, specification_offset_);
+ Module::InlineOriginMap& inline_origin_map =
+ cu_context_->file_context->module_
+ ->inline_origin_maps[cu_context_->file_context->filename_];
+ inline_origin_map.SetReference(specification_offset_, specification_offset_);
Module::InlineOrigin* origin =
- cu_context_->file_context->module_->inline_origin_map
- .GetOrCreateInlineOrigin(specification_offset_, name_);
+ inline_origin_map.GetOrCreateInlineOrigin(specification_offset_, name_);
unique_ptr<Module::Inline> in(
new Module::Inline(origin, ranges, call_site_line_, call_site_file_id_,
inline_nest_level_, std::move(child_inlines_)));
@@ -718,7 +747,9 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
ranges_form_(DW_FORM_sec_offset),
ranges_data_(0),
inline_(false),
- handle_inline_(handle_inline) {}
+ handle_inline_(handle_inline),
+ has_qualified_name_(false),
+ has_range_data_(false) {}
void ProcessAttributeUnsigned(enum DwarfAttribute attr,
enum DwarfForm form,
@@ -741,6 +772,8 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler {
bool inline_;
vector<unique_ptr<Module::Inline>> child_inlines_;
bool handle_inline_;
+ bool has_qualified_name_;
+ bool has_range_data_;
DIEContext child_context_; // A context for our children.
};
@@ -760,6 +793,7 @@ void DwarfCUToModule::FuncHandler::ProcessAttributeUnsigned(
high_pc_ = data;
break;
case DW_AT_ranges:
+ has_range_data_ = true;
ranges_data_ = data;
ranges_form_ = form;
break;
@@ -804,7 +838,7 @@ DIEHandler* DwarfCUToModule::FuncHandler::FindChildHandler(
bool DwarfCUToModule::FuncHandler::EndAttributes() {
// Compute our name, and record a specification, if appropriate.
- name_ = ComputeQualifiedName();
+ name_ = ComputeQualifiedName(&has_qualified_name_);
if (name_.empty() && abstract_origin_) {
name_ = abstract_origin_->name;
}
@@ -830,7 +864,7 @@ void DwarfCUToModule::FuncHandler::Finish() {
iter->second->name = name_;
}
- if (!ranges_data_) {
+ if (!has_range_data_) {
// Make high_pc_ an address, if it isn't already.
if (high_pc_form_ != DW_FORM_addr &&
high_pc_form_ != DW_FORM_GNU_addr_index &&
@@ -877,6 +911,9 @@ void DwarfCUToModule::FuncHandler::Finish() {
scoped_ptr<Module::Function> func(new Module::Function(name, low_pc_));
func->ranges = ranges;
func->parameter_size = 0;
+ // If the name was unqualified, prefer the Extern name if there's a mismatch
+ // (the Extern name will be fully-qualified in that case).
+ func->prefer_extern_name = !has_qualified_name_;
if (func->address) {
// If the function address is zero this is a sign that this function
// description is just empty debug data and should just be discarded.
@@ -903,15 +940,16 @@ void DwarfCUToModule::FuncHandler::Finish() {
StringView name = name_.empty() ? name_omitted : name_;
uint64_t offset =
specification_offset_ != 0 ? specification_offset_ : offset_;
- cu_context_->file_context->module_->inline_origin_map.SetReference(offset_,
- offset);
- cu_context_->file_context->module_->inline_origin_map
- .GetOrCreateInlineOrigin(offset_, name);
+ Module::InlineOriginMap& inline_origin_map =
+ cu_context_->file_context->module_
+ ->inline_origin_maps[cu_context_->file_context->filename_];
+ inline_origin_map.SetReference(offset_, offset);
+ inline_origin_map.GetOrCreateInlineOrigin(offset_, name);
}
}
bool DwarfCUToModule::NamedScopeHandler::EndAttributes() {
- child_context_.name = ComputeQualifiedName();
+ child_context_.name = ComputeQualifiedName(NULL);
if (child_context_.name.empty() && no_specification) {
cu_context_->reporter->UnknownSpecification(offset_, specification_offset_);
}
@@ -1041,12 +1079,21 @@ DwarfCUToModule::DwarfCUToModule(FileContext* file_context,
LineToModuleHandler* line_reader,
RangesHandler* ranges_handler,
WarningReporter* reporter,
- bool handle_inline)
+ bool handle_inline,
+ uint64_t low_pc,
+ uint64_t addr_base,
+ bool has_source_line_info,
+ uint64_t source_line_offset)
: RootDIEHandler(handle_inline),
line_reader_(line_reader),
- cu_context_(new CUContext(file_context, reporter, ranges_handler)),
+ cu_context_(new CUContext(file_context,
+ reporter,
+ ranges_handler,
+ low_pc,
+ addr_base)),
child_context_(new DIEContext()),
- has_source_line_info_(false) {}
+ has_source_line_info_(has_source_line_info),
+ source_line_offset_(source_line_offset) {}
DwarfCUToModule::~DwarfCUToModule() {
}
diff --git a/src/common/dwarf_cu_to_module.h b/src/common/dwarf_cu_to_module.h
index 5a800104..1ff0ebc7 100644
--- a/src/common/dwarf_cu_to_module.h
+++ b/src/common/dwarf_cu_to_module.h
@@ -264,7 +264,11 @@ class DwarfCUToModule: public RootDIEHandler {
LineToModuleHandler* line_reader,
RangesHandler* ranges_handler,
WarningReporter* reporter,
- bool handle_inline = false);
+ bool handle_inline = false,
+ uint64_t low_pc = 0,
+ uint64_t addr_base = 0,
+ bool has_source_line_info = false,
+ uint64_t source_line_offset = 0);
~DwarfCUToModule();
void ProcessAttributeSigned(enum DwarfAttribute attr,
diff --git a/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc
index f3fa4903..134b2c24 100644
--- a/src/common/dwarf_cu_to_module_unittest.cc
+++ b/src/common/dwarf_cu_to_module_unittest.cc
@@ -30,6 +30,10 @@
// dwarf_cu_to_module.cc: Unit tests for google_breakpad::DwarfCUToModule.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdint.h>
#include <string>
@@ -263,6 +267,10 @@ class CUFixtureBase {
void TestFunction(int i, const string& name,
Module::Address address, Module::Address size);
+ // Test that the I'th function (ordered by address) in the module
+ // this.module_ has the given prefer_extern_name.
+ void TestFunctionPreferExternName(int i, bool prefer_extern_name);
+
// Test that the number of source lines owned by the I'th function
// in the module this.module_ is equal to EXPECTED.
void TestLineCount(int i, size_t expected);
@@ -611,6 +619,15 @@ void CUFixtureBase::TestFunction(int i, const string& name,
EXPECT_EQ(0U, function->parameter_size);
}
+void CUFixtureBase::TestFunctionPreferExternName(int i,
+ bool prefer_extern_name) {
+ FillFunctions();
+ ASSERT_LT((size_t)i, functions_.size());
+
+ Module::Function* function = functions_[i];
+ EXPECT_EQ(prefer_extern_name, function->prefer_extern_name);
+}
+
void CUFixtureBase::TestLineCount(int i, size_t expected) {
FillFunctions();
ASSERT_LT((size_t) i, functions_.size());
diff --git a/src/common/dwarf_line_to_module.cc b/src/common/dwarf_line_to_module.cc
index e716d483..940ab2d6 100644
--- a/src/common/dwarf_line_to_module.cc
+++ b/src/common/dwarf_line_to_module.cc
@@ -31,6 +31,10 @@
// dwarf_line_to_module.cc: Implementation of DwarfLineToModule class.
// See dwarf_line_to_module.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <string>
diff --git a/src/common/dwarf_line_to_module_unittest.cc b/src/common/dwarf_line_to_module_unittest.cc
index c4a02dfa..9eb1469f 100644
--- a/src/common/dwarf_line_to_module_unittest.cc
+++ b/src/common/dwarf_line_to_module_unittest.cc
@@ -30,6 +30,10 @@
// dwarf_line_to_module.cc: Unit tests for google_breakpad::DwarfLineToModule.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <vector>
#include "breakpad_googletest_includes.h"
diff --git a/src/common/dwarf_range_list_handler.cc b/src/common/dwarf_range_list_handler.cc
index 4d3dbd2e..c40a5c3b 100644
--- a/src/common/dwarf_range_list_handler.cc
+++ b/src/common/dwarf_range_list_handler.cc
@@ -32,6 +32,10 @@
// dwarf_range_list_handler.cc: Implementation of DwarfRangeListHandler class.
// See dwarf_range_list_handler.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <algorithm>
#include "common/dwarf_range_list_handler.h"
diff --git a/src/common/language.cc b/src/common/language.cc
index 0096a8d1..61693a8c 100644
--- a/src/common/language.cc
+++ b/src/common/language.cc
@@ -31,6 +31,10 @@
// language.cc: Subclasses and singletons for google_breakpad::Language.
// See language.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/language.h"
#include <stdlib.h>
diff --git a/src/common/linux/breakpad_getcontext.h b/src/common/linux/breakpad_getcontext.h
index c553219f..d64784d4 100644
--- a/src/common/linux/breakpad_getcontext.h
+++ b/src/common/linux/breakpad_getcontext.h
@@ -29,10 +29,6 @@
#ifndef GOOGLE_BREAKPAD_COMMON_LINUX_INCLUDE_UCONTEXT_H
#define GOOGLE_BREAKPAD_COMMON_LINUX_INCLUDE_UCONTEXT_H
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifndef HAVE_GETCONTEXT
#include <signal.h>
diff --git a/src/common/linux/breakpad_getcontext_unittest.cc b/src/common/linux/breakpad_getcontext_unittest.cc
index 573ddd88..5b340eb7 100644
--- a/src/common/linux/breakpad_getcontext_unittest.cc
+++ b/src/common/linux/breakpad_getcontext_unittest.cc
@@ -29,6 +29,10 @@
// asm/sigcontext.h can't be included with signal.h on glibc or
// musl, so only compare _libc_fpstate and _fpstate on Android.
#if defined(__ANDROID__) && defined(__x86_64__)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <asm/sigcontext.h>
#endif
diff --git a/src/common/linux/crc32.cc b/src/common/linux/crc32.cc
index c02f06c4..cf386a24 100644
--- a/src/common/linux/crc32.cc
+++ b/src/common/linux/crc32.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/crc32.h"
namespace google_breakpad {
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index b436f765..b693fc9e 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -31,6 +31,10 @@
// dump_symbols.cc: implement google_breakpad::WriteSymbolFile:
// Find all the debugging info in a file and dump it as a Breakpad symbol file.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/dump_symbols.h"
#include <assert.h>
@@ -47,6 +51,9 @@
#include <sys/stat.h>
#include <unistd.h>
#include <zlib.h>
+#ifdef HAVE_LIBZSTD
+#include <zstd.h>
+#endif
#include <set>
#include <string>
@@ -104,6 +111,11 @@ using google_breakpad::wasteful_vector;
#define EM_AARCH64 183
#endif
+// Define ZStd compression if host machine does not include this define.
+#ifndef ELFCOMPRESS_ZSTD
+#define ELFCOMPRESS_ZSTD 2
+#endif
+
//
// FDWrapper
//
@@ -301,7 +313,7 @@ uint32_t GetCompressionHeader(
return sizeof (*header);
}
-std::pair<uint8_t *, uint64_t> UncompressSectionContents(
+std::pair<uint8_t *, uint64_t> UncompressZlibSectionContents(
const uint8_t* compressed_buffer, uint64_t compressed_size, uint64_t uncompressed_size) {
z_stream stream;
memset(&stream, 0, sizeof stream);
@@ -330,6 +342,90 @@ std::pair<uint8_t *, uint64_t> UncompressSectionContents(
: std::make_pair(uncompressed_buffer.release(), uncompressed_size);
}
+#ifdef HAVE_LIBZSTD
+std::pair<uint8_t *, uint64_t> UncompressZstdSectionContents(
+ const uint8_t* compressed_buffer, uint64_t compressed_size,uint64_t uncompressed_size) {
+
+ google_breakpad::scoped_array<uint8_t> uncompressed_buffer(new uint8_t[uncompressed_size]);
+ size_t out_size = ZSTD_decompress(uncompressed_buffer.get(), uncompressed_size,
+ compressed_buffer, compressed_size);
+ if (ZSTD_isError(out_size)) {
+ return std::make_pair(nullptr, 0);
+ }
+ assert(out_size == uncompressed_size);
+ return std::make_pair(uncompressed_buffer.release(), uncompressed_size);
+}
+#endif
+
+std::pair<uint8_t *, uint64_t> UncompressSectionContents(
+ uint64_t compression_type, const uint8_t* compressed_buffer,
+ uint64_t compressed_size, uint64_t uncompressed_size) {
+ if (compression_type == ELFCOMPRESS_ZLIB) {
+ return UncompressZlibSectionContents(compressed_buffer, compressed_size, uncompressed_size);
+ }
+
+#ifdef HAVE_LIBZSTD
+ if (compression_type == ELFCOMPRESS_ZSTD) {
+ return UncompressZstdSectionContents(compressed_buffer, compressed_size, uncompressed_size);
+ }
+#endif
+
+ return std::make_pair(nullptr, 0);
+}
+
+void StartProcessSplitDwarf(google_breakpad::CompilationUnit* reader,
+ Module* module,
+ google_breakpad::Endianness endianness,
+ bool handle_inter_cu_refs,
+ bool handle_inline) {
+ std::string split_file;
+ google_breakpad::SectionMap split_sections;
+ google_breakpad::ByteReader split_byte_reader(endianness);
+ uint64_t cu_offset = 0;
+ if (!reader->ProcessSplitDwarf(split_file, split_sections, split_byte_reader,
+ cu_offset))
+ return;
+ DwarfCUToModule::FileContext file_context(split_file, module,
+ handle_inter_cu_refs);
+ for (auto section : split_sections)
+ file_context.AddSectionToSectionMap(section.first, section.second.first,
+ section.second.second);
+ // Because DWP/DWO file doesn't have .debug_addr/.debug_line/.debug_line_str,
+ // its debug info will refer to .debug_addr/.debug_line in the main binary.
+ if (file_context.section_map().find(".debug_addr") ==
+ file_context.section_map().end())
+ file_context.AddSectionToSectionMap(".debug_addr", reader->GetAddrBuffer(),
+ reader->GetAddrBufferLen());
+ if (file_context.section_map().find(".debug_line") ==
+ file_context.section_map().end())
+ file_context.AddSectionToSectionMap(".debug_line", reader->GetLineBuffer(),
+ reader->GetLineBufferLen());
+ if (file_context.section_map().find(".debug_line_str") ==
+ file_context.section_map().end())
+ file_context.AddSectionToSectionMap(".debug_line_str",
+ reader->GetLineStrBuffer(),
+ reader->GetLineStrBufferLen());
+
+ DumperRangesHandler ranges_handler(&split_byte_reader);
+ DumperLineToModule line_to_module(&split_byte_reader);
+ DwarfCUToModule::WarningReporter reporter(split_file, cu_offset);
+ DwarfCUToModule root_handler(
+ &file_context, &line_to_module, &ranges_handler, &reporter, handle_inline,
+ reader->GetLowPC(), reader->GetAddrBase(), reader->HasSourceLineInfo(),
+ reader->GetSourceLineOffset());
+ google_breakpad::DIEDispatcher die_dispatcher(&root_handler);
+ google_breakpad::CompilationUnit split_reader(
+ split_file, file_context.section_map(), cu_offset, &split_byte_reader,
+ &die_dispatcher);
+ split_reader.SetSplitDwarf(reader->GetAddrBase(), reader->GetDWOID());
+ split_reader.Start();
+ // Normally, it won't happen unless we have transitive reference.
+ if (split_reader.ShouldProcessSplitDwarf()) {
+ StartProcessSplitDwarf(&split_reader, module, endianness,
+ handle_inter_cu_refs, handle_inline);
+ }
+}
+
template<typename ElfClass>
bool LoadDwarf(const string& dwarf_filename,
const typename ElfClass::Ehdr* elf_header,
@@ -380,7 +476,7 @@ bool LoadDwarf(const string& dwarf_filename,
size -= compression_header_size;
std::pair<uint8_t *, uint64_t> uncompressed =
- UncompressSectionContents(contents, size, chdr.ch_size);
+ UncompressSectionContents(chdr.ch_type, contents, size, chdr.ch_size);
if (uncompressed.first != nullptr && uncompressed.second != 0) {
file_context.AddManagedSectionToSectionMap(name, uncompressed.first, uncompressed.second);
@@ -417,6 +513,11 @@ bool LoadDwarf(const string& dwarf_filename,
&die_dispatcher);
// Process the entire compilation unit; get the offset of the next.
offset += reader.Start();
+ // Start to process split dwarf file.
+ if (reader.ShouldProcessSplitDwarf()) {
+ StartProcessSplitDwarf(&reader, module, endianness, handle_inter_cu_refs,
+ handle_inline);
+ }
}
return true;
}
@@ -445,6 +546,9 @@ bool DwarfCFIRegisterNames(const typename ElfClass::Ehdr* elf_header,
case EM_X86_64:
*register_names = DwarfCFIToModule::RegisterNames::X86_64();
return true;
+ case EM_RISCV:
+ *register_names = DwarfCFIToModule::RegisterNames::RISCV();
+ return true;
default:
return false;
}
@@ -522,7 +626,7 @@ bool LoadDwarfCFI(const string& dwarf_filename,
cfi_size -= compression_header_size;
std::pair<uint8_t *, uint64_t> uncompressed =
- UncompressSectionContents(cfi, cfi_size, chdr.ch_size);
+ UncompressSectionContents(chdr.ch_type, cfi, cfi_size, chdr.ch_size);
if (uncompressed.first == nullptr || uncompressed.second == 0) {
fprintf(stderr, "%s: decompression failed\n", dwarf_filename.c_str());
@@ -1018,6 +1122,7 @@ const char* ElfArchitecture(const typename ElfClass::Ehdr* elf_header) {
case EM_SPARC: return "sparc";
case EM_SPARCV9: return "sparcv9";
case EM_X86_64: return "x86_64";
+ case EM_RISCV: return "riscv";
default: return NULL;
}
}
diff --git a/src/common/linux/dump_symbols_unittest.cc b/src/common/linux/dump_symbols_unittest.cc
index 97d5827e..55dcdeed 100644
--- a/src/common/linux/dump_symbols_unittest.cc
+++ b/src/common/linux/dump_symbols_unittest.cc
@@ -31,6 +31,10 @@
// dump_symbols_unittest.cc:
// Unittests for google_breakpad::DumpSymbols
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <elf.h>
#include <link.h>
#include <stdio.h>
diff --git a/src/common/linux/elf_core_dump.cc b/src/common/linux/elf_core_dump.cc
index f5ee3033..67257fd2 100644
--- a/src/common/linux/elf_core_dump.cc
+++ b/src/common/linux/elf_core_dump.cc
@@ -29,6 +29,10 @@
// elf_core_dump.cc: Implement google_breakpad::ElfCoreDump.
// See elf_core_dump.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/elf_core_dump.h"
#include <stddef.h>
diff --git a/src/common/linux/elf_core_dump_unittest.cc b/src/common/linux/elf_core_dump_unittest.cc
index 6789dd84..25cab99f 100644
--- a/src/common/linux/elf_core_dump_unittest.cc
+++ b/src/common/linux/elf_core_dump_unittest.cc
@@ -28,6 +28,10 @@
// elf_core_dump_unittest.cc: Unit tests for google_breakpad::ElfCoreDump.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <sys/procfs.h>
#include <set>
diff --git a/src/common/linux/elf_symbols_to_module.cc b/src/common/linux/elf_symbols_to_module.cc
index 3c33be99..70d50f89 100644
--- a/src/common/linux/elf_symbols_to_module.cc
+++ b/src/common/linux/elf_symbols_to_module.cc
@@ -30,6 +30,10 @@
// Original author: Ted Mielczarek <ted.mielczarek@gmail.com>
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/elf_symbols_to_module.h"
#include <cxxabi.h>
diff --git a/src/common/linux/elf_symbols_to_module_unittest.cc b/src/common/linux/elf_symbols_to_module_unittest.cc
index 17eb670f..a74b29f0 100644
--- a/src/common/linux/elf_symbols_to_module_unittest.cc
+++ b/src/common/linux/elf_symbols_to_module_unittest.cc
@@ -31,6 +31,10 @@
// elf_symbols_to_module_unittest.cc:
// Unittests for google_breakpad::ELFSymbolsToModule
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <elf.h>
#include <string>
diff --git a/src/common/linux/elfutils.cc b/src/common/linux/elfutils.cc
index a68cc0af..95b5db82 100644
--- a/src/common/linux/elfutils.cc
+++ b/src/common/linux/elfutils.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/elfutils.h"
#include <assert.h>
diff --git a/src/common/linux/file_id.cc b/src/common/linux/file_id.cc
index 0bd2a759..d8fcbd8d 100644
--- a/src/common/linux/file_id.cc
+++ b/src/common/linux/file_id.cc
@@ -31,6 +31,10 @@
// See file_id.h for documentation
//
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/file_id.h"
#include <arpa/inet.h>
diff --git a/src/common/linux/file_id_unittest.cc b/src/common/linux/file_id_unittest.cc
index 74bf9e1b..0ef45353 100644
--- a/src/common/linux/file_id_unittest.cc
+++ b/src/common/linux/file_id_unittest.cc
@@ -28,6 +28,10 @@
// Unit tests for FileID
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <elf.h>
#include <spawn.h>
#include <stdlib.h>
diff --git a/src/common/linux/google_crashdump_uploader.cc b/src/common/linux/google_crashdump_uploader.cc
index 6242e6d2..8c5e0492 100644
--- a/src/common/linux/google_crashdump_uploader.cc
+++ b/src/common/linux/google_crashdump_uploader.cc
@@ -27,6 +27,10 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/google_crashdump_uploader.h"
#include <sys/types.h>
diff --git a/src/common/linux/google_crashdump_uploader_test.cc b/src/common/linux/google_crashdump_uploader_test.cc
index 39aab65d..e81f21d6 100644
--- a/src/common/linux/google_crashdump_uploader_test.cc
+++ b/src/common/linux/google_crashdump_uploader_test.cc
@@ -28,6 +28,10 @@
// Unit test for crash dump uploader.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include "common/linux/google_crashdump_uploader.h"
diff --git a/src/common/linux/guid_creator.cc b/src/common/linux/guid_creator.cc
index 31a326c7..8635f9dc 100644
--- a/src/common/linux/guid_creator.cc
+++ b/src/common/linux/guid_creator.cc
@@ -27,7 +27,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <config.h> // Must come first
#endif
#include "common/linux/eintr_wrapper.h"
diff --git a/src/common/linux/http_upload.cc b/src/common/linux/http_upload.cc
index 1b576ea6..0a5bdb50 100644
--- a/src/common/linux/http_upload.cc
+++ b/src/common/linux/http_upload.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/http_upload.h"
#include <assert.h>
diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc
index a53087d9..2b639098 100644
--- a/src/common/linux/libcurl_wrapper.cc
+++ b/src/common/linux/libcurl_wrapper.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <dlfcn.h>
#include <iostream>
@@ -303,12 +307,10 @@ bool LibcurlWrapper::SendRequestInner(const string& url,
(*easy_getinfo_)(curl_, CURLINFO_RESPONSE_CODE, http_status_code);
}
-#ifndef NDEBUG
if (err_code != CURLE_OK)
fprintf(stderr, "Failed to send http request to %s, error: %s\n",
url.c_str(),
(*easy_strerror_)(err_code));
-#endif
Reset();
diff --git a/src/common/linux/linux_libc_support.cc b/src/common/linux/linux_libc_support.cc
index 10cbeaef..abcbfde8 100644
--- a/src/common/linux/linux_libc_support.cc
+++ b/src/common/linux/linux_libc_support.cc
@@ -30,6 +30,10 @@
// we call the libc functions directly we risk crashing in the dynamic linker
// as it tries to resolve uncached PLT entries.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/linux_libc_support.h"
#include <stddef.h>
diff --git a/src/common/linux/linux_libc_support_unittest.cc b/src/common/linux/linux_libc_support_unittest.cc
index 449f995f..30dd1430 100644
--- a/src/common/linux/linux_libc_support_unittest.cc
+++ b/src/common/linux/linux_libc_support_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/linux/linux_libc_support.h"
diff --git a/src/common/linux/memory_mapped_file.cc b/src/common/linux/memory_mapped_file.cc
index 7e444607..a7b96eb5 100644
--- a/src/common/linux/memory_mapped_file.cc
+++ b/src/common/linux/memory_mapped_file.cc
@@ -29,6 +29,10 @@
// memory_mapped_file.cc: Implement google_breakpad::MemoryMappedFile.
// See memory_mapped_file.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/memory_mapped_file.h"
#include <fcntl.h>
@@ -57,8 +61,11 @@ MemoryMappedFile::~MemoryMappedFile() {
bool MemoryMappedFile::Map(const char* path, size_t offset) {
Unmap();
-
- int fd = sys_open(path, O_RDONLY, 0);
+ // Based on https://pubs.opengroup.org/onlinepubs/7908799/xsh/open.html
+ // If O_NONBLOCK is set: The open() function will return without blocking
+ // for the device to be ready or available. Setting this value will provent
+ // hanging if file is not avilable.
+ int fd = sys_open(path, O_RDONLY | O_NONBLOCK, 0);
if (fd == -1) {
return false;
}
diff --git a/src/common/linux/memory_mapped_file.h b/src/common/linux/memory_mapped_file.h
index d4a85051..462e116e 100644
--- a/src/common/linux/memory_mapped_file.h
+++ b/src/common/linux/memory_mapped_file.h
@@ -33,7 +33,7 @@
#define COMMON_LINUX_MEMORY_MAPPED_FILE_H_
#include <stddef.h>
-#include "common/basictypes.h"
+
#include "common/memory_range.h"
namespace google_breakpad {
@@ -49,6 +49,9 @@ class MemoryMappedFile {
// If Map() fails, the object behaves as if it is default constructed.
MemoryMappedFile(const char* path, size_t offset);
+ MemoryMappedFile(const MemoryMappedFile&) = delete;
+ void operator=(const MemoryMappedFile&) = delete;
+
~MemoryMappedFile();
// Maps a file at |path| into memory, which can then be accessed via
@@ -77,8 +80,6 @@ class MemoryMappedFile {
private:
// Mapped file content as a MemoryRange object.
MemoryRange content_;
-
- DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile);
};
} // namespace google_breakpad
diff --git a/src/common/linux/memory_mapped_file_unittest.cc b/src/common/linux/memory_mapped_file_unittest.cc
index 5ed677df..b7a61a70 100644
--- a/src/common/linux/memory_mapped_file_unittest.cc
+++ b/src/common/linux/memory_mapped_file_unittest.cc
@@ -29,6 +29,10 @@
// memory_mapped_file_unittest.cc:
// Unit tests for google_breakpad::MemoryMappedFile.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
diff --git a/src/common/linux/safe_readlink.cc b/src/common/linux/safe_readlink.cc
index 97ea62c0..a42b01a5 100644
--- a/src/common/linux/safe_readlink.cc
+++ b/src/common/linux/safe_readlink.cc
@@ -29,6 +29,10 @@
// safe_readlink.cc: Implement google_breakpad::SafeReadLink.
// See safe_readlink.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stddef.h>
#include "third_party/lss/linux_syscall_support.h"
diff --git a/src/common/linux/safe_readlink_unittest.cc b/src/common/linux/safe_readlink_unittest.cc
index 6f5f9d75..8fa6d065 100644
--- a/src/common/linux/safe_readlink_unittest.cc
+++ b/src/common/linux/safe_readlink_unittest.cc
@@ -28,6 +28,10 @@
// safe_readlink_unittest.cc: Unit tests for google_breakpad::SafeReadLink.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/linux/safe_readlink.h"
diff --git a/src/common/linux/scoped_pipe.cc b/src/common/linux/scoped_pipe.cc
new file mode 100644
index 00000000..8de04ce9
--- /dev/null
+++ b/src/common/linux/scoped_pipe.cc
@@ -0,0 +1,132 @@
+// Copyright 2022 Google LLC
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google LLC nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
+#include "common/linux/scoped_pipe.h"
+
+#include <unistd.h>
+
+#include "common/linux/eintr_wrapper.h"
+
+namespace google_breakpad {
+
+ScopedPipe::ScopedPipe() {
+ fds_[0] = -1;
+ fds_[1] = -1;
+}
+
+ScopedPipe::~ScopedPipe() {
+ CloseReadFd();
+ CloseWriteFd();
+}
+
+bool ScopedPipe::Init() {
+ return pipe(fds_) == 0;
+}
+
+void ScopedPipe::CloseReadFd() {
+ if (fds_[0] != -1) {
+ close(fds_[0]);
+ fds_[0] = -1;
+ }
+}
+
+void ScopedPipe::CloseWriteFd() {
+ if (fds_[1] != -1) {
+ close(fds_[1]);
+ fds_[1] = -1;
+ }
+}
+
+bool ScopedPipe::ReadLine(std::string& line) {
+ // Simple buffered file read. `read_buffer_` stores previously read bytes, and
+ // we either return a line from this buffer, or we append blocks of read bytes
+ // to the buffer until we have a complete line.
+ size_t eol_index = read_buffer_.find('\n');
+
+ // While we don't have a full line, and read pipe is valid.
+ while (eol_index == std::string::npos && GetReadFd() != -1) {
+ // Read a block of 128 bytes from the read pipe.
+ char read_buf[128];
+ ssize_t read_len = HANDLE_EINTR(
+ read(GetReadFd(), read_buf, sizeof(read_buf)));
+ if (read_len <= 0) {
+ // Pipe error, or pipe has been closed.
+ CloseReadFd();
+ break;
+ }
+
+ // Append the block, and check if we have a full line now.
+ read_buffer_.append(read_buf, read_len);
+ eol_index = read_buffer_.find('\n');
+ }
+
+ if (eol_index != std::string::npos) {
+ // We have a full line to output.
+ line = read_buffer_.substr(0, eol_index);
+ if (eol_index < read_buffer_.size()) {
+ read_buffer_ = read_buffer_.substr(eol_index + 1);
+ } else {
+ read_buffer_ = "";
+ }
+
+ return true;
+ }
+
+ if (read_buffer_.size()) {
+ // We don't have a full line to output, but we can only reach here if the
+ // pipe has closed and there are some bytes left at the end, so we should
+ // return those bytes.
+ line = std::move(read_buffer_);
+ read_buffer_ = "";
+
+ return true;
+ }
+
+ // We don't have any buffered data left, and the pipe has closed.
+ return false;
+}
+
+int ScopedPipe::Dup2WriteFd(int new_fd) const {
+ return dup2(fds_[1], new_fd);
+}
+
+bool ScopedPipe::WriteForTesting(const void* bytes, size_t bytes_len) {
+ ssize_t r = HANDLE_EINTR(write(GetWriteFd(), bytes, bytes_len));
+ if (r != static_cast<ssize_t>(bytes_len)) {
+ CloseWriteFd();
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace google_breakpad
diff --git a/src/common/linux/scoped_pipe.h b/src/common/linux/scoped_pipe.h
new file mode 100644
index 00000000..25394c2a
--- /dev/null
+++ b/src/common/linux/scoped_pipe.h
@@ -0,0 +1,115 @@
+// Copyright 2022 Google LLC
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google LLC nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef COMMON_LINUX_SCOPED_PIPE_H_
+#define COMMON_LINUX_SCOPED_PIPE_H_
+
+#include <stdint.h>
+#include <string>
+
+namespace google_breakpad {
+
+// Small RAII wrapper for a pipe pair.
+//
+// Example (both ends of pipe in same process):
+// ScopedPipe tmp;
+// std::string line;
+// if (tmp.Init() && tmp.Write(bytes, bytes_len)) {
+// tmp.CloseWriteFd();
+// while (tmp.ReadLine(&line)) {
+// std::cerr << line << std::endl;
+// }
+// }
+//
+// Example (reading output from a child process):
+// ScopedPipe tmp;
+// if (fork()) {
+// // Parent process, read from the read end of the pipe.
+// std::string line;
+// while (tmp.ReadLine(line)) {
+// // Process output...
+// }
+// // Close read pipe once done processing the output that we wanted, this
+// // should ensure that the child process exits even if we didn't read all
+// // of the output.
+// tmp.CloseReadFd();
+// // Parent process should handle waiting for child to exit here...
+// } else {
+// // Child process, close the read fd and dup the write fd before exec'ing.
+// tmp.CloseReadFd();
+// tmp.Dup2WriteFd(STDOUT_FILENO);
+// tmp.Dup2WriteFd(STDERR_FILENO);
+// execl("some-command", "some-arguments");
+// }
+class ScopedPipe {
+ public:
+ ScopedPipe();
+ ~ScopedPipe();
+
+ // Creates the pipe pair - returns false on error.
+ bool Init();
+
+ // Close the read pipe. This only needs to be used when the read pipe needs to
+ // be closed earlier.
+ void CloseReadFd();
+
+ // Close the write pipe. This only needs to be used when the write pipe needs
+ // to be closed earlier.
+ void CloseWriteFd();
+
+ // Reads characters until newline or end of pipe. On read failure this will
+ // close the read pipe, but continue to return true and read buffered lines
+ // until the internal buffering is exhausted. This will block if there is no
+ // data available on the read pipe.
+ bool ReadLine(std::string& line);
+
+ // Writes bytes to the write end of the pipe, returns false and closes write
+ // pipe on failure.
+ bool WriteForTesting(const void* bytes, size_t bytes_len);
+
+ // Calls the dup2 system call to replace any existing open file descriptor
+ // with number new_fd with a copy of the current write end file descriptor
+ // for the pipe.
+ int Dup2WriteFd(int new_fd) const;
+
+ private:
+ int GetReadFd() const {
+ return fds_[0];
+ }
+
+ int GetWriteFd() const {
+ return fds_[1];
+ }
+
+ int fds_[2];
+ std::string read_buffer_;
+};
+
+} // namespace google_breakpad
+
+#endif // COMMON_LINUX_SCOPED_PIPE_H_
diff --git a/src/common/linux/scoped_pipe_unittest.cc b/src/common/linux/scoped_pipe_unittest.cc
new file mode 100644
index 00000000..4daa5c25
--- /dev/null
+++ b/src/common/linux/scoped_pipe_unittest.cc
@@ -0,0 +1,75 @@
+// Copyright 2022 Google LLC
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google LLC nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// scoped_pipe_unittest.cc: Unit tests for google_breakpad::ScopedPipe.
+
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
+#include "common/linux/scoped_pipe.h"
+
+#include "breakpad_googletest_includes.h"
+
+namespace google_breakpad {
+
+TEST(ScopedPipeTest, WriteAndClose) {
+ const char kTestData[] = "One\nTwo\nThree";
+ ScopedPipe pipe;
+ std::string line;
+
+ ASSERT_TRUE(pipe.Init());
+ ASSERT_TRUE(pipe.WriteForTesting(kTestData, strlen(kTestData)));
+ pipe.CloseWriteFd();
+
+ ASSERT_TRUE(pipe.ReadLine(line));
+ ASSERT_EQ(line, "One");
+ ASSERT_TRUE(pipe.ReadLine(line));
+ ASSERT_EQ(line, "Two");
+ ASSERT_TRUE(pipe.ReadLine(line));
+ ASSERT_EQ(line, "Three");
+ ASSERT_FALSE(pipe.ReadLine(line));
+}
+
+TEST(ScopedPipeTest, MultipleWrites) {
+ const char kTestDataOne[] = "One\n";
+ const char kTestDataTwo[] = "Two\n";
+ ScopedPipe pipe;
+ std::string line;
+
+ ASSERT_TRUE(pipe.Init());
+ ASSERT_TRUE(pipe.WriteForTesting(kTestDataOne, strlen(kTestDataOne)));
+ ASSERT_TRUE(pipe.ReadLine(line));
+ ASSERT_EQ(line, "One");
+
+ ASSERT_TRUE(pipe.WriteForTesting(kTestDataTwo, strlen(kTestDataTwo)));
+ ASSERT_TRUE(pipe.ReadLine(line));
+ ASSERT_EQ(line, "Two");
+}
+
+} // namespace google_breakpad
diff --git a/src/common/linux/scoped_tmpfile.cc b/src/common/linux/scoped_tmpfile.cc
new file mode 100644
index 00000000..2395a64e
--- /dev/null
+++ b/src/common/linux/scoped_tmpfile.cc
@@ -0,0 +1,103 @@
+// Copyright 2022 Google LLC
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google LLC nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Utility class for creating a temporary file that is deleted in the
+// destructor.
+
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
+#include "common/linux/scoped_tmpfile.h"
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "common/linux/eintr_wrapper.h"
+
+#if !defined(__ANDROID__)
+#define TEMPDIR "/tmp"
+#else
+#define TEMPDIR "/data/local/tmp"
+#endif
+
+namespace google_breakpad {
+
+ScopedTmpFile::ScopedTmpFile() = default;
+
+ScopedTmpFile::~ScopedTmpFile() {
+ if (fd_ >= 0) {
+ close(fd_);
+ fd_ = -1;
+ }
+}
+
+bool ScopedTmpFile::InitEmpty() {
+ // Prevent calling Init when fd_ is already valid, leaking the file.
+ if (fd_ != -1) {
+ return false;
+ }
+
+ // Respect the TMPDIR environment variable.
+ const char* tempdir = getenv("TMPDIR");
+ if (!tempdir) {
+ tempdir = TEMPDIR;
+ }
+
+ // Create a temporary file that is not linked in to the filesystem, and that
+ // is only accessible by the current user.
+ fd_ = open(tempdir, O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
+
+ return fd_ >= 0;
+}
+
+bool ScopedTmpFile::InitString(const char* text) {
+ return InitData(text, strlen(text));
+}
+
+bool ScopedTmpFile::InitData(const void* data, size_t data_len) {
+ if (!InitEmpty()) {
+ return false;
+ }
+
+ return SetContents(data, data_len);
+}
+
+bool ScopedTmpFile::SetContents(const void* data, size_t data_len) {
+ ssize_t r = HANDLE_EINTR(write(fd_, data, data_len));
+ if (r != static_cast<ssize_t>(data_len)) {
+ return false;
+ }
+
+ return 0 == lseek(fd_, 0, SEEK_SET);
+}
+
+} // namespace google_breakpad
diff --git a/src/common/linux/scoped_tmpfile.h b/src/common/linux/scoped_tmpfile.h
new file mode 100644
index 00000000..dffec182
--- /dev/null
+++ b/src/common/linux/scoped_tmpfile.h
@@ -0,0 +1,85 @@
+// Copyright 2022 Google LLC
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google LLC nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Utility class for creating a temporary file for that is deleted in the
+// destructor.
+
+#ifndef COMMON_LINUX_SCOPED_TMPFILE_H_
+#define COMMON_LINUX_SCOPED_TMPFILE_H_
+
+#include <string>
+
+namespace google_breakpad {
+
+// Small RAII wrapper for temporary files.
+//
+// Example:
+// ScopedTmpFile tmp;
+// if (tmp.Init("Some file contents")) {
+// ...
+// }
+class ScopedTmpFile {
+ public:
+ // Initialize the ScopedTmpFile object - this does not create the temporary
+ // file until Init is called.
+ ScopedTmpFile();
+
+ // Destroy temporary file on scope exit.
+ ~ScopedTmpFile();
+
+ // Creates the empty temporary file - returns true iff the temporary file was
+ // created successfully. Should always be checked before using the file.
+ bool InitEmpty();
+
+ // Creates the temporary file with the provided C string. The terminating null
+ // is not written. Returns true iff the temporary file was created
+ // successfully and the contents were written successfully.
+ bool InitString(const char* text);
+
+ // Creates the temporary file with the provided data. Returns true iff the
+ // temporary file was created successfully and the contents were written
+ // successfully.
+ bool InitData(const void* data, size_t data_len);
+
+ // Returns the Posix file descriptor for the test file, or -1 if Init()
+ // returned false. Note: on Windows, this always returns -1.
+ int GetFd() const {
+ return fd_;
+ }
+
+ private:
+ // Set the contents of the temporary file, and seek back to the start of the
+ // file. On failure, returns false.
+ bool SetContents(const void* data, size_t data_len);
+
+ int fd_ = -1;
+};
+
+} // namespace google_breakpad
+
+#endif // COMMON_LINUX_SCOPED_TMPFILE_H_
diff --git a/src/common/linux/scoped_tmpfile_unittest.cc b/src/common/linux/scoped_tmpfile_unittest.cc
new file mode 100644
index 00000000..f0bb2bbb
--- /dev/null
+++ b/src/common/linux/scoped_tmpfile_unittest.cc
@@ -0,0 +1,50 @@
+// Copyright 2022 Google LLC
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google LLC nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// scoped_tmpfile_unittest.cc: Unit tests for google_breakpad::ScopedTmpfile.
+
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
+#include "common/linux/scoped_tmpfile.h"
+
+#include <unistd.h>
+
+#include "breakpad_googletest_includes.h"
+
+using google_breakpad::ScopedTmpFile;
+
+TEST(ScopedTmpFileTest, CheckContentsMatch) {
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("Test"));
+
+ char file_contents[5] = {0};
+ ASSERT_EQ(4, read(file.GetFd(), file_contents, sizeof(file_contents)));
+ EXPECT_STREQ(file_contents, "Test");
+}
diff --git a/src/common/linux/symbol_collector_client.cc b/src/common/linux/symbol_collector_client.cc
index 1c1dc97a..e9a1893c 100644
--- a/src/common/linux/symbol_collector_client.cc
+++ b/src/common/linux/symbol_collector_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/symbol_collector_client.h"
#include <stdio.h>
diff --git a/src/common/linux/symbol_upload.cc b/src/common/linux/symbol_upload.cc
index c080533a..8ab143c6 100644
--- a/src/common/linux/symbol_upload.cc
+++ b/src/common/linux/symbol_upload.cc
@@ -29,6 +29,10 @@
// symbol_upload.cc: implemented google_breakpad::sym_upload::Start, a helper
// function for linux symbol upload tool.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/symbol_upload.h"
#include <assert.h>
diff --git a/src/common/linux/synth_elf.cc b/src/common/linux/synth_elf.cc
index 2ba25e61..8e9170e7 100644
--- a/src/common/linux/synth_elf.cc
+++ b/src/common/linux/synth_elf.cc
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/synth_elf.h"
#include <assert.h>
diff --git a/src/common/linux/synth_elf_unittest.cc b/src/common/linux/synth_elf_unittest.cc
index 44ef6ef3..578f6a26 100644
--- a/src/common/linux/synth_elf_unittest.cc
+++ b/src/common/linux/synth_elf_unittest.cc
@@ -31,6 +31,10 @@
// synth_elf_unittest.cc:
// Unittests for google_breakpad::synth_elf::ELF
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <elf.h>
#include "breakpad_googletest_includes.h"
diff --git a/src/common/linux/tests/auto_testfile.h b/src/common/linux/tests/auto_testfile.h
deleted file mode 100644
index e2d2ff23..00000000
--- a/src/common/linux/tests/auto_testfile.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2013 Google LLC
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google LLC nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Utility class for creating a temporary file for unit tests
-// that is deleted in the destructor.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE
-#define GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE
-
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <string>
-
-#include "breakpad_googletest_includes.h"
-#include "common/linux/eintr_wrapper.h"
-#include "common/tests/auto_tempdir.h"
-
-namespace google_breakpad {
-
-class AutoTestFile {
- public:
- // Create a new empty test file.
- // test_prefix: (input) test-specific prefix, can't be NULL.
- explicit AutoTestFile(const char* test_prefix) {
- Init(test_prefix);
- }
-
- // Create a new test file, and fill it with initial data from a C string.
- // The terminating zero is not written.
- // test_prefix: (input) test-specific prefix, can't be NULL.
- // text: (input) initial content.
- AutoTestFile(const char* test_prefix, const char* text) {
- Init(test_prefix);
- if (fd_ >= 0)
- WriteText(text, static_cast<size_t>(strlen(text)));
- }
-
- AutoTestFile(const char* test_prefix, const char* text, size_t text_len) {
- Init(test_prefix);
- if (fd_ >= 0)
- WriteText(text, text_len);
- }
-
- // Destroy test file on scope exit.
- ~AutoTestFile() {
- if (fd_ >= 0) {
- close(fd_);
- fd_ = -1;
- }
- }
-
- // Returns true iff the test file could be created properly.
- // Useful in tests inside EXPECT_TRUE(file.IsOk());
- bool IsOk() {
- return fd_ >= 0;
- }
-
- // Returns the Posix file descriptor for the test file, or -1
- // If IsOk() returns false. Note: on Windows, this always returns -1.
- int GetFd() {
- return fd_;
- }
-
- private:
- void Init(const char* test_prefix) {
- fd_ = -1;
- char path_templ[PATH_MAX];
- int ret = snprintf(path_templ, sizeof(path_templ),
- TEMPDIR "/%s-unittest.XXXXXX",
- test_prefix);
- if (ret >= static_cast<int>(sizeof(path_templ)))
- return;
-
- fd_ = mkstemp(path_templ);
- if (fd_ < 0)
- return;
-
- unlink(path_templ);
- }
-
- void WriteText(const char* text, size_t text_len) {
- ssize_t r = HANDLE_EINTR(write(fd_, text, text_len));
- if (r != static_cast<ssize_t>(text_len)) {
- close(fd_);
- fd_ = -1;
- return;
- }
-
- lseek(fd_, 0, SEEK_SET);
- }
-
- int fd_;
-};
-
-} // namespace google_breakpad
-
-#endif // GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE
diff --git a/src/common/linux/tests/crash_generator.cc b/src/common/linux/tests/crash_generator.cc
index 0db0c4a2..1cad9ae2 100644
--- a/src/common/linux/tests/crash_generator.cc
+++ b/src/common/linux/tests/crash_generator.cc
@@ -29,6 +29,10 @@
// crash_generator.cc: Implement google_breakpad::CrashGenerator.
// See crash_generator.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/tests/crash_generator.h"
#include <pthread.h>
diff --git a/src/common/long_string_dictionary.cc b/src/common/long_string_dictionary.cc
index f504aa42..19a649e7 100644
--- a/src/common/long_string_dictionary.cc
+++ b/src/common/long_string_dictionary.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/long_string_dictionary.h"
#include <assert.h>
diff --git a/src/common/long_string_dictionary_unittest.cc b/src/common/long_string_dictionary_unittest.cc
index be34efdf..f10dc0d9 100644
--- a/src/common/long_string_dictionary_unittest.cc
+++ b/src/common/long_string_dictionary_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <algorithm>
#include <string>
diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc
index 392efe78..96340d54 100644
--- a/src/common/mac/arch_utilities.cc
+++ b/src/common/mac/arch_utilities.cc
@@ -26,113 +26,22 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/mac/arch_utilities.h"
+#include <mach/machine.h>
#include <mach-o/arch.h>
#include <mach-o/fat.h>
#include <stdio.h>
#include <string.h>
-#ifndef CPU_SUBTYPE_ARM_V7S
-#define CPU_SUBTYPE_ARM_V7S (static_cast<cpu_subtype_t>(11))
-#endif // CPU_SUBTYPE_ARM_V7S
-
-#ifndef CPU_TYPE_ARM64
-#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
-#endif // CPU_TYPE_ARM64
-
-#ifndef CPU_SUBTYPE_ARM64_ALL
-#define CPU_SUBTYPE_ARM64_ALL (static_cast<cpu_subtype_t>(0))
-#endif // CPU_SUBTYPE_ARM64_ALL
-
-#ifndef CPU_SUBTYPE_ARM64_E
-#define CPU_SUBTYPE_ARM64_E (static_cast<cpu_subtype_t>(2))
-#endif // CPU_SUBTYPE_ARM64_E
-
-namespace {
-
-const NXArchInfo* ArchInfo_arm64(cpu_subtype_t cpu_subtype) {
- const char* name = NULL;
- switch (cpu_subtype) {
- case CPU_SUBTYPE_ARM64_ALL:
- name = "arm64";
- break;
- case CPU_SUBTYPE_ARM64_E:
- name = "arm64e";
- break;
- default:
- return NULL;
- }
-
- NXArchInfo* arm64 = new NXArchInfo;
- *arm64 = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM,
- CPU_SUBTYPE_ARM_V7);
- arm64->name = name;
- arm64->cputype = CPU_TYPE_ARM64;
- arm64->cpusubtype = cpu_subtype;
- arm64->description = "arm 64";
- return arm64;
-}
-
-const NXArchInfo* ArchInfo_armv7s() {
- NXArchInfo* armv7s = new NXArchInfo;
- *armv7s = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM,
- CPU_SUBTYPE_ARM_V7);
- armv7s->name = "armv7s";
- armv7s->cpusubtype = CPU_SUBTYPE_ARM_V7S;
- armv7s->description = "arm v7s";
- return armv7s;
-}
-
-} // namespace
-
-namespace google_breakpad {
-
-const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name) {
- // TODO: Remove this when the OS knows about arm64.
- if (!strcmp("arm64", arch_name))
- return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM64,
- CPU_SUBTYPE_ARM64_ALL);
-
- if (!strcmp("arm64e", arch_name))
- return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM64,
- CPU_SUBTYPE_ARM64_E);
-
- // TODO: Remove this when the OS knows about armv7s.
- if (!strcmp("armv7s", arch_name))
- return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S);
-
- return NXGetArchInfoFromName(arch_name);
-}
-
-const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type,
- cpu_subtype_t cpu_subtype) {
- // TODO: Remove this when the OS knows about arm64.
- if (cpu_type == CPU_TYPE_ARM64 && cpu_subtype == CPU_SUBTYPE_ARM64_ALL) {
- static const NXArchInfo* arm64 = ArchInfo_arm64(cpu_subtype);
- return arm64;
- }
-
- if (cpu_type == CPU_TYPE_ARM64 && cpu_subtype == CPU_SUBTYPE_ARM64_E) {
- static const NXArchInfo* arm64e = ArchInfo_arm64(cpu_subtype);
- return arm64e;
- }
-
- // TODO: Remove this when the OS knows about armv7s.
- if (cpu_type == CPU_TYPE_ARM && cpu_subtype == CPU_SUBTYPE_ARM_V7S) {
- static const NXArchInfo* armv7s = ArchInfo_armv7s();
- return armv7s;
- }
-
- return NXGetArchInfoFromCpuType(cpu_type, cpu_subtype);
-}
-
-} // namespace google_breakpad
+#ifdef __APPLE__
+#include <mach-o/utils.h>
+#endif
-// TODO(crbug.com/1242776): The "#ifndef __APPLE__" should be here, but the
-// system version of NXGetLocalArchInfo returns incorrect information on
-// x86_64 machines (treating them as just x86), so use the Breakpad version
-// all the time for now.
namespace {
enum Architecture {
@@ -147,69 +56,31 @@ enum Architecture {
kNumArchitectures
};
+struct NamedArchInfo {
+ const char* name;
+ ArchInfo info;
+};
+
// enum Architecture above and kKnownArchitectures below
// must be kept in sync.
-const NXArchInfo kKnownArchitectures[] = {
- {
- "i386",
- CPU_TYPE_I386,
- CPU_SUBTYPE_I386_ALL,
- NX_LittleEndian,
- "Intel 80x86"
- },
- {
- "x86_64",
- CPU_TYPE_X86_64,
- CPU_SUBTYPE_X86_64_ALL,
- NX_LittleEndian,
- "Intel x86-64"
- },
- {
- "x86_64h",
- CPU_TYPE_X86_64,
- CPU_SUBTYPE_X86_64_H,
- NX_LittleEndian,
- "Intel x86-64h Haswell"
- },
- {
- "arm",
- CPU_TYPE_ARM,
- CPU_SUBTYPE_ARM_ALL,
- NX_LittleEndian,
- "ARM"
- },
- {
- "arm64",
- CPU_TYPE_ARM64,
- CPU_SUBTYPE_ARM64_ALL,
- NX_LittleEndian,
- "ARM64"
- },
- {
- "arm64e",
- CPU_TYPE_ARM64,
- CPU_SUBTYPE_ARM64_E,
- NX_LittleEndian,
- "ARM64e"
- },
- {
- "ppc",
- CPU_TYPE_POWERPC,
- CPU_SUBTYPE_POWERPC_ALL,
- NX_BigEndian,
- "PowerPC"
- }
-};
+constexpr NamedArchInfo kKnownArchitectures[] = {
+ {"i386", {CPU_TYPE_I386, CPU_SUBTYPE_I386_ALL}},
+ {"x86_64", {CPU_TYPE_X86_64, CPU_SUBTYPE_X86_64_ALL}},
+ {"x86_64h", {CPU_TYPE_X86_64, CPU_SUBTYPE_X86_64_H}},
+ {"arm", {CPU_TYPE_ARM, CPU_SUBTYPE_ARM_ALL}},
+ {"arm64", {CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64_ALL}},
+ {"arm64e", {CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64E}},
+ {"ppc", {CPU_TYPE_POWERPC, CPU_SUBTYPE_POWERPC_ALL}}};
} // namespace
-const NXArchInfo *NXGetLocalArchInfo(void) {
+ArchInfo GetLocalArchInfo(void) {
Architecture arch;
#if defined(__i386__)
arch = kArch_i386;
#elif defined(__x86_64__)
arch = kArch_x86_64;
-#elif defined(__arm64)
+#elif defined(__arm64__) || defined(__aarch64__)
arch = kArch_arm64;
#elif defined(__arm__)
arch = kArch_arm;
@@ -218,51 +89,72 @@ const NXArchInfo *NXGetLocalArchInfo(void) {
#else
#error "Unsupported CPU architecture"
#endif
- return &kKnownArchitectures[arch];
+ return kKnownArchitectures[arch].info;
}
-#ifndef __APPLE__
+#ifdef __APPLE__
-const NXArchInfo *NXGetArchInfoFromName(const char *name) {
- for (int arch = 0; arch < kNumArchitectures; ++arch) {
- if (!strcmp(name, kKnownArchitectures[arch].name)) {
- return &kKnownArchitectures[arch];
+std::optional<ArchInfo> GetArchInfoFromName(const char* arch_name) {
+ if (__builtin_available(macOS 13.0, iOS 16.0, *)) {
+ cpu_type_t type;
+ cpu_subtype_t subtype;
+ if (macho_cpu_type_for_arch_name(arch_name, &type, &subtype)) {
+ return ArchInfo{type, subtype};
+ }
+ } else {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ const NXArchInfo* info = NXGetArchInfoFromName(arch_name);
+#pragma clang diagnostic pop
+ if (info) {
+ return ArchInfo{info->cputype, info->cpusubtype};
}
}
- return NULL;
+ return std::nullopt;
}
-const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
- cpu_subtype_t cpusubtype) {
- const NXArchInfo *candidate = NULL;
+const char* GetNameFromCPUType(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {
+ if (__builtin_available(macOS 13.0, iOS 16.0, *)) {
+ const char* name = macho_arch_name_for_cpu_type(cpu_type, cpu_subtype);
+ if (name) {
+ return name;
+ }
+ } else {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ const NXArchInfo* info = NXGetArchInfoFromCpuType(cpu_type, cpu_subtype);
+#pragma clang diagnostic pop
+ if (info) {
+ return info->name;
+ }
+ }
+
+ return kUnknownArchName;
+}
+
+#else
+
+std::optional<ArchInfo> GetArchInfoFromName(const char* arch_name) {
for (int arch = 0; arch < kNumArchitectures; ++arch) {
- if (kKnownArchitectures[arch].cputype == cputype) {
- if (kKnownArchitectures[arch].cpusubtype == cpusubtype) {
- return &kKnownArchitectures[arch];
- }
- if (!candidate) {
- candidate = &kKnownArchitectures[arch];
- }
+ if (!strcmp(arch_name, kKnownArchitectures[arch].name)) {
+ return kKnownArchitectures[arch].info;
}
}
- return candidate;
+ return std::nullopt;
}
-struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
- cpu_subtype_t cpusubtype,
- struct fat_arch *fat_archs,
- uint32_t nfat_archs) {
- struct fat_arch *candidate = NULL;
- for (uint32_t f = 0; f < nfat_archs; ++f) {
- if (fat_archs[f].cputype == cputype) {
- if (fat_archs[f].cpusubtype == cpusubtype) {
- return &fat_archs[f];
+const char* GetNameFromCPUType(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {
+ const char* candidate = kUnknownArchName;
+ for (int arch = 0; arch < kNumArchitectures; ++arch) {
+ if (kKnownArchitectures[arch].info.cputype == cpu_type) {
+ if (kKnownArchitectures[arch].info.cpusubtype == cpu_subtype) {
+ return kKnownArchitectures[arch].name;
}
- if (!candidate) {
- candidate = &fat_archs[f];
+ if (!strcmp(candidate, kUnknownArchName)) {
+ candidate = kKnownArchitectures[arch].name;
}
}
}
return candidate;
}
-#endif // !__APPLE__
+#endif // __APPLE__
diff --git a/src/common/mac/arch_utilities.h b/src/common/mac/arch_utilities.h
index d267c43b..3b036738 100644
--- a/src/common/mac/arch_utilities.h
+++ b/src/common/mac/arch_utilities.h
@@ -31,16 +31,26 @@
#ifndef COMMON_MAC_ARCH_UTILITIES_H__
#define COMMON_MAC_ARCH_UTILITIES_H__
-#include <mach-o/arch.h>
+#include <mach/machine.h>
-namespace google_breakpad {
+#include <optional>
-// Custom implementation of |NXGetArchInfoFromName| and
-// |NXGetArchInfoFromCpuType| that handle newer CPU on older OSes.
-const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name);
-const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type,
- cpu_subtype_t cpu_subtype);
+static constexpr const char* kUnknownArchName = "<Unknown architecture>";
-} // namespace google_breakpad
+struct ArchInfo {
+ cpu_type_t cputype;
+ cpu_subtype_t cpusubtype;
+};
+
+// Returns architecture info if `arch_name` corresponds to a valid, known
+// architecture, and std::nullopt otherwise.
+std::optional<ArchInfo> GetArchInfoFromName(const char* arch_name);
+
+// Returns the name of the architecture specified by `cpu_type` and
+// `cpu_subtype`, or `kUnknownArchName` if it's unknown or invalid.
+const char* GetNameFromCPUType(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype);
+
+// Returns the architecture of the machine this code is running on.
+ArchInfo GetLocalArchInfo();
#endif // COMMON_MAC_ARCH_UTILITIES_H__
diff --git a/src/common/mac/bootstrap_compat.cc b/src/common/mac/bootstrap_compat.cc
index 6647bae3..408589ba 100644
--- a/src/common/mac/bootstrap_compat.cc
+++ b/src/common/mac/bootstrap_compat.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/mac/bootstrap_compat.h"
namespace breakpad {
diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc
index 9658b2c6..c06945e4 100644
--- a/src/common/mac/dump_syms.cc
+++ b/src/common/mac/dump_syms.cc
@@ -32,6 +32,10 @@
// dump_syms.cc: Create a symbol file for use with minidumps
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/mac/dump_syms.h"
#include <assert.h>
@@ -217,11 +221,10 @@ bool DumpSymbols::ReadData(uint8_t* contents, size_t size,
return true;
}
-bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
- cpu_subtype_t cpu_subtype) {
+bool DumpSymbols::SetArchitecture(const ArchInfo& info) {
// Find the best match for the architecture the user requested.
- const SuperFatArch* best_match = FindBestMatchForArchitecture(
- cpu_type, cpu_subtype);
+ const SuperFatArch* best_match =
+ FindBestMatchForArchitecture(info.cputype, info.cpusubtype);
if (!best_match) return false;
// Record the selected object file.
@@ -229,70 +232,37 @@ bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
return true;
}
-bool DumpSymbols::SetArchitecture(const std::string& arch_name) {
- bool arch_set = false;
- const NXArchInfo* arch_info =
- google_breakpad::BreakpadGetArchInfoFromName(arch_name.c_str());
- if (arch_info) {
- arch_set = SetArchitecture(arch_info->cputype, arch_info->cpusubtype);
- }
- return arch_set;
-}
SuperFatArch* DumpSymbols::FindBestMatchForArchitecture(
- cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {
- // Check if all the object files can be converted to struct fat_arch.
- bool can_convert_to_fat_arch = true;
- vector<struct fat_arch> fat_arch_vector;
- for (vector<SuperFatArch>::const_iterator it = object_files_.begin();
- it != object_files_.end();
- ++it) {
- struct fat_arch arch;
- bool success = it->ConvertToFatArch(&arch);
- if (!success) {
- can_convert_to_fat_arch = false;
- break;
- }
- fat_arch_vector.push_back(arch);
- }
-
- // If all the object files can be converted to struct fat_arch, use
- // NXFindBestFatArch.
- if (can_convert_to_fat_arch) {
- const struct fat_arch* best_match
- = NXFindBestFatArch(cpu_type, cpu_subtype, &fat_arch_vector[0],
- static_cast<uint32_t>(fat_arch_vector.size()));
-
- for (size_t i = 0; i < fat_arch_vector.size(); ++i) {
- if (best_match == &fat_arch_vector[i])
- return &object_files_[i];
+ cpu_type_t cpu_type,
+ cpu_subtype_t cpu_subtype) {
+ SuperFatArch* closest_match = nullptr;
+ for (auto& object_file : object_files_) {
+ if (static_cast<cpu_type_t>(object_file.cputype) == cpu_type) {
+ // If there's an exact match, return it directly.
+ if ((static_cast<cpu_subtype_t>(object_file.cpusubtype) &
+ ~CPU_SUBTYPE_MASK) == (cpu_subtype & ~CPU_SUBTYPE_MASK)) {
+ return &object_file;
+ }
+ // Otherwise, hold on to this as the closest match since at least the CPU
+ // type matches.
+ if (!closest_match) {
+ closest_match = &object_file;
+ }
}
- assert(best_match == NULL);
- // Fall through since NXFindBestFatArch can't find arm slices on x86_64
- // macOS 13. See FB11955188.
}
-
- // Check for an exact match with cpu_type and cpu_subtype.
- for (vector<SuperFatArch>::iterator it = object_files_.begin();
- it != object_files_.end();
- ++it) {
- if (static_cast<cpu_type_t>(it->cputype) == cpu_type &&
- (static_cast<cpu_subtype_t>(it->cpusubtype) & ~CPU_SUBTYPE_MASK) ==
- (cpu_subtype & ~CPU_SUBTYPE_MASK))
- return &*it;
- }
-
// No exact match found.
- // TODO(erikchen): If it becomes necessary, we can copy the implementation of
- // NXFindBestFatArch, located at
- // http://web.mit.edu/darwin/src/modules/cctools/libmacho/arch.c.
- fprintf(stderr, "Failed to find an exact match for an object file with cpu "
- "type: %d and cpu subtype: %d.\n", cpu_type, cpu_subtype);
- if (!can_convert_to_fat_arch) {
- fprintf(stderr, "Furthermore, at least one object file is larger "
- "than 2**32.\n");
+ fprintf(stderr,
+ "Failed to find an exact match for an object file with cpu "
+ "type: %d and cpu subtype: %d.\n",
+ cpu_type, cpu_subtype);
+ if (closest_match) {
+ fprintf(stderr, "Using %s as the closest match.\n",
+ GetNameFromCPUType(closest_match->cputype,
+ closest_match->cpusubtype));
+ return closest_match;
}
- return NULL;
+ return nullptr;
}
string DumpSymbols::Identifier() {
@@ -398,8 +368,8 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
selected_object_file_ = &object_files_[0];
else {
// Look for an object file whose architecture matches our own.
- const NXArchInfo* local_arch = NXGetLocalArchInfo();
- if (!SetArchitecture(local_arch->cputype, local_arch->cpusubtype)) {
+ ArchInfo local_arch = GetLocalArchInfo();
+ if (!SetArchitecture(local_arch)) {
fprintf(stderr, "%s: object file contains more than one"
" architecture, none of which match the current"
" architecture; specify an architecture explicitly"
@@ -414,18 +384,16 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
// Find the name of the selected file's architecture, to appear in
// the MODULE record and in error messages.
- const NXArchInfo* selected_arch_info =
- google_breakpad::BreakpadGetArchInfoFromCpuType(
- selected_object_file_->cputype, selected_object_file_->cpusubtype);
+ const char* selected_arch_name = GetNameFromCPUType(
+ selected_object_file_->cputype, selected_object_file_->cpusubtype);
// In certain cases, it is possible that architecture info can't be reliably
// determined, e.g. new architectures that breakpad is unware of. In that
// case, avoid crashing and return false instead.
- if (selected_arch_info == NULL) {
+ if (selected_arch_name == kUnknownArchName) {
return false;
}
- const char* selected_arch_name = selected_arch_info->name;
if (strcmp(selected_arch_name, "i386") == 0)
selected_arch_name = "x86";
@@ -438,7 +406,12 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
}
// Compute a module name, to appear in the MODULE record.
- string module_name = google_breakpad::BaseName(object_filename_);
+ string module_name;
+ if (!module_name_.empty()) {
+ module_name = module_name_;
+ } else {
+ module_name = google_breakpad::BaseName(object_filename_);
+ }
// Choose an identifier string, to appear in the MODULE record.
string identifier = Identifier();
@@ -447,18 +420,71 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr<Module>& module) {
// Create a module to hold the debugging information.
module.reset(new Module(module_name, "mac", selected_arch_name, identifier,
- "", enable_multiple_));
+ "", enable_multiple_, prefer_extern_name_));
return true;
}
+void DumpSymbols::StartProcessSplitDwarf(
+ google_breakpad::CompilationUnit* reader,
+ Module* module,
+ google_breakpad::Endianness endianness,
+ bool handle_inter_cu_refs,
+ bool handle_inline) const {
+ std::string split_file;
+ google_breakpad::SectionMap split_sections;
+ google_breakpad::ByteReader split_byte_reader(endianness);
+ uint64_t cu_offset = 0;
+ if (reader->ProcessSplitDwarf(split_file, split_sections, split_byte_reader,
+ cu_offset))
+ return;
+ DwarfCUToModule::FileContext file_context(split_file, module,
+ handle_inter_cu_refs);
+ for (auto section : split_sections)
+ file_context.AddSectionToSectionMap(section.first, section.second.first,
+ section.second.second);
+ // Because DWP/DWO file doesn't have .debug_addr/.debug_line/.debug_line_str,
+ // its debug info will refer to .debug_addr/.debug_line in the main binary.
+ if (file_context.section_map().find(".debug_addr") ==
+ file_context.section_map().end())
+ file_context.AddSectionToSectionMap(".debug_addr", reader->GetAddrBuffer(),
+ reader->GetAddrBufferLen());
+ if (file_context.section_map().find(".debug_line") ==
+ file_context.section_map().end())
+ file_context.AddSectionToSectionMap(".debug_line", reader->GetLineBuffer(),
+ reader->GetLineBufferLen());
+ if (file_context.section_map().find(".debug_line_str") ==
+ file_context.section_map().end())
+ file_context.AddSectionToSectionMap(".debug_line_str",
+ reader->GetLineStrBuffer(),
+ reader->GetLineStrBufferLen());
+ DumperRangesHandler ranges_handler(&split_byte_reader);
+ DumperLineToModule line_to_module(&split_byte_reader);
+ DwarfCUToModule::WarningReporter reporter(split_file, cu_offset);
+ DwarfCUToModule root_handler(
+ &file_context, &line_to_module, &ranges_handler, &reporter, handle_inline,
+ reader->GetLowPC(), reader->GetAddrBase(), reader->HasSourceLineInfo(),
+ reader->GetSourceLineOffset());
+ google_breakpad::DIEDispatcher die_dispatcher(&root_handler);
+ google_breakpad::CompilationUnit split_reader(
+ split_file, file_context.section_map(), cu_offset, &split_byte_reader,
+ &die_dispatcher);
+ split_reader.SetSplitDwarf(reader->GetAddrBase(), reader->GetDWOID());
+ split_reader.Start();
+ // Normally, it won't happen unless we have transitive reference.
+ if (split_reader.ShouldProcessSplitDwarf()) {
+ StartProcessSplitDwarf(&split_reader, module, endianness,
+ handle_inter_cu_refs, handle_inline);
+ }
+}
+
void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
const mach_o::Reader& macho_reader,
const mach_o::SectionMap& dwarf_sections,
bool handle_inter_cu_refs) const {
// Build a byte reader of the appropriate endianness.
- ByteReader byte_reader(macho_reader.big_endian()
- ? ENDIANNESS_BIG
- : ENDIANNESS_LITTLE);
+ google_breakpad::Endianness endianness =
+ macho_reader.big_endian() ? ENDIANNESS_BIG : ENDIANNESS_LITTLE;
+ ByteReader byte_reader(endianness);
// Construct a context for this file.
DwarfCUToModule::FileContext file_context(selected_object_name_,
@@ -494,14 +520,14 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
// Walk the __debug_info section, one compilation unit at a time.
uint64_t debug_info_length = debug_info_section.second;
+ bool handle_inline = symbol_data_ & INLINES;
for (uint64_t offset = 0; offset < debug_info_length;) {
// Make a handler for the root DIE that populates MODULE with the
// debug info.
DwarfCUToModule::WarningReporter reporter(selected_object_name_,
offset);
DwarfCUToModule root_handler(&file_context, &line_to_module,
- &ranges_handler, &reporter,
- symbol_data_ & INLINES);
+ &ranges_handler, &reporter, handle_inline);
// Make a Dwarf2Handler that drives our DIEHandler.
DIEDispatcher die_dispatcher(&root_handler);
// Make a DWARF parser for the compilation unit at OFFSET.
@@ -512,6 +538,11 @@ void DumpSymbols::ReadDwarf(google_breakpad::Module* module,
&die_dispatcher);
// Process the entire compilation unit; get the offset of the next.
offset += dwarf_reader.Start();
+ // Start to process split dwarf file.
+ if (dwarf_reader.ShouldProcessSplitDwarf()) {
+ StartProcessSplitDwarf(&dwarf_reader, module, endianness,
+ handle_inter_cu_refs, handle_inline);
+ }
}
}
@@ -536,16 +567,14 @@ bool DumpSymbols::ReadCFI(google_breakpad::Module* module,
register_names = DwarfCFIToModule::RegisterNames::ARM64();
break;
default: {
- const NXArchInfo* arch = google_breakpad::BreakpadGetArchInfoFromCpuType(
- macho_reader.cpu_type(), macho_reader.cpu_subtype());
- fprintf(stderr, "%s: cannot convert DWARF call frame information for ",
- selected_object_name_.c_str());
- if (arch)
- fprintf(stderr, "architecture '%s'", arch->name);
- else
- fprintf(stderr, "architecture %d,%d",
- macho_reader.cpu_type(), macho_reader.cpu_subtype());
- fprintf(stderr, " to Breakpad symbol file: no register name table\n");
+ const char* arch_name = GetNameFromCPUType(macho_reader.cpu_type(),
+ macho_reader.cpu_subtype());
+ fprintf(
+ stderr,
+ "%s: cannot convert DWARF call frame information for architecture "
+ "'%s' (%d, %d) to Breakpad symbol file: no register name table\n",
+ selected_object_name_.c_str(), arch_name, macho_reader.cpu_type(),
+ macho_reader.cpu_subtype());
return false;
}
}
diff --git a/src/common/mac/dump_syms.h b/src/common/mac/dump_syms.h
index c2e1b40b..5ccf49e3 100644
--- a/src/common/mac/dump_syms.h
+++ b/src/common/mac/dump_syms.h
@@ -43,6 +43,8 @@
#include <vector>
#include "common/byte_cursor.h"
+#include "common/dwarf/dwarf2reader.h"
+#include "common/mac/arch_utilities.h"
#include "common/mac/macho_reader.h"
#include "common/mac/super_fat_arch.h"
#include "common/module.h"
@@ -55,7 +57,9 @@ class DumpSymbols {
public:
DumpSymbols(SymbolData symbol_data,
bool handle_inter_cu_refs,
- bool enable_multiple = false)
+ bool enable_multiple = false,
+ const std::string& module_name = "",
+ bool prefer_extern_name = false)
: symbol_data_(symbol_data),
handle_inter_cu_refs_(handle_inter_cu_refs),
object_filename_(),
@@ -65,12 +69,19 @@ class DumpSymbols {
object_files_(),
selected_object_file_(),
selected_object_name_(),
- enable_multiple_(enable_multiple) {}
+ enable_multiple_(enable_multiple),
+ module_name_(module_name),
+ prefer_extern_name_(prefer_extern_name) {}
~DumpSymbols() = default;
// Prepare to read debugging information from |filename|. |filename| may be
// the name of a fat file, a Mach-O file, or a dSYM bundle containing either
- // of the above. On success, return true; if there is a problem reading
+ // of the above.
+ //
+ // If |module_name_| is empty, uses the basename of |filename| as the module
+ // name. Otherwise, uses |module_name_| as the module name.
+ //
+ // On success, return true; if there is a problem reading
// |filename|, report it and return false.
bool Read(const std::string& filename);
@@ -82,26 +93,15 @@ class DumpSymbols {
// problem reading |contents|, report it and return false.
bool ReadData(uint8_t* contents, size_t size, const std::string& filename);
- // If this dumper's file includes an object file for |cpu_type| and
- // |cpu_subtype|, then select that object file for dumping, and return
- // true. Otherwise, return false, and leave this dumper's selected
- // architecture unchanged.
- //
- // By default, if this dumper's file contains only one object file, then
- // the dumper will dump those symbols; and if it contains more than one
- // object file, then the dumper will dump the object file whose
- // architecture matches that of this dumper program.
- bool SetArchitecture(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype);
-
- // If this dumper's file includes an object file for |arch_name|, then select
- // that object file for dumping, and return true. Otherwise, return false,
- // and leave this dumper's selected architecture unchanged.
+ // If this dumper's file includes an object file for `info`, then select that
+ // object file for dumping, and return true. Otherwise, return false, and
+ // leave this dumper's selected architecture unchanged.
//
// By default, if this dumper's file contains only one object file, then
// the dumper will dump those symbols; and if it contains more than one
// object file, then the dumper will dump the object file whose
// architecture matches that of this dumper program.
- bool SetArchitecture(const std::string& arch_name);
+ bool SetArchitecture(const ArchInfo& info);
// Return a pointer to an array of SuperFatArch structures describing the
// object files contained in this dumper's file. Set *|count| to the number
@@ -144,6 +144,13 @@ class DumpSymbols {
// Creates an empty module object.
bool CreateEmptyModule(scoped_ptr<Module>& module);
+ // Process the split dwarf file referenced by reader.
+ void StartProcessSplitDwarf(google_breakpad::CompilationUnit* reader,
+ Module* module,
+ google_breakpad::Endianness endianness,
+ bool handle_inter_cu_refs,
+ bool handle_inline) const;
+
// Read debugging information from |dwarf_sections|, which was taken from
// |macho_reader|, and add it to |module|.
void ReadDwarf(google_breakpad::Module* module,
@@ -204,6 +211,19 @@ class DumpSymbols {
// See: https://crbug.com/google-breakpad/751 and docs at
// docs/symbol_files.md#records-3
bool enable_multiple_;
+
+ // If non-empty, used as the module name. Otherwise, the basename of
+ // |object_filename_| is used as the module name.
+ const std::string module_name_;
+
+ // If a Function and an Extern share the same address but have a different
+ // name, prefer the name of the Extern.
+ //
+ // Use this when dumping Mach-O .dSYMs built with -gmlt (Minimum Line Tables),
+ // as the Function's fully-qualified name will only be present in the STABS
+ // (which are placed in the Extern), not in the DWARF symbols (which are
+ // placed in the Function).
+ bool prefer_extern_name_;
};
} // namespace google_breakpad
diff --git a/src/common/mac/file_id.cc b/src/common/mac/file_id.cc
index a6c1d26f..ee4a66bb 100644
--- a/src/common/mac/file_id.cc
+++ b/src/common/mac/file_id.cc
@@ -32,6 +32,10 @@
//
// Author: Dan Waylonis
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/mac/file_id.h"
#include <fcntl.h>
diff --git a/src/common/mac/launch_reporter.cc b/src/common/mac/launch_reporter.cc
index de554ee3..f6b8aed1 100644
--- a/src/common/mac/launch_reporter.cc
+++ b/src/common/mac/launch_reporter.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/src/common/mac/macho_id.cc b/src/common/mac/macho_id.cc
index e67ccddb..bb0058ce 100644
--- a/src/common/mac/macho_id.cc
+++ b/src/common/mac/macho_id.cc
@@ -33,6 +33,10 @@
// Author: Dan Waylonis
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <mach-o/loader.h>
#include <stdio.h>
diff --git a/src/common/mac/macho_reader.cc b/src/common/mac/macho_reader.cc
index 23c809c4..0324be14 100644
--- a/src/common/mac/macho_reader.cc
+++ b/src/common/mac/macho_reader.cc
@@ -31,6 +31,10 @@
// macho_reader.cc: Implementation of google_breakpad::Mach_O::FatReader and
// google_breakpad::Mach_O::Reader. See macho_reader.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/mac/macho_reader.h"
#include <assert.h>
diff --git a/src/common/mac/macho_reader_unittest.cc b/src/common/mac/macho_reader_unittest.cc
index 3beec341..4b5ac6ca 100644
--- a/src/common/mac/macho_reader_unittest.cc
+++ b/src/common/mac/macho_reader_unittest.cc
@@ -31,6 +31,10 @@
// macho_reader_unittest.cc: Unit tests for google_breakpad::Mach_O::FatReader
// and google_breakpad::Mach_O::Reader.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <map>
#include <string>
#include <vector>
diff --git a/src/common/mac/macho_utilities.cc b/src/common/mac/macho_utilities.cc
index 16e430df..113e8d3f 100644
--- a/src/common/mac/macho_utilities.cc
+++ b/src/common/mac/macho_utilities.cc
@@ -30,6 +30,10 @@
//
// Author: Dave Camp
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/mac/byteswap.h"
#include "common/mac/macho_utilities.h"
diff --git a/src/common/mac/macho_walker.cc b/src/common/mac/macho_walker.cc
index 505a4df1..4b9f56c2 100644
--- a/src/common/mac/macho_walker.cc
+++ b/src/common/mac/macho_walker.cc
@@ -32,17 +32,21 @@
//
// Author: Dan Waylonis
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <fcntl.h>
-#include <mach-o/arch.h>
#include <mach-o/fat.h>
#include <mach-o/loader.h>
#include <string.h>
#include <unistd.h>
+#include "common/mac/arch_utilities.h"
#include "common/mac/byteswap.h"
-#include "common/mac/macho_walker.h"
#include "common/mac/macho_utilities.h"
+#include "common/mac/macho_walker.h"
namespace MacFileUtilities {
@@ -81,9 +85,8 @@ bool MachoWalker::WalkHeader(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {
cpu_subtype_t valid_cpu_subtype = cpu_subtype;
// if |cpu_type| is 0, use the native cpu type.
if (cpu_type == 0) {
- const NXArchInfo* arch = NXGetLocalArchInfo();
- assert(arch);
- valid_cpu_type = arch->cputype;
+ ArchInfo arch = GetLocalArchInfo();
+ valid_cpu_type = arch.cputype;
valid_cpu_subtype = CPU_SUBTYPE_MULTIPLE;
}
off_t offset;
diff --git a/src/common/mac/string_utilities.cc b/src/common/mac/string_utilities.cc
index 861029d4..3b83351f 100644
--- a/src/common/mac/string_utilities.cc
+++ b/src/common/mac/string_utilities.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/scoped_ptr.h"
#include "common/mac/string_utilities.h"
diff --git a/src/common/md5.cc b/src/common/md5.cc
index b6e710da..86298f4d 100644
--- a/src/common/md5.cc
+++ b/src/common/md5.cc
@@ -13,6 +13,10 @@
* will fill a supplied 16-byte array with the digest.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include "common/md5.h"
diff --git a/src/common/memory_allocator_unittest.cc b/src/common/memory_allocator_unittest.cc
index 6ca625bb..8ef68913 100644
--- a/src/common/memory_allocator_unittest.cc
+++ b/src/common/memory_allocator_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/memory_allocator.h"
diff --git a/src/common/memory_range_unittest.cc b/src/common/memory_range_unittest.cc
index f112e761..f081d679 100644
--- a/src/common/memory_range_unittest.cc
+++ b/src/common/memory_range_unittest.cc
@@ -28,6 +28,10 @@
// memory_range_unittest.cc: Unit tests for google_breakpad::MemoryRange.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/memory_range.h"
diff --git a/src/common/module.cc b/src/common/module.cc
index 75782ab1..0eb5aad8 100644
--- a/src/common/module.cc
+++ b/src/common/module.cc
@@ -30,6 +30,10 @@
// module.cc: Implement google_breakpad::Module. See module.h.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/module.h"
#include "common/string_view.h"
@@ -101,14 +105,16 @@ Module::Module(const string& name,
const string& architecture,
const string& id,
const string& code_id /* = "" */,
- bool enable_multiple_field /* = false*/)
+ bool enable_multiple_field /* = false*/,
+ bool prefer_extern_name /* = false*/)
: name_(name),
os_(os),
architecture_(architecture),
id_(id),
code_id_(code_id),
load_address_(0),
- enable_multiple_field_(enable_multiple_field) {}
+ enable_multiple_field_(enable_multiple_field),
+ prefer_extern_name_(prefer_extern_name) {}
Module::~Module() {
for (FileByNameMap::iterator it = files_.begin(); it != files_.end(); ++it)
@@ -148,11 +154,28 @@ bool Module::AddFunction(Function* function) {
it_ext = externs_.find(&arm_thumb_ext);
}
if (it_ext != externs_.end()) {
+ Extern* found_ext = it_ext->get();
+ bool name_mismatch = found_ext->name != function->name;
if (enable_multiple_field_) {
- Extern* found_ext = it_ext->get();
+ bool is_multiple_based_on_name;
+ // In the case of a .dSYM built with -gmlt, the external name will be the
+ // fully-qualified symbol name, but the function name will be the partial
+ // name (or omitted).
+ //
+ // Don't mark multiple in this case.
+ if (name_mismatch &&
+ (function->name == "<name omitted>" ||
+ found_ext->name.find(function->name.str()) != string::npos)) {
+ is_multiple_based_on_name = false;
+ } else {
+ is_multiple_based_on_name = name_mismatch;
+ }
// If the PUBLIC is for the same symbol as the FUNC, don't mark multiple.
function->is_multiple |=
- found_ext->name != function->name || found_ext->is_multiple;
+ is_multiple_based_on_name || found_ext->is_multiple;
+ }
+ if (name_mismatch && prefer_extern_name_) {
+ function->name = AddStringToPool(it_ext->get()->name);
}
externs_.erase(it_ext);
}
@@ -266,8 +289,7 @@ void Module::GetStackFrameEntries(vector<StackFrameEntry*>* vec) const {
}
}
-void Module::AssignSourceIds(
- set<InlineOrigin*, InlineOriginCompare>& inline_origins) {
+void Module::AssignSourceIds() {
// First, give every source file an id of -1.
for (FileByNameMap::iterator file_it = files_.begin();
file_it != files_.end(); ++file_it) {
@@ -371,7 +393,7 @@ bool Module::Write(std::ostream& stream, SymbolData symbol_data) {
// Get all referenced inline origins.
set<InlineOrigin*, InlineOriginCompare> inline_origins;
CreateInlineOrigins(inline_origins);
- AssignSourceIds(inline_origins);
+ AssignSourceIds();
// Write out files.
for (FileByNameMap::iterator file_it = files_.begin();
diff --git a/src/common/module.h b/src/common/module.h
index c1fd9f59..28e8e9c5 100644
--- a/src/common/module.h
+++ b/src/common/module.h
@@ -131,6 +131,10 @@ class Module {
// If this symbol has been folded with other symbols in the linked binary.
bool is_multiple = false;
+
+ // If the function's name should be filled out from a matching Extern,
+ // should they not match.
+ bool prefer_extern_name = false;
};
struct InlineOrigin {
@@ -142,10 +146,6 @@ class Module {
// The inlined function's name.
StringView name;
-
- File* file;
-
- int getFileID() const { return file ? file->source_id : -1; }
};
// A inlined call site.
@@ -224,7 +224,7 @@ class Module {
map<uint64_t, uint64_t> references_;
};
- InlineOriginMap inline_origin_map;
+ map<std::string, InlineOriginMap> inline_origin_maps;
// A source line.
struct Line {
@@ -317,7 +317,8 @@ class Module {
const string& architecture,
const string& id,
const string& code_id = "",
- bool enable_multiple_field = false);
+ bool enable_multiple_field = false,
+ bool prefer_extern_name = false);
~Module();
// Set the module's load address to LOAD_ADDRESS; addresses given
@@ -402,7 +403,7 @@ class Module {
// Set the source id numbers for all other files --- unused by the
// source line data --- to -1. We do this before writing out the
// symbol file, at which point we omit any unused files.
- void AssignSourceIds(set<InlineOrigin*, InlineOriginCompare>& inline_origins);
+ void AssignSourceIds();
// This function should be called before AssignSourceIds() to get the set of
// valid InlineOrigins*.
@@ -502,6 +503,15 @@ class Module {
// at
// https://chromium.googlesource.com/breakpad/breakpad/+/master/docs/symbol_files.md#records-3
bool enable_multiple_field_;
+
+ // If a Function and an Extern share the same address but have a different
+ // name, prefer the name of the Extern.
+ //
+ // Use this when dumping Mach-O .dSYMs built with -gmlt (Minimum Line Tables),
+ // as the Function's fully-qualified name will only be present in the STABS
+ // (which are placed in the Extern), not in the DWARF symbols (which are
+ // placed in the Function).
+ bool prefer_extern_name_;
};
} // namespace google_breakpad
diff --git a/src/common/module_unittest.cc b/src/common/module_unittest.cc
index 39727554..c51162e5 100644
--- a/src/common/module_unittest.cc
+++ b/src/common/module_unittest.cc
@@ -30,6 +30,10 @@
// module_unittest.cc: Unit tests for google_breakpad::Module.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -194,9 +198,7 @@ TEST(Module, WriteOmitUnusedFiles) {
function->lines.push_back(line1);
function->lines.push_back(line2);
m.AddFunction(function);
-
- std::set<Module::InlineOrigin*, Module::InlineOriginCompare> inline_origins;
- m.AssignSourceIds(inline_origins);
+ m.AssignSourceIds();
vector<Module::File*> vec;
m.GetFiles(&vec);
@@ -637,6 +639,37 @@ TEST(Module, ConstructFunctionsAndExternsWithSameAddress) {
}
// If there exists an extern and a function at the same address, only write
+// out the FUNC entry.
+TEST(Module, ConstructFunctionsAndExternsWithSameAddressPreferExternName) {
+ stringstream s;
+ Module m(MODULE_NAME, MODULE_OS, MODULE_ARCH, MODULE_ID, "", false, true);
+
+ // Two externs.
+ auto extern1 = std::make_unique<Module::Extern>(0xabc0);
+ extern1->name = "extern1";
+ auto extern2 = std::make_unique<Module::Extern>(0xfff0);
+ extern2->name = "extern2";
+
+ m.AddExtern(std::move(extern1));
+ m.AddExtern(std::move(extern2));
+
+ Module::Function* function = new Module::Function("function2", 0xfff0);
+ Module::Range range(0xfff0, 0x10);
+ function->ranges.push_back(range);
+ function->parameter_size = 0;
+ m.AddFunction(function);
+
+ m.Write(s, ALL_SYMBOL_DATA);
+ string contents = s.str();
+
+ EXPECT_STREQ("MODULE " MODULE_OS " " MODULE_ARCH " " MODULE_ID " " MODULE_NAME
+ "\n"
+ "FUNC fff0 10 0 extern2\n"
+ "PUBLIC abc0 0 extern1\n",
+ contents.c_str());
+}
+
+// If there exists an extern and a function at the same address, only write
// out the FUNC entry, and mark it with `m` if the multiple field is enabled.
TEST(Module, ConstructFunctionsAndExternsWithSameAddressMultiple) {
stringstream s;
diff --git a/src/common/path_helper.cc b/src/common/path_helper.cc
index e51a1b68..fbbcfca3 100644
--- a/src/common/path_helper.cc
+++ b/src/common/path_helper.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/path_helper.h"
#include <assert.h>
diff --git a/src/common/safe_math_unittest.cc b/src/common/safe_math_unittest.cc
index 1908155d..453afbe0 100644
--- a/src/common/safe_math_unittest.cc
+++ b/src/common/safe_math_unittest.cc
@@ -28,6 +28,10 @@
// safe_math_unittest.cc: Unit tests for SafeMath
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "safe_math.h"
#include "breakpad_googletest_includes.h"
diff --git a/src/common/simple_string_dictionary.cc b/src/common/simple_string_dictionary.cc
index 68288897..d3e09b8f 100644
--- a/src/common/simple_string_dictionary.cc
+++ b/src/common/simple_string_dictionary.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/simple_string_dictionary.h"
namespace google_breakpad {
diff --git a/src/common/simple_string_dictionary.h b/src/common/simple_string_dictionary.h
index f7253a34..166d56c8 100644
--- a/src/common/simple_string_dictionary.h
+++ b/src/common/simple_string_dictionary.h
@@ -32,8 +32,6 @@
#include <assert.h>
#include <string.h>
-#include "common/basictypes.h"
-
namespace google_breakpad {
// Opaque type for the serialized representation of a NonAllocatingMap. One is
@@ -80,6 +78,8 @@ class NonAllocatingMap {
: map_(map),
current_(0) {
}
+ Iterator(const Iterator&) = delete;
+ void operator=(const Iterator&) = delete;
// Returns the next entry in the map, or NULL if at the end of the
// collection.
@@ -90,14 +90,12 @@ class NonAllocatingMap {
return entry;
}
}
- return NULL;
+ return nullptr;
}
private:
const NonAllocatingMap& map_;
size_t current_;
-
- DISALLOW_COPY_AND_ASSIGN(Iterator);
};
NonAllocatingMap() : entries_() {
diff --git a/src/common/simple_string_dictionary_unittest.cc b/src/common/simple_string_dictionary_unittest.cc
index 4f3f1f5c..b4dd7fe9 100644
--- a/src/common/simple_string_dictionary_unittest.cc
+++ b/src/common/simple_string_dictionary_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/simple_string_dictionary.h"
diff --git a/src/common/solaris/dump_symbols.cc b/src/common/solaris/dump_symbols.cc
index 8277fd66..09e5b376 100644
--- a/src/common/solaris/dump_symbols.cc
+++ b/src/common/solaris/dump_symbols.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <demangle.h>
#include <fcntl.h>
#include <gelf.h>
diff --git a/src/common/solaris/file_id.cc b/src/common/solaris/file_id.cc
index 53d205b6..5a9982bb 100644
--- a/src/common/solaris/file_id.cc
+++ b/src/common/solaris/file_id.cc
@@ -32,6 +32,10 @@
//
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <elf.h>
#include <fcntl.h>
#include <gelf.h>
diff --git a/src/common/solaris/guid_creator.cc b/src/common/solaris/guid_creator.cc
index 4802f5a7..998d2499 100644
--- a/src/common/solaris/guid_creator.cc
+++ b/src/common/solaris/guid_creator.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <cassert>
#include <ctime>
diff --git a/src/common/stabs_reader.cc b/src/common/stabs_reader.cc
index 30118830..e18780c9 100644
--- a/src/common/stabs_reader.cc
+++ b/src/common/stabs_reader.cc
@@ -31,6 +31,10 @@
// This file implements the google_breakpad::StabsReader class.
// See stabs_reader.h.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/stabs_reader.h"
#include <assert.h>
diff --git a/src/common/stabs_reader.h b/src/common/stabs_reader.h
index 3f5f0a8f..655683f1 100644
--- a/src/common/stabs_reader.h
+++ b/src/common/stabs_reader.h
@@ -49,10 +49,6 @@
#include <stddef.h>
#include <stdint.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifdef HAVE_MACH_O_NLIST_H
#include <mach-o/nlist.h>
#elif defined(HAVE_A_OUT_H)
diff --git a/src/common/stabs_reader_unittest.cc b/src/common/stabs_reader_unittest.cc
index 79888815..294e8836 100644
--- a/src/common/stabs_reader_unittest.cc
+++ b/src/common/stabs_reader_unittest.cc
@@ -30,6 +30,10 @@
// stabs_reader_unittest.cc: Unit tests for google_breakpad::StabsReader.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <errno.h>
#include <stab.h>
diff --git a/src/common/stabs_to_module.cc b/src/common/stabs_to_module.cc
index 3d026c22..f04c987a 100644
--- a/src/common/stabs_to_module.cc
+++ b/src/common/stabs_to_module.cc
@@ -30,6 +30,10 @@
// dump_stabs.cc --- implement the StabsToModule class.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <cxxabi.h>
#include <stdarg.h>
diff --git a/src/common/stabs_to_module_unittest.cc b/src/common/stabs_to_module_unittest.cc
index 95bdb261..c6d40281 100644
--- a/src/common/stabs_to_module_unittest.cc
+++ b/src/common/stabs_to_module_unittest.cc
@@ -30,6 +30,10 @@
// dump_stabs_unittest.cc: Unit tests for StabsToModule.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <vector>
#include "breakpad_googletest_includes.h"
diff --git a/src/common/string_conversion.cc b/src/common/string_conversion.cc
index 213d6ed7..a4e64ff0 100644
--- a/src/common/string_conversion.cc
+++ b/src/common/string_conversion.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include "common/convert_UTF.h"
diff --git a/src/common/string_conversion_unittest.cc b/src/common/string_conversion_unittest.cc
index 2e64a957..0f372c80 100644
--- a/src/common/string_conversion_unittest.cc
+++ b/src/common/string_conversion_unittest.cc
@@ -28,6 +28,10 @@
// string_conversion_unittest.cc: Unit tests for google_breakpad::UTF* helpers.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include <vector>
diff --git a/src/common/test_assembler.cc b/src/common/test_assembler.cc
index 91899663..6b1c1fd3 100644
--- a/src/common/test_assembler.cc
+++ b/src/common/test_assembler.cc
@@ -31,6 +31,10 @@
// test_assembler.cc: Implementation of google_breakpad::TestAssembler.
// See test_assembler.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/test_assembler.h"
#include <assert.h>
diff --git a/src/common/test_assembler_unittest.cc b/src/common/test_assembler_unittest.cc
index f16594f1..0307fdbf 100644
--- a/src/common/test_assembler_unittest.cc
+++ b/src/common/test_assembler_unittest.cc
@@ -30,6 +30,10 @@
// test_assembler_unittest.cc: Unit tests for google_breakpad::TestAssembler.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include <string.h>
diff --git a/src/common/tests/file_utils.cc b/src/common/tests/file_utils.cc
index 814b2094..84a22809 100644
--- a/src/common/tests/file_utils.cc
+++ b/src/common/tests/file_utils.cc
@@ -29,6 +29,10 @@
// file_utils.cc: Implement utility functions for file manipulation.
// See file_utils.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/common/windows/dia_util.cc b/src/common/windows/dia_util.cc
index dcfe0ef9..a5d984d1 100644
--- a/src/common/windows/dia_util.cc
+++ b/src/common/windows/dia_util.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/windows/dia_util.h"
#include <atlbase.h>
diff --git a/src/common/windows/guid_string.cc b/src/common/windows/guid_string.cc
index be9eb8a3..2c298c33 100644
--- a/src/common/windows/guid_string.cc
+++ b/src/common/windows/guid_string.cc
@@ -30,6 +30,10 @@
//
// See guid_string.h for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <wchar.h>
#include "common/windows/string_utils-inl.h"
diff --git a/src/common/windows/http_upload.cc b/src/common/windows/http_upload.cc
index 088a5e54..bd48a233 100644
--- a/src/common/windows/http_upload.cc
+++ b/src/common/windows/http_upload.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
// Disable exception handler warnings.
diff --git a/src/common/windows/omap.cc b/src/common/windows/omap.cc
index ad916997..1ffcec76 100644
--- a/src/common/windows/omap.cc
+++ b/src/common/windows/omap.cc
@@ -100,6 +100,10 @@
// position) so that resolution will work as expected for translated addresses.
// This is transparent to the rest of the toolchain.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/windows/omap.h"
#include <atlbase.h>
diff --git a/src/common/windows/omap_unittest.cc b/src/common/windows/omap_unittest.cc
index 841e5391..ebe0d47e 100644
--- a/src/common/windows/omap_unittest.cc
+++ b/src/common/windows/omap_unittest.cc
@@ -28,6 +28,10 @@
// Unittests for OMAP related functions.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/windows/omap.h"
#include "breakpad_googletest_includes.h"
diff --git a/src/common/windows/pdb_source_line_writer.cc b/src/common/windows/pdb_source_line_writer.cc
index 800c316f..dd80a6d2 100644
--- a/src/common/windows/pdb_source_line_writer.cc
+++ b/src/common/windows/pdb_source_line_writer.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/windows/pdb_source_line_writer.h"
#include <windows.h>
diff --git a/src/common/windows/pe_source_line_writer.cc b/src/common/windows/pe_source_line_writer.cc
index a568e0c7..d1d25cf4 100644
--- a/src/common/windows/pe_source_line_writer.cc
+++ b/src/common/windows/pe_source_line_writer.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/windows/pe_source_line_writer.h"
#include "common/windows/pe_util.h"
diff --git a/src/common/windows/pe_source_line_writer.h b/src/common/windows/pe_source_line_writer.h
index a3748145..324663ba 100644
--- a/src/common/windows/pe_source_line_writer.h
+++ b/src/common/windows/pe_source_line_writer.h
@@ -31,7 +31,6 @@
#include <string>
-#include "common/basictypes.h"
#include "common/windows/module_info.h"
namespace google_breakpad {
@@ -44,6 +43,8 @@ using std::wstring;
class PESourceLineWriter {
public:
explicit PESourceLineWriter(const wstring& pe_file);
+ PESourceLineWriter(const PESourceLineWriter&) = delete;
+ void operator=(const PESourceLineWriter&) = delete;
~PESourceLineWriter();
// Writes Breakpad symbols from the pe file to |symbol_file|.
@@ -58,9 +59,7 @@ public:
bool GetPEInfo(PEModuleInfo* info);
private:
- const wstring pe_file_;
-
- DISALLOW_COPY_AND_ASSIGN(PESourceLineWriter);
+ const wstring pe_file_;
};
} // namespace google_breakpad
diff --git a/src/common/windows/pe_util.cc b/src/common/windows/pe_util.cc
index 1df93105..2d4aebe7 100644
--- a/src/common/windows/pe_util.cc
+++ b/src/common/windows/pe_util.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "pe_util.h"
#include <windows.h>
diff --git a/src/common/windows/string_utils.cc b/src/common/windows/string_utils.cc
index 01dca193..1e570b52 100644
--- a/src/common/windows/string_utils.cc
+++ b/src/common/windows/string_utils.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <cassert>
#include <vector>
diff --git a/src/common/windows/sym_upload_v2_protocol.cc b/src/common/windows/sym_upload_v2_protocol.cc
index f2dc660c..450f3626 100644
--- a/src/common/windows/sym_upload_v2_protocol.cc
+++ b/src/common/windows/sym_upload_v2_protocol.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/windows/sym_upload_v2_protocol.h"
#include <cstdio>
diff --git a/src/common/windows/symbol_collector_client.cc b/src/common/windows/symbol_collector_client.cc
index 187b100e..d91b702b 100644
--- a/src/common/windows/symbol_collector_client.cc
+++ b/src/common/windows/symbol_collector_client.cc
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/windows/symbol_collector_client.h"
#include <stdio.h>
diff --git a/src/config.h.in b/src/config.h.in
index 8fd7b0aa..9a4eb0de 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -21,6 +21,9 @@
/* Define to 1 if you have the `rustc_demangle' library (-lrustc_demangle). */
#undef HAVE_LIBRUSTC_DEMANGLE
+/* Define to 1 if you have the `zstd' library (-lzstd). */
+#undef HAVE_LIBZSTD
+
/* Define to 1 if you have the `memfd_create' function. */
#undef HAVE_MEMFD_CREATE
diff --git a/src/google_breakpad/common/minidump_cpu_amd64.h b/src/google_breakpad/common/minidump_cpu_amd64.h
index 308f21ec..be209801 100644
--- a/src/google_breakpad/common/minidump_cpu_amd64.h
+++ b/src/google_breakpad/common/minidump_cpu_amd64.h
@@ -227,7 +227,7 @@ typedef struct {
#define MD_CONTEXT_AMD64_ALL (MD_CONTEXT_AMD64_FULL | \
MD_CONTEXT_AMD64_SEGMENTS | \
- MD_CONTEXT_X86_DEBUG_REGISTERS)
+ MD_CONTEXT_AMD64_DEBUG_REGISTERS)
/* CONTEXT_ALL */
diff --git a/src/google_breakpad/common/minidump_cpu_riscv.h b/src/google_breakpad/common/minidump_cpu_riscv.h
index 94d06117..812cf5fd 100644
--- a/src/google_breakpad/common/minidump_cpu_riscv.h
+++ b/src/google_breakpad/common/minidump_cpu_riscv.h
@@ -39,28 +39,8 @@
#include "google_breakpad/common/breakpad_types.h"
-#define MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT 32
-#if defined(__riscv)
-# if __riscv_flen == 32
-typedef uint32_t riscv_fpr_size;
-# elif __riscv_flen == 64
-typedef uint64_t riscv_fpr_size;
-# elif __riscv_flen == 128
-typedef uint128_struct riscv_fpr_size;
-# else
-# error "Unexpected __riscv_flen"
-# endif
-#else
-typedef uint32_t riscv_fpr_size;
-#endif
-
#define MD_CONTEXT_RISCV_GPR_COUNT 32
-
-typedef struct {
- /* 32 floating point registers, f0 .. f31. */
- riscv_fpr_size regs[MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT];
- uint32_t fpcsr;
-} MDFloatingSaveAreaRISCV;
+#define MD_CONTEXT_RISCV_FPR_COUNT 32
enum MDRISCVRegisterNumbers {
MD_CONTEXT_RISCV_REG_PC = 0,
@@ -72,13 +52,14 @@ enum MDRISCVRegisterNumbers {
* context stored in the structure. */
#define MD_CONTEXT_RISCV 0x00800000
#define MD_CONTEXT_RISCV_INTEGER (MD_CONTEXT_RISCV | 0x00000001)
-#define MD_CONTEXT_RISCV_FLOATING_POINT (MD_CONTEXT_RISCV | 0x00000004)
+#define MD_CONTEXT_RISCV_FLOATING_POINT (MD_CONTEXT_RISCV | 0x00000002)
#define MD_CONTEXT_RISCV_FULL (MD_CONTEXT_RISCV_INTEGER | \
MD_CONTEXT_RISCV_FLOATING_POINT)
typedef struct {
/* Determines which fields of this struct are populated */
uint32_t context_flags;
+ uint32_t version;
uint32_t pc;
uint32_t ra;
@@ -113,20 +94,24 @@ typedef struct {
uint32_t t5;
uint32_t t6;
- MDFloatingSaveAreaRISCV float_save;
+ /* 32 floating point registers, f0 .. f31. Breakpad only supports RISCV32
+ * with 32 bit floating point. */
+ uint32_t fpregs[MD_CONTEXT_RISCV_FPR_COUNT];
+ uint32_t fcsr;
} MDRawContextRISCV;
/* For (MDRawContextRISCV64).context_flags. These values indicate the type of
* context stored in the structure. */
#define MD_CONTEXT_RISCV64 0x08000000
#define MD_CONTEXT_RISCV64_INTEGER (MD_CONTEXT_RISCV64 | 0x00000001)
-#define MD_CONTEXT_RISCV64_FLOATING_POINT (MD_CONTEXT_RISCV64 | 0x00000004)
+#define MD_CONTEXT_RISCV64_FLOATING_POINT (MD_CONTEXT_RISCV64 | 0x00000002)
#define MD_CONTEXT_RISCV64_FULL (MD_CONTEXT_RISCV64_INTEGER | \
MD_CONTEXT_RISCV64_FLOATING_POINT)
typedef struct {
/* Determines which fields of this struct are populated */
uint32_t context_flags;
+ uint32_t version;
uint64_t pc;
uint64_t ra;
@@ -161,7 +146,10 @@ typedef struct {
uint64_t t5;
uint64_t t6;
- MDFloatingSaveAreaRISCV float_save;
+ /* 32 floating point registers, f0 .. f31. Breakpad only supports RISCV64 with
+ * 64 bit floating point. */
+ uint64_t fpregs[MD_CONTEXT_RISCV_FPR_COUNT];
+ uint32_t fcsr;
} MDRawContextRISCV64;
diff --git a/src/google_breakpad/common/minidump_exception_linux.h b/src/google_breakpad/common/minidump_exception_linux.h
index 354cdd6b..2135244f 100644
--- a/src/google_breakpad/common/minidump_exception_linux.h
+++ b/src/google_breakpad/common/minidump_exception_linux.h
@@ -112,6 +112,11 @@ typedef enum {
MD_EXCEPTION_FLAG_LIN_SEGV_ACCERR = 2,
MD_EXCEPTION_FLAG_LIN_SEGV_BNDERR = 3,
MD_EXCEPTION_FLAG_LIN_SEGV_PKUERR = 4,
+ MD_EXCEPTION_FLAG_LIN_SEGV_ACCADI = 5,
+ MD_EXCEPTION_FLAG_LIN_SEGV_ADIDERR = 6,
+ MD_EXCEPTION_FLAG_LIN_SEGV_ADIPERR = 7,
+ MD_EXCEPTION_FLAG_LIN_SEGV_MTEAERR = 8,
+ MD_EXCEPTION_FLAG_LIN_SEGV_MTESERR = 9,
/* SIGBUS */
MD_EXCEPTION_FLAG_LIN_BUS_ADRALN = 1,
diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h
index 1526afce..959d15ba 100644
--- a/src/google_breakpad/common/minidump_format.h
+++ b/src/google_breakpad/common/minidump_format.h
@@ -1105,7 +1105,7 @@ typedef struct {
typedef struct {
uint32_t count;
- MDLocationDescriptor objects[0]; /* MDRawCrashpadAnnotation */
+ MDRawCrashpadAnnotation objects[0];
} MDRawCrashpadAnnotationList;
typedef struct {
@@ -1122,7 +1122,7 @@ typedef struct {
typedef struct {
uint32_t count;
- MDLocationDescriptor modules[0]; /* MDRawModuleCrashpadInfoLink */
+ MDRawModuleCrashpadInfoLink modules[0];
} MDRawModuleCrashpadInfoList;
typedef struct {
diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h
index 934a0e3e..e523ab36 100644
--- a/src/google_breakpad/processor/minidump.h
+++ b/src/google_breakpad/processor/minidump.h
@@ -89,7 +89,6 @@
#include <string>
#include <vector>
-#include "common/basictypes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/code_modules.h"
@@ -114,7 +113,7 @@ template<typename AddressType, typename EntryType> class RangeMap;
// itself.
class MinidumpObject : public DumpObject {
public:
- virtual ~MinidumpObject() {}
+ virtual ~MinidumpObject() = default;
protected:
explicit MinidumpObject(Minidump* minidump);
@@ -136,7 +135,9 @@ class MinidumpObject : public DumpObject {
// same interface, and may be derived from this class.
class MinidumpStream : public MinidumpObject {
public:
- virtual ~MinidumpStream() {}
+ MinidumpStream(const MinidumpStream&) = delete;
+ void operator=(const MinidumpStream&) = delete;
+ ~MinidumpStream() override = default;
protected:
explicit MinidumpStream(Minidump* minidump);
@@ -150,8 +151,6 @@ class MinidumpStream : public MinidumpObject {
// that implements MinidumpStream can compare expected_size to a
// known size as an integrity check.
virtual bool Read(uint32_t expected_size) = 0;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpStream);
};
@@ -167,7 +166,9 @@ class MinidumpStream : public MinidumpObject {
// user wants).
class MinidumpContext : public DumpContext {
public:
- virtual ~MinidumpContext();
+ MinidumpContext(const MinidumpContext&) = delete;
+ void operator=(const MinidumpContext&) = delete;
+ ~MinidumpContext() override;
protected:
explicit MinidumpContext(Minidump* minidump);
@@ -192,8 +193,6 @@ class MinidumpContext : public DumpContext {
// for access to data about the minidump file itself, such as whether
// it should be byte-swapped.
Minidump* minidump_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpContext);
};
@@ -208,7 +207,7 @@ class MinidumpContext : public DumpContext {
class MinidumpMemoryRegion : public MinidumpObject,
public MemoryRegion {
public:
- virtual ~MinidumpMemoryRegion();
+ ~MinidumpMemoryRegion() override;
static void set_max_bytes(uint32_t max_bytes) { max_bytes_ = max_bytes; }
static uint32_t max_bytes() { return max_bytes_; }
@@ -219,22 +218,22 @@ class MinidumpMemoryRegion : public MinidumpObject,
const uint8_t* GetMemory() const;
// The address of the base of the memory region.
- uint64_t GetBase() const;
+ uint64_t GetBase() const override;
// The size, in bytes, of the memory region.
- uint32_t GetSize() const;
+ uint32_t GetSize() const override;
// Frees the cached memory region, if cached.
void FreeMemory();
// Obtains the value of memory at the pointer specified by address.
- bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const;
- bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const;
- bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const;
- bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const;
+ bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const override;
+ bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const override;
+ bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const override;
+ bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const override;
// Print a human-readable representation of the object to stdout.
- void Print() const;
+ void Print() const override;
void SetPrintMode(bool hexdump, unsigned int width);
protected:
@@ -277,9 +276,9 @@ class MinidumpMemoryRegion : public MinidumpObject,
// contain a memory region or context.
class MinidumpThread : public MinidumpObject {
public:
- virtual ~MinidumpThread();
+ ~MinidumpThread() override;
- const MDRawThread* thread() const { return valid_ ? &thread_ : NULL; }
+ const MDRawThread* thread() const { return valid_ ? &thread_ : nullptr; }
// GetMemory may return NULL even if the MinidumpThread is valid,
// if the thread memory cannot be read.
virtual MinidumpMemoryRegion* GetMemory();
@@ -322,7 +321,9 @@ class MinidumpThread : public MinidumpObject {
// a process.
class MinidumpThreadList : public MinidumpStream {
public:
- virtual ~MinidumpThreadList();
+ MinidumpThreadList(const MinidumpThreadList&) = delete;
+ void operator=(const MinidumpThreadList&) = delete;
+ ~MinidumpThreadList() override;
static void set_max_threads(uint32_t max_threads) {
max_threads_ = max_threads;
@@ -364,18 +365,16 @@ class MinidumpThreadList : public MinidumpStream {
// The list of threads.
MinidumpThreads* threads_;
- uint32_t thread_count_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpThreadList);
+ uint32_t thread_count_;
};
// MinidumpThreadName contains the name of a thread.
class MinidumpThreadName : public MinidumpObject {
public:
- virtual ~MinidumpThreadName();
+ ~MinidumpThreadName() override;
const MDRawThreadName* thread_name() const {
- return valid_ ? &thread_name_ : NULL;
+ return valid_ ? &thread_name_ : nullptr;
}
// Gets the thread ID.
@@ -419,7 +418,9 @@ class MinidumpThreadName : public MinidumpObject {
// MinidumpThreadNames) in a process.
class MinidumpThreadNameList : public MinidumpStream {
public:
- virtual ~MinidumpThreadNameList();
+ MinidumpThreadNameList(const MinidumpThreadNameList&) = delete;
+ void operator=(const MinidumpThreadNameList&) = delete;
+ ~MinidumpThreadNameList() override;
virtual unsigned int thread_name_count() const {
return valid_ ? thread_name_count_ : 0;
@@ -446,8 +447,6 @@ class MinidumpThreadNameList : public MinidumpStream {
// The list of thread names.
MinidumpThreadNames* thread_names_;
uint32_t thread_name_count_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpThreadNameList);
};
// MinidumpModule wraps MDRawModule, which contains information about loaded
@@ -457,7 +456,7 @@ class MinidumpThreadNameList : public MinidumpStream {
class MinidumpModule : public MinidumpObject,
public CodeModule {
public:
- virtual ~MinidumpModule();
+ ~MinidumpModule() override;
static void set_max_cv_bytes(uint32_t max_cv_bytes) {
max_cv_bytes_ = max_cv_bytes;
@@ -469,27 +468,27 @@ class MinidumpModule : public MinidumpObject,
}
static uint32_t max_misc_bytes() { return max_misc_bytes_; }
- const MDRawModule* module() const { return valid_ ? &module_ : NULL; }
+ const MDRawModule* module() const { return valid_ ? &module_ : nullptr; }
// CodeModule implementation
- virtual uint64_t base_address() const {
+ uint64_t base_address() const override {
return valid_ ? module_.base_of_image : static_cast<uint64_t>(-1);
}
- virtual uint64_t size() const { return valid_ ? module_.size_of_image : 0; }
- virtual string code_file() const;
- virtual string code_identifier() const;
- virtual string debug_file() const;
- virtual string debug_identifier() const;
- virtual string version() const;
- virtual CodeModule* Copy() const;
- virtual bool is_unloaded() const { return false; }
+ uint64_t size() const override { return valid_ ? module_.size_of_image : 0; }
+ string code_file() const override;
+ string code_identifier() const override;
+ string debug_file() const override;
+ string debug_identifier() const override;
+ string version() const override;
+ CodeModule* Copy() const override;
+ bool is_unloaded() const override { return false; }
// Getter and setter for shrink_down_delta. This is used when the address
// range for a module is shrunk down due to address range conflicts with
// other modules. The base_address and size fields are not updated and they
// should always reflect the original values (reported in the minidump).
- virtual uint64_t shrink_down_delta() const;
- virtual void SetShrinkDownDelta(uint64_t shrink_down_delta);
+ uint64_t shrink_down_delta() const override;
+ void SetShrinkDownDelta(uint64_t shrink_down_delta) override;
// The CodeView record, which contains information to locate the module's
// debugging information (pdb). This is returned as uint8_t* because
@@ -580,7 +579,9 @@ class MinidumpModule : public MinidumpObject,
class MinidumpModuleList : public MinidumpStream,
public CodeModules {
public:
- virtual ~MinidumpModuleList();
+ MinidumpModuleList(const MinidumpModuleList&) = delete;
+ void operator=(const MinidumpModuleList&) = delete;
+ ~MinidumpModuleList() override;
static void set_max_modules(uint32_t max_modules) {
max_modules_ = max_modules;
@@ -588,19 +589,19 @@ class MinidumpModuleList : public MinidumpStream,
static uint32_t max_modules() { return max_modules_; }
// CodeModules implementation.
- virtual unsigned int module_count() const {
+ unsigned int module_count() const override {
return valid_ ? module_count_ : 0;
}
- virtual const MinidumpModule* GetModuleForAddress(uint64_t address) const;
- virtual const MinidumpModule* GetMainModule() const;
- virtual const MinidumpModule* GetModuleAtSequence(
- unsigned int sequence) const;
- virtual const MinidumpModule* GetModuleAtIndex(unsigned int index) const;
- virtual const CodeModules* Copy() const;
+ const MinidumpModule* GetModuleForAddress(uint64_t address) const override;
+ const MinidumpModule* GetMainModule() const override;
+ const MinidumpModule* GetModuleAtSequence(
+ unsigned int sequence) const override;
+ const MinidumpModule* GetModuleAtIndex(unsigned int index) const override;
+ const CodeModules* Copy() const override;
// Returns a vector of all modules which address ranges needed to be shrunk
// down due to address range conflicts with other modules.
- virtual vector<linked_ptr<const CodeModule> > GetShrunkRangeModules() const;
+ vector<linked_ptr<const CodeModule>> GetShrunkRangeModules() const override;
// Print a human-readable representation of the object to stdout.
void Print();
@@ -615,7 +616,7 @@ class MinidumpModuleList : public MinidumpStream,
static const uint32_t kStreamType = MD_MODULE_LIST_STREAM;
- bool Read(uint32_t expected_size);
+ bool Read(uint32_t expected_size) override;
bool StoreRange(const MinidumpModule& module,
uint64_t base_address,
@@ -632,8 +633,6 @@ class MinidumpModuleList : public MinidumpStream,
MinidumpModules* modules_;
uint32_t module_count_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpModuleList);
};
@@ -648,7 +647,9 @@ class MinidumpModuleList : public MinidumpStream,
// memory minidumps contain all of a process' mapped memory.
class MinidumpMemoryList : public MinidumpStream {
public:
- virtual ~MinidumpMemoryList();
+ MinidumpMemoryList(const MinidumpMemoryList&) = delete;
+ void operator=(const MinidumpMemoryList&) = delete;
+ ~MinidumpMemoryList() override;
static void set_max_regions(uint32_t max_regions) {
max_regions_ = max_regions;
@@ -696,8 +697,6 @@ class MinidumpMemoryList : public MinidumpStream {
// The list of regions.
MemoryRegions* regions_;
uint32_t region_count_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryList);
};
@@ -709,10 +708,12 @@ class MinidumpMemoryList : public MinidumpStream {
// occurred.
class MinidumpException : public MinidumpStream {
public:
- virtual ~MinidumpException();
+ MinidumpException(const MinidumpException&) = delete;
+ void operator=(const MinidumpException&) = delete;
+ ~MinidumpException() override;
const MDRawExceptionStream* exception() const {
- return valid_ ? &exception_ : NULL;
+ return valid_ ? &exception_ : nullptr;
}
// The thread ID is used to determine if a thread is the exception thread,
@@ -736,19 +737,19 @@ class MinidumpException : public MinidumpStream {
bool Read(uint32_t expected_size) override;
MDRawExceptionStream exception_;
- MinidumpContext* context_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpException);
+ MinidumpContext* context_;
};
// MinidumpAssertion wraps MDRawAssertionInfo, which contains information
// about an assertion that caused the minidump to be generated.
class MinidumpAssertion : public MinidumpStream {
public:
- virtual ~MinidumpAssertion();
+ MinidumpAssertion(const MinidumpAssertion&) = delete;
+ void operator=(const MinidumpAssertion&) = delete;
+ ~MinidumpAssertion() override;
const MDRawAssertionInfo* assertion() const {
- return valid_ ? &assertion_ : NULL;
+ return valid_ ? &assertion_ : nullptr;
}
string expression() const {
@@ -779,8 +780,6 @@ class MinidumpAssertion : public MinidumpStream {
string expression_;
string function_;
string file_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpAssertion);
};
@@ -788,10 +787,12 @@ class MinidumpAssertion : public MinidumpStream {
// the system on which the minidump was generated. See also MinidumpMiscInfo.
class MinidumpSystemInfo : public MinidumpStream {
public:
- virtual ~MinidumpSystemInfo();
+ MinidumpSystemInfo(const MinidumpSystemInfo&) = delete;
+ void operator=(const MinidumpSystemInfo&) = delete;
+ ~MinidumpSystemInfo() override;
const MDRawSystemInfo* system_info() const {
- return valid_ ? &system_info_ : NULL;
+ return valid_ ? &system_info_ : nullptr;
}
// GetOS and GetCPU return textual representations of the operating system
@@ -834,8 +835,6 @@ class MinidumpSystemInfo : public MinidumpStream {
// A string identifying the CPU vendor, if known.
const string* cpu_vendor_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpSystemInfo);
};
@@ -846,7 +845,7 @@ class MinidumpUnloadedModule : public MinidumpObject,
~MinidumpUnloadedModule() override;
const MDRawUnloadedModule* module() const {
- return valid_ ? &unloaded_module_ : NULL;
+ return valid_ ? &unloaded_module_ : nullptr;
}
// CodeModule implementation
@@ -903,6 +902,8 @@ class MinidumpUnloadedModule : public MinidumpObject,
class MinidumpUnloadedModuleList : public MinidumpStream,
public CodeModules {
public:
+ MinidumpUnloadedModuleList(const MinidumpUnloadedModuleList&) = delete;
+ void operator=(const MinidumpUnloadedModuleList&) = delete;
~MinidumpUnloadedModuleList() override;
static void set_max_modules(uint32_t max_modules) {
@@ -945,8 +946,6 @@ class MinidumpUnloadedModuleList : public MinidumpStream,
MinidumpUnloadedModules* unloaded_modules_;
uint32_t module_count_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpUnloadedModuleList);
};
@@ -955,8 +954,11 @@ class MinidumpUnloadedModuleList : public MinidumpStream,
// information. See also MinidumpSystemInfo.
class MinidumpMiscInfo : public MinidumpStream {
public:
+ MinidumpMiscInfo(const MinidumpMiscInfo&) = delete;
+ void operator=(const MinidumpMiscInfo&) = delete;
+
const MDRawMiscInfo* misc_info() const {
- return valid_ ? &misc_info_ : NULL;
+ return valid_ ? &misc_info_ : nullptr;
}
// Print a human-readable representation of the object to stdout.
@@ -980,8 +982,6 @@ class MinidumpMiscInfo : public MinidumpStream {
string daylight_name_;
string build_string_;
string dbg_bld_str_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpMiscInfo);
};
@@ -990,8 +990,11 @@ class MinidumpMiscInfo : public MinidumpStream {
// at the time the minidump was generated.
class MinidumpBreakpadInfo : public MinidumpStream {
public:
+ MinidumpBreakpadInfo(const MinidumpBreakpadInfo&) = delete;
+ void operator=(const MinidumpBreakpadInfo&) = delete;
+
const MDRawBreakpadInfo* breakpad_info() const {
- return valid_ ? &breakpad_info_ : NULL;
+ return valid_ ? &breakpad_info_ : nullptr;
}
// These thread IDs are used to determine if threads deserve special
@@ -1014,8 +1017,6 @@ class MinidumpBreakpadInfo : public MinidumpStream {
bool Read(uint32_t expected_size_) override;
MDRawBreakpadInfo breakpad_info_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpBreakpadInfo);
};
// MinidumpMemoryInfo wraps MDRawMemoryInfo, which provides information
@@ -1023,7 +1024,9 @@ class MinidumpBreakpadInfo : public MinidumpStream {
// and protection.
class MinidumpMemoryInfo : public MinidumpObject {
public:
- const MDRawMemoryInfo* info() const { return valid_ ? &memory_info_ : NULL; }
+ const MDRawMemoryInfo* info() const {
+ return valid_ ? &memory_info_ : nullptr;
+ }
// The address of the base of the memory region.
uint64_t GetBase() const { return valid_ ? memory_info_.base_address : 0; }
@@ -1060,7 +1063,9 @@ class MinidumpMemoryInfo : public MinidumpObject {
// info corresponding to a specific address.
class MinidumpMemoryInfoList : public MinidumpStream {
public:
- virtual ~MinidumpMemoryInfoList();
+ MinidumpMemoryInfoList(const MinidumpMemoryInfoList&) = delete;
+ void operator=(const MinidumpMemoryInfoList&) = delete;
+ ~MinidumpMemoryInfoList() override;
unsigned int info_count() const { return valid_ ? info_count_ : 0; }
@@ -1086,14 +1091,15 @@ class MinidumpMemoryInfoList : public MinidumpStream {
MinidumpMemoryInfos* infos_;
uint32_t info_count_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryInfoList);
};
// MinidumpLinuxMaps wraps information about a single mapped memory region
// from /proc/self/maps.
class MinidumpLinuxMaps : public MinidumpObject {
public:
+ MinidumpLinuxMaps(const MinidumpLinuxMaps&) = delete;
+ void operator=(const MinidumpLinuxMaps&) = delete;
+
// The memory address of the base of the mapped region.
uint64_t GetBase() const { return valid_ ? region_.start : 0; }
// The size of the mapped region.
@@ -1139,8 +1145,6 @@ class MinidumpLinuxMaps : public MinidumpObject {
// The memory region struct that this class wraps.
MappedMemoryRegion region_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpLinuxMaps);
};
// MinidumpLinuxMapsList corresponds to the Linux-exclusive MD_LINUX_MAPS
@@ -1148,7 +1152,9 @@ class MinidumpLinuxMaps : public MinidumpObject {
// the mapped memory regions and their access permissions.
class MinidumpLinuxMapsList : public MinidumpStream {
public:
- virtual ~MinidumpLinuxMapsList();
+ MinidumpLinuxMapsList(const MinidumpLinuxMapsList&) = delete;
+ void operator=(const MinidumpLinuxMapsList&) = delete;
+ ~MinidumpLinuxMapsList() override;
// Get number of mappings.
unsigned int get_maps_count() const { return valid_ ? maps_count_ : 0; }
@@ -1180,8 +1186,6 @@ class MinidumpLinuxMapsList : public MinidumpStream {
MinidumpLinuxMappings* maps_;
// The number of mappings.
uint32_t maps_count_;
-
- DISALLOW_COPY_AND_ASSIGN(MinidumpLinuxMapsList);
};
// MinidumpCrashpadInfo wraps MDRawCrashpadInfo, which is an optional stream in
@@ -1196,12 +1200,12 @@ class MinidumpCrashpadInfo : public MinidumpStream {
};
const MDRawCrashpadInfo* crashpad_info() const {
- return valid_ ? &crashpad_info_ : NULL;
+ return valid_ ? &crashpad_info_ : nullptr;
}
const std::vector<std::vector<AnnotationObject>>*
GetModuleCrashpadInfoAnnotationObjects() const {
- return valid_ ? &module_crashpad_info_annotation_objects_ : NULL;
+ return valid_ ? &module_crashpad_info_annotation_objects_ : nullptr;
}
// Print a human-readable representation of the object to stdout.
@@ -1242,6 +1246,9 @@ class Minidump {
// is valid as long as the Minidump object is.
explicit Minidump(std::istream& input);
+ Minidump(const Minidump&) = delete;
+ void operator=(const Minidump&) = delete;
+
virtual ~Minidump();
// path may be empty if the minidump was not opened from a file
@@ -1258,7 +1265,9 @@ class Minidump {
}
static uint32_t max_string_length() { return max_string_length_; }
- virtual const MDRawHeader* header() const { return valid_ ? &header_ : NULL; }
+ virtual const MDRawHeader* header() const {
+ return valid_ ? &header_ : nullptr;
+ }
// Reads the CPU information from the system info stream and generates the
// appropriate CPU flags. The returned context_cpu_flags are the same as
@@ -1374,7 +1383,7 @@ class Minidump {
// the Minidump object locate interesting streams quickly, and
// provides a convenient place to stash MinidumpStream objects.
struct MinidumpStreamInfo {
- MinidumpStreamInfo() : stream_index(0), stream(NULL) {}
+ MinidumpStreamInfo() : stream_index(0), stream(nullptr) {}
~MinidumpStreamInfo() { delete stream; }
// Index into the MinidumpDirectoryEntries vector
@@ -1436,8 +1445,6 @@ class Minidump {
// Knobs for controlling display of memory printing.
bool hexdump_;
unsigned int hexdump_width_;
-
- DISALLOW_COPY_AND_ASSIGN(Minidump);
};
diff --git a/src/google_breakpad/processor/minidump_processor.h b/src/google_breakpad/processor/minidump_processor.h
index 137ef444..8475407e 100644
--- a/src/google_breakpad/processor/minidump_processor.h
+++ b/src/google_breakpad/processor/minidump_processor.h
@@ -126,8 +126,18 @@ class MinidumpProcessor {
// does not exist or cannot be determined.
static string GetAssertion(Minidump* dump);
+ // Sets the flag to enable/disable use of objdump during normal crash
+ // processing. This is independent from the flag for use of objdump during
+ // exploitability analysis.
void set_enable_objdump(bool enabled) { enable_objdump_ = enabled; }
+ // Sets the flag to enable/disable use of objdump during exploitability
+ // analysis. This is independent from the flag for use of objdump during
+ // normal crash processing.
+ void set_enable_objdump_for_exploitability(bool enabled) {
+ enable_objdump_for_exploitability_ = enabled;
+ }
+
private:
StackFrameSymbolizer* frame_symbolizer_;
// Indicate whether resolver_helper_ is owned by this instance.
@@ -138,9 +148,15 @@ class MinidumpProcessor {
// memory corruption issue.
bool enable_exploitability_;
- // This flag permits the exploitability scanner to shell out to objdump
- // for purposes of disassembly.
+ // This flag permits the processor to shell out to objdump for purposes of
+ // disassembly during normal crash processing, but not during exploitability
+ // analysis.
bool enable_objdump_;
+
+ // This flag permits the exploitability scanner to shell out to objdump for
+ // purposes of disassembly. This results in significantly more overhead than
+ // the enable_objdump_ flag.
+ bool enable_objdump_for_exploitability_;
};
} // namespace google_breakpad
diff --git a/src/processor/address_map_unittest.cc b/src/processor/address_map_unittest.cc
index 1bf0d718..2d754b60 100644
--- a/src/processor/address_map_unittest.cc
+++ b/src/processor/address_map_unittest.cc
@@ -30,6 +30,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <limits.h>
#include <stdio.h>
diff --git a/src/processor/basic_code_modules.cc b/src/processor/basic_code_modules.cc
index 57021d47..bdfc8f3d 100644
--- a/src/processor/basic_code_modules.cc
+++ b/src/processor/basic_code_modules.cc
@@ -33,6 +33,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/basic_code_modules.h"
#include <assert.h>
diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc
index 07aba6bc..220bd746 100644
--- a/src/processor/basic_source_line_resolver.cc
+++ b/src/processor/basic_source_line_resolver.cc
@@ -31,6 +31,10 @@
// See basic_source_line_resolver.h and basic_source_line_resolver_types.h
// for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/processor/basic_source_line_resolver_unittest.cc b/src/processor/basic_source_line_resolver_unittest.cc
index fba4e9a6..a73ded8b 100644
--- a/src/processor/basic_source_line_resolver_unittest.cc
+++ b/src/processor/basic_source_line_resolver_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <stdio.h>
diff --git a/src/processor/call_stack.cc b/src/processor/call_stack.cc
index 87ffd1ae..6ecae6dc 100644
--- a/src/processor/call_stack.cc
+++ b/src/processor/call_stack.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/stack_frame.h"
diff --git a/src/processor/cfi_frame_info.cc b/src/processor/cfi_frame_info.cc
index 5216a44e..2094e094 100644
--- a/src/processor/cfi_frame_info.cc
+++ b/src/processor/cfi_frame_info.cc
@@ -31,6 +31,10 @@
// cfi_frame_info.cc: Implementation of CFIFrameInfo class.
// See cfi_frame_info.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/cfi_frame_info.h"
#include <string.h>
diff --git a/src/processor/cfi_frame_info_unittest.cc b/src/processor/cfi_frame_info_unittest.cc
index 85f970a5..0cf4562d 100644
--- a/src/processor/cfi_frame_info_unittest.cc
+++ b/src/processor/cfi_frame_info_unittest.cc
@@ -31,6 +31,10 @@
// cfi_frame_info_unittest.cc: Unit tests for CFIFrameInfo,
// CFIRuleParser, CFIFrameInfoParseHandler, and SimpleCFIWalker.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include "breakpad_googletest_includes.h"
diff --git a/src/processor/contained_range_map_unittest.cc b/src/processor/contained_range_map_unittest.cc
index 670bb189..1d681fdf 100644
--- a/src/processor/contained_range_map_unittest.cc
+++ b/src/processor/contained_range_map_unittest.cc
@@ -30,6 +30,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include "processor/contained_range_map-inl.h"
diff --git a/src/processor/convert_old_arm64_context.cc b/src/processor/convert_old_arm64_context.cc
index 8347064a..768475b2 100644
--- a/src/processor/convert_old_arm64_context.cc
+++ b/src/processor/convert_old_arm64_context.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/convert_old_arm64_context.h"
#include <string.h>
diff --git a/src/processor/disassembler_objdump.cc b/src/processor/disassembler_objdump.cc
index dfe10d58..9f9569a5 100644
--- a/src/processor/disassembler_objdump.cc
+++ b/src/processor/disassembler_objdump.cc
@@ -30,10 +30,16 @@
//
// Author: Mark Brand
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/disassembler_objdump.h"
-#ifdef __linux__
#include <unistd.h>
+#include <sys/wait.h>
+
+#include <array>
#include <fstream>
#include <iostream>
#include <iterator>
@@ -41,76 +47,15 @@
#include <sstream>
#include <vector>
+#include "common/linux/eintr_wrapper.h"
+#include "common/linux/scoped_pipe.h"
+#include "common/linux/scoped_tmpfile.h"
#include "processor/logging.h"
namespace google_breakpad {
namespace {
-const size_t kMaxX86InstructionLength = 15;
-
-// Small RAII wrapper for temporary files.
-//
-// Example:
-// ScopedTmpFile tmp("/tmp/tmpfile-XXXX");
-// if (tmp.Create()) {
-// std::cerr << tmp.path() << std::endl;
-// }
-class ScopedTmpFile {
- public:
- // Initialize the ScopedTmpFile object - this does not create the temporary
- // file yet.
- ScopedTmpFile(const char* path_format);
- ~ScopedTmpFile();
-
- // Creates the temporary file, returns true on success.
- bool Create();
-
- // Writes bytes to the temporary file, returns true on success.
- bool Write(const uint8_t* bytes, unsigned int bytes_len);
-
- // Returns the path of the temporary file.
- string path() const { return path_; }
-
- private:
- int fd_;
- string path_;
-};
-
-ScopedTmpFile::ScopedTmpFile(const char* path_format) : path_(path_format) {}
-
-ScopedTmpFile::~ScopedTmpFile() {
- if (fd_) {
- close(fd_);
- unlink(path_.c_str());
- }
-}
-
-bool ScopedTmpFile::Create() {
- fd_ = mkstemp(path_.data());
- if (fd_ < 0) {
- unlink(path_.c_str());
- fd_ = 0;
- path_ = "";
- return false;
- }
-
- return true;
-}
-bool ScopedTmpFile::Write(const uint8_t* bytes, unsigned int bytes_len) {
- if (fd_) {
- do {
- ssize_t result = write(fd_, bytes, bytes_len);
- if (result < 0) {
- break;
- }
-
- bytes += result;
- bytes_len -= result;
- } while (bytes_len);
- }
-
- return bytes_len == 0;
-}
+const size_t kMaxX86InstructionLength = 15;
bool IsInstructionPrefix(const string& token) {
if (token == "lock" || token == "rep" || token == "repz" ||
@@ -285,47 +230,87 @@ bool DisassemblerObjdump::DisassembleInstruction(uint32_t cpu,
return false;
}
- // Create two temporary files, one for the raw instruction bytes to pass to
- // objdump, and one for the output, and write the bytes to the input file.
- ScopedTmpFile raw_bytes_file("/tmp/breakpad_mem_region-raw_bytes-XXXXXX");
- ScopedTmpFile disassembly_file("/tmp/breakpad_mem_region-disassembly-XXXXXX");
- if (!raw_bytes_file.Create() || !disassembly_file.Create() ||
- !raw_bytes_file.Write(raw_bytes, raw_bytes_len)) {
- BPLOG(ERROR) << "Failed creating temporary files.";
+ // Create a temporary file for the raw instruction bytes to pass to
+ // objdump, and write the bytes to the input file.
+ ScopedTmpFile raw_bytes_file;
+ if (!raw_bytes_file.InitData(raw_bytes, raw_bytes_len)) {
+ BPLOG(ERROR) << "Failed creating temporary file.";
+ return false;
+ }
+
+ // Create a pipe to use to read the disassembly back from objdump.
+ ScopedPipe disassembly_pipe;
+ if (!disassembly_pipe.Init()) {
+ BPLOG(ERROR) << "Failed creating pipe for output.";
return false;
}
- char cmd[1024] = {0};
- snprintf(cmd, 1024,
- "objdump -D --no-show-raw-insn -b binary -M intel -m %s %s > %s",
- architecture.c_str(), raw_bytes_file.path().c_str(),
- disassembly_file.path().c_str());
- if (system(cmd)) {
- BPLOG(ERROR) << "Failed to call objdump.";
+ pid_t child_pid = fork();
+ if (child_pid < 0) {
+ BPLOG(ERROR) << "Fork failed.";
return false;
}
- // Pipe each output line into the string until the string contains the first
- // instruction from objdump.
- std::ifstream objdump_stream(disassembly_file.path());
+ if (child_pid == 0) {
+ // In the child process, set up the input and output file descriptors.
+ if (dup2(raw_bytes_file.GetFd(), STDIN_FILENO) < 0 ||
+ disassembly_pipe.Dup2WriteFd(STDOUT_FILENO) < 0 ||
+ disassembly_pipe.Dup2WriteFd(STDERR_FILENO) < 0) {
+ BPLOG(ERROR) << "Failed dup'ing file descriptors.";
+ exit(-1);
+ }
- // Match the instruction line, from:
- // 0: lock cmpxchg DWORD PTR [esi+0x10],eax
- // extract the string "lock cmpxchg DWORD PTR [esi+0x10],eax"
- std::regex instruction_regex(
- "^\\s+[0-9a-f]+:\\s+" // " 0:"
- "((?:\\s*\\S*)+)$"); // "lock cmpxchg..."
+ // We need to close the read end of the pipe in the child process so that
+ // when the parent closes it, the pipe is disconnected.
+ disassembly_pipe.CloseReadFd();
- std::string line;
- std::smatch match;
- do {
- if (!getline(objdump_stream, line)) {
- BPLOG(INFO) << "Failed to find instruction in objdump output.";
+ // We use "/proc/self/fd/0" here to allow objdump to parse an unnamed file,
+ // since objdump does not have a mode to read from stdin. This cannot be
+ // used with a pipe, since objdump requires that the input is a standard
+ // file.
+ execlp("objdump", "objdump", "-D", "--no-show-raw-insn", "-b", "binary",
+ "-M", "intel", "-m", architecture.c_str(), "/proc/self/fd/0",
+ nullptr);
+
+ BPLOG(ERROR) << "Failed to exec objdump.";
+ exit(-1);
+ } else {
+ // In the parent process, parse the objdump output.
+
+ // Match the instruction line, from:
+ // 0: lock cmpxchg DWORD PTR [esi+0x10],eax
+ // extract the string "lock cmpxchg DWORD PTR [esi+0x10],eax"
+ std::regex instruction_regex(
+ "^\\s+[0-9a-f]+:\\s+" // " 0:"
+ "((?:\\s*\\S*)+)$"); // "lock cmpxchg..."
+
+ std::string line;
+ std::smatch match;
+ while (disassembly_pipe.ReadLine(line)) {
+ if (std::regex_match(line, match, instruction_regex)) {
+ instruction = match[1].str();
+ break;
+ }
+ }
+
+ // Close the read pipe so that objdump will exit (in case we broke out of
+ // the loop above before reading all of the output).
+ disassembly_pipe.CloseReadFd();
+
+ // Now wait for objdump to exit.
+ int status = 0;
+ HANDLE_EINTR(waitpid(child_pid, &status, 0));
+
+ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+ BPLOG(ERROR) << "objdump didn't run successfully.";
return false;
}
- } while (!std::regex_match(line, match, instruction_regex));
- instruction = match[1].str();
+ if (instruction == "") {
+ BPLOG(ERROR) << "Failed to find instruction in objdump output.";
+ return false;
+ }
+ }
return true;
}
@@ -498,23 +483,5 @@ bool DisassemblerObjdump::CalculateDestAddress(const DumpContext& context,
uint64_t& address) {
return CalculateAddress(context, dest_, address);
}
-} // namespace google_breakpad
-
-#else // __linux__
-namespace google_breakpad {
-DisassemblerObjdump::DisassemblerObjdump(const uint32_t cpu,
- const MemoryRegion* memory_region,
- uint64_t address) {}
-
-bool DisassemblerObjdump::CalculateSrcAddress(const DumpContext& context,
- uint64_t& address) {
- return false;
-}
-
-bool DisassemblerObjdump::CalculateDestAddress(const DumpContext& context,
- uint64_t& address) {
- return false;
-}
-} // namespace google_breakpad
-#endif // __linux__
+} // namespace google_breakpad \ No newline at end of file
diff --git a/src/processor/disassembler_objdump_unittest.cc b/src/processor/disassembler_objdump_unittest.cc
index 4b4ce6c3..30a60da5 100644
--- a/src/processor/disassembler_objdump_unittest.cc
+++ b/src/processor/disassembler_objdump_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <unistd.h>
#include <vector>
diff --git a/src/processor/disassembler_x86.cc b/src/processor/disassembler_x86.cc
index dffb996d..741cec7f 100644
--- a/src/processor/disassembler_x86.cc
+++ b/src/processor/disassembler_x86.cc
@@ -33,6 +33,10 @@
//
// Author: Cris Neckar
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/disassembler_x86.h"
#include <string.h>
diff --git a/src/processor/disassembler_x86_unittest.cc b/src/processor/disassembler_x86_unittest.cc
index 117b3bf8..18525b82 100644
--- a/src/processor/disassembler_x86_unittest.cc
+++ b/src/processor/disassembler_x86_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <unistd.h>
#include "breakpad_googletest_includes.h"
diff --git a/src/processor/dump_context.cc b/src/processor/dump_context.cc
index a8ab0084..ab97930f 100644
--- a/src/processor/dump_context.cc
+++ b/src/processor/dump_context.cc
@@ -30,6 +30,10 @@
//
// See dump_context.h for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/dump_context.h"
#include <assert.h>
@@ -772,24 +776,14 @@ void DumpContext::Print() {
context_riscv->t6);
#if defined(__riscv)
- for (unsigned int freg_index = 0;
- freg_index < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; ++freg_index) {
- riscv_fpr_size fp_value = context_riscv->float_save.regs[freg_index];
-# if __riscv_flen == 32
- printf(" float_save.regs[%2d] = 0x%" PRIx32 "\n",
- freg_index, fp_value);
-# elif __riscv_flen == 64
- printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
- freg_index, fp_value);
-# elif __riscv_flen == 128
- printf(" float_save.regs[%2d] = 0x%" PRIx64 "%" PRIx64 "\n",
- freg_index, fp_value.high, fp_value.low);
-# else
-# error "Unexpected __riscv_flen"
-# endif
+ for (unsigned int freg_index = 0; freg_index < MD_CONTEXT_RISCV_FPR_COUNT;
+ ++freg_index) {
+ // Breakpad only supports RISCV32 with 32 bit floating point.
+ uint32_t fp_value = context_riscv->fpregs[freg_index];
+ printf(" fpregs[%2d] = 0x%" PRIx32 "\n", freg_index,
+ fp_value);
}
- printf(" float_save.fpcsr = 0x%" PRIx32 "\n",
- context_riscv->float_save.fpcsr);
+ printf(" fcsr = 0x%" PRIx32 "\n", context_riscv->fcsr);
#endif
break;
}
@@ -866,25 +860,14 @@ void DumpContext::Print() {
context_riscv64->t6);
#if defined(__riscv)
- for (unsigned int freg_index = 0;
- freg_index < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; ++freg_index) {
- riscv_fpr_size fp_value = context_riscv64->float_save.regs[freg_index];
-# if __riscv_flen == 32
- printf(" float_save.regs[%2d] = 0x%" PRIx32 "\n",
- freg_index, fp_value);
-# elif __riscv_flen == 64
- printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
- freg_index, fp_value);
-# elif __riscv_flen == 128
- printf(" float_save.regs[%2d] = 0x%"
- PRIx64 "%" PRIx64 "\n",
- freg_index, fp_value.high, fp_value.low);
-# else
-# error "Unexpected __riscv_flen"
-# endif
+ for (unsigned int freg_index = 0; freg_index < MD_CONTEXT_RISCV_FPR_COUNT;
+ ++freg_index) {
+ // Breakpad only supports RISCV64 with 64 bit floating point.
+ uint64_t fp_value = context_riscv64->fpregs[freg_index];
+ printf(" fpregs[%2d] = 0x%" PRIx64 "\n", freg_index,
+ fp_value);
}
- printf(" float_save.fpcsr = 0x%" PRIx32 "\n",
- context_riscv64->float_save.fpcsr);
+ printf(" fcsr = 0x%" PRIx32 "\n", context_riscv64->fcsr);
#endif
break;
}
diff --git a/src/processor/dump_object.cc b/src/processor/dump_object.cc
index 6186c8fa..4050b11e 100644
--- a/src/processor/dump_object.cc
+++ b/src/processor/dump_object.cc
@@ -28,6 +28,10 @@
// dump_object.cc: A base class for all mini/micro dump object.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/dump_object.h"
namespace google_breakpad {
diff --git a/src/processor/exploitability.cc b/src/processor/exploitability.cc
index 7a4107bf..89064c9b 100644
--- a/src/processor/exploitability.cc
+++ b/src/processor/exploitability.cc
@@ -33,6 +33,10 @@
// Author: Cris Neckar
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <cassert>
#include "common/scoped_ptr.h"
diff --git a/src/processor/exploitability_linux.cc b/src/processor/exploitability_linux.cc
index 63a12656..76e78f45 100644
--- a/src/processor/exploitability_linux.cc
+++ b/src/processor/exploitability_linux.cc
@@ -33,6 +33,10 @@
//
// Author: Matthew Riley
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/exploitability_linux.h"
#include <string.h>
@@ -41,7 +45,9 @@
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/process_state.h"
#include "google_breakpad/processor/stack_frame.h"
+#ifdef __linux__
#include "processor/disassembler_objdump.h"
+#endif
#include "processor/logging.h"
namespace {
@@ -156,7 +162,7 @@ ExploitabilityRating ExploitabilityLinux::CheckPlatformExploitability() {
}
bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
-#ifdef _WIN32
+#ifndef __linux__
BPLOG(INFO) << "MinGW does not support fork and exec. Terminating method.";
return false;
#else
@@ -220,7 +226,7 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
} else {
return false;
}
-#endif // _WIN32
+#endif // __linux__
}
bool ExploitabilityLinux::StackPointerOffStack(uint64_t stack_ptr) {
diff --git a/src/processor/exploitability_unittest.cc b/src/processor/exploitability_unittest.cc
index bc1823c6..09e4690d 100644
--- a/src/processor/exploitability_unittest.cc
+++ b/src/processor/exploitability_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <unistd.h>
@@ -80,7 +84,7 @@ ExploitabilityFor(const string& filename) {
SimpleSymbolSupplier supplier(TestDataDir() + "/symbols");
BasicSourceLineResolver resolver;
MinidumpProcessor processor(&supplier, &resolver, true);
- processor.set_enable_objdump(true);
+ processor.set_enable_objdump_for_exploitability(true);
ProcessState state;
string minidump_file = TestDataDir() + "/" + filename;
diff --git a/src/processor/exploitability_win.cc b/src/processor/exploitability_win.cc
index accaadd3..b94e8725 100644
--- a/src/processor/exploitability_win.cc
+++ b/src/processor/exploitability_win.cc
@@ -33,6 +33,10 @@
//
// Author: Cris Neckar
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <vector>
#include "processor/exploitability_win.h"
diff --git a/src/processor/fast_source_line_resolver.cc b/src/processor/fast_source_line_resolver.cc
index 0d1ebc6b..79803f2c 100644
--- a/src/processor/fast_source_line_resolver.cc
+++ b/src/processor/fast_source_line_resolver.cc
@@ -36,6 +36,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/fast_source_line_resolver.h"
#include "processor/fast_source_line_resolver_types.h"
diff --git a/src/processor/fast_source_line_resolver_unittest.cc b/src/processor/fast_source_line_resolver_unittest.cc
index 1bb35019..08340c15 100644
--- a/src/processor/fast_source_line_resolver_unittest.cc
+++ b/src/processor/fast_source_line_resolver_unittest.cc
@@ -36,6 +36,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <stdio.h>
diff --git a/src/processor/logging.cc b/src/processor/logging.cc
index 136f4f8f..46386eb5 100644
--- a/src/processor/logging.cc
+++ b/src/processor/logging.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <errno.h>
#include <string.h>
diff --git a/src/processor/map_serializers_unittest.cc b/src/processor/map_serializers_unittest.cc
index 74ebd5e5..cd31ddc8 100644
--- a/src/processor/map_serializers_unittest.cc
+++ b/src/processor/map_serializers_unittest.cc
@@ -31,6 +31,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <climits>
#include <map>
#include <string>
diff --git a/src/processor/microdump.cc b/src/processor/microdump.cc
index 83fb098c..94d2c200 100644
--- a/src/processor/microdump.cc
+++ b/src/processor/microdump.cc
@@ -30,6 +30,10 @@
//
// See microdump.h for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/microdump.h"
#include <stdio.h>
diff --git a/src/processor/microdump_processor.cc b/src/processor/microdump_processor.cc
index be6150cd..3c25d5cf 100644
--- a/src/processor/microdump_processor.cc
+++ b/src/processor/microdump_processor.cc
@@ -30,6 +30,10 @@
//
// See microdump_processor.h for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/microdump_processor.h"
#include <assert.h>
diff --git a/src/processor/microdump_processor_unittest.cc b/src/processor/microdump_processor_unittest.cc
index 3362431b..47f5e35e 100644
--- a/src/processor/microdump_processor_unittest.cc
+++ b/src/processor/microdump_processor_unittest.cc
@@ -28,6 +28,10 @@
// Unit test for MicrodumpProcessor.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fstream>
#include <iostream>
#include <string>
diff --git a/src/processor/microdump_stackwalk.cc b/src/processor/microdump_stackwalk.cc
index 593b07d6..222310f7 100644
--- a/src/processor/microdump_stackwalk.cc
+++ b/src/processor/microdump_stackwalk.cc
@@ -29,6 +29,10 @@
// microdump_stackwalk.cc: Process a microdump with MicrodumpProcessor, printing
// the results, including stack traces.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <string.h>
#include <unistd.h>
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc
index 135770d5..83f72b97 100644
--- a/src/processor/minidump.cc
+++ b/src/processor/minidump.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/minidump.h"
#include <assert.h>
@@ -72,6 +76,11 @@ using std::vector;
namespace {
+// Limit arrived at by adding up possible states in Intel Ch. 13.5 X-SAVE
+// MANAGED STATE
+// (~ 3680 bytes) plus some extra for the future.
+const uint32_t kMaxXSaveAreaSize = 16384;
+
// Returns true iff |context_size| matches exactly one of the sizes of the
// various MDRawContext* types.
// TODO(blundell): This function can be removed once
@@ -503,6 +512,10 @@ bool MinidumpContext::Read(uint32_t expected_size) {
// sizeof(MDRawContextAMD64). For now we skip this extended data.
if (expected_size > sizeof(MDRawContextAMD64)) {
size_t bytes_left = expected_size - sizeof(MDRawContextAMD64);
+ if (bytes_left > kMaxXSaveAreaSize) {
+ BPLOG(ERROR) << "MinidumpContext oversized xstate area";
+ return false;
+ }
std::vector<uint8_t> xstate(bytes_left);
if (!minidump_->ReadBytes(xstate.data(),
bytes_left)) {
@@ -1246,12 +1259,11 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_riscv->t5);
Swap(&context_riscv->t6);
- for (int fpr_index = 0;
- fpr_index < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT;
+ for (int fpr_index = 0; fpr_index < MD_CONTEXT_RISCV_FPR_COUNT;
++fpr_index) {
- Swap(&context_riscv->float_save.regs[fpr_index]);
+ Swap(&context_riscv->fpregs[fpr_index]);
}
- Swap(&context_riscv->float_save.fpcsr);
+ Swap(&context_riscv->fcsr);
}
SetContextRISCV(context_riscv.release());
@@ -1325,12 +1337,11 @@ bool MinidumpContext::Read(uint32_t expected_size) {
Swap(&context_riscv64->t5);
Swap(&context_riscv64->t6);
- for (int fpr_index = 0;
- fpr_index < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT;
+ for (int fpr_index = 0; fpr_index < MD_CONTEXT_RISCV_FPR_COUNT;
++fpr_index) {
- Swap(&context_riscv64->float_save.regs[fpr_index]);
+ Swap(&context_riscv64->fpregs[fpr_index]);
}
- Swap(&context_riscv64->float_save.fpcsr);
+ Swap(&context_riscv64->fcsr);
}
SetContextRISCV64(context_riscv64.release());
@@ -5479,6 +5490,27 @@ void MinidumpCrashpadInfo::Print() {
printf(" module_list[%d].simple_annotations[\"%s\"] = %s\n",
module_index, annot.first.c_str(), annot.second.c_str());
}
+ const auto& crashpad_annots =
+ module_crashpad_info_annotation_objects_[module_index];
+ for (const AnnotationObject& annot : crashpad_annots) {
+ std::string str_value;
+ if (annot.type == 1) {
+ // Value represents a C-style string.
+ for (const uint8_t& v : annot.value) {
+ str_value.append(1, static_cast<char>(v));
+ }
+ } else {
+ // Value represents something else.
+ char buffer[3];
+ for (const uint8_t& v : annot.value) {
+ snprintf(buffer, sizeof(buffer), "%02X", v);
+ str_value.append(buffer);
+ }
+ }
+ printf(
+ " module_list[%d].crashpad_annotations[\"%s\"] (type = %u) = %s\n",
+ module_index, annot.name.c_str(), annot.type, str_value.c_str());
+ }
printf(" address_mask = %" PRIu64 "\n", crashpad_info_.address_mask);
}
diff --git a/src/processor/minidump_dump.cc b/src/processor/minidump_dump.cc
index 83afd1da..d3c33ad4 100644
--- a/src/processor/minidump_dump.cc
+++ b/src/processor/minidump_dump.cc
@@ -31,6 +31,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <string.h>
#include <unistd.h>
diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc
index fb330e26..5d2dea6d 100644
--- a/src/processor/minidump_processor.cc
+++ b/src/processor/minidump_processor.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/minidump_processor.h"
#include <assert.h>
@@ -44,11 +48,14 @@
#include "google_breakpad/processor/process_state.h"
#include "google_breakpad/processor/exploitability.h"
#include "google_breakpad/processor/stack_frame_symbolizer.h"
-#include "processor/disassembler_objdump.h"
#include "processor/logging.h"
#include "processor/stackwalker_x86.h"
#include "processor/symbolic_constants_win.h"
+#ifdef __linux__
+#include "processor/disassembler_objdump.h"
+#endif
+
namespace google_breakpad {
MinidumpProcessor::MinidumpProcessor(SymbolSupplier* supplier,
@@ -56,7 +63,8 @@ MinidumpProcessor::MinidumpProcessor(SymbolSupplier* supplier,
: frame_symbolizer_(new StackFrameSymbolizer(supplier, resolver)),
own_frame_symbolizer_(true),
enable_exploitability_(false),
- enable_objdump_(false) {
+ enable_objdump_(false),
+ enable_objdump_for_exploitability_(false) {
}
MinidumpProcessor::MinidumpProcessor(SymbolSupplier* supplier,
@@ -65,7 +73,8 @@ MinidumpProcessor::MinidumpProcessor(SymbolSupplier* supplier,
: frame_symbolizer_(new StackFrameSymbolizer(supplier, resolver)),
own_frame_symbolizer_(true),
enable_exploitability_(enable_exploitability),
- enable_objdump_(false) {
+ enable_objdump_(false),
+ enable_objdump_for_exploitability_(false) {
}
MinidumpProcessor::MinidumpProcessor(StackFrameSymbolizer* frame_symbolizer,
@@ -73,7 +82,8 @@ MinidumpProcessor::MinidumpProcessor(StackFrameSymbolizer* frame_symbolizer,
: frame_symbolizer_(frame_symbolizer),
own_frame_symbolizer_(false),
enable_exploitability_(enable_exploitability),
- enable_objdump_(false) {
+ enable_objdump_(false),
+ enable_objdump_for_exploitability_(false) {
assert(frame_symbolizer_);
}
@@ -368,9 +378,8 @@ ProcessResult MinidumpProcessor::Process(
// rating.
if (enable_exploitability_) {
scoped_ptr<Exploitability> exploitability(
- Exploitability::ExploitabilityForPlatform(dump,
- process_state,
- enable_objdump_));
+ Exploitability::ExploitabilityForPlatform(
+ dump, process_state, enable_objdump_for_exploitability_));
// The engine will be null if the platform is not supported
if (exploitability != NULL) {
process_state->exploitability_ = exploitability->CheckExploitability();
@@ -626,6 +635,16 @@ bool MinidumpProcessor::GetCPUInfo(Minidump* dump, SystemInfo* info) {
break;
}
+ case MD_CPU_ARCHITECTURE_RISCV: {
+ info->cpu = "riscv";
+ break;
+ }
+
+ case MD_CPU_ARCHITECTURE_RISCV64: {
+ info->cpu = "riscv64";
+ break;
+ }
+
default: {
// Assign the numeric architecture ID into the CPU string.
char cpu_string[7];
@@ -760,6 +779,8 @@ bool MinidumpProcessor::GetProcessCreateTime(Minidump* dump,
return true;
}
+#ifdef __linux__
+
static bool IsCanonicalAddress(uint64_t address) {
uint64_t sign_bit = (address >> 63) & 1;
for (int shift = 48; shift < 63; ++shift) {
@@ -832,6 +853,7 @@ static void CalculateFaultAddressFromInstruction(Minidump* dump,
*address = write_address;
}
}
+#endif // __linux__
// static
string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address,
@@ -1776,6 +1798,21 @@ string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address,
case MD_EXCEPTION_FLAG_LIN_SEGV_PKUERR:
reason.append("SEGV_PKUERR");
break;
+ case MD_EXCEPTION_FLAG_LIN_SEGV_ACCADI:
+ reason.append("SEGV_ACCADI");
+ break;
+ case MD_EXCEPTION_FLAG_LIN_SEGV_ADIDERR:
+ reason.append("SEGV_ADIDERR");
+ break;
+ case MD_EXCEPTION_FLAG_LIN_SEGV_ADIPERR:
+ reason.append("SEGV_ADIPERR");
+ break;
+ case MD_EXCEPTION_FLAG_LIN_SEGV_MTEAERR:
+ reason.append("SEGV_MTEAERR");
+ break;
+ case MD_EXCEPTION_FLAG_LIN_SEGV_MTESERR:
+ reason.append("SEGV_MTESERR");
+ break;
default:
reason.append(flags_string);
BPLOG(INFO) << "Unknown exception reason " << reason;
@@ -2070,6 +2107,7 @@ string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address,
static_cast<MDCPUArchitecture>(raw_system_info->processor_architecture),
*address);
+#ifdef __linux__
// For invalid accesses to non-canonical addresses, amd64 cpus don't provide
// the fault address, so recover it from the disassembly and register state
// if possible.
@@ -2078,6 +2116,7 @@ string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address,
&& std::numeric_limits<uint64_t>::max() == *address) {
CalculateFaultAddressFromInstruction(dump, address);
}
+#endif // __linux__
}
return reason;
diff --git a/src/processor/minidump_processor_unittest.cc b/src/processor/minidump_processor_unittest.cc
index 1ca8c9fb..de3cfdd5 100644
--- a/src/processor/minidump_processor_unittest.cc
+++ b/src/processor/minidump_processor_unittest.cc
@@ -29,6 +29,10 @@
// Unit test for MinidumpProcessor. Uses a pre-generated minidump and
// corresponding symbol file, and checks the stack frames for correctness.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <string>
diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc
index cee9a734..74b41acf 100644
--- a/src/processor/minidump_stackwalk.cc
+++ b/src/processor/minidump_stackwalk.cc
@@ -31,6 +31,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -57,6 +61,7 @@ struct Options {
bool machine_readable;
bool output_stack_contents;
bool output_requesting_thread_only;
+ bool brief;
string minidump_file;
std::vector<string> symbol_paths;
@@ -110,6 +115,8 @@ bool PrintMinidumpProcess(const Options& options) {
if (options.machine_readable) {
PrintProcessStateMachineReadable(process_state);
+ } else if (options.brief) {
+ PrintRequestingThreadBrief(process_state);
} else {
PrintProcessState(process_state, options.output_stack_contents,
options.output_requesting_thread_only, &resolver);
@@ -130,7 +137,8 @@ static void Usage(int argc, const char *argv[], bool error) {
"\n"
" -m Output in machine-readable format\n"
" -s Output stack contents\n"
- " -c Output thread that causes crash or dump only\n",
+ " -c Output thread that causes crash or dump only\n"
+ " -b Brief of the thread that causes crash or dump\n",
google_breakpad::BaseName(argv[0]).c_str());
}
@@ -140,14 +148,18 @@ static void SetupOptions(int argc, const char *argv[], Options* options) {
options->machine_readable = false;
options->output_stack_contents = false;
options->output_requesting_thread_only = false;
+ options->brief = false;
- while ((ch = getopt(argc, (char * const*)argv, "chms")) != -1) {
+ while ((ch = getopt(argc, (char* const*)argv, "bchms")) != -1) {
switch (ch) {
case 'h':
Usage(argc, argv, false);
exit(0);
break;
+ case 'b':
+ options->brief = true;
+ break;
case 'c':
options->output_requesting_thread_only = true;
break;
diff --git a/src/processor/minidump_unittest.cc b/src/processor/minidump_unittest.cc
index 53d44ae1..719adf78 100644
--- a/src/processor/minidump_unittest.cc
+++ b/src/processor/minidump_unittest.cc
@@ -29,6 +29,10 @@
// Unit test for Minidump. Uses a pre-generated minidump and
// verifies that certain streams are correct.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <iostream>
#include <fstream>
#include <sstream>
diff --git a/src/processor/module_comparer.cc b/src/processor/module_comparer.cc
index 389712c5..a6413038 100644
--- a/src/processor/module_comparer.cc
+++ b/src/processor/module_comparer.cc
@@ -31,6 +31,10 @@
//
// Author: lambxsy@google.com (Siyang Xie)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/module_comparer.h"
#include <map>
@@ -64,7 +68,7 @@ bool ModuleComparer::Compare(const string& symbol_data) {
buffer.reset();
// Serialize BasicSourceLineResolver::Module.
- unsigned int serialized_size = 0;
+ size_t serialized_size = 0;
scoped_array<char> serialized_data(
serializer_.Serialize(*(basic_module.get()), &serialized_size));
ASSERT_TRUE(serialized_data.get());
diff --git a/src/processor/module_serializer.cc b/src/processor/module_serializer.cc
index d0445094..05519958 100644
--- a/src/processor/module_serializer.cc
+++ b/src/processor/module_serializer.cc
@@ -32,6 +32,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/module_serializer.h"
#include <map>
@@ -107,10 +111,10 @@ char* ModuleSerializer::Write(const BasicSourceLineResolver::Module& module,
return dest;
}
-char* ModuleSerializer::Serialize(
- const BasicSourceLineResolver::Module& module, unsigned int* size) {
+char* ModuleSerializer::Serialize(const BasicSourceLineResolver::Module& module,
+ size_t* size) {
// Compute size of memory to allocate.
- unsigned int size_to_alloc = SizeOf(module);
+ const size_t size_to_alloc = SizeOf(module);
// Allocate memory for serialized data.
char* serialized_data = new char[size_to_alloc];
@@ -124,8 +128,8 @@ char* ModuleSerializer::Serialize(
// Write serialized data to allocated memory chunk.
char* end_address = Write(module, serialized_data);
// Verify the allocated memory size is equal to the size of data been written.
- unsigned int size_written =
- static_cast<unsigned int>(end_address - serialized_data);
+ const size_t size_written =
+ static_cast<size_t>(end_address - serialized_data);
if (size_to_alloc != size_written) {
BPLOG(ERROR) << "size_to_alloc differs from size_written: "
<< size_to_alloc << " vs " << size_written;
@@ -134,6 +138,7 @@ char* ModuleSerializer::Serialize(
// Set size and return the start address of memory chunk.
if (size)
*size = size_to_alloc;
+
return serialized_data;
}
@@ -146,7 +151,7 @@ bool ModuleSerializer::SerializeModuleAndLoadIntoFastResolver(
BasicSourceLineResolver::Module* basic_module =
dynamic_cast<BasicSourceLineResolver::Module*>(iter->second);
- unsigned int size = 0;
+ size_t size = 0;
scoped_array<char> symbol_data(Serialize(*basic_module, &size));
if (!symbol_data.get()) {
BPLOG(ERROR) << "Serialization failed for module: " << basic_module->name_;
@@ -197,8 +202,8 @@ bool ModuleSerializer::ConvertOneModule(
return SerializeModuleAndLoadIntoFastResolver(iter, fast_resolver);
}
-char* ModuleSerializer::SerializeSymbolFileData(
- const string& symbol_data, unsigned int* size) {
+char* ModuleSerializer::SerializeSymbolFileData(const string& symbol_data,
+ size_t* size) {
scoped_ptr<BasicSourceLineResolver::Module> module(
new BasicSourceLineResolver::Module("no name"));
scoped_array<char> buffer(new char[symbol_data.size() + 1]);
diff --git a/src/processor/module_serializer.h b/src/processor/module_serializer.h
index 4e365a41..fd387cbb 100644
--- a/src/processor/module_serializer.h
+++ b/src/processor/module_serializer.h
@@ -72,13 +72,13 @@ class ModuleSerializer {
// Caller takes the ownership of the memory chunk (allocated on heap), and
// owner should call delete [] to free the memory after use.
char* Serialize(const BasicSourceLineResolver::Module& module,
- unsigned int* size = NULL);
+ size_t* size = nullptr);
// Given the string format symbol_data, produces a chunk of serialized data.
// Caller takes ownership of the serialized data (on heap), and owner should
// call delete [] to free the memory after use.
char* SerializeSymbolFileData(const string& symbol_data,
- unsigned int* size = NULL);
+ size_t* size = nullptr);
// Serializes one loaded module with given moduleid in the basic source line
// resolver, and loads the serialized data into the fast source line resolver.
diff --git a/src/processor/pathname_stripper.cc b/src/processor/pathname_stripper.cc
index f34b53f7..11dc6974 100644
--- a/src/processor/pathname_stripper.cc
+++ b/src/processor/pathname_stripper.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/pathname_stripper.h"
namespace google_breakpad {
diff --git a/src/processor/pathname_stripper_unittest.cc b/src/processor/pathname_stripper_unittest.cc
index ff474a7b..c5c39cc8 100644
--- a/src/processor/pathname_stripper_unittest.cc
+++ b/src/processor/pathname_stripper_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include "processor/pathname_stripper.h"
diff --git a/src/processor/postfix_evaluator_unittest.cc b/src/processor/postfix_evaluator_unittest.cc
index 76d85751..d3c52409 100644
--- a/src/processor/postfix_evaluator_unittest.cc
+++ b/src/processor/postfix_evaluator_unittest.cc
@@ -30,6 +30,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <stdio.h>
diff --git a/src/processor/proc_maps_linux.cc b/src/processor/proc_maps_linux.cc
index 05c1145a..6fcb909a 100644
--- a/src/processor/proc_maps_linux.cc
+++ b/src/processor/proc_maps_linux.cc
@@ -6,6 +6,10 @@
#define __STDC_FORMAT_MACROS
#endif
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/proc_maps_linux.h"
#include <fcntl.h>
diff --git a/src/processor/proc_maps_linux_unittest.cc b/src/processor/proc_maps_linux_unittest.cc
index dc51babb..3d683cad 100644
--- a/src/processor/proc_maps_linux_unittest.cc
+++ b/src/processor/proc_maps_linux_unittest.cc
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/proc_maps_linux.h"
diff --git a/src/processor/process_state.cc b/src/processor/process_state.cc
index 95bbd48d..c5c38b6c 100644
--- a/src/processor/process_state.cc
+++ b/src/processor/process_state.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/process_state.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"
diff --git a/src/processor/range_map_truncate_lower_unittest.cc b/src/processor/range_map_truncate_lower_unittest.cc
index 12dad873..b3599fc5 100644
--- a/src/processor/range_map_truncate_lower_unittest.cc
+++ b/src/processor/range_map_truncate_lower_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <limits.h>
#include <stdio.h>
diff --git a/src/processor/range_map_truncate_upper_unittest.cc b/src/processor/range_map_truncate_upper_unittest.cc
index 57046e19..aa058ad4 100644
--- a/src/processor/range_map_truncate_upper_unittest.cc
+++ b/src/processor/range_map_truncate_upper_unittest.cc
@@ -31,6 +31,10 @@
//
// Author: Ivan Penkov
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <limits.h>
#include <stdio.h>
diff --git a/src/processor/range_map_unittest.cc b/src/processor/range_map_unittest.cc
index 2745e809..8735bb09 100644
--- a/src/processor/range_map_unittest.cc
+++ b/src/processor/range_map_unittest.cc
@@ -31,6 +31,10 @@
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <limits.h>
#include <stdio.h>
diff --git a/src/processor/simple_symbol_supplier.cc b/src/processor/simple_symbol_supplier.cc
index 5b3f6819..0de34c94 100644
--- a/src/processor/simple_symbol_supplier.cc
+++ b/src/processor/simple_symbol_supplier.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/simple_symbol_supplier.h"
#include <assert.h>
diff --git a/src/processor/source_line_resolver_base.cc b/src/processor/source_line_resolver_base.cc
index 5c0b6cd7..da9ff762 100644
--- a/src/processor/source_line_resolver_base.cc
+++ b/src/processor/source_line_resolver_base.cc
@@ -33,6 +33,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
diff --git a/src/processor/stack_frame_cpu.cc b/src/processor/stack_frame_cpu.cc
index e31a3198..4a4a052c 100644
--- a/src/processor/stack_frame_cpu.cc
+++ b/src/processor/stack_frame_cpu.cc
@@ -32,6 +32,10 @@
//
// Author: Colin Blundell
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/stack_frame_cpu.h"
namespace google_breakpad {
diff --git a/src/processor/stack_frame_symbolizer.cc b/src/processor/stack_frame_symbolizer.cc
index 0d124a02..3afd471b 100644
--- a/src/processor/stack_frame_symbolizer.cc
+++ b/src/processor/stack_frame_symbolizer.cc
@@ -31,6 +31,10 @@
// line information in a stack frame, and also looks up WindowsFrameInfo or
// CFIFrameInfo for a stack frame.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/stack_frame_symbolizer.h"
#include <assert.h>
diff --git a/src/processor/stackwalk_common.cc b/src/processor/stackwalk_common.cc
index a1b6364d..688b2782 100644
--- a/src/processor/stackwalk_common.cc
+++ b/src/processor/stackwalk_common.cc
@@ -31,6 +31,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/stackwalk_common.h"
#include <assert.h>
@@ -273,6 +277,32 @@ static void PrintStackContents(const string& indent,
printf("\n");
}
+static void PrintFrameHeader(const StackFrame* frame, int frame_index) {
+ printf("%2d ", frame_index);
+
+ uint64_t instruction_address = frame->ReturnAddress();
+
+ if (frame->module) {
+ printf("%s", PathnameStripper::File(frame->module->code_file()).c_str());
+ if (!frame->function_name.empty()) {
+ printf("!%s", frame->function_name.c_str());
+ if (!frame->source_file_name.empty()) {
+ string source_file = PathnameStripper::File(frame->source_file_name);
+ printf(" [%s : %d + 0x%" PRIx64 "]", source_file.c_str(),
+ frame->source_line,
+ instruction_address - frame->source_line_base);
+ } else {
+ printf(" + 0x%" PRIx64, instruction_address - frame->function_base);
+ }
+ } else {
+ printf(" + 0x%" PRIx64,
+ instruction_address - frame->module->base_address());
+ }
+ } else {
+ printf("0x%" PRIx64, instruction_address);
+ }
+}
+
// PrintStack prints the call stack in |stack| to stdout, in a reasonably
// useful form. Module, function, and source file names are displayed if
// they are available. The code offset to the base code address of the
@@ -294,30 +324,7 @@ static void PrintStack(const CallStack* stack,
}
for (int frame_index = 0; frame_index < frame_count; ++frame_index) {
const StackFrame* frame = stack->frames()->at(frame_index);
- printf("%2d ", frame_index);
-
- uint64_t instruction_address = frame->ReturnAddress();
-
- if (frame->module) {
- printf("%s", PathnameStripper::File(frame->module->code_file()).c_str());
- if (!frame->function_name.empty()) {
- printf("!%s", frame->function_name.c_str());
- if (!frame->source_file_name.empty()) {
- string source_file = PathnameStripper::File(frame->source_file_name);
- printf(" [%s : %d + 0x%" PRIx64 "]",
- source_file.c_str(),
- frame->source_line,
- instruction_address - frame->source_line_base);
- } else {
- printf(" + 0x%" PRIx64, instruction_address - frame->function_base);
- }
- } else {
- printf(" + 0x%" PRIx64,
- instruction_address - frame->module->base_address());
- }
- } else {
- printf("0x%" PRIx64, instruction_address);
- }
+ PrintFrameHeader(frame, frame_index);
printf("\n ");
// Inlined frames don't have registers info.
@@ -1277,4 +1284,21 @@ void PrintProcessStateMachineReadable(const ProcessState& process_state) {
}
}
+void PrintRequestingThreadBrief(const ProcessState& process_state) {
+ int requesting_thread = process_state.requesting_thread();
+ if (requesting_thread == -1) {
+ printf(" <no crashing or requesting dump thread identified>\n");
+ return;
+ }
+
+ printf("Thread %d (%s)\n", requesting_thread,
+ process_state.crashed() ? "crashed" : "requested dump, did not crash");
+ const CallStack* stack = process_state.threads()->at(requesting_thread);
+ int frame_count = stack->frames()->size();
+ for (int frame_index = 0; frame_index < frame_count; ++frame_index) {
+ PrintFrameHeader(stack->frames()->at(frame_index), frame_index);
+ printf("\n");
+ }
+}
+
} // namespace google_breakpad
diff --git a/src/processor/stackwalk_common.h b/src/processor/stackwalk_common.h
index bb12b98f..3782f987 100644
--- a/src/processor/stackwalk_common.h
+++ b/src/processor/stackwalk_common.h
@@ -43,6 +43,7 @@ void PrintProcessState(const ProcessState& process_state,
bool output_stack_contents,
bool output_requesting_thread_only,
SourceLineResolverInterface* resolver);
+void PrintRequestingThreadBrief(const ProcessState& process_state);
} // namespace google_breakpad
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
index e607b721..1ff6cf7c 100644
--- a/src/processor/stackwalker.cc
+++ b/src/processor/stackwalker.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/stackwalker.h"
#include <assert.h>
diff --git a/src/processor/stackwalker_address_list.cc b/src/processor/stackwalker_address_list.cc
index b393d475..7c346c66 100644
--- a/src/processor/stackwalker_address_list.cc
+++ b/src/processor/stackwalker_address_list.cc
@@ -32,6 +32,10 @@
//
// Author: Chris Hamilton <chrisha@chromium.org>
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <vector>
diff --git a/src/processor/stackwalker_address_list.h b/src/processor/stackwalker_address_list.h
index 28d377c3..d27f3fb2 100644
--- a/src/processor/stackwalker_address_list.h
+++ b/src/processor/stackwalker_address_list.h
@@ -36,7 +36,6 @@
#ifndef PROCESSOR_STACKWALKER_ADDRESS_LIST_H_
#define PROCESSOR_STACKWALKER_ADDRESS_LIST_H_
-#include "common/basictypes.h"
#include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/stackwalker.h"
@@ -53,6 +52,8 @@ class StackwalkerAddressList : public Stackwalker {
size_t frame_count,
const CodeModules* modules,
StackFrameSymbolizer* frame_symbolizer);
+ StackwalkerAddressList(const StackwalkerAddressList&) = delete;
+ void operator=(const StackwalkerAddressList&) = delete;
private:
// Implementation of Stackwalker.
@@ -62,8 +63,6 @@ class StackwalkerAddressList : public Stackwalker {
const uint64_t* frames_;
size_t frame_count_;
-
- DISALLOW_COPY_AND_ASSIGN(StackwalkerAddressList);
};
} // namespace google_breakpad
diff --git a/src/processor/stackwalker_address_list_unittest.cc b/src/processor/stackwalker_address_list_unittest.cc
index feda6268..1b5a4fc7 100644
--- a/src/processor/stackwalker_address_list_unittest.cc
+++ b/src/processor/stackwalker_address_list_unittest.cc
@@ -31,6 +31,10 @@
//
// Author: Chris Hamilton <chrisha@chromium.org>
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_amd64.cc b/src/processor/stackwalker_amd64.cc
index 6a539709..b934e73b 100644
--- a/src/processor/stackwalker_amd64.cc
+++ b/src/processor/stackwalker_amd64.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai, Ted Mielczarek
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include "common/scoped_ptr.h"
diff --git a/src/processor/stackwalker_amd64_unittest.cc b/src/processor/stackwalker_amd64_unittest.cc
index a7e513e9..88f6ef7f 100644
--- a/src/processor/stackwalker_amd64_unittest.cc
+++ b/src/processor/stackwalker_amd64_unittest.cc
@@ -30,6 +30,10 @@
// stackwalker_amd64_unittest.cc: Unit tests for StackwalkerAMD64 class.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_arm.cc b/src/processor/stackwalker_arm.cc
index 7df2eb6d..5f6f3e8d 100644
--- a/src/processor/stackwalker_arm.cc
+++ b/src/processor/stackwalker_arm.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai, Ted Mielczarek, Jim Blandy
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <vector>
#include "common/scoped_ptr.h"
diff --git a/src/processor/stackwalker_arm64.cc b/src/processor/stackwalker_arm64.cc
index ae3a0595..9c09835f 100644
--- a/src/processor/stackwalker_arm64.cc
+++ b/src/processor/stackwalker_arm64.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai, Ted Mielczarek, Jim Blandy, Colin Blundell
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <vector>
#include "common/scoped_ptr.h"
diff --git a/src/processor/stackwalker_arm64_unittest.cc b/src/processor/stackwalker_arm64_unittest.cc
index 37475058..f302d7d5 100644
--- a/src/processor/stackwalker_arm64_unittest.cc
+++ b/src/processor/stackwalker_arm64_unittest.cc
@@ -30,6 +30,10 @@
// stackwalker_arm64_unittest.cc: Unit tests for StackwalkerARM64 class.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_arm_unittest.cc b/src/processor/stackwalker_arm_unittest.cc
index 20c810a7..6103e202 100644
--- a/src/processor/stackwalker_arm_unittest.cc
+++ b/src/processor/stackwalker_arm_unittest.cc
@@ -30,6 +30,10 @@
// stackwalker_arm_unittest.cc: Unit tests for StackwalkerARM class.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_mips.cc b/src/processor/stackwalker_mips.cc
index 11b08fae..7195c162 100644
--- a/src/processor/stackwalker_mips.cc
+++ b/src/processor/stackwalker_mips.cc
@@ -32,6 +32,10 @@
//
// Author: Tata Elxsi
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"
diff --git a/src/processor/stackwalker_mips64_unittest.cc b/src/processor/stackwalker_mips64_unittest.cc
index aefcf8ee..55b7503f 100644
--- a/src/processor/stackwalker_mips64_unittest.cc
+++ b/src/processor/stackwalker_mips64_unittest.cc
@@ -31,6 +31,10 @@
// stackwalker_mips64_unittest.cc: Unit tests for StackwalkerMIPS class for
// mips64 platforms.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_mips_unittest.cc b/src/processor/stackwalker_mips_unittest.cc
index ac7324c4..305f4db8 100644
--- a/src/processor/stackwalker_mips_unittest.cc
+++ b/src/processor/stackwalker_mips_unittest.cc
@@ -30,6 +30,10 @@
// stackwalker_mips_unittest.cc: Unit tests for StackwalkerMIPS class.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_ppc.cc b/src/processor/stackwalker_ppc.cc
index e71d9138..0083392b 100644
--- a/src/processor/stackwalker_ppc.cc
+++ b/src/processor/stackwalker_ppc.cc
@@ -33,6 +33,10 @@
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/scoped_ptr.h"
#include "processor/stackwalker_ppc.h"
#include "google_breakpad/processor/call_stack.h"
diff --git a/src/processor/stackwalker_ppc64.cc b/src/processor/stackwalker_ppc64.cc
index 9ac8e45b..c36d16be 100644
--- a/src/processor/stackwalker_ppc64.cc
+++ b/src/processor/stackwalker_ppc64.cc
@@ -31,6 +31,10 @@
// See stackwalker_ppc64.h for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/scoped_ptr.h"
#include "processor/stackwalker_ppc64.h"
#include "google_breakpad/processor/call_stack.h"
diff --git a/src/processor/stackwalker_riscv.cc b/src/processor/stackwalker_riscv.cc
index 3d8a64f4..c3681a61 100644
--- a/src/processor/stackwalker_riscv.cc
+++ b/src/processor/stackwalker_riscv.cc
@@ -33,6 +33,10 @@
* Author: Iacopo Colonnelli
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"
diff --git a/src/processor/stackwalker_riscv64.cc b/src/processor/stackwalker_riscv64.cc
index d97bad63..0ed7b5e6 100644
--- a/src/processor/stackwalker_riscv64.cc
+++ b/src/processor/stackwalker_riscv64.cc
@@ -33,6 +33,10 @@
* Author: Iacopo Colonnelli
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"
diff --git a/src/processor/stackwalker_riscv64_unittest.cc b/src/processor/stackwalker_riscv64_unittest.cc
index 73c06264..c8579b9b 100644
--- a/src/processor/stackwalker_riscv64_unittest.cc
+++ b/src/processor/stackwalker_riscv64_unittest.cc
@@ -31,6 +31,10 @@
* Author: Iacopo Colonnelli
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_riscv_unittest.cc b/src/processor/stackwalker_riscv_unittest.cc
index f4a6b79c..37f0e233 100644
--- a/src/processor/stackwalker_riscv_unittest.cc
+++ b/src/processor/stackwalker_riscv_unittest.cc
@@ -31,6 +31,10 @@
* Author: Iacopo Colonnelli
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
#include <vector>
diff --git a/src/processor/stackwalker_selftest.cc b/src/processor/stackwalker_selftest.cc
index 2737f64d..4f3483b4 100644
--- a/src/processor/stackwalker_selftest.cc
+++ b/src/processor/stackwalker_selftest.cc
@@ -48,6 +48,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include "processor/logging.h"
diff --git a/src/processor/stackwalker_sparc.cc b/src/processor/stackwalker_sparc.cc
index fb76744c..ed7f7dc3 100644
--- a/src/processor/stackwalker_sparc.cc
+++ b/src/processor/stackwalker_sparc.cc
@@ -33,6 +33,10 @@
// Author: Michael Shang
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/memory_region.h"
#include "google_breakpad/processor/stack_frame_cpu.h"
diff --git a/src/processor/stackwalker_x86.cc b/src/processor/stackwalker_x86.cc
index b598c5bd..9bda5f8c 100644
--- a/src/processor/stackwalker_x86.cc
+++ b/src/processor/stackwalker_x86.cc
@@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <string>
diff --git a/src/processor/stackwalker_x86_unittest.cc b/src/processor/stackwalker_x86_unittest.cc
index 3d786b8e..b614b0e4 100644
--- a/src/processor/stackwalker_x86_unittest.cc
+++ b/src/processor/stackwalker_x86_unittest.cc
@@ -30,6 +30,10 @@
// stackwalker_x86_unittest.cc: Unit tests for StackwalkerX86 class.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include <vector>
diff --git a/src/processor/static_address_map_unittest.cc b/src/processor/static_address_map_unittest.cc
index 2e206a09..aebab976 100644
--- a/src/processor/static_address_map_unittest.cc
+++ b/src/processor/static_address_map_unittest.cc
@@ -30,6 +30,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <climits>
#include <cstdlib>
#include <ctime>
diff --git a/src/processor/static_contained_range_map_unittest.cc b/src/processor/static_contained_range_map_unittest.cc
index cdc11c1d..d0507a4b 100644
--- a/src/processor/static_contained_range_map_unittest.cc
+++ b/src/processor/static_contained_range_map_unittest.cc
@@ -31,6 +31,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/scoped_ptr.h"
#include "processor/contained_range_map-inl.h"
diff --git a/src/processor/static_map_unittest.cc b/src/processor/static_map_unittest.cc
index 4360e8c6..67b201b6 100644
--- a/src/processor/static_map_unittest.cc
+++ b/src/processor/static_map_unittest.cc
@@ -30,6 +30,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <climits>
#include <map>
diff --git a/src/processor/static_range_map_unittest.cc b/src/processor/static_range_map_unittest.cc
index 3903e948..d4ddec0c 100644
--- a/src/processor/static_range_map_unittest.cc
+++ b/src/processor/static_range_map_unittest.cc
@@ -30,6 +30,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "common/scoped_ptr.h"
#include "processor/range_map-inl.h"
diff --git a/src/processor/symbolic_constants_win.cc b/src/processor/symbolic_constants_win.cc
index 0c57b686..98c2b4dd 100644
--- a/src/processor/symbolic_constants_win.cc
+++ b/src/processor/symbolic_constants_win.cc
@@ -32,6 +32,10 @@
//
// Author: Ben Wagner
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include "common/stdio_wrapper.h"
diff --git a/src/processor/synth_minidump.cc b/src/processor/synth_minidump.cc
index 9dacb395..e51d1060 100644
--- a/src/processor/synth_minidump.cc
+++ b/src/processor/synth_minidump.cc
@@ -30,6 +30,10 @@
// synth_minidump.cc: Implementation of SynthMinidump. See synth_minidump.h
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "processor/synth_minidump.h"
namespace google_breakpad {
diff --git a/src/processor/synth_minidump_unittest.cc b/src/processor/synth_minidump_unittest.cc
index 4bc46747..3b803afe 100644
--- a/src/processor/synth_minidump_unittest.cc
+++ b/src/processor/synth_minidump_unittest.cc
@@ -31,6 +31,10 @@
// synth_minidump_unittest.cc: Unit tests for google_breakpad::SynthMinidump
// classes.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <sstream>
#include <string>
diff --git a/src/processor/testdata/linux_test_app.cc b/src/processor/testdata/linux_test_app.cc
index 4ff4f707..b0bbb669 100644
--- a/src/processor/testdata/linux_test_app.cc
+++ b/src/processor/testdata/linux_test_app.cc
@@ -38,6 +38,10 @@
// generate an executable with STABS symbols (needs -m32), or -gdwarf-2 for one
// with DWARF symbols (32- or 64-bit)
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/src/processor/testdata/test_app.cc b/src/processor/testdata/test_app.cc
index 79cabef0..83468fbb 100644
--- a/src/processor/testdata/test_app.cc
+++ b/src/processor/testdata/test_app.cc
@@ -31,6 +31,10 @@
// google_breakpad/src/client/windows/releasestaticcrt/exception_handler.lib
// Then run test_app to generate a dump, and dump_syms to create the .sym file.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include "client/windows/handler/exception_handler.h"
diff --git a/src/processor/tokenize.cc b/src/processor/tokenize.cc
index 4e62f2ea..a46c9644 100644
--- a/src/processor/tokenize.cc
+++ b/src/processor/tokenize.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include <string>
diff --git a/src/third_party/libdisasm/x86_format.c b/src/third_party/libdisasm/x86_format.c
index 0ec960dc..bb547ad4 100644
--- a/src/third_party/libdisasm/x86_format.c
+++ b/src/third_party/libdisasm/x86_format.c
@@ -29,7 +29,7 @@
} while( 0 )
#define STRNCATF( buf, fmt, data, len ) do { \
- char _tmp[MAX_OP_STRING]; \
+ char _tmp[MAX_OP_XML_STRING]; \
\
snprintf( _tmp, sizeof _tmp, fmt, data ); \
STRNCAT( buf, _tmp, len ); \
diff --git a/src/third_party/mac_headers/README b/src/third_party/mac_headers/README
index c681bb3d..2b855b60 100644
--- a/src/third_party/mac_headers/README
+++ b/src/third_party/mac_headers/README
@@ -1,2 +1,25 @@
-These headers were copied from the Mac OS X 10.7 SDK to enable building
-the Mac dump_syms code that processes Mach-O files on Linux.
+These headers were copied to enable building the Mac dump_syms code that
+processes Mach-O files on Linux.
+
+From xnu-8792.41.9 (https://github.com/apple-oss-distributions/xnu at 5c2921b)
+i386/_types.h
+arm/_types.h
+mach/boolean.h
+mach/machine.h
+mach/thread_status.h
+mach/vm_prot.h
+mach/i386/boolean.h
+mach/i386/vm_types.h
+mach/arm/boolean.h
+mach/arm/vm_types.h
+mach/machine/boolean.h
+mach/machine/vm_types.h
+
+From cctools-986 (https://github.com/apple-oss-distributions/cctools at cbe977a)
+mach-o/arch.h
+mach-o/fat.h
+mach-o/loader.h
+mach-o/nlist.h
+
+From architecture-282 (https://github.com/apple-oss-distributions/architecture at fe86900)
+architecture/byte_order.h
diff --git a/src/third_party/mac_headers/architecture/byte_order.h b/src/third_party/mac_headers/architecture/byte_order.h
index b772d9f3..1f723ae1 100644
--- a/src/third_party/mac_headers/architecture/byte_order.h
+++ b/src/third_party/mac_headers/architecture/byte_order.h
@@ -2,14 +2,14 @@
* Copyright (c) 1999-2008 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -17,7 +17,7 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_LICENSE_HEADER_END@
*/
/*
@@ -26,20 +26,14 @@
* Byte ordering conversion.
*
*/
-/* This file mostly left blank */
-#ifndef _ARCHITECTURE_BYTE_ORDER_H_
+#ifndef _ARCHITECTURE_BYTE_ORDER_H_
#define _ARCHITECTURE_BYTE_ORDER_H_
-/*
- * Identify the byte order
- * of the current host.
- */
-
enum NXByteOrder {
NX_UnknownByteOrder,
NX_LittleEndian,
NX_BigEndian
};
-#endif /* _ARCHITECTURE_BYTE_ORDER_H_ */
+#endif /* _ARCHITECTURE_BYTE_ORDER_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/arm/_types.h b/src/third_party/mac_headers/arm/_types.h
new file mode 100644
index 00000000..f464d6bd
--- /dev/null
+++ b/src/third_party/mac_headers/arm/_types.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ */
+#ifndef _BSD_ARM__TYPES_H_
+#define _BSD_ARM__TYPES_H_
+
+#if defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
+
+
+typedef long __darwin_intptr_t;
+typedef unsigned int __darwin_natural_t;
+
+
+#endif /* defined (__arm__) || defined (__arm64__) || defined (__aarch64__) */
+
+#endif /* _BSD_ARM__TYPES_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/i386/_types.h b/src/third_party/mac_headers/i386/_types.h
index 2ed7fd67..c0478d3f 100644
--- a/src/third_party/mac_headers/i386/_types.h
+++ b/src/third_party/mac_headers/i386/_types.h
@@ -2,7 +2,7 @@
* Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,13 +22,17 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
-#ifndef _BSD_I386__TYPES_H_
-#define _BSD_I386__TYPES_H_
+#ifndef _BSD_I386__TYPES_H_
+#define _BSD_I386__TYPES_H_
+
+#if defined (__i386__) || defined (__x86_64__)
+
+typedef long __darwin_intptr_t;
+typedef unsigned int __darwin_natural_t;
-typedef long __darwin_intptr_t;
-typedef unsigned int __darwin_natural_t;
+#endif /* defined (__i386__) || defined (__x86_64__) */
-#endif /* _BSD_I386__TYPES_H_ */
+#endif /* _BSD_I386__TYPES_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach-o/arch.h b/src/third_party/mac_headers/mach-o/arch.h
index 526c10fc..29b81c5b 100644
--- a/src/third_party/mac_headers/mach-o/arch.h
+++ b/src/third_party/mac_headers/mach-o/arch.h
@@ -48,7 +48,7 @@ typedef struct {
const char *description;
} NXArchInfo;
-#if __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -72,6 +72,36 @@ extern const NXArchInfo *NXGetArchInfoFromName(const char *name);
extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
cpu_subtype_t cpusubtype);
+/* The above interfaces that return pointers to NXArchInfo structs in normal
+ * cases returns a pointer from the array returned in NXGetAllArchInfos().
+ * In some cases when the cputype is CPU_TYPE_I386 or CPU_TYPE_POWERPC it will
+ * retun malloc(3)'ed NXArchInfo struct which contains a string in the
+ * description field also a malloc(3)'ed pointer. To allow programs not to
+ * leak memory they can call NXFreeArchInfo() on pointers returned from the
+ * above interfaces. Since this is a new API on older systems can use the
+ * code below. Going forward the above interfaces will only return pointers
+ * from the array returned in NXGetAllArchInfos().
+ */
+extern void NXFreeArchInfo(const NXArchInfo *x);
+
+/* The code that can be used for NXFreeArchInfo() when it is not available is:
+ *
+ * static void NXFreeArchInfo(
+ * const NXArchInfo *x)
+ * {
+ * const NXArchInfo *p;
+ *
+ * p = NXGetAllArchInfos();
+ * while(p->name != NULL){
+ * if(x == p)
+ * return;
+ * p++;
+ * }
+ * free((char *)x->description);
+ * free((NXArchInfo *)x);
+ * }
+ */
+
/* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of
* fat_arch structs and selects the best one that matches (if any) and returns
* a pointer to that fat_arch struct (or NULL). The fat_arch structs must be
@@ -86,6 +116,21 @@ extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
struct fat_arch *fat_archs,
uint32_t nfat_archs);
+/* NXFindBestFatArch_64() is passed a cputype and cpusubtype and a set of
+ * fat_arch_64 structs and selects the best one that matches (if any) and
+ * returns a pointer to that fat_arch_64 struct (or NULL). The fat_arch_64
+ * structs must be in the host byte order and correct such that the fat_archs64
+ * really points to enough memory for nfat_arch structs. It is possible that
+ * this routine could fail if new cputypes or cpusubtypes are added and an old
+ * version of this routine is used. But if there is an exact match between the
+ * cputype and cpusubtype and one of the fat_arch_64 structs this routine will
+ * always succeed.
+ */
+extern struct fat_arch_64 *NXFindBestFatArch_64(cpu_type_t cputype,
+ cpu_subtype_t cpusubtype,
+ struct fat_arch_64 *fat_archs64,
+ uint32_t nfat_archs);
+
/* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two
* different cpusubtypes for the specified cputype. If the two cpusubtypes
* can't be combined (the specific subtypes are mutually exclusive) -1 is
@@ -98,8 +143,8 @@ extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
cpu_subtype_t cpusubtype1,
cpu_subtype_t cpusubtype2);
-#if __cplusplus
+#ifdef __cplusplus
}
#endif /* __cplusplus */
-#endif /* _MACH_O_ARCH_H_ */
+#endif /* _MACH_O_ARCH_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach-o/fat.h b/src/third_party/mac_headers/mach-o/fat.h
index e2bcf433..0e5927dc 100644
--- a/src/third_party/mac_headers/mach-o/fat.h
+++ b/src/third_party/mac_headers/mach-o/fat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2016 Apple, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
@@ -49,7 +49,7 @@
#define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */
struct fat_header {
- uint32_t magic; /* FAT_MAGIC */
+ uint32_t magic; /* FAT_MAGIC or FAT_MAGIC_64 */
uint32_t nfat_arch; /* number of structs that follow */
};
@@ -61,4 +61,23 @@ struct fat_arch {
uint32_t align; /* alignment as a power of 2 */
};
-#endif /* _MACH_O_FAT_H_ */
+/*
+ * The support for the 64-bit fat file format described here is a work in
+ * progress and not yet fully supported in all the Apple Developer Tools.
+ *
+ * When a slice is greater than 4mb or an offset to a slice is greater than 4mb
+ * then the 64-bit fat file format is used.
+ */
+#define FAT_MAGIC_64 0xcafebabf
+#define FAT_CIGAM_64 0xbfbafeca /* NXSwapLong(FAT_MAGIC_64) */
+
+struct fat_arch_64 {
+ cpu_type_t cputype; /* cpu specifier (int) */
+ cpu_subtype_t cpusubtype; /* machine specifier (int) */
+ uint64_t offset; /* file offset to this object file */
+ uint64_t size; /* size of this object file */
+ uint32_t align; /* alignment as a power of 2 */
+ uint32_t reserved; /* reserved */
+};
+
+#endif /* _MACH_O_FAT_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach-o/loader.h b/src/third_party/mac_headers/mach-o/loader.h
index ff18e29c..2b03dfdc 100644
--- a/src/third_party/mac_headers/mach-o/loader.h
+++ b/src/third_party/mac_headers/mach-o/loader.h
@@ -115,11 +115,14 @@ struct mach_header_64 {
#define MH_DYLIB 0x6 /* dynamically bound shared library */
#define MH_DYLINKER 0x7 /* dynamic link editor */
#define MH_BUNDLE 0x8 /* dynamically bound bundle file */
-#define MH_DYLIB_STUB 0x9 /* shared library stub for static */
- /* linking only, no section contents */
-#define MH_DSYM 0xa /* companion file with only debug */
- /* sections */
+#define MH_DYLIB_STUB 0x9 /* shared library stub for static
+ linking only, no section contents */
+#define MH_DSYM 0xa /* companion file with only debug
+ sections */
#define MH_KEXT_BUNDLE 0xb /* x86_64 kexts */
+#define MH_FILESET 0xc /* a file composed of other Mach-Os to
+ be run in the same userspace sharing
+ a single linkedit. */
/* Constants for the flags field of the mach_header */
#define MH_NOUNDEFS 0x1 /* the object file has no undefined
@@ -207,6 +210,25 @@ struct mach_header_64 {
require it. Only used in MH_EXECUTE
filetypes. */
+#define MH_APP_EXTENSION_SAFE 0x02000000 /* The code was linked for use in an
+ application extension. */
+
+#define MH_NLIST_OUTOFSYNC_WITH_DYLDINFO 0x04000000 /* The external symbols
+ listed in the nlist symbol table do
+ not include all the symbols listed in
+ the dyld info. */
+
+#define MH_SIM_SUPPORT 0x08000000 /* Allow LC_MIN_VERSION_MACOS and
+ LC_BUILD_VERSION load commands with
+ the platforms macOS, macCatalyst,
+ iOSSimulator, tvOSSimulator and
+ watchOSSimulator. */
+
+#define MH_DYLIB_IN_CACHE 0x80000000 /* Only for use on dylibs. When this bit
+ is set, the dylib is part of the dyld
+ shared cache, rather than loose in
+ the filesystem. */
+
/*
* The load commands directly follow the mach_header. The total size of all
* of the commands is given by the sizeofcmds field in the mach_header. All
@@ -290,6 +312,20 @@ struct load_command {
#define LC_FUNCTION_STARTS 0x26 /* compressed table of function start addresses */
#define LC_DYLD_ENVIRONMENT 0x27 /* string for dyld to treat
like environment variable */
+#define LC_MAIN (0x28|LC_REQ_DYLD) /* replacement for LC_UNIXTHREAD */
+#define LC_DATA_IN_CODE 0x29 /* table of non-instructions in __text */
+#define LC_SOURCE_VERSION 0x2A /* source version used to build binary */
+#define LC_DYLIB_CODE_SIGN_DRS 0x2B /* Code signing DRs copied from linked dylibs */
+#define LC_ENCRYPTION_INFO_64 0x2C /* 64-bit encrypted segment information */
+#define LC_LINKER_OPTION 0x2D /* linker options in MH_OBJECT files */
+#define LC_LINKER_OPTIMIZATION_HINT 0x2E /* optimization hints in MH_OBJECT files */
+#define LC_VERSION_MIN_TVOS 0x2F /* build for AppleTV min OS version */
+#define LC_VERSION_MIN_WATCHOS 0x30 /* build for Watch min OS version */
+#define LC_NOTE 0x31 /* arbitrary data included within a Mach-O file */
+#define LC_BUILD_VERSION 0x32 /* build for platform min OS version */
+#define LC_DYLD_EXPORTS_TRIE (0x33 | LC_REQ_DYLD) /* used with linkedit_data_command, payload is trie */
+#define LC_DYLD_CHAINED_FIXUPS (0x34 | LC_REQ_DYLD) /* used with linkedit_data_command */
+#define LC_FILESET_ENTRY (0x35 | LC_REQ_DYLD) /* used with fileset_entry_command */
/*
* A variable length string in a load command is represented by an lc_str
@@ -367,6 +403,9 @@ struct segment_command_64 { /* for 64-bit architectures */
first page of the segment is not
protected. All other pages of the
segment are protected. */
+#define SG_READ_ONLY 0x10 /* This segment is made read-only after fixups */
+
+
/*
* A segment is made up of zero or more sections. Non-MH_OBJECT files have
@@ -492,6 +531,8 @@ struct section_64 { /* for 64-bit architectures */
#define S_THREAD_LOCAL_INIT_FUNCTION_POINTERS 0x15 /* functions to call
to initialize TLV
values */
+#define S_INIT_FUNC_OFFSETS 0x16 /* 32-bit offsets to
+ initializers */
/*
* Constants for the section attributes part of the flags field of a section
@@ -753,14 +794,14 @@ struct dylinker_command {
* Thread commands contain machine-specific data structures suitable for
* use in the thread state primitives. The machine specific data structures
* follow the struct thread_command as follows.
- * Each flavor of machine specific data structure is preceded by an unsigned
- * long constant for the flavor of that data structure, an uint32_t
- * that is the count of longs of the size of the state data structure and then
+ * Each flavor of machine specific data structure is preceded by an uint32_t
+ * constant for the flavor of that data structure, an uint32_t that is the
+ * count of uint32_t's of the size of the state data structure and then
* the state data structure follows. This triple may be repeated for many
* flavors. The constants for the flavors, counts and state data structure
* definitions are expected to be in the header file <machine/thread_status.h>.
* These machine specific data structures sizes must be multiples of
- * 4 bytes The cmdsize reflects the total size of the thread_command
+ * 4 bytes. The cmdsize reflects the total size of the thread_command
* and all of the sizes of the constants for the flavors, counts and state
* data structures.
*
@@ -774,7 +815,7 @@ struct thread_command {
uint32_t cmd; /* LC_THREAD or LC_UNIXTHREAD */
uint32_t cmdsize; /* total size of this command */
/* uint32_t flavor flavor of thread state */
- /* uint32_t count count of longs in thread state */
+ /* uint32_t count count of uint32_t's in thread state */
/* struct XXX_thread_state state thread state for this flavor */
/* ... */
};
@@ -1149,7 +1190,11 @@ struct rpath_command {
*/
struct linkedit_data_command {
uint32_t cmd; /* LC_CODE_SIGNATURE, LC_SEGMENT_SPLIT_INFO,
- or LC_FUNCTION_STARTS */
+ LC_FUNCTION_STARTS, LC_DATA_IN_CODE,
+ LC_DYLIB_CODE_SIGN_DRS,
+ LC_LINKER_OPTIMIZATION_HINT,
+ LC_DYLD_EXPORTS_TRIE, or
+ LC_DYLD_CHAINED_FIXUPS. */
uint32_t cmdsize; /* sizeof(struct linkedit_data_command) */
uint32_t dataoff; /* file offset of data in __LINKEDIT segment */
uint32_t datasize; /* file size of data in __LINKEDIT segment */
@@ -1169,17 +1214,74 @@ struct encryption_info_command {
};
/*
+ * The encryption_info_command_64 contains the file offset and size of an
+ * of an encrypted segment (for use in x86_64 targets).
+ */
+struct encryption_info_command_64 {
+ uint32_t cmd; /* LC_ENCRYPTION_INFO_64 */
+ uint32_t cmdsize; /* sizeof(struct encryption_info_command_64) */
+ uint32_t cryptoff; /* file offset of encrypted range */
+ uint32_t cryptsize; /* file size of encrypted range */
+ uint32_t cryptid; /* which enryption system,
+ 0 means not-encrypted yet */
+ uint32_t pad; /* padding to make this struct's size a multiple
+ of 8 bytes */
+};
+
+/*
* The version_min_command contains the min OS version on which this
* binary was built to run.
*/
struct version_min_command {
uint32_t cmd; /* LC_VERSION_MIN_MACOSX or
- LC_VERSION_MIN_IPHONEOS */
+ LC_VERSION_MIN_IPHONEOS or
+ LC_VERSION_MIN_WATCHOS or
+ LC_VERSION_MIN_TVOS */
uint32_t cmdsize; /* sizeof(struct min_version_command) */
uint32_t version; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */
- uint32_t reserved; /* zero */
+ uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */
+};
+
+/*
+ * The build_version_command contains the min OS version on which this
+ * binary was built to run for its platform. The list of known platforms and
+ * tool values following it.
+ */
+struct build_version_command {
+ uint32_t cmd; /* LC_BUILD_VERSION */
+ uint32_t cmdsize; /* sizeof(struct build_version_command) plus */
+ /* ntools * sizeof(struct build_tool_version) */
+ uint32_t platform; /* platform */
+ uint32_t minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */
+ uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */
+ uint32_t ntools; /* number of tool entries following this */
+};
+
+struct build_tool_version {
+ uint32_t tool; /* enum for the tool */
+ uint32_t version; /* version number of the tool */
};
+/* Known values for the platform field above. */
+#define PLATFORM_MACOS 1
+#define PLATFORM_IOS 2
+#define PLATFORM_TVOS 3
+#define PLATFORM_WATCHOS 4
+#define PLATFORM_BRIDGEOS 5
+#define PLATFORM_MACCATALYST 6
+#define PLATFORM_IOSSIMULATOR 7
+#define PLATFORM_TVOSSIMULATOR 8
+#define PLATFORM_WATCHOSSIMULATOR 9
+#define PLATFORM_DRIVERKIT 10
+
+#ifndef __APPLE_BLEACH_SDK__
+#endif /* __APPLE_BLEACH_SDK__ */
+
+/* Known values for the tool field above. */
+#define TOOL_CLANG 1
+#define TOOL_SWIFT 2
+#define TOOL_LD 3
+
/*
* The dyld_info_command contains the file offsets and sizes of
* the new compressed form of the information dyld needs to
@@ -1265,14 +1367,19 @@ struct dyld_info_command {
* Nodes for a symbol start with a uleb128 that is the length of
* the exported symbol information for the string so far.
* If there is no exported symbol, the node starts with a zero byte.
- * If there is exported info, it follows the length. First is
- * a uleb128 containing flags. Normally, it is followed by a
- * uleb128 encoded offset which is location of the content named
+ * If there is exported info, it follows the length.
+ *
+ * First is a uleb128 containing flags. Normally, it is followed by
+ * a uleb128 encoded offset which is location of the content named
* by the symbol from the mach_header for the image. If the flags
* is EXPORT_SYMBOL_FLAGS_REEXPORT, then following the flags is
* a uleb128 encoded library ordinal, then a zero terminated
* UTF8 string. If the string is zero length, then the symbol
* is re-export from the specified dylib with the same name.
+ * If the flags is EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER, then following
+ * the flags is two uleb128s: the stub offset and the resolver offset.
+ * The stub is used by non-lazy pointers. The resolver is used
+ * by lazy pointers and must be called to get the actual address to use.
*
* After the optional exported symbol information is a byte of
* how many edges (0-255) that this node has leaving it,
@@ -1316,6 +1423,7 @@ struct dyld_info_command {
#define BIND_SPECIAL_DYLIB_SELF 0
#define BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE -1
#define BIND_SPECIAL_DYLIB_FLAT_LOOKUP -2
+#define BIND_SPECIAL_DYLIB_WEAK_LOOKUP -3
#define BIND_SYMBOL_FLAGS_WEAK_IMPORT 0x1
#define BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION 0x8
@@ -1335,6 +1443,9 @@ struct dyld_info_command {
#define BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB 0xA0
#define BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED 0xB0
#define BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB 0xC0
+#define BIND_OPCODE_THREADED 0xD0
+#define BIND_SUBOPCODE_THREADED_SET_BIND_ORDINAL_TABLE_SIZE_ULEB 0x00
+#define BIND_SUBOPCODE_THREADED_APPLY 0x01
/*
@@ -1344,9 +1455,23 @@ struct dyld_info_command {
#define EXPORT_SYMBOL_FLAGS_KIND_MASK 0x03
#define EXPORT_SYMBOL_FLAGS_KIND_REGULAR 0x00
#define EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL 0x01
+#define EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE 0x02
#define EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION 0x04
#define EXPORT_SYMBOL_FLAGS_REEXPORT 0x08
#define EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER 0x10
+#define EXPORT_SYMBOL_FLAGS_STATIC_RESOLVER 0x20
+
+
+/*
+ * The linker_option_command contains linker options embedded in object files.
+ */
+struct linker_option_command {
+ uint32_t cmd; /* LC_LINKER_OPTION only used in MH_OBJECT filetypes */
+ uint32_t cmdsize;
+ uint32_t count; /* number of strings */
+ /* concatenation of zero terminated UTF8 strings.
+ Zero filled at end to align */
+};
/*
* The symseg_command contains the offset and size of the GNU style
@@ -1388,6 +1513,50 @@ struct fvmfile_command {
uint32_t header_addr; /* files virtual address */
};
+
+/*
+ * The entry_point_command is a replacement for thread_command.
+ * It is used for main executables to specify the location (file offset)
+ * of main(). If -stack_size was used at link time, the stacksize
+ * field will contain the stack size need for the main thread.
+ */
+struct entry_point_command {
+ uint32_t cmd; /* LC_MAIN only used in MH_EXECUTE filetypes */
+ uint32_t cmdsize; /* 24 */
+ uint64_t entryoff; /* file (__TEXT) offset of main() */
+ uint64_t stacksize;/* if not zero, initial stack size */
+};
+
+
+/*
+ * The source_version_command is an optional load command containing
+ * the version of the sources used to build the binary.
+ */
+struct source_version_command {
+ uint32_t cmd; /* LC_SOURCE_VERSION */
+ uint32_t cmdsize; /* 16 */
+ uint64_t version; /* A.B.C.D.E packed as a24.b10.c10.d10.e10 */
+};
+
+
+/*
+ * The LC_DATA_IN_CODE load commands uses a linkedit_data_command
+ * to point to an array of data_in_code_entry entries. Each entry
+ * describes a range of data in a code section.
+ */
+struct data_in_code_entry {
+ uint32_t offset; /* from mach_header to start of data range*/
+ uint16_t length; /* number of bytes in data range */
+ uint16_t kind; /* a DICE_KIND_* value */
+};
+#define DICE_KIND_DATA 0x0001
+#define DICE_KIND_JUMP_TABLE8 0x0002
+#define DICE_KIND_JUMP_TABLE16 0x0003
+#define DICE_KIND_JUMP_TABLE32 0x0004
+#define DICE_KIND_ABS_JUMP_TABLE32 0x0005
+
+
+
/*
* Sections of type S_THREAD_LOCAL_VARIABLES contain an array
* of tlv_descriptor structures.
@@ -1399,4 +1568,39 @@ struct tlv_descriptor
unsigned long offset;
};
-#endif /* _MACHO_LOADER_H_ */
+/*
+ * LC_NOTE commands describe a region of arbitrary data included in a Mach-O
+ * file. Its initial use is to record extra data in MH_CORE files.
+ */
+struct note_command {
+ uint32_t cmd; /* LC_NOTE */
+ uint32_t cmdsize; /* sizeof(struct note_command) */
+ char data_owner[16]; /* owner name for this LC_NOTE */
+ uint64_t offset; /* file offset of this data */
+ uint64_t size; /* length of data region */
+};
+
+/*
+ * LC_FILESET_ENTRY commands describe constituent Mach-O files that are part
+ * of a fileset. In one implementation, entries are dylibs with individual
+ * mach headers and repositionable text and data segments. Each entry is
+ * further described by its own mach header.
+ */
+struct fileset_entry_command {
+ uint32_t cmd; /* LC_FILESET_ENTRY */
+ uint32_t cmdsize; /* includes entry_id string */
+ uint64_t vmaddr; /* memory address of the entry */
+ uint64_t fileoff; /* file offset of the entry */
+ union lc_str entry_id; /* contained entry id */
+ uint32_t reserved; /* reserved */
+};
+
+/*
+ * These deprecated values may still be used within Apple but are mechanically
+ * removed from public API. The mechanical process may produce unusual results.
+ */
+#if (!defined(PLATFORM_IOSMAC))
+#define PLATFORM_IOSMAC PLATFORM_MACCATALYST
+#endif
+
+#endif /* _MACHO_LOADER_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach-o/nlist.h b/src/third_party/mac_headers/mach-o/nlist.h
index 1c194101..7b979a52 100644
--- a/src/third_party/mac_headers/mach-o/nlist.h
+++ b/src/third_party/mac_headers/mach-o/nlist.h
@@ -78,7 +78,7 @@ struct nlist {
#ifndef __LP64__
char *n_name; /* for use when in-core */
#endif
- int32_t n_strx; /* index into the string table */
+ uint32_t n_strx; /* index into the string table */
} n_un;
uint8_t n_type; /* type flag, see below */
uint8_t n_sect; /* section number or NO_SECT */
@@ -296,17 +296,29 @@ struct nlist_64 {
*/
#define N_SYMBOL_RESOLVER 0x0100
+/*
+ * The N_ALT_ENTRY bit of the n_desc field indicates that the
+ * symbol is pinned to the previous content.
+ */
+#define N_ALT_ENTRY 0x0200
+
+/*
+ * The N_COLD_FUNC bit of the n_desc field indicates that the symbol is used
+ * infrequently and the linker should order it towards the end of the section.
+ */
+#define N_COLD_FUNC 0x0400
+
#ifndef __STRICT_BSD__
-#if __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* The function nlist(3) from the C library.
*/
extern int nlist (const char *filename, struct nlist *list);
-#if __cplusplus
+#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __STRICT_BSD__ */
-#endif /* _MACHO_LIST_H_ */
+#endif /* _MACHO_LIST_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/arm/boolean.h b/src/third_party/mac_headers/mach/arm/boolean.h
new file mode 100644
index 00000000..d653a394
--- /dev/null
+++ b/src/third_party/mac_headers/mach/arm/boolean.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ * File: boolean.h
+ *
+ * Boolean type, for ARM.
+ */
+
+#ifndef _MACH_ARM_BOOLEAN_H_
+#define _MACH_ARM_BOOLEAN_H_
+
+#if defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
+
+typedef int boolean_t;
+
+#endif /* defined (__arm__) || defined (__arm64__) */
+
+#endif /* _MACH_ARM_BOOLEAN_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/arm/vm_types.h b/src/third_party/mac_headers/mach/arm/vm_types.h
new file mode 100644
index 00000000..3650a869
--- /dev/null
+++ b/src/third_party/mac_headers/mach/arm/vm_types.h
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ * File: vm_types.h
+ * Author: Avadis Tevanian, Jr.
+ * Date: 1985
+ *
+ * Header file for VM data types. ARM version.
+ */
+
+#ifndef _MACH_ARM_VM_TYPES_H_
+#define _MACH_ARM_VM_TYPES_H_
+
+#if defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
+
+#ifndef ASSEMBLER
+
+#include <arm/_types.h>
+#include <stdint.h>
+#include <sys/cdefs.h>
+
+/*
+ * natural_t and integer_t are Mach's legacy types for machine-
+ * independent integer types (unsigned, and signed, respectively).
+ * Their original purpose was to define other types in a machine/
+ * compiler independent way.
+ *
+ * They also had an implicit "same size as pointer" characteristic
+ * to them (i.e. Mach's traditional types are very ILP32 or ILP64
+ * centric). We will likely support x86 ABIs that do not follow
+ * either ofthese models (specifically LP64). Therefore, we had to
+ * make a choice between making these types scale with pointers or stay
+ * tied to integers. Because their use is predominantly tied to
+ * to the size of an integer, we are keeping that association and
+ * breaking free from pointer size guarantees.
+ *
+ * New use of these types is discouraged.
+ */
+typedef __darwin_natural_t natural_t;
+typedef int integer_t;
+
+/*
+ * A vm_offset_t is a type-neutral pointer,
+ * e.g. an offset into a virtual memory space.
+ */
+#ifdef __LP64__
+typedef uintptr_t vm_offset_t ;
+typedef uintptr_t vm_size_t;
+
+typedef uint64_t mach_vm_address_t ;
+typedef uint64_t mach_vm_offset_t ;
+typedef uint64_t mach_vm_size_t;
+
+typedef uint64_t vm_map_offset_t ;
+typedef uint64_t vm_map_address_t ;
+typedef uint64_t vm_map_size_t;
+#else
+typedef natural_t vm_offset_t ;
+/*
+ * A vm_size_t is the proper type for e.g.
+ * expressing the difference between two
+ * vm_offset_t entities.
+ */
+typedef natural_t vm_size_t;
+
+/*
+ * This new type is independent of a particular vm map's
+ * implementation size - and represents appropriate types
+ * for all possible maps. This is used for interfaces
+ * where the size of the map is not known - or we don't
+ * want to have to distinguish.
+ */
+typedef uint64_t mach_vm_address_t ;
+typedef uint64_t mach_vm_offset_t ;
+typedef uint64_t mach_vm_size_t;
+
+typedef uint32_t vm_map_offset_t ;
+typedef uint32_t vm_map_address_t ;
+typedef uint32_t vm_map_size_t;
+#endif /* __LP64__ */
+
+
+typedef uint32_t vm32_offset_t;
+typedef uint32_t vm32_address_t;
+typedef uint32_t vm32_size_t;
+
+typedef vm_offset_t mach_port_context_t;
+
+#ifdef MACH_KERNEL_PRIVATE
+typedef vm32_offset_t mach_port_context32_t;
+typedef mach_vm_offset_t mach_port_context64_t;
+#endif
+
+#endif /* ASSEMBLER */
+
+/*
+ * If composing messages by hand (please do not)
+ */
+#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
+
+#endif /* defined (__arm__) || defined (__arm64__) || defined (__aarch64__) */
+
+#endif /* _MACH_ARM_VM_TYPES_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/boolean.h b/src/third_party/mac_headers/mach/boolean.h
index 641c3962..ba884293 100644
--- a/src/third_party/mac_headers/mach/boolean.h
+++ b/src/third_party/mac_headers/mach/boolean.h
@@ -2,7 +2,7 @@
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,34 +22,34 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
@@ -62,27 +62,27 @@
*
*/
-#ifndef _MACH_BOOLEAN_H_
-#define _MACH_BOOLEAN_H_
+#ifndef _MACH_BOOLEAN_H_
+#define _MACH_BOOLEAN_H_
/*
* Pick up "boolean_t" type definition
*/
-#ifndef ASSEMBLER
+#ifndef ASSEMBLER
#include <mach/machine/boolean.h>
-#endif /* ASSEMBLER */
+#endif /* ASSEMBLER */
/*
* Define TRUE and FALSE if not defined.
*/
-#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
-#ifndef FALSE
-#define FALSE 0
-#endif /* FALSE */
+#ifndef FALSE
+#define FALSE 0
+#endif /* FALSE */
-#endif /* _MACH_BOOLEAN_H_ */
+#endif /* _MACH_BOOLEAN_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/i386/boolean.h b/src/third_party/mac_headers/mach/i386/boolean.h
index 100f7e7b..b1d69a19 100644
--- a/src/third_party/mac_headers/mach/i386/boolean.h
+++ b/src/third_party/mac_headers/mach/i386/boolean.h
@@ -2,7 +2,7 @@
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,34 +22,34 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
@@ -62,13 +62,17 @@
* Boolean type, for I386.
*/
-#ifndef _MACH_I386_BOOLEAN_H_
+#ifndef _MACH_I386_BOOLEAN_H_
#define _MACH_I386_BOOLEAN_H_
+#if defined (__i386__) || defined (__x86_64__)
+
#if defined(__x86_64__) && !defined(KERNEL)
-typedef unsigned int boolean_t;
+typedef unsigned int boolean_t;
#else
-typedef int boolean_t;
+typedef int boolean_t;
#endif
-#endif /* _MACH_I386_BOOLEAN_H_ */
+#endif /* defined (__i386__) || defined (__x86_64__) */
+
+#endif /* _MACH_I386_BOOLEAN_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/i386/vm_param.h b/src/third_party/mac_headers/mach/i386/vm_param.h
deleted file mode 100644
index edcb8349..00000000
--- a/src/third_party/mac_headers/mach/i386/vm_param.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. The rights granted to you under the License
- * may not be used to create, or enable the creation or redistribution of,
- * unlawful or unlicensed copies of an Apple operating system, or to
- * circumvent, violate, or enable the circumvention or violation of, any
- * terms of an Apple operating system software license agreement.
- *
- * Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- *
- * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
- */
-/*
- * @OSF_COPYRIGHT@
- */
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-/*
- * Copyright (c) 1994 The University of Utah and
- * the Computer Systems Laboratory at the University of Utah (CSL).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the
- * Computer Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- */
-
-/*
- * File: vm_param.h
- * Author: Avadis Tevanian, Jr.
- * Date: 1985
- *
- * I386 machine dependent virtual memory parameters.
- * Most of the declarations are preceeded by I386_ (or i386_)
- * which is OK because only I386 specific code will be using
- * them.
- */
-
-#ifndef _MACH_I386_VM_PARAM_H_
-#define _MACH_I386_VM_PARAM_H_
-
-#define BYTE_SIZE 8 /* byte size in bits */
-
-#define I386_PGBYTES 4096 /* bytes per 80386 page */
-#define I386_PGSHIFT 12 /* bitshift for pages */
-
-#define PAGE_SIZE I386_PGBYTES
-#define PAGE_SHIFT I386_PGSHIFT
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-#define I386_LPGBYTES 2*1024*1024 /* bytes per large page */
-#define I386_LPGSHIFT 21 /* bitshift for large pages */
-#define I386_LPGMASK (I386_LPGBYTES-1)
-
-/*
- * Convert bytes to pages and convert pages to bytes.
- * No rounding is used.
- */
-
-#define i386_btop(x) ((ppnum_t)((x) >> I386_PGSHIFT))
-#define machine_btop(x) i386_btop(x)
-#define i386_ptob(x) (((pmap_paddr_t)(x)) << I386_PGSHIFT)
-
-/*
- * Round off or truncate to the nearest page. These will work
- * for either addresses or counts. (i.e. 1 byte rounds to 1 page
- * bytes.
- */
-
-#define i386_round_page(x) ((((pmap_paddr_t)(x)) + I386_PGBYTES - 1) & \
- ~(I386_PGBYTES-1))
-#define i386_trunc_page(x) (((pmap_paddr_t)(x)) & ~(I386_PGBYTES-1))
-
-
-
-#define VM_MIN_ADDRESS64 ((user_addr_t) 0x0000000000000000ULL)
-/*
- * default top of user stack... it grows down from here
- */
-#define VM_USRSTACK64 ((user_addr_t) 0x00007FFF5FC00000ULL)
-#define VM_DYLD64 ((user_addr_t) 0x00007FFF5FC00000ULL)
-#define VM_LIB64_SHR_DATA ((user_addr_t) 0x00007FFF60000000ULL)
-#define VM_LIB64_SHR_TEXT ((user_addr_t) 0x00007FFF80000000ULL)
-/*
- * the end of the usable user address space , for now about 47 bits.
- * the 64 bit commpage is past the end of this
- */
-#define VM_MAX_PAGE_ADDRESS ((user_addr_t) 0x00007FFFFFE00000ULL)
-/*
- * canonical end of user address space for limits checking
- */
-#define VM_MAX_USER_PAGE_ADDRESS ((user_addr_t)0x00007FFFFFFFF000ULL)
-
-
-/* system-wide values */
-#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
-#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_PAGE_ADDRESS)
-
-/* process-relative values (all 32-bit legacy only for now) */
-#define VM_MIN_ADDRESS ((vm_offset_t) 0)
-#define VM_USRSTACK32 ((vm_offset_t) 0xC0000000)
-#define VM_MAX_ADDRESS ((vm_offset_t) 0xFFE00000)
-
-
-
-#endif /* _MACH_I386_VM_PARAM_H_ */
diff --git a/src/third_party/mac_headers/mach/i386/vm_types.h b/src/third_party/mac_headers/mach/i386/vm_types.h
index 2c38fa2d..0c3bb6ba 100644
--- a/src/third_party/mac_headers/mach/i386/vm_types.h
+++ b/src/third_party/mac_headers/mach/i386/vm_types.h
@@ -1,8 +1,8 @@
/*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,34 +22,34 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
@@ -64,14 +64,16 @@
* Header file for VM data types. I386 version.
*/
-#ifndef _MACH_I386_VM_TYPES_H_
+#ifndef _MACH_I386_VM_TYPES_H_
#define _MACH_I386_VM_TYPES_H_
-#ifndef ASSEMBLER
+#if defined (__i386__) || defined (__x86_64__)
+
+#ifndef ASSEMBLER
#include <i386/_types.h>
-#include <mach/i386/vm_param.h>
#include <stdint.h>
+#include <sys/cdefs.h>
/*
* natural_t and integer_t are Mach's legacy types for machine-
@@ -90,18 +92,18 @@
*
* New use of these types is discouraged.
*/
-typedef __darwin_natural_t natural_t;
-typedef int integer_t;
+typedef __darwin_natural_t natural_t;
+typedef int integer_t;
/*
* A vm_offset_t is a type-neutral pointer,
* e.g. an offset into a virtual memory space.
*/
#ifdef __LP64__
-typedef uintptr_t vm_offset_t;
-#else /* __LP64__ */
-typedef natural_t vm_offset_t;
-#endif /* __LP64__ */
+typedef uintptr_t vm_offset_t ;
+#else /* __LP64__ */
+typedef natural_t vm_offset_t ;
+#endif /* __LP64__ */
/*
* A vm_size_t is the proper type for e.g.
@@ -109,10 +111,10 @@ typedef natural_t vm_offset_t;
* vm_offset_t entities.
*/
#ifdef __LP64__
-typedef uintptr_t vm_size_t;
-#else /* __LP64__ */
-typedef natural_t vm_size_t;
-#endif /* __LP64__ */
+typedef uintptr_t vm_size_t;
+#else /* __LP64__ */
+typedef natural_t vm_size_t;
+#endif /* __LP64__ */
/*
* This new type is independent of a particular vm map's
@@ -121,20 +123,35 @@ typedef natural_t vm_size_t;
* where the size of the map is not known - or we don't
* want to have to distinguish.
*/
-typedef uint64_t mach_vm_address_t;
-typedef uint64_t mach_vm_offset_t;
-typedef uint64_t mach_vm_size_t;
+typedef uint64_t mach_vm_address_t ;
+typedef uint64_t mach_vm_offset_t ;
+typedef uint64_t mach_vm_size_t;
+
+typedef uint64_t vm_map_offset_t ;
+typedef uint64_t vm_map_address_t ;
+typedef uint64_t vm_map_size_t;
+
+typedef mach_vm_address_t mach_port_context_t;
-typedef uint64_t vm_map_offset_t;
-typedef uint64_t vm_map_address_t;
-typedef uint64_t vm_map_size_t;
+#ifdef MACH_KERNEL_PRIVATE
+/*
+ * These are types used internal to Mach to implement the
+ * legacy 32-bit VM APIs published by the kernel.
+ */
+typedef uint32_t vm32_address_t;
+typedef uint32_t vm32_offset_t;
+typedef uint32_t vm32_size_t;
-#endif /* ASSEMBLER */
+#endif /* MACH_KERNEL_PRIVATE */
+
+#endif /* ASSEMBLER */
/*
* If composing messages by hand (please do not)
*/
-#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
+#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
+
+#endif /* defined (__i386__) || defined (__x86_64__) */
-#endif /* _MACH_I386_VM_TYPES_H_ */
+#endif /* _MACH_I386_VM_TYPES_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/machine.h b/src/third_party/mac_headers/mach/machine.h
index 5bb21e48..53457cca 100644
--- a/src/third_party/mac_headers/mach/machine.h
+++ b/src/third_party/mac_headers/mach/machine.h
@@ -1,8 +1,9 @@
/*
- * Copyright (c) 2000-2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2007-2016 Apple, Inc. All rights reserved.
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +12,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,31 +23,31 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
@@ -57,60 +58,114 @@
* Machine independent machine abstraction.
*/
-#ifndef _MACH_MACHINE_H_
+#ifndef _MACH_MACHINE_H_
#define _MACH_MACHINE_H_
+#ifndef __ASSEMBLER__
+
#include <stdint.h>
#include <mach/machine/vm_types.h>
#include <mach/boolean.h>
-typedef integer_t cpu_type_t;
-typedef integer_t cpu_subtype_t;
-typedef integer_t cpu_threadtype_t;
+typedef integer_t cpu_type_t;
+typedef integer_t cpu_subtype_t;
+typedef integer_t cpu_threadtype_t;
+
+#define CPU_STATE_MAX 4
+
+#define CPU_STATE_USER 0
+#define CPU_STATE_SYSTEM 1
+#define CPU_STATE_IDLE 2
+#define CPU_STATE_NICE 3
+
+#ifdef KERNEL_PRIVATE
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+cpu_type_t cpu_type(void);
+
+cpu_subtype_t cpu_subtype(void);
+
+cpu_threadtype_t cpu_threadtype(void);
+__END_DECLS
-#define CPU_STATE_MAX 4
+#ifdef MACH_KERNEL_PRIVATE
-#define CPU_STATE_USER 0
-#define CPU_STATE_SYSTEM 1
-#define CPU_STATE_IDLE 2
-#define CPU_STATE_NICE 3
+struct machine_info {
+ integer_t major_version; /* kernel major version id */
+ integer_t minor_version; /* kernel minor version id */
+ integer_t max_cpus; /* max number of CPUs possible */
+ uint32_t memory_size; /* size of memory in bytes, capped at 2 GB */
+ uint64_t max_mem; /* actual size of physical memory */
+ uint32_t physical_cpu; /* number of physical CPUs now available */
+ integer_t physical_cpu_max; /* max number of physical CPUs possible */
+ uint32_t logical_cpu; /* number of logical cpu now available */
+ integer_t logical_cpu_max; /* max number of physical CPUs possible */
+};
+typedef struct machine_info *machine_info_t;
+typedef struct machine_info machine_info_data_t;
+
+extern struct machine_info machine_info;
+
+__BEGIN_DECLS
+cpu_type_t slot_type(
+ int slot_num);
+
+cpu_subtype_t slot_subtype(
+ int slot_num);
+
+cpu_threadtype_t slot_threadtype(
+ int slot_num);
+__END_DECLS
+
+#endif /* MACH_KERNEL_PRIVATE */
+#endif /* KERNEL_PRIVATE */
/*
* Capability bits used in the definition of cpu_type.
*/
-#define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
-#define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
+#define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
+#define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
+#define CPU_ARCH_ABI64_32 0x02000000 /* ABI for 64-bit hardware with 32-bit types; LP32 */
/*
* Machine types known by all.
*/
-
-#define CPU_TYPE_ANY ((cpu_type_t) -1)
-#define CPU_TYPE_VAX ((cpu_type_t) 1)
+#define CPU_TYPE_ANY ((cpu_type_t) -1)
+
+#define CPU_TYPE_VAX ((cpu_type_t) 1)
/* skip ((cpu_type_t) 2) */
/* skip ((cpu_type_t) 3) */
/* skip ((cpu_type_t) 4) */
/* skip ((cpu_type_t) 5) */
-#define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
-#define CPU_TYPE_X86 ((cpu_type_t) 7)
-#define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
-#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
+#define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
+#define CPU_TYPE_X86 ((cpu_type_t) 7)
+#define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
+#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
/* skip CPU_TYPE_MIPS ((cpu_type_t) 8) */
-/* skip ((cpu_type_t) 9) */
-#define CPU_TYPE_MC98000 ((cpu_type_t) 10)
+/* skip ((cpu_type_t) 9) */
+#define CPU_TYPE_MC98000 ((cpu_type_t) 10)
#define CPU_TYPE_HPPA ((cpu_type_t) 11)
-#define CPU_TYPE_ARM ((cpu_type_t) 12)
-#define CPU_TYPE_MC88000 ((cpu_type_t) 13)
-#define CPU_TYPE_SPARC ((cpu_type_t) 14)
-#define CPU_TYPE_I860 ((cpu_type_t) 15)
+#define CPU_TYPE_ARM ((cpu_type_t) 12)
+#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
+#define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
+#define CPU_TYPE_MC88000 ((cpu_type_t) 13)
+#define CPU_TYPE_SPARC ((cpu_type_t) 14)
+#define CPU_TYPE_I860 ((cpu_type_t) 15)
/* skip CPU_TYPE_ALPHA ((cpu_type_t) 16) */
/* skip ((cpu_type_t) 17) */
-#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
-#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
+#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
+#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
+/* skip ((cpu_type_t) 19) */
+/* skip ((cpu_type_t) 20 */
+/* skip ((cpu_type_t) 21 */
+/* skip ((cpu_type_t) 22 */
+/* skip ((cpu_type_t) 23 */
/*
* Machine subtypes (these are defined here, instead of in a machine
@@ -121,9 +176,16 @@ typedef integer_t cpu_threadtype_t;
/*
* Capability bits used in the definition of cpu_subtype.
*/
-#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
-#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
+#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
+#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
+#define CPU_SUBTYPE_PTRAUTH_ABI 0x80000000 /* pointer authentication with versioned ABI */
+/*
+ * When selecting a slice, ANY will pick the slice with the best
+ * grading for the selected cpu_type_t, unlike the "ALL" subtypes,
+ * which are the slices that can run on any hardware for that cpu type.
+ */
+#define CPU_SUBTYPE_ANY ((cpu_subtype_t) -1)
/*
* Object files that are hand-crafted to run on any
@@ -136,42 +198,42 @@ typedef integer_t cpu_threadtype_t;
* It is the responsibility of the implementor to make sure the
* software handles unsupported implementations elegantly.
*/
-#define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
-#define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
+#define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
/*
* Machine threadtypes.
* This is none - not defined - for most machine types/subtypes.
*/
-#define CPU_THREADTYPE_NONE ((cpu_threadtype_t) 0)
+#define CPU_THREADTYPE_NONE ((cpu_threadtype_t) 0)
/*
* VAX subtypes (these do *not* necessary conform to the actual cpu
* ID assigned by DEC available via the SID register).
*/
-#define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
-#define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
-#define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
-#define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
-#define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
-#define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
-#define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
-#define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
-#define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
-#define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
-#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
-#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
+#define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
+#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
/*
- * 680x0 subtypes
+ * 680x0 subtypes
*
* The subtype definitions here are unusual for historical reasons.
* NeXT used to consider 68030 code as generic 68000 code. For
* backwards compatability:
- *
+ *
* CPU_SUBTYPE_MC68030 symbol has been preserved for source code
* compatability.
*
@@ -182,119 +244,119 @@ typedef integer_t cpu_threadtype_t;
* files to be tagged as containing 68030-specific instructions.
*/
-#define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
-#define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
-#define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
-#define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
+#define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
/*
* I386 subtypes
*/
-#define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
-
-#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
-#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
-#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
-#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
-#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
-#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
-#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
-#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
-#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
-#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
-#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
-#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
-#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
-#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
-#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
-#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
-#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
-#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
-#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
-#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
-#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
-
-#define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
-#define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
-
-#define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
-#define CPU_SUBTYPE_INTEL_MODEL_ALL 0
+#define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
+
+#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
+#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
+#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
+#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
+#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
+#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
+#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
+#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
+#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
+#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
+#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
+#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
+#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
+#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
+#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
+#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
+#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
+#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
+#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
+#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
+#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
+
+#define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
+#define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
+
+#define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
+#define CPU_SUBTYPE_INTEL_MODEL_ALL 0
/*
* X86 subtypes.
*/
-#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
-#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
-#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
-#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
+#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
+#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
+#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
+#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
-#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)
+#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)
/*
* Mips subtypes.
*/
-#define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
-#define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
-#define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
-#define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
-#define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
-#define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
-#define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
+#define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
+#define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
/*
* MC98000 (PowerPC) subtypes
*/
-#define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
/*
* HPPA subtypes for Hewlett-Packard HP-PA family of
- * risc processors. Port by NeXT to 700 series.
+ * risc processors. Port by NeXT to 700 series.
*/
-#define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
-#define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
+#define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
/*
* MC88000 subtypes.
*/
-#define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
-#define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
/*
* SPARC subtypes
*/
-#define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
/*
* I860 subtypes
*/
-#define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
/*
* PowerPC subtypes
*/
-#define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
-#define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
-#define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
-#define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
-#define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
-#define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
-#define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
-#define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
-#define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
-#define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
-#define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
-#define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
-#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
+#define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
+#define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
/*
* ARM subtypes
@@ -303,8 +365,38 @@ typedef integer_t cpu_threadtype_t;
#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
-#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
-#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9) /* ARMv7-A and ARMv7-R */
+#define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
+#define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */
+#define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12)
+#define CPU_SUBTYPE_ARM_V8 ((cpu_subtype_t) 13)
+#define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t) 14) /* Not meant to be run under xnu */
+#define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t) 15) /* Not meant to be run under xnu */
+#define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t) 16) /* Not meant to be run under xnu */
+#define CPU_SUBTYPE_ARM_V8M ((cpu_subtype_t) 17) /* Not meant to be run under xnu */
+
+/*
+ * ARM64 subtypes
+ */
+#define CPU_SUBTYPE_ARM64_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_ARM64_V8 ((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_ARM64E ((cpu_subtype_t) 2)
+
+/* CPU subtype feature flags for ptrauth on arm64e platforms */
+#define CPU_SUBTYPE_ARM64_PTR_AUTH_MASK 0x0f000000
+#define CPU_SUBTYPE_ARM64_PTR_AUTH_VERSION(x) (((x) & CPU_SUBTYPE_ARM64_PTR_AUTH_MASK) >> 24)
+#ifdef PRIVATE
+#define CPU_SUBTYPE_ARM64_PTR_AUTH_CURRENT_VERSION 0
+#endif /* PRIVATE */
+
+/*
+ * ARM64_32 subtypes
+ */
+#define CPU_SUBTYPE_ARM64_32_ALL ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_ARM64_32_V8 ((cpu_subtype_t) 1)
+
+#endif /* !__ASSEMBLER__ */
/*
* CPU families (sysctl hw.cpufamily)
@@ -317,31 +409,53 @@ typedef integer_t cpu_threadtype_t;
* Use feature flags (eg, hw.optional.altivec) to test for optional
* functionality.
*/
-#define CPUFAMILY_UNKNOWN 0
-#define CPUFAMILY_POWERPC_G3 0xcee41549
-#define CPUFAMILY_POWERPC_G4 0x77c184ae
-#define CPUFAMILY_POWERPC_G5 0xed76d8aa
-#define CPUFAMILY_INTEL_6_13 0xaa33392b
-#define CPUFAMILY_INTEL_YONAH 0x73d67300
-#define CPUFAMILY_INTEL_MEROM 0x426f69ef
-#define CPUFAMILY_INTEL_PENRYN 0x78ea4fbc
-#define CPUFAMILY_INTEL_NEHALEM 0x6b5a4cd2
-#define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
-#define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
-#define CPUFAMILY_ARM_9 0xe73283ae
-#define CPUFAMILY_ARM_11 0x8ff620d8
-#define CPUFAMILY_ARM_XSCALE 0x53b005f5
-#define CPUFAMILY_ARM_13 0x0cc90e64
-#define CPUFAMILY_ARM_14 0x96077ef1
+#define CPUFAMILY_UNKNOWN 0
+#define CPUFAMILY_POWERPC_G3 0xcee41549
+#define CPUFAMILY_POWERPC_G4 0x77c184ae
+#define CPUFAMILY_POWERPC_G5 0xed76d8aa
+#define CPUFAMILY_INTEL_6_13 0xaa33392b
+#define CPUFAMILY_INTEL_PENRYN 0x78ea4fbc
+#define CPUFAMILY_INTEL_NEHALEM 0x6b5a4cd2
+#define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
+#define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
+#define CPUFAMILY_INTEL_IVYBRIDGE 0x1f65e835
+#define CPUFAMILY_INTEL_HASWELL 0x10b282dc
+#define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
+#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
+#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
+#define CPUFAMILY_INTEL_ICELAKE 0x38435547
+#define CPUFAMILY_ARM_9 0xe73283ae
+#define CPUFAMILY_ARM_11 0x8ff620d8
+#define CPUFAMILY_ARM_XSCALE 0x53b005f5
+#define CPUFAMILY_ARM_12 0xbd1b0ae9
+#define CPUFAMILY_ARM_13 0x0cc90e64
+#define CPUFAMILY_ARM_14 0x96077ef1
+#define CPUFAMILY_ARM_15 0xa8511bca
+#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
+#define CPUFAMILY_ARM_CYCLONE 0x37a09642
+#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
+#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
+#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
+#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
+#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
+#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
+#ifndef RC_HIDE_XNU_FIRESTORM
+#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
+#endif /* !RC_HIDE_XNU_FIRESTORM */
+
+/* Described in rdar://64125549 */
+#define CPUSUBFAMILY_UNKNOWN 0
+#define CPUSUBFAMILY_ARM_HP 1
+#define CPUSUBFAMILY_ARM_HG 2
+#define CPUSUBFAMILY_ARM_M 3
+#ifndef RC_HIDE_XNU_FIRESTORM
+#define CPUSUBFAMILY_ARM_HS 4
+#define CPUSUBFAMILY_ARM_HC_HD 5
+#endif /* !RC_HIDE_XNU_FIRESTORM */
/* The following synonyms are deprecated: */
-#define CPUFAMILY_INTEL_6_14 CPUFAMILY_INTEL_YONAH
-#define CPUFAMILY_INTEL_6_15 CPUFAMILY_INTEL_MEROM
-#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN
-#define CPUFAMILY_INTEL_6_26 CPUFAMILY_INTEL_NEHALEM
-
-#define CPUFAMILY_INTEL_CORE CPUFAMILY_INTEL_YONAH
-#define CPUFAMILY_INTEL_CORE2 CPUFAMILY_INTEL_MEROM
+#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN
+#define CPUFAMILY_INTEL_6_26 CPUFAMILY_INTEL_NEHALEM
-#endif /* _MACH_MACHINE_H_ */
+#endif /* _MACH_MACHINE_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/machine/boolean.h b/src/third_party/mac_headers/mach/machine/boolean.h
index ffdc2390..adca083d 100644
--- a/src/third_party/mac_headers/mach/machine/boolean.h
+++ b/src/third_party/mac_headers/mach/machine/boolean.h
@@ -2,7 +2,7 @@
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,7 +22,7 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
@@ -31,10 +31,10 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/boolean.h"
-#elif defined (__arm__)
+#elif defined (__arm__) || defined (__arm64__) || defined(__aarch64__)
#include "mach/arm/boolean.h"
#else
#error architecture not supported
#endif
-#endif /* _MACH_MACHINE_BOOLEAN_H_ */
+#endif /* _MACH_MACHINE_BOOLEAN_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/machine/thread_state.h b/src/third_party/mac_headers/mach/machine/thread_state.h
index 1547acac..fceb4279 100644
--- a/src/third_party/mac_headers/mach/machine/thread_state.h
+++ b/src/third_party/mac_headers/mach/machine/thread_state.h
@@ -6,4 +6,4 @@
#define THREAD_STATE_MAX 1
-#endif /* _MACH_MACHINE_THREAD_STATE_H_ */
+#endif /* _MACH_MACHINE_THREAD_STATE_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/machine/thread_status.h b/src/third_party/mac_headers/mach/machine/thread_status.h
index d1ab56ad..4309afdc 100644
--- a/src/third_party/mac_headers/mach/machine/thread_status.h
+++ b/src/third_party/mac_headers/mach/machine/thread_status.h
@@ -1 +1 @@
-/* This file intentionally left blank */
+/* This file intentionally left blank */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/machine/vm_types.h b/src/third_party/mac_headers/mach/machine/vm_types.h
index 8ccd24be..7ee7ac8e 100644
--- a/src/third_party/mac_headers/mach/machine/vm_types.h
+++ b/src/third_party/mac_headers/mach/machine/vm_types.h
@@ -2,7 +2,7 @@
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,7 +22,7 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
@@ -31,10 +31,10 @@
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/vm_types.h"
-#elif defined (__arm__)
+#elif defined (__arm__) || defined (__arm64__) || defined(__aarch64__)
#include "mach/arm/vm_types.h"
#else
#error architecture not supported
#endif
-#endif /* _MACH_MACHINE_VM_TYPES_H_ */
+#endif /* _MACH_MACHINE_VM_TYPES_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/thread_status.h b/src/third_party/mac_headers/mach/thread_status.h
index aead09bf..f742500c 100644
--- a/src/third_party/mac_headers/mach/thread_status.h
+++ b/src/third_party/mac_headers/mach/thread_status.h
@@ -2,7 +2,7 @@
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,7 +22,7 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
@@ -32,24 +32,24 @@
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
@@ -65,8 +65,8 @@
*
*/
-#ifndef _MACH_THREAD_STATUS_H_
-#define _MACH_THREAD_STATUS_H_
+#ifndef _MACH_THREAD_STATUS_H_
+#define _MACH_THREAD_STATUS_H_
/*
* The actual structure that comprises the thread state is defined
@@ -80,15 +80,21 @@
* Generic definition for machine-dependent thread status.
*/
-typedef natural_t *thread_state_t; /* Variable-length array */
+typedef natural_t *thread_state_t; /* Variable-length array */
/* THREAD_STATE_MAX is now defined in <mach/machine/thread_state.h> */
-typedef natural_t thread_state_data_t[THREAD_STATE_MAX];
+typedef natural_t thread_state_data_t[THREAD_STATE_MAX];
+
+#define THREAD_STATE_FLAVOR_LIST 0 /* List of valid flavors */
+#define THREAD_STATE_FLAVOR_LIST_NEW 128
+#define THREAD_STATE_FLAVOR_LIST_10_9 129
+#define THREAD_STATE_FLAVOR_LIST_10_13 130
+#define THREAD_STATE_FLAVOR_LIST_10_15 131
-#define THREAD_STATE_FLAVOR_LIST 0 /* List of valid flavors */
-#define THREAD_STATE_FLAVOR_LIST_NEW 128
+typedef int thread_state_flavor_t;
+typedef thread_state_flavor_t *thread_state_flavor_array_t;
-typedef int thread_state_flavor_t;
-typedef thread_state_flavor_t *thread_state_flavor_array_t;
+#define THREAD_CONVERT_THREAD_STATE_TO_SELF 1
+#define THREAD_CONVERT_THREAD_STATE_FROM_SELF 2
-#endif /* _MACH_THREAD_STATUS_H_ */
+#endif /* _MACH_THREAD_STATUS_H_ */ \ No newline at end of file
diff --git a/src/third_party/mac_headers/mach/vm_prot.h b/src/third_party/mac_headers/mach/vm_prot.h
index 07c2114e..b19c8e24 100644
--- a/src/third_party/mac_headers/mach/vm_prot.h
+++ b/src/third_party/mac_headers/mach/vm_prot.h
@@ -1,8 +1,8 @@
/*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2021 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
@@ -11,10 +11,10 @@
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -22,34 +22,34 @@
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
@@ -63,8 +63,8 @@
*
*/
-#ifndef _MACH_VM_PROT_H_
-#define _MACH_VM_PROT_H_
+#ifndef _MACH_VM_PROT_H_
+#define _MACH_VM_PROT_H_
/*
* Types defined:
@@ -72,29 +72,36 @@
* vm_prot_t VM protection values.
*/
-typedef int vm_prot_t;
+typedef int vm_prot_t;
/*
* Protection values, defined as bits within the vm_prot_t type
*/
-#define VM_PROT_NONE ((vm_prot_t) 0x00)
+#define VM_PROT_NONE ((vm_prot_t) 0x00)
-#define VM_PROT_READ ((vm_prot_t) 0x01) /* read permission */
-#define VM_PROT_WRITE ((vm_prot_t) 0x02) /* write permission */
-#define VM_PROT_EXECUTE ((vm_prot_t) 0x04) /* execute permission */
+#define VM_PROT_READ ((vm_prot_t) 0x01) /* read permission */
+#define VM_PROT_WRITE ((vm_prot_t) 0x02) /* write permission */
+#define VM_PROT_EXECUTE ((vm_prot_t) 0x04) /* execute permission */
/*
* The default protection for newly-created virtual memory
*/
-#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
+#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
/*
* The maximum privileges possible, for parameter checking.
*/
-#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
+#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
+
+/*
+ * This is an alias to VM_PROT_EXECUTE to identify callers that
+ * want to allocate an hardware assisted Read-only/read-write
+ * trusted path in userland.
+ */
+#define VM_PROT_RORW_TP (VM_PROT_EXECUTE)
/*
* An invalid protection value.
@@ -103,15 +110,16 @@ typedef int vm_prot_t;
* looks like VM_PROT_ALL and then some.
*/
-#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x08)
+#define VM_PROT_NO_CHANGE_LEGACY ((vm_prot_t) 0x08)
+#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x01000000)
-/*
+/*
* When a caller finds that he cannot obtain write permission on a
* mapped entry, the following flag can be used. The entry will
* be made "needs copy" effectively copying the object (using COW),
* and write permission will be added to the maximum protections
- * for the associated entry.
- */
+ * for the associated entry.
+ */
#define VM_PROT_COPY ((vm_prot_t) 0x10)
@@ -127,14 +135,59 @@ typedef int vm_prot_t;
* walking down the shadow chain.
*/
-#define VM_PROT_WANTS_COPY ((vm_prot_t) 0x10)
+#define VM_PROT_WANTS_COPY ((vm_prot_t) 0x10)
+#ifdef PRIVATE
+/*
+ * The caller wants this memory region treated as if it had a valid
+ * code signature.
+ */
+
+#define VM_PROT_TRUSTED ((vm_prot_t) 0x20)
+#endif /* PRIVATE */
/*
- * Another invalid protection value.
+ * Another invalid protection value.
* Indicates that the other protection bits are to be applied as a mask
* against the actual protection bits of the map entry.
*/
-#define VM_PROT_IS_MASK ((vm_prot_t) 0x40)
+#define VM_PROT_IS_MASK ((vm_prot_t) 0x40)
+
+/*
+ * Another invalid protection value to support execute-only protection.
+ * VM_PROT_STRIP_READ is a special marker that tells mprotect to not
+ * set VM_PROT_READ. We have to do it this way because existing code
+ * expects the system to set VM_PROT_READ if VM_PROT_EXECUTE is set.
+ * VM_PROT_EXECUTE_ONLY is just a convenience value to indicate that
+ * the memory should be executable and explicitly not readable. It will
+ * be ignored on platforms that do not support this type of protection.
+ */
+#define VM_PROT_STRIP_READ ((vm_prot_t) 0x80)
+#define VM_PROT_EXECUTE_ONLY (VM_PROT_EXECUTE|VM_PROT_STRIP_READ)
+
+#ifdef PRIVATE
+/*
+ * When using VM_PROT_COPY, fail instead of copying an executable mapping,
+ * since that could cause code-signing violations.
+ */
+#define VM_PROT_COPY_FAIL_IF_EXECUTABLE ((vm_prot_t)0x100)
+#endif /* PRIVATE */
+
+#if defined(__x86_64__)
+/*
+ * Another invalid protection value to support specifying different
+ * execute permissions for user- and supervisor- modes. When
+ * MBE is enabled in a VM, VM_PROT_EXECUTE is used to indicate
+ * supervisor-mode execute permission, and VM_PROT_UEXEC specifies
+ * user-mode execute permission. Currently only used by the
+ * x86 Hypervisor kext.
+ */
+#define VM_PROT_UEXEC ((vm_prot_t) 0x8) /* User-mode Execute Permission */
+
+#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE | VM_PROT_UEXEC)
+#else
+#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE)
+#endif /* defined(__x86_64__) */
+
-#endif /* _MACH_VM_PROT_H_ */
+#endif /* _MACH_VM_PROT_H_ */ \ No newline at end of file
diff --git a/src/tools/linux/core2md/core2md.cc b/src/tools/linux/core2md/core2md.cc
index 3f34294f..ec4a012a 100644
--- a/src/tools/linux/core2md/core2md.cc
+++ b/src/tools/linux/core2md/core2md.cc
@@ -28,6 +28,10 @@
// core2md.cc: A utility to convert an ELF core file to a minidump file.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include "client/linux/minidump_writer/minidump_writer.h"
diff --git a/src/tools/linux/core_handler/core_handler.cc b/src/tools/linux/core_handler/core_handler.cc
index 224073d3..8a1d9766 100644
--- a/src/tools/linux/core_handler/core_handler.cc
+++ b/src/tools/linux/core_handler/core_handler.cc
@@ -28,6 +28,10 @@
// core_handler.cc: A tool to handle coredumps on Linux
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/tools/linux/dump_syms/dump_syms.cc b/src/tools/linux/dump_syms/dump_syms.cc
index 8998b3b3..2fce23c2 100644
--- a/src/tools/linux/dump_syms/dump_syms.cc
+++ b/src/tools/linux/dump_syms/dump_syms.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <paths.h>
#include <stdio.h>
#include <unistd.h>
@@ -56,7 +60,7 @@ int usage(const char* self) {
fprintf(stderr, " -n <name> Use specified name for name of the object\n");
fprintf(stderr, " -o <os> Use specified name for the "
"operating system\n");
- fprintf(stderr, " -m Enable writing the optional 'm' field on FUNC"
+ fprintf(stderr, " -m Enable writing the optional 'm' field on FUNC "
"and PUBLIC, denoting multiple symbols for "
"the address.\n");
return 1;
diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc
index a4ddbe8e..3e310bc7 100644
--- a/src/tools/linux/md2core/minidump-2-core.cc
+++ b/src/tools/linux/md2core/minidump-2-core.cc
@@ -30,6 +30,10 @@
// Large parts lifted from the userspace core dumper:
// http://code.google.com/p/google-coredumper/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <elf.h>
#include <errno.h>
#include <limits.h>
@@ -278,7 +282,7 @@ typedef struct prpsinfo { /* Information about process */
// We parse the minidump file and keep the parsed information in this structure
struct CrashedProcess {
CrashedProcess()
- : crashing_tid(-1),
+ : exception{-1},
auxv(NULL),
auxv_length(0) {
memset(&prps, 0, sizeof(prps));
@@ -302,7 +306,6 @@ struct CrashedProcess {
};
std::map<uint64_t, Mapping> mappings;
- pid_t crashing_tid;
int fatal_signal;
struct Thread {
@@ -326,6 +329,7 @@ struct CrashedProcess {
size_t stack_length;
};
std::vector<Thread> threads;
+ Thread exception;
const uint8_t* auxv;
size_t auxv_length;
@@ -579,25 +583,21 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
thread->mcontext.__gregs[30] = rawregs->t5;
thread->mcontext.__gregs[31] = rawregs->t6;
-# if __riscv_flen == 32
- for (int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; ++i) {
- thread->mcontext.__fpregs.__f.__f[i] = rawregs->float_save.regs[i];
+ // Breakpad only supports RISCV32 with 32 bit floating point.
+ // Breakpad only supports RISCV64 with 64 bit floating point.
+#if __riscv_xlen == 32
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; ++i) {
+ thread->mcontext.__fpregs.__f.__f[i] = rawregs->fpregs[i];
}
- thread->mcontext.__fpregs.__f.__fcsr = rawregs->float_save.fpcsr;
-# elif __riscv_flen == 64
- for (int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; ++i) {
- thread->mcontext.__fpregs.__d.__f[i] = rawregs->float_save.regs[i];
+ thread->mcontext.__fpregs.__f.__fcsr = rawregs->fcsr;
+#elif __riscv_xlen == 64
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; ++i) {
+ thread->mcontext.__fpregs.__d.__f[i] = rawregs->fpregs[i];
}
- thread->mcontext.__fpregs.__d.__fcsr = rawregs->float_save.fpcsr;
-# elif __riscv_flen == 128
- for (int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; ++i) {
- thread->mcontext.__fpregs.__q.__f[2*i] = rawregs->float_save.regs[i].high;
- thread->mcontext.__fpregs.__q.__f[2*i+1] = rawregs->float_save.regs[i].low;
- }
- thread->mcontext.__fpregs.__q.__fcsr = rawregs->float_save.fpcsr;
-# else
-# error "Unexpected __riscv_flen"
-# endif
+ thread->mcontext.__fpregs.__d.__fcsr = rawregs->fcsr;
+#else
+#error "Unexpected __riscv_xlen"
+#endif
}
#else
#error "This code has not been ported to your platform yet"
@@ -995,10 +995,25 @@ ParseDSODebugInfo(const Options& options, CrashedProcess* crashinfo,
static void
ParseExceptionStream(const Options& options, CrashedProcess* crashinfo,
- const MinidumpMemoryRange& range) {
+ const MinidumpMemoryRange& range,
+ const MinidumpMemoryRange& full_file) {
const MDRawExceptionStream* exp = range.GetData<MDRawExceptionStream>(0);
- crashinfo->crashing_tid = exp->thread_id;
+ if (!exp) {
+ return;
+ }
+ if (options.verbose) {
+ fprintf(stderr,
+ "MD_EXCEPTION_STREAM:\n"
+ "Found exception thread %" PRIu32 " \n"
+ "\n\n",
+ exp->thread_id);
+ }
crashinfo->fatal_signal = (int) exp->exception_record.exception_code;
+ crashinfo->exception = {};
+ crashinfo->exception.tid = exp->thread_id;
+ // crashinfo->threads[].tid == crashinfo->exception.tid provides the stack.
+ ParseThreadRegisters(&crashinfo->exception,
+ full_file.Subrange(exp->thread_context));
}
static bool
@@ -1361,7 +1376,7 @@ main(int argc, const char* argv[]) {
break;
case MD_EXCEPTION_STREAM:
ParseExceptionStream(options, &crashinfo,
- dump.Subrange(dirent->location));
+ dump.Subrange(dirent->location), dump);
break;
case MD_MODULE_LIST_STREAM:
ParseModuleStream(options, &crashinfo, dump.Subrange(dirent->location),
@@ -1477,16 +1492,21 @@ main(int argc, const char* argv[]) {
return 1;
}
- for (unsigned i = 0; i < crashinfo.threads.size(); ++i) {
- if (crashinfo.threads[i].tid == crashinfo.crashing_tid) {
- WriteThread(options, crashinfo.threads[i], crashinfo.fatal_signal);
+ for (const auto& current_thread : crashinfo.threads) {
+ if (current_thread.tid == crashinfo.exception.tid) {
+ // Use the exception record's context for the crashed thread instead of
+ // the thread's own context. For the crashed thread the thread's own
+ // context is the state inside the exception handler. Using it would not
+ // result in the expected stack trace from the time of the crash.
+ // The stack memory has already been provided by current_thread.
+ WriteThread(options, crashinfo.exception, crashinfo.fatal_signal);
break;
}
}
- for (unsigned i = 0; i < crashinfo.threads.size(); ++i) {
- if (crashinfo.threads[i].tid != crashinfo.crashing_tid)
- WriteThread(options, crashinfo.threads[i], 0);
+ for (const auto& current_thread : crashinfo.threads) {
+ if (current_thread.tid != crashinfo.exception.tid)
+ WriteThread(options, current_thread, 0);
}
if (note_align) {
diff --git a/src/tools/linux/md2core/minidump_memory_range_unittest.cc b/src/tools/linux/md2core/minidump_memory_range_unittest.cc
index 9012101d..c939dd64 100644
--- a/src/tools/linux/md2core/minidump_memory_range_unittest.cc
+++ b/src/tools/linux/md2core/minidump_memory_range_unittest.cc
@@ -29,6 +29,10 @@
// minidump_memory_range_unittest.cc:
// Unit tests for google_breakpad::MinidumpMemoryRange.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "tools/linux/md2core/minidump_memory_range.h"
diff --git a/src/tools/linux/pid2md/pid2md.cc b/src/tools/linux/pid2md/pid2md.cc
index ca1cb637..add12a73 100644
--- a/src/tools/linux/pid2md/pid2md.cc
+++ b/src/tools/linux/pid2md/pid2md.cc
@@ -28,6 +28,10 @@
// pid2md.cc: An utility to generate a minidump from a running process
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/src/tools/linux/symupload/minidump_upload.cc b/src/tools/linux/symupload/minidump_upload.cc
index 6adead03..9f2c9674 100644
--- a/src/tools/linux/symupload/minidump_upload.cc
+++ b/src/tools/linux/symupload/minidump_upload.cc
@@ -33,6 +33,10 @@
// ver: the product version
// symbol_file: the breakpad format symbol file
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/src/tools/linux/symupload/sym_upload.cc b/src/tools/linux/symupload/sym_upload.cc
index 8f5e8a50..a76c55f7 100644
--- a/src/tools/linux/symupload/sym_upload.cc
+++ b/src/tools/linux/symupload/sym_upload.cc
@@ -38,6 +38,10 @@
// cpu: the CPU that the module was built for
// symbol_file: the contents of the breakpad-format symbol file
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj b/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj
index 5b644e24..c98b6ac5 100644
--- a/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj
+++ b/src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj
@@ -1251,7 +1251,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 8B3102D411F0D60300FCF3E4 /* BreakpadDebug.xcconfig */;
buildSettings = {
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
HEADER_SEARCH_PATHS = (
../../..,
../../../common/mac/include/,
@@ -1264,7 +1264,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 8B3102D511F0D60300FCF3E4 /* BreakpadRelease.xcconfig */;
buildSettings = {
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
HEADER_SEARCH_PATHS = (
../../..,
../../../common/mac/include/,
diff --git a/src/tools/mac/dump_syms/dump_syms_tool.cc b/src/tools/mac/dump_syms/dump_syms_tool.cc
index 2e05cbf3..9fb8d13f 100644
--- a/src/tools/mac/dump_syms/dump_syms_tool.cc
+++ b/src/tools/mac/dump_syms/dump_syms_tool.cc
@@ -31,6 +31,10 @@
// dump_syms_tool.cc: Command line tool that uses the DumpSymbols class.
// TODO(waylonis): accept stdin
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <mach-o/arch.h>
#include <unistd.h>
@@ -59,16 +63,20 @@ struct Options {
cfi(true),
handle_inter_cu_refs(true),
handle_inlines(false),
- enable_multiple(false) {}
+ enable_multiple(false),
+ module_name(),
+ prefer_extern_name(false) {}
string srcPath;
string dsymPath;
- const NXArchInfo *arch;
+ std::optional<ArchInfo> arch;
bool header_only;
bool cfi;
bool handle_inter_cu_refs;
bool handle_inlines;
bool enable_multiple;
+ string module_name;
+ bool prefer_extern_name;
};
static bool StackFrameEntryComparator(const Module::StackFrameEntry* a,
@@ -117,11 +125,12 @@ static void CopyCFIDataBetweenModules(Module* to_module,
}
static bool SetArchitecture(DumpSymbols& dump_symbols,
- const NXArchInfo* arch,
+ const ArchInfo& arch,
const std::string& filename) {
- if (!dump_symbols.SetArchitecture(arch->cputype, arch->cpusubtype)) {
+ if (!dump_symbols.SetArchitecture(arch)) {
fprintf(stderr, "%s: no architecture '%s' is present in file.\n",
- filename.c_str(), arch->name);
+ filename.c_str(),
+ GetNameFromCPUType(arch.cputype, arch.cpusubtype));
size_t available_size;
const SuperFatArch* available =
dump_symbols.AvailableArchitectures(&available_size);
@@ -131,14 +140,8 @@ static bool SetArchitecture(DumpSymbols& dump_symbols,
fprintf(stderr, "architectures present in the file are:\n");
for (size_t i = 0; i < available_size; i++) {
const SuperFatArch* arch = &available[i];
- const NXArchInfo* arch_info =
- google_breakpad::BreakpadGetArchInfoFromCpuType(arch->cputype,
- arch->cpusubtype);
- if (arch_info)
- fprintf(stderr, "%s (%s)\n", arch_info->name, arch_info->description);
- else
- fprintf(stderr, "unrecognized cpu type 0x%x, subtype 0x%x\n",
- arch->cputype, arch->cpusubtype);
+ fprintf(stderr, "%s\n",
+ GetNameFromCPUType(arch->cputype, arch->cpusubtype));
}
return false;
}
@@ -150,7 +153,8 @@ static bool Start(const Options& options) {
(options.handle_inlines ? INLINES : NO_DATA) |
(options.cfi ? CFI : NO_DATA) | SYMBOLS_AND_FILES;
DumpSymbols dump_symbols(symbol_data, options.handle_inter_cu_refs,
- options.enable_multiple);
+ options.enable_multiple, options.module_name,
+ options.prefer_extern_name);
// For x86_64 binaries, the CFI data is in the __TEXT,__eh_frame of the
// Mach-O file, which is not copied into the dSYM. Whereas in i386, the CFI
@@ -169,7 +173,7 @@ static bool Start(const Options& options) {
return false;
if (options.arch &&
- !SetArchitecture(dump_symbols, options.arch, primary_file)) {
+ !SetArchitecture(dump_symbols, *options.arch, primary_file)) {
return false;
}
@@ -189,7 +193,7 @@ static bool Start(const Options& options) {
return false;
if (options.arch &&
- !SetArchitecture(dump_symbols, options.arch, options.srcPath)) {
+ !SetArchitecture(dump_symbols, *options.arch, options.srcPath)) {
return false;
}
Module* cfi_module = NULL;
@@ -197,13 +201,38 @@ static bool Start(const Options& options) {
return false;
scoped_ptr<Module> scoped_cfi_module(cfi_module);
+ bool name_matches;
+ if (!options.module_name.empty()) {
+ // Ignore the basename of the dSYM and binary and use the passed-in module
+ // name.
+ name_matches = true;
+ } else {
+ name_matches = cfi_module->name() == module->name();
+ }
+
// Ensure that the modules are for the same debug code file.
- if (cfi_module->name() != module->name() ||
- cfi_module->os() != module->os() ||
+ if (!name_matches || cfi_module->os() != module->os() ||
cfi_module->architecture() != module->architecture() ||
cfi_module->identifier() != module->identifier()) {
fprintf(stderr, "Cannot generate a symbol file from split sources that do"
" not match.\n");
+ if (!name_matches) {
+ fprintf(stderr, "Name mismatch: binary=[%s], dSYM=[%s]\n",
+ cfi_module->name().c_str(), module->name().c_str());
+ }
+ if (cfi_module->os() != module->os()) {
+ fprintf(stderr, "OS mismatch: binary=[%s], dSYM=[%s]\n",
+ cfi_module->os().c_str(), module->os().c_str());
+ }
+ if (cfi_module->architecture() != module->architecture()) {
+ fprintf(stderr, "Architecture mismatch: binary=[%s], dSYM=[%s]\n",
+ cfi_module->architecture().c_str(),
+ module->architecture().c_str());
+ }
+ if (cfi_module->identifier() != module->identifier()) {
+ fprintf(stderr, "Identifier mismatch: binary=[%s], dSYM=[%s]\n",
+ cfi_module->identifier().c_str(), module->identifier().c_str());
+ }
return false;
}
@@ -216,8 +245,10 @@ static bool Start(const Options& options) {
//=============================================================================
static void Usage(int argc, const char *argv[]) {
fprintf(stderr, "Output a Breakpad symbol file from a Mach-o file.\n");
- fprintf(stderr, "Usage: %s [-a ARCHITECTURE] [-c] [-g dSYM path] "
- "<Mach-o file>\n", argv[0]);
+ fprintf(stderr,
+ "Usage: %s [-a ARCHITECTURE] [-c] [-g dSYM path] "
+ "[-n MODULE] [-x] <Mach-o file>\n",
+ argv[0]);
fprintf(stderr, "\t-i: Output module header information only.\n");
fprintf(stderr, "\t-a: Architecture type [default: native, or whatever is\n");
fprintf(stderr, "\t in the file, if it contains only one architecture]\n");
@@ -229,6 +260,12 @@ static void Usage(int argc, const char *argv[]) {
fprintf(stderr,
"\t-m: Enable writing the optional 'm' field on FUNC "
"and PUBLIC, denoting multiple symbols for the address.\n");
+ fprintf(stderr,
+ "\t-n: Use MODULE as the name of the module rather than \n"
+ "the basename of the Mach-O file/dSYM.\n");
+ fprintf(stderr,
+ "\t-x: Prefer the PUBLIC (extern) name over the FUNC if\n"
+ "they do not match.\n");
fprintf(stderr, "\t-h: Usage\n");
fprintf(stderr, "\t-?: Usage\n");
}
@@ -238,14 +275,13 @@ static void SetupOptions(int argc, const char *argv[], Options *options) {
extern int optind;
signed char ch;
- while ((ch = getopt(argc, (char* const*)argv, "ia:g:crdm?h")) != -1) {
+ while ((ch = getopt(argc, (char* const*)argv, "ia:g:crdm?hn:x")) != -1) {
switch (ch) {
case 'i':
options->header_only = true;
break;
case 'a': {
- const NXArchInfo *arch_info =
- google_breakpad::BreakpadGetArchInfoFromName(optarg);
+ std::optional<ArchInfo> arch_info = GetArchInfoFromName(optarg);
if (!arch_info) {
fprintf(stderr, "%s: Invalid architecture: %s\n", argv[0], optarg);
Usage(argc, argv);
@@ -269,6 +305,12 @@ static void SetupOptions(int argc, const char *argv[], Options *options) {
case 'm':
options->enable_multiple = true;
break;
+ case 'n':
+ options->module_name = optarg;
+ break;
+ case 'x':
+ options->prefer_extern_name = true;
+ break;
case '?':
case 'h':
Usage(argc, argv);
diff --git a/src/tools/mac/dump_syms/macho_dump.cc b/src/tools/mac/dump_syms/macho_dump.cc
deleted file mode 100644
index b724cc74..00000000
--- a/src/tools/mac/dump_syms/macho_dump.cc
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright 2010 Google LLC
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google LLC nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
-
-// macho_dump.cc: Dump the contents of a Mach-O file. This is mostly
-// a test program for the Mach_O::FatReader and Mach_O::Reader classes.
-
-#include <errno.h>
-#include <fcntl.h>
-#include <mach-o/arch.h>
-#include <sys/mman.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "common/byte_cursor.h"
-#include "common/mac/arch_utilities.h"
-#include "common/mac/macho_reader.h"
-#include "common/path_helper.h"
-
-using google_breakpad::ByteBuffer;
-using std::ostringstream;
-using std::string;
-using std::vector;
-
-namespace {
-namespace mach_o = google_breakpad::mach_o;
-
-string program_name;
-
-int check_syscall(int result, const char* operation, const char* filename) {
- if (result < 0) {
- fprintf(stderr, "%s: %s '%s': %s\n",
- program_name.c_str(), operation,
- filename, strerror(errno));
- exit(1);
- }
- return result;
-}
-
-class DumpSection: public mach_o::Reader::SectionHandler {
- public:
- DumpSection() : index_(0) { }
- bool HandleSection(const mach_o::Section& section) {
- printf(" section %d '%s' in segment '%s'\n"
- " address: 0x%llx\n"
- " alignment: 1 << %d B\n"
- " flags: %d\n"
- " size: %ld\n",
- index_++, section.section_name.c_str(), section.segment_name.c_str(),
- section.address, section.align,
- mach_o::SectionFlags(section.flags),
- section.contents.Size());
- return true;
- }
-
- private:
- int index_;
-};
-
-class DumpCommand: public mach_o::Reader::LoadCommandHandler {
- public:
- DumpCommand(mach_o::Reader* reader) : reader_(reader), index_(0) { }
- bool UnknownCommand(mach_o::LoadCommandType type,
- const ByteBuffer& contents) {
- printf(" load command %d: %d", index_++, type);
- return true;
- }
- bool SegmentCommand(const mach_o::Segment& segment) {
- printf(" load command %d: %s-bit segment '%s'\n"
- " address: 0x%llx\n"
- " memory size: 0x%llx\n"
- " maximum protection: 0x%x\n"
- " initial protection: 0x%x\n"
- " flags: %d\n"
- " section_list size: %ld B\n",
- index_++, (segment.bits_64 ? "64" : "32"), segment.name.c_str(),
- segment.vmaddr, segment.vmsize, segment.maxprot,
- segment.initprot, mach_o::SegmentFlags(segment.flags),
- segment.section_list.Size());
-
- DumpSection dump_section;
- return reader_->WalkSegmentSections(segment, &dump_section);
- }
- private:
- mach_o::Reader* reader_;
- int index_;
-};
-
-void DumpFile(const char* filename) {
- int fd = check_syscall(open(filename, O_RDONLY), "opening", filename);
- struct stat attributes;
- check_syscall(fstat(fd, &attributes),
- "getting file attributes for", filename);
- void* mapping = mmap(NULL, attributes.st_size, PROT_READ,
- MAP_PRIVATE, fd, 0);
- close(fd);
- check_syscall(mapping == (void*)-1 ? -1 : 0,
- "mapping contents of", filename);
-
- mach_o::FatReader::Reporter fat_reporter(filename);
- mach_o::FatReader fat_reader(&fat_reporter);
- if (!fat_reader.Read(reinterpret_cast<uint8_t*>(mapping),
- attributes.st_size)) {
- exit(1);
- }
- printf("filename: %s\n", filename);
- size_t object_files_size;
- const SuperFatArch* super_fat_object_files =
- fat_reader.object_files(&object_files_size);
- struct fat_arch* object_files;
- if (!super_fat_object_files->ConvertToFatArch(object_files)) {
- exit(1);
- }
- printf(" object file count: %ld\n", object_files_size);
- for (size_t i = 0; i < object_files_size; i++) {
- const struct fat_arch& file = object_files[i];
- const NXArchInfo* fat_arch_info =
- google_breakpad::BreakpadGetArchInfoFromCpuType(
- file.cputype, file.cpusubtype);
- printf("\n object file %ld:\n"
- " fat header:\n:"
- " CPU type: %s (%s)\n"
- " size: %d B\n"
- " alignment: 1<<%d B\n",
- i, fat_arch_info->name, fat_arch_info->description,
- file.size, file.align);
-
- ostringstream name;
- name << filename;
- if (object_files_size > 1)
- name << ", object file #" << i;
- ByteBuffer file_contents(reinterpret_cast<uint8_t*>(mapping)
- + file.offset, file.size);
- mach_o::Reader::Reporter reporter(name.str());
- mach_o::Reader reader(&reporter);
- if (!reader.Read(file_contents, file.cputype, file.cpusubtype)) {
- exit(1);
- }
-
- const NXArchInfo* macho_arch_info =
- NXGetArchInfoFromCpuType(reader.cpu_type(),
- reader.cpu_subtype());
- printf(" Mach-O header:\n"
- " word size: %s\n"
- " CPU type: %s (%s)\n"
- " File type: %d\n"
- " flags: %x\n",
- (reader.bits_64() ? "64 bits" : "32 bits"),
- macho_arch_info->name, macho_arch_info->description,
- reader.file_type(), reader.flags());
-
- DumpCommand dump_command(&reader);
- reader.WalkLoadCommands(&dump_command);
- }
- munmap(mapping, attributes.st_size);
-}
-
-} // namespace
-
-int main(int argc, char** argv) {
- program_name = google_breakpad::BaseName(argv[0]);
- if (argc == 1) {
- fprintf(stderr, "Usage: %s FILE ...\n"
- "Dump the contents of the Mach-O or fat binary files "
- "'FILE ...'.\n", program_name.c_str());
- }
- for (int i = 1; i < argc; i++) {
- DumpFile(argv[i]);
- }
-}
diff --git a/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj b/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj
index 903c66f1..b1dd6a11 100644
--- a/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj
+++ b/src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj
@@ -371,7 +371,7 @@
1DEB927508733DD40010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
GCC_PREPROCESSOR_DEFINITIONS = HAVE_MACH_O_NLIST_H;
HEADER_SEARCH_PATHS = (
../../..,
@@ -385,7 +385,7 @@
1DEB927608733DD40010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
NDEBUG,
diff --git a/src/tools/mac/upload_system_symbols/upload_system_symbols.go b/src/tools/mac/upload_system_symbols/upload_system_symbols.go
index ba067276..f34c288a 100644
--- a/src/tools/mac/upload_system_symbols/upload_system_symbols.go
+++ b/src/tools/mac/upload_system_symbols/upload_system_symbols.go
@@ -163,6 +163,29 @@ func main() {
}
}
+// manglePath reduces an absolute filesystem path to a string suitable as the
+// base for a file name which encodes some of the original path. The result
+// concatenates the leading initial from each path component except the last to
+// the last path component; for example /System/Library/Frameworks/AppKit
+// becomes SLFAppKit.
+// Assumes ASCII.
+func manglePath(path string) string {
+ components := strings.Split(path, "/")
+ n := len(components)
+ builder := strings.Builder{}
+ for i, component := range components {
+ if len(component) == 0 {
+ continue
+ }
+ if i < n-1 {
+ builder.WriteString(component[:1])
+ } else {
+ builder.WriteString(component)
+ }
+ }
+ return builder.String()
+}
+
type WorkerPool struct {
wg sync.WaitGroup
}
@@ -296,7 +319,7 @@ func (dq *DumpQueue) worker() {
dumpSyms := path.Join(*breakpadTools, "dump_syms")
for req := range dq.queue {
- filebase := path.Join(dq.dumpPath, strings.Replace(req.path, "/", "_", -1))
+ filebase := path.Join(dq.dumpPath, manglePath(req.path))
symfile := fmt.Sprintf("%s_%s.sym", filebase, req.arch)
f, err := os.Create(symfile)
if err != nil {
diff --git a/src/tools/mac/upload_system_symbols/upload_system_symbols.sh b/src/tools/mac/upload_system_symbols/upload_system_symbols.sh
new file mode 100755
index 00000000..43fd98ed
--- /dev/null
+++ b/src/tools/mac/upload_system_symbols/upload_system_symbols.sh
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+# Copyright 2023 Google LLC
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google LLC nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Finds the dyld_shared_cache on a system, extracts it, and dumps the symbols
+# in Breakpad format to the directory passed as the first argument
+# The script must be in the same directory as `dump_syms`,
+# `upload_system_symbols` and `dsc_extractor` binaries.
+# Exits with 0 if all supported architectures for this OS version were found and
+# dumped, and nonzero otherwise.
+
+set -ex
+
+if [[ $# -ne 1 ]]; then
+ echo "usage: $0 <destination_directory>" >& 2
+ exit 1
+fi
+
+destination_dir="$1"
+
+dir="$(dirname "$0")"
+dir="$(cd "${dir}"; pwd)"
+major_version=$(sw_vers -productVersion | cut -d . -f 1)
+if [[ "${major_version}" -lt 13 ]]; then
+ dsc_directory="/System/Library/dyld"
+else
+ dsc_directory="/System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld"
+fi
+
+working_dir=$(mktemp -d)
+mkdir "${destination_dir}"
+trap 'rm -rf "${working_dir}" "${destination_dir}"' EXIT
+
+architectures=(x86_64h)
+missing_architectures=()
+# macOS >= 13 on arm64 still has a x86_64 cache for Rosetta.
+if [[ "${major_version}" -lt 13 ]] || [[ $(uname -p) == "arm" ]]; then
+ architectures+=( x86_64 )
+fi
+if [[ "${major_version}" -ge 11 ]]; then
+ architectures+=( arm64e )
+fi
+
+for arch in "${architectures[@]}"; do
+ cache="${dsc_directory}/dyld_shared_cache_${arch}"
+ if [[ ! -f "${cache}" ]]; then
+ missing_architectures+=("${arch}")
+ continue
+ fi
+ "${dir}/dsc_extractor" \
+ "${cache}" \
+ "${working_dir}/${arch}"
+ "${dir}/upload_system_symbols" \
+ --breakpad-tools="${dir}" \
+ --system-root="${working_dir}/${arch}" \
+ --dump-to="${destination_dir}"
+done
+if [[ "${#missing_architectures[@]}" -eq "${#architectures[@]}" ]]; then
+ echo "Couldn't locate dyld_shared_cache for any architectures" >& 2
+ echo "in ${dsc_directory}. Exiting." >& 2
+ exit 1
+fi
+
+rm -rf "${working_dir}"
+# We have results now, so let's keep `destination_dir`.
+trap '' EXIT
+
+"${dir}/upload_system_symbols" \
+ --breakpad-tools="${dir}" \
+ --system-root=/ \
+ --dump-to="${destination_dir}"
+
+set +x
+echo
+echo "Dumped!"
+echo "To upload, run:"
+echo
+echo "'${dir}/upload_system_symbols'" \\
+echo " --breakpad-tools='${dir}'" \\
+echo " --api-key=<YOUR API KEY>" \\
+echo " --upload-from='${destination_dir}'"
+
+if [[ "${#missing_architectures[@]}" -gt 0 ]]; then
+ echo "dyld_shared_cache not found for architecture(s):" >& 2
+ echo " " "${missing_architectures[@]}" >& 2
+ echo "You'll need to get symbols for them elsewhere." >& 2
+ exit 1
+fi
diff --git a/src/tools/python/deps-to-manifest.py b/src/tools/python/deps-to-manifest.py
index 2fcaf771..b614f94f 100755
--- a/src/tools/python/deps-to-manifest.py
+++ b/src/tools/python/deps-to-manifest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
# Copyright 2016 Google LLC
#
# Redistribution and use in source and binary forms, with or without
@@ -29,8 +29,6 @@
"""Convert gclient's DEPS file to repo's manifest xml file."""
-from __future__ import print_function
-
import argparse
import os
import sys
@@ -76,7 +74,8 @@ def ConvertDepsToManifest(deps, manifest):
"""Convert the |deps| file to the |manifest|."""
# Load the DEPS file data.
ctx = {}
- execfile(deps, ctx)
+ with open(deps, 'rb') as file:
+ exec(compile(file.read(), deps, 'exec'), ctx)
new_contents = ''
diff --git a/src/tools/python/filter_syms.py b/src/tools/python/filter_syms.py
index caf3693a..8537769e 100644
--- a/src/tools/python/filter_syms.py
+++ b/src/tools/python/filter_syms.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright 2012 Google LLC
#
# Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@ DWARF files and normalize and de-duplicate the FILE records found within,
updating any references to the FILE records in the other record types.
"""
-import macpath
import ntpath
import optparse
import os
@@ -132,8 +131,8 @@ class SymbolFileParser(object):
Returns:
The actual path to use when writing the FILE record.
"""
- return path[len(filter(path.startswith,
- self.ignored_prefixes + [''])[0]):]
+ return path[len(next(filter(path.startswith,
+ self.ignored_prefixes + ['']))):]
def _ParseFileRecord(self, file_record):
"""Parses and corrects a FILE record."""
@@ -193,7 +192,7 @@ def main():
symbol_parser = SymbolFileParser(sys.stdin, sys.stdout, options.prefixes,
path_handler)
symbol_parser.Process()
- except BreakpadParseError, e:
+ except BreakpadParseError as e:
print >> sys.stderr, 'Got an error while processing symbol file'
print >> sys.stderr, str(e)
return 1
diff --git a/src/tools/python/tests/filter_syms_unittest.py b/src/tools/python/tests/filter_syms_unittest.py
index 1081fc73..f6364b8b 100644
--- a/src/tools/python/tests/filter_syms_unittest.py
+++ b/src/tools/python/tests/filter_syms_unittest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright 2012 Google LLC
#
# Redistribution and use in source and binary forms, with or without
@@ -29,10 +29,9 @@
"""Unit tests for filter_syms.py"""
-import cStringIO
+import io
import ntpath
import os
-import StringIO
import sys
import unittest
@@ -44,8 +43,8 @@ import filter_syms
class FilterSysmsTest(unittest.TestCase):
def assertParsed(self, input_data, ignored_prefixes, expected):
- input_io = cStringIO.StringIO(input_data)
- output_io = cStringIO.StringIO()
+ input_io = io.StringIO(input_data)
+ output_io = io.StringIO()
parser = filter_syms.SymbolFileParser(input_io, output_io,
ignored_prefixes, ntpath)
parser.Process()
@@ -134,4 +133,4 @@ FUNC 1000 c 0 Function1_1
self.assertParsed(INPUT, IGNORED_PREFIXES, EXPECTED_OUTPUT)
if __name__ == '__main__':
- unittest.main() \ No newline at end of file
+ unittest.main()
diff --git a/src/tools/solaris/dump_syms/dump_syms.cc b/src/tools/solaris/dump_syms/dump_syms.cc
index fc331c21..ead16001 100644
--- a/src/tools/solaris/dump_syms/dump_syms.cc
+++ b/src/tools/solaris/dump_syms/dump_syms.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include <cstdio>
diff --git a/src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc b/src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc
index b4d191bd..fb6c883b 100644
--- a/src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc
+++ b/src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc
@@ -28,6 +28,10 @@
// ./dump_syms dump_syms_regtest.pdb > dump_syms_regtest.sym
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
namespace google_breakpad {
class C {
diff --git a/src/tools/windows/converter/ms_symbol_server_converter.cc b/src/tools/windows/converter/ms_symbol_server_converter.cc
index bfe46925..f7d9d943 100644
--- a/src/tools/windows/converter/ms_symbol_server_converter.cc
+++ b/src/tools/windows/converter/ms_symbol_server_converter.cc
@@ -33,6 +33,10 @@
//
// Author: Mark Mentovai
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <dbghelp.h>
#include <pathcch.h>
diff --git a/src/tools/windows/converter_exe/converter.cc b/src/tools/windows/converter_exe/converter.cc
index 75ec55b0..92c41774 100644
--- a/src/tools/windows/converter_exe/converter.cc
+++ b/src/tools/windows/converter_exe/converter.cc
@@ -31,6 +31,10 @@
#pragma comment(lib, "diaguids.lib")
#pragma comment(lib, "imagehlp.lib")
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <cassert>
#include <cstdio>
#include <ctime>
diff --git a/src/tools/windows/converter_exe/escaping.cc b/src/tools/windows/converter_exe/escaping.cc
index de074298..e399c0f4 100644
--- a/src/tools/windows/converter_exe/escaping.cc
+++ b/src/tools/windows/converter_exe/escaping.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "tools/windows/converter_exe/escaping.h"
#include <assert.h>
diff --git a/src/tools/windows/converter_exe/http_download.cc b/src/tools/windows/converter_exe/http_download.cc
index 75f674e0..de824198 100644
--- a/src/tools/windows/converter_exe/http_download.cc
+++ b/src/tools/windows/converter_exe/http_download.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <stdio.h>
#include <Windows.h>
diff --git a/src/tools/windows/converter_exe/tokenizer.cc b/src/tools/windows/converter_exe/tokenizer.cc
index 6d627536..08480d7b 100644
--- a/src/tools/windows/converter_exe/tokenizer.cc
+++ b/src/tools/windows/converter_exe/tokenizer.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include "tools/windows/converter_exe/tokenizer.h"
diff --git a/src/tools/windows/converter_exe/winhttp_client.cc b/src/tools/windows/converter_exe/winhttp_client.cc
index f8c1492d..425a9daa 100644
--- a/src/tools/windows/converter_exe/winhttp_client.cc
+++ b/src/tools/windows/converter_exe/winhttp_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "tools/windows/converter_exe/winhttp_client.h"
#include <assert.h>
diff --git a/src/tools/windows/converter_exe/wininet_client.cc b/src/tools/windows/converter_exe/wininet_client.cc
index 90cf114c..571ab86c 100644
--- a/src/tools/windows/converter_exe/wininet_client.cc
+++ b/src/tools/windows/converter_exe/wininet_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "tools/windows/converter_exe/wininet_client.h"
#include <assert.h>
diff --git a/src/tools/windows/dump_syms/dump_syms.cc b/src/tools/windows/dump_syms/dump_syms.cc
index 26c226a2..1979d430 100644
--- a/src/tools/windows/dump_syms/dump_syms.cc
+++ b/src/tools/windows/dump_syms/dump_syms.cc
@@ -29,6 +29,10 @@
// Windows utility to dump the line number data from a pdb file to
// a text-based format that we can use from the minidump processor.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include <wchar.h>
diff --git a/src/tools/windows/dump_syms/dump_syms_unittest.cc b/src/tools/windows/dump_syms/dump_syms_unittest.cc
index 97dc5c9b..73c48a2f 100644
--- a/src/tools/windows/dump_syms/dump_syms_unittest.cc
+++ b/src/tools/windows/dump_syms/dump_syms_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <Windows.h>
#include <shellapi.h>
diff --git a/src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc b/src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc
index 442676ba..90d00af2 100644
--- a/src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc
+++ b/src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc
@@ -35,6 +35,11 @@
// cl /Zi dump_syms_regtest64.cc /link /PROFILE
// dump_syms dump_syms_regtest64.pdb > dump_syms_regtest64.sym
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
namespace google_breakpad {
class C {
diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc
index 65123a28..46ace95a 100644
--- a/src/tools/windows/symupload/symupload.cc
+++ b/src/tools/windows/symupload/symupload.cc
@@ -42,6 +42,10 @@
// cpu: the CPU that the module was built for, typically "x86".
// symbol_file: the contents of the breakpad-format symbol file
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <dbghelp.h>
#include <wininet.h>