985 Commits

Author SHA1 Message Date
Mark Mentovai
67082c93b9 Add MachMessageServer and its test.
MachMessageServer is much like mach_msg_server() and
mach_msg_server_once(), but with a C++ interface and with a number of
deficiencies corrected.

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

Review URL: https://codereview.chromium.org/544393002
2014-09-08 21:06:34 -04:00
Mark Mentovai
2cae118b60 Add MachOImageSymbolTableReader and hook it up to MachOImageReader.
TEST=util_test MachOImageReader.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/539263003
2014-09-05 16:53:18 -04:00
Mark Mentovai
3d4eeae864 Make ProcessReaderModule and ProcessReaderThread nested classes.
This change is being made in response to the suggestion at
https://codereview.chromium.org/539263003/diff/20001/util/mac/mach_o_image_symbol_table_reader.h#newcode45

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

Review URL: https://codereview.chromium.org/543193002
2014-09-05 16:35:16 -04:00
Mark Mentovai
9dd0ac943a Implement (and test) ProcessReader::Modules().
This depended on MachOImageReader, which recently landed, so it can now
be added.

TEST=util_test ProcessReader.*Modules
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/546573002
2014-09-05 13:43:51 -04:00
Mark Mentovai
5a0b7827ff Run mig to generate the exc and mach_exc interfaces.
mach_exc is necessary because libSystem doesn’t contain this at all. exc
is necessary too, however: the copy in libSystem relies on the server
callbacks being externally defined symbols, which is cheesey.
Additionally, some Crashpad code wants to call internal validation
(“check”) routines that are not normally accessible to outside callers
via the copy of exc in libSystem, but they are made accessible here by
processing mig’s output in this Python script.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/541213002
2014-09-05 13:27:06 -04:00
Mark Mentovai
2f425e744b Add missing dependency on util_test_multiprocess_exec_test_child to
util_test.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/542993002
2014-09-05 12:40:05 -04:00
Mark Mentovai
35865a00d5 Fix problems discovered with gcc 4.9.1.
BUG=
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/538233002
2014-09-05 12:39:09 -04:00
Mark Mentovai
4f74716f6d Add MachOImageReader and its test, which also tests
MachOImageSegmentReader.

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

Review URL: https://codereview.chromium.org/535343004
2014-09-04 11:45:40 -04:00
Mark Mentovai
52064fdd1b Add the MultiprocessExec test and its test.
TEST=util_test MultiprocessExec.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/531203002
2014-09-03 18:24:29 -04:00
Mark Mentovai
d492df404c Add CloseMultipleNowOrOnExec().
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/534703003
2014-09-02 16:21:46 -04:00
Mark Mentovai
1460c47d6a Add MachOImageSegmentReader.
This is part of a family of classes whose chief entry point is
MachOImageReader. MachOImageReader depends on this class to read
segments, so this one is landing first. The bulk of this class will be
tested as part of MachOImageReader.

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

Review URL: https://codereview.chromium.org/516983003
2014-09-02 15:50:11 -04:00
Mark Mentovai
af0cfd5a57 Add strnlen() wrapper and its test.
TEST=util_test strnlen.strnlen
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/514253002
2014-08-28 14:38:27 -04:00
Mark Mentovai
04842e0ca4 Add CheckedMachAddressRange and its test.
TEST=util_test CheckedMachAddressRange.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/513453002
2014-08-28 13:47:28 -04:00
Mark Mentovai
ff26ea6db9 Refactor MachMultiprocess into a Multiprocess base class without any
knowledge of Mach. MachMultiprocess builds on this new base class.

TEST=util_test MachMultiprocess.*:Multiprocess.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/506143002
2014-08-26 17:10:19 -04:00
Mark Mentovai
30589d87a9 Add ProcessTypes, its test, and many proctype definition files.
TEST=util_test ProcessTypes.DyldImagesSelf
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/501203002
2014-08-26 17:08:18 -04:00
Mark Mentovai
0cc86a24f9 Add ScopedForbidReturn and its test.
Use ScopedForbidReturn in ProcessReader::InitializeThreads().

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

Review URL: https://codereview.chromium.org/493203005
2014-08-26 16:50:08 -04:00
Mark Mentovai
8256f9fc23 Add most of ProcessReader and its test.
TEST=util_test ProcessReader.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/491963002
2014-08-25 17:51:09 -04:00
Mark Mentovai
4004e77ee9 Improvements for MachMultiprocess.
This adds a pipe going in the other direction (parent to child).
Initially, I didn’t think this was necessary, but it turned out to be
needed for ProcessReader. Having the child wait on a pipe read is the
easiest way to keep it alive until the parent is done with it.

This also tests MachMultiprocess::ChildPID() in
mach_multiprocess_test.cc.

Both of these fell out of https://codereview.chromium.org/491963002/.

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

Review URL: https://codereview.chromium.org/491363002
2014-08-22 14:00:10 -04:00
Mark Mentovai
bbe4d85935 Add MachMultiprocess and its test.
TEST=util_test MachMultiprocess.MachMultiprocess
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/482483002
2014-08-20 13:58:42 -04:00
Mark Mentovai
280c4345c5 Add BootstrapCheckIn and its test.
TEST=util_test Bootstrap.BootstrapCheckIn
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/478713003
2014-08-18 20:41:00 -07:00
Mark Mentovai
8fe32b7b9c Add mac_util, including MacOSXMinorVersion(), MacOSXVersion(), and
MacModelAndBoard(), along with their tests.

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

Review URL: https://codereview.chromium.org/473023002
2014-08-15 22:33:14 -07:00
Mark Mentovai
a70edb3b7f Add ServiceManagement*() and their tests.
TEST=util_test ServiceManagement
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/467923003
2014-08-15 22:30:24 -07:00
Mark Mentovai
d05166c26c Add CheckedRange<> and its test.
TEST=util_test CheckedRange
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/467113002
2014-08-15 10:22:37 -07:00
Mark Mentovai
6997418cd4 Add InRangeCast<> and its test.
InRangeCast<> is similar to base::saturated_cast<>, but it allows the
caller to specify the value to be returned in the event that the source
value can’t be converted to the destination data type without data loss.

TEST=util_test InRangeCast
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/467103002
2014-08-14 16:00:44 -07:00
Mark Mentovai
01f9e396b8 Include <limits.h> in util/file/file_writer.cc because it uses IOV_MAX.
This also updates mini_chromium to abd6e3792f4f.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/469093002
2014-08-14 09:58:31 -07:00
Mark Mentovai
5f554ff10e Add ProcessArgumentsForPID() (process_util) and its test.
TEST=util_test ProcessUtil.ProcessArgumentsForPID
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/461253002
2014-08-14 09:57:19 -07:00
Mark Mentovai
21af173940 Add InitializationStateDcheck, its base class, and their tests.
TEST=util_test InitializationState*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/465103002
2014-08-14 09:51:26 -07:00
Mark Mentovai
7090b209ad Use the gtest_main target for test executables.
There’s no need to build a separate copy of gtest_main.cc for each test
executable.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/465363004
2014-08-13 15:28:59 -07:00
Mark Mentovai
293964f69b Add CFPropertyToLaunchData() and its test.
TEST=util_test Launchd
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/438673003
2014-08-03 18:53:10 -04:00
Mark Mentovai
4ae57690fa Put back the standard-layout checks lost in 5bbb7e8abbe0.
TEST=util_test UUID.UUID
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/440603002
2014-08-03 18:50:09 -04:00
Mark Mentovai
9f6d86742d Add TaskMemory, which can read another Mach task’s memory, and its test.
This also adds MachErrorMessage(), a test-only function that’s a
dependency of TaskMemory’s test, and related test-only error message
functions.

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

Review URL: https://codereview.chromium.org/438993002
2014-08-03 18:48:40 -04:00
Mark Mentovai
5bbb7e8abb Fix the UUID structure to have distinct fields, as expected by
Breakpad’s minidump reader.

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

Review URL: https://codereview.chromium.org/436933002
2014-08-01 16:10:58 -04:00
Mark Mentovai
4d6b867a1f Add UUID, c16lcpy (strlcpy for char16*), and their tests to util.
These are dependencies of the upcoming MinidumpStringWriter.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/430003003
2014-08-01 14:39:55 -04:00
Mark Mentovai
6e720f1421 Fix StringFileWriter::Seek().
The final range check needs to check that the value fits in a size_t,
because that’s what StringFileWriter uses for its offset_.

TEST=util_test StringFileWriter.SeekInvalid
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/434103003
2014-08-01 13:30:27 -04:00
Mark Mentovai
995012534e Introduce MinidumpWritable, its dependencies, and their tests.
MinidumpWritable is the base class for all minidump-writing operations.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/432003005
2014-08-01 12:48:28 -04:00