Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 | |
| 15 #include <windows.h> | |
| 16 | |
| 17 #include "base/logging.h" | |
| 18 #include "client/crashpad_client.h" | |
| 19 #include "tools/tool_support.h" | |
| 20 | |
| 21 #if !ARCH_CPU_32_BITS | |
|
Mark Mentovai
2015/10/30 19:42:44
Should be !defined(ARCH_CPU_32_BITS). Found the sa
scottmg
2015/10/30 23:52:07
Done.
| |
| 22 #error This test is only supported on x86. | |
| 23 #endif // !ARCH_CPU_32_BITS | |
| 24 | |
| 25 namespace crashpad { | |
| 26 namespace { | |
| 27 | |
| 28 int CrashyLoadZ7Main(int argc, char* argv[]) { | |
| 29 if (argc != 2) { | |
| 30 fprintf(stderr, "Usage: %s <server_pipe_name>\n", argv[0]); | |
| 31 return 1; | |
|
Mark Mentovai
2015/10/30 19:42:44
<stdlib.h> EXIT_FAILURE, EXIT_SUCCESS
scottmg
2015/10/30 23:52:07
Done.
| |
| 32 } | |
| 33 | |
| 34 CrashpadClient client; | |
| 35 if (!client.SetHandler(argv[1])) { | |
| 36 LOG(ERROR) << "SetHandler"; | |
| 37 return 1; | |
| 38 } | |
| 39 if (!client.UseHandler()) { | |
| 40 LOG(ERROR) << "UseHandler"; | |
| 41 return 1; | |
| 42 } | |
| 43 | |
| 44 // The DLL has /Z7 symbols embedded in the binary (rather than in a .pdb). | |
| 45 // There's only an x86 version of this dll as newer x64 toolchains can't | |
| 46 // generate this format any more. | |
| 47 HMODULE z7_test = LoadLibrary(L"../../handler/win/z7_test.dll"); | |
|
Mark Mentovai
2015/10/30 19:42:44
If either of these fail, LOG(ERROR) and return EXI
Mark Mentovai
2015/10/30 19:42:44
This will be treated as a path relative to cwd, wh
scottmg
2015/10/30 23:52:07
Done.
scottmg
2015/10/30 23:52:07
Windows is very promiscuous and eventually tries r
Mark Mentovai
2015/10/31 01:29:33
scottmg wrote:
| |
| 48 FARPROC crash_me = GetProcAddress(z7_test, "?CrashMe@@YAXXZ"); | |
| 49 reinterpret_cast<void(*)()>(crash_me)(); | |
| 50 | |
| 51 return 0; | |
| 52 } | |
| 53 | |
| 54 } // namespace | |
| 55 } // namespace crashpad | |
| 56 | |
| 57 int wmain(int argc, wchar_t* argv[]) { | |
| 58 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::CrashyLoadZ7Main); | |
| 59 } | |
| 60 | |
|
Mark Mentovai
2015/10/30 19:42:44
Remove the blank line at EOF.
scottmg
2015/10/30 23:52:07
Done.
| |
| OLD | NEW |