Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/crashpad/crashpad/handler/win/crashy_test_z7_loader.cc

Issue 2804713002: Update Crashpad to b4095401639ebe2ad33169e5c1d994065cbff1b8 (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include <stdlib.h> 15 #include <stdlib.h>
16 #include <windows.h> 16 #include <windows.h>
17 17
18 #include "base/files/file_path.h" 18 #include "base/files/file_path.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "client/crashpad_client.h" 21 #include "client/crashpad_client.h"
22 #include "test/paths.h" 22 #include "test/test_paths.h"
23 23
24 #if !defined(ARCH_CPU_X86) 24 #if !defined(ARCH_CPU_X86)
25 #error This test is only supported on x86. 25 #error This test is only supported on x86.
26 #endif // !ARCH_CPU_X86 26 #endif // !ARCH_CPU_X86
27 27
28 namespace crashpad { 28 namespace crashpad {
29 namespace { 29 namespace {
30 30
31 int CrashyLoadZ7Main(int argc, wchar_t* argv[]) { 31 int CrashyLoadZ7Main(int argc, wchar_t* argv[]) {
32 if (argc != 2) { 32 if (argc != 2) {
33 fprintf(stderr, "Usage: %ls <server_pipe_name>\n", argv[0]); 33 fprintf(stderr, "Usage: %ls <server_pipe_name>\n", argv[0]);
34 return EXIT_FAILURE; 34 return EXIT_FAILURE;
35 } 35 }
36 36
37 CrashpadClient client; 37 CrashpadClient client;
38 if (!client.SetHandlerIPCPipe(argv[1])) { 38 if (!client.SetHandlerIPCPipe(argv[1])) {
39 LOG(ERROR) << "SetHandler"; 39 LOG(ERROR) << "SetHandler";
40 return EXIT_FAILURE; 40 return EXIT_FAILURE;
41 } 41 }
42 42
43 // The DLL has /Z7 symbols embedded in the binary (rather than in a .pdb). 43 // The DLL has /Z7 symbols embedded in the binary (rather than in a .pdb).
44 // There's only an x86 version of this dll as newer x64 toolchains can't 44 // There's only an x86 version of this dll as newer x64 toolchains can't
45 // generate this format any more. 45 // generate this format any more.
46 base::FilePath z7_path = test::Paths::TestDataRoot().Append( 46 base::FilePath z7_path = test::TestPaths::TestDataRoot().Append(
47 FILE_PATH_LITERAL("handler/win/z7_test.dll")); 47 FILE_PATH_LITERAL("handler/win/z7_test.dll"));
48 HMODULE z7_test = LoadLibrary(z7_path.value().c_str()); 48 HMODULE z7_test = LoadLibrary(z7_path.value().c_str());
49 if (!z7_test) { 49 if (!z7_test) {
50 PLOG(ERROR) << "LoadLibrary"; 50 PLOG(ERROR) << "LoadLibrary";
51 return EXIT_FAILURE; 51 return EXIT_FAILURE;
52 } 52 }
53 FARPROC crash_me = GetProcAddress(z7_test, "CrashMe"); 53 FARPROC crash_me = GetProcAddress(z7_test, "CrashMe");
54 if (!crash_me) { 54 if (!crash_me) {
55 PLOG(ERROR) << "GetProcAddress"; 55 PLOG(ERROR) << "GetProcAddress";
56 return EXIT_FAILURE; 56 return EXIT_FAILURE;
57 } 57 }
58 reinterpret_cast<void(*)()>(crash_me)(); 58 reinterpret_cast<void(*)()>(crash_me)();
59 59
60 return EXIT_SUCCESS; 60 return EXIT_SUCCESS;
61 } 61 }
62 62
63 } // namespace 63 } // namespace
64 } // namespace crashpad 64 } // namespace crashpad
65 65
66 int wmain(int argc, wchar_t* argv[]) { 66 int wmain(int argc, wchar_t* argv[]) {
67 return crashpad::CrashyLoadZ7Main(argc, argv); 67 return crashpad::CrashyLoadZ7Main(argc, argv);
68 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698