167 Commits

Author SHA1 Message Date
Mark Mentovai
62b0976290 Add MinidumpExceptionWriter::InitializeFromSnapshot() and test.
TEST=minidump_test MinidumpExceptionWriter.InitializeFromSnapshot
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/698673002
2014-11-04 12:41:01 -05:00
Mark Mentovai
8248c030e2 Add MinidumpThreadListWriter::InitializeFromSnapshot(), everything
downstream, and tests.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/693933002
2014-11-04 12:36:29 -05:00
Mark Mentovai
52c2f6edfc Add MinidumpContextWriter::CreateFromSnapshot(), everything downstream,
and its test.

Minidump context structures now interoperate more easily with snapshot
CPUContext structures, while maintaining identical layout to before.
This is facilitated by reusing the Fxsave types for the substructures
which were completely identical, and by using compatible logic to
initialize the minidump and snapshot structures for testing.

TEST=minidump_test, snapshot_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/686353004
2014-11-03 17:43:39 -05:00
Mark Mentovai
f3bdc972f9 Fix comment for MinidumpUTF8StringAtRVAAsString().
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/689193003
2014-11-03 15:08:00 -05:00
Mark Mentovai
486429e4f4 util/net: Place death tests into a *DeathTest test case.
Not doing this causes gtest to issue these warnings:

[WARNING] ../../third_party/gtest/gtest/src/gtest-death-test.cc:825::
Death tests use fork(), which is unsafe particularly in a threaded
context. For this test, Google Test detected 4 threads.

The gtest documentation recommends giving the test case a name ending in
DeathTest. Test cases named according to this convention run before all
other tests. Other death tests in Crashpad also follow this convention.

https://code.google.com/p/googletest/wiki/AdvancedGuide#Death_Tests_And_Threads

TEST=util_test HTTPMultipartBuilderDeathTest.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/694963002
2014-10-31 15:39:16 -04:00
Robert Sesek
d88711adfa Add HTTPTransport, a Mac implementation, and an end-to-end test.
BUG=https://crbug.com/415544
R=mark@chromium.org

Review URL: https://codereview.chromium.org/692963002
2014-10-31 12:17:32 -04:00
Mark Mentovai
45993a6959 minidump: Fix InitializeFromSnapshot() comments for module lists.
These classes don’t really have “mutators” other than their singular
AddModule() methods, and the documentation is clearer when revised in
this way.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/691853002
2014-10-30 17:26:56 -04:00
Mark Mentovai
4299ab3c4c Add MinidumpMemoryListWriter::AddFromSnapshot(), everything downstream,
and its test.

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

Review URL: https://codereview.chromium.org/641603006
2014-10-30 17:15:49 -04:00
Mark Mentovai
f7b38a9dd9 minidump: Fix InitializeFromSnapshot() comments for module lists.
These classes don’t really have “mutators” other than their singular
AddModule() methods, and the documentation is clearer when revised in
this way.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/691853002
2014-10-30 14:51:40 -04:00
Robert Sesek
123e01f96d Treat '+' as a safe MIME type character.
This addresses a review comment from
https://codereview.chromium.org/681303003/diff/120001/util/net/http_multipart_builder.cc#newcode107

R=mark@chromium.org

Review URL: https://codereview.chromium.org/694483002
2014-10-30 09:22:39 -04:00
Robert Sesek
9db5d6f773 Add HTTPMultipartBuilder and its test.
BUG=https://crbug.com/415544
R=mark@chromium.org

Review URL: https://codereview.chromium.org/681303003
2014-10-29 19:13:24 -04:00
Mark Mentovai
4ee00568b7 snapshot: Make destructors of interface classes public and virtual.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/689483003
2014-10-29 17:31:23 -04:00
Mark Mentovai
84b44610cf minidump: Add InitializeFromSnapshot() for MinidumpModuleWriter and
MinidumpModuleListWriter.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/682263002
2014-10-29 11:38:49 -04:00
Mark Mentovai
7f30a9ebef Fix a few documentation problems.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/688643002
2014-10-29 11:33:34 -04:00
Mark Mentovai
78bec65b27 minidump: Use decltype(object) instead of typeof(object).
TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/681313005
2014-10-28 17:28:31 -04:00
Mark Mentovai
765e428321 minidump: Add InitializeFromSnapshot() for
MinidumpModuleCrashpadInfoListWriter and everything downstream.

TEST=minidump_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/683143003
2014-10-28 17:00:46 -04:00
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