From patchwork Fri Nov 3 19:52:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: auh@yoctoproject.org X-Patchwork-Id: 33951 Return-Path: Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1807C07E97 for ; Fri, 3 Nov 2023 19:52:50 +0000 (UTC) Received: from a27-29.smtp-out.us-west-2.amazonses.com (a27-29.smtp-out.us-west-2.amazonses.com [54.240.27.29]) by mx.groups.io with SMTP id smtpd.web10.63864.1699041165701040906 for ; Fri, 03 Nov 2023 12:52:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@yoctoproject.org header.s=lvjh2tk576v2ro5mi6k4dt3mc6wpqbky header.b=P4G07LnS; dkim=pass header.i=@amazonses.com header.s=hsbnp7p3ensaochzwyq5wwmceodymuwv header.b=HCGWpIUY; spf=pass (domain: us-west-2.amazonses.com, ip: 54.240.27.29, mailfrom: 0101018b96bebdf9-127f9925-ecaa-4266-a324-a07e62606561-000000@us-west-2.amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=lvjh2tk576v2ro5mi6k4dt3mc6wpqbky; d=yoctoproject.org; t=1699041165; h=Content-Type:MIME-Version:From:To:Cc:Subject:Message-Id:Date; bh=g+r7JoOvQQ/dWM8DQZjZ/xtACBZMk5LCeywtIk2jZrA=; b=P4G07LnS4Il4ns4zSj5tECRO7YEv4IyvLcP8ddS7IsY8lsCY/yzK5/YlGKtn+dQt LuthdvYkXcVgZimo3y5sD037+uMpV653b+aVlaxJmVwbMxJLtNcWb7YvfUcUrjdYHd7 MT4wosIRQ9nzsSTFq8vscj6b0q4rVd5g7apm6tvg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=hsbnp7p3ensaochzwyq5wwmceodymuwv; d=amazonses.com; t=1699041165; h=Content-Type:MIME-Version:From:To:Cc:Subject:Message-Id:Date:Feedback-ID; bh=g+r7JoOvQQ/dWM8DQZjZ/xtACBZMk5LCeywtIk2jZrA=; b=HCGWpIUY7sTpY/q1G7841vh1m3DY7DlJnuJz1+NIGooTfvZf560FWBL0y5P50YpF 4omPaRU2SYsCwehGLPSnTgMMMeFEgFfHhYHiCpd/Aw4558T+IxQ0hXzUKTFkZwqMknV W5RYnsZwZJR/ROrJW2F97tRu51RM+NFencc3QpJs= MIME-Version: 1.0 From: auh@yoctoproject.org To: Forced@yoctoproject.org, maintainer@yoctoproject.org, for@yoctoproject.org, AUH@yoctoproject.org Cc: openembedded-devel@lists.openembedded.org Subject: [AUH] breakpad: upgrading to 2023.01.27 FAILED Message-ID: <0101018b96bebdf9-127f9925-ecaa-4266-a324-a07e62606561-000000@us-west-2.amazonses.com> Date: Fri, 3 Nov 2023 19:52:44 +0000 Feedback-ID: 1.us-west-2.9np3MYPs3fEaOBysGKSlUD4KtcmPijcmS9Az2Hwf7iQ=:AmazonSES X-SES-Outgoing: 2023.11.03-54.240.27.29 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 03 Nov 2023 19:52:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/105892 Hello, this email is a notification from the Auto Upgrade Helper that the automatic attempt to upgrade the recipe *breakpad* to *2023.01.27* has Failed(do_compile). Detailed error information: do_compile failed Next steps: - apply the patch: git am 0001-breakpad-upgrade-1.0-2023.01.27.patch - check the changes to upstream patches and summarize them in the commit message, - compile an image that contains the package - perform some basic sanity tests - amend the patch and sign it off: git commit -s --reset-author --amend - send it to the appropriate mailing list Alternatively, if you believe the recipe should not be upgraded at this time, you can fill RECIPE_NO_UPDATE_REASON in respective recipe file so that automatic upgrades would no longer be attempted. Please review the attached files for further information and build/update failures. Any problem please file a bug at https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Automated%20Update%20Handler Regards, The Upgrade Helper -- >8 -- From 9f06c7688aec7093bffc41a5e913bdfbe731ad5f Mon Sep 17 00:00:00 2001 From: Upgrade Helper Date: Fri, 3 Nov 2023 11:37:41 +0000 Subject: [PATCH] breakpad: upgrade 1.0 -> 2023.01.27 --- ...ript-to-coordinate-dumping-and-uploa.patch | 150 + ...001-lss-Match-syscalls-to-match-musl.patch | 58 - ...ler_objdump-from-the-build-on-non-li.patch | 1046 ++++ .../breakpad/0003-Add-ScopedTmpFile.patch | 1092 +++++ .../breakpad/0004-Add-ScopedPipe.patch | 625 +++ .../0005-Refactor-DisassemblerObjdump.patch | 622 +++ ..._LANGUAGE_STANDARD-from-c-0x-to-c-17.patch | 61 + .../breakpad/0007-Fix-Mac-build.patch | 37 + ...or-message-if-failed-to-send-http-re.patch | 36 + ...09-Print-Crashpad-annotation-objects.patch | 49 + .../breakpad/0010-Fix-sprintf-usage.patch | 29 + ...ig.h-to-the-beginning-of-all-cc-file.patch | 4258 +++++++++++++++++ ...sing-NXArchInfo-as-a-vocabulary-type.patch | 434 ++ ...0013-Mac-delete-unused-macho_dump.cc.patch | 228 + ...Add-brief-flag-to-minidump_stackwalk.patch | 173 + ...extra-comma-in-minidump_stackwalk.cc.patch | 26 + ...ac-New-n-MODULE-arg-to-Mac-dump_syms.patch | 203 + ...017-Mac-don-t-call-NXFindBestFatArch.patch | 150 + ...s-recognized-value-for-ELF-e_machine.patch | 34 + .../0019-Add-RISC-V-register-names.patch | 101 + .../0020-Add-maxsize-for-xstate-areas.patch | 67 + ...ISC-V-numeric-identifiers-to-strings.patch | 40 + ...or-opening-file-to-prevent-hanging-w.patch | 32 + ...-the-brief-output-of-minidump_stackw.patch | 41 + ...w-x-option-to-prefer-extern-names-wh.patch | 428 ++ ...name-matching-for-marking-symbols-as.patch | 54 + ...-int-with-size_t-for-ModuleSerialize.patch | 120 + .../breakpad/0027-Update-Mac-Headers.patch | 2615 ++++++++++ ...c-update-arch_utilities-for-macOS-13.patch | 272 ++ ...D64-X86-typo-in-MD_CONTEXT_AMD64_ALL.patch | 32 + ...Use-exception-context-for-crashed-th.patch | 116 + ...cture-byte_order.h-from-canonical-re.patch | 84 + ...032-Fix-dump_syms-help-typo-on-Linux.patch | 26 + ...vailability-checks-for-mach-o-util.h.patch | 35 + ...wModuleCrashpadInfoList-modules-type.patch | 31 + ...wCrashpadAnnotationList-objects-type.patch | 30 + ...yms-riscv-Fix-register-name-mismatch.patch | 36 + ...0037-dump_syms-riscv-Update-unittest.patch | 31 + ...allow-granular-control-over-the-use-.patch | 91 + .../breakpad/0039-Modernize-code.patch | 796 +++ ...-file-names-in-upload_system_symbols.patch | 64 + ...n_map-key-collision-when-split-dwarf.patch | 588 +++ ...ump-generation-on-arm-softfp-targets.patch | 41 + ...V-minidump-context-to-match-Crashpad.patch | 343 ++ ...ize-enable_objdump_for_exploitabilit.patch | 46 + ...-reading-DW_AT_ranges-in-split-dwarf.patch | 359 ++ ...-formatting-for-MinidumpCrashpadInfo.patch | 29 + ...e-and-.debug_line_str-among-dwp-file.patch | 243 + ...nges_data-is-index-0-in-DW_AT_ranges.patch | 94 + .../0049-Fix-warnings-in-configure.ac.patch | 431 ++ ...057-Committing-changes-from-do_patch.patch | 16 + .../breakpad/breakpad/mips_asm_sgidefs.patch | 19 - .../recipes-devtools/breakpad/breakpad_git.bb | 57 +- 53 files changed, 16638 insertions(+), 81 deletions(-) create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0001-Mac-add-shell-script-to-coordinate-dumping-and-uploa.patch delete mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0001-lss-Match-syscalls-to-match-musl.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0002-Remove-disassembler_objdump-from-the-build-on-non-li.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0003-Add-ScopedTmpFile.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0004-Add-ScopedPipe.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0005-Refactor-DisassemblerObjdump.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0006-Change-CLANG_CXX_LANGUAGE_STANDARD-from-c-0x-to-c-17.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0007-Fix-Mac-build.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0008-linux-Report-error-message-if-failed-to-send-http-re.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0009-Print-Crashpad-annotation-objects.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0010-Fix-sprintf-usage.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0011-Add-include-config.h-to-the-beginning-of-all-cc-file.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0012-Mac-stop-using-NXArchInfo-as-a-vocabulary-type.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0013-Mac-delete-unused-macho_dump.cc.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0014-Add-brief-flag-to-minidump_stackwalk.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0015-Remove-extra-comma-in-minidump_stackwalk.cc.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0016-dump_syms-Mac-New-n-MODULE-arg-to-Mac-dump_syms.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0017-Mac-don-t-call-NXFindBestFatArch.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0018-Add-EM_RISCV-as-recognized-value-for-ELF-e_machine.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0019-Add-RISC-V-register-names.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0020-Add-maxsize-for-xstate-areas.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0021-Convert-RISC-V-numeric-identifiers-to-strings.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0022-Set-O_NONBLOCK-for-opening-file-to-prevent-hanging-w.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0023-Fix-alignment-of-the-brief-output-of-minidump_stackw.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0024-dump_syms-Mac-New-x-option-to-prefer-extern-names-wh.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0025-dump_syms-Relax-name-matching-for-marking-symbols-as.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0026-Replace-unsigned-int-with-size_t-for-ModuleSerialize.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0027-Update-Mac-Headers.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0028-Mac-update-arch_utilities-for-macOS-13.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0029-Fix-AMD64-X86-typo-in-MD_CONTEXT_AMD64_ALL.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0030-minidump-2-core-Use-exception-context-for-crashed-th.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0031-Reimport-architecture-byte_order.h-from-canonical-re.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0032-Fix-dump_syms-help-typo-on-Linux.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0033-Include-iOS-in-availability-checks-for-mach-o-util.h.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0034-Fix-MDRawModuleCrashpadInfoList-modules-type.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0035-Fix-MDRawCrashpadAnnotationList-objects-type.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0036-dump_syms-riscv-Fix-register-name-mismatch.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0037-dump_syms-riscv-Update-unittest.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0038-Add-new-flag-to-allow-granular-control-over-the-use-.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0039-Modernize-code.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0040-Mac-shorten-sym-file-names-in-upload_system_symbols.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0041-Fix-inline_origin_map-key-collision-when-split-dwarf.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0042-Fix-minidump-generation-on-arm-softfp-targets.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0043-Modify-RISCV-minidump-context-to-match-Crashpad.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0044-Properly-initialize-enable_objdump_for_exploitabilit.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0045-Fix-reading-DW_AT_ranges-in-split-dwarf.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0046-Breakpad-Fix-hex-formatting-for-MinidumpCrashpadInfo.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0047-Share-.debug_line-and-.debug_line_str-among-dwp-file.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0048-Fix-bug-when-ranges_data-is-index-0-in-DW_AT_ranges.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0049-Fix-warnings-in-configure.ac.patch create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0057-Committing-changes-from-do_patch.patch delete mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0001-Mac-add-shell-script-to-coordinate-dumping-and-uploa.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0001-Mac-add-shell-script-to-coordinate-dumping-and-uploa.patch new file mode 100644 index 000000000..73ddf6a9a --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0001-Mac-add-shell-script-to-coordinate-dumping-and-uploa.patch @@ -0,0 +1,150 @@ +From 95857a18bb8392be8d88f704d49e08f4075f3dac Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Mon, 30 Jan 2023 10:30:39 -0500 +Subject: [PATCH] Mac: add shell script to coordinate dumping and uploading + macOS system symbols. + +This checks in an edited version of a script that has been used by the +Chrome Mac team for this purpose. It expects to reside in the same +place as `dump_syms`, `dsc_extractor`[0], `symupload` and `upload_system_symbols` binaries. + +When called, it will: +- Locate and extract any dyld_shared_caches found on the system +- Dump the above +- Dump any remaining uncached system libraries +- Write the results to a directory passed as an argument +- Provide (but not call) an `upload_system_symbols` invocation +to upload the results + +[0] Not yet checked in + +Bug: 1400770 + +Change-Id: I30610c23d0c979e34dd3830eeedb5ceeae8ce66b +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4111109 +Reviewed-by: Mark Mentovai +--- + .../upload_system_symbols.sh | 114 ++++++++++++++++++ + 1 file changed, 114 insertions(+) + create mode 100755 src/tools/mac/upload_system_symbols/upload_system_symbols.sh + +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 " >& 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=" \\ ++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/meta-oe/recipes-devtools/breakpad/breakpad/0001-lss-Match-syscalls-to-match-musl.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0001-lss-Match-syscalls-to-match-musl.patch deleted file mode 100644 index 80e5a8a76..000000000 --- a/meta-oe/recipes-devtools/breakpad/breakpad/0001-lss-Match-syscalls-to-match-musl.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 5f7333e4f7b7485598bd71aa80967e1a16a7f901 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 14 Sep 2017 22:57:52 -0700 -Subject: [PATCH] lss: Match syscalls to match musl - -Signed-off-by: Khem Raj ---- -Upstream-Status: Pending - - linux_syscall_support.h | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/linux_syscall_support.h -+++ b/linux_syscall_support.h -@@ -1006,6 +1006,9 @@ struct kernel_statx { - #define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) - #endif - -+#ifndef __NR_fstatat -+#define __NR_fstatat __NR_fstatat64 -+#endif - - #if defined(__x86_64__) - #ifndef ARCH_SET_GS -@@ -1140,6 +1143,7 @@ struct kernel_statx { - #ifndef __NR_getrandom - #define __NR_getrandom 355 - #endif -+ - /* End of i386 definitions */ - #elif defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) - #ifndef __NR_setresuid -@@ -1448,6 +1452,12 @@ struct kernel_statx { - #ifndef __NR_getrandom - #define __NR_getrandom 318 - #endif -+#ifndef __NR_pread -+#define __NR_pread __NR_pread64 -+#endif -+#ifndef __NR_pwrite -+#define __NR_pwrite __NR_pwrite64 -+#endif - /* End of x86-64 definitions */ - #elif defined(__mips__) - #if _MIPS_SIM == _MIPS_SIM_ABI32 -@@ -1633,6 +1643,12 @@ struct kernel_statx { - #ifndef __NR_getrandom - #define __NR_getrandom (__NR_Linux + 313) - #endif -+ -+#undef __NR_pread -+#define __NR_pread __NR_pread64 -+#undef __NR_pwrite -+#define __NR_pwrite __NR_pwrite64 -+ - /* End of MIPS (64bit API) definitions */ - #else - #ifndef __NR_setresuid diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0002-Remove-disassembler_objdump-from-the-build-on-non-li.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0002-Remove-disassembler_objdump-from-the-build-on-non-li.patch new file mode 100644 index 000000000..1fa7abb63 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0002-Remove-disassembler_objdump-from-the-build-on-non-li.patch @@ -0,0 +1,1046 @@ +From f6178140175800cc6385a151e7f23d6e5c4968ca Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Mon, 30 Jan 2023 11:15:11 +0100 +Subject: [PATCH] Remove disassembler_objdump from the build on non-linux + platforms. + +Change-Id: I29d628ac7cf79bfca1794ba325c945a0f122b360 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3964364 +Reviewed-by: Ivan Penkov +--- + Makefile.am | 32 ++- + Makefile.in | 389 ++++++++++++++++---------- + src/processor/disassembler_objdump.cc | 21 +- + src/processor/exploitability_linux.cc | 6 +- + src/processor/minidump_processor.cc | 9 +- + 5 files changed, 273 insertions(+), 184 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 9b7f7247..688725fa 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,10 @@ 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 ++endif LINUX_HOST + if SELFTEST + check_PROGRAMS += \ + src/processor/stackwalker_selftest +@@ -366,8 +369,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 +450,11 @@ 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/processor/disassembler_objdump.cc \ ++ src/processor/disassembler_objdump.h ++endif LINUX_HOST + + # libdisasm 3rd party library + src_third_party_libdisasm_libdisasm_a_SOURCES = \ +@@ -911,7 +917,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,6 +952,10 @@ 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/processor/disassembler_objdump.o ++endif + + src_processor_disassembler_objdump_unittest_SOURCES = \ + src/processor/disassembler_objdump_unittest.cc +@@ -1044,7 +1053,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 +1085,10 @@ 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/processor/disassembler_objdump.o ++endif + + src_processor_minidump_unittest_SOURCES = \ + src/common/test_assembler.cc \ +@@ -1194,7 +1206,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 +1231,10 @@ 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/processor/disassembler_objdump.o ++endif + + src_processor_stackwalker_amd64_unittest_SOURCES = \ + src/common/test_assembler.cc \ +@@ -1416,7 +1431,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 +1463,10 @@ 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/processor/disassembler_objdump.o ++endif LINUX_HOST + + ## Additional files to be included in a source distribution + ## +diff --git a/Makefile.in b/Makefile.in +index d358b6b1..54d8c2aa 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,10 @@ 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@@SELFTEST_TRUE@am__append_11 = \ + @DISABLE_PROCESSOR_FALSE@@SELFTEST_TRUE@ src/processor/stackwalker_selftest + + +@@ -203,17 +205,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 +224,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 +232,47 @@ 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/processor/disassembler_objdump.cc \ ++@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.h ++ ++@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/processor/disassembler_objdump.o ++ ++@LINUX_HOST_TRUE@am__append_28 = \ ++@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o ++ ++@LINUX_HOST_TRUE@am__append_29 = \ ++@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.o ++ ++@LINUX_HOST_TRUE@am__append_30 = \ ++@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 +324,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 +351,14 @@ 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@@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 +454,127 @@ 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/processor/disassembler_objdump.cc \ ++ src/processor/disassembler_objdump.h ++@LINUX_HOST_TRUE@am__objects_2 = \ ++@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 +610,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 = +@@ -553,13 +685,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) \ +@@ -585,7 +717,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) \ +@@ -769,9 +901,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 +931,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 = \ +@@ -901,7 +1031,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 +1056,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_28) + am_src_processor_minidump_stackwalk_OBJECTS = \ + src/processor/minidump_stackwalk.$(OBJEXT) + src_processor_minidump_stackwalk_OBJECTS = \ +@@ -937,7 +1066,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 +1090,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_30) + 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 +1211,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 +1232,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_29) + 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 = \ +@@ -1667,7 +1794,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) \ +@@ -2132,7 +2259,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 +2283,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 +2323,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 +2351,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 +2373,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 +2387,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 +2399,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 +2428,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 +2495,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 = \ +@@ -2420,12 +2533,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 +2574,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) +@@ -2765,23 +2878,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,11 +2909,9 @@ 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 \ +- $(TEST_LIBS) \ +- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) +- ++ src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \ ++ $(TEST_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \ ++ $(am__append_27) + src_processor_disassembler_objdump_unittest_SOURCES = \ + src/processor/disassembler_objdump_unittest.cc + +@@ -2908,25 +3014,18 @@ src_processor_minidump_processor_unittest_SOURCES = \ + 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 +3042,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_28) + src_processor_minidump_unittest_SOURCES = \ + src/common/test_assembler.cc \ + src/processor/minidump_unittest.cc \ +@@ -3080,18 +3177,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 +3200,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_29) + src_processor_stackwalker_amd64_unittest_SOURCES = \ + src/common/test_assembler.cc \ + src/processor/stackwalker_amd64_unittest.cc +@@ -3328,32 +3419,23 @@ src_processor_microdump_stackwalk_LDADD = \ + 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 +3448,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_30) + EXTRA_DIST = \ + $(SCRIPTS) \ + src/client/linux/data/linux-gate-amd.sym \ +@@ -3965,9 +4046,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 +4145,9 @@ 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/processor/disassembler_objdump.$(OBJEXT): \ ++ src/processor/$(am__dirstamp) \ ++ src/processor/$(DEPDIR)/$(am__dirstamp) + src/$(am__dirstamp): + @$(MKDIR_P) src + @: > src/$(am__dirstamp) +@@ -8766,13 +8847,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 +9036,13 @@ 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/processor/stackwalker_selftest.log: src/processor/stackwalker_selftest$(EXEEXT) + @p='src/processor/stackwalker_selftest$(EXEEXT)'; \ + b='src/processor/stackwalker_selftest'; \ +diff --git a/src/processor/disassembler_objdump.cc b/src/processor/disassembler_objdump.cc +index dfe10d58..c6b6ac57 100644 +--- a/src/processor/disassembler_objdump.cc ++++ b/src/processor/disassembler_objdump.cc +@@ -32,7 +32,6 @@ + + #include "processor/disassembler_objdump.h" + +-#ifdef __linux__ + #include + #include + #include +@@ -498,23 +497,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/exploitability_linux.cc b/src/processor/exploitability_linux.cc +index 63a12656..c48bbdf5 100644 +--- a/src/processor/exploitability_linux.cc ++++ b/src/processor/exploitability_linux.cc +@@ -41,7 +41,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 +158,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 +222,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/minidump_processor.cc b/src/processor/minidump_processor.cc +index fb330e26..d72926cb 100644 +--- a/src/processor/minidump_processor.cc ++++ b/src/processor/minidump_processor.cc +@@ -44,11 +44,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, +@@ -770,6 +773,7 @@ static bool IsCanonicalAddress(uint64_t address) { + return true; + } + ++#ifdef __linux__ + static void CalculateFaultAddressFromInstruction(Minidump* dump, + uint64_t* address) { + MinidumpException* exception = dump->GetException(); +@@ -832,6 +836,7 @@ static void CalculateFaultAddressFromInstruction(Minidump* dump, + *address = write_address; + } + } ++#endif // __linux__ + + // static + string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address, +@@ -2070,6 +2075,7 @@ string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address, + static_cast(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 +2084,7 @@ string MinidumpProcessor::GetCrashReason(Minidump* dump, uint64_t* address, + && std::numeric_limits::max() == *address) { + CalculateFaultAddressFromInstruction(dump, address); + } ++#endif // __linux__ + } + + return reason; diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0003-Add-ScopedTmpFile.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0003-Add-ScopedTmpFile.patch new file mode 100644 index 000000000..0036f2477 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0003-Add-ScopedTmpFile.patch @@ -0,0 +1,1092 @@ +From 9a87ff661e3ff2d6b4b4390a3e129bb933a36502 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Mon, 30 Jan 2023 11:19:45 +0100 +Subject: [PATCH] Add ScopedTmpFile. + +This replaces the existing AutoTestFile implementation with a simpler +implementation that uses O_TMPFILE to avoid having the temporary files +linked in the filesystem. + +Refactor the existing tests to use the new ScopedTmpFile instead of +duplicating the same ScopedTestFile wrapper into each test. + +Change-Id: Iee9416e52269eff271f748ec9d822aee6e28f59a +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3971917 +Reviewed-by: Lei Zhang +--- + Makefile.am | 16 ++- + Makefile.in | 85 +++++++++++- + .../linux/minidump_writer/cpu_set_unittest.cc | 60 ++++----- + .../minidump_writer/line_reader_unittest.cc | 41 +++--- + .../proc_cpuinfo_reader_unittest.cc | 56 +++----- + src/common/linux/scoped_tmpfile.cc | 99 ++++++++++++++ + src/common/linux/scoped_tmpfile.h | 85 ++++++++++++ + src/common/linux/scoped_tmpfile_unittest.cc | 46 +++++++ + src/common/linux/tests/auto_testfile.h | 123 ------------------ + 9 files changed, 388 insertions(+), 223 deletions(-) + create mode 100644 src/common/linux/scoped_tmpfile.cc + create mode 100644 src/common/linux/scoped_tmpfile.h + create mode 100644 src/common/linux/scoped_tmpfile_unittest.cc + delete mode 100644 src/common/linux/tests/auto_testfile.h + +diff --git a/Makefile.am b/Makefile.am +index 688725fa..dea7b53d 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -222,7 +222,8 @@ check_PROGRAMS += \ + src/processor/synth_minidump_unittest + if LINUX_HOST + check_PROGRAMS += \ +- src/processor/disassembler_objdump_unittest ++ src/processor/disassembler_objdump_unittest \ ++ src/common/linux/scoped_tmpfile_unittest + endif LINUX_HOST + if SELFTEST + check_PROGRAMS += \ +@@ -529,7 +530,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) +@@ -558,7 +558,8 @@ 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_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 \ +@@ -957,6 +958,15 @@ src_processor_exploitability_unittest_LDADD += \ + src/processor/disassembler_objdump.o + endif + ++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 = \ +diff --git a/Makefile.in b/Makefile.in +index 54d8c2aa..33e37458 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -193,7 +193,8 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1) + @DISABLE_PROCESSOR_FALSE@ src/processor/synth_minidump_unittest + + @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/processor/disassembler_objdump_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 +@@ -351,7 +352,8 @@ 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@@LINUX_HOST_TRUE@am__EXEEXT_6 = src/processor/disassembler_objdump_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_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) +@@ -672,7 +674,8 @@ 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_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 \ +@@ -706,6 +709,7 @@ 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_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) \ +@@ -809,6 +813,12 @@ 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_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) \ +@@ -1521,6 +1531,7 @@ 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_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 \ +@@ -1550,6 +1561,7 @@ 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_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 \ +@@ -1744,6 +1756,7 @@ 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_tmpfile_unittest_SOURCES) \ + $(src_common_mac_macho_reader_unittest_SOURCES) \ + $(src_common_safe_math_unittest_SOURCES) \ + $(src_common_test_assembler_unittest_SOURCES) \ +@@ -1804,6 +1817,7 @@ 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_tmpfile_unittest_SOURCES) \ + $(src_common_mac_macho_reader_unittest_SOURCES) \ + $(src_common_safe_math_unittest_SOURCES) \ + $(src_common_test_assembler_unittest_SOURCES) \ +@@ -2523,7 +2537,8 @@ 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_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 \ +@@ -2912,6 +2927,17 @@ src_processor_exploitability_unittest_LDADD = \ + src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \ + $(TEST_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \ + $(am__append_27) ++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 + +@@ -4293,6 +4319,9 @@ 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_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) +@@ -4539,6 +4568,13 @@ 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_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) +@@ -5329,6 +5365,7 @@ 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_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 +@@ -5358,6 +5395,7 @@ 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_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 +@@ -5854,6 +5892,20 @@ 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_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 +@@ -6792,6 +6844,20 @@ 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_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 +@@ -9043,6 +9109,13 @@ src/processor/disassembler_objdump_unittest.log: src/processor/disassembler_objd + --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'; \ +@@ -9535,6 +9608,7 @@ 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_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 +@@ -9564,6 +9638,7 @@ 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_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 +@@ -9889,6 +9964,7 @@ 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_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 +@@ -9918,6 +9994,7 @@ 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_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/src/client/linux/minidump_writer/cpu_set_unittest.cc b/src/client/linux/minidump_writer/cpu_set_unittest.cc +index 1db74410..e9d4e87a 100644 +--- a/src/client/linux/minidump_writer/cpu_set_unittest.cc ++++ b/src/client/linux/minidump_writer/cpu_set_unittest.cc +@@ -35,7 +35,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 +43,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 +51,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 +60,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 +69,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 +78,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 +87,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 +96,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 +105,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 +125,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 +137,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/line_reader_unittest.cc b/src/client/linux/minidump_writer/line_reader_unittest.cc +index 3062c39f..b96ebf9d 100644 +--- a/src/client/linux/minidump_writer/line_reader_unittest.cc ++++ b/src/client/linux/minidump_writer/line_reader_unittest.cc +@@ -32,7 +32,7 @@ + + #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 +40,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 +53,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 +69,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 +85,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 +107,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 +131,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 +147,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/proc_cpuinfo_reader_unittest.cc b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc +index f6d3e285..cbdc5fbc 100644 +--- a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc ++++ b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc +@@ -35,33 +35,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 +55,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 +68,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 +83,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 +100,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 +113,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 +126,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 +139,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 +156,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 +169,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/common/linux/scoped_tmpfile.cc b/src/common/linux/scoped_tmpfile.cc +new file mode 100644 +index 00000000..229e8d42 +--- /dev/null ++++ b/src/common/linux/scoped_tmpfile.cc +@@ -0,0 +1,99 @@ ++// 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. ++ ++#include "common/linux/scoped_tmpfile.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++#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(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 ++ ++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..f82c5998 +--- /dev/null ++++ b/src/common/linux/scoped_tmpfile_unittest.cc +@@ -0,0 +1,46 @@ ++// 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. ++ ++#include "common/linux/scoped_tmpfile.h" ++ ++#include ++ ++#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/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 +-#include +- +-#include +- +-#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(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(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(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/meta-oe/recipes-devtools/breakpad/breakpad/0004-Add-ScopedPipe.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0004-Add-ScopedPipe.patch new file mode 100644 index 000000000..719022a0e --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0004-Add-ScopedPipe.patch @@ -0,0 +1,625 @@ +From 5daa41904a02ab68b872758bc17a5d066244e5c2 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Mon, 30 Jan 2023 11:33:04 +0100 +Subject: [PATCH] Add ScopedPipe. + +This provides a similar wrapper to ScopedTmpFile for linux pipes. + +Change-Id: I53b377085322f61d87525d215ecd703f13ae9ae7 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3971918 +Reviewed-by: Lei Zhang +--- + Makefile.am | 12 +++ + Makefile.in | 77 ++++++++++++++ + src/common/linux/scoped_pipe.cc | 128 +++++++++++++++++++++++ + src/common/linux/scoped_pipe.h | 115 ++++++++++++++++++++ + src/common/linux/scoped_pipe_unittest.cc | 71 +++++++++++++ + 5 files changed, 403 insertions(+) + create mode 100644 src/common/linux/scoped_pipe.cc + create mode 100644 src/common/linux/scoped_pipe.h + create mode 100644 src/common/linux/scoped_pipe_unittest.cc + +diff --git a/Makefile.am b/Makefile.am +index dea7b53d..da13cce1 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -223,6 +223,7 @@ check_PROGRAMS += \ + 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 +@@ -558,6 +559,8 @@ 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/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 \ +@@ -958,6 +961,15 @@ src_processor_exploitability_unittest_LDADD += \ + 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 = \ +diff --git a/Makefile.in b/Makefile.in +index 33e37458..ef7e8fe6 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -194,6 +194,7 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1) + + @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 = \ +@@ -353,6 +354,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \ + @DISABLE_PROCESSOR_FALSE@ src/processor/stackwalker_x86_unittest$(EXEEXT) \ + @DISABLE_PROCESSOR_FALSE@ src/processor/synth_minidump_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) \ +@@ -674,6 +676,7 @@ 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/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 \ +@@ -709,6 +712,7 @@ 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) \ +@@ -813,6 +817,12 @@ 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) +@@ -1531,6 +1541,7 @@ 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 \ +@@ -1561,6 +1572,7 @@ 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_unittest-scoped_pipe_unittest.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 \ +@@ -1756,6 +1768,7 @@ 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) \ +@@ -1817,6 +1830,7 @@ 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) \ +@@ -2537,6 +2551,7 @@ 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/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 \ +@@ -2927,6 +2942,17 @@ src_processor_exploitability_unittest_LDADD = \ + 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 + +@@ -4319,6 +4345,9 @@ 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) +@@ -4568,6 +4597,13 @@ 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) +@@ -5365,6 +5401,7 @@ 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 +@@ -5395,6 +5432,7 @@ 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_unittest-scoped_pipe_unittest.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 +@@ -5892,6 +5930,20 @@ 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 +@@ -6844,6 +6896,20 @@ 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 +@@ -9109,6 +9175,13 @@ src/processor/disassembler_objdump_unittest.log: src/processor/disassembler_objd + --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'; \ +@@ -9608,6 +9681,7 @@ 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 +@@ -9638,6 +9712,7 @@ 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_unittest-scoped_pipe_unittest.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 +@@ -9964,6 +10039,7 @@ 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 +@@ -9994,6 +10070,7 @@ 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_unittest-scoped_pipe_unittest.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 +diff --git a/src/common/linux/scoped_pipe.cc b/src/common/linux/scoped_pipe.cc +new file mode 100644 +index 00000000..b13f8d45 +--- /dev/null ++++ b/src/common/linux/scoped_pipe.cc +@@ -0,0 +1,128 @@ ++// 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. ++ ++#include "common/linux/scoped_pipe.h" ++ ++#include ++ ++#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(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 ++#include ++ ++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..a7d6272c +--- /dev/null ++++ b/src/common/linux/scoped_pipe_unittest.cc +@@ -0,0 +1,71 @@ ++// 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. ++ ++#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/meta-oe/recipes-devtools/breakpad/breakpad/0005-Refactor-DisassemblerObjdump.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0005-Refactor-DisassemblerObjdump.patch new file mode 100644 index 000000000..e2bc3af84 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0005-Refactor-DisassemblerObjdump.patch @@ -0,0 +1,622 @@ +From 38115b0c5f57544e88e108fa1616acfaa7b9d984 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Mon, 30 Jan 2023 11:33:54 +0100 +Subject: [PATCH] Refactor DisassemblerObjdump. + +This change removes ScopedTmpFile from DisassemblerObjdump, and +replaces it with the use of the implementation in linux/common. + +It also switches to using ScopedPipe to read the output from objdump, +and directly execing objdump instead of using system. + +Change-Id: I6d425190fb4a20d6b265c72aa7315026687cb86a +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3971919 +Reviewed-by: Ivan Penkov +--- + Makefile.am | 32 ++++- + Makefile.in | 111 +++++++++++------ + src/processor/disassembler_objdump.cc | 172 ++++++++++++-------------- + 3 files changed, 178 insertions(+), 137 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index da13cce1..1d45f8e5 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -454,9 +454,13 @@ src_libbreakpad_a_SOURCES = \ + src/processor/tokenize.h + if LINUX_HOST + src_libbreakpad_a_SOURCES += \ +- src/processor/disassembler_objdump.cc \ +- src/processor/disassembler_objdump.h +-endif LINUX_HOST ++ 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 = \ +@@ -958,6 +962,8 @@ src_processor_exploitability_unittest_LDADD = \ + $(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 + +@@ -984,6 +990,8 @@ src_processor_disassembler_objdump_unittest_SOURCES = \ + 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 \ +@@ -1064,6 +1072,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 +@@ -1109,6 +1123,8 @@ src_processor_minidump_processor_unittest_LDADD = \ + $(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 + +@@ -1255,6 +1271,8 @@ src_processor_stackwalker_selftest_LDADD = \ + $(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 + +@@ -1443,6 +1461,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 +@@ -1487,6 +1511,8 @@ src_processor_minidump_stackwalk_LDADD = \ + 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 + +diff --git a/Makefile.in b/Makefile.in +index ef7e8fe6..d790cac4 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -248,8 +248,12 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1) + @DISABLE_TOOLS_FALSE@@LINUX_HOST_TRUE@@X86_HOST_TRUE@ src/common/mac/macho_reader_unittest + + @LINUX_HOST_TRUE@am__append_22 = \ +-@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.cc \ +-@LINUX_HOST_TRUE@ src/processor/disassembler_objdump.h ++@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 +@@ -264,15 +268,33 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1) + @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 = . +@@ -569,9 +591,14 @@ am__src_libbreakpad_a_SOURCES_DIST = \ + src/processor/symbolic_constants_win.cc \ + src/processor/symbolic_constants_win.h \ + src/processor/tokenize.cc src/processor/tokenize.h \ +- src/processor/disassembler_objdump.cc \ +- src/processor/disassembler_objdump.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) \ +@@ -903,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 \ +@@ -999,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 = \ +@@ -1031,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 = \ +@@ -1076,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__append_28) ++ $(am__DEPENDENCIES_1) $(am__append_29) + am_src_processor_minidump_stackwalk_OBJECTS = \ + src/processor/minidump_stackwalk.$(OBJEXT) + src_processor_minidump_stackwalk_OBJECTS = \ +@@ -1111,7 +1140,7 @@ src_processor_minidump_stackwalk_DEPENDENCIES = \ + src/processor/stackwalker_x86.o \ + src/processor/symbolic_constants_win.o \ + src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \ +- $(am__append_30) ++ $(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) +@@ -1252,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__append_29) ++ $(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 = \ +@@ -1572,7 +1601,9 @@ 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 \ +@@ -2971,6 +3002,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 \ +@@ -3028,17 +3061,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 \ +@@ -3055,11 +3085,9 @@ 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 + +@@ -3096,7 +3124,7 @@ src_processor_minidump_processor_unittest_LDADD = \ + src/processor/symbolic_constants_win.o \ + src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \ + $(TEST_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \ +- $(am__append_28) ++ $(am__append_29) + src_processor_minidump_unittest_SOURCES = \ + src/common/test_assembler.cc \ + src/processor/minidump_unittest.cc \ +@@ -3253,7 +3281,7 @@ src_processor_stackwalker_selftest_LDADD = \ + src/processor/stackwalker_riscv64.o \ + src/processor/stackwalker_sparc.o \ + src/processor/stackwalker_x86.o src/processor/tokenize.o \ +- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(am__append_29) ++ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(am__append_30) + src_processor_stackwalker_amd64_unittest_SOURCES = \ + src/common/test_assembler.cc \ + src/processor/stackwalker_amd64_unittest.cc +@@ -3433,27 +3461,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 \ +@@ -3464,10 +3487,8 @@ 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 + +@@ -3501,7 +3522,7 @@ src_processor_minidump_stackwalk_LDADD = src/common/path_helper.o \ + src/processor/stackwalker_x86.o \ + src/processor/symbolic_constants_win.o \ + src/processor/tokenize.o src/third_party/libdisasm/libdisasm.a \ +- $(am__append_30) ++ $(am__append_32) + EXTRA_DIST = \ + $(SCRIPTS) \ + src/client/linux/data/linux-gate-amd.sym \ +@@ -4197,6 +4218,12 @@ 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) +@@ -5432,7 +5459,9 @@ 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 +@@ -9712,7 +9741,9 @@ 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 +@@ -10070,7 +10101,9 @@ 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 +diff --git a/src/processor/disassembler_objdump.cc b/src/processor/disassembler_objdump.cc +index c6b6ac57..f000b4b4 100644 +--- a/src/processor/disassembler_objdump.cc ++++ b/src/processor/disassembler_objdump.cc +@@ -33,6 +33,9 @@ + #include "processor/disassembler_objdump.h" + + #include ++#include ++ ++#include + #include + #include + #include +@@ -40,76 +43,15 @@ + #include + #include + ++#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" || +@@ -284,47 +226,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; + } + +- 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."; ++ // 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; + } + +- // Pipe each output line into the string until the string contains the first +- // instruction from objdump. +- std::ifstream objdump_stream(disassembly_file.path()); ++ pid_t child_pid = fork(); ++ if (child_pid < 0) { ++ BPLOG(ERROR) << "Fork failed."; ++ return false; ++ } + +- // 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..." ++ 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); ++ } + +- std::string line; +- std::smatch match; +- do { +- if (!getline(objdump_stream, line)) { +- BPLOG(INFO) << "Failed to find instruction in objdump output."; ++ // 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(); ++ ++ // 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; + } diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0006-Change-CLANG_CXX_LANGUAGE_STANDARD-from-c-0x-to-c-17.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0006-Change-CLANG_CXX_LANGUAGE_STANDARD-from-c-0x-to-c-17.patch new file mode 100644 index 000000000..dbc83b569 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0006-Change-CLANG_CXX_LANGUAGE_STANDARD-from-c-0x-to-c-17.patch @@ -0,0 +1,61 @@ +From bc25ffb613086afa4184af3aca1722ff747a21fc Mon Sep 17 00:00:00 2001 +From: Hiroyuki Komatsu +Date: Mon, 6 Feb 2023 21:02:22 +0900 +Subject: [PATCH] Change CLANG_CXX_LANGUAGE_STANDARD from "c++0x" to "c++17". + +* This fixes build errors with `xcodebuild`. +* CLANG_CXX_LANGUAGE_STANDARD represents "-std" (e.g. "=std=c++17"). + +Change-Id: Ibeeccb2d77518d2e767a6cf4840ff673427d98ba +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4218220 +Reviewed-by: Mike Frysinger +Reviewed-by: Nelson Billing +--- + src/tools/mac/dump_syms/dump_syms.xcodeproj/project.pbxproj | 4 ++-- + src/tools/mac/symupload/symupload.xcodeproj/project.pbxproj | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +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/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/meta-oe/recipes-devtools/breakpad/breakpad/0007-Fix-Mac-build.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0007-Fix-Mac-build.patch new file mode 100644 index 000000000..943776451 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0007-Fix-Mac-build.patch @@ -0,0 +1,37 @@ +From 5687ac51caab4f7100ddcb9dea92ca6bd6be66e7 Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Tue, 7 Feb 2023 15:44:24 -0500 +Subject: [PATCH] Fix Mac build + +https://chromium.googlesource.com/breakpad/breakpad/+/f6178140175800cc6385a151e7f23d6e5c4968ca +missed marking `IsCanonicalAddress` Linux-only. + +Bug: None +Change-Id: Ia936db4b5541f22abcc884d410e7eae3818b4c0f +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4227418 +Reviewed-by: Mark Mentovai +--- + src/processor/minidump_processor.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc +index d72926cb..0073ae4e 100644 +--- a/src/processor/minidump_processor.cc ++++ b/src/processor/minidump_processor.cc +@@ -763,6 +763,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) { +@@ -773,7 +775,6 @@ static bool IsCanonicalAddress(uint64_t address) { + return true; + } + +-#ifdef __linux__ + static void CalculateFaultAddressFromInstruction(Minidump* dump, + uint64_t* address) { + MinidumpException* exception = dump->GetException(); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0008-linux-Report-error-message-if-failed-to-send-http-re.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0008-linux-Report-error-message-if-failed-to-send-http-re.patch new file mode 100644 index 000000000..1ef34dd48 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0008-linux-Report-error-message-if-failed-to-send-http-re.patch @@ -0,0 +1,36 @@ +From 5f72a811c1304885766d8594ae12f57709387b72 Mon Sep 17 00:00:00 2001 +From: Xinan Lin +Date: Sat, 11 Feb 2023 18:26:02 +0900 +Subject: [PATCH] [linux] Report error message if failed to send http request + +If symupload client failed to connect the backend, we need this error +message to be exposed. This could help the failure we are facing in +official staging builders. + +BUG=chromium:1401761 +TEST=NA + +Change-Id: Ic720aff9cb523c38553d6c02bf72aa5b95e862a7 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4240299 +Reviewed-by: Nelson Billing +--- + src/common/linux/libcurl_wrapper.cc | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc +index a53087d9..c4a174a8 100644 +--- a/src/common/linux/libcurl_wrapper.cc ++++ b/src/common/linux/libcurl_wrapper.cc +@@ -303,12 +303,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/meta-oe/recipes-devtools/breakpad/breakpad/0009-Print-Crashpad-annotation-objects.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0009-Print-Crashpad-annotation-objects.patch new file mode 100644 index 000000000..2997a06ae --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0009-Print-Crashpad-annotation-objects.patch @@ -0,0 +1,49 @@ +From 984e043d7999c866d20b7bc08eb1c1d641ca9266 Mon Sep 17 00:00:00 2001 +From: Brian Sheedy +Date: Thu, 16 Feb 2023 10:51:13 -0800 +Subject: [PATCH] Print Crashpad annotation objects + +Updates minidump_dump to print out any Crashpad annotation objects that +are in a minidump. If an annotation contains a string value, it will be +printed out as such, otherwise it will be printed out as hex bytes. + +Bug: crashpad:329 +Change-Id: Ieecd6381c623f9011b16357742f7145a118dbc3c +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4261631 +Reviewed-by: Joshua Peraza +--- + src/processor/minidump.cc | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc +index 135770d5..2df932f4 100644 +--- a/src/processor/minidump.cc ++++ b/src/processor/minidump.cc +@@ -5479,6 +5479,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(v)); ++ } ++ } else { ++ // Value represents something else. ++ char buffer[3]; ++ for (const uint8_t& v : annot.value) { ++ sprintf(buffer, "%X", 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/meta-oe/recipes-devtools/breakpad/breakpad/0010-Fix-sprintf-usage.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0010-Fix-sprintf-usage.patch new file mode 100644 index 000000000..2ecc5b05f --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0010-Fix-sprintf-usage.patch @@ -0,0 +1,29 @@ +From abb105db21e962eda5b7d9b7a0ac8dd701e0b987 Mon Sep 17 00:00:00 2001 +From: Brian Sheedy +Date: Thu, 16 Feb 2023 12:35:22 -0800 +Subject: [PATCH] Fix sprintf usage + +Changes a recent introduction of sprintf to snprintf since sprintf is +deprecated in Chromium. + +Bug: crashpad:329 +Change-Id: Icd346da4c86bd8e867266dfebaf617991dd90113 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4261633 +Reviewed-by: Joshua Peraza +--- + src/processor/minidump.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc +index 2df932f4..8c4f75d6 100644 +--- a/src/processor/minidump.cc ++++ b/src/processor/minidump.cc +@@ -5492,7 +5492,7 @@ void MinidumpCrashpadInfo::Print() { + // Value represents something else. + char buffer[3]; + for (const uint8_t& v : annot.value) { +- sprintf(buffer, "%X", v); ++ snprintf(buffer, sizeof(buffer), "%X", v); + str_value.append(buffer); + } + } diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0011-Add-include-config.h-to-the-beginning-of-all-cc-file.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0011-Add-include-config.h-to-the-beginning-of-all-cc-file.patch new file mode 100644 index 000000000..6d700e22e --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0011-Add-include-config.h-to-the-beginning-of-all-cc-file.patch @@ -0,0 +1,4258 @@ +From f5123d71965578abf905d6388a79a232597bb1eb Mon Sep 17 00:00:00 2001 +From: Ian Barkley-Yeung +Date: Fri, 24 Feb 2023 11:14:53 -0800 +Subject: [PATCH] Add #include to the beginning of all cc files + +Added + #ifdef HAVE_CONFIG_H + #include + #endif +to the beginning of all source files that didn't have it. + +This ensures that configuration options are respected in all source +files. In particular, it ensures that the defines needed to fix Large +File System issues are set before including system headers. + +More generally, it ensures consistency between the source files, and +avoids the possibility of ODR violations between source files that were +including config.h and source files that were not. + +Process: +Ran +find . \( -name third_party -prune \) -o \( -name '.git*' -prune \) -o \( \( -name '*.cc' -o -name '*.c' \) -exec sed -i '0,/^#include/ s/^#include/#ifdef HAVE_CONFIG_H\n#include \/\/ Must come first\n#endif\n\n#include/' {} + \) +and then manually fixed up src/common/linux/guid_creator.cc, +src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc, +src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc, +src/common/stabs_reader.h, and src/common/linux/breakpad_getcontext.h. + +BUG=google-breakpad:877 +Fixed: google-breakpad:877 +TEST=./configure && make && make check +TEST=Did the find/sed in ChromeOS's copy, ensured emerge-hana google-breakpad +worked and had fewer LFS violations. +TEST=Did the find/sed in Chrome's copy, ensured compiling hana, windows, linux, and +eve still worked (since Chrome doesn't used config.h) + +Change-Id: I16cededbba0ea0c28e919b13243e35300999e799 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4289676 +Reviewed-by: Mike Frysinger +--- + src/client/ios/exception_handler_no_mach.cc | 4 ++++ + src/client/linux/crash_generation/crash_generation_client.cc | 4 ++++ + src/client/linux/crash_generation/crash_generation_server.cc | 4 ++++ + src/client/linux/dump_writer_common/thread_info.cc | 4 ++++ + src/client/linux/dump_writer_common/ucontext_reader.cc | 4 ++++ + src/client/linux/handler/exception_handler.cc | 4 ++++ + src/client/linux/handler/exception_handler_unittest.cc | 4 ++++ + src/client/linux/handler/minidump_descriptor.cc | 4 ++++ + src/client/linux/log/log.cc | 4 ++++ + src/client/linux/microdump_writer/microdump_writer.cc | 4 ++++ + .../linux/microdump_writer/microdump_writer_unittest.cc | 4 ++++ + src/client/linux/minidump_writer/cpu_set_unittest.cc | 4 ++++ + .../linux/minidump_writer/directory_reader_unittest.cc | 4 ++++ + src/client/linux/minidump_writer/line_reader_unittest.cc | 4 ++++ + src/client/linux/minidump_writer/linux_core_dumper.cc | 4 ++++ + .../linux/minidump_writer/linux_core_dumper_unittest.cc | 4 ++++ + src/client/linux/minidump_writer/linux_dumper.cc | 4 ++++ + .../linux/minidump_writer/linux_dumper_unittest_helper.cc | 4 ++++ + src/client/linux/minidump_writer/linux_ptrace_dumper.cc | 4 ++++ + .../linux/minidump_writer/linux_ptrace_dumper_unittest.cc | 4 ++++ + src/client/linux/minidump_writer/minidump_writer.cc | 4 ++++ + src/client/linux/minidump_writer/minidump_writer_unittest.cc | 4 ++++ + .../linux/minidump_writer/minidump_writer_unittest_utils.cc | 4 ++++ + src/client/linux/minidump_writer/pe_file.cc | 4 ++++ + .../linux/minidump_writer/proc_cpuinfo_reader_unittest.cc | 4 ++++ + src/client/linux/sender/google_crash_report_sender.cc | 4 ++++ + src/client/mac/crash_generation/crash_generation_client.cc | 4 ++++ + src/client/mac/crash_generation/crash_generation_server.cc | 4 ++++ + src/client/mac/handler/breakpad_nlist_64.cc | 4 ++++ + src/client/mac/handler/dynamic_images.cc | 4 ++++ + src/client/mac/handler/exception_handler.cc | 4 ++++ + src/client/mac/handler/minidump_generator.cc | 4 ++++ + src/client/mac/handler/protected_memory_allocator.cc | 4 ++++ + src/client/mac/handler/testcases/DynamicImagesTests.cc | 4 ++++ + src/client/mac/handler/testcases/breakpad_nlist_test.cc | 4 ++++ + src/client/mac/tests/crash_generation_server_test.cc | 4 ++++ + src/client/mac/tests/exception_handler_test.cc | 4 ++++ + src/client/mac/tests/minidump_generator_test.cc | 4 ++++ + src/client/mac/tests/minidump_generator_test_helper.cc | 4 ++++ + src/client/minidump_file_writer.cc | 4 ++++ + src/client/minidump_file_writer_unittest.cc | 4 ++++ + src/client/solaris/handler/exception_handler.cc | 4 ++++ + src/client/solaris/handler/exception_handler_test.cc | 4 ++++ + src/client/solaris/handler/minidump_generator.cc | 4 ++++ + src/client/solaris/handler/minidump_test.cc | 4 ++++ + src/client/solaris/handler/solaris_lwp.cc | 4 ++++ + src/client/windows/crash_generation/client_info.cc | 4 ++++ + .../windows/crash_generation/crash_generation_client.cc | 4 ++++ + .../windows/crash_generation/crash_generation_server.cc | 4 ++++ + src/client/windows/crash_generation/minidump_generator.cc | 4 ++++ + src/client/windows/handler/exception_handler.cc | 4 ++++ + src/client/windows/sender/crash_report_sender.cc | 4 ++++ + .../windows/tests/crash_generation_app/abstract_class.cc | 4 ++++ + .../tests/crash_generation_app/crash_generation_app.cc | 4 ++++ + src/client/windows/unittests/crash_generation_server_test.cc | 4 ++++ + src/client/windows/unittests/dump_analysis.cc | 4 ++++ + src/client/windows/unittests/exception_handler_death_test.cc | 4 ++++ + .../windows/unittests/exception_handler_nesting_test.cc | 4 ++++ + src/client/windows/unittests/exception_handler_test.cc | 4 ++++ + src/client/windows/unittests/minidump_test.cc | 4 ++++ + src/common/byte_cursor_unittest.cc | 4 ++++ + src/common/convert_UTF.cc | 4 ++++ + src/common/dwarf/bytereader.cc | 4 ++++ + src/common/dwarf/bytereader_unittest.cc | 4 ++++ + src/common/dwarf/cfi_assembler.cc | 4 ++++ + src/common/dwarf/dwarf2diehandler.cc | 4 ++++ + src/common/dwarf/dwarf2diehandler_unittest.cc | 4 ++++ + src/common/dwarf/dwarf2reader.cc | 4 ++++ + src/common/dwarf/dwarf2reader_cfi_unittest.cc | 4 ++++ + src/common/dwarf/dwarf2reader_die_unittest.cc | 4 ++++ + src/common/dwarf/dwarf2reader_lineinfo_unittest.cc | 4 ++++ + src/common/dwarf/dwarf2reader_splitfunctions_unittest.cc | 4 ++++ + src/common/dwarf/elf_reader.cc | 4 ++++ + src/common/dwarf/functioninfo.cc | 4 ++++ + src/common/dwarf_cfi_to_module.cc | 4 ++++ + src/common/dwarf_cfi_to_module_unittest.cc | 4 ++++ + src/common/dwarf_cu_to_module.cc | 4 ++++ + src/common/dwarf_cu_to_module_unittest.cc | 4 ++++ + src/common/dwarf_line_to_module.cc | 4 ++++ + src/common/dwarf_line_to_module_unittest.cc | 4 ++++ + src/common/dwarf_range_list_handler.cc | 4 ++++ + src/common/language.cc | 4 ++++ + src/common/linux/breakpad_getcontext.h | 4 ---- + src/common/linux/breakpad_getcontext_unittest.cc | 4 ++++ + src/common/linux/crc32.cc | 4 ++++ + src/common/linux/dump_symbols.cc | 4 ++++ + src/common/linux/dump_symbols_unittest.cc | 4 ++++ + src/common/linux/elf_core_dump.cc | 4 ++++ + src/common/linux/elf_core_dump_unittest.cc | 4 ++++ + src/common/linux/elf_symbols_to_module.cc | 4 ++++ + src/common/linux/elf_symbols_to_module_unittest.cc | 4 ++++ + src/common/linux/elfutils.cc | 4 ++++ + src/common/linux/file_id.cc | 4 ++++ + src/common/linux/file_id_unittest.cc | 4 ++++ + src/common/linux/google_crashdump_uploader.cc | 4 ++++ + src/common/linux/google_crashdump_uploader_test.cc | 4 ++++ + src/common/linux/guid_creator.cc | 2 +- + src/common/linux/http_upload.cc | 4 ++++ + src/common/linux/libcurl_wrapper.cc | 4 ++++ + src/common/linux/linux_libc_support.cc | 4 ++++ + src/common/linux/linux_libc_support_unittest.cc | 4 ++++ + src/common/linux/memory_mapped_file.cc | 4 ++++ + src/common/linux/memory_mapped_file_unittest.cc | 4 ++++ + src/common/linux/safe_readlink.cc | 4 ++++ + src/common/linux/safe_readlink_unittest.cc | 4 ++++ + src/common/linux/scoped_pipe.cc | 4 ++++ + src/common/linux/scoped_pipe_unittest.cc | 4 ++++ + src/common/linux/scoped_tmpfile.cc | 4 ++++ + src/common/linux/scoped_tmpfile_unittest.cc | 4 ++++ + src/common/linux/symbol_collector_client.cc | 4 ++++ + src/common/linux/symbol_upload.cc | 4 ++++ + src/common/linux/synth_elf.cc | 4 ++++ + src/common/linux/synth_elf_unittest.cc | 4 ++++ + src/common/linux/tests/crash_generator.cc | 4 ++++ + src/common/long_string_dictionary.cc | 4 ++++ + src/common/long_string_dictionary_unittest.cc | 4 ++++ + src/common/mac/arch_utilities.cc | 4 ++++ + src/common/mac/bootstrap_compat.cc | 4 ++++ + src/common/mac/dump_syms.cc | 4 ++++ + src/common/mac/file_id.cc | 4 ++++ + src/common/mac/launch_reporter.cc | 4 ++++ + src/common/mac/macho_id.cc | 4 ++++ + src/common/mac/macho_reader.cc | 4 ++++ + src/common/mac/macho_reader_unittest.cc | 4 ++++ + src/common/mac/macho_utilities.cc | 4 ++++ + src/common/mac/macho_walker.cc | 4 ++++ + src/common/mac/string_utilities.cc | 4 ++++ + src/common/md5.cc | 4 ++++ + src/common/memory_allocator_unittest.cc | 4 ++++ + src/common/memory_range_unittest.cc | 4 ++++ + src/common/module.cc | 4 ++++ + src/common/module_unittest.cc | 4 ++++ + src/common/path_helper.cc | 4 ++++ + src/common/safe_math_unittest.cc | 4 ++++ + src/common/simple_string_dictionary.cc | 4 ++++ + src/common/simple_string_dictionary_unittest.cc | 4 ++++ + src/common/solaris/dump_symbols.cc | 4 ++++ + src/common/solaris/file_id.cc | 4 ++++ + src/common/solaris/guid_creator.cc | 4 ++++ + src/common/stabs_reader.cc | 4 ++++ + src/common/stabs_reader.h | 4 ---- + src/common/stabs_reader_unittest.cc | 4 ++++ + src/common/stabs_to_module.cc | 4 ++++ + src/common/stabs_to_module_unittest.cc | 4 ++++ + src/common/string_conversion.cc | 4 ++++ + src/common/string_conversion_unittest.cc | 4 ++++ + src/common/test_assembler.cc | 4 ++++ + src/common/test_assembler_unittest.cc | 4 ++++ + src/common/tests/file_utils.cc | 4 ++++ + src/common/windows/dia_util.cc | 4 ++++ + src/common/windows/guid_string.cc | 4 ++++ + src/common/windows/http_upload.cc | 4 ++++ + src/common/windows/omap.cc | 4 ++++ + src/common/windows/omap_unittest.cc | 4 ++++ + src/common/windows/pdb_source_line_writer.cc | 4 ++++ + src/common/windows/pe_source_line_writer.cc | 4 ++++ + src/common/windows/pe_util.cc | 4 ++++ + src/common/windows/string_utils.cc | 4 ++++ + src/common/windows/sym_upload_v2_protocol.cc | 4 ++++ + src/common/windows/symbol_collector_client.cc | 4 ++++ + src/processor/address_map_unittest.cc | 4 ++++ + src/processor/basic_code_modules.cc | 4 ++++ + src/processor/basic_source_line_resolver.cc | 4 ++++ + src/processor/basic_source_line_resolver_unittest.cc | 4 ++++ + src/processor/call_stack.cc | 4 ++++ + src/processor/cfi_frame_info.cc | 4 ++++ + src/processor/cfi_frame_info_unittest.cc | 4 ++++ + src/processor/contained_range_map_unittest.cc | 4 ++++ + src/processor/convert_old_arm64_context.cc | 4 ++++ + src/processor/disassembler_objdump.cc | 4 ++++ + src/processor/disassembler_objdump_unittest.cc | 4 ++++ + src/processor/disassembler_x86.cc | 4 ++++ + src/processor/disassembler_x86_unittest.cc | 4 ++++ + src/processor/dump_context.cc | 4 ++++ + src/processor/dump_object.cc | 4 ++++ + src/processor/exploitability.cc | 4 ++++ + src/processor/exploitability_linux.cc | 4 ++++ + src/processor/exploitability_unittest.cc | 4 ++++ + src/processor/exploitability_win.cc | 4 ++++ + src/processor/fast_source_line_resolver.cc | 4 ++++ + src/processor/fast_source_line_resolver_unittest.cc | 4 ++++ + src/processor/logging.cc | 4 ++++ + src/processor/map_serializers_unittest.cc | 4 ++++ + src/processor/microdump.cc | 4 ++++ + src/processor/microdump_processor.cc | 4 ++++ + src/processor/microdump_processor_unittest.cc | 4 ++++ + src/processor/microdump_stackwalk.cc | 4 ++++ + src/processor/minidump.cc | 4 ++++ + src/processor/minidump_dump.cc | 4 ++++ + src/processor/minidump_processor.cc | 4 ++++ + src/processor/minidump_processor_unittest.cc | 4 ++++ + src/processor/minidump_stackwalk.cc | 4 ++++ + src/processor/minidump_unittest.cc | 4 ++++ + src/processor/module_comparer.cc | 4 ++++ + src/processor/module_serializer.cc | 4 ++++ + src/processor/pathname_stripper.cc | 4 ++++ + src/processor/pathname_stripper_unittest.cc | 4 ++++ + src/processor/postfix_evaluator_unittest.cc | 4 ++++ + src/processor/proc_maps_linux.cc | 4 ++++ + src/processor/proc_maps_linux_unittest.cc | 4 ++++ + src/processor/process_state.cc | 4 ++++ + src/processor/range_map_truncate_lower_unittest.cc | 4 ++++ + src/processor/range_map_truncate_upper_unittest.cc | 4 ++++ + src/processor/range_map_unittest.cc | 4 ++++ + src/processor/simple_symbol_supplier.cc | 4 ++++ + src/processor/source_line_resolver_base.cc | 4 ++++ + src/processor/stack_frame_cpu.cc | 4 ++++ + src/processor/stack_frame_symbolizer.cc | 4 ++++ + src/processor/stackwalk_common.cc | 4 ++++ + src/processor/stackwalker.cc | 4 ++++ + src/processor/stackwalker_address_list.cc | 4 ++++ + src/processor/stackwalker_address_list_unittest.cc | 4 ++++ + src/processor/stackwalker_amd64.cc | 4 ++++ + src/processor/stackwalker_amd64_unittest.cc | 4 ++++ + src/processor/stackwalker_arm.cc | 4 ++++ + src/processor/stackwalker_arm64.cc | 4 ++++ + src/processor/stackwalker_arm64_unittest.cc | 4 ++++ + src/processor/stackwalker_arm_unittest.cc | 4 ++++ + src/processor/stackwalker_mips.cc | 4 ++++ + src/processor/stackwalker_mips64_unittest.cc | 4 ++++ + src/processor/stackwalker_mips_unittest.cc | 4 ++++ + src/processor/stackwalker_ppc.cc | 4 ++++ + src/processor/stackwalker_ppc64.cc | 4 ++++ + src/processor/stackwalker_riscv.cc | 4 ++++ + src/processor/stackwalker_riscv64.cc | 4 ++++ + src/processor/stackwalker_riscv64_unittest.cc | 4 ++++ + src/processor/stackwalker_riscv_unittest.cc | 4 ++++ + src/processor/stackwalker_selftest.cc | 4 ++++ + src/processor/stackwalker_sparc.cc | 4 ++++ + src/processor/stackwalker_x86.cc | 4 ++++ + src/processor/stackwalker_x86_unittest.cc | 4 ++++ + src/processor/static_address_map_unittest.cc | 4 ++++ + src/processor/static_contained_range_map_unittest.cc | 4 ++++ + src/processor/static_map_unittest.cc | 4 ++++ + src/processor/static_range_map_unittest.cc | 4 ++++ + src/processor/symbolic_constants_win.cc | 4 ++++ + src/processor/synth_minidump.cc | 4 ++++ + src/processor/synth_minidump_unittest.cc | 4 ++++ + src/processor/testdata/linux_test_app.cc | 4 ++++ + src/processor/testdata/test_app.cc | 4 ++++ + src/processor/tokenize.cc | 4 ++++ + src/tools/linux/core2md/core2md.cc | 4 ++++ + src/tools/linux/core_handler/core_handler.cc | 4 ++++ + src/tools/linux/dump_syms/dump_syms.cc | 4 ++++ + src/tools/linux/md2core/minidump-2-core.cc | 4 ++++ + src/tools/linux/md2core/minidump_memory_range_unittest.cc | 4 ++++ + src/tools/linux/pid2md/pid2md.cc | 4 ++++ + src/tools/linux/symupload/minidump_upload.cc | 4 ++++ + src/tools/linux/symupload/sym_upload.cc | 4 ++++ + src/tools/mac/dump_syms/dump_syms_tool.cc | 4 ++++ + src/tools/mac/dump_syms/macho_dump.cc | 4 ++++ + src/tools/solaris/dump_syms/dump_syms.cc | 4 ++++ + src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc | 4 ++++ + src/tools/windows/converter/ms_symbol_server_converter.cc | 4 ++++ + src/tools/windows/converter_exe/converter.cc | 4 ++++ + src/tools/windows/converter_exe/escaping.cc | 4 ++++ + src/tools/windows/converter_exe/http_download.cc | 4 ++++ + src/tools/windows/converter_exe/tokenizer.cc | 4 ++++ + src/tools/windows/converter_exe/winhttp_client.cc | 4 ++++ + src/tools/windows/converter_exe/wininet_client.cc | 4 ++++ + src/tools/windows/dump_syms/dump_syms.cc | 4 ++++ + src/tools/windows/dump_syms/dump_syms_unittest.cc | 4 ++++ + src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc | 5 +++++ + src/tools/windows/symupload/symupload.cc | 4 ++++ + 264 files changed, 1046 insertions(+), 9 deletions(-) + +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 // Must come first ++#endif ++ + #include + #include + +diff --git a/src/client/linux/crash_generation/crash_generation_client.cc b/src/client/linux/crash_generation/crash_generation_client.cc +index 5a8c6b4c..f06273d5 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 // Must come first ++#endif ++ + #include "client/linux/crash_generation/crash_generation_client.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/client/linux/dump_writer_common/thread_info.cc b/src/client/linux/dump_writer_common/thread_info.cc +index d8bf80b0..fc82c0c6 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 // Must come first ++#endif ++ + #include "client/linux/dump_writer_common/thread_info.h" + + #include +diff --git a/src/client/linux/dump_writer_common/ucontext_reader.cc b/src/client/linux/dump_writer_common/ucontext_reader.cc +index 97ed2a9f..c6a8e9aa 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 // Must come first ++#endif ++ + #include "client/linux/dump_writer_common/ucontext_reader.h" + + #include "common/linux/linux_libc_support.h" +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 // Must come first ++#endif ++ + #include "client/linux/handler/exception_handler.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #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 // 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 // Must come first ++#endif ++ + #include "client/linux/microdump_writer/microdump_writer.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/client/linux/minidump_writer/cpu_set_unittest.cc b/src/client/linux/minidump_writer/cpu_set_unittest.cc +index e9d4e87a..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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +diff --git a/src/client/linux/minidump_writer/line_reader_unittest.cc b/src/client/linux/minidump_writer/line_reader_unittest.cc +index b96ebf9d..bc1f9d39 100644 +--- a/src/client/linux/minidump_writer/line_reader_unittest.cc ++++ b/src/client/linux/minidump_writer/line_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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "client/linux/minidump_writer/linux_core_dumper.h" + + #include +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 // Must come first ++#endif ++ + #include + + #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..85922a9c 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 // Must come first ++#endif ++ + #include "client/linux/minidump_writer/linux_dumper.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +index 718fab7c..0e58236b 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 // Must come first ++#endif ++ + #include "client/linux/minidump_writer/linux_ptrace_dumper.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + + #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 cbdc5fbc..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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "common/linux/google_crashdump_uploader.h" + #include + #include +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 // 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 // Must come first ++#endif ++ + #include "client/mac/crash_generation/crash_generation_server.h" + + #include +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 // Must come first ++#endif ++ + #include "breakpad_nlist_64.h" + + #include +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 // 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "protected_memory_allocator.h" + #include + +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 // 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 // Must come first ++#endif ++ + #include "client/mac/handler/testcases/breakpad_nlist_test.h" + #include + #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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // Must come first ++#endif ++ + #include "client/windows/crash_generation/crash_generation_client.h" + #include + #include +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 // Must come first ++#endif ++ + #include "client/windows/crash_generation/crash_generation_server.h" + #include + #include +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 // Must come first ++#endif ++ + #include "client/windows/crash_generation/minidump_generator.h" + + #include +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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include + + #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 // 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 // Must come first ++#endif ++ + #include "client/windows/tests/crash_generation_app/crash_generation_app.h" + + #include +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 // 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include "client/windows/unittests/exception_handler_test.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include "convert_UTF.h" + #ifdef CVTUTF_DEBUG + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include "common/dwarf/cfi_assembler.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + + #include +diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc +index b191d78c..65cb8e7d 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 // Must come first ++#endif ++ + #include "common/dwarf/dwarf2reader.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +diff --git a/src/common/dwarf/dwarf2reader_die_unittest.cc b/src/common/dwarf/dwarf2reader_die_unittest.cc +index fc639a64..442fa66c 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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/common/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc +index 7da8507d..287c851e 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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/common/dwarf_cfi_to_module_unittest.cc b/src/common/dwarf_cfi_to_module_unittest.cc +index 0b677b21..43b5e7c4 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 // Must come first ++#endif ++ + #include + #include + +diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc +index a5a1fd06..43b468c1 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 // Must come first ++#endif ++ + #include "common/dwarf_cu_to_module.h" + + #include +diff --git a/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc +index f3fa4903..7ab2f15c 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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include "common/language.h" + + #include +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 +-#endif +- + #ifndef HAVE_GETCONTEXT + + #include +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 // Must come first ++#endif ++ + #include + #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 // 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..48e4c926 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 // Must come first ++#endif ++ + #include "common/linux/dump_symbols.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "common/linux/elf_core_dump.h" + + #include +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 // Must come first ++#endif ++ + #include + + #include +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 + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include "common/linux/elf_symbols_to_module.h" + + #include +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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include "common/linux/elfutils.h" + + #include +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 // Must come first ++#endif ++ + #include "common/linux/file_id.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "common/linux/google_crashdump_uploader.h" + + #include +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 // Must come first ++#endif ++ + #include + + #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 ++#include // 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 // Must come first ++#endif ++ + #include "common/linux/http_upload.h" + + #include +diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc +index c4a174a8..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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include "common/linux/linux_libc_support.h" + + #include +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 // 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..568312cf 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 // Must come first ++#endif ++ + #include "common/linux/memory_mapped_file.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #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 // 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 +index b13f8d45..8de04ce9 100644 +--- a/src/common/linux/scoped_pipe.cc ++++ b/src/common/linux/scoped_pipe.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 // Must come first ++#endif ++ + #include "common/linux/scoped_pipe.h" + + #include +diff --git a/src/common/linux/scoped_pipe_unittest.cc b/src/common/linux/scoped_pipe_unittest.cc +index a7d6272c..4daa5c25 100644 +--- a/src/common/linux/scoped_pipe_unittest.cc ++++ b/src/common/linux/scoped_pipe_unittest.cc +@@ -28,6 +28,10 @@ + + // scoped_pipe_unittest.cc: Unit tests for google_breakpad::ScopedPipe. + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include "common/linux/scoped_pipe.h" + + #include "breakpad_googletest_includes.h" +diff --git a/src/common/linux/scoped_tmpfile.cc b/src/common/linux/scoped_tmpfile.cc +index 229e8d42..2395a64e 100644 +--- a/src/common/linux/scoped_tmpfile.cc ++++ b/src/common/linux/scoped_tmpfile.cc +@@ -29,6 +29,10 @@ + // Utility class for creating a temporary file that is deleted in the + // destructor. + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include "common/linux/scoped_tmpfile.h" + + #include +diff --git a/src/common/linux/scoped_tmpfile_unittest.cc b/src/common/linux/scoped_tmpfile_unittest.cc +index f82c5998..f0bb2bbb 100644 +--- a/src/common/linux/scoped_tmpfile_unittest.cc ++++ b/src/common/linux/scoped_tmpfile_unittest.cc +@@ -28,6 +28,10 @@ + + // scoped_tmpfile_unittest.cc: Unit tests for google_breakpad::ScopedTmpfile. + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include "common/linux/scoped_tmpfile.h" + + #include +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 // Must come first ++#endif ++ + #include "common/linux/symbol_collector_client.h" + + #include +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 // Must come first ++#endif ++ + #include "common/linux/symbol_upload.h" + + #include +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 // Must come first ++#endif ++ + #include "common/linux/synth_elf.h" + + #include +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 // Must come first ++#endif ++ + #include + + #include "breakpad_googletest_includes.h" +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 // Must come first ++#endif ++ + #include "common/linux/tests/crash_generator.h" + + #include +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 // Must come first ++#endif ++ + #include "common/long_string_dictionary.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc +index 392efe78..543c7c4a 100644 +--- a/src/common/mac/arch_utilities.cc ++++ b/src/common/mac/arch_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 // Must come first ++#endif ++ + #include "common/mac/arch_utilities.h" + + #include +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 // 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..e1025f79 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 // Must come first ++#endif ++ + #include "common/mac/dump_syms.h" + + #include +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 // Must come first ++#endif ++ + #include "common/mac/file_id.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "common/mac/macho_reader.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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..f9cd9327 100644 +--- a/src/common/mac/macho_walker.cc ++++ b/src/common/mac/macho_walker.cc +@@ -32,6 +32,10 @@ + // + // Author: Dan Waylonis + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // Must come first ++#endif ++ + #include + + #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 // 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 // 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..a5c1b6ad 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 // Must come first ++#endif ++ + #include "common/module.h" + #include "common/string_view.h" + +diff --git a/src/common/module_unittest.cc b/src/common/module_unittest.cc +index 39727554..213b3154 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "common/path_helper.h" + + #include +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 // 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 // Must come first ++#endif ++ + #include "common/simple_string_dictionary.h" + + namespace google_breakpad { +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 // 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "common/stabs_reader.h" + + #include +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 + #include + +-#ifdef HAVE_CONFIG_H +-#include +-#endif +- + #ifdef HAVE_MACH_O_NLIST_H + #include + #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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "common/test_assembler.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "common/windows/dia_util.h" + + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + + // 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 // Must come first ++#endif ++ + #include "common/windows/omap.h" + + #include +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 // 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 // Must come first ++#endif ++ + #include "common/windows/pdb_source_line_writer.h" + + #include +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 // 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_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 // Must come first ++#endif ++ + #include "pe_util.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "common/windows/sym_upload_v2_protocol.h" + + #include +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 // Must come first ++#endif ++ + #include "common/windows/symbol_collector_client.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "processor/basic_code_modules.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // 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 // Must come first ++#endif ++ + #include "processor/cfi_frame_info.h" + + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include "processor/convert_old_arm64_context.h" + + #include +diff --git a/src/processor/disassembler_objdump.cc b/src/processor/disassembler_objdump.cc +index f000b4b4..9f9569a5 100644 +--- a/src/processor/disassembler_objdump.cc ++++ b/src/processor/disassembler_objdump.cc +@@ -30,6 +30,10 @@ + // + // Author: Mark Brand + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include "processor/disassembler_objdump.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "processor/disassembler_x86.h" + + #include +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 // Must come first ++#endif ++ + #include + + #include "breakpad_googletest_includes.h" +diff --git a/src/processor/dump_context.cc b/src/processor/dump_context.cc +index a8ab0084..93d826c4 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 // Must come first ++#endif ++ + #include "google_breakpad/processor/dump_context.h" + + #include +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 // 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 // Must come first ++#endif ++ + #include + + #include "common/scoped_ptr.h" +diff --git a/src/processor/exploitability_linux.cc b/src/processor/exploitability_linux.cc +index c48bbdf5..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 // Must come first ++#endif ++ + #include "processor/exploitability_linux.h" + + #include +diff --git a/src/processor/exploitability_unittest.cc b/src/processor/exploitability_unittest.cc +index bc1823c6..5f8cee0a 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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + + #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 // 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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "google_breakpad/processor/microdump.h" + + #include +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 // Must come first ++#endif ++ + #include "google_breakpad/processor/microdump_processor.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc +index 8c4f75d6..63f48ffe 100644 +--- a/src/processor/minidump.cc ++++ b/src/processor/minidump.cc +@@ -32,6 +32,10 @@ + // + // Author: Mark Mentovai + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include "google_breakpad/processor/minidump.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc +index 0073ae4e..d56a7d63 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 // Must come first ++#endif ++ + #include "google_breakpad/processor/minidump_processor.h" + + #include +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 // Must come first ++#endif ++ + #include + + #include +diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc +index cee9a734..5ff61b3c 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/processor/module_comparer.cc b/src/processor/module_comparer.cc +index 389712c5..1bf0b316 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 // Must come first ++#endif ++ + #include "processor/module_comparer.h" + + #include +diff --git a/src/processor/module_serializer.cc b/src/processor/module_serializer.cc +index d0445094..91d0006e 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 // Must come first ++#endif ++ + #include "processor/module_serializer.h" + + #include +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 // 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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "google_breakpad/processor/proc_maps_linux.h" + + #include +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 // 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 // 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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include "processor/simple_symbol_supplier.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // Must come first ++#endif ++ + #include "google_breakpad/processor/stack_frame_symbolizer.h" + + #include +diff --git a/src/processor/stackwalk_common.cc b/src/processor/stackwalk_common.cc +index a1b6364d..3a842959 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 // Must come first ++#endif ++ + #include "processor/stackwalk_common.h" + + #include +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 // Must come first ++#endif ++ + #include "google_breakpad/processor/stackwalker.h" + + #include +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 + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include + + #include +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 + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // 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 // 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 // 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #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 // 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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // Must come first ++#endif ++ + #include + #include + +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 // 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 // Must come first ++#endif ++ + #include + + #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 // 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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/tools/linux/dump_syms/dump_syms.cc b/src/tools/linux/dump_syms/dump_syms.cc +index 8998b3b3..531a60ba 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 // Must come first ++#endif ++ + #include + #include + #include +diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc +index a4ddbe8e..f12f2841 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 // Must come first ++#endif ++ + #include + #include + #include +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 // 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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #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..2f2815c5 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 // Must come first ++#endif ++ + #include + #include + +diff --git a/src/tools/mac/dump_syms/macho_dump.cc b/src/tools/mac/dump_syms/macho_dump.cc +index b724cc74..2610025c 100644 +--- a/src/tools/mac/dump_syms/macho_dump.cc ++++ b/src/tools/mac/dump_syms/macho_dump.cc +@@ -31,6 +31,10 @@ + // 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. + ++#ifdef HAVE_CONFIG_H ++#include // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + +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 ++#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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include "tools/windows/converter_exe/escaping.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + #include +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 // Must come first ++#endif ++ + #include + + #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 // Must come first ++#endif ++ + #include "tools/windows/converter_exe/winhttp_client.h" + + #include +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 // Must come first ++#endif ++ + #include "tools/windows/converter_exe/wininet_client.h" + + #include +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 // Must come first ++#endif ++ + #include + #include + +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 // Must come first ++#endif ++ + #include + #include + +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 ++#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 // Must come first ++#endif ++ + #include + #include + #include diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0012-Mac-stop-using-NXArchInfo-as-a-vocabulary-type.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0012-Mac-stop-using-NXArchInfo-as-a-vocabulary-type.patch new file mode 100644 index 000000000..6965383af --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0012-Mac-stop-using-NXArchInfo-as-a-vocabulary-type.patch @@ -0,0 +1,434 @@ +From ef55207540d1d0b686f53145d87f6fb29edf3380 Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Thu, 9 Mar 2023 09:54:53 -0500 +Subject: [PATCH] Mac: stop using NXArchInfo as a vocabulary type + +It's deprecated in macOS 13/iOS 16, so this is an incremental step towards using newly introduced APIs for those OSes. + +Since the description field is no longer available in the new +mach-o/util.h API, stop using it, especially since architecture name is +sufficiently informative. + +Bug: chromium:1420654 +Change-Id: If2cec4f1fc88d13a71f011822bff61f173486b68 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4322265 +Reviewed-by: Mark Mentovai +--- + src/common/mac/arch_utilities.cc | 79 ++++++----------------- + src/common/mac/arch_utilities.h | 26 +++++--- + src/common/mac/dump_syms.cc | 47 +++++--------- + src/common/mac/dump_syms.h | 20 ++---- + src/common/mac/macho_walker.cc | 9 ++- + src/tools/mac/dump_syms/dump_syms_tool.cc | 26 +++----- + 6 files changed, 72 insertions(+), 135 deletions(-) + +diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc +index 543c7c4a..cdc1dfa5 100644 +--- a/src/common/mac/arch_utilities.cc ++++ b/src/common/mac/arch_utilities.cc +@@ -53,86 +53,44 @@ + #define CPU_SUBTYPE_ARM64_E (static_cast(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) { ++std::optional GetArchInfoFromName(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); ++ return ArchInfo{CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64_ALL}; + + if (!strcmp("arm64e", arch_name)) +- return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM64, +- CPU_SUBTYPE_ARM64_E); +- ++ return ArchInfo{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 ArchInfo{CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S}; + +- return NXGetArchInfoFromName(arch_name); ++ const NXArchInfo* info = NXGetArchInfoFromName(arch_name); ++ if (info) ++ return ArchInfo{info->cputype, info->cpusubtype}; ++ return std::nullopt; + } + +-const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type, +- cpu_subtype_t cpu_subtype) { ++const char* GetNameFromCPUType(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; ++ return "arm64"; + } + + if (cpu_type == CPU_TYPE_ARM64 && cpu_subtype == CPU_SUBTYPE_ARM64_E) { +- static const NXArchInfo* arm64e = ArchInfo_arm64(cpu_subtype); +- return arm64e; ++ 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 "armv7s"; + } + +- return NXGetArchInfoFromCpuType(cpu_type, cpu_subtype); ++ const NXArchInfo* info = NXGetArchInfoFromCpuType(cpu_type, cpu_subtype); ++ if (info) ++ return info->name; ++ return kUnknownArchName; + } + +-} // namespace google_breakpad +- + // 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 +@@ -207,7 +165,7 @@ const NXArchInfo kKnownArchitectures[] = { + + } // namespace + +-const NXArchInfo *NXGetLocalArchInfo(void) { ++ArchInfo GetLocalArchInfo(void) { + Architecture arch; + #if defined(__i386__) + arch = kArch_i386; +@@ -222,7 +180,8 @@ const NXArchInfo *NXGetLocalArchInfo(void) { + #else + #error "Unsupported CPU architecture" + #endif +- return &kKnownArchitectures[arch]; ++ NXArchInfo info = kKnownArchitectures[arch]; ++ return {info.cputype, info.cpusubtype}; + } + + #ifndef __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 ++#include + +-namespace google_breakpad { ++#include + +-// 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 = ""; + +-} // 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 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/dump_syms.cc b/src/common/mac/dump_syms.cc +index e1025f79..efa60f5b 100644 +--- a/src/common/mac/dump_syms.cc ++++ b/src/common/mac/dump_syms.cc +@@ -221,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. +@@ -233,16 +232,6 @@ 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. +@@ -402,8 +391,8 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr& 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" +@@ -418,18 +407,16 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr& 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"; + +@@ -540,16 +527,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..c22a0575 100644 +--- a/src/common/mac/dump_syms.h ++++ b/src/common/mac/dump_syms.h +@@ -43,6 +43,7 @@ + #include + + #include "common/byte_cursor.h" ++#include "common/mac/arch_utilities.h" + #include "common/mac/macho_reader.h" + #include "common/mac/super_fat_arch.h" + #include "common/module.h" +@@ -82,26 +83,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. ++ // 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(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. +- // +- // 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 +diff --git a/src/common/mac/macho_walker.cc b/src/common/mac/macho_walker.cc +index f9cd9327..4b9f56c2 100644 +--- a/src/common/mac/macho_walker.cc ++++ b/src/common/mac/macho_walker.cc +@@ -38,15 +38,15 @@ + + #include + #include +-#include + #include + #include + #include + #include + ++#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 { + +@@ -85,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/tools/mac/dump_syms/dump_syms_tool.cc b/src/tools/mac/dump_syms/dump_syms_tool.cc +index 2f2815c5..4d6f25c9 100644 +--- a/src/tools/mac/dump_syms/dump_syms_tool.cc ++++ b/src/tools/mac/dump_syms/dump_syms_tool.cc +@@ -67,7 +67,7 @@ struct Options { + + string srcPath; + string dsymPath; +- const NXArchInfo *arch; ++ std::optional arch; + bool header_only; + bool cfi; + bool handle_inter_cu_refs; +@@ -121,11 +121,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); +@@ -135,14 +136,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; + } +@@ -173,7 +168,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; + } + +@@ -193,7 +188,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; +@@ -248,8 +243,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { + options->header_only = true; + break; + case 'a': { +- const NXArchInfo *arch_info = +- google_breakpad::BreakpadGetArchInfoFromName(optarg); ++ std::optional arch_info = GetArchInfoFromName(optarg); + if (!arch_info) { + fprintf(stderr, "%s: Invalid architecture: %s\n", argv[0], optarg); + Usage(argc, argv); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0013-Mac-delete-unused-macho_dump.cc.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0013-Mac-delete-unused-macho_dump.cc.patch new file mode 100644 index 000000000..8bd60b2c9 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0013-Mac-delete-unused-macho_dump.cc.patch @@ -0,0 +1,228 @@ +From 3848d7e3b5365b53452e123c65bcf07a633c58ff Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Fri, 10 Mar 2023 17:18:22 -0500 +Subject: [PATCH] Mac: delete unused macho_dump.cc + +The only references to this are in derelict Xcode projects. + +Bug: chromium:1420654 +Change-Id: If0d7064f32bab23630f79f459bb1dc429a203b88 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4329733 +Reviewed-by: Mark Mentovai +--- + src/tools/mac/dump_syms/macho_dump.cc | 206 -------------------------- + 1 file changed, 206 deletions(-) + delete mode 100644 src/tools/mac/dump_syms/macho_dump.cc + +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 2610025c..00000000 +--- a/src/tools/mac/dump_syms/macho_dump.cc ++++ /dev/null +@@ -1,206 +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 +- +-// 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. +- +-#ifdef HAVE_CONFIG_H +-#include // Must come first +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-#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(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(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/meta-oe/recipes-devtools/breakpad/breakpad/0014-Add-brief-flag-to-minidump_stackwalk.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0014-Add-brief-flag-to-minidump_stackwalk.patch new file mode 100644 index 000000000..d00be98d1 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0014-Add-brief-flag-to-minidump_stackwalk.patch @@ -0,0 +1,173 @@ +From 309534f959c47b1518a1a01817ad7ab4ec20a12b Mon Sep 17 00:00:00 2001 +From: Ziad Youssef +Date: Wed, 15 Mar 2023 15:34:30 +0000 +Subject: [PATCH] Add brief flag to minidump_stackwalk + +The added flag will print only one line per frame for the requesting +thread (This is mostly the crashing thread). + +Refactor the code for printing the frame so it can be reused. + +Bug: 1374075 +Change-Id: I8a1c8b1a09740fcaa23c3cc642468622ee64ea73 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4339771 +Reviewed-by: Joshua Peraza +--- + src/processor/minidump_stackwalk.cc | 10 ++++- + src/processor/stackwalk_common.cc | 69 ++++++++++++++++++----------- + src/processor/stackwalk_common.h | 1 + + 3 files changed, 54 insertions(+), 26 deletions(-) + +diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc +index 5ff61b3c..08c30ed3 100644 +--- a/src/processor/minidump_stackwalk.cc ++++ b/src/processor/minidump_stackwalk.cc +@@ -61,6 +61,7 @@ struct Options { + bool machine_readable; + bool output_stack_contents; + bool output_requesting_thread_only; ++ bool brief; + + string minidump_file; + std::vector symbol_paths; +@@ -114,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); +@@ -135,6 +138,7 @@ static void Usage(int argc, const char *argv[], bool error) { + " -m Output in machine-readable format\n" + " -s Output stack contents\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()); + } + +@@ -144,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/stackwalk_common.cc b/src/processor/stackwalk_common.cc +index 3a842959..889931ea 100644 +--- a/src/processor/stackwalk_common.cc ++++ b/src/processor/stackwalk_common.cc +@@ -277,6 +277,33 @@ 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); ++ } ++ printf("\n "); ++} ++ + // 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 +@@ -298,31 +325,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); +- } +- printf("\n "); ++ PrintFrameHeader(frame, frame_index); + + // Inlined frames don't have registers info. + if (frame->trust != StackFrameAMD64::FRAME_TRUST_INLINE) { +@@ -1281,4 +1284,20 @@ void PrintProcessStateMachineReadable(const ProcessState& process_state) { + } + } + ++void PrintRequestingThreadBrief(const ProcessState& process_state) { ++ int requesting_thread = process_state.requesting_thread(); ++ if (requesting_thread == -1) { ++ printf(" \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); ++ } ++} ++ + } // 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/meta-oe/recipes-devtools/breakpad/breakpad/0015-Remove-extra-comma-in-minidump_stackwalk.cc.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0015-Remove-extra-comma-in-minidump_stackwalk.cc.patch new file mode 100644 index 000000000..1e16a6d4d --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0015-Remove-extra-comma-in-minidump_stackwalk.cc.patch @@ -0,0 +1,26 @@ +From 9bf8d1ec526cec139b2d3fba148ce81ccf2cceab Mon Sep 17 00:00:00 2001 +From: Ziad Youssef +Date: Thu, 16 Mar 2023 12:05:56 +0000 +Subject: [PATCH] Remove extra comma in minidump_stackwalk.cc + +Bug: 1374075 +Change-Id: I1fb0f73b286625f3c99735e51418393af891a2b8 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4345752 +Reviewed-by: Joshua Peraza +--- + src/processor/minidump_stackwalk.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc +index 08c30ed3..74b41acf 100644 +--- a/src/processor/minidump_stackwalk.cc ++++ b/src/processor/minidump_stackwalk.cc +@@ -137,7 +137,7 @@ 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()); + } diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0016-dump_syms-Mac-New-n-MODULE-arg-to-Mac-dump_syms.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0016-dump_syms-Mac-New-n-MODULE-arg-to-Mac-dump_syms.patch new file mode 100644 index 000000000..204cd2121 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0016-dump_syms-Mac-New-n-MODULE-arg-to-Mac-dump_syms.patch @@ -0,0 +1,203 @@ +From 9cc38fec8bbf4efc58f077c975e7f2b422a74ee3 Mon Sep 17 00:00:00 2001 +From: Ben Hamilton +Date: Mon, 20 Mar 2023 11:45:05 -0600 +Subject: [PATCH] [dump_syms/Mac] New -n MODULE arg to Mac dump_syms + +Previously, dump_syms always used the basename of the on-disk file as +the Breakpad module name and required that the on-disk filename of the dSYM and binary file match, or it would exit with an error. + +Build automation often uses filenames unrelated to the Breakpad module +name, so this CL adds a new optional "-n MODULE" argument to Mac +dump_syms that allows passing in the Breakpad module name from outside. + +In this case, the basename of the on-disk file(s) is ignored and +no longer required to match. + +Change-Id: Ic38e8cf762c79bce61d289b397293eff6c0039ce +Bug: b/273531493 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4338857 +Reviewed-by: Robert Sesek +--- + src/common/mac/dump_syms.cc | 7 +++- + src/common/mac/dump_syms.h | 17 ++++++-- + src/tools/mac/dump_syms/dump_syms_tool.cc | 49 +++++++++++++++++++---- + 3 files changed, 62 insertions(+), 11 deletions(-) + +diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc +index efa60f5b..6396e97a 100644 +--- a/src/common/mac/dump_syms.cc ++++ b/src/common/mac/dump_syms.cc +@@ -429,7 +429,12 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr& 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(); +diff --git a/src/common/mac/dump_syms.h b/src/common/mac/dump_syms.h +index c22a0575..d5aa7185 100644 +--- a/src/common/mac/dump_syms.h ++++ b/src/common/mac/dump_syms.h +@@ -56,7 +56,8 @@ 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 = "") + : symbol_data_(symbol_data), + handle_inter_cu_refs_(handle_inter_cu_refs), + object_filename_(), +@@ -66,12 +67,18 @@ class DumpSymbols { + object_files_(), + selected_object_file_(), + selected_object_name_(), +- enable_multiple_(enable_multiple) {} ++ enable_multiple_(enable_multiple), ++ module_name_(module_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); + +@@ -194,6 +201,10 @@ 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_; + }; + + } // namespace google_breakpad +diff --git a/src/tools/mac/dump_syms/dump_syms_tool.cc b/src/tools/mac/dump_syms/dump_syms_tool.cc +index 4d6f25c9..ab36164f 100644 +--- a/src/tools/mac/dump_syms/dump_syms_tool.cc ++++ b/src/tools/mac/dump_syms/dump_syms_tool.cc +@@ -63,7 +63,8 @@ struct Options { + cfi(true), + handle_inter_cu_refs(true), + handle_inlines(false), +- enable_multiple(false) {} ++ enable_multiple(false), ++ module_name() {} + + string srcPath; + string dsymPath; +@@ -73,6 +74,7 @@ struct Options { + bool handle_inter_cu_refs; + bool handle_inlines; + bool enable_multiple; ++ string module_name; + }; + + static bool StackFrameEntryComparator(const Module::StackFrameEntry* a, +@@ -149,7 +151,7 @@ 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); + + // 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 +@@ -196,13 +198,38 @@ static bool Start(const Options& options) { + return false; + scoped_ptr 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; + } + +@@ -215,8 +242,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] " +- "\n", argv[0]); ++ fprintf(stderr, ++ "Usage: %s [-a ARCHITECTURE] [-c] [-g dSYM path] " ++ "[-n MODULE] \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"); +@@ -228,6 +257,9 @@ 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-h: Usage\n"); + fprintf(stderr, "\t-?: Usage\n"); + } +@@ -237,7 +269,7 @@ 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:")) != -1) { + switch (ch) { + case 'i': + options->header_only = true; +@@ -267,6 +299,9 @@ 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 '?': + case 'h': + Usage(argc, argv); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0017-Mac-don-t-call-NXFindBestFatArch.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0017-Mac-don-t-call-NXFindBestFatArch.patch new file mode 100644 index 000000000..bf2b7bd5c --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0017-Mac-don-t-call-NXFindBestFatArch.patch @@ -0,0 +1,150 @@ +From c179ddaa58e0ec3093f98de555ad5791e9cb432a Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Mon, 13 Mar 2023 18:14:34 -0400 +Subject: [PATCH] Mac: don't call NXFindBestFatArch + +`NXFindBestFatArch` is deprecated in macOS 13. We use this when an +architecture is passed in via the `-a` flag. Unfortunately, neither +of the potential replacements can help with this use case: + +- `macho_for_each_slice` as suggested in a reply to FB11955188 just +enumerates slices, without the logic for inexact matches (for example, +x86_64h -> x86_64 or arm64e -> arm64). +- `macho_best_slice` as recommended by the deprecation notice only +supports finding a suitable slice to run on the local machine. + +We could adapt the logic in `NXFindBestFatArch` but it gets quite +complex for some architectures. Instead, this change adapts the +`NXFindBestFatArch` polyfill used in `dump_syms_mac` for Linux, which +returns an exact match if possible, and the first slice that matches +the requested CPU type otherwise. I think this is probably Good +Enough for most cases; if not, we can try porting the x86_64 and ARM +logic and falling back to this for the rest. + +Change-Id: I3b269dab7246eced768cecd994e915debd95721a +Bug: chromium:14206541420654 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4335477 +Reviewed-by: Mark Mentovai +--- + src/common/mac/arch_utilities.cc | 18 -------- + src/common/mac/dump_syms.cc | 75 +++++++++++--------------------- + 2 files changed, 26 insertions(+), 67 deletions(-) + +diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc +index cdc1dfa5..febf8a22 100644 +--- a/src/common/mac/arch_utilities.cc ++++ b/src/common/mac/arch_utilities.cc +@@ -210,22 +210,4 @@ const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype, + } + return candidate; + } +- +-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]; +- } +- if (!candidate) { +- candidate = &fat_archs[f]; +- } +- } +- } +- return candidate; +-} + #endif // !__APPLE__ +diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc +index 6396e97a..04ccae25 100644 +--- a/src/common/mac/dump_syms.cc ++++ b/src/common/mac/dump_syms.cc +@@ -232,60 +232,37 @@ bool DumpSymbols::SetArchitecture(const ArchInfo& info) { + return true; + } + +-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 fat_arch_vector; +- for (vector::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(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]; ++SuperFatArch* DumpSymbols::FindBestMatchForArchitecture( ++ cpu_type_t cpu_type, ++ cpu_subtype_t cpu_subtype) { ++ SuperFatArch* closest_match = nullptr; ++ for (auto& object_file : object_files_) { ++ if (static_cast(object_file.cputype) == cpu_type) { ++ // If there's an exact match, return it directly. ++ if ((static_cast(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::iterator it = object_files_.begin(); +- it != object_files_.end(); +- ++it) { +- if (static_cast(it->cputype) == cpu_type && +- (static_cast(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() { diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0018-Add-EM_RISCV-as-recognized-value-for-ELF-e_machine.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0018-Add-EM_RISCV-as-recognized-value-for-ELF-e_machine.patch new file mode 100644 index 000000000..fc98017e3 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0018-Add-EM_RISCV-as-recognized-value-for-ELF-e_machine.patch @@ -0,0 +1,34 @@ +From b0dc1f3529caa497e292707845ed77573d745d9e Mon Sep 17 00:00:00 2001 +From: Thomas Gales +Date: Tue, 28 Mar 2023 19:09:16 +0000 +Subject: [PATCH] Add EM_RISCV as recognized value for ELF e_machine + +`dump_syms` fails to write symbol file without knowing how to convert +the ELF `e_machine` field to a string. + +Use "riscv" as the value because ELF `e_machine` does not distinguish +between 32 bit and 64 bit RISC-V. + +Test: run `dump_syms` on the libc++ that's shipped with the Clang +toolchain, or any other riscv binary: `./dump_syms -r -n libc++.so -o +Fuchsia /lib/riscv64-unknown-fuchsia/libc++.so.2.0` +Bug: fuchsia:124084 +Change-Id: Ic04db96ec3d3d484350bdd0b90c9dfb70d7f7eb2 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4376828 +Reviewed-by: Mike Frysinger +--- + src/common/linux/dump_symbols.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc +index 48e4c926..36687bf4 100644 +--- a/src/common/linux/dump_symbols.cc ++++ b/src/common/linux/dump_symbols.cc +@@ -1022,6 +1022,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/meta-oe/recipes-devtools/breakpad/breakpad/0019-Add-RISC-V-register-names.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0019-Add-RISC-V-register-names.patch new file mode 100644 index 000000000..1400b4597 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0019-Add-RISC-V-register-names.patch @@ -0,0 +1,101 @@ +From 4d8bb33976e00c4bed675949fca6a5aafb118a97 Mon Sep 17 00:00:00 2001 +From: Thomas Gales +Date: Tue, 28 Mar 2023 21:14:44 +0000 +Subject: [PATCH] Add RISC-V register names + +RISC-V register names are needed in order to load DWARF call frame +information. + +Bug: fuchsia:124084 +Change-Id: I2791b3a38ea35ddc2bb293f60f75dcc86338e354 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4376827 +Reviewed-by: Mike Frysinger +--- + src/common/dwarf_cfi_to_module.cc | 23 ++++++++++++++++++++++ + src/common/dwarf_cfi_to_module.h | 3 +++ + src/common/dwarf_cfi_to_module_unittest.cc | 12 +++++++++++ + src/common/linux/dump_symbols.cc | 3 +++ + 4 files changed, 41 insertions(+) + +diff --git a/src/common/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc +index 287c851e..7e04d3c5 100644 +--- a/src/common/dwarf_cfi_to_module.cc ++++ b/src/common/dwarf_cfi_to_module.cc +@@ -147,6 +147,29 @@ vector DwarfCFIToModule::RegisterNames::MIPS() { + sizeof(kRegisterNames) / sizeof(kRegisterNames[0])); + } + ++vector DwarfCFIToModule::RegisterNames::RISCV() { ++ static const char *const names[] = { ++ "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", ++ "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", ++ "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", ++ "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31", ++ "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 MIPS(); + ++ // RISC-V. ++ static vector RISCV(); ++ + private: + // Given STRINGS, an array of C strings with SIZE elements, return an + // equivalent vector. +diff --git a/src/common/dwarf_cfi_to_module_unittest.cc b/src/common/dwarf_cfi_to_module_unittest.cc +index 43b5e7c4..b407edd0 100644 +--- a/src/common/dwarf_cfi_to_module_unittest.cc ++++ b/src/common/dwarf_cfi_to_module_unittest.cc +@@ -307,3 +307,15 @@ TEST(RegisterNames, X86_64) { + EXPECT_EQ("$rsp", names[7]); + EXPECT_EQ("$rip", names[16]); + } ++ ++TEST(RegisterNames, RISCV) { ++ vector names = DwarfCFIToModule::RegisterNames::RISCV(); ++ ++ EXPECT_EQ("x0", names[0]); ++ EXPECT_EQ("x31", 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/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc +index 36687bf4..8179663b 100644 +--- a/src/common/linux/dump_symbols.cc ++++ b/src/common/linux/dump_symbols.cc +@@ -449,6 +449,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; + } diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0020-Add-maxsize-for-xstate-areas.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0020-Add-maxsize-for-xstate-areas.patch new file mode 100644 index 000000000..57c437d2f --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0020-Add-maxsize-for-xstate-areas.patch @@ -0,0 +1,67 @@ +From f6e42357d412e6d24a6a637752ae126c15819c9b Mon Sep 17 00:00:00 2001 +From: Alex Gough +Date: Tue, 28 Mar 2023 22:47:20 +0000 +Subject: [PATCH] Add maxsize for xstate areas + +Breakpad skips the xstate area in x64 contexts but allowed this area +to be of unconstrained size. This hits problems if the size is greater +than Chrome's maximum allocation size, so we change to skipping a +maximum size. The maximum is chosen to allow the full set of states +today, plus some slack for the future: + +Based on Intel x64 manual 13.5 XSAVE-MANAGED STATE + +* => further bytes might be reserved + +| Size | Region | +| 576 | Legacy + header | +| 384 | AVX State | +| 80 | MPX State | +| 1600 | AVX-512 State | +| 72*| PT State | +| 8 | pkru state | +| 8 | pasid state | +| 16 | CET state | +| 8 | HDC State | +| 96?| uintr state | +| 808*| lbr state | +| 8 | hwp state | +| 16 | amx state | + +== 3680 so jump up a bit for the future to 2**12. + +Bug:1425631 +Change-Id: Ie08555651977cdbfa1c351c661118f13238213c4 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4379497 +Reviewed-by: Ivan Penkov +--- + src/processor/minidump.cc | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc +index 63f48ffe..45e4a524 100644 +--- a/src/processor/minidump.cc ++++ b/src/processor/minidump.cc +@@ -76,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 +@@ -507,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 xstate(bytes_left); + if (!minidump_->ReadBytes(xstate.data(), + bytes_left)) { diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0021-Convert-RISC-V-numeric-identifiers-to-strings.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0021-Convert-RISC-V-numeric-identifiers-to-strings.patch new file mode 100644 index 000000000..ec4cd08bf --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0021-Convert-RISC-V-numeric-identifiers-to-strings.patch @@ -0,0 +1,40 @@ +From b1775c56b253e8f3c19e4ae8cfd67f9fe1fe45b1 Mon Sep 17 00:00:00 2001 +From: Thomas Gales +Date: Tue, 11 Apr 2023 21:40:00 +0000 +Subject: [PATCH] Convert RISC-V numeric identifiers to strings + +Printing the register values as part of the stack trace relies on the +CPU architecture being "riscv" or "riscv64" rather than the numeric +identifiers (0x8005 and 0x8006, respectively). + +Fixed: 1432306 + +Test: Run `minidump_stackwalk` on a RISC-V minidump +Change-Id: I0009da687438d51047e2ee39ffa1c50d78798caa +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4416399 +Reviewed-by: Joshua Peraza +--- + src/processor/minidump_processor.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc +index d56a7d63..5ba6ff4f 100644 +--- a/src/processor/minidump_processor.cc ++++ b/src/processor/minidump_processor.cc +@@ -633,6 +633,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]; diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0022-Set-O_NONBLOCK-for-opening-file-to-prevent-hanging-w.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0022-Set-O_NONBLOCK-for-opening-file-to-prevent-hanging-w.patch new file mode 100644 index 000000000..d106c92d8 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0022-Set-O_NONBLOCK-for-opening-file-to-prevent-hanging-w.patch @@ -0,0 +1,32 @@ +From bd9d94c70843620adeebcd73c243001237c6d426 Mon Sep 17 00:00:00 2001 +From: Yuki Wang +Date: Mon, 17 Apr 2023 13:58:52 -0700 +Subject: [PATCH] Set O_NONBLOCK for opening file to prevent hanging when file + unavailable. + +Bug: 277976345 +Change-Id: Iddf55d8e172f98c76ae7167f609fb53c4c60fa48 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4437089 +Reviewed-by: Joshua Peraza +--- + src/common/linux/memory_mapped_file.cc | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/common/linux/memory_mapped_file.cc b/src/common/linux/memory_mapped_file.cc +index 568312cf..a7b96eb5 100644 +--- a/src/common/linux/memory_mapped_file.cc ++++ b/src/common/linux/memory_mapped_file.cc +@@ -61,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/meta-oe/recipes-devtools/breakpad/breakpad/0023-Fix-alignment-of-the-brief-output-of-minidump_stackw.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0023-Fix-alignment-of-the-brief-output-of-minidump_stackw.patch new file mode 100644 index 000000000..fb340bebf --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0023-Fix-alignment-of-the-brief-output-of-minidump_stackw.patch @@ -0,0 +1,41 @@ +From 16cee17997a52e200b38fbded8545bc76127d791 Mon Sep 17 00:00:00 2001 +From: Ziad Youssef +Date: Fri, 21 Apr 2023 12:47:56 +0000 +Subject: [PATCH] Fix alignment of the brief output of minidump_stackwalk + +Bug: 1435239 +Change-Id: I4ea6cbe89d5ef0907f7e07c454e4533995996521 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4459351 +Reviewed-by: Joshua Peraza +--- + src/processor/stackwalk_common.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/processor/stackwalk_common.cc b/src/processor/stackwalk_common.cc +index 889931ea..688b2782 100644 +--- a/src/processor/stackwalk_common.cc ++++ b/src/processor/stackwalk_common.cc +@@ -301,7 +301,6 @@ static void PrintFrameHeader(const StackFrame* frame, int frame_index) { + } else { + printf("0x%" PRIx64, instruction_address); + } +- printf("\n "); + } + + // PrintStack prints the call stack in |stack| to stdout, in a reasonably +@@ -326,6 +325,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); + PrintFrameHeader(frame, frame_index); ++ printf("\n "); + + // Inlined frames don't have registers info. + if (frame->trust != StackFrameAMD64::FRAME_TRUST_INLINE) { +@@ -1297,6 +1297,7 @@ void PrintRequestingThreadBrief(const ProcessState& process_state) { + 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"); + } + } + diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0024-dump_syms-Mac-New-x-option-to-prefer-extern-names-wh.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0024-dump_syms-Mac-New-x-option-to-prefer-extern-names-wh.patch new file mode 100644 index 000000000..ccd5c3a7d --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0024-dump_syms-Mac-New-x-option-to-prefer-extern-names-wh.patch @@ -0,0 +1,428 @@ +From f548d75c9fa8bc062a580dbe5edb2fae2106d5c9 Mon Sep 17 00:00:00 2001 +From: Ben Hamilton +Date: Fri, 21 Apr 2023 12:02:42 -0600 +Subject: [PATCH] [dump_syms/Mac] New -x option to prefer extern names when + there's a mismatch + +When built with -gmlt, .dSYMs are (by design) missing the +`DW_AT_linkage_name` which Breakpad uses to fill out the +(name-mangled) function names. + +Thankfully, the .dSYM contains both the old-school LC_SYMTAB command +containing the STABS-format symbols (which include the fully-qualified +C++ symbol names we want, but no actual compilation unit data), as +well as the LC_SEGMENT_64 containing the __DWARF segment with the +minimal -gmlt debug information (which excludes the name-mangled C++ +symbols). + +Unfortunately, since the .dSYM's STABS does not define compilation +units, the usual path in `StabsReader` ignores all the fully-qualified +C++ symbol names for the functions: + +https://chromium.googlesource.com/breakpad/breakpad/+/bd9d94c70843620adeebcd73c243001237c6d426/src/common/stabs_reader.cc#100 + +Fortunately, when built for macOS platforms (`HAVE_MACH_O_NLIST_H`), +`StabsReader` supports storing all the STABS-format symbols as +`Extern`s, regardless of whether or not they're in a compilation unit: + +https://chromium.googlesource.com/breakpad/breakpad/+/bd9d94c70843620adeebcd73c243001237c6d426/src/common/stabs_reader.cc#119 + +Currently, when there's both a `Function` and an `Extern` with the same address, `Module` discards the `Extern`: + +https://chromium.googlesource.com/breakpad/breakpad/+/bd9d94c70843620adeebcd73c243001237c6d426/src/common/module.cc#161 + +This CL adds a new `-x` option to the Mac `dump_syms` which prefers +the Extern function name if there's a mismatch. + +Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883 +Change-Id: I0d32adc64fbf567600b0a5ca63c71c422b7f0f8c +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4453650 +Reviewed-by: Joshua Peraza +--- + src/common/dwarf_cu_to_module.cc | 32 +++++++++++++++++++---- + src/common/dwarf_cu_to_module_unittest.cc | 13 +++++++++ + src/common/mac/dump_syms.cc | 2 +- + src/common/mac/dump_syms.h | 15 +++++++++-- + src/common/module.cc | 15 +++++++---- + src/common/module.h | 16 +++++++++++- + src/common/module_unittest.cc | 31 ++++++++++++++++++++++ + src/tools/mac/dump_syms/dump_syms_tool.cc | 17 +++++++++--- + 8 files changed, 123 insertions(+), 18 deletions(-) + +diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc +index 43b468c1..708ed143 100644 +--- a/src/common/dwarf_cu_to_module.cc ++++ b/src/common/dwarf_cu_to_module.cc +@@ -330,7 +330,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_; +@@ -466,7 +469,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. +@@ -482,6 +486,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()) { +@@ -500,6 +513,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 +@@ -722,7 +739,8 @@ 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) {} + + void ProcessAttributeUnsigned(enum DwarfAttribute attr, + enum DwarfForm form, +@@ -745,6 +763,7 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler { + bool inline_; + vector> child_inlines_; + bool handle_inline_; ++ bool has_qualified_name_; + DIEContext child_context_; // A context for our children. + }; + +@@ -808,7 +827,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; + } +@@ -881,6 +900,9 @@ void DwarfCUToModule::FuncHandler::Finish() { + scoped_ptr 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. +@@ -915,7 +937,7 @@ void DwarfCUToModule::FuncHandler::Finish() { + } + + 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_); + } +diff --git a/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc +index 7ab2f15c..134b2c24 100644 +--- a/src/common/dwarf_cu_to_module_unittest.cc ++++ b/src/common/dwarf_cu_to_module_unittest.cc +@@ -267,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); +@@ -615,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/mac/dump_syms.cc b/src/common/mac/dump_syms.cc +index 04ccae25..dd91196a 100644 +--- a/src/common/mac/dump_syms.cc ++++ b/src/common/mac/dump_syms.cc +@@ -420,7 +420,7 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr& 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; + } + +diff --git a/src/common/mac/dump_syms.h b/src/common/mac/dump_syms.h +index d5aa7185..5bcb0b58 100644 +--- a/src/common/mac/dump_syms.h ++++ b/src/common/mac/dump_syms.h +@@ -57,7 +57,8 @@ class DumpSymbols { + DumpSymbols(SymbolData symbol_data, + bool handle_inter_cu_refs, + bool enable_multiple = false, +- const std::string& module_name = "") ++ const std::string& module_name = "", ++ bool prefer_extern_name = false) + : symbol_data_(symbol_data), + handle_inter_cu_refs_(handle_inter_cu_refs), + object_filename_(), +@@ -68,7 +69,8 @@ class DumpSymbols { + selected_object_file_(), + selected_object_name_(), + enable_multiple_(enable_multiple), +- module_name_(module_name) {} ++ module_name_(module_name), ++ prefer_extern_name_(prefer_extern_name) {} + ~DumpSymbols() = default; + + // Prepare to read debugging information from |filename|. |filename| may be +@@ -205,6 +207,15 @@ class DumpSymbols { + // 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/module.cc b/src/common/module.cc +index a5c1b6ad..e61c3b7a 100644 +--- a/src/common/module.cc ++++ b/src/common/module.cc +@@ -105,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) +@@ -152,11 +154,14 @@ 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(); + // 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; ++ function->is_multiple |= name_mismatch || found_ext->is_multiple; ++ } ++ if (name_mismatch && prefer_extern_name_) { ++ function->name = AddStringToPool(it_ext->get()->name); + } + externs_.erase(it_ext); + } +diff --git a/src/common/module.h b/src/common/module.h +index c1fd9f59..d736701f 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 { +@@ -317,7 +321,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 +@@ -502,6 +507,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 213b3154..6a6762e5 100644 +--- a/src/common/module_unittest.cc ++++ b/src/common/module_unittest.cc +@@ -640,6 +640,37 @@ TEST(Module, ConstructFunctionsAndExternsWithSameAddress) { + contents.c_str()); + } + ++// 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(0xabc0); ++ extern1->name = "extern1"; ++ auto extern2 = std::make_unique(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) { +diff --git a/src/tools/mac/dump_syms/dump_syms_tool.cc b/src/tools/mac/dump_syms/dump_syms_tool.cc +index ab36164f..9fb8d13f 100644 +--- a/src/tools/mac/dump_syms/dump_syms_tool.cc ++++ b/src/tools/mac/dump_syms/dump_syms_tool.cc +@@ -64,7 +64,8 @@ struct Options { + handle_inter_cu_refs(true), + handle_inlines(false), + enable_multiple(false), +- module_name() {} ++ module_name(), ++ prefer_extern_name(false) {} + + string srcPath; + string dsymPath; +@@ -75,6 +76,7 @@ struct Options { + bool handle_inlines; + bool enable_multiple; + string module_name; ++ bool prefer_extern_name; + }; + + static bool StackFrameEntryComparator(const Module::StackFrameEntry* a, +@@ -151,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.module_name); ++ 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 +@@ -244,7 +247,7 @@ 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] " +- "[-n MODULE] \n", ++ "[-n MODULE] [-x] \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"); +@@ -260,6 +263,9 @@ static void Usage(int argc, const char *argv[]) { + 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"); + } +@@ -269,7 +275,7 @@ 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?hn:")) != -1) { ++ while ((ch = getopt(argc, (char* const*)argv, "ia:g:crdm?hn:x")) != -1) { + switch (ch) { + case 'i': + options->header_only = true; +@@ -302,6 +308,9 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { + case 'n': + options->module_name = optarg; + break; ++ case 'x': ++ options->prefer_extern_name = true; ++ break; + case '?': + case 'h': + Usage(argc, argv); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0025-dump_syms-Relax-name-matching-for-marking-symbols-as.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0025-dump_syms-Relax-name-matching-for-marking-symbols-as.patch new file mode 100644 index 000000000..0f681e4cc --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0025-dump_syms-Relax-name-matching-for-marking-symbols-as.patch @@ -0,0 +1,54 @@ +From bfde407de559c10d6cef861b3873ff287c24e761 Mon Sep 17 00:00:00 2001 +From: Ben Hamilton +Date: Mon, 24 Apr 2023 13:53:09 -0600 +Subject: [PATCH] [dump_syms] Relax name matching for marking symbols as + multiple + +Previously, the logic to mark a symbol as "multiple" would always fire +for C++ symbols for Apple `.dSYM`s built with `-gmlt`. + +This was because for a C++ symbol like `void foo::bar::Baz()`, the +DWARF data would contain the truncated function name `Baz`, but the +STABS would contain the fully-qualified name `void foo::bar::Baz()`. + +This CL relaxes the name matching to not mark as multiple: + +1) Symbols which were missing names entirely in the DWARF (e.g, ")` +2) Symbols whose fully-qualified name includes the truncated name as a substring + +Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883 +Change-Id: I26ded7ca84d964aa4a73da19e4bdd7e686e2c998 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4470047 +Reviewed-by: Joshua Peraza +--- + src/common/module.cc | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/src/common/module.cc b/src/common/module.cc +index e61c3b7a..73c4a8b1 100644 +--- a/src/common/module.cc ++++ b/src/common/module.cc +@@ -157,8 +157,22 @@ bool Module::AddFunction(Function* function) { + Extern* found_ext = it_ext->get(); + bool name_mismatch = found_ext->name != function->name; + if (enable_multiple_field_) { ++ 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 == "" || ++ 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 |= name_mismatch || found_ext->is_multiple; ++ function->is_multiple |= ++ is_multiple_based_on_name || found_ext->is_multiple; + } + if (name_mismatch && prefer_extern_name_) { + function->name = AddStringToPool(it_ext->get()->name); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0026-Replace-unsigned-int-with-size_t-for-ModuleSerialize.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0026-Replace-unsigned-int-with-size_t-for-ModuleSerialize.patch new file mode 100644 index 000000000..335264766 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0026-Replace-unsigned-int-with-size_t-for-ModuleSerialize.patch @@ -0,0 +1,120 @@ +From 7b981b213550b08530ff17386c1c29c9771be40b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= +Date: Wed, 26 Apr 2023 13:20:27 -0700 +Subject: [PATCH] Replace unsigned int with size_t for ModuleSerializer + +This is a speculative fix for a memory bug where our symbol files are +looking like they've grown enough that serializing them will outgrow +UINT_MAX. Before this change a size_t is implicitly cast to a size_t in +unsigned int, allocate a buffer of that size and then continue to write +module data out of bounds. + +I have not been able to reproduce the OOB write locally as the original +uploaded symbol data is gone, but I have been able to reproduce builds +where, if we enable inline frames and CFI dumping, the size grows to +3.6GB when serializing it, which is close enough to 4.2GB that the +wrapping theory seems reasonable on another board or build. + +No effort is made here to prevent wrapping behavior on 32-bit systems. + +Bug: b/237242489, chromium:1410232 +Change-Id: I3d7ec03c51c298f10df3d5b1e5306433875c7919 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4477821 +Reviewed-by: Leonard Grey +Reviewed-by: Mark Mentovai +--- + src/processor/module_comparer.cc | 2 +- + src/processor/module_serializer.cc | 17 +++++++++-------- + src/processor/module_serializer.h | 4 ++-- + 3 files changed, 12 insertions(+), 11 deletions(-) + +diff --git a/src/processor/module_comparer.cc b/src/processor/module_comparer.cc +index 1bf0b316..a6413038 100644 +--- a/src/processor/module_comparer.cc ++++ b/src/processor/module_comparer.cc +@@ -68,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 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 91d0006e..05519958 100644 +--- a/src/processor/module_serializer.cc ++++ b/src/processor/module_serializer.cc +@@ -111,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]; +@@ -128,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(end_address - serialized_data); ++ const size_t size_written = ++ static_cast(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; +@@ -138,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; + } + +@@ -150,7 +151,7 @@ bool ModuleSerializer::SerializeModuleAndLoadIntoFastResolver( + BasicSourceLineResolver::Module* basic_module = + dynamic_cast(iter->second); + +- unsigned int size = 0; ++ size_t size = 0; + scoped_array symbol_data(Serialize(*basic_module, &size)); + if (!symbol_data.get()) { + BPLOG(ERROR) << "Serialization failed for module: " << basic_module->name_; +@@ -201,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 module( + new BasicSourceLineResolver::Module("no name")); + scoped_array 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/meta-oe/recipes-devtools/breakpad/breakpad/0027-Update-Mac-Headers.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0027-Update-Mac-Headers.patch new file mode 100644 index 000000000..3334a6b7f --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0027-Update-Mac-Headers.patch @@ -0,0 +1,2615 @@ +From 652e7dac80f7a97c69818b928830850bfd1cf0f8 Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Wed, 26 Apr 2023 21:08:39 +0000 +Subject: [PATCH] Update Mac Headers + +These are reimported from Apple's Github source drops, see exact +provenance in README. Most were imported as is, some were edited +to match previous versions, and as noted below + +- Added arm headers where needed +- Removed (now) unused `/mach/i386/vm_param.h` +- Removed availability annotations +- Removed `__kernel_ptr_semantics` +- Added `defined(__aarch64__)` to all arm64 define guards + +Bug: chromium:1420654, google-breakpad:880, b/257505171 +Change-Id: I17bd03fa871a8f1dc4285daafa3d7b26c2186e2b +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4482294 +Reviewed-by: Mark Mentovai +--- + Makefile.am | 4 +- + Makefile.in | 4 +- + src/third_party/mac_headers/README | 25 +- + .../mac_headers/architecture/byte_order.h | 33 +- + src/third_party/mac_headers/arm/_types.h | 16 + + src/third_party/mac_headers/i386/_types.h | 22 +- + src/third_party/mac_headers/mach-o/arch.h | 51 ++- + src/third_party/mac_headers/mach-o/fat.h | 25 +- + src/third_party/mac_headers/mach-o/loader.h | 236 +++++++++- + src/third_party/mac_headers/mach-o/nlist.h | 20 +- + .../mac_headers/mach/arm/boolean.h | 74 +++ + .../mac_headers/mach/arm/vm_types.h | 159 +++++++ + src/third_party/mac_headers/mach/boolean.h | 42 +- + .../mac_headers/mach/i386/boolean.h | 32 +- + .../mac_headers/mach/i386/vm_param.h | 157 ------- + .../mac_headers/mach/i386/vm_types.h | 83 ++-- + src/third_party/mac_headers/mach/machine.h | 424 +++++++++++------- + .../mac_headers/mach/machine/boolean.h | 12 +- + .../mac_headers/mach/machine/thread_state.h | 2 +- + .../mac_headers/mach/machine/thread_status.h | 2 +- + .../mac_headers/mach/machine/vm_types.h | 12 +- + .../mac_headers/mach/thread_status.h | 42 +- + src/third_party/mac_headers/mach/vm_prot.h | 109 +++-- + 23 files changed, 1088 insertions(+), 498 deletions(-) + create mode 100644 src/third_party/mac_headers/arm/_types.h + create mode 100644 src/third_party/mac_headers/mach/arm/boolean.h + create mode 100644 src/third_party/mac_headers/mach/arm/vm_types.h + delete mode 100644 src/third_party/mac_headers/mach/i386/vm_param.h + +diff --git a/Makefile.am b/Makefile.am +index 1d45f8e5..58e41483 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1732,10 +1732,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 d790cac4..18456383 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -3734,10 +3734,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/src/third_party/mac_headers/README b/src/third_party/mac_headers/README +index c681bb3d..3dccc49d 100644 +--- a/src/third_party/mac_headers/README ++++ b/src/third_party/mac_headers/README +@@ -1,2 +1,23 @@ +-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 ++architecture/byte_order.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 +diff --git a/src/third_party/mac_headers/architecture/byte_order.h b/src/third_party/mac_headers/architecture/byte_order.h +index b772d9f3..8fb7f7e9 100644 +--- a/src/third_party/mac_headers/architecture/byte_order.h ++++ b/src/third_party/mac_headers/architecture/byte_order.h +@@ -1,22 +1,23 @@ + /* +- * Copyright (c) 1999-2008 Apple Computer, Inc. All rights reserved. ++ * Copyright (c) 1999-2002 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. ++ * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ++ * Reserved. 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 1.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.apple.com/publicsource 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. ++ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ++ * License for the specific language governing rights and limitations ++ * under the License." + * + * @APPLE_LICENSE_HEADER_END@ + */ +@@ -26,20 +27,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 . + * 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 */ +@@ -1168,18 +1213,75 @@ struct encryption_info_command { + 0 means not-encrypted yet */ + }; + ++/* ++ * 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 ++#include ++#include ++ ++/* ++ * 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 +-#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 +-#include + #include ++#include + + /* + * 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 + #include + #include + +-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 ++ ++__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 */ +-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/meta-oe/recipes-devtools/breakpad/breakpad/0028-Mac-update-arch_utilities-for-macOS-13.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0028-Mac-update-arch_utilities-for-macOS-13.patch new file mode 100644 index 000000000..9ab93d4e8 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0028-Mac-update-arch_utilities-for-macOS-13.patch @@ -0,0 +1,272 @@ +From 57bed07ad46f46ae575d1e38bf07c4d3137bbf53 Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Thu, 27 Apr 2023 12:38:54 -0400 +Subject: [PATCH] Mac: update arch_utilities for macOS 13 + + The NXArch* family is deprecated in macOS 13. This change: + - Uses the replacements where available + - Silences deprecation warnings otherwise + - Removes the Linux cross-compile shims in favor of having completely + separate implementations for Mac and non-Mac. The logic of the Linux + versions uses the same prepopulated data as before, but they no longer + use NXArchInfo. + +clang diagnostic disables are necessary due to https://crbug.com/1406057 + +Bug: chromium:1420654, google-breakpad:880, b/257505171 +Change-Id: Iad777915a5a058551cfb3a7d3cf681cce180dfea +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4437109 +Reviewed-by: Mark Mentovai +--- + src/common/mac/arch_utilities.cc | 197 +++++++++++-------------------- + 1 file changed, 72 insertions(+), 125 deletions(-) + +diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc +index febf8a22..15504b05 100644 +--- a/src/common/mac/arch_utilities.cc ++++ b/src/common/mac/arch_utilities.cc +@@ -32,69 +32,16 @@ + + #include "common/mac/arch_utilities.h" + ++#include + #include + #include + #include + #include + +-#ifndef CPU_SUBTYPE_ARM_V7S +-#define CPU_SUBTYPE_ARM_V7S (static_cast(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(0)) +-#endif // CPU_SUBTYPE_ARM64_ALL +- +-#ifndef CPU_SUBTYPE_ARM64_E +-#define CPU_SUBTYPE_ARM64_E (static_cast(2)) +-#endif // CPU_SUBTYPE_ARM64_E +- +-std::optional GetArchInfoFromName(const char* arch_name) { +- // TODO: Remove this when the OS knows about arm64. +- if (!strcmp("arm64", arch_name)) +- return ArchInfo{CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64_ALL}; +- +- if (!strcmp("arm64e", arch_name)) +- return ArchInfo{CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64_E}; +- // TODO: Remove this when the OS knows about armv7s. +- if (!strcmp("armv7s", arch_name)) +- return ArchInfo{CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S}; +- +- const NXArchInfo* info = NXGetArchInfoFromName(arch_name); +- if (info) +- return ArchInfo{info->cputype, info->cpusubtype}; +- return std::nullopt; +-} +- +-const char* GetNameFromCPUType(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) { +- return "arm64"; +- } +- +- if (cpu_type == CPU_TYPE_ARM64 && cpu_subtype == CPU_SUBTYPE_ARM64_E) { +- return "arm64e"; +- } +- +- // TODO: Remove this when the OS knows about armv7s. +- if (cpu_type == CPU_TYPE_ARM && cpu_subtype == CPU_SUBTYPE_ARM_V7S) { +- return "armv7s"; +- } +- +- const NXArchInfo* info = NXGetArchInfoFromCpuType(cpu_type, cpu_subtype); +- if (info) +- return info->name; +- return kUnknownArchName; +-} ++#ifdef __APPLE__ ++#include ++#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 { +@@ -109,59 +56,21 @@ 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 + +@@ -171,7 +80,7 @@ ArchInfo GetLocalArchInfo(void) { + 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; +@@ -180,34 +89,72 @@ ArchInfo GetLocalArchInfo(void) { + #else + #error "Unsupported CPU architecture" + #endif +- NXArchInfo info = kKnownArchitectures[arch]; +- return {info.cputype, info.cpusubtype}; ++ return kKnownArchitectures[arch].info; + } + +-#ifndef __APPLE__ ++#ifdef __APPLE__ + +-const NXArchInfo *NXGetArchInfoFromName(const char *name) { ++std::optional GetArchInfoFromName(const char* arch_name) { ++ if (__builtin_available(macOS 13.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 std::nullopt; ++} ++ ++const char* GetNameFromCPUType(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) { ++ if (__builtin_available(macOS 13.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 GetArchInfoFromName(const char* arch_name) { + for (int arch = 0; arch < kNumArchitectures; ++arch) { +- if (!strcmp(name, kKnownArchitectures[arch].name)) { +- return &kKnownArchitectures[arch]; ++ if (!strcmp(arch_name, kKnownArchitectures[arch].name)) { ++ return kKnownArchitectures[arch].info; + } + } +- 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) { ++ const char* candidate = kUnknownArchName; + for (int arch = 0; arch < kNumArchitectures; ++arch) { +- if (kKnownArchitectures[arch].cputype == cputype) { +- if (kKnownArchitectures[arch].cpusubtype == cpusubtype) { +- return &kKnownArchitectures[arch]; ++ if (kKnownArchitectures[arch].info.cputype == cpu_type) { ++ if (kKnownArchitectures[arch].info.cpusubtype == cpu_subtype) { ++ return kKnownArchitectures[arch].name; + } +- if (!candidate) { +- candidate = &kKnownArchitectures[arch]; ++ if (!strcmp(candidate, kUnknownArchName)) { ++ candidate = kKnownArchitectures[arch].name; + } + } + } + return candidate; + } +-#endif // !__APPLE__ ++#endif // __APPLE__ diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0029-Fix-AMD64-X86-typo-in-MD_CONTEXT_AMD64_ALL.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0029-Fix-AMD64-X86-typo-in-MD_CONTEXT_AMD64_ALL.patch new file mode 100644 index 000000000..26da3f418 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0029-Fix-AMD64-X86-typo-in-MD_CONTEXT_AMD64_ALL.patch @@ -0,0 +1,32 @@ +From 68f5a4d11a2703f76b9c4312a4a3df699cef41d8 Mon Sep 17 00:00:00 2001 +From: Ben Wagner +Date: Wed, 26 Apr 2023 11:08:05 -0400 +Subject: [PATCH] Fix AMD64/X86 typo in MD_CONTEXT_AMD64_ALL + +Use MD_CONTEXT_AMD64_DEBUG_REGISTERS instead of +MD_CONTEXT_AMD64_DEBUG_REGISTERS in the definition of +MD_CONTEXT_AMD64_ALL. This previously happened to work because the two +flags happened to have the same values and every includer of +minidump_cpu_amd64.h also happened to previously include +minidump_cpu_x86.h. + +Change-Id: If8b422d3623936f4a0b57a4cf6dac4f348daa024 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4480251 +Reviewed-by: Joshua Peraza +--- + src/google_breakpad/common/minidump_cpu_amd64.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +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/meta-oe/recipes-devtools/breakpad/breakpad/0030-minidump-2-core-Use-exception-context-for-crashed-th.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0030-minidump-2-core-Use-exception-context-for-crashed-th.patch new file mode 100644 index 000000000..656bc4c9e --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0030-minidump-2-core-Use-exception-context-for-crashed-th.patch @@ -0,0 +1,116 @@ +From de040fa25de948e71cef9c035ba152fa75bfe0ec Mon Sep 17 00:00:00 2001 +From: Ben Wagner +Date: Mon, 24 Apr 2023 23:41:28 -0400 +Subject: [PATCH] minidump-2-core: Use exception context for crashed thread + +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. + +This change aligns the behavior of minidump-2-core with the behavior of +minidump_stackwalk. + +Bug: google-breakpad:885 +Change-Id: I5cd3e9d39807308491b64fcd335f5f85b1dcd084 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4473128 +Reviewed-by: Joshua Peraza +Reviewed-by: Joshua Peraza +--- + src/tools/linux/md2core/minidump-2-core.cc | 42 ++++++++++++++++------ + 1 file changed, 31 insertions(+), 11 deletions(-) + +diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc +index f12f2841..9d5e5e3f 100644 +--- a/src/tools/linux/md2core/minidump-2-core.cc ++++ b/src/tools/linux/md2core/minidump-2-core.cc +@@ -282,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)); +@@ -306,7 +306,6 @@ struct CrashedProcess { + }; + std::map mappings; + +- pid_t crashing_tid; + int fatal_signal; + + struct Thread { +@@ -330,6 +329,7 @@ struct CrashedProcess { + size_t stack_length; + }; + std::vector threads; ++ Thread exception; + + const uint8_t* auxv; + size_t auxv_length; +@@ -999,10 +999,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(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 +@@ -1365,7 +1380,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), +@@ -1481,16 +1496,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/meta-oe/recipes-devtools/breakpad/breakpad/0031-Reimport-architecture-byte_order.h-from-canonical-re.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0031-Reimport-architecture-byte_order.h-from-canonical-re.patch new file mode 100644 index 000000000..f85d6fe83 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0031-Reimport-architecture-byte_order.h-from-canonical-re.patch @@ -0,0 +1,84 @@ +From 99cd657eec78e330a1f0d4184dd6d0e163209c70 Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Mon, 1 May 2023 17:13:08 -0400 +Subject: [PATCH] Reimport architecture/byte_order.h from canonical repo + +Bug: b/257505171 +Change-Id: I210b6689683ff2cf561997584924fd9b568943cb +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4494631 +Reviewed-by: Mark Mentovai +--- + src/third_party/mac_headers/README | 4 ++- + .../mac_headers/architecture/byte_order.h | 29 +++++++++---------- + 2 files changed, 17 insertions(+), 16 deletions(-) + +diff --git a/src/third_party/mac_headers/README b/src/third_party/mac_headers/README +index 3dccc49d..2b855b60 100644 +--- a/src/third_party/mac_headers/README ++++ b/src/third_party/mac_headers/README +@@ -3,7 +3,6 @@ processes Mach-O files on Linux. + + From xnu-8792.41.9 (https://github.com/apple-oss-distributions/xnu at 5c2921b) + i386/_types.h +-architecture/byte_order.h + arm/_types.h + mach/boolean.h + mach/machine.h +@@ -21,3 +20,6 @@ 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 8fb7f7e9..1f723ae1 100644 +--- a/src/third_party/mac_headers/architecture/byte_order.h ++++ b/src/third_party/mac_headers/architecture/byte_order.h +@@ -1,24 +1,23 @@ + /* +- * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved. ++ * Copyright (c) 1999-2008 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ +- * +- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights +- * Reserved. 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 1.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.apple.com/publicsource and read it before using +- * this file. +- * ++ * ++ * 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, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the +- * License for the specific language governing rights and limitations +- * under the License." +- * ++ * 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@ + */ + /* +@@ -30,7 +29,7 @@ + + #ifndef _ARCHITECTURE_BYTE_ORDER_H_ + #define _ARCHITECTURE_BYTE_ORDER_H_ +- ++ + enum NXByteOrder { + NX_UnknownByteOrder, + NX_LittleEndian, diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0032-Fix-dump_syms-help-typo-on-Linux.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0032-Fix-dump_syms-help-typo-on-Linux.patch new file mode 100644 index 000000000..991bd6964 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0032-Fix-dump_syms-help-typo-on-Linux.patch @@ -0,0 +1,26 @@ +From e9eb843f421bcde49914aaf711fbd745aae24904 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= +Date: Tue, 2 May 2023 13:19:34 -0700 +Subject: [PATCH] Fix dump_syms help typo on Linux + +Bug: None +Change-Id: I0409a0c2ab8e60b1f84f72b50a1fd400b5a41cbd +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4500379 +Reviewed-by: Mark Mentovai +--- + src/tools/linux/dump_syms/dump_syms.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tools/linux/dump_syms/dump_syms.cc b/src/tools/linux/dump_syms/dump_syms.cc +index 531a60ba..2fce23c2 100644 +--- a/src/tools/linux/dump_syms/dump_syms.cc ++++ b/src/tools/linux/dump_syms/dump_syms.cc +@@ -60,7 +60,7 @@ int usage(const char* self) { + fprintf(stderr, " -n Use specified name for name of the object\n"); + fprintf(stderr, " -o 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/meta-oe/recipes-devtools/breakpad/breakpad/0033-Include-iOS-in-availability-checks-for-mach-o-util.h.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0033-Include-iOS-in-availability-checks-for-mach-o-util.h.patch new file mode 100644 index 000000000..cba5c8702 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0033-Include-iOS-in-availability-checks-for-mach-o-util.h.patch @@ -0,0 +1,35 @@ +From 3ea3af42d3ea0a61dfb2688a4466318ce5649afa Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Tue, 2 May 2023 16:05:18 -0400 +Subject: [PATCH] Include iOS in availability checks for mach-o/util.h calls + +Bug: chromium:1420654 +Change-Id: Id0281089962147040b6332223bf4593bf4fc60cd +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4500259 +Reviewed-by: Mark Mentovai +--- + src/common/mac/arch_utilities.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc +index 15504b05..96340d54 100644 +--- a/src/common/mac/arch_utilities.cc ++++ b/src/common/mac/arch_utilities.cc +@@ -95,7 +95,7 @@ ArchInfo GetLocalArchInfo(void) { + #ifdef __APPLE__ + + std::optional GetArchInfoFromName(const char* arch_name) { +- if (__builtin_available(macOS 13.0, *)) { ++ 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)) { +@@ -114,7 +114,7 @@ std::optional GetArchInfoFromName(const char* arch_name) { + } + + const char* GetNameFromCPUType(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) { +- if (__builtin_available(macOS 13.0, *)) { ++ 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; diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0034-Fix-MDRawModuleCrashpadInfoList-modules-type.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0034-Fix-MDRawModuleCrashpadInfoList-modules-type.patch new file mode 100644 index 000000000..775217634 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0034-Fix-MDRawModuleCrashpadInfoList-modules-type.patch @@ -0,0 +1,31 @@ +From 6e319cac57ef30f98a5c79c54efee1584f018491 Mon Sep 17 00:00:00 2001 +From: Ben Wagner +Date: Wed, 3 May 2023 15:08:23 -0400 +Subject: [PATCH] Fix MDRawModuleCrashpadInfoList::modules type + +MDRawModuleCrashpadInfoList::modules is a flexible array of +MDRawModuleCrashpadInfoLink and not MDLocationDescriptor. Breakpad does +not currently use the MDRawModuleCrashpadInfoList type, but its +definition should be updated to reflect the correct type to avoid +confusion. + +Change-Id: If97f490db8d41529b59a225a275a37116746c2b7 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4504150 +Reviewed-by: Joshua Peraza +--- + src/google_breakpad/common/minidump_format.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h +index 1526afce..802cc7e3 100644 +--- a/src/google_breakpad/common/minidump_format.h ++++ b/src/google_breakpad/common/minidump_format.h +@@ -1122,7 +1122,7 @@ typedef struct { + + typedef struct { + uint32_t count; +- MDLocationDescriptor modules[0]; /* MDRawModuleCrashpadInfoLink */ ++ MDRawModuleCrashpadInfoLink modules[0]; + } MDRawModuleCrashpadInfoList; + + typedef struct { diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0035-Fix-MDRawCrashpadAnnotationList-objects-type.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0035-Fix-MDRawCrashpadAnnotationList-objects-type.patch new file mode 100644 index 000000000..1c0179737 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0035-Fix-MDRawCrashpadAnnotationList-objects-type.patch @@ -0,0 +1,30 @@ +From 837b0f5d52701df4a88b94eaa8b0a093e33ff45d Mon Sep 17 00:00:00 2001 +From: Ben Wagner +Date: Wed, 3 May 2023 16:25:52 -0400 +Subject: [PATCH] Fix MDRawCrashpadAnnotationList::objects type + +MDRawCrashpadAnnotationList::objects is a flexible array of +MDRawCrashpadAnnotation and not MDLocationDescriptor. Breakpad does not +currently use the MDRawCrashpadAnnotationList type, but its definition +should be updated to reflect the correct type to avoid confusion. + +Change-Id: I58b5b0e4f7f95bc003b103e2750e3759c3e31292 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4503630 +Reviewed-by: Joshua Peraza +--- + src/google_breakpad/common/minidump_format.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h +index 802cc7e3..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 { diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0036-dump_syms-riscv-Fix-register-name-mismatch.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0036-dump_syms-riscv-Fix-register-name-mismatch.patch new file mode 100644 index 000000000..61a441d6e --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0036-dump_syms-riscv-Fix-register-name-mismatch.patch @@ -0,0 +1,36 @@ +From 5b101544cafe22267a2ede256b9ac24d6131fcf2 Mon Sep 17 00:00:00 2001 +From: Thomas Gales +Date: Thu, 4 May 2023 23:07:34 +0000 +Subject: [PATCH] [dump_syms][riscv] Fix register name mismatch + +dump_syms was using x0...x31 notation, while the rest of Breakpad was +using the ABI names. This mismatch was causing stackwalking to not fully +succeed. + +Fixed: 1432426 +Change-Id: I0713e76e65ff6dad492b51bc3607e94e25dc2c3a +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4505156 +Reviewed-by: Joshua Peraza +--- + src/common/dwarf_cfi_to_module.cc | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/common/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc +index 7e04d3c5..4c594175 100644 +--- a/src/common/dwarf_cfi_to_module.cc ++++ b/src/common/dwarf_cfi_to_module.cc +@@ -149,10 +149,10 @@ vector DwarfCFIToModule::RegisterNames::MIPS() { + + vector DwarfCFIToModule::RegisterNames::RISCV() { + static const char *const names[] = { +- "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", +- "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", +- "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", +- "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31", ++ "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", diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0037-dump_syms-riscv-Update-unittest.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0037-dump_syms-riscv-Update-unittest.patch new file mode 100644 index 000000000..db45fb36c --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0037-dump_syms-riscv-Update-unittest.patch @@ -0,0 +1,31 @@ +From f4a3b346f34ab4f3bf39f983b601cadd3fc12312 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Mon, 8 May 2023 10:35:58 +0200 +Subject: [PATCH] [dump_syms][riscv] Update unittest. + +Change 4505156 changed the RISCV register names, this change adjusts +the unittest to match the new names. + +Bug: 1432426 +Change-Id: I0887d8fc11eec63ab6953ea1a136873591e49286 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4507066 +Reviewed-by: Joshua Peraza +--- + src/common/dwarf_cfi_to_module_unittest.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/common/dwarf_cfi_to_module_unittest.cc b/src/common/dwarf_cfi_to_module_unittest.cc +index b407edd0..52653ec6 100644 +--- a/src/common/dwarf_cfi_to_module_unittest.cc ++++ b/src/common/dwarf_cfi_to_module_unittest.cc +@@ -311,8 +311,8 @@ TEST(RegisterNames, X86_64) { + TEST(RegisterNames, RISCV) { + vector names = DwarfCFIToModule::RegisterNames::RISCV(); + +- EXPECT_EQ("x0", names[0]); +- EXPECT_EQ("x31", names[31]); ++ 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]); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0038-Add-new-flag-to-allow-granular-control-over-the-use-.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0038-Add-new-flag-to-allow-granular-control-over-the-use-.patch new file mode 100644 index 000000000..ab17f45dd --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0038-Add-new-flag-to-allow-granular-control-over-the-use-.patch @@ -0,0 +1,91 @@ +From 463ae7cd60d14594b29ec88831ce8374eabbf601 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Tue, 9 May 2023 14:31:56 +0200 +Subject: [PATCH] Add new flag to allow granular control over the use of + objdump. + +This adds a new flag `enable_objdump_for_exploitability_` to the +MinidumpProcessor, which allows enabling objdump separately for crash +address fixups and for exploitability analysis, as the performance cost +of the exploitability analysis is significantly higher. + +Change-Id: I667ffdce7cc0a970793f91413c3d2e3af93f4247 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4507067 +Reviewed-by: Ivan Penkov +Reviewed-by: Ivan Penkov +--- + .../processor/minidump_processor.h | 20 +++++++++++++++++-- + src/processor/exploitability_unittest.cc | 2 +- + src/processor/minidump_processor.cc | 5 ++--- + 3 files changed, 21 insertions(+), 6 deletions(-) + +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/exploitability_unittest.cc b/src/processor/exploitability_unittest.cc +index 5f8cee0a..09e4690d 100644 +--- a/src/processor/exploitability_unittest.cc ++++ b/src/processor/exploitability_unittest.cc +@@ -84,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/minidump_processor.cc b/src/processor/minidump_processor.cc +index 5ba6ff4f..f7d877c6 100644 +--- a/src/processor/minidump_processor.cc ++++ b/src/processor/minidump_processor.cc +@@ -375,9 +375,8 @@ ProcessResult MinidumpProcessor::Process( + // rating. + if (enable_exploitability_) { + scoped_ptr 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(); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0039-Modernize-code.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0039-Modernize-code.patch new file mode 100644 index 000000000..e082e3694 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0039-Modernize-code.patch @@ -0,0 +1,796 @@ +From 5850e262b1d955c99ab4c404fe357959a8a616f0 Mon Sep 17 00:00:00 2001 +From: Lei Zhang +Date: Fri, 12 May 2023 11:13:43 -0700 +Subject: [PATCH] Modernize code + +- Replace DISALLOW_COPY_AND_ASSIGN with =delete. +- Replace some NULLs with nullptrs; +- Use the override keyword when appropriate. +- Use =default when appropriate. + +Change-Id: I99e1d7f349dd4c32aa5d05e2ebdce7a86e47f551 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4527718 +Reviewed-by: Ivan Penkov +--- + .../crash_generation_client.cc | 8 +- + .../crash_generation_client.h | 11 +- + src/common/basictypes.h | 8 - + src/common/linux/memory_mapped_file.h | 7 +- + src/common/simple_string_dictionary.h | 8 +- + src/common/windows/pe_source_line_writer.h | 7 +- + src/google_breakpad/processor/minidump.h | 191 +++++++++--------- + src/processor/stackwalker_address_list.h | 5 +- + 8 files changed, 119 insertions(+), 126 deletions(-) + +diff --git a/src/client/linux/crash_generation/crash_generation_client.cc b/src/client/linux/crash_generation/crash_generation_client.cc +index f06273d5..020c6146 100644 +--- a/src/client/linux/crash_generation/crash_generation_client.cc ++++ b/src/client/linux/crash_generation/crash_generation_client.cc +@@ -49,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; +@@ -92,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 + + 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/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/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 +-#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/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 + #include + +-#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/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 + +-#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/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 + #include + +-#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 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(-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 > GetShrunkRangeModules() const; ++ vector> 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>* + 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/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/meta-oe/recipes-devtools/breakpad/breakpad/0040-Mac-shorten-sym-file-names-in-upload_system_symbols.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0040-Mac-shorten-sym-file-names-in-upload_system_symbols.patch new file mode 100644 index 000000000..5c2154e4b --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0040-Mac-shorten-sym-file-names-in-upload_system_symbols.patch @@ -0,0 +1,64 @@ +From 38b6eebda19a4127299a7bf806c67868dde7fca3 Mon Sep 17 00:00:00 2001 +From: Leonard Grey +Date: Thu, 18 May 2023 14:09:08 -0400 +Subject: [PATCH] Mac: shorten sym file names in upload_system_symbols + +macOS caps filenames at 255 characters. When upload_system_symbols runs +`dump_syms`, the resulting filename is based on a mangled version of +the file's full path. In some circumstances (for example, the dumped +file itself lives in a temp directory), this name can exceed the max. + +This change replaces the current mangling by mapping each path component but the last to its first initial, greatly shortening +the resulting filename. + +Bug: 1400770 +Change-Id: I68203a98eda2912893c5d8f7c676faee17e39e91 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4519231 +Reviewed-by: Robert Sesek +--- + .../upload_system_symbols.go | 25 ++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +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/meta-oe/recipes-devtools/breakpad/breakpad/0041-Fix-inline_origin_map-key-collision-when-split-dwarf.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0041-Fix-inline_origin_map-key-collision-when-split-dwarf.patch new file mode 100644 index 000000000..a61e0f518 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0041-Fix-inline_origin_map-key-collision-when-split-dwarf.patch @@ -0,0 +1,588 @@ +From 9f96d5c7b7960cbc67942dc28664753557ed186a Mon Sep 17 00:00:00 2001 +From: Zequan Wu +Date: Thu, 18 May 2023 15:22:25 -0400 +Subject: [PATCH] Fix inline_origin_map key collision when split dwarf is + enabled. + +It fixes following two problems: +1. When we have skeleton compilation unit (DW_TAG_skeleton_unit) in a +binary file refers to the complete unit in a split dwarf file +(.dwo/.dwp file), we should use the split dwarf file's path in warning +reporting. Right now, it uses the original file (binary file) path in +warning report, which is incorrect. + +For example, if we have chrome.debug which is the binary with skeleton +debug info and chrome.dwp which is the complete debug info and the debug +info in chrome.dwp has some incorrect reference, it will warn on +chrome.debug rather than chrome.dwp + +2. When split dwarf is enabled, the global inline_origin_map will likely +encounter key collision because the offsets as keys are now relative to +each CU's offset which is relative to .debug_info section. Also +offsets from different files might collide. + +This change makes a inline_origin_map for each debug file and use +offsets only relative to .debug_info section as keys. + +Bug: b/280290608 +Change-Id: If70e2e1bfcbeeeef2d425c918796d351a0e9ab3b +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4544694 +Reviewed-by: Joshua Peraza +Reviewed-by: Mark Mentovai +--- + src/common/dwarf/dwarf2reader.cc | 109 ++++++++++-------- + src/common/dwarf/dwarf2reader.h | 34 ++++-- + src/common/dwarf/dwarf2reader_die_unittest.cc | 3 +- + src/common/dwarf_cu_to_module.cc | 18 +-- + src/common/linux/dump_symbols.cc | 39 +++++++ + src/common/mac/dump_syms.cc | 50 +++++++- + src/common/mac/dump_syms.h | 8 ++ + src/common/module.cc | 5 +- + src/common/module.h | 8 +- + src/common/module_unittest.cc | 4 +- + 10 files changed, 190 insertions(+), 88 deletions(-) + +diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc +index 65cb8e7d..4f63b979 100644 +--- a/src/common/dwarf/dwarf2reader.cc ++++ b/src/common/dwarf/dwarf2reader.cc +@@ -81,8 +81,8 @@ CompilationUnit::CompilationUnit(const string& path, + 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_() {} ++ str_offsets_base_(0), have_checked_for_dwp_(false), ++ should_process_split_dwarf_(false) {} + + // Initialize a compilation unit from a .dwo or .dwp file. + // In this case, we need the .debug_addr section from the +@@ -400,7 +400,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(); +@@ -461,10 +467,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; + } +@@ -994,66 +998,68 @@ 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); ++ 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(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(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_, §ions); ++ 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_, §ions); +- 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(dwo_name_); ++ int width = GetElfWidth(*split_elf_reader_.get()); + if (width != 0) { +- ByteReader reader(ENDIANNESS_LITTLE); +- reader.SetAddressSize(width); +- SectionMap sections; +- ReadDebugSectionsFromDwo(&elf, §ions); +- 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(), §ions); ++ if (!sections.empty()) { ++ split_file = dwo_name_; ++ } + } + } + } ++ return !split_file.empty(); + } + + void CompilationUnit::ReadDebugSectionsFromDwo(ElfReader* elf_reader, +@@ -1088,10 +1094,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_); +@@ -1231,8 +1233,13 @@ 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 (info_data_) +- + offset, size))); ++ std::make_pair(reinterpret_cast(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(info_data_) + offset, size))); + } else if (section_id == DW_SECT_STR_OFFSETS) { + sections->insert(std::make_pair( + ".debug_str_offsets", +diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h +index ddcdd801..cd676dea 100644 +--- a/src/common/dwarf/dwarf2reader.h ++++ b/src/common/dwarf/dwarf2reader.h +@@ -481,6 +481,24 @@ 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 GetRangeBase() { return ranges_base_; } ++ ++ uint64_t GetDWOID() { return dwo_id_; } ++ ++ bool ShouldProcessSplitDwarf() { return should_process_split_dwarf_; } ++ + private: + + // This struct represents a single DWARF2/3 abbreviation +@@ -647,9 +665,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 +673,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 +@@ -743,14 +758,13 @@ 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 dwp_byte_reader_; ++ // ElfReader for the dwo/dwo file. ++ std::unique_ptr split_elf_reader_; + + // DWP reader. + std::unique_ptr dwp_reader_; ++ ++ bool should_process_split_dwarf_; + }; + + // A Reader for a .dwp file. Supports the fetching of DWARF debug +@@ -770,8 +784,6 @@ class DwpReader { + public: + DwpReader(const ByteReader& byte_reader, ElfReader* elf_reader); + +- ~DwpReader(); +- + // Read the CU index and initialize data members. + void Initialize(); + +diff --git a/src/common/dwarf/dwarf2reader_die_unittest.cc b/src/common/dwarf/dwarf2reader_die_unittest.cc +index 442fa66c..2b365396 100644 +--- a/src/common/dwarf/dwarf2reader_die_unittest.cc ++++ b/src/common/dwarf/dwarf2reader_die_unittest.cc +@@ -333,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_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc +index 708ed143..2a23ca7c 100644 +--- a/src/common/dwarf_cu_to_module.cc ++++ b/src/common/dwarf_cu_to_module.cc +@@ -696,11 +696,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 in( + new Module::Inline(origin, ranges, call_site_line_, call_site_file_id_, + inline_nest_level_, std::move(child_inlines_))); +@@ -929,10 +930,11 @@ 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); + } + } + +diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc +index 8179663b..0bfc74c3 100644 +--- a/src/common/linux/dump_symbols.cc ++++ b/src/common/linux/dump_symbols.cc +@@ -334,6 +334,40 @@ std::pair UncompressSectionContents( + : std::make_pair(uncompressed_buffer.release(), uncompressed_size); + } + ++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); ++ 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); ++ google_breakpad::DIEDispatcher die_dispatcher(&root_handler); ++ google_breakpad::CompilationUnit split_reader(split_file, split_sections, ++ cu_offset, &split_byte_reader, ++ &die_dispatcher); ++ split_reader.SetSplitDwarf(reader->GetAddrBuffer(), ++ reader->GetAddrBufferLen(), reader->GetAddrBase(), ++ reader->GetRangeBase(), 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 + bool LoadDwarf(const string& dwarf_filename, + const typename ElfClass::Ehdr* elf_header, +@@ -421,6 +455,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; + } +diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc +index dd91196a..d7c3e695 100644 +--- a/src/common/mac/dump_syms.cc ++++ b/src/common/mac/dump_syms.cc +@@ -424,14 +424,49 @@ bool DumpSymbols::CreateEmptyModule(scoped_ptr& module) { + 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); ++ 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); ++ google_breakpad::DIEDispatcher die_dispatcher(&root_handler); ++ google_breakpad::CompilationUnit split_reader(split_file, split_sections, ++ cu_offset, &split_byte_reader, ++ &die_dispatcher); ++ split_reader.SetSplitDwarf(reader->GetAddrBuffer(), ++ reader->GetAddrBufferLen(), reader->GetAddrBase(), ++ reader->GetRangeBase(), 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_, +@@ -467,14 +502,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. +@@ -485,6 +520,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); ++ } + } + } + +diff --git a/src/common/mac/dump_syms.h b/src/common/mac/dump_syms.h +index 5bcb0b58..5ccf49e3 100644 +--- a/src/common/mac/dump_syms.h ++++ b/src/common/mac/dump_syms.h +@@ -43,6 +43,7 @@ + #include + + #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" +@@ -143,6 +144,13 @@ class DumpSymbols { + // Creates an empty module object. + bool CreateEmptyModule(scoped_ptr& 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, +diff --git a/src/common/module.cc b/src/common/module.cc +index 73c4a8b1..0eb5aad8 100644 +--- a/src/common/module.cc ++++ b/src/common/module.cc +@@ -289,8 +289,7 @@ void Module::GetStackFrameEntries(vector* vec) const { + } + } + +-void Module::AssignSourceIds( +- set& 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) { +@@ -394,7 +393,7 @@ bool Module::Write(std::ostream& stream, SymbolData symbol_data) { + // Get all referenced inline origins. + set 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 d736701f..28e8e9c5 100644 +--- a/src/common/module.h ++++ b/src/common/module.h +@@ -146,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. +@@ -228,7 +224,7 @@ class Module { + map references_; + }; + +- InlineOriginMap inline_origin_map; ++ map inline_origin_maps; + + // A source line. + struct Line { +@@ -407,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& inline_origins); ++ void AssignSourceIds(); + + // This function should be called before AssignSourceIds() to get the set of + // valid InlineOrigins*. +diff --git a/src/common/module_unittest.cc b/src/common/module_unittest.cc +index 6a6762e5..c51162e5 100644 +--- a/src/common/module_unittest.cc ++++ b/src/common/module_unittest.cc +@@ -198,9 +198,7 @@ TEST(Module, WriteOmitUnusedFiles) { + function->lines.push_back(line1); + function->lines.push_back(line2); + m.AddFunction(function); +- +- std::set inline_origins; +- m.AssignSourceIds(inline_origins); ++ m.AssignSourceIds(); + + vector vec; + m.GetFiles(&vec); diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0042-Fix-minidump-generation-on-arm-softfp-targets.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0042-Fix-minidump-generation-on-arm-softfp-targets.patch new file mode 100644 index 000000000..8b3359b07 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0042-Fix-minidump-generation-on-arm-softfp-targets.patch @@ -0,0 +1,41 @@ +From 8267ac651047c3d44354d6a2e6cd36b506766d03 Mon Sep 17 00:00:00 2001 +From: Richard Nichols +Date: Fri, 19 May 2023 17:41:55 +0000 +Subject: [PATCH] Fix minidump generation on arm softfp targets. + +Test: arm softfp build, crashed program intentionally with kill -4 and +observed successful minidump generation. +Bug: b/283473162 +Change-Id: Id71f92653ced04575ffbb87e309d4139ca34d843 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4545508 +Reviewed-by: Joshua Peraza +--- + src/client/linux/minidump_writer/linux_ptrace_dumper.cc | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +index 0e58236b..2adc39e1 100644 +--- a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc ++++ b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +@@ -179,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 +@@ -190,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/meta-oe/recipes-devtools/breakpad/breakpad/0043-Modify-RISCV-minidump-context-to-match-Crashpad.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0043-Modify-RISCV-minidump-context-to-match-Crashpad.patch new file mode 100644 index 000000000..8357b5ad0 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0043-Modify-RISCV-minidump-context-to-match-Crashpad.patch @@ -0,0 +1,343 @@ +From 64a53c190426fe582999ac7cfc4c4a5d24084795 Mon Sep 17 00:00:00 2001 +From: Thomas Gales +Date: Mon, 22 May 2023 22:51:47 +0000 +Subject: [PATCH] Modify RISCV minidump context to match Crashpad + +- RISCV32 will only include support for 32 bit floating point registers +- RISCV64 will only include support for 64 bit floating point registers +- RISCV 32/64 context will include a "version" field to account for + future extensions + +Fixed: 1447862 + +Tested: `make check` on x86 host +Tested: `minidump_stackwalk` for RISCV64 minidump on x86 host +Change-Id: I605d5b2c35e627a5dc986aaf818a9c9898f6ae0b +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4553281 +Reviewed-by: Joshua Peraza +--- + .../linux/dump_writer_common/thread_info.cc | 30 +++++------- + .../dump_writer_common/ucontext_reader.cc | 28 +++++------ + .../common/minidump_cpu_riscv.h | 38 +++++--------- + src/processor/dump_context.cc | 49 ++++++------------- + src/processor/minidump.cc | 14 +++--- + src/tools/linux/md2core/minidump-2-core.cc | 30 +++++------- + 6 files changed, 72 insertions(+), 117 deletions(-) + +diff --git a/src/client/linux/dump_writer_common/thread_info.cc b/src/client/linux/dump_writer_common/thread_info.cc +index fc82c0c6..6288a056 100644 +--- a/src/client/linux/dump_writer_common/thread_info.cc ++++ b/src/client/linux/dump_writer_common/thread_info.cc +@@ -322,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 c6a8e9aa..76497683 100644 +--- a/src/client/linux/dump_writer_common/ucontext_reader.cc ++++ b/src/client/linux/dump_writer_common/ucontext_reader.cc +@@ -310,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/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/processor/dump_context.cc b/src/processor/dump_context.cc +index 93d826c4..ab97930f 100644 +--- a/src/processor/dump_context.cc ++++ b/src/processor/dump_context.cc +@@ -776,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; + } +@@ -870,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/minidump.cc b/src/processor/minidump.cc +index 45e4a524..f0f92534 100644 +--- a/src/processor/minidump.cc ++++ b/src/processor/minidump.cc +@@ -1259,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()); + +@@ -1338,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()); + +diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc +index 9d5e5e3f..3e310bc7 100644 +--- a/src/tools/linux/md2core/minidump-2-core.cc ++++ b/src/tools/linux/md2core/minidump-2-core.cc +@@ -583,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" diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0044-Properly-initialize-enable_objdump_for_exploitabilit.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0044-Properly-initialize-enable_objdump_for_exploitabilit.patch new file mode 100644 index 000000000..111dd1dcc --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0044-Properly-initialize-enable_objdump_for_exploitabilit.patch @@ -0,0 +1,46 @@ +From 6857c7c65f43dcd6f20ff800c56fedb4878c1140 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Tue, 23 May 2023 17:26:17 +0200 +Subject: [PATCH] Properly initialize enable_objdump_for_exploitability_ + +Change-Id: I30fab42e2a1e7d0abf970b825e66a0db8b6a0fd5 +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4557444 +Reviewed-by: Joshua Peraza +--- + src/processor/minidump_processor.cc | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc +index f7d877c6..f412af64 100644 +--- a/src/processor/minidump_processor.cc ++++ b/src/processor/minidump_processor.cc +@@ -63,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, +@@ -72,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, +@@ -80,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_); + } + diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0045-Fix-reading-DW_AT_ranges-in-split-dwarf.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0045-Fix-reading-DW_AT_ranges-in-split-dwarf.patch new file mode 100644 index 000000000..680e6dc36 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0045-Fix-reading-DW_AT_ranges-in-split-dwarf.patch @@ -0,0 +1,359 @@ +From 02fe1eef8e4753cfa686db52fc375e17f5d23c84 Mon Sep 17 00:00:00 2001 +From: Zequan Wu +Date: Thu, 25 May 2023 15:40:44 -0400 +Subject: [PATCH] Fix reading DW_AT_ranges in split dwarf. + +Bug: b/280290608, chromium:1448979 +Change-Id: I3f9e4c3d62b4c858238ccbbda0366926c306e27f +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4568824 +Reviewed-by: Joshua Peraza +--- + src/common/dwarf/dwarf2enums.h | 6 +++--- + src/common/dwarf/dwarf2reader.cc | 29 ++++++++++++++++++++--------- + src/common/dwarf/dwarf2reader.h | 28 +++++++++++----------------- + src/common/dwarf_cu_to_module.cc | 26 ++++++++++++++++++-------- + src/common/dwarf_cu_to_module.h | 4 +++- + src/common/linux/dump_symbols.cc | 23 ++++++++++++++++------- + src/common/mac/dump_syms.cc | 22 +++++++++++++++------- + 7 files changed, 86 insertions(+), 52 deletions(-) + +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 4f63b979..0a1ff060 100644 +--- a/src/common/dwarf/dwarf2reader.cc ++++ b/src/common/dwarf/dwarf2reader.cc +@@ -80,7 +80,7 @@ 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), ++ skeleton_dwo_id_(0), addr_base_(0), + str_offsets_base_(0), have_checked_for_dwp_(false), + should_process_split_dwarf_(false) {} + +@@ -91,16 +91,11 @@ 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, ++void CompilationUnit::SetSplitDwarf( + uint64_t addr_base, +- uint64_t ranges_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; + } + +@@ -889,7 +884,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(); +@@ -1016,7 +1013,8 @@ bool CompilationUnit::ProcessSplitDwarf(std::string& split_file, + string debug_suffix(".debug"); + dwp_path = path_; + size_t found = path_.rfind(debug_suffix); +- if (found + debug_suffix.length() == path_.length()) ++ 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) { +@@ -1133,6 +1131,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; + } +@@ -1245,6 +1245,12 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id, + ".debug_str_offsets", + std::make_pair(reinterpret_cast (str_offsets_data_) + + offset, size))); ++ } else if (section_id == DW_SECT_RNGLISTS) { ++ sections->insert(std::make_pair( ++ ".debug_rnglists", ++ std::make_pair( ++ reinterpret_cast(rnglist_data_) + offset, ++ size))); + } + } + sections->insert(std::make_pair( +@@ -1830,6 +1836,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 cd676dea..a5c5febf 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 +@@ -493,7 +492,7 @@ class CompilationUnit { + + uint64_t GetAddrBase() { return addr_base_; } + +- uint64_t GetRangeBase() { return ranges_base_; } ++ uint64_t GetLowPC() { return low_pc_; } + + uint64_t GetDWOID() { return dwo_id_; } + +@@ -583,14 +582,8 @@ 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; +- } +- // 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_low_pc) { ++ low_pc_ = data; + } + handler_->ProcessAttributeUnsigned(offset, attr, form, data); + } +@@ -745,10 +738,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_; + +@@ -762,9 +751,12 @@ class CompilationUnit { + std::unique_ptr split_elf_reader_; + + // DWP reader. +- std::unique_ptr dwp_reader_; ++ std::unique_ptr dwp_reader_; ++ ++ bool should_process_split_dwarf_; + +- bool should_process_split_dwarf_; ++ // The value of the DW_AT_low_pc attribute, if any. ++ uint64_t low_pc_; + }; + + // A Reader for a .dwp file. Supports the fetching of DWARF debug +@@ -851,6 +843,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_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc +index 2a23ca7c..a6cfb49c 100644 +--- a/src/common/dwarf_cu_to_module.cc ++++ b/src/common/dwarf_cu_to_module.cc +@@ -169,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::iterator it = functions.begin(); +@@ -854,7 +858,7 @@ void DwarfCUToModule::FuncHandler::Finish() { + iter->second->name = name_; + } + +- if (!ranges_data_) { ++ if (low_pc_ && high_pc_) { + // 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 && +@@ -868,7 +872,7 @@ void DwarfCUToModule::FuncHandler::Finish() { + + Module::Range range(low_pc_, high_pc_ - low_pc_); + ranges.push_back(range); +- } else { ++ } else if (ranges_data_) { + RangesHandler* ranges_handler = cu_context_->ranges_handler; + if (ranges_handler) { + RangeListReader::CURangesInfo cu_info; +@@ -1069,10 +1073,16 @@ 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) + : 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) {} + +diff --git a/src/common/dwarf_cu_to_module.h b/src/common/dwarf_cu_to_module.h +index 5a800104..90ee2dec 100644 +--- a/src/common/dwarf_cu_to_module.h ++++ b/src/common/dwarf_cu_to_module.h +@@ -264,7 +264,9 @@ 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); + ~DwarfCUToModule(); + + void ProcessAttributeSigned(enum DwarfAttribute attr, +diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc +index 0bfc74c3..2f468dfe 100644 +--- a/src/common/linux/dump_symbols.cc ++++ b/src/common/linux/dump_symbols.cc +@@ -348,18 +348,27 @@ void StartProcessSplitDwarf(google_breakpad::CompilationUnit* reader, + 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, 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()); ++ + 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); ++ &reporter, handle_inline, reader->GetLowPC(), ++ reader->GetAddrBase()); + google_breakpad::DIEDispatcher die_dispatcher(&root_handler); +- google_breakpad::CompilationUnit split_reader(split_file, split_sections, +- cu_offset, &split_byte_reader, +- &die_dispatcher); +- split_reader.SetSplitDwarf(reader->GetAddrBuffer(), +- reader->GetAddrBufferLen(), reader->GetAddrBase(), +- reader->GetRangeBase(), reader->GetDWOID()); ++ 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()) { +diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc +index d7c3e695..2f48cb4f 100644 +--- a/src/common/mac/dump_syms.cc ++++ b/src/common/mac/dump_syms.cc +@@ -439,18 +439,26 @@ void DumpSymbols::StartProcessSplitDwarf( + 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); ++ // If DWP/DWO file doesn't have .debug_addr, its debug info will refer to ++ // .debug_addr 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()); + 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); ++ &reporter, handle_inline, reader->GetLowPC(), ++ reader->GetAddrBase()); + google_breakpad::DIEDispatcher die_dispatcher(&root_handler); +- google_breakpad::CompilationUnit split_reader(split_file, split_sections, +- cu_offset, &split_byte_reader, +- &die_dispatcher); +- split_reader.SetSplitDwarf(reader->GetAddrBuffer(), +- reader->GetAddrBufferLen(), reader->GetAddrBase(), +- reader->GetRangeBase(), reader->GetDWOID()); ++ 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()) { diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0046-Breakpad-Fix-hex-formatting-for-MinidumpCrashpadInfo.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0046-Breakpad-Fix-hex-formatting-for-MinidumpCrashpadInfo.patch new file mode 100644 index 000000000..3e3c28990 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0046-Breakpad-Fix-hex-formatting-for-MinidumpCrashpadInfo.patch @@ -0,0 +1,29 @@ +From 18aa6faf2e044bb22a6331a95b2319fa5f751ea8 Mon Sep 17 00:00:00 2001 +From: Ben Hamilton +Date: Fri, 26 May 2023 09:52:25 -0600 +Subject: [PATCH] [Breakpad] Fix hex formatting for + MinidumpCrashpadInfo::Print() + +The hex formatting in MinidumpCrashpadInfo::Print() was missing +the leading 0, so byte values < 128 were not possible to decode. + +Change-Id: Ib355bcdaf86e91d644045df645fb4fa75332aa4b +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4571100 +Reviewed-by: Joshua Peraza +--- + src/processor/minidump.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc +index f0f92534..83f72b97 100644 +--- a/src/processor/minidump.cc ++++ b/src/processor/minidump.cc +@@ -5503,7 +5503,7 @@ void MinidumpCrashpadInfo::Print() { + // Value represents something else. + char buffer[3]; + for (const uint8_t& v : annot.value) { +- snprintf(buffer, sizeof(buffer), "%X", v); ++ snprintf(buffer, sizeof(buffer), "%02X", v); + str_value.append(buffer); + } + } diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0047-Share-.debug_line-and-.debug_line_str-among-dwp-file.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0047-Share-.debug_line-and-.debug_line_str-among-dwp-file.patch new file mode 100644 index 000000000..45f89740d --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0047-Share-.debug_line-and-.debug_line_str-among-dwp-file.patch @@ -0,0 +1,243 @@ +From a9bb98478507cd9a07ebf0b20faae501e9798106 Mon Sep 17 00:00:00 2001 +From: Zequan Wu +Date: Wed, 31 May 2023 16:26:04 -0400 +Subject: [PATCH] Share .debug_line and .debug_line_str among dwp file and main + binary file. + +The debug info in the dwp file needs to refer to the .debug_line and +.debug_line_str sections in the main binary. + +This fixes dump_syms not generating LINE records for dwp in split dwarf. + +Bug: chromium:1448979 +Change-Id: I71923f12cea72caae081c1406e2cbca55e95859e +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4576346 +Reviewed-by: Joshua Peraza +--- + src/common/dwarf/dwarf2reader.cc | 12 +++++++++--- + src/common/dwarf/dwarf2reader.h | 26 +++++++++++++++++++++++++- + src/common/dwarf_cu_to_module.cc | 7 +++++-- + src/common/dwarf_cu_to_module.h | 4 +++- + src/common/linux/dump_symbols.cc | 20 +++++++++++++++----- + src/common/mac/dump_syms.cc | 20 +++++++++++++++----- + 6 files changed, 72 insertions(+), 17 deletions(-) + +diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc +index 0a1ff060..8a8bf6f8 100644 +--- a/src/common/dwarf/dwarf2reader.cc ++++ b/src/common/dwarf/dwarf2reader.cc +@@ -82,7 +82,8 @@ CompilationUnit::CompilationUnit(const string& path, + is_split_dwarf_(false), is_type_unit_(false), dwo_id_(0), dwo_name_(), + skeleton_dwo_id_(0), addr_base_(0), + str_offsets_base_(0), have_checked_for_dwp_(false), +- should_process_split_dwarf_(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 +@@ -91,8 +92,7 @@ CompilationUnit::CompilationUnit(const string& path, + // the executable file, and call it as if we were still + // processing the original compilation unit. + +-void CompilationUnit::SetSplitDwarf( +- uint64_t addr_base, ++void CompilationUnit::SetSplitDwarf(uint64_t addr_base, + uint64_t dwo_id) { + is_split_dwarf_ = true; + addr_base_ = addr_base; +@@ -435,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()) { +diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h +index a5c5febf..b6bd2f31 100644 +--- a/src/common/dwarf/dwarf2reader.h ++++ b/src/common/dwarf/dwarf2reader.h +@@ -496,6 +496,18 @@ class CompilationUnit { + + 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: +@@ -585,6 +597,10 @@ class CompilationUnit { + else if (attr == DW_AT_low_pc) { + low_pc_ = data; + } ++ else if (attr == DW_AT_stmt_list) { ++ has_source_line_info_ = true; ++ source_line_offset_ = data; ++ } + handler_->ProcessAttributeUnsigned(offset, attr, form, data); + } + +@@ -696,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_; + +@@ -710,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 +@@ -757,6 +777,10 @@ class CompilationUnit { + + // 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 +diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc +index a6cfb49c..3beaff2c 100644 +--- a/src/common/dwarf_cu_to_module.cc ++++ b/src/common/dwarf_cu_to_module.cc +@@ -1075,7 +1075,9 @@ DwarfCUToModule::DwarfCUToModule(FileContext* file_context, + WarningReporter* reporter, + bool handle_inline, + uint64_t low_pc, +- uint64_t addr_base) ++ 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, +@@ -1084,7 +1086,8 @@ DwarfCUToModule::DwarfCUToModule(FileContext* file_context, + 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 90ee2dec..1ff0ebc7 100644 +--- a/src/common/dwarf_cu_to_module.h ++++ b/src/common/dwarf_cu_to_module.h +@@ -266,7 +266,9 @@ class DwarfCUToModule: public RootDIEHandler { + WarningReporter* reporter, + bool handle_inline = false, + uint64_t low_pc = 0, +- uint64_t addr_base = 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/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc +index 2f468dfe..86c948d9 100644 +--- a/src/common/linux/dump_symbols.cc ++++ b/src/common/linux/dump_symbols.cc +@@ -351,19 +351,29 @@ void StartProcessSplitDwarf(google_breakpad::CompilationUnit* reader, + 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, its debug info +- // will refer to .debug_addr/.debug_line in the main binary. ++ // 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()); ++ 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, +diff --git a/src/common/mac/dump_syms.cc b/src/common/mac/dump_syms.cc +index 2f48cb4f..c06945e4 100644 +--- a/src/common/mac/dump_syms.cc ++++ b/src/common/mac/dump_syms.cc +@@ -442,18 +442,28 @@ void DumpSymbols::StartProcessSplitDwarf( + for (auto section : split_sections) + file_context.AddSectionToSectionMap(section.first, section.second.first, + section.second.second); +- // If DWP/DWO file doesn't have .debug_addr, its debug info will refer to +- // .debug_addr in the main binary. ++ // 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()); ++ 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, diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0048-Fix-bug-when-ranges_data-is-index-0-in-DW_AT_ranges.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0048-Fix-bug-when-ranges_data-is-index-0-in-DW_AT_ranges.patch new file mode 100644 index 000000000..79f9612b1 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0048-Fix-bug-when-ranges_data-is-index-0-in-DW_AT_ranges.patch @@ -0,0 +1,94 @@ +From 8988364bcddd9b194b0bf931c10bc125987330ed Mon Sep 17 00:00:00 2001 +From: Zequan Wu +Date: Thu, 1 Jun 2023 14:58:24 -0400 +Subject: [PATCH] Fix bug when ranges_data is index 0 in DW_AT_ranges. + +Bug: chromium:1448979 +Change-Id: Ib174ab1592d189e0f05e6baa6a96af2742d00eda +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4580929 +Reviewed-by: Joshua Peraza +--- + src/common/dwarf_cu_to_module.cc | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc +index 3beaff2c..94a0d428 100644 +--- a/src/common/dwarf_cu_to_module.cc ++++ b/src/common/dwarf_cu_to_module.cc +@@ -579,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, +@@ -600,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>& inlines_; +@@ -620,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; +@@ -663,7 +666,7 @@ bool DwarfCUToModule::InlineHandler::EndAttributes() { + void DwarfCUToModule::InlineHandler::Finish() { + vector 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 && +@@ -745,7 +748,8 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler { + ranges_data_(0), + inline_(false), + handle_inline_(handle_inline), +- has_qualified_name_(false) {} ++ has_qualified_name_(false), ++ has_range_data_(false) {} + + void ProcessAttributeUnsigned(enum DwarfAttribute attr, + enum DwarfForm form, +@@ -769,6 +773,7 @@ class DwarfCUToModule::FuncHandler: public GenericDIEHandler { + vector> child_inlines_; + bool handle_inline_; + bool has_qualified_name_; ++ bool has_range_data_; + DIEContext child_context_; // A context for our children. + }; + +@@ -788,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; +@@ -858,7 +864,7 @@ void DwarfCUToModule::FuncHandler::Finish() { + iter->second->name = name_; + } + +- if (low_pc_ && high_pc_) { ++ 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 && +@@ -872,7 +878,7 @@ void DwarfCUToModule::FuncHandler::Finish() { + + Module::Range range(low_pc_, high_pc_ - low_pc_); + ranges.push_back(range); +- } else if (ranges_data_) { ++ } else { + RangesHandler* ranges_handler = cu_context_->ranges_handler; + if (ranges_handler) { + RangeListReader::CURangesInfo cu_info; diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0049-Fix-warnings-in-configure.ac.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0049-Fix-warnings-in-configure.ac.patch new file mode 100644 index 000000000..90bcba790 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0049-Fix-warnings-in-configure.ac.patch @@ -0,0 +1,431 @@ +From 7a1a190f4f68e8a3e06788498f50a4d5520a69f3 Mon Sep 17 00:00:00 2001 +From: Marc Gonzalez +Date: Thu, 6 Jul 2023 16:33:54 +0200 +Subject: [PATCH] Fix warnings in configure.ac + +Fix warnings on Ubuntu 22.04 + +Change-Id: I2f64988706e72838b4e2cec50d0bde9eb90929ad +Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4668734 +Reviewed-by: Mike Frysinger +--- + Makefile.in | 2 - + aclocal.m4 | 29 ------ + configure | 275 ++++++++++++--------------------------------------- + configure.ac | 11 +-- + 4 files changed, 65 insertions(+), 252 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 18456383..641226a0 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -2185,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@ +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..fb84fb0d 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 +@@ -1719,39 +1716,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 +1763,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 +@@ -6937,180 +6934,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 +7501,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 : +@@ -10767,6 +10619,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..1d53bc61 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]) diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0057-Committing-changes-from-do_patch.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0057-Committing-changes-from-do_patch.patch new file mode 100644 index 000000000..6bddb6850 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0057-Committing-changes-from-do_patch.patch @@ -0,0 +1,16 @@ +From a330225c017c2fb00ac63bed3cfec2f071fd5c4c Mon Sep 17 00:00:00 2001 +From: OpenEmbedded +Date: Fri, 3 Nov 2023 11:37:02 +0000 +Subject: [PATCH] Committing changes from do_patch + +--- + src/third_party/lss | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/third_party/lss b/src/third_party/lss +index 9719c1e1..5df84436 160000 +--- a/src/third_party/lss ++++ b/src/third_party/lss +@@ -1 +1 @@ +-Subproject commit 9719c1e1e676814c456b55f5f070eabad6709d31 ++Subproject commit 5df84436e034857faba3d88f88120238bc6056ce diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch b/meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch deleted file mode 100644 index 77d08399b..000000000 --- a/meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch +++ /dev/null @@ -1,19 +0,0 @@ -Upstream-Status: Pending - ---- a/linux_syscall_support.h -+++ b/linux_syscall_support.h -@@ -119,14 +119,7 @@ extern "C" { - - #ifdef __mips__ - /* Include definitions of the ABI currently in use. */ --#ifdef __ANDROID__ --/* Android doesn't have sgidefs.h, but does have asm/sgidefs.h, -- * which has the definitions we need. -- */ - #include --#else --#include --#endif - #endif - #endif - diff --git a/meta-oe/recipes-devtools/breakpad/breakpad_git.bb b/meta-oe/recipes-devtools/breakpad/breakpad_git.bb index 3462b846d..3322d8b51 100644 --- a/meta-oe/recipes-devtools/breakpad/breakpad_git.bb +++ b/meta-oe/recipes-devtools/breakpad/breakpad_git.bb @@ -14,11 +14,12 @@ inherit autotools DEPENDS += "zlib" DEPENDS:append:libc-musl = " libucontext" +SRCREV = "bae713be2e51faa5cbe0ac4bcd21c0a3ee72ff8e" BBCLASSEXTEND = "native" PE = "2" -PV = "1.0" +PV = "2023.01.27" SRCREV_FORMAT = "breakpad_gtest_protobuf_lss_gyp" @@ -41,9 +42,57 @@ SRC_URI = "git://github.com/google/breakpad;name=breakpad;branch=main;protocol=h file://0004-elf_reader.cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch \ file://mcontext.patch \ file://0001-Remove-HAVE_GETCONTEXT-check-to-add-local-implementa.patch \ - file://0001-lss-Match-syscalls-to-match-musl.patch;patchdir=src/third_party/lss \ - file://mips_asm_sgidefs.patch;patchdir=src/third_party/lss \ -" + file://0001-Mac-add-shell-script-to-coordinate-dumping-and-uploa.patch \ + file://0002-Remove-disassembler_objdump-from-the-build-on-non-li.patch \ + file://0003-Add-ScopedTmpFile.patch \ + file://0004-Add-ScopedPipe.patch \ + file://0005-Refactor-DisassemblerObjdump.patch \ + file://0006-Change-CLANG_CXX_LANGUAGE_STANDARD-from-c-0x-to-c-17.patch \ + file://0007-Fix-Mac-build.patch \ + file://0008-linux-Report-error-message-if-failed-to-send-http-re.patch \ + file://0009-Print-Crashpad-annotation-objects.patch \ + file://0010-Fix-sprintf-usage.patch \ + file://0011-Add-include-config.h-to-the-beginning-of-all-cc-file.patch \ + file://0012-Mac-stop-using-NXArchInfo-as-a-vocabulary-type.patch \ + file://0013-Mac-delete-unused-macho_dump.cc.patch \ + file://0014-Add-brief-flag-to-minidump_stackwalk.patch \ + file://0015-Remove-extra-comma-in-minidump_stackwalk.cc.patch \ + file://0016-dump_syms-Mac-New-n-MODULE-arg-to-Mac-dump_syms.patch \ + file://0017-Mac-don-t-call-NXFindBestFatArch.patch \ + file://0018-Add-EM_RISCV-as-recognized-value-for-ELF-e_machine.patch \ + file://0019-Add-RISC-V-register-names.patch \ + file://0020-Add-maxsize-for-xstate-areas.patch \ + file://0021-Convert-RISC-V-numeric-identifiers-to-strings.patch \ + file://0022-Set-O_NONBLOCK-for-opening-file-to-prevent-hanging-w.patch \ + file://0023-Fix-alignment-of-the-brief-output-of-minidump_stackw.patch \ + file://0024-dump_syms-Mac-New-x-option-to-prefer-extern-names-wh.patch \ + file://0025-dump_syms-Relax-name-matching-for-marking-symbols-as.patch \ + file://0026-Replace-unsigned-int-with-size_t-for-ModuleSerialize.patch \ + file://0027-Update-Mac-Headers.patch \ + file://0028-Mac-update-arch_utilities-for-macOS-13.patch \ + file://0029-Fix-AMD64-X86-typo-in-MD_CONTEXT_AMD64_ALL.patch \ + file://0030-minidump-2-core-Use-exception-context-for-crashed-th.patch \ + file://0031-Reimport-architecture-byte_order.h-from-canonical-re.patch \ + file://0032-Fix-dump_syms-help-typo-on-Linux.patch \ + file://0033-Include-iOS-in-availability-checks-for-mach-o-util.h.patch \ + file://0034-Fix-MDRawModuleCrashpadInfoList-modules-type.patch \ + file://0035-Fix-MDRawCrashpadAnnotationList-objects-type.patch \ + file://0036-dump_syms-riscv-Fix-register-name-mismatch.patch \ + file://0037-dump_syms-riscv-Update-unittest.patch \ + file://0038-Add-new-flag-to-allow-granular-control-over-the-use-.patch \ + file://0039-Modernize-code.patch \ + file://0040-Mac-shorten-sym-file-names-in-upload_system_symbols.patch \ + file://0041-Fix-inline_origin_map-key-collision-when-split-dwarf.patch \ + file://0042-Fix-minidump-generation-on-arm-softfp-targets.patch \ + file://0043-Modify-RISCV-minidump-context-to-match-Crashpad.patch \ + file://0044-Properly-initialize-enable_objdump_for_exploitabilit.patch \ + file://0045-Fix-reading-DW_AT_ranges-in-split-dwarf.patch \ + file://0046-Breakpad-Fix-hex-formatting-for-MinidumpCrashpadInfo.patch \ + file://0047-Share-.debug_line-and-.debug_line_str-among-dwp-file.patch \ + file://0048-Fix-bug-when-ranges_data-is-index-0-in-DW_AT_ranges.patch \ + file://0049-Fix-warnings-in-configure.ac.patch \ + file://0057-Committing-changes-from-do_patch.patch \ + " S = "${WORKDIR}/git" CXXFLAGS += "-D_GNU_SOURCE"