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 <stdint.h> |
15 #include <stdlib.h> | 16 #include <stdlib.h> |
| 17 #include <windows.h> |
| 18 |
| 19 #include "base/logging.h" |
| 20 #include "client/crashpad_client.h" |
| 21 #include "util/file/file_io.h" |
| 22 |
| 23 __declspec(noinline) uint64_t CurrentAddress() { |
| 24 return reinterpret_cast<uint64_t>(_ReturnAddress()); |
| 25 } |
16 | 26 |
17 int main(int argc, char* argv[]) { | 27 int main(int argc, char* argv[]) { |
18 return EXIT_SUCCESS; | 28 CHECK_EQ(argc, 2); |
| 29 |
| 30 crashpad::CrashpadClient client; |
| 31 CHECK(client.SetHandler(argv[1])); |
| 32 CHECK(client.UseHandler()); |
| 33 |
| 34 HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); |
| 35 CHECK_NE(out, INVALID_HANDLE_VALUE); |
| 36 uint64_t break_address = CurrentAddress(); |
| 37 crashpad::CheckedWriteFile(out, &break_address, sizeof(break_address)); |
| 38 |
| 39 __debugbreak(); |
| 40 |
| 41 return 0; |
19 } | 42 } |
OLD | NEW |