151 Commits

Author SHA1 Message Date
Mark Mentovai
0a4ea0b52d minidump: Change the ownership model.
All minidump objects now own their all of their children, rather than
having them maintain weak pointers and requiring callers to maintain
ownership.

The only weak object in the entire tree now is the “extra memory” added
to a MinidumpMemoryListWriter by its AddExtraMemory() method. Extra
memory aliases objects owned elsewhere in the tree, typically by a
MinidumpThreadWriter as stack memory. Non-“extra” memory added to a
MinidumpMemoryListWriter by its AddMemory() method is strongly owned.

Many objects are now deleted through base pointers, and in those cases,
the base classes now have public virtual destructors. The ultimate base,
MinidumpWritable, is still protected to guard against direct
instantiation and deletion, and thus its destructor does not need to be
virtual.

This updates mini_chromium to eeb3b6a4f020 specifically for that
revision, which includes necessary updates to scoped_ptr. It also picks
up:

eeb3b6a4f020 Update base/move.h and base/memory/scoped_ptr.h to match
67ad2efafaba More porting to Windows
be27a006421e AUTHORS: Fix link post-git migration flag day.
05f5b1503230 Add codereview.settings to mini_chromium.
a32c2b199811 Beginnings of Windows support in mini_chromium

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/674153002
2014-10-27 15:01:39 -04:00
Robert Sesek
977a7a8052 Add HTTPBodyStream interface, three concrete implementations, and their tests.
BUG=415544
R=mark@chromium.org

Review URL: https://codereview.chromium.org/669153006
2014-10-24 15:04:25 -04:00
Mark Mentovai
3f48f6d798 minidump: Rename MinidumpCrashpadModuleInfoWriter files.
The classes were renamed in response to
https://codereview.chromium.org/675803002/diff/1/minidump/minidump_extensions.h#newcode334,
but the files were not.

TEST=minidump_test \
     MinidumpCrashpadInfoWriter.*:MinidumpModuleCrashpadInfoWriter.*

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/645393005
2014-10-24 14:58:53 -04:00
Mark Mentovai
61af24848f Add MinidumpModuleCrashpadInfo, its list form, their writers, and their
test.

Move SimpleAnnotations from being a property of the minidump to being a
property of the module, matching the Snapshot interface.

TEST=minidump_test MinidumpCrashpadInfo.*:MinidumpCrashpadModule.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/675803002
2014-10-24 14:44:55 -04:00
Mark Mentovai
38aeadc1c1 minidump: Use forward declarations in more places.
TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/679443002
2014-10-23 18:47:27 -04:00
Mark Mentovai
44a839614b minidump: Annotate existing virtual destructors that override a base
class virtual destructor with “override”.

TEST=minidump_test MinidumpContextWriter.*:MinidumpModuleWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/675783006
2014-10-23 18:42:26 -04:00
Mark Mentovai
dcdbd2098f minidump: Be consistent about setting the fields of WritableIoVec.
The iov_base field appears before the iov_len field, but for some
reason, sometimes the fields were being set in the reverse order.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/678473003
2014-10-23 17:25:20 -04:00
Mark Mentovai
20f95a2f5b minidump: Migrate the rest of the tests to
MinidumpWritableAtLocationDescriptor<>().

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/670853002
2014-10-22 18:35:18 -04:00
Mark Mentovai
8a6a4c68e4 Refactor minidump test utilities for MinidumpWritable,
MinidumpFileWriter, and Minidump*StringWriter.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/664283002
2014-10-21 14:15:07 -04:00
Mark Mentovai
01c535b001 Move minidump/*_test_util.* to minidump/test.
Suggested at
https://codereview.chromium.org/654573003/diff/1/minidump/minidump_string_writer_test_util.h#newcode22

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/663093003
2014-10-20 12:11:14 -04:00
Mark Mentovai
b8a2f41156 Add MinidumpCrashpadInfoWriter and its test.
TEST=minidump_test MinidumpCrashpadInfoWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/654573003
2014-10-17 18:00:41 -04:00
Mark Mentovai
b9db7543a3 client.gyp: Sort.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/657303003
2014-10-17 14:38:30 -04:00
Mark Mentovai
7d84d6512b include "util/stdlib/cxx.h" before checking CXX_LIBRARY_VERSION.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/662813003
2014-10-17 14:24:12 -04:00
Mark Mentovai
279ca87e68 Add ProcessSnapshotMac.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/650223007
2014-10-17 14:00:58 -04:00
Mark Mentovai
6584361343 Add ModuleSnapshotMac.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/649633004
2014-10-17 13:56:31 -04:00
Mark Mentovai
b43f510a52 Add crashpad_info, MachOImageAnnotationsReader, and its test.
TEST=snapshot_test MachOImageAnnotationsReader.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/651283003
2014-10-17 13:47:02 -04:00
Mark Mentovai
bcae4d94d5 Create snapshot/mac and move some files from snapshot and util to there.
TEST=snapshot_test, util_test CheckedMachAddressRange.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/666483002
2014-10-17 13:41:45 -04:00
Mark Mentovai
dd9cf1b367 Add CRASHPAD_SIMULATE_CRASH() and supporting client code.
TEST=client_test SimulateCrash.SimulateCrash
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/658853002
2014-10-17 12:30:55 -04:00
Mark Mentovai
f59e3e6b78 Add tool man pages in asciidoc format.
nroff mandoc-format man pages can be generated by running:

a2x --format manpage \
    --attribute 'mansource=Crashpad' \
    --attribute 'manversion=0.6.0' \
    --attribute 'manmanual=Crashpad Manual' \
    --attribute 'revdate=October 2014' \
    manpage.ad

For HTML output, use --format xhtml.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/664553004
2014-10-17 11:01:48 -04:00
Mark Mentovai
c9db1b1d19 Add MinidumpSimpleStringDictionaryWriter and its test.
TEST=minidump_test MinidumpSimpleStringDictionaryWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/656173003
2014-10-16 18:09:18 -04:00
Mark Mentovai
6c1a46f2bb ScopedTaskSuspend test: remove extraneous CheckedReadFDAtEOF().
The base class takes care of this.

TEST=util_test ScopedTaskSuspend.ScopedTaskSuspend
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/659493002
2014-10-14 11:14:20 -04:00
Mark Mentovai
525de2c35a Use exactly one of final, override, and virtual.
This change was generated mechanically by running:

  find . \
      \( -name \*.cc -or -name \*.mm -or -name \*.h \) \
      -and -not -path ./third_party/\* -and -not -path ./out/\* -exec \
      sed -i '' -E -e 's/virtual (.*) override final/\1 final/' {} +

  find . \
      \( -name \*.cc -or -name \*.mm -or -name \*.h \) \
      -and -not -path ./third_party/\* -and -not -path ./out/\* -exec \
      sed -i '' -E -e 's/virtual (.*) override/\1 override/' {} +

Additional changes were made manually based on:

  git grep -E '^ {3,}.*override[;{]'

http://google-styleguide.googlecode.com/svn/trunk/cppguide.html?showone=The__define_Guard#Inheritance

TEST=*_test
BUG=
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/654933002
2014-10-14 11:11:57 -04:00
Mark Mentovai
5d74f120fc Convert NULL to nullptr.
This change was generated mechanically by running:

  find . \( -name \*.cc -or -name \*.mm -or -name \*.h \) \
      -and -not -path ./third_party/\* -and -not -path ./out/\* \
      -exec sed -i '' -E -e 's/(^|[^_])NULL/\1nullptr/g' {} +

Further manual fix-ups were applied to remove casts of nullptr to other
pointer types where possible, to preserve the intentional use of NULL
(as a short form of MACH_PORT_NULL) in exception_port_tool, and to fix
80-column violations.

https://groups.google.com/a/chromium.org/d/topic/chromium-dev/4mijeJHzxLg/discussion

TEST=*_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/656703002
2014-10-14 11:10:45 -04:00
Mark Mentovai
d90ce10e1f ProcessReader: Fix comment about TASK_BASIC_INFO_64.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/650993003
2014-10-13 18:09:53 -04:00
Mark Mentovai
d7eb23c93e Add ExceptionSnapshotMac.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/650303002
2014-10-13 18:09:07 -04:00
Mark Mentovai
356a2db147 Add ThreadSnapshotMac.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/652003002
2014-10-13 18:06:43 -04:00
Mark Mentovai
2bd5e23ea4 Add ScopedTaskSuspend and its test.
This also introduces ScopedFcntlFlags.

TEST=util_test ScopedTaskSuspend.*:ScopedFcntlFlags.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/649693002
2014-10-13 18:05:21 -04:00
Mark Mentovai
8c7872e9e0 Use the correct null constants for Mach threads, tasks, and hosts.
This uses THREAD_NULL, TASK_NULL, and HOST_NULL in preference to
MACH_PORT_NULL and kMachPortNull. These constants are correctly-typed
(thread_t, task_t, and host_t) and result in more readable source code,
especially where thread and task parameters appear together as they do
in exc_*_variants.

TEST=util_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/649713002
2014-10-13 12:59:21 -04:00
Mark Mentovai
8f23d3e475 util_test Clock.SleepNanoseconds: don’t set an upper bound for the
amount of time spent sleeping.

Even with the slop, this wound up being flaky, specifically on virtual
machines. And guess what our automated test infrastructure runs on?

TEST=util_test Clock.SleepNanoseconds
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/640373003
2014-10-10 14:00:43 -04:00
Mark Mentovai
7669b33010 ServiceManagement test: reduce test flake.
ExpectProcessIsRunning() goes to a lot of trouble to deal with the flaky
{CTL_KERN, KERN_PROCARGS2} API exposed by ProcessArgumentsForPID(). It
retries that call inside an inner loop until it succeeds, because it may
fail while a process is mid-exec(). Once it succeeds, it should use the
argv it obtained. Waiting for success and then attempting to call
ProcessArgumentsForPID() again to get argv can be flaky when the first
attempt succeeds because it’s pre-exec(), and the second one catches the
process in the middle of the exec() and fails.

The existence of the inner loop was intended to protect against this
problem, and the subsequent call outside of the inner loop appears to be
left behind from before the inner loop existed. It should have been
removed when the inner loop was added.

TEST=util_test ServiceManagement.SubmitRemoveJob
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/644473005
2014-10-09 17:26:50 -04:00
Mark Mentovai
c182be95a2 Rename minidump_test_util.* to minidump_file_writer_test_util.*.
This is in line with the other new minidump_*_test_util files, namely,
the “context” and “memory” ones. minidump_file_writer_test_util.*
provides VerifyMinidumpHeader(), which is used to validate the
MINIDUMP_HEADER at the beginning of a minidump file, as written by
MinidumpFileWriter.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/643643003
2014-10-09 17:07:59 -04:00
Mark Mentovai
b8684a8a3c Add MinidumpThreadWriter, MinidumpThreadListWriter, and their test.
TEST=minidump_test MinidumpThreadWriter*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/637503006
2014-10-09 15:31:29 -04:00
Mark Mentovai
8d36e3581c minidump: Use variable names in tests that match parallel array indices.
Inspired by
https://codereview.chromium.org/637503006/diff/20001/minidump/minidump_thread_writer_test.cc#newcode409

TEST=minidump_test MinidumpMemoryWriter.*:MinidumpModuleWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/643683003
2014-10-09 15:21:05 -04:00
Mark Mentovai
9d115e2391 Add MinidumpExceptionWriter and its test.
TEST=minidump_test MinidumpExceptionWriter*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/639573002
2014-10-09 15:13:13 -04:00
Mark Mentovai
22350bd676 In tests, use ASSERT_NO_FATAL_FAILURE() instead of checking
testing::Test::HasFatalFailure() after calling functions that could fail
fatally.

Inspired by
https://codereview.chromium.org/637503006/diff/20001/minidump/minidump_thread_writer_test.cc#newcode437

TEST=client_test, minidump_test, util_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/640383002
2014-10-09 15:08:54 -04:00
Mark Mentovai
9c76cc60db Pull test utilities from MinidumpMemoryWriter’s test out into their own file.
These utilities are also useful to MinidumpThreadWriter’s test.

TEST=minidump_test MinidumpMemoryWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/639513002
2014-10-07 17:58:43 -04:00
Mark Mentovai
b677bc4ec0 Simplify MinidumpModuleWriter’s module name requirement implementation.
TEST=minidump_test MinidumpModuleWriter*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/633163002
2014-10-07 17:31:43 -04:00
Mark Mentovai
40602fab1f Don’t use using directives (“using namespace”) in tools.
The contents of tools are moved into the namespace
crashpad::(anonymous namespace).

https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Namespaces

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/627273004
2014-10-07 17:30:09 -04:00
Mark Mentovai
6d1af6922f Don’t use using directives (“using namespace”) in tests.
The contents of tests are moved into the namespace
crashpad::test::(anonymous namespace).

https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Namespaces

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/635883002
2014-10-07 17:28:50 -04:00
Mark Mentovai
e74a272ab5 Add MinidumpContextWriter test.
TEST=minidump_test MinidumpContextWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/628153004
2014-10-07 17:27:11 -04:00
Mark Mentovai
d0294f3bb8 Fix collision between 49c03db12965 and 56503fef865d.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/628403002
2014-10-06 19:02:57 -04:00
Mark Mentovai
49c03db129 Add snapshot/cpu_context_mac*, including InitializeCPUContextX86() and
InitializeCPUContextX86_64(), and their tests.

TEST=snapshot_test CPUContextMac.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/630513003
2014-10-06 18:46:04 -04:00
Mark Mentovai
56503fef86 Use the correct fxsave type for x86_64.
No functional change.

TEST=snapshot_test SystemSnapshotMacTest.CPUX86SupportsDAZ
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/623343004
2014-10-06 13:47:10 -04:00
Mark Mentovai
0ff46a4e60 Improve SystemSnapshotMac::TimeZone()’s computation of UTC offsets.
In locations that observe daylight saving time, this method now probes
different times to determine the offset when DST observance is (or is
not) in effect. This replaces a hard-coded one-hour offset, accounting
for Lord Howe Island, Australia, which is at a 30-minute offset.

TEST=snapshot_test SystemSnapshotMacTest.TimeZone
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/626093005
2014-10-03 18:40:09 -04:00
Mark Mentovai
6b451ea32a Add MemorySnapshotMac.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/623163004
2014-10-03 14:57:07 -04:00
Mark Mentovai
3f81599848 Add SystemSnapshotMac and its test.
TEST=snapshot_test SystemSnapshotMac.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/626013002
2014-10-03 14:55:54 -04:00
Mark Mentovai
bc8626f898 Use the correct type for ProcessReader::Thread::port.
It is a thread_t, not a task_t.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/627683002
2014-10-03 12:05:56 -04:00
Mark Mentovai
47f17926e4 util_test: specify libbsm link dependency properly.
7dda7b322881 accidentally moved the libbsm.dylib dependency from
util_test_lib to util_test. It is only used by
test/mac/mach_multiprocess.cc in util_test_lib.

Meanwhile, util_test should link against Foundation.framework, which is
used by three tests in util/mac: launchd_test.mm, mac_util_test.mm, and
service_management_test.mm.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/612923004
2014-10-02 18:32:33 -04:00
Mark Mentovai
7b2e7efcc2 Add the Snapshot interface.
These are all of the abstract base classes used in the Snapshot series,
discussed in the thread at
https://groups.google.com/a/chromium.org/d/topic/crashpad-dev/4pACgjhIz-I.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/597673004
2014-10-02 17:09:37 -04:00
Mark Mentovai
ae7ad05090 int128_test.cc: Add missing #include after d198c50abe9b.
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/620793003
2014-10-01 16:56:56 -04:00