Change some ELF utils to return the length as a size_t.

R=mark@chromium.org

Review URL: https://breakpad.appspot.com/7694002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1349 4c0a9323-5329-0410-9bdc-e9ce6186880e
Add frame pointer recovery to the AMD64 Stackwalker.

BUG=https://code.google.com/p/chromium/issues/detail?id=393594
R=mark@chromium.org

Review URL: https://breakpad.appspot.com/10664002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1350 4c0a9323-5329-0410-9bdc-e9ce6186880e
[Android]: Remove __system_property_get(ro.build.fingerprint) from WriteOSInformation.

__system_property_get has been removed from the Android NDK for 'L' so Breakpad
no longer links. This CL just removes the call in WriteOSInformation because
Chrome already passes the build fingerprint as a crash key called "android_build_fp" in the crash report HTTP POST message.

BUG=394841,393903
R=mark@chromium.org

Review URL: https://breakpad.appspot.com/1694002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1351 4c0a9323-5329-0410-9bdc-e9ce6186880e
Both std::tr1::unordered_set and std::unordered_set are not allowed in
Google at this moment.  This change is implementing a workaround that
allows switching to hash_set and hash_map.

R=mark@chromium.org

Review URL: https://breakpad.appspot.com/6694002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1354 4c0a9323-5329-0410-9bdc-e9ce6186880e
Chrome on Android now supports loading the shared library directly from the APK file.

This patch makes two changes to breakpad to enable crash reporting to work correctly when the library is inside another file (an archive):

- Do not filter mappings which map an executable at a non-zero offset.
- If such an executable is mapped look in the ELF information for the
shared object name and use that name in the minidump.

Note this change doesn't care about the archive format and isn't Android
specific (though loading the shared library this way is currently only done on Android).

BUG=390618
R=thestig@chromium.org

Review URL: https://breakpad.appspot.com/7684002

Patch from Anton Carver <anton@chromium.org>.

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1355 4c0a9323-5329-0410-9bdc-e9ce6186880e
Annotate PageAllocator for MSan.

PageAllocator maps memory via sys_mmap(), implemented in
linux_syscall_support.h. We need to explicitly inform MSan that this memory is
initialized.

Patch by Sergey Matveev <earthdok@chromium.org>

BUG=chromium:394028

Review URL: https://breakpad.appspot.com/2744002/


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1356 4c0a9323-5329-0410-9bdc-e9ce6186880e
Add GYP build for the src/tools directory on Mac and Linux.

This GYP-ifies the src/processor and src/common directories on those platforms
as well. The Makefile build uses much more granular unittest executables, so
the new processor_unittests does not yet link because of multiple main() symbols,
but this will be fixed later.

Update issue 575

R=mark@chromium.org

Review URL: https://breakpad.appspot.com/10674002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1358 4c0a9323-5329-0410-9bdc-e9ce6186880e
In Mac dump_syms, allow reading debug data out of both the Mach-O file and the dSYM.

This adds a new |-g <dSYM path>| flag to dump_syms, to specify the dSYM path for
the target Mach-O argument. The UUIDs and architectures of the two paths must
match in order to dump symbols for this "split module."

This reason for this is that for x86_64 binaries on OS X, the CFI data is stored
in the __TEXT,__eh_frame segment of the Mach-O file, and the data is not copied
into the dSYM by dsymutil.  Therefore, just dumping the dSYM doesn't yield CFI
data for x86_64 files, and both the dSYM and the Mach-O file must be dumped in
order to produce a complete Breakpad symbol file. For i386 binaries, the CFI data
is stored in the __DWARF,__debug_frame segment, which is part of the dSYM, so
this isn't necessary.

BUG=https://code.google.com/p/chromium/issues/detail?id=393594
R=mark@chromium.org

Review URL: https://breakpad.appspot.com/6704002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1359 4c0a9323-5329-0410-9bdc-e9ce6186880e
upload_system_symbols: Use the Go1.3 improvements to debug/macho.

This removes the custom MachO header reading functionality, since the stdlib can
now read Fat files.

R=andybons@chromium.org, mark@chromium.org

Review URL: https://breakpad.appspot.com/10684002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1360 4c0a9323-5329-0410-9bdc-e9ce6186880e
Update lss from r24 to r31.


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1361 4c0a9323-5329-0410-9bdc-e9ce6186880e
Add .gitignore, remove generated files
Install headers and pkg-config files

Installing a library without headers or pkg-config file isn't much use

See http://code.google.com/p/google-breakpad/issues/detail?id=219

v2:
Remove --with-pkgconfigdir option, just use $(libdir)/pkgconfig
Use $(includedir) rather than $(prefix)/include
Avoid O_BINARY redefinition warning on Cygwin

On Cygwin, WIN32 not defined, but O_BINARY is defined by fcntl.h, so avoid a
redefinition warning.

../src/processor/minidump.cc:55:0: warning: "O_BINARY" redefined [enabled by default]
 #define O_BINARY 0
 ^
In file included from /usr/include/sys/fcntl.h:3:0,
                 from /usr/include/fcntl.h:14,
                 from ../src/processor/minidump.cc:39:
/usr/include/sys/_default_fcntl.h:52:0: note: this is the location of the previous definition
 #define O_BINARY _FBINARY
 ^

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Build minidump_upload, sym_upload for all targets

Rather than duplicating these tools for any target which has libcurl
- Introduce src/tools/common/ and move minidump_upload, sym_upload there from src/tools/linux/
- Move linux/http_upload.cc,.h up to src/common/ from src/common/linux/

Don't link with -ldl and use dlopen to use libcurl.so, but just link with
libcurl.

XXX: Perhaps retaining linking with -dl and just teaching it the name of curl
shared object on Cygwin would be more upstreamable, although the reasons for not
linking with libcurl are obscure...
Remove local copy of curl headers

This reverts commit d9d863e153d12532fc85bd8b44bc47f079ed064c.
This reverts commit 68e380d5a73a0d657693f166fbcb1dd77027766b.
Add support for DWARF in PECOFF as used by Cygwin and MinGW

For cygwin and mingw targets, build a dump_syms tool which can read DWARF
symbols contained in a PE/COFF executable.

I felt bad about making another copy of dump_symbols.cc, so this one has the
beginnings of being parameterized by an image file reader class, so we can apply
it to a pecoff-format image file reading class

Write pecoff format image file reading class which
- knows how to read PE32 and PE32+ image files
- makes PECOFF file id by fetching from a CV record or by hashing
- can read PECOFF exports as a fallback if there is no DWARF information

v2:
Don't include arpa/inet.h on MinGW

v3:
Use AM_CPPFLAGS for NO_STABS_SUPPORT
Fix building minidump processor for MinGW

This is a sub-set of changes in https://breakpad.appspot.com/548002/ with a bit
of updating

- Link minidump_stackwalk, minidump_dump with PTHREAD_LIBS as pthread_cancel is used
- Link minidump_stackwalk with ws2_32 as ntoh functions are used
- Fix wtypes.h include for case sensitive filesystems
- _s function variants should only be used if _MSC_VER, use _r variants with
MinGW (and define _POSIX to ensure they are prototyped)
- Don't try to include arpa/inet.h on Windows
- Don't try to build upload tools, dump_syms_dwarf for MinGW
Build PECOFF/DWARF dump_syms for MinGW

- Substitute MapViewOfFile() for mmap()
- Link dump_syms_dwarf with ws2_32 as ntoh functions are used
Fix building client library and upload tools for MinGW

This is the rest of https://breakpad.appspot.com/548002/, brought up to date

Mainly fix include filenames to be lowercased for case-sensitive filesystems

Removed usage of stdext::checked_array_iterator, which is a MSVC-only feature.

v2:
Refine MinGW changes in HTTPUpload::GetFileContents so it closes file after use

v3:
For consistency, write conditionals in terms of _MSC_VER, not __MINGW32__
Fix common.gypi to allow gyp to generate Makefiles on Windows

The MSVS_VERSION variable does not exist unless we are using the MSVS generator