mirror of
https://github.com/yuzu-emu/breakpad
synced 2024-11-25 17:35:27 +00:00
Add a flag to google_converter to keep Breakpad/PE/PDB files after conversion.
Change-Id: I8948e1aba598d42369d70ca1cc1168ce3841ab40 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4038509 Reviewed-by: Zequan Wu <zequanwu@google.com> Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
c7acbcef04
commit
4d0c21b9a5
1 changed files with 30 additions and 17 deletions
|
@ -304,7 +304,8 @@ static bool SafeToMakeExternalRequest(const MissingSymbolInfo& missing_info,
|
|||
|
||||
// Converter options derived from command line parameters.
|
||||
struct ConverterOptions {
|
||||
ConverterOptions() : report_fetch_failures(true), trace_symsrv(false) {}
|
||||
ConverterOptions()
|
||||
: report_fetch_failures(true), trace_symsrv(false), keep_files(false) {}
|
||||
|
||||
~ConverterOptions() {
|
||||
}
|
||||
|
@ -354,6 +355,9 @@ struct ConverterOptions {
|
|||
// If set then SymSrv callbacks are logged to stderr.
|
||||
bool trace_symsrv;
|
||||
|
||||
// If set then Breakpad/PE/PDB files won't be deleted after processing.
|
||||
bool keep_files;
|
||||
|
||||
private:
|
||||
// DISABLE_COPY_AND_ASSIGN
|
||||
ConverterOptions(const ConverterOptions&);
|
||||
|
@ -435,6 +439,7 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
|||
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||
missing_info.debug_file, missing_info.debug_identifier,
|
||||
converted_file, kSymbolUploadTypeBreakpad);
|
||||
if (!options.keep_files)
|
||||
remove(converted_file.c_str());
|
||||
|
||||
// Upload PDB/PE if we have them
|
||||
|
@ -443,6 +448,7 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
|||
missing_info.debug_file,
|
||||
missing_info.debug_identifier, symbol_file,
|
||||
kSymbolUploadTypePDB);
|
||||
if (!options.keep_files)
|
||||
remove(symbol_file.c_str());
|
||||
}
|
||||
if (!pe_file.empty()) {
|
||||
|
@ -450,6 +456,7 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
|||
missing_info.code_file,
|
||||
missing_info.debug_identifier, pe_file,
|
||||
kSymbolUploadTypePE);
|
||||
if (!options.keep_files)
|
||||
remove(pe_file.c_str());
|
||||
}
|
||||
|
||||
|
@ -541,6 +548,7 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
|||
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||
missing_info.debug_file, missing_info.debug_identifier,
|
||||
converted_file, kSymbolUploadTypeBreakpad);
|
||||
if (!options.keep_files)
|
||||
remove(converted_file.c_str());
|
||||
|
||||
// Upload PDB/PE if we have them
|
||||
|
@ -548,12 +556,14 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
|||
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||
missing_info.debug_file, missing_info.debug_identifier,
|
||||
symbol_file, kSymbolUploadTypePDB);
|
||||
if (!options.keep_files)
|
||||
remove(symbol_file.c_str());
|
||||
}
|
||||
if (!pe_file.empty()) {
|
||||
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||
missing_info.code_file, missing_info.debug_identifier,
|
||||
pe_file, kSymbolUploadTypePE);
|
||||
if (!options.keep_files)
|
||||
remove(pe_file.c_str());
|
||||
}
|
||||
|
||||
|
@ -732,6 +742,8 @@ static int usage(const char* program_name) {
|
|||
" prevent external symbol requests\n"
|
||||
" -tss If set then SymSrv callbacks will be\n"
|
||||
" traced to stderr.\n"
|
||||
" -keep-files If set then don't delete Breakpad/PE/\n"
|
||||
" PDB files after conversion.\n"
|
||||
" Note that any server specified by -f or -n that starts with \\filer\n"
|
||||
" will be treated as internal, and all others as external.\n",
|
||||
program_name);
|
||||
|
@ -769,17 +781,21 @@ int main(int argc, char** argv) {
|
|||
ConverterOptions options;
|
||||
options.report_fetch_failures = true;
|
||||
|
||||
// All arguments are paired.
|
||||
if (argc % 2 != 1) {
|
||||
return usage(argv[0]);
|
||||
}
|
||||
|
||||
string blacklist_regex_str;
|
||||
bool have_any_msss_servers = false;
|
||||
for (int argi = 1; argi < argc; argi += 2) {
|
||||
for (int argi = 1; argi < argc; argi++) {
|
||||
string option = argv[argi];
|
||||
string value = argv[argi + 1];
|
||||
if (option == "-tss") {
|
||||
printf("Tracing SymSrv callbacks to stderr.\n");
|
||||
options.trace_symsrv = true;
|
||||
continue;
|
||||
} else if (option == "-keep-files") {
|
||||
printf("Keeping Breakpad/PE/PDB files after conversion.\n");
|
||||
options.keep_files = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
string value = argv[++argi];
|
||||
if (option == "-f") {
|
||||
AddServer(value,& options.full_internal_msss_servers,
|
||||
& options.full_external_msss_servers);
|
||||
|
@ -818,9 +834,6 @@ int main(int argc, char** argv) {
|
|||
printf("Getting the list of missing symbols from a file. Fetch failures"
|
||||
" will not be reported.\n");
|
||||
options.report_fetch_failures = false;
|
||||
} else if (option == "-tss") {
|
||||
printf("Tracing SymSrv callbacks to stderr.\n");
|
||||
options.trace_symsrv = true;
|
||||
} else if (option == "-t") {
|
||||
if (!WindowsStringUtils::safe_mbstowcs(
|
||||
value,
|
||||
|
|
Loading…
Reference in a new issue