288 Commits

Author SHA1 Message Date
Scott Graham
7cd1639990 win: Partial fixes for client_test after CrashReportDatabase added
- Dependency on compat required for sys/types.h inclusion for ssize_t.
- Test impl of stat to avoid #error
- FileHandle isn't int on Windows.

client_test no longer links though, as it's still lacking an
implementation of CrashReportDatabase of course.

R=rsesek@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/875043004
2015-01-26 13:56:20 -08:00
Scott Graham
7c9bd944ae win: Add implementation of HTTPTransport based on WinHTTP
(There's also https://codereview.chromium.org/854363006/ based on
WinInet, I'm still a little uncertain which is preferable here.)

R=cpu@chromium.org, mark@chromium.org, rsesek@chromium.org, ananta@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/852213004
2015-01-26 13:31:35 -08:00
Robert Sesek
ee98449755 Create CrashReportDatabase interface, a test, and a Mac implementation.
R=mark@chromium.org
TEST=client_test --gtest_filter=CrashReportDatabase\*

Review URL: https://codereview.chromium.org/842513002
2015-01-26 15:59:01 -05:00
Scott Graham
070ea9bfd7 roll mini_chromium to 45cbbb054ccef2e77d5233aa95c5f2742a23dec1
Includes:
45cbbb054ccef2e77d5233aa95c5f2742a23dec1 Add FilePath::FinalExtension and RemoveFinalExtension

TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/860863002
2015-01-20 10:22:02 -08:00
Scott Graham
ac6a7455fd win: use FileOffset, not off_t in string_file_writer_test
off_t exists on Windows, but Seek is implemented in terms of
SetFilePointerEx which expects a LONGLONG, so FileOffset is LONGLONG.

So, use FileOffset in the test code so that it wraps at the expected
value.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/854883002
2015-01-15 11:24:28 -08:00
Scott Graham
92d5c41964 win: implement ErrnoMessage
R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/816223007
2015-01-15 10:40:18 -08:00
Scott Graham
cb8c01f410 win: Some %zu to PRIuS
%zu aborts in system printf functions on Windows, so use PRIuS instead.

R=mark@chromium.org, rsesek@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/849193002
2015-01-15 10:00:43 -08:00
Scott Graham
7e7b65da1b win: Add implementation of ExecutablePath
R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/852773004
2015-01-15 10:00:09 -08:00
Scott Graham
c4a5f7de28 Roll mini_chromium to 3ce1cc29260d5b49ac21d96454a778c02f583172
Includes:

3ce1cc29260d5b49ac21d96454a778c02f583172 Pull in base/format_macros.h from Chromium, unmodified
028fa7ca08fe98ae215589a53dae03c498b45bff win: Add advapi32 to link, required for rand_util.cc "SystemFunction036"

R=mark@chromium.org
TBR=rsesek@chromium.org

Review URL: https://codereview.chromium.org/837703003
2015-01-15 09:59:09 -08:00
Scott Graham
7115130043 win: Add implementation of ScopedTempDir
Also fix implementation of CreateFile which aborted at runtime
when provided POSIX-style permissions.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/837123005
2015-01-13 13:51:32 -08:00
Robert Sesek
f0b9dcba25 Add a tri-state enum to return the result of Xattr operations.
R=mark@chromium.org
TEST=util_test --gtest_filter=Xattr\*

Review URL: https://codereview.chromium.org/842223003
2015-01-09 13:04:36 -05:00
Scott Graham
a277e14c9e Fix function name in error message of scoped_temp_dir_test
After https://codereview.chromium.org/826003003/.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/836833003
2015-01-08 11:08:32 -08:00
Scott Graham
f9c487b1e1 win: port multiprocess_exec_test_child.cc
R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/808493003
2015-01-08 11:08:11 -08:00
Scott Graham
c6bcbfb042 win: port semaphore test
R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/840933004
2015-01-08 09:32:12 -08:00
Scott Graham
b1d2beb724 win: Disable Clock tests that require SleepNanoseconds
As it was left unimplemented on Windows per previous discussion.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/838833004
2015-01-07 21:04:52 -08:00
Scott Graham
b0545c2627 win: porting for scoped_temp_dir_test
Uses the posix-y CRT functions rather than Win32 API for consistency/similarity
to the POSIX code path as it's localized test code anyway.

R=rsesek@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/826003003
2015-01-07 16:16:18 -08:00
Scott Graham
7b161de65c win: FILE_PATH_LITERAL in executable_path_test.cc
R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/838023002
2015-01-07 15:08:37 -08:00
Scott Graham
9b05b910d4 win: FILE_PATH_LITERALs in http_multipart_builder_test.cc
clang-format wanted to rewrap this way.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/814683003
2015-01-07 15:07:40 -08:00
Scott Graham
119c4fdd93 win: various porting for http_body_test.cc
- Wrap constants in FILE_PATH_LITERAL for L"".
- dynamic allocation, as VS otherwise complains about lack of constant
expression:

d:\src\crashpad\crashpad\util\net\http_body_test.cc(182) : error C2057: expected constant expression
d:\src\crashpad\crashpad\util\net\http_body_test.cc(182) : error C2466: cannot allocate an array of constant size 0
d:\src\crashpad\crashpad\util\net\http_body_test.cc(182) : error C2133: 'buf' : unknown size
d:\src\crashpad\crashpad\util\net\http_body_test.cc(183) : error C2070: 'uint8_t []': illegal sizeof operand
d:\src\crashpad\crashpad\util\net\http_body_test.cc(196) : error C2070: 'uint8_t []': illegal sizeof operand

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/837293002
2015-01-07 15:05:38 -08:00
Scott Graham
4ec5405135 win: avoid warning in StringFileWriter.SeekInvalid test
d:\src\crashpad\crashpad\util\file\string_file_writer_test.cc(367) : warning C4244: 'initializing' : conversion from 'const uint64_t' to 'const off_t', possible loss of data

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/836413004
2015-01-07 14:42:52 -08:00
Scott Graham
cd4a2f83e6 Roll mini_chromium to 836497baf21c5fbb7876573dc1dadef4c023a87d
Includes:
836497baf21c5fbb7876573dc1dadef4c023a87d win: Default to /SUBSYSTEM:CONSOLE

TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/844443003
2015-01-06 17:01:07 -08:00
Robert Sesek
c75dc46b17 Add UUID::InitializeFromString().
R=mark@chromium.org
TEST=util_test --gtest_filter=UUID.FromString

Review URL: https://codereview.chromium.org/820783004
2015-01-02 18:46:10 -05:00
Robert Sesek
1cdb7c1d04 Create ScopedTempDir, implement it on POSIX, and use it where appropriate.
R=mark@chromium.org
TEST=util_test --gtest_filter=ScopedTempDir.*

Review URL: https://codereview.chromium.org/834693002
2015-01-02 13:51:47 -05:00
Robert Sesek
8e98c9251a Add wrappers around getxattr() and setxattr().
R=mark@chromium.org
TEST=util_test --gtest_filter=Xattr.*

Review URL: https://codereview.chromium.org/791493009
2014-12-30 17:39:27 -05:00
Mark Mentovai
3ee6566051 generate_dump, exception_port_tool: set SecTaskAccess allowed.
This adds an Info.plist to these two tools that use task_for_pid().
Since they’re flat unbundled executables, the Info.plist must be placed
as a __TEXT,__info_plist section.

By setting SecTaskAccess to allowed and signing these tools with a
certificate trusted by the system, they will be allowed to use
task_for_pid() without requiring the invoking user to be root. This
provides an alternative to installing these tools as setuid root.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/822533002
2014-12-30 14:27:58 -05:00
Mark Mentovai
f4ec7ba590 Add the run_with_crashpad tool.
run_with_crashpad runs a program with a Crashpad exception handler. It
allows a Crashpad exception-handling server to be started and to direct
crashes to it from programs that are not themselves clients of the
Crashpad client library.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/810423004
2014-12-30 14:25:58 -05:00
Mark Mentovai
2602e9d5d0 Add CrashpadClient.
CrashpadClient is the primary interface for an application to have
Crashpad monitor it for crashes. It contains StartHandler(), which
starts a Crashpad handler process, and UseHandler(), which configures
the process to direct its crashes to a handler process.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/785233011
2014-12-30 14:24:52 -05:00
Mark Mentovai
588d7dba1c Add the crashpad_handler executable.
crashpad_handler is Crashpad’s exception handler server.

Currently, it runs a loop to receive exceptions, and exits when it no
longer has any clients. In the future, this will be extended to write
and potentially upload dumps.

The handler is expected to be started by its initial client via the
CrashpadClient interface.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/789693005
2014-12-30 14:23:47 -05:00
Mark Mentovai
b0e8f3e3e4 tools: Restore Resources, Copyright, and License to man pages.
This updates moved man pages to reference man_footer.ad by a proper
relative path following 39f69c862af6.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/820803003
2014-12-19 18:44:35 -05:00
Scott Graham
47c7c03f9e clang-format: don't bin pack arguments
Prefer

  function(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
           bbbbbbbbbbbbb,
           ccccccccccccccccccccccccccccccccccccccccccc);

over

  function(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbb,
           ccccccccccccccccccccccccccccccccccccccccccc);

R=mark@chromium.org

Review URL: https://codereview.chromium.org/805333006
2014-12-19 15:44:05 -08:00
Scott Graham
6865865773 Change 'bool world_readable' to an enum
More clear at callsites, and relatively important not to accidentally choose the wrong one.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/821483002
2014-12-19 15:35:30 -08:00
Scott Graham
9cfd2c515e Make http_body cross-platform
'util' builds on Windows after this.

R=mark@chromium.org, rsesek@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/791493007
2014-12-19 15:21:19 -08:00
Scott Graham
4e8a78c182 Roll mini_chromium to 4d84318dbcdf46b543ab4556736cf8a9ae3ced18
Includes:
4d84318dbcdf46b543ab4556736cf8a9ae3ced18 win: Disable C4201, nameless struct/union warning
864f44f98bb8e6869b1243de9b2ebd3f50a03a21 Exclude _test suffixed files too

TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/817093002
2014-12-19 15:02:54 -08:00
Scott Graham
8d7681752d win: Avoid signed/unsigned warning
d:\src\crashpad\crashpad\snapshot\cpu_context.cc(96) : warning C4245: 'return' : conversion from 'int' to 'uint64_t', signed/unsigned mismatch

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/819703002
2014-12-19 14:53:23 -08:00
Mark Mentovai
110eafe9a1 CloseMultipleNowOrOnExec(): promote out of test.
This function will be useful in upcoming non-test code. Because the
first Crashpad client that wants a Crashpad handler will now be
responsible for starting the handler process, this will prevent file
descriptors from leaking to the handler process.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/819483002
2014-12-19 16:42:34 -05:00
Scott Graham
5f5e342584 Switch [String]FileWriter to use new file_io.h functions/types
Also add ScopedFileHandle as cross-platform version of ScopedFD/ScopedFileHANDLE.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/815053004
2014-12-19 13:33:01 -08:00
Mark Mentovai
25c3afaac5 Add CloseStdinAndStdout().
There will be no reason to leave the handler process connected to its
invoker’s stdin or stdout.

On the other hand, I’m currently leaving it connected to the original
and stderr, as these may be useful for diagnostics.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/818573002
2014-12-19 14:20:20 -05:00
Scott Graham
384497475a Add LoggingSeekFile
As the whence values are "helpfully" available in windows.h as well
( http://msdn.microsoft.com/en-us/library/windows/desktop/dd757336(v=vs.85).aspx )
don't bother inventing a new enum. Add implementations for POSIX and Win32.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/812593005
2014-12-19 10:45:22 -08:00
Scott Graham
4034d30023 Add LoggingOpenFileFor{Read|Write}
I started (https://codereview.chromium.org/812403002/) emulating oflag values
on Windows in FileWriter, but it seemed awkward. On the assumption that we're
only likely to need "read a file" and "write a file" this seemed simpler, and
sufficient (but I don't know if that's necessarily true).

Users of open are not yet switched.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/818433002
2014-12-18 16:29:33 -08:00
Scott Graham
4a9b858fbd win: Add Scoped...Handle
Intended for future use to implement util/file/file_writer.

There's a similar class in base:
https://code.google.com/p/chromium/codesearch#chromium/src/base/win/scoped_handle.h&l=28

However (perhaps for historical reasons) it does not distinguish between
the possible types of HANDLEs which have different invalid values,
resulting in a need to copy a bunch of code rather than simply using
ScopedGeneric.

Instead, distinguish between the types so the caller can use the
correct one.

Refs:
http://blogs.msdn.com/b/oldnewthing/archive/2004/03/02/82639.aspx
http://msdn.microsoft.com/en-us/magazine/cc302328.aspx (Figure 2)

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/813873004
2014-12-18 09:51:20 -08:00
Scott Graham
26c6f19927 Roll mini_chromium to 43b7cd397e5f239e59700831430b703d9a4a3b4f
Includes:
43b7cd397e5f239e59700831430b703d9a4a3b4f win: Fix for logging.h ERROR, again
a83f160101c6b054bdcfe81dea62340c7d933778 win: implement sys_byteorder.h

TBR=mark@chromium.org

Review URL: https://codereview.chromium.org/817443002
2014-12-18 09:29:46 -08:00
Scott Graham
d1fdcf99e0 win: implement Semaphore
Ref:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686946%28v=vs.85%29.aspx

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/797173003
2014-12-18 09:08:57 -08:00
Scott Graham
ec38bf152d win: Add static_cast to AssignIfInRange
Otherwise, when assigning to a smaller type, MSVC warns e.g.

d:\src\crashpad\crashpad\util\numeric\safe_assignment.h(38) : error C2220: warning treated as error - no 'object' file generated
        d:\src\crashpad\crashpad\util\file\string_file_writer.cc(127) : see reference to function template instantiation 'bool crashpad::AssignIfInRange<size_t,FileOffset>(Destination *,Source)' being compiled
        with
        [
            Destination=size_t
,            Source=FileOffset
        ]
d:\src\crashpad\crashpad\util\numeric\safe_assignment.h(38) : warning C4244: '=' : conversion from 'FileOffset' to 'size_t', possible loss of data

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/809303003
2014-12-18 08:42:26 -08:00
Scott Graham
10165ce449 Cross platform low level file IO wrappers
Rename fd_io to file_io, and ReadFD to ReadFile, etc.

file_io.cc is the higher level versions that call the basic ReadFile/WriteFile
and then file_io_posix.cc and file_io_win.cc are the implementations of
those functions.

The Windows path is as yet untested, lacking the ability to link the test binary.

R=cpu@chromium.org, mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/811823003
2014-12-17 14:35:18 -08:00
Mark Mentovai
3d84a738d0 Update GYP to svn r2015 (32ca1cd8e010).
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/813873002
2014-12-17 16:03:58 -05:00
Mark Mentovai
9d2c1cffa2 Update mini_chromium to 222feaf3d302.
This picks up:

222feaf3d302 Update README
e38cddb83571 Lock: don’t require NativeThreadType to be a pointer type
8c599712d10c Include What You Use: <string.h> for memmove() and memcpy()
ef991f44ed63 Linux: always build in C++11 mode

BUG=crashpad:6
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/812133002
2014-12-17 16:01:35 -05:00
Mark Mentovai
39f69c862a tools: Move Mac-specific tools to tools/mac.
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/804913003
2014-12-17 15:26:23 -05:00
Mark Mentovai
a02f721637 Add NewMachPort() and its test, and switch call sites to use it.
There were many call sites that wasted a few lines on
mach_port_allocate() and sticking the result into a scoper. I was about
to add three more, so I took the opportunity to simplify things.

TEST=util_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/809103002
2014-12-17 15:10:38 -05:00
Mark Mentovai
439532bd0b MachMessageServer::Run(): correct documentation.
The comment referred to the old form of the |persistent| argument, which
was a bool.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/806953004
2014-12-17 15:09:22 -05:00
Scott Graham
3eeae10ebe win: avoid warning on return of base::RandGenerator
Else,

d:\src\crashpad\crashpad\util\net\http_multipart_builder.cc(50) : warning C4244: 'initializing' : conversion from 'uint64_t' to 'int', possible loss of data

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/796643006
2014-12-17 10:50:05 -08:00