Merge branch 'master' into landonf-ha14-merge-ha-fork
This commit is contained in:
Коммит
cc9b8ada44
|
@ -322,6 +322,10 @@ message CrashReport {
|
|||
message ReportInfo {
|
||||
/** If true, this report was generated on request, and no crash occured. */
|
||||
required bool user_requested = 1;
|
||||
|
||||
/** A client-generated 16 byte OSF standard UUID for this report. May be used to filter duplicate reports submitted
|
||||
* by a single client. */
|
||||
optional bytes uuid = 2;
|
||||
}
|
||||
|
||||
/* Report format information. Required for all v1.1+ crash reports. */
|
||||
|
|
|
@ -40,6 +40,8 @@ extern "C" {
|
|||
#import "PLCrashAsyncImageList.h"
|
||||
#import "PLCrashFrameWalker.h"
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @defgroup plcrash_log_writer Crash Log Writer
|
||||
|
@ -62,6 +64,9 @@ typedef struct plcrash_log_writer {
|
|||
/** If true, the report should be marked as a 'generated' user-requested report, rather than as a true crash
|
||||
* report */
|
||||
bool user_requested;
|
||||
|
||||
/** Report UUID */
|
||||
uuid_t uuid_bytes;
|
||||
} report_info;
|
||||
|
||||
/** System data */
|
||||
|
@ -168,4 +173,4 @@ void plcrash_log_writer_free (plcrash_log_writer_t *writer);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* PLCRASH_LOG_WRITER_H */
|
||||
#endif /* PLCRASH_LOG_WRITER_H */
|
||||
|
|
|
@ -234,6 +234,9 @@ enum {
|
|||
|
||||
/** CrashReport.report_info.crashed */
|
||||
PLCRASH_PROTO_REPORT_INFO_USER_REQUESTED_ID = 1,
|
||||
|
||||
/** CrashReport.report_info.uuid */
|
||||
PLCRASH_PROTO_REPORT_INFO_UUID_ID = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -262,6 +265,16 @@ plcrash_error_t plcrash_log_writer_init (plcrash_log_writer_t *writer,
|
|||
/* Default to false */
|
||||
writer->report_info.user_requested = user_requested;
|
||||
|
||||
/* Generate a UUID for this incident; CFUUID is used in favor of NSUUID as to maintain compatibility
|
||||
* with (Mac OS X 10.7|iOS 5) and earlier. */
|
||||
{
|
||||
CFUUIDRef uuid = CFUUIDCreate(NULL);
|
||||
CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid);
|
||||
PLCF_ASSERT(sizeof(bytes) == sizeof(writer->report_info.uuid_bytes));
|
||||
memcpy(writer->report_info.uuid_bytes, &bytes, sizeof(writer->report_info.uuid_bytes));
|
||||
CFRelease(uuid);
|
||||
}
|
||||
|
||||
/* Fetch the application information */
|
||||
{
|
||||
writer->application_info.app_identifier = strdup([app_identifier UTF8String]);
|
||||
|
@ -1089,6 +1102,13 @@ static size_t plcrash_writer_write_report_info (plcrash_async_file_t *file, plcr
|
|||
/* Note crashed status */
|
||||
rv += plcrash_writer_pack(file, PLCRASH_PROTO_REPORT_INFO_USER_REQUESTED_ID, PLPROTOBUF_C_TYPE_BOOL, &writer->report_info.user_requested);
|
||||
|
||||
/* Write the 128-bit UUID */
|
||||
PLProtobufCBinaryData uuid_bin;
|
||||
|
||||
uuid_bin.len = sizeof(writer->report_info.uuid_bytes);
|
||||
uuid_bin.data = &writer->report_info.uuid_bytes;
|
||||
rv += plcrash_writer_pack(file, PLCRASH_PROTO_REPORT_INFO_UUID_ID, PLPROTOBUF_C_TYPE_BYTES, &uuid_bin);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,6 +345,16 @@
|
|||
return;
|
||||
|
||||
STAssertFalse(crashReport->report_info->user_requested, @"Report not correctly marked as non-user-requested");
|
||||
STAssertTrue(crashReport->report_info->has_uuid, @"Report missing a UUID value");
|
||||
STAssertEquals((size_t)16, crashReport->report_info->uuid.len, @"UUID is not expected 16 bytes");
|
||||
{
|
||||
CFUUIDBytes uuid_bytes;
|
||||
memcpy(&uuid_bytes, crashReport->report_info->uuid.data, sizeof(uuid_bytes));
|
||||
CFUUIDRef uuid = CFUUIDCreateFromUUIDBytes(NULL, uuid_bytes);
|
||||
STAssertNotNULL(uuid, @"Value not parsable as a UUID");
|
||||
if (uuid != NULL)
|
||||
CFRelease(uuid);
|
||||
}
|
||||
|
||||
/* Test the report */
|
||||
[self checkSystemInfo: crashReport];
|
||||
|
|
|
@ -107,6 +107,9 @@ typedef struct _PLCrashReportDecoder _PLCrashReportDecoder;
|
|||
|
||||
/** Exception information (may be nil) */
|
||||
PLCrashReportExceptionInfo *_exceptionInfo;
|
||||
|
||||
/** Report UUID */
|
||||
CFUUIDRef _uuid;
|
||||
}
|
||||
|
||||
- (id) initWithData: (NSData *) encodedData error: (NSError **) outError;
|
||||
|
@ -171,4 +174,11 @@ typedef struct _PLCrashReportDecoder _PLCrashReportDecoder;
|
|||
*/
|
||||
@property(nonatomic, readonly) PLCrashReportExceptionInfo *exceptionInfo;
|
||||
|
||||
/**
|
||||
* A client-generated 16-byte UUID. May be used to filter duplicate reports submitted or generated
|
||||
* by a single client. Only available in later (v1.2+) crash report format versions. If not available,
|
||||
* will be NULL.
|
||||
*/
|
||||
@property(nonatomic, readonly) CFUUIDRef uuidRef;
|
||||
|
||||
@end
|
||||
|
|
|
@ -92,6 +92,24 @@ static void populate_nserror (NSError **error, PLCrashReporterError code, NSStri
|
|||
goto error;
|
||||
}
|
||||
|
||||
/* Report info (optional) */
|
||||
_uuid = NULL;
|
||||
if (_decoder->crashReport->report_info != NULL) {
|
||||
/* Report UUID (optional)
|
||||
* If our minimum supported target is bumped to (10.8+, iOS 6.0+), NSUUID should
|
||||
* be used instead. */
|
||||
if (_decoder->crashReport->report_info->has_uuid) {
|
||||
/* Validate the UUID length */
|
||||
if (_decoder->crashReport->report_info->uuid.len != sizeof(uuid_t)) {
|
||||
populate_nserror(outError, PLCrashReporterErrorCrashReportInvalid , @"Report UUID value is not a standard 16 bytes");
|
||||
goto error;
|
||||
}
|
||||
|
||||
CFUUIDBytes uuid_bytes;
|
||||
memcpy(&uuid_bytes, _decoder->crashReport->report_info->uuid.data, _decoder->crashReport->report_info->uuid.len);
|
||||
_uuid = CFUUIDCreateFromUUIDBytes(NULL, uuid_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/* System info */
|
||||
_systemInfo = [[self extractSystemInfo: _decoder->crashReport->system_info error: outError] retain];
|
||||
|
@ -156,6 +174,9 @@ error:
|
|||
[_threads release];
|
||||
[_images release];
|
||||
[_exceptionInfo release];
|
||||
|
||||
if (_uuid != NULL)
|
||||
CFRelease(_uuid);
|
||||
|
||||
/* Free the decoder state */
|
||||
if (_decoder != NULL) {
|
||||
|
@ -215,6 +236,7 @@ error:
|
|||
@synthesize threads = _threads;
|
||||
@synthesize images = _images;
|
||||
@synthesize exceptionInfo = _exceptionInfo;
|
||||
@synthesize uuidRef = _uuid;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -717,4 +739,4 @@ static void populate_nserror (NSError **error, PLCrashReporterError code, NSStri
|
|||
];
|
||||
|
||||
*error = [NSError errorWithDomain: PLCrashReporterErrorDomain code: code userInfo: userInfo];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,6 +139,9 @@ static plcrash_error_t plcr_live_report_callback (plcrash_async_thread_state_t *
|
|||
PLCrashReport *crashLog = [[[PLCrashReport alloc] initWithData: [NSData dataWithContentsOfMappedFile: _logPath] error: &error] autorelease];
|
||||
STAssertNotNil(crashLog, @"Could not decode crash log: %@", error);
|
||||
|
||||
/* Report info */
|
||||
STAssertNotNULL(crashLog.uuidRef, @"No report UUID");
|
||||
|
||||
/* System info */
|
||||
STAssertNotNil(crashLog.systemInfo, @"No system information available");
|
||||
STAssertNotNil(crashLog.systemInfo.operatingSystemVersion, @"OS version is nil");
|
||||
|
|
|
@ -168,7 +168,13 @@ NSInteger binaryImageSort(id binary1, id binary2, void *context);
|
|||
if (report.hasMachineInfo && report.machineInfo.modelName != nil)
|
||||
hardwareModel = report.machineInfo.modelName;
|
||||
|
||||
[text appendFormat: @"Incident Identifier: TODO\n"];
|
||||
NSString *incidentIdentifier = @"???";
|
||||
if (report.uuidRef != NULL) {
|
||||
incidentIdentifier = (NSString *) CFUUIDCreateString(NULL, report.uuidRef);
|
||||
[incidentIdentifier autorelease];
|
||||
}
|
||||
|
||||
[text appendFormat: @"Incident Identifier: %@\n", incidentIdentifier];
|
||||
[text appendFormat: @"CrashReporter Key: TODO\n"];
|
||||
[text appendFormat: @"Hardware Model: %@\n", hardwareModel];
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
PLCrashReport *report = [[PLCrashReport alloc] initWithData: reportData error: &error];
|
||||
STAssertNotNil(report, @"Could not parse geneated live report: %@", error);
|
||||
|
||||
|
||||
STAssertEqualStrings([[report signalInfo] name], @"SIGTRAP", @"Incorrect signal name");
|
||||
STAssertEqualStrings([[report signalInfo] code], @"TRAP_TRACE", @"Incorrect signal code");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче