Add symbol type option to SymUploadV2ProtocolSend.
Change-Id: Ia2eadae56c7f879ddb2212e4018024a5c04634aa Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3670054 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
parent
bee636cea4
commit
678d69cd78
6 changed files with 41 additions and 15 deletions
|
@ -20,6 +20,7 @@ static bool SymUploadV2ProtocolSend(const wchar_t* api_url,
|
||||||
const wstring& debug_file,
|
const wstring& debug_file,
|
||||||
const wstring& debug_id,
|
const wstring& debug_id,
|
||||||
const wstring& symbol_filename,
|
const wstring& symbol_filename,
|
||||||
|
const wstring& symbol_type,
|
||||||
bool force) {
|
bool force) {
|
||||||
wstring url(api_url);
|
wstring url(api_url);
|
||||||
wstring key(api_key);
|
wstring key(api_key);
|
||||||
|
@ -69,7 +70,7 @@ static bool SymUploadV2ProtocolSend(const wchar_t* api_url,
|
||||||
|
|
||||||
CompleteUploadResult completeUploadResult =
|
CompleteUploadResult completeUploadResult =
|
||||||
SymbolCollectorClient::CompleteUpload(url, key, timeout_ms, upload_key,
|
SymbolCollectorClient::CompleteUpload(url, key, timeout_ms, upload_key,
|
||||||
debug_file, debug_id);
|
debug_file, debug_id, symbol_type);
|
||||||
if (completeUploadResult == CompleteUploadResult::Error) {
|
if (completeUploadResult == CompleteUploadResult::Error) {
|
||||||
wprintf(L"Failed to complete upload.\n");
|
wprintf(L"Failed to complete upload.\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -37,14 +37,26 @@ namespace google_breakpad {
|
||||||
// Sends file at |symbol_filename| using the sym-upload-v2 protocol to
|
// Sends file at |symbol_filename| using the sym-upload-v2 protocol to
|
||||||
// |api_url| using key |api_key|, and using identifiers |debug_file| and
|
// |api_url| using key |api_key|, and using identifiers |debug_file| and
|
||||||
// |debug_id|. |timeout_ms| is the number of milliseconds to wait before
|
// |debug_id|. |timeout_ms| is the number of milliseconds to wait before
|
||||||
// terminating the upload attempt. If |force| is set then it will overwrite an
|
// terminating the upload attempt. |symbol_type| is the type of the symbol
|
||||||
// existing file with the same |debug_file| and |debug_id| in the store.
|
// file, which is one of:
|
||||||
|
// "BREAKPAD"
|
||||||
|
// "ELF"
|
||||||
|
// "PE"
|
||||||
|
// "MACHO"
|
||||||
|
// "DEBUG_ONLY"
|
||||||
|
// "DWP"
|
||||||
|
// "DSYM"
|
||||||
|
// "PDB"
|
||||||
|
// "SOURCE_MAP"
|
||||||
|
// If |force| is set then it will overwrite an existing file with the
|
||||||
|
// same |debug_file| and |debug_id| in the store.
|
||||||
bool SymUploadV2ProtocolSend(const wchar_t* api_url,
|
bool SymUploadV2ProtocolSend(const wchar_t* api_url,
|
||||||
const wchar_t* api_key,
|
const wchar_t* api_key,
|
||||||
int* timeout_ms,
|
int* timeout_ms,
|
||||||
const std::wstring& debug_file,
|
const std::wstring& debug_file,
|
||||||
const std::wstring& debug_id,
|
const std::wstring& debug_id,
|
||||||
const std::wstring& symbol_filename,
|
const std::wstring& symbol_filename,
|
||||||
|
const std::wstring& symbol_type,
|
||||||
bool force);
|
bool force);
|
||||||
|
|
||||||
} // namespace google_breakpad
|
} // namespace google_breakpad
|
||||||
|
|
|
@ -70,15 +70,23 @@ namespace google_breakpad {
|
||||||
int* timeout_ms,
|
int* timeout_ms,
|
||||||
const wstring& upload_key,
|
const wstring& upload_key,
|
||||||
const wstring& debug_file,
|
const wstring& debug_file,
|
||||||
const wstring& debug_id) {
|
const wstring& debug_id,
|
||||||
|
const wstring& type) {
|
||||||
wstring url = api_url +
|
wstring url = api_url +
|
||||||
L"/v1/uploads/" + upload_key + L":complete"
|
L"/v1/uploads/" + upload_key + L":complete"
|
||||||
L"?key=" + api_key;
|
L"?key=" + api_key;
|
||||||
wstring body =
|
wstring body =
|
||||||
L"{ symbol_id: {"
|
L"{ symbol_id: {"
|
||||||
L"debug_file: \"" + debug_file + L"\", "
|
L"debug_file: \"" +
|
||||||
L"debug_id: \"" + debug_id + L"\" "
|
debug_file +
|
||||||
|
L"\", "
|
||||||
|
L"debug_id: \"" +
|
||||||
|
debug_id +
|
||||||
|
L"\" "
|
||||||
L"}, "
|
L"}, "
|
||||||
|
L"symbol_upload_type: \"" +
|
||||||
|
type +
|
||||||
|
L"\", "
|
||||||
L"use_async_processing: true }";
|
L"use_async_processing: true }";
|
||||||
wstring response;
|
wstring response;
|
||||||
int response_code;
|
int response_code;
|
||||||
|
|
|
@ -69,13 +69,13 @@ namespace google_breakpad {
|
||||||
|
|
||||||
// Notify the API that symbol file upload is finished and its contents
|
// Notify the API that symbol file upload is finished and its contents
|
||||||
// are ready to be read and/or used for further processing.
|
// are ready to be read and/or used for further processing.
|
||||||
static CompleteUploadResult CompleteUpload(
|
static CompleteUploadResult CompleteUpload(wstring& api_url,
|
||||||
wstring& api_url,
|
wstring& api_key,
|
||||||
wstring& api_key,
|
int* timeout_ms,
|
||||||
int* timeout_ms,
|
const wstring& upload_key,
|
||||||
const wstring& upload_key,
|
const wstring& debug_file,
|
||||||
const wstring& debug_file,
|
const wstring& debug_id,
|
||||||
const wstring& debug_id);
|
const wstring& type);
|
||||||
|
|
||||||
// Returns whether or not a symbol file corresponding to the debug_file/
|
// Returns whether or not a symbol file corresponding to the debug_file/
|
||||||
// debug_id pair is already present in symbol storage.
|
// debug_id pair is already present in symbol storage.
|
||||||
|
|
|
@ -66,6 +66,7 @@ using google_breakpad::WindowsStringUtils;
|
||||||
const char* kMissingStringDelimiters = "|";
|
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";
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -239,7 +240,8 @@ static bool UploadSymbolFile(const wstring& upload_symbol_url,
|
||||||
FprintfFlush(stderr, "Uploading %s\n", converted_file.c_str());
|
FprintfFlush(stderr, "Uploading %s\n", converted_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, true)) {
|
debug_id_w, converted_file_w, kSymbolUploadTypeBreakpad,
|
||||||
|
/*force=*/true)) {
|
||||||
FprintfFlush(stderr, "UploadSymbolFile: HTTPUpload::SendRequest failed "
|
FprintfFlush(stderr, "UploadSymbolFile: HTTPUpload::SendRequest failed "
|
||||||
"for %s %s %s\n",
|
"for %s %s %s\n",
|
||||||
missing_info.debug_file.c_str(),
|
missing_info.debug_file.c_str(),
|
||||||
|
|
|
@ -68,6 +68,8 @@ using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::wstring;
|
using std::wstring;
|
||||||
|
|
||||||
|
const wchar_t* kSymbolUploadTypeBreakpad = L"BREAKPAD";
|
||||||
|
|
||||||
// Extracts the file version information for the given filename,
|
// Extracts the file version information for the given filename,
|
||||||
// as a string, for example, "1.2.3.4". Returns true on success.
|
// as a string, for example, "1.2.3.4". Returns true on success.
|
||||||
static bool GetFileVersionString(const wchar_t* filename, wstring* version) {
|
static bool GetFileVersionString(const wchar_t* filename, wstring* version) {
|
||||||
|
@ -251,7 +253,8 @@ int wmain(int argc, wchar_t* argv[]) {
|
||||||
|
|
||||||
success = google_breakpad::SymUploadV2ProtocolSend(
|
success = google_breakpad::SymUploadV2ProtocolSend(
|
||||||
api_url, api_key, timeout == -1 ? nullptr : &timeout,
|
api_url, api_key, timeout == -1 ? nullptr : &timeout,
|
||||||
pdb_info.debug_file, pdb_info.debug_identifier, symbol_file, force);
|
pdb_info.debug_file, pdb_info.debug_identifier, symbol_file,
|
||||||
|
kSymbolUploadTypeBreakpad, force);
|
||||||
} else {
|
} else {
|
||||||
printUsageAndExit();
|
printUsageAndExit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue