mirror of
https://git.suyu.dev/suyu/breakpad
synced 2024-11-21 14:29:09 -07:00
Add support for product_name in Mac sym_upload v2
Change-Id: I6fab9f62434fd19eb7aea4a66f0dd809af57e595 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3436859 Reviewed-by: Nelson Billing <nbilling@google.com> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
3123f102ff
commit
7685201906
3 changed files with 28 additions and 15 deletions
|
@ -96,7 +96,8 @@ typedef NS_ENUM(NSInteger, SymbolStatus) {
|
|||
withUploadKey:(NSString*)uploadKey
|
||||
withDebugFile:(NSString*)debugFile
|
||||
withDebugID:(NSString*)debugID
|
||||
withType:(NSString*)type;
|
||||
withType:(NSString*)type
|
||||
withProductName:(NSString*)productName;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -190,18 +190,22 @@
|
|||
withUploadKey:(NSString*)uploadKey
|
||||
withDebugFile:(NSString*)debugFile
|
||||
withDebugID:(NSString*)debugID
|
||||
withType:(NSString*)type {
|
||||
withType:(NSString*)type
|
||||
withProductName:(NSString*)productName {
|
||||
NSURL* URL = [NSURL
|
||||
URLWithString:[NSString
|
||||
stringWithFormat:@"%@/v1/uploads/%@:complete?key=%@",
|
||||
APIURL, uploadKey, APIKey]];
|
||||
|
||||
NSDictionary* symbolIdDictionary =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:debugFile, @"debug_file",
|
||||
debugID, @"debug_id", nil];
|
||||
NSDictionary* jsonDictionary = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys:symbolIdDictionary, @"symbol_id", type,
|
||||
@"symbol_upload_type", nil];
|
||||
NSMutableDictionary* jsonDictionary = [@{
|
||||
@"symbol_id" : @{@"debug_file" : debugFile, @"debug_id" : debugID},
|
||||
@"symbol_upload_type" : type
|
||||
} mutableCopy];
|
||||
|
||||
if (productName != nil) {
|
||||
jsonDictionary[@"metadata"] = @{@"product_name": productName};
|
||||
}
|
||||
|
||||
NSError* error = nil;
|
||||
NSData* jsonData =
|
||||
[NSJSONSerialization dataWithJSONObject:jsonDictionary
|
||||
|
|
|
@ -73,6 +73,7 @@ typedef struct {
|
|||
NSString* type;
|
||||
NSString* codeFile;
|
||||
NSString* debugID;
|
||||
NSString* productName;
|
||||
} Options;
|
||||
|
||||
//=============================================================================
|
||||
|
@ -212,7 +213,8 @@ static void StartSymUploadProtocolV2(Options* options,
|
|||
withUploadKey:[URLResponse uploadKey]
|
||||
withDebugFile:debugFile
|
||||
withDebugID:debugID
|
||||
withType:options->type];
|
||||
withType:options->type
|
||||
withProductName:options->productName];
|
||||
[URLResponse release];
|
||||
if (completeUploadResult == CompleteUploadResultError) {
|
||||
fprintf(stdout, "Failed to complete upload.\n");
|
||||
|
@ -271,18 +273,20 @@ static void Usage(int argc, const char* argv[]) {
|
|||
"[Only in sym-upload-v2 protocol mode]\n");
|
||||
fprintf(
|
||||
stderr,
|
||||
"-t:\t <symbol-type> Explicitly set symbol upload type ("
|
||||
"\t-t: <symbol-type> Explicitly set symbol upload type ("
|
||||
"default is 'breakpad').\n"
|
||||
"\t One of ['breakpad', 'elf', 'pe', 'macho', 'debug_only', 'dwp', "
|
||||
"'dsym', 'pdb'].\n"
|
||||
"\t Note: When this flag is set to anything other than 'breakpad', then "
|
||||
"the '-c' and '-i' flags must also be set.\n");
|
||||
fprintf(stderr, "-c:\t <code-file> Explicitly set 'code_file' for symbol "
|
||||
fprintf(stderr, "\t-c: <code-file> Explicitly set 'code_file' for symbol "
|
||||
"upload (basename of executable).\n");
|
||||
fprintf(stderr, "-i:\t <debug-id> Explicitly set 'debug_id' for symbol "
|
||||
fprintf(stderr, "\t-i: <debug-id> Explicitly set 'debug_id' for symbol "
|
||||
"upload (typically build ID of executable). The debug-id for "
|
||||
"symbol-types 'dsym' and 'macho' will be determined "
|
||||
"automatically. \n");
|
||||
fprintf(stderr, "\t-n: <product-name> Optionally set 'product_name' for "
|
||||
"symbol upload\n");
|
||||
fprintf(stderr, "\t-h: Usage\n");
|
||||
fprintf(stderr, "\t-?: Usage\n");
|
||||
fprintf(stderr, "\n");
|
||||
|
@ -329,11 +333,12 @@ static void SetupOptions(int argc, const char* argv[], Options* options) {
|
|||
options->codeFile = nil;
|
||||
options->debugID = nil;
|
||||
options->force = NO;
|
||||
options->productName = nil;
|
||||
|
||||
extern int optind;
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, (char* const*)argv, "p:k:t:c:i:hf?")) != -1) {
|
||||
while ((ch = getopt(argc, (char* const*)argv, "p:k:t:c:i:n:hf?")) != -1) {
|
||||
switch (ch) {
|
||||
case 'p':
|
||||
if (strcmp(optarg, "sym-upload-v2") == 0) {
|
||||
|
@ -362,12 +367,15 @@ static void SetupOptions(int argc, const char* argv[], Options* options) {
|
|||
case 'c':
|
||||
options->codeFile = [NSString stringWithCString:optarg
|
||||
encoding:NSASCIIStringEncoding];
|
||||
;
|
||||
break;
|
||||
case 'i':
|
||||
options->debugID = [NSString stringWithCString:optarg
|
||||
encoding:NSASCIIStringEncoding];
|
||||
;
|
||||
break;
|
||||
case 'n':
|
||||
options->productName =
|
||||
[NSString stringWithCString:optarg
|
||||
encoding:NSASCIIStringEncoding];
|
||||
break;
|
||||
case 'f':
|
||||
options->force = YES;
|
||||
|
|
Loading…
Reference in a new issue