zijie0 / AMParser

Parse the Instruments Activity Monitor template trace result file to get CPU and memory usage
13 stars 7 forks source link

Issue in unarchiving archived 1.run file #5

Open irfan-cloudnix opened 6 years ago

irfan-cloudnix commented 6 years ago

When these lines are executed XRActivityInstrumentRun *run = [NSUnarchiver unarchiveObjectWithData:traceData]; printf("\n%s\n", [[run description] UTF8String]);

program throws...

2018-03-14 19:41:14.862 AMParser[47185:635434] Terminating app due to uncaught exception 'NSArchiverArchiveInconsistency', reason: ' Incorrect archive: unexpected byte' *** First throw call stack: ( 0 CoreFoundation 0x00007fffd5c542cb __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fffeaa6a48d objc_exception_throw + 48 2 CoreFoundation 0x00007fffd5cd2c3d +[NSException raise:format:] + 205 3 Foundation 0x00007fffd7638299 _decodeReusedCStringUsingTable + 329 4 Foundation 0x00007fffd7638131 -[NSUnarchiver decodeObject] + 73 5 AMParser 0x0000000107d224c6 -[PFTTrackSegment initWithCoder:] + 246 6 Foundation 0x00007fffd76385a6 _decodeObject_old + 416 7 Foundation 0x00007fffd7638fd5 _decodeValueOfObjCType + 978 8 Foundation 0x00007fffd7638bb7 -[NSUnarchiver decodeValueOfObjCType:at:] + 92 9 Foundation 0x00007fffd75d00b4 -[NSArray(NSArray) initWithCoder:] + 466 10 Foundation 0x00007fffd76385a6 _decodeObject_old + 416 11 AMParser 0x0000000107d2295c -[XRRun initWithCoder:] + 460 12 Foundation 0x00007fffd76385a6 _decodeObject_old + 416 13 Foundation 0x00007fffd76379e8 +[NSUnarchiver unarchiveObjectWithData:] + 64 14 AMParser 0x0000000107d2270c main + 236 15 libdyld.dylib 0x00007fffeb350235 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6

# Xcode : 9.2 Refer attached 1.run file being used, I have modified directly to

    NSString *resultUnzippedFile = @"~/Desktop/1.run";
    NSURL *traceFile = [NSURL fileURLWithPath:[resultUnzippedFile stringByExpandingTildeInPath]];
    NSData *traceData = [NSData dataWithContentsOfURL:traceFile];

    // Deserialize the data and dump its content
    XRActivityInstrumentRun *run = [NSUnarchiver unarchiveObjectWithData:traceData];
    printf("\n%s\n", [[run description] UTF8String]);

Is the issue with Xcode version, instrument trace file being corrupted, since I have tried with multiple trace files.

1.run.zip