OLD | NEW |
---|---|
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 "client/crashpad_client.h" | 15 #include <windows.h> |
16 | 16 |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "client/crashpad_client.h" | |
18 #include "tools/tool_support.h" | 19 #include "tools/tool_support.h" |
19 | 20 |
20 namespace crashpad { | 21 namespace crashpad { |
21 namespace { | 22 namespace { |
22 | 23 |
23 void SomeCrashyFunction() { | 24 void SomeCrashyFunction() { |
24 volatile int* foo = reinterpret_cast<volatile int*>(7); | 25 volatile int* foo = reinterpret_cast<volatile int*>(7); |
Mark Mentovai
2015/09/29 22:14:04
Move after CreateFile().
scottmg
2015/09/30 18:54:11
Done.
| |
26 // Cause a GetLastError setting too before we crash. | |
27 CreateFile(L"non-existent file", | |
Mark Mentovai
2015/09/29 22:14:04
Since we don’t control the current directory or it
scottmg
2015/09/30 18:54:11
SetLastError() seems much better. Done.
| |
28 GENERIC_READ, | |
29 0, | |
30 nullptr, | |
31 OPEN_EXISTING, | |
32 0, | |
33 nullptr); | |
25 *foo = 42; | 34 *foo = 42; |
26 } | 35 } |
27 | 36 |
28 int CrashyMain(int argc, char* argv[]) { | 37 int CrashyMain(int argc, char* argv[]) { |
29 if (argc != 2) { | 38 if (argc != 2) { |
30 fprintf(stderr, "Usage: %s <server_pipe_name>\n", argv[0]); | 39 fprintf(stderr, "Usage: %s <server_pipe_name>\n", argv[0]); |
31 return 1; | 40 return 1; |
32 } | 41 } |
33 | 42 |
34 CrashpadClient client; | 43 CrashpadClient client; |
(...skipping 10 matching lines...) Expand all Loading... | |
45 | 54 |
46 return 0; | 55 return 0; |
47 } | 56 } |
48 | 57 |
49 } // namespace | 58 } // namespace |
50 } // namespace crashpad | 59 } // namespace crashpad |
51 | 60 |
52 int wmain(int argc, wchar_t* argv[]) { | 61 int wmain(int argc, wchar_t* argv[]) { |
53 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::CrashyMain); | 62 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::CrashyMain); |
54 } | 63 } |
OLD | NEW |