Re: DTrace probe problem
Re: DTrace probe problem
- Subject: Re: DTrace probe problem
- From: radj <email@hidden>
- Date: Fri, 6 Jun 2008 10:28:15 +0800
Hello again.
I have another problem now and it is how to set off DTrace from within the
application. This is my code:
// SNIPPET START
int pid = [[NSProcessInfo processInfo] processIdentifier];
NSArray *arguments = [NSArray arrayWithObjects: @"-w", // permit destructive
actions
@"-o /tmp/DTraceLog", //
output file
@"-s /tmp/DTrace.d", //
D script
[NSNumber
numberWithInt:pid], // feed in PID for macro $1
nil];
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/dev/dtrace"];
[task setArguments: arguments];
[task launch];
// SNIPPET END
the launch path is correct, right? I found dtrace in the /dev folder.
Unfortunately, it crashes and here's a part of the crash log:
// CRASH LOG
...
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000096cddd78
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'launch path not accessible'
Thread 0 Crashed:
0 com.apple.CoreFoundation 0x96cddd78
___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ + 0
1 libobjc.A.dylib 0x9003a768 objc_exception_throw + 68
2 com.apple.CoreFoundation 0x96cddcdc +[NSException
raise:format:arguments:] + 136
3 com.apple.CoreFoundation 0x96cddd14 +[NSException
raise:format:] + 52
4 com.apple.Foundation 0x93c502c0 -[NSConcreteTask
launchWithDictionary:] + 392
...
// CRASH LOG END
Is there something wrong with how the NSTask was set up?
The application does not run as "root" but as "_lp". Is that a big factor in
the error?
Cheers,
radj
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden