getsectionbyname() and getsegmentbyname() do not exist prior to Mac OS X
10.7. These functions are used by util_test MachOImageReader.*. For 10.6
SDK and runtime compatibility, Crashpad needs its own implementations of
these functions.
This checkin contains unmodified copies of the upstream code. A
subsequent checkin will contain the local modifications, which will trim
out all unnecessary portions. This is being committed in two parts to
make it easier to see what changes are being made to the upstream files.
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/564853002
MachOImageSymbolTableReader.
This results in a speed boost for MachOImageSymbolTableReader because
it’s able to read the entire string table in one operation, rather than
reading each string from the remote process individually. Copying is
also reduced. In a debug-mode build on my laptop, util_test
MachOImageReader.* has improved from ~1400ms to ~1000ms.
TEST=util_test TaskMemory.*:MachOImageReader.*
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/558313002
There’s no reason that “in” or “request” messages should be non-const.
This makes them const, bridges the const gap left by the MIG-generated
“check” functions with wrappers, and uses non-const fields in
“out” messages instead of const fields in “in” messages for in-out
parameters.
TEST=util_test ExcServerVariants.*:MachMessageServer.*
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/564533002
This includes the StringToNumber() function, both int and unsigned int variants.
Similar functionality is available in base, but it is unsuitable for
applications where a number’s base may be determined based on an "0x" or
"0X" prefix (hexadecimal) or an "0" prefix (octal).
TEST=util_test StringNumberConversion.*
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/557033002
An expectation of the child’s termination reason can now be specified.
It is now possible to test with children that do not exit cleanly, if
they are not expected to exit cleanly.
TEST=util_test Multiprocess.*
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/553153002
(MACH_RCV_LARGE).
This also adds a COMPILE_ASSERT to check that the
PersistentNonblockingFourMessages test case is not exceeding the value
of MACH_PORT_QLIMIT_DEFAULT.
TEST=util_test MachMessageServer.*
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/557793002
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
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
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
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
time_t is a typedef for long on Mac OS X. In 32-bit x86 (ILP32), long is
a signed 32-bit quantity, and its range does not contain the range of
uint32_t, used to store times in time_t fashion in minidump files. A
cast is necessary to make these EXPECT_* macros do the right thing. This
is not a problem in x86_64 (LP64) where long is a signed 64-bit
quantity, which does contain the range of uint32_t.
clang’s error was “error: comparison of integers of different signs:
'const long' and 'const unsigned int' [-Werror,-Wsign-compare]”
BUG=
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/491023005
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