Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am running instruments via Terminal:

instruments -t /Developer/Platforms/"iPhoneOS.platform/Developer/Library/Instruments/PlugIns/Au‌​tomationInstrument.bundle/Contents/Resources/Automation.tracetemplate ~/Library/Application\\\ Support/iPhone\\\ Simulator/$simulatorSDKVersion/Applications/<randomUUID>/MyApp.app -e UIASCRIPT someJSFile.js -e UIARESULTSPATH Logs

for several test scripts.

But I keep getting sporadic crashes and this is interfering with the workflow I have set up.

Can anyone tell me what this means:

instruments[57679:1603] InstrumentsException : *** -[__NSCFString stringByAppendingString:]: nil argument
instruments[57679:1603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFString stringByAppendingString:]: nil argument'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff90ed4f56 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff90598d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff90ed4d8a +[NSException raise:format:arguments:] + 106
    3   CoreFoundation                      0x00007fff90ed4d14 +[NSException raise:format:] + 116
    4   Foundation                          0x00007fff939e9375 -[NSString stringByAppendingString:] + 91
    5   AutomationInstrument                0x000000010c5b6695 AutomationInstrument + 30357
    6   libdispatch.dylib                   0x00007fff8ad07a86 _dispatch_call_block_and_release + 18
    7   libdispatch.dylib                   0x00007fff8ad098f6 _dispatch_main_queue_callback_4CF + 308
    8   CoreFoundation                      0x00007fff90e69e7c __CFRunLoopRun + 1724
    9   CoreFoundation                      0x00007fff90e69486 CFRunLoopRunSpecific + 230
    10  Foundation                          0x00007fff939d7f7b -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 267
    11  Foundation                          0x00007fff93a5bb56 -[NSRunLoop(NSRunLoop) runUntilDate:] + 66
    12  instruments                         0x00000001091d03c1 _mh_execute_header + 13249
    13  instruments                         0x00000001091ce194 _mh_execute_header + 4500
)
terminate called throwing an exception

Thanks!

P.S. Not sure if this is the right site to post this question on.

share|improve this question
    
And your question is what exactly? Why does it crash? It would help you could add the specific parameters you use when calling instruments. –  patrix Oct 24 '12 at 17:40
    
@patrix yes why does it crash? I have already stated what parameters I pass to instruments. instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/Aut‌​omationInstrument.bundle/Contents/Resources/Automation.tracetemplate ~/Library/Application\\\ Support/iPhone\\\ Simulator/$simulatorSDKVersion/Applications/<randomUUID>/MyApp.app -e UIASCRIPT someJSFile.js -e UIARESULTSPATH Logs –  stackErr Oct 24 '12 at 18:22
add comment

4 Answers 4

I've seen that Exception before when I throw a Javascript primitive and it reproduces reliably and consistently with my Instruments-4.5 (4523).

Your comments state that this does not reproduce reliably. Is it possible that your tests do not take the same path reliably (and hence, not consistently throwing), and this is why they only reproduce sometimes? Before continuing, I suggest verifying that your tests are taking the same path consistently.

To verify throwing a Javascript primitive is the case with your tests, do these steps.

Find a Javascript test file that reproduces with your InstrumentsException.

Verify the Javascript test throws a Javascript primitive, as opposed to a Javascript Object. Specifically, you want a line that uses "throw" but does not use "new" in the same line. The relevant line should look like this,

throw "Who's your daddy";   //Instruments throws an InstrumentsException with this.

not

throw new Error("Who's your daddy?");  //Instruments has no problems with this.

Verify that your installation does actually throw that specific InstrumentsException when you throw a primitive.

throw "Who's your daddy";

At this point, you've got a pretty good suspect. But you to make more certain, try removing the suspicious "throw" line or replacing it with something else, just to see if you can get the test to pass.

share|improve this answer
add comment

The obvious, though probably not helpful, answer is that while doing something with the automation, Instruments encountered a missing string while trying to append it to an existing string. I'd be suspicious of something in the .js file being the catalyst for this.

I'd still file it as a bug, since bad input (if that should happen to be the reason) shouldn't cause a crash.

share|improve this answer
    
I do not think this is whats happening because I am passing through 20 different files one after the other and it crashes on a different file every time. –  stackErr Oct 24 '12 at 19:34
add comment

FWIW, I'm getting exactly the same trace trying to run instruments through the zucchini framework (pointer values different, but the trace is the same). I can run the framework on the CoreDataBooks sample w/o error, but when I try to point it at my development app, I get this issue. I suspect a version mismatch, since I'm running zucchini on Xcode 4.5.1 and most of the zucchini crowd isn't there yet. But invoking zucchini gets the same two error lines you began with. Good luck, I'll update if I find anything interesting.

share|improve this answer
    
I dont use any frameworks but I suspect this crash is related to how instruments handles any failures in your scripts. I have seen a good correlation between the number of failures and the number of crashes. –  stackErr Oct 25 '12 at 19:17
    
Yeah, I started out think along your lines, user1160022, but it appears that it doesn't matter what is in the script, it crashes the same if it's large, small, or empty. Which makes me suspect something environmental, or else that it's having trouble finding the script, which seems unlikely. –  paleotek Oct 25 '12 at 19:33
    
No it finds the script since even after it crashes the script runs successfully. –  stackErr Oct 25 '12 at 19:36
    
Its hard to narrow this down since I can get it to run without ever crashing and then run it again without any changes and it crashes. –  stackErr Oct 25 '12 at 19:40
    
Huh. Weird yours is intermittent, and mines completely deterministic. Intermittents in my experience tend to be memory leaks and overwrites and such. I'm on Lion 10.7.5, xcode 4.5.1 Just for fun, here's the trace from my run, with the -v switch on to provide a little more logging: –  paleotek Oct 25 '12 at 19:57
show 3 more comments

I was just experiencing 100% reproducible crashes in Instruments (not very productive) that seem to have been fixed by rebuilding the spotlight index (sudo mdutil -E /), so that might be worth a try for anyone who can't get Instruments to run for more than a few seconds.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.