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

Side by Side Diff: third_party/crashpad/crashpad/tools/generate_dump.cc

Issue 2754553002: Update Crashpad to 18d70acf81df49cc10b00bcc67c1ec64e16bd9d0 (Closed)
Patch Set: Created 3 years, 9 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 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,
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 <fcntl.h>
16 #include <getopt.h> 15 #include <getopt.h>
17 #include <stdio.h> 16 #include <stdio.h>
18 #include <stdlib.h> 17 #include <stdlib.h>
19 #include <sys/types.h> 18 #include <sys/types.h>
20 19
21 #include <memory> 20 #include <memory>
22 #include <string> 21 #include <string>
23 22
24 #include "base/logging.h" 23 #include "base/logging.h"
25 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
(...skipping 15 matching lines...) Expand all
41 #elif defined(OS_WIN) 40 #elif defined(OS_WIN)
42 #include "base/strings/utf_string_conversions.h" 41 #include "base/strings/utf_string_conversions.h"
43 #include "snapshot/win/process_snapshot_win.h" 42 #include "snapshot/win/process_snapshot_win.h"
44 #include "util/win/scoped_process_suspend.h" 43 #include "util/win/scoped_process_suspend.h"
45 #include "util/win/xp_compat.h" 44 #include "util/win/xp_compat.h"
46 #endif // OS_MACOSX 45 #endif // OS_MACOSX
47 46
48 namespace crashpad { 47 namespace crashpad {
49 namespace { 48 namespace {
50 49
51 struct Options {
52 std::string dump_path;
53 pid_t pid;
54 bool suspend;
55 };
56
57 void Usage(const base::FilePath& me) { 50 void Usage(const base::FilePath& me) {
58 fprintf(stderr, 51 fprintf(stderr,
59 "Usage: %" PRFilePath " [OPTION]... PID\n" 52 "Usage: %" PRFilePath " [OPTION]... PID\n"
60 "Generate a minidump file containing a snapshot of a running process.\n" 53 "Generate a minidump file containing a snapshot of a running process.\n"
61 "\n" 54 "\n"
62 " -r, --no-suspend don't suspend the target process during dump generation\n" 55 " -r, --no-suspend don't suspend the target process during dump generation\n"
63 " -o, --output=FILE write the minidump to FILE instead of minidump.PID\n" 56 " -o, --output=FILE write the minidump to FILE instead of minidump.PID\n"
64 " --help display this help and exit\n" 57 " --help display this help and exit\n"
65 " --version output version information and exit\n", 58 " --version output version information and exit\n",
66 me.value().c_str()); 59 me.value().c_str());
(...skipping 11 matching lines...) Expand all
78 kOptionNoSuspend = 'r', 71 kOptionNoSuspend = 'r',
79 72
80 // Long options without short equivalents. 73 // Long options without short equivalents.
81 kOptionLastChar = 255, 74 kOptionLastChar = 255,
82 75
83 // Standard options. 76 // Standard options.
84 kOptionHelp = -2, 77 kOptionHelp = -2,
85 kOptionVersion = -3, 78 kOptionVersion = -3,
86 }; 79 };
87 80
88 Options options = {}; 81 struct {
82 std::string dump_path;
83 pid_t pid;
84 bool suspend;
85 } options = {};
89 options.suspend = true; 86 options.suspend = true;
90 87
91 const option long_options[] = { 88 const option long_options[] = {
92 {"no-suspend", no_argument, nullptr, kOptionNoSuspend}, 89 {"no-suspend", no_argument, nullptr, kOptionNoSuspend},
93 {"output", required_argument, nullptr, kOptionOutput}, 90 {"output", required_argument, nullptr, kOptionOutput},
94 {"help", no_argument, nullptr, kOptionHelp}, 91 {"help", no_argument, nullptr, kOptionHelp},
95 {"version", no_argument, nullptr, kOptionVersion}, 92 {"version", no_argument, nullptr, kOptionVersion},
96 {nullptr, 0, nullptr, 0}, 93 {nullptr, 0, nullptr, 0},
97 }; 94 };
98 95
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 219
223 #if defined(OS_POSIX) 220 #if defined(OS_POSIX)
224 int main(int argc, char* argv[]) { 221 int main(int argc, char* argv[]) {
225 return crashpad::GenerateDumpMain(argc, argv); 222 return crashpad::GenerateDumpMain(argc, argv);
226 } 223 }
227 #elif defined(OS_WIN) 224 #elif defined(OS_WIN)
228 int wmain(int argc, wchar_t* argv[]) { 225 int wmain(int argc, wchar_t* argv[]) {
229 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain); 226 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain);
230 } 227 }
231 #endif // OS_POSIX 228 #endif // OS_POSIX
OLDNEW
« no previous file with comments | « third_party/crashpad/crashpad/tools/crashpad_http_upload.md ('k') | third_party/crashpad/crashpad/tools/tool_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698