This includes the functions ExceptionBehaviorHasState(),
ExceptionBehaviorHasIdentity(),
ExceptionBehaviorHasMachExceptionCodes(), and ExceptionBehaviorBasic().
TEST=util_test
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/565793005
This also puts kMachExceptionCodes into mach_extensions.h, because a
form of MACH_EXCEPTION_CODES that’s the right type
(exception_behavior_t) has now shown its use in more than one file.
TEST=util_test ExcClientVariants.UniversalExceptionRaise
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/567283002
library support.
When building with support for Mac OS X 10.6, C++11 library support is
not available, because Mac OS X uses libc++ for C++11 support, and Mac
OS X 10.6 does not provide libc++ as a runtime library. gtest and gmock
have a hard time distinguishing between C++11 language and library
support (which is not really their fault, having one but not the other
is an odd situation). The currently-released trunk versions of gtest and
gmock do not work in this configuration. I’ve submitted patches upstream
to fix this, but they may take a while to make it to the released
verions. For now, it’s fine to roll gtest and gmock back to versions
from December 2013 that do work cleanly with C++11 language support but
only C++03 library support.
TEST=Compile and run all tests in both 10.6 and native builds
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/572613002
until the server is done handling its request.
In most tests, this is handled automatically because the client expects
a reply from the server, and waits for this reply. This test is
different because the server does handle the message, but does not send
a reply, so the client does not wait for one. When the child process
exits before the parent has had a chance to inspect the message it
received, the parent will find a dead name where it expects the remote
port to be, causing this test to be flaky based on the outcome of this
race.
The potential for a similar race existed in the
MachMessageServer.ComplexNotDestroyedNoReply test because it also
involved a request without a reply. In that test, the situation was
handled by not allowing the child to exit until signaled to do so by the
parent. The same logic should be used for both no-reply tests.
TEST=util_test MachMessageServer.ReturnCodeNoReply
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/569953002
Kernel bugs prevent debug thread state flavors from being delivered to
exception handlers properly. Through luck, things work out for
x86_DEBUG_STATE and x86_DEBUG_STATE64, but a handler registered to
receive the x86_DEBUG_STATE32 thread state flavor will never be called.
For the x86 family, the only thread state flavors that can be delivered
to exception handlers are the thread, float, and exception flavors.
Radar 18312067 is filed.
TEST=util_test ExcServerVariants.ThreadStates
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/558503006
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