aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/file_id_unittest.cc
AgeCommit message (Collapse)Author
2023-02-27Add #include <config.h> to the beginning of all cc filesIan Barkley-Yeung
Added #ifdef HAVE_CONFIG_H #include <config.h> #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 <config.h> \/\/ 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 <vapier@chromium.org>
2022-09-07Update copyright boilerplate, 2022 edition (Breakpad)Mark Mentovai
sed -i '' -E -e 's/Copyright (\(c\) )?([0-9-]+),? (Google|The Chromium Authors).*(\r)?$/Copyright \2 Google LLC\4/' -e '/^((\/\/|#| \*) )?All rights reserved\.?\r?$/d' -e 's/name of Google Inc\. nor the/name of Google LLC nor the/' -e 's/POSSIBILITY OF SUCH DAMAGE$/POSSIBILITY OF SUCH DAMAGE./' $(git grep -El 'Copyright (\(c\) )?([0-9-]+),? (Google|The Chromium Authors).*$') Plus manual fixes for src/processor/disassembler_x86.{cc,h}. Plus some conversions from CRLF to LF line endings in .cc and .h files. Bug: chromium:1098010 Change-Id: I8030e804eecd9f5a1ec9d66ae166efd8418c2a67 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3878302 Reviewed-by: Mike Frysinger <vapier@chromium.org>
2022-01-28namespace implementations of FileIDAdam Duke
In trying to create a backend service that can process both ELF and Mach-O binaries, I found that symbol collisions occur when trying to link different implementations of FileID. This change puts the different implementations into separate namespaces to avoid the collision. Change-Id: I15aabb222803f2ffbda15ed13e66793bae32ddce Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3421417 Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-08file_id_unittest: avoid system()Mike Frysinger
We have API's for copying files & changing file modes, so there's no sense in using system() to run programs to do that. For the strip call, do the minimal spawn+wait dance. This avoids weird quoting string issues at least. Change-Id: Ibda117f243e886c0c7fcf8076fb8602b8d3ba42d Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2396558 Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-07-15fix pointer style to match the style guideMike Frysinger
We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine <saugustine@google.com> Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-02-28Replace TYPED_TEST_CASE with TYPED_TEST_SUITE.Lei Zhang
TYPED_TEST_CASE is deprecated in modern googletest. BUG=chromium:936654 Change-Id: I08004ffbb26089ebe17302934ed6d3268220d151 Reviewed-on: https://chromium-review.googlesource.com/c/1493423 Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-05-26Teach the ELF parser to handle multiple PT_NOTE phdrs.Peter Collingbourne
It is legal for an ELF to contain multiple PT_NOTEs, and that is in fact what lld's output looks like. Testing: "make check" and breakpad_unittests when patched into chromium. Bug: chromium:716484 Change-Id: I01d3f8679961e2cb7e789d4007de8914c6af357d Reviewed-on: https://chromium-review.googlesource.com/513512 Reviewed-by: Primiano Tucci <primiano@chromium.org> Reviewed-by: Ted Mielczarek <ted@mielczarek.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-06-10Dump INFO CODE_ID containing Build ID in Linux dump_symsTed Mielczarek
I'd like to have the Build ID available for our symbol server uploading, and this will make it easy. Most of this change is me rewriting dump_symbols_unittest to be typed tests so I could add a new test there. R=mark@chromium.org BUG= Review URL: https://codereview.chromium.org/2052263002 .
2016-04-05Switch the Linux minidump writer to use MDCVInfoELF for CV data.Ted Mielczarek
This preserves full build ids in minidumps, which are useful for tracking down the right version of system libraries from Linux distributions. The default build id produced by GNU binutils' ld is a 160-bit SHA-1 hash of some parts of the binary, which is exactly 20 bytes: https://sourceware.org/binutils/docs-2.26/ld/Options.html#index-g_t_002d_002dbuild_002did-292 The bulk of the changes here are to change the signatures of the FileID methods to use a wasteful_vector instead of raw pointers, since build ids can be of arbitrary length. The previous change that added support for this in the processor code preserved the return value of `Minidump::debug_identifier()` as the current `GUID+age` treatment for backwards-compatibility, and exposed the full build id from `Minidump::code_identifier()`, which was previously stubbed out for Linux dumps. This change keeps the debug ID in the `dump_syms` output the same to match. R=mark@chromium.org, thestig@chromium.org BUG= Review URL: https://codereview.chromium.org/1688743002 .
2013-12-13Misc Android-related fixes.digit@chromium.org
- src/common/android/testing/mkdtemp.h: Fixes a compilation error when using the (recent) NDK r9b, see comments in the source file for details. - android/test-driver, Makefile.am, Makefile.in: Autotools 1.12 changed the way tests are run during "make check" so add a new "custom test driver" to run tests on Android, and modify Makefile.am / Makefile.in accordingly. Otherwise, 'make check' tried to run the tests on the host. - android/test-shell.sh: Allow several tests to run in parallel on the device, by creating a custom test directory for each test process. This allows running "make check -j8" reliably. - src/common/linux/file_id_unittest.cc: Disable the SelfStrip test on Android, since it assumes a 'strip' executable is available on the target system where the test runs. BUG=NONE R=mark@chromium.org, ted.mielczarek@gmail.com TEST=android/run-checks.sh --ndk-dir=/path/to/android-ndk-r9b Review URL: https://breakpad.appspot.com/904003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1259 4c0a9323-5329-0410-9bdc-e9ce6186880e
2013-04-10Fix build on Android - put the missing NT_GNU_BUILD_ID #define in ↵thestig@chromium.org
elf_gnu_compat.h and use it where needed. Review URL: https://breakpad.appspot.com/554004 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1146 4c0a9323-5329-0410-9bdc-e9ce6186880e
2013-04-04Try to find a build-id through PT_NOTE program headersted.mielczarek@gmail.com
A=Mike Hommey <mh@glandium.org> R=ted at https://breakpad.appspot.com/544003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1143 4c0a9323-5329-0410-9bdc-e9ce6186880e
2013-04-04Support generic Elf notes, with unit teststed.mielczarek@gmail.com
A=Mike Hommey <mh@glandium.org> R=ted at https://breakpad.appspot.com/546002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1142 4c0a9323-5329-0410-9bdc-e9ce6186880e
2013-03-29Refactor file_id_unittestted.mielczarek@gmail.com
A=Mike Hommey <mh@glandium.org> R=ted at https://breakpad.appspot.com/543003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1138 4c0a9323-5329-0410-9bdc-e9ce6186880e
2012-11-21Cleaning up google-breakpad source code of signed-unsigned comparison warningsivan.penkov@gmail.com
http://breakpad.appspot.com/488002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1083 4c0a9323-5329-0410-9bdc-e9ce6186880e
2012-07-02Fixing various compiler warnings and applying minor tweaks to allow running ofivan.penkov@gmail.com
the mojority of breakpad unittests in Google. http://breakpad.appspot.com/399002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@978 4c0a9323-5329-0410-9bdc-e9ce6186880e
2012-06-28This change allows compiling the google-breakpad code using a global ↵ivan.penkov@gmail.com
::string class instead of std::string. For more details take a look at common/using_std_string.h git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@974 4c0a9323-5329-0410-9bdc-e9ce6186880e
2011-12-21Replace readlink calls with a safer version that guarantees NULL-termination.benchan@chromium.org
This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Add a SafeReadLink function that wraps sys_readlink() to resolve a symbolic link but guarantees the result is NULL-terminated on success. 2. Refactor other source code to use SafeReadLink instead of readlink() or sys_readlink(). BUG=455 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6. 2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock). 3. All unit tests pass. 4. Run minidump-2-core to covnert a minidump file to a core file. Review URL: http://breakpad.appspot.com/334001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@896 4c0a9323-5329-0410-9bdc-e9ce6186880e
2011-11-23 Correct compilation warning.qsr@chromium.org
1) Modify src/common/mac/macho_walker.cc to remove a signed vs unsigned comparison. 2) Replace mktemp in test using AutoTmpDir that has been moved from client/mac/tests to common/tests. Review URL: http://breakpad.appspot.com/328001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@888 4c0a9323-5329-0410-9bdc-e9ce6186880e
2011-10-20Fix some shadow variables, including one in file_id.cc that causes all files ↵thestig@chromium.org
to generate the same hash. Add a test to make sure this doesn't happen again. Review URL: http://breakpad.appspot.com/316002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@875 4c0a9323-5329-0410-9bdc-e9ce6186880e
2011-08-30issue 243 - Linux dumper should use build id produced by ld --build-id if ↵ted.mielczarek
available R=thestig at http://breakpad.appspot.com/185001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@830 4c0a9323-5329-0410-9bdc-e9ce6186880e
2010-09-16Fix compilation of file_id_unittest.thestig@chromium.org
Review URL: http://breakpad.appspot.com/198001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@689 4c0a9323-5329-0410-9bdc-e9ce6186880e
2010-08-27Linux FileID should work with ELFCLASS32 and ELFCLASS64 regardless of what'smark@chromium.org
native. BUG=399 TEST=none Review URL: http://breakpad.appspot.com/178001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@677 4c0a9323-5329-0410-9bdc-e9ce6186880e
2009-12-23Issue 357: New Linux file_id code doesn't persist across strip. ↵ted.mielczarek
r=agl,nealsid at http://breakpad.appspot.com/49008 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@461 4c0a9323-5329-0410-9bdc-e9ce6186880e