OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 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, |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include <unistd.h> | 35 #include <unistd.h> |
36 | 36 |
37 #include "base/mac/scoped_mach_port.h" | 37 #include "base/mac/scoped_mach_port.h" |
38 #include "snapshot/mac/process_snapshot_mac.h" | 38 #include "snapshot/mac/process_snapshot_mac.h" |
39 #include "util/mach/scoped_task_suspend.h" | 39 #include "util/mach/scoped_task_suspend.h" |
40 #include "util/mach/task_for_pid.h" | 40 #include "util/mach/task_for_pid.h" |
41 #elif defined(OS_WIN) | 41 #elif defined(OS_WIN) |
42 #include "base/strings/utf_string_conversions.h" | 42 #include "base/strings/utf_string_conversions.h" |
43 #include "snapshot/win/process_snapshot_win.h" | 43 #include "snapshot/win/process_snapshot_win.h" |
44 #include "util/win/scoped_process_suspend.h" | 44 #include "util/win/scoped_process_suspend.h" |
| 45 #include "util/win/xp_compat.h" |
45 #endif // OS_MACOSX | 46 #endif // OS_MACOSX |
46 | 47 |
47 namespace crashpad { | 48 namespace crashpad { |
48 namespace { | 49 namespace { |
49 | 50 |
50 struct Options { | 51 struct Options { |
51 std::string dump_path; | 52 std::string dump_path; |
52 pid_t pid; | 53 pid_t pid; |
53 bool suspend; | 54 bool suspend; |
54 }; | 55 }; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 145 |
145 if (options.pid == getpid()) { | 146 if (options.pid == getpid()) { |
146 if (options.suspend) { | 147 if (options.suspend) { |
147 LOG(ERROR) << "cannot suspend myself"; | 148 LOG(ERROR) << "cannot suspend myself"; |
148 return EXIT_FAILURE; | 149 return EXIT_FAILURE; |
149 } | 150 } |
150 LOG(WARNING) << "operating on myself"; | 151 LOG(WARNING) << "operating on myself"; |
151 } | 152 } |
152 #elif defined(OS_WIN) | 153 #elif defined(OS_WIN) |
153 ScopedKernelHANDLE process( | 154 ScopedKernelHANDLE process( |
154 OpenProcess(PROCESS_ALL_ACCESS, false, options.pid)); | 155 OpenProcess(kXPProcessAllAccess, false, options.pid)); |
155 if (!process.is_valid()) { | 156 if (!process.is_valid()) { |
156 LOG(ERROR) << "could not open process " << options.pid; | 157 LOG(ERROR) << "could not open process " << options.pid; |
157 return EXIT_FAILURE; | 158 return EXIT_FAILURE; |
158 } | 159 } |
159 #endif // OS_MACOSX | 160 #endif // OS_MACOSX |
160 | 161 |
161 if (options.dump_path.empty()) { | 162 if (options.dump_path.empty()) { |
162 options.dump_path = base::StringPrintf("minidump.%d", options.pid); | 163 options.dump_path = base::StringPrintf("minidump.%d", options.pid); |
163 } | 164 } |
164 | 165 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 220 |
220 #if defined(OS_POSIX) | 221 #if defined(OS_POSIX) |
221 int main(int argc, char* argv[]) { | 222 int main(int argc, char* argv[]) { |
222 return crashpad::GenerateDumpMain(argc, argv); | 223 return crashpad::GenerateDumpMain(argc, argv); |
223 } | 224 } |
224 #elif defined(OS_WIN) | 225 #elif defined(OS_WIN) |
225 int wmain(int argc, wchar_t* argv[]) { | 226 int wmain(int argc, wchar_t* argv[]) { |
226 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain); | 227 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain); |
227 } | 228 } |
228 #endif // OS_POSIX | 229 #endif // OS_POSIX |
OLD | NEW |