mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-23 00:45:35 +00:00
Upload native symbols from google_converter.
Change-Id: I4b636ccb1dc536ad63b0995994057fe1874f4ee6 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3681980 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
parent
678d69cd78
commit
41a11409d6
|
@ -67,6 +67,8 @@ const char* kMissingStringDelimiters = "|";
|
||||||
const char* kLocalCachePath = "c:\\symbols";
|
const char* kLocalCachePath = "c:\\symbols";
|
||||||
const char* kNoExeMSSSServer = "http://msdl.microsoft.com/download/symbols/";
|
const char* kNoExeMSSSServer = "http://msdl.microsoft.com/download/symbols/";
|
||||||
const wchar_t* kSymbolUploadTypeBreakpad = L"BREAKPAD";
|
const wchar_t* kSymbolUploadTypeBreakpad = L"BREAKPAD";
|
||||||
|
const wchar_t* kSymbolUploadTypePE = L"PE";
|
||||||
|
const wchar_t* kSymbolUploadTypePDB = L"PDB";
|
||||||
|
|
||||||
// Windows stdio doesn't do line buffering. Use this function to flush after
|
// Windows stdio doesn't do line buffering. Use this function to flush after
|
||||||
// writing to stdout and stderr so that a log will be available if the
|
// writing to stdout and stderr so that a log will be available if the
|
||||||
|
@ -206,47 +208,46 @@ static bool MissingSymbolInfoToParameters(const MissingSymbolInfo& missing_info,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// UploadSymbolFile sends |converted_file| as identified by |missing_info|
|
// UploadSymbolFile sends |converted_file| as identified by |debug_file| and
|
||||||
// to the symbol server rooted at |upload_symbol_url|. Returns true on
|
// |debug_identifier|, to the symbol server rooted at |upload_symbol_url|.
|
||||||
// success and false on failure, printing an error message.
|
// Returns true on success and false on failure, printing an error message.
|
||||||
static bool UploadSymbolFile(const wstring& upload_symbol_url,
|
static bool UploadSymbolFile(const wstring& upload_symbol_url,
|
||||||
const wstring& api_key,
|
const wstring& api_key,
|
||||||
const MissingSymbolInfo& missing_info,
|
const string& debug_file,
|
||||||
const string& converted_file) {
|
const string& debug_identifier,
|
||||||
|
const string& symbol_file,
|
||||||
|
const wstring& symbol_type) {
|
||||||
wstring debug_file_w;
|
wstring debug_file_w;
|
||||||
if (!WindowsStringUtils::safe_mbstowcs(missing_info.debug_file,
|
if (!WindowsStringUtils::safe_mbstowcs(debug_file, &debug_file_w)) {
|
||||||
&debug_file_w)) {
|
|
||||||
FprintfFlush(stderr, "UploadSymbolFile: safe_mbstowcs failed for %s\n",
|
FprintfFlush(stderr, "UploadSymbolFile: safe_mbstowcs failed for %s\n",
|
||||||
converted_file.c_str());
|
symbol_file.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring debug_id_w;
|
wstring debug_id_w;
|
||||||
if (!WindowsStringUtils::safe_mbstowcs(missing_info.debug_identifier,
|
if (!WindowsStringUtils::safe_mbstowcs(debug_identifier, &debug_id_w)) {
|
||||||
&debug_id_w)) {
|
|
||||||
FprintfFlush(stderr, "UploadSymbolFile: safe_mbstowcs failed for %s\n",
|
FprintfFlush(stderr, "UploadSymbolFile: safe_mbstowcs failed for %s\n",
|
||||||
converted_file.c_str());
|
symbol_file.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring converted_file_w;
|
wstring symbol_file_w;
|
||||||
if (!WindowsStringUtils::safe_mbstowcs(converted_file, &converted_file_w)) {
|
if (!WindowsStringUtils::safe_mbstowcs(symbol_file, &symbol_file_w)) {
|
||||||
FprintfFlush(stderr, "UploadSymbolFile: safe_mbstowcs failed for %s\n",
|
FprintfFlush(stderr, "UploadSymbolFile: safe_mbstowcs failed for %s\n",
|
||||||
converted_file.c_str());
|
symbol_file.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int timeout_ms = 60 * 1000;
|
int timeout_ms = 60 * 1000;
|
||||||
FprintfFlush(stderr, "Uploading %s\n", converted_file.c_str());
|
FprintfFlush(stderr, "Uploading %s\n", symbol_file.c_str());
|
||||||
if (!google_breakpad::SymUploadV2ProtocolSend(
|
if (!google_breakpad::SymUploadV2ProtocolSend(
|
||||||
upload_symbol_url.c_str(), api_key.c_str(), &timeout_ms, debug_file_w,
|
upload_symbol_url.c_str(), api_key.c_str(), &timeout_ms, debug_file_w,
|
||||||
debug_id_w, converted_file_w, kSymbolUploadTypeBreakpad,
|
debug_id_w, symbol_file_w, symbol_type,
|
||||||
/*force=*/true)) {
|
/*force=*/true)) {
|
||||||
FprintfFlush(stderr, "UploadSymbolFile: HTTPUpload::SendRequest failed "
|
FprintfFlush(stderr,
|
||||||
"for %s %s %s\n",
|
"UploadSymbolFile: HTTPUpload::SendRequest failed "
|
||||||
missing_info.debug_file.c_str(),
|
"for %s %s\n",
|
||||||
missing_info.debug_identifier.c_str(),
|
debug_file.c_str(), debug_identifier.c_str());
|
||||||
missing_info.version.c_str());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,30 +409,47 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
||||||
MSSymbolServerConverter::LocateResult located =
|
MSSymbolServerConverter::LocateResult located =
|
||||||
MSSymbolServerConverter::LOCATE_FAILURE;
|
MSSymbolServerConverter::LOCATE_FAILURE;
|
||||||
string converted_file;
|
string converted_file;
|
||||||
|
string symbol_file;
|
||||||
|
string pe_file;
|
||||||
if (msss_servers.size() > 0) {
|
if (msss_servers.size() > 0) {
|
||||||
// Attempt to fetch the symbol file and convert it.
|
// Attempt to fetch the symbol file and convert it.
|
||||||
FprintfFlush(stderr, "Making internal request for %s (%s)\n",
|
FprintfFlush(stderr, "Making internal request for %s (%s)\n",
|
||||||
missing_info.debug_file.c_str(),
|
missing_info.debug_file.c_str(),
|
||||||
missing_info.debug_identifier.c_str());
|
missing_info.debug_identifier.c_str());
|
||||||
MSSymbolServerConverter converter(options.local_cache_path, msss_servers);
|
MSSymbolServerConverter converter(options.local_cache_path, msss_servers);
|
||||||
located = converter.LocateAndConvertSymbolFile(missing_info,
|
located = converter.LocateAndConvertSymbolFile(
|
||||||
false, // keep_symbol_file
|
missing_info,
|
||||||
false, // keep_pe_file
|
/*keep_symbol_file=*/true,
|
||||||
& converted_file,
|
/*keep_pe_file=*/true, &converted_file, &symbol_file, &pe_file);
|
||||||
NULL, // symbol_file
|
|
||||||
NULL); // pe_file
|
|
||||||
switch (located) {
|
switch (located) {
|
||||||
case MSSymbolServerConverter::LOCATE_SUCCESS:
|
case MSSymbolServerConverter::LOCATE_SUCCESS:
|
||||||
FprintfFlush(stderr, "LocateResult = LOCATE_SUCCESS\n");
|
FprintfFlush(stderr, "LocateResult = LOCATE_SUCCESS\n");
|
||||||
// Upload it. Don't bother checking the return value. If this
|
// Upload it. Don't bother checking the return value. If this
|
||||||
// succeeds, it should disappear from the missing symbol list.
|
// succeeds, it should disappear from the missing symbol list.
|
||||||
// If it fails, something will print an error message indicating
|
// If it fails, something will print an error message indicating
|
||||||
// the cause of the failure, and the item will remain on the
|
// the cause of the failure, and the item will remain on the
|
||||||
// missing symbol list.
|
// missing symbol list.
|
||||||
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||||
missing_info, converted_file);
|
missing_info.debug_file, missing_info.debug_identifier,
|
||||||
|
converted_file, kSymbolUploadTypeBreakpad);
|
||||||
remove(converted_file.c_str());
|
remove(converted_file.c_str());
|
||||||
|
|
||||||
|
// Upload PDB/PE if we have them
|
||||||
|
if (!symbol_file.empty()) {
|
||||||
|
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||||
|
missing_info.debug_file,
|
||||||
|
missing_info.debug_identifier, symbol_file,
|
||||||
|
kSymbolUploadTypePDB);
|
||||||
|
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);
|
||||||
|
remove(pe_file.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// Note: this does leave some directories behind that could be
|
// Note: this does leave some directories behind that could be
|
||||||
// cleaned up. The directories inside options.local_cache_path for
|
// cleaned up. The directories inside options.local_cache_path for
|
||||||
// debug_file/debug_identifier can be removed at this point.
|
// debug_file/debug_identifier can be removed at this point.
|
||||||
|
@ -489,11 +507,8 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
||||||
msss_servers);
|
msss_servers);
|
||||||
located = external_converter.LocateAndConvertSymbolFile(
|
located = external_converter.LocateAndConvertSymbolFile(
|
||||||
missing_info,
|
missing_info,
|
||||||
false, // keep_symbol_file
|
/*keep_symbol_file=*/true,
|
||||||
false, // keep_pe_file
|
/*keep_pe_file=*/true, &converted_file, &symbol_file, &pe_file);
|
||||||
& converted_file,
|
|
||||||
NULL, // symbol_file
|
|
||||||
NULL); // pe_file
|
|
||||||
} else {
|
} else {
|
||||||
FprintfFlush(stderr, "ERROR: No suitable external symbol servers.\n");
|
FprintfFlush(stderr, "ERROR: No suitable external symbol servers.\n");
|
||||||
}
|
}
|
||||||
|
@ -505,15 +520,30 @@ static void ConvertMissingSymbolFile(const MissingSymbolInfo& missing_info,
|
||||||
switch (located) {
|
switch (located) {
|
||||||
case MSSymbolServerConverter::LOCATE_SUCCESS:
|
case MSSymbolServerConverter::LOCATE_SUCCESS:
|
||||||
FprintfFlush(stderr, "LocateResult = LOCATE_SUCCESS\n");
|
FprintfFlush(stderr, "LocateResult = LOCATE_SUCCESS\n");
|
||||||
// Upload it. Don't bother checking the return value. If this
|
// Upload it. Don't bother checking the return value. If this
|
||||||
// succeeds, it should disappear from the missing symbol list.
|
// succeeds, it should disappear from the missing symbol list.
|
||||||
// If it fails, something will print an error message indicating
|
// If it fails, something will print an error message indicating
|
||||||
// the cause of the failure, and the item will remain on the
|
// the cause of the failure, and the item will remain on the
|
||||||
// missing symbol list.
|
// missing symbol list.
|
||||||
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||||
missing_info, converted_file);
|
missing_info.debug_file, missing_info.debug_identifier,
|
||||||
|
converted_file, kSymbolUploadTypeBreakpad);
|
||||||
remove(converted_file.c_str());
|
remove(converted_file.c_str());
|
||||||
|
|
||||||
|
// Upload PDB/PE if we have them
|
||||||
|
if (!symbol_file.empty()) {
|
||||||
|
UploadSymbolFile(options.upload_symbols_url, options.api_key,
|
||||||
|
missing_info.debug_file, missing_info.debug_identifier,
|
||||||
|
symbol_file, kSymbolUploadTypePDB);
|
||||||
|
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);
|
||||||
|
remove(pe_file.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// Note: this does leave some directories behind that could be
|
// Note: this does leave some directories behind that could be
|
||||||
// cleaned up. The directories inside options.local_cache_path for
|
// cleaned up. The directories inside options.local_cache_path for
|
||||||
// debug_file/debug_identifier can be removed at this point.
|
// debug_file/debug_identifier can be removed at this point.
|
||||||
|
|
Loading…
Reference in a new issue