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

Side by Side Diff: tools/generate_dump.cc

Issue 1303173011: win: Implement and use ScopedProcessSuspend (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: dword -1 Created 5 years, 3 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
« no previous file with comments | « handler/win/crash_report_exception_handler.cc ('k') | util/util.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 #include <mach/mach.h> 34 #include <mach/mach.h>
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 #endif // OS_MACOSX 45 #endif // OS_MACOSX
45 46
46 namespace crashpad { 47 namespace crashpad {
47 namespace { 48 namespace {
48 49
49 struct Options { 50 struct Options {
50 std::string dump_path; 51 std::string dump_path;
51 pid_t pid; 52 pid_t pid;
52 bool suspend; 53 bool suspend;
53 }; 54 };
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 options.dump_path = base::StringPrintf("minidump.%d", options.pid); 162 options.dump_path = base::StringPrintf("minidump.%d", options.pid);
162 } 163 }
163 164
164 { 165 {
165 #if defined(OS_MACOSX) 166 #if defined(OS_MACOSX)
166 scoped_ptr<ScopedTaskSuspend> suspend; 167 scoped_ptr<ScopedTaskSuspend> suspend;
167 if (options.suspend) { 168 if (options.suspend) {
168 suspend.reset(new ScopedTaskSuspend(task)); 169 suspend.reset(new ScopedTaskSuspend(task));
169 } 170 }
170 #elif defined(OS_WIN) 171 #elif defined(OS_WIN)
172 scoped_ptr<ScopedProcessSuspend> suspend;
171 if (options.suspend) { 173 if (options.suspend) {
172 LOG(ERROR) << "TODO(scottmg): --no-suspend is required for now."; 174 suspend.reset(new ScopedProcessSuspend(process.get()));
173 return EXIT_FAILURE;
174 } 175 }
175 #endif // OS_MACOSX 176 #endif // OS_MACOSX
176 177
177 #if defined(OS_MACOSX) 178 #if defined(OS_MACOSX)
178 ProcessSnapshotMac process_snapshot; 179 ProcessSnapshotMac process_snapshot;
179 if (!process_snapshot.Initialize(task)) { 180 if (!process_snapshot.Initialize(task)) {
180 return EXIT_FAILURE; 181 return EXIT_FAILURE;
181 } 182 }
182 #elif defined(OS_WIN) 183 #elif defined(OS_WIN)
183 ProcessSnapshotWin process_snapshot; 184 ProcessSnapshotWin process_snapshot;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 216
216 #if defined(OS_POSIX) 217 #if defined(OS_POSIX)
217 int main(int argc, char* argv[]) { 218 int main(int argc, char* argv[]) {
218 return crashpad::GenerateDumpMain(argc, argv); 219 return crashpad::GenerateDumpMain(argc, argv);
219 } 220 }
220 #elif defined(OS_WIN) 221 #elif defined(OS_WIN)
221 int wmain(int argc, wchar_t* argv[]) { 222 int wmain(int argc, wchar_t* argv[]) {
222 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain); 223 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain);
223 } 224 }
224 #endif // OS_POSIX 225 #endif // OS_POSIX
OLDNEW
« no previous file with comments | « handler/win/crash_report_exception_handler.cc ('k') | util/util.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698