On Oct 23, 2008, at 2:20 AM, [EMAIL PROTECTED] wrote:
>> Thank you for getting interested in detail.
>> In my case, "inconsistent results from different program" was that.
>>
>> However, dtrace ustack() showed results from some programs with the  
>> name of "_start()",  "main()",
> "libc.so.1'_open()" and so on,
>> but from the other programs, without name of functions but hexa- 
>> decimal addresses.
>>
>
> dtrace needs to be able open the process; if the process has  
> terminated,
> all you get are hexidecimal addresses.
>
> DTrace is async: first it generates the probes output in the probe
> context (sync); then later it pretty prints the output, outside of  
> the probe
> context (after the fact).


To be a little clearer, the ustack() action records addresses when the  
probe
fires, but those addresses aren't converted to symbols until later in  
user-
land, and at that point the process from which the stack came may have  
gone
away. Here's how I solve this problem:

<some probe where you take a ustack()>
{
        ustack();
        procs[pid] = 1;
}

syscall::rexit:entry
/procs[pid]/
{
        procs[pid] = 0;
        stop();
        system("prun %d", pid);
}

What this does is catches processes as they call the exit system call  
and
forces them to pause long enough for us to gather ustack() data. This  
isn't
fool proof since applications that exit abnormally will escape.

Adam

--
Adam Leventhal, Fishworks                        http://blogs.sun.com/ahl

_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to