Discussion:
dtrace / c++ / lots of threads
William Reich
2010-05-07 18:43:31 UTC
Permalink
I have a very simple dtrace script ( shown below ).

This script works on simple programs just fine.



Now I want to use this script on a large C++ executable.

The executable is 8.5 meg in size on a x86 platform.

This executable has more than 10 threads in it.



I try to execute that the dtrace script and I get this error -



./adc.d 24930

dtrace: failed to compile script ./adc.d: line 7: failed to grab
process 24930



What is the error really trying to tell me ?



wr

#######################



#!/usr/sbin/dtrace -qs

BEGIN

{ flag = 1 ; }



END

{ flag = 0 ; }

pid$1:::entry

{

self->t[probefunc] = timestamp ;

}



pid$1:::return

/self->t[probefunc] && flag /

{ this->time = timestamp - self->t[probefunc] ;

@[probefunc] = avg(this->time) ;

self->t[probefunc] = 0 ;

}
Adam Leventhal
2010-05-07 18:50:28 UTC
Permalink
Hey William,

There are a variety of reasons why dtrace(1M) would be unable to grab the process -- for example, if the process you identified doesn't exist or if you don't have permissions to it. Try this:

truss -t open dtrace -s adc.d 24930

... you might see output like this:

...
open("/proc/24930/as", O_RDONLY|O_EXCL) Err#2 ENOENT
open("/proc/24930/as", O_RDONLY) Err#2 ENOENT

Adam
Post by William Reich
I have a very simple dtrace script ( shown below ).
This script works on simple programs just fine.
Now I want to use this script on a large C++ executable.
The executable is 8.5 meg in size on a x86 platform.
This executable has more than 10 threads in it.
I try to execute that the dtrace script and I get this error –
./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab process 24930
What is the error really trying to tell me ?
wr
#######################
#!/usr/sbin/dtrace -qs
BEGIN
{ flag = 1 ; }
END
{ flag = 0 ; }
pid$1:::entry
{
self->t[probefunc] = timestamp ;
}
pid$1:::return
/self->t[probefunc] && flag /
{ this->time = timestamp - self->t[probefunc] ;
@[probefunc] = avg(this->time) ;
self->t[probefunc] = 0 ;
}
_______________________________________________
dtrace-discuss mailing list
--
Adam Leventhal, Fishworks http://blogs.sun.com/ahl
William Reich
2010-05-10 13:51:21 UTC
Permalink
Yes, I am trying to find my hotspots.

However - NO dtrace script will work.

Yes, the process does exist. ( I have to change the pid for each test performed. )
Yes, I am running dtrace as root, so I do have access to the process.

wr




-----Original Message-----
From: Chad Mynhier [mailto:cmynhier-***@public.gmane.org]
Sent: Friday, May 07, 2010 2:53 PM
To: William Reich
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
#!/usr/sbin/dtrace -qs
BEGIN
{       flag =  1 ; }
END
{       flag = 0 ; }
pid$1:::entry
{
self->t[probefunc] = timestamp ;
}
pid$1:::return
/self->t[probefunc] && flag /
{       this->time = timestamp - self->t[probefunc] ;
        self->t[probefunc] = 0 ;
}
Unrelated question, but what is it that you're trying to achieve with
this script? Do you need to know how much time you're spending in
each and every function you call? Or are you just trying to get a
feel for your hotspots? If it's the latter, just use sampling,
something like this:

profile-997
/ arg1 && pid == $1 /
{
@[ufunc(arg1)] = count();
}

This is going to be far more lightweight, but it will still give you a
feel for your hotspots. Enabling every single function entry and
return probe is going to be very expensive.

Chad


++++++++++++++++++++++++++++
Post by William Reich
I have a very simple dtrace script ( shown below ).
This script works on simple programs just fine.
Now I want to use this script on a large C++ executable.
The executable is 8.5 meg in size on a x86 platform.
This executable has more than 10 threads in it.
I try to execute that the dtrace script and I get this error -
./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab process 24930
What is the error really trying to tell me ?
Michael Schuster
2010-05-10 13:59:59 UTC
Permalink
Post by William Reich
Yes, I am trying to find my hotspots.
However - NO dtrace script will work.
Post by William Reich
Now I want to use this script on a large C++ executable.
The executable is 8.5 meg in size on a x86 platform.
This executable has more than 10 threads in it.
I try to execute that the dtrace script and I get this error -
./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab process 24930
or differently?
does this happen for any process you try to trace, or just for this one?

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
William Reich
2010-05-10 19:01:34 UTC
Permalink
only this process fails -

./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab
process 24930


This script works fine on any other process.



-----Original Message-----
From: Michael Schuster [mailto:michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org]
Sent: Monday, May 10, 2010 10:00 AM
To: William Reich
Cc: dtrace-discuss-***@public.gmane.org
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
Yes, I am trying to find my hotspots.
However - NO dtrace script will work.
Post by William Reich
Now I want to use this script on a large C++ executable.
The executable is 8.5 meg in size on a x86 platform.
This executable has more than 10 threads in it.
I try to execute that the dtrace script and I get this error -
./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab process 24930
or differently?
does this happen for any process you try to trace, or just for this one?

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
Michael Schuster
2010-05-11 05:38:17 UTC
Permalink
Post by William Reich
only this process fails -
./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab process 24930
This script works fine on any other process.
so then the obvious question is: what's different about that
process/program? are you running it under a debugger or truss?

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
William Reich
2010-05-11 12:38:39 UTC
Permalink
as implied in the first email ( below ) ,
the only thing that I see as different between this particular process
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
b) the executable has at least 10 threads in it.


wr



-----Original Message-----
From: dtrace-discuss-bounces-***@public.gmane.org
[mailto:dtrace-discuss-bounces-***@public.gmane.org] On Behalf Of Michael
Schuster
Sent: Tuesday, May 11, 2010 1:38 AM
To: dtrace-discuss-***@public.gmane.org
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
only this process fails -
./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab process 24930
This script works fine on any other process.
so then the obvious question is: what's different about that
process/program? are you running it under a debugger or truss?

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
++++++++++++++++++++++++++++++++++++

I have a very simple dtrace script ( shown below ).
This script works on simple programs just fine.

Now I want to use this script on a large C++ executable.
The executable is 8.5 meg in size on a x86 platform.
This executable has more than 10 threads in it.

I try to execute that the dtrace script and I get this error -

./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab
process 24930

What is the error really trying to tell me ?

wr
#######################

#!/usr/sbin/dtrace -qs
BEGIN
{ flag = 1 ; }

END
{ flag = 0 ; }
pid$1:::entry
{
self->t[probefunc] = timestamp ;
}

pid$1:::return
/self->t[probefunc] && flag /
{ this->time = timestamp - self->t[probefunc] ;
@[probefunc] = avg(this->time) ;
self->t[probefunc] = 0 ;
}
Michael Schuster
2010-05-11 13:35:34 UTC
Permalink
Post by William Reich
as implied in the first email ( below ) ,
the only thing that I see as different between this particular process
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
I don't think this should be an issue ... but can you give some detail on
how this executable is built?
Post by William Reich
b) the executable has at least 10 threads in it.
the executable doesn't have threads ;-) they're a property of the running
process, but I know what you mean: that shouldn't be a problem, I just
tried tracing firefox, which has more, and had no issue.

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
William Reich
2010-05-11 13:58:24 UTC
Permalink
we use the g++ compiler for this c++ executable

g++ -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

There are many files on a link line with some 3rd party libraries...

g++ -m64 -fPIC /vob/adc/router/core/DiameterAdapter.o
/vob/adc/router/core/DiameterAdapterThread.o \
/vob/adc/router/core/DiameterMessage.o
/vob/adc/router/core/ServerGroup.o /vob/adc/router/core/RoundRobin.o \
/vob/adc/router/core/HashRouting.o
/vob/adc/router/core/AlgorithmFactory.o
/vob/adc/router/core/DiameterConfigException.o \
/vob/adc/router/core/DiameterException.o
/vob/adc/router/core/DiameterMessageException.o
/vob/adc/router/core/RoutingEngine.o \
.
.
.
/vob/adc/router/framework/TraceLoggerThread.o \
-lsocket -lnsl -lpthread -L/vob/diameter/lib \
-L/vob/diameter/sctp/lib -L/vob/adc/router/thirdparty/boost/stage/lib \
-ldiameter -ldiamsctp -lboost_serialization -o ../bin/adc


wr


-----Original Message-----
From: Michael Schuster [mailto:michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org]
Sent: Tuesday, May 11, 2010 9:36 AM
To: William Reich
Cc: dtrace-discuss-***@public.gmane.org
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
as implied in the first email ( below ) ,
the only thing that I see as different between this particular process
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
I don't think this should be an issue ... but can you give some detail
on
how this executable is built?
Post by William Reich
b) the executable has at least 10 threads in it.
the executable doesn't have threads ;-) they're a property of the
running
process, but I know what you mean: that shouldn't be a problem, I just
tried tracing firefox, which has more, and had no issue.

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
William Reich
2010-05-11 17:27:51 UTC
Permalink
truss was not being used in this simple test.
Neither was gdb.

wr



-----Original Message-----

Isn't this what happens if a process is already being traced (e.g., by
truss)?

Nico
--

-----Original Message-----
From: dtrace-discuss-bounces-***@public.gmane.org
[mailto:dtrace-discuss-bounces-***@public.gmane.org] On Behalf Of William
Reich
Sent: Tuesday, May 11, 2010 9:58 AM
To: Michael Schuster
Cc: dtrace-discuss-***@public.gmane.org
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads

we use the g++ compiler for this c++ executable

g++ -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

There are many files on a link line with some 3rd party libraries...

g++ -m64 -fPIC /vob/adc/router/core/DiameterAdapter.o
/vob/adc/router/core/DiameterAdapterThread.o \
/vob/adc/router/core/DiameterMessage.o
/vob/adc/router/core/ServerGroup.o /vob/adc/router/core/RoundRobin.o \
/vob/adc/router/core/HashRouting.o
/vob/adc/router/core/AlgorithmFactory.o
/vob/adc/router/core/DiameterConfigException.o \
/vob/adc/router/core/DiameterException.o
/vob/adc/router/core/DiameterMessageException.o
/vob/adc/router/core/RoutingEngine.o \
.
.
.
/vob/adc/router/framework/TraceLoggerThread.o \
-lsocket -lnsl -lpthread -L/vob/diameter/lib \
-L/vob/diameter/sctp/lib -L/vob/adc/router/thirdparty/boost/stage/lib \
-ldiameter -ldiamsctp -lboost_serialization -o ../bin/adc


wr


-----Original Message-----
From: Michael Schuster [mailto:michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org]
Sent: Tuesday, May 11, 2010 9:36 AM
To: William Reich
Cc: dtrace-discuss-***@public.gmane.org
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
as implied in the first email ( below ) ,
the only thing that I see as different between this particular process
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
I don't think this should be an issue ... but can you give some detail
on
how this executable is built?
Post by William Reich
b) the executable has at least 10 threads in it.
the executable doesn't have threads ;-) they're a property of the
running
process, but I know what you mean: that shouldn't be a problem, I just
tried tracing firefox, which has more, and had no issue.

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
Trond Norbye
2010-05-11 17:31:41 UTC
Permalink
Post by William Reich
truss was not being used in this simple test.
Neither was gdb.
are you using watchmalloc or something else that utilize /proc ?

Trond
Post by William Reich
wr
-----Original Message-----
Isn't this what happens if a process is already being traced (e.g., by
truss)?
Nico
--
-----Original Message-----
Reich
Sent: Tuesday, May 11, 2010 9:58 AM
To: Michael Schuster
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
we use the g++ compiler for this c++ executable
g++ -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
There are many files on a link line with some 3rd party libraries...
g++ -m64 -fPIC /vob/adc/router/core/DiameterAdapter.o
/vob/adc/router/core/DiameterAdapterThread.o \
/vob/adc/router/core/DiameterMessage.o
/vob/adc/router/core/ServerGroup.o /vob/adc/router/core/RoundRobin.o \
/vob/adc/router/core/HashRouting.o
/vob/adc/router/core/AlgorithmFactory.o
/vob/adc/router/core/DiameterConfigException.o \
/vob/adc/router/core/DiameterException.o
/vob/adc/router/core/DiameterMessageException.o
/vob/adc/router/core/RoutingEngine.o \
.
.
.
/vob/adc/router/framework/TraceLoggerThread.o \
-lsocket -lnsl -lpthread -L/vob/diameter/lib \
-L/vob/diameter/sctp/lib -L/vob/adc/router/thirdparty/boost/stage/lib \
-ldiameter -ldiamsctp -lboost_serialization -o ../bin/adc
wr
-----Original Message-----
Sent: Tuesday, May 11, 2010 9:36 AM
To: William Reich
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
as implied in the first email ( below ) ,
the only thing that I see as different between this particular process
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
I don't think this should be an issue ... but can you give some detail
on
how this executable is built?
Post by William Reich
b) the executable has at least 10 threads in it.
the executable doesn't have threads ;-) they're a property of the
running
process, but I know what you mean: that shouldn't be a problem, I just
tried tracing firefox, which has more, and had no issue.
Michael
--
Recursion, n.: see 'Recursion'
_______________________________________________
dtrace-discuss mailing list
_______________________________________________
dtrace-discuss mailing list
William Reich
2010-05-11 18:26:28 UTC
Permalink
as far as I know - no

again, any other executable , say "hello world" , works with dtrace just
fine.

Only this one particular executable is not working with dtrace.

wr

-----Original Message-----
From: Trond Norbye [mailto:trond.norbye-***@public.gmane.org]
Sent: Tuesday, May 11, 2010 1:32 PM
To: William Reich
Cc: dtrace-discuss-***@public.gmane.org
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
truss was not being used in this simple test.
Neither was gdb.
are you using watchmalloc or something else that utilize /proc ?

Trond
Post by William Reich
wr
-----Original Message-----
Isn't this what happens if a process is already being traced (e.g., by
truss)?
Nico
--
-----Original Message-----
Reich
Sent: Tuesday, May 11, 2010 9:58 AM
To: Michael Schuster
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
we use the g++ compiler for this c++ executable
g++ -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
Post by William Reich
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
There are many files on a link line with some 3rd party libraries...
g++ -m64 -fPIC /vob/adc/router/core/DiameterAdapter.o
/vob/adc/router/core/DiameterAdapterThread.o \
/vob/adc/router/core/DiameterMessage.o
/vob/adc/router/core/ServerGroup.o /vob/adc/router/core/RoundRobin.o \
/vob/adc/router/core/HashRouting.o
/vob/adc/router/core/AlgorithmFactory.o
/vob/adc/router/core/DiameterConfigException.o \
/vob/adc/router/core/DiameterException.o
/vob/adc/router/core/DiameterMessageException.o
/vob/adc/router/core/RoutingEngine.o \
.
.
.
/vob/adc/router/framework/TraceLoggerThread.o \
-lsocket -lnsl -lpthread -L/vob/diameter/lib \
-L/vob/diameter/sctp/lib -L/vob/adc/router/thirdparty/boost/stage/lib \
-ldiameter -ldiamsctp -lboost_serialization -o ../bin/adc
wr
-----Original Message-----
Sent: Tuesday, May 11, 2010 9:36 AM
To: William Reich
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
as implied in the first email ( below ) ,
the only thing that I see as different between this particular process
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
I don't think this should be an issue ... but can you give some detail
on
how this executable is built?
Post by William Reich
b) the executable has at least 10 threads in it.
the executable doesn't have threads ;-) they're a property of the
running
process, but I know what you mean: that shouldn't be a problem, I just
tried tracing firefox, which has more, and had no issue.
Michael
--
Recursion, n.: see 'Recursion'
_______________________________________________
dtrace-discuss mailing list
_______________________________________________
dtrace-discuss mailing list
Yosef Lev (Sun Labs, Oracle)
2010-05-11 19:00:30 UTC
Permalink
I'm not sure what the problem might be (except for the process being
traced by another program), but have you tried letting DTrace run the
executable for you (with the "-c" switch)?

To do that, you'll have to replace $1 with $target in your DTrace
script, and then run it as follows:

dtrace -s <script file> -c '<command to run your executable>'

DTrace will create a process to run the command specified after the '-c'
switch, assign the pid to $target and pass it to your script.

Cheers,
Yossi
Post by William Reich
as far as I know - no
again, any other executable , say "hello world" , works with dtrace just
fine.
Only this one particular executable is not working with dtrace.
wr
-----Original Message-----
Sent: Tuesday, May 11, 2010 1:32 PM
To: William Reich
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
truss was not being used in this simple test.
Neither was gdb.
are you using watchmalloc or something else that utilize /proc ?
Trond
Post by William Reich
wr
-----Original Message-----
Isn't this what happens if a process is already being traced (e.g., by
truss)?
Nico
--
-----Original Message-----
Reich
Sent: Tuesday, May 11, 2010 9:58 AM
To: Michael Schuster
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
we use the g++ compiler for this c++ executable
g++ -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
Post by William Reich
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
There are many files on a link line with some 3rd party libraries...
g++ -m64 -fPIC /vob/adc/router/core/DiameterAdapter.o
/vob/adc/router/core/DiameterAdapterThread.o \
/vob/adc/router/core/DiameterMessage.o
/vob/adc/router/core/ServerGroup.o /vob/adc/router/core/RoundRobin.o \
/vob/adc/router/core/HashRouting.o
/vob/adc/router/core/AlgorithmFactory.o
/vob/adc/router/core/DiameterConfigException.o \
/vob/adc/router/core/DiameterException.o
/vob/adc/router/core/DiameterMessageException.o
/vob/adc/router/core/RoutingEngine.o \
.
.
.
/vob/adc/router/framework/TraceLoggerThread.o \
-lsocket -lnsl -lpthread -L/vob/diameter/lib \
-L/vob/diameter/sctp/lib -L/vob/adc/router/thirdparty/boost/stage/lib
\
Post by William Reich
-ldiameter -ldiamsctp -lboost_serialization -o ../bin/adc
wr
-----Original Message-----
Sent: Tuesday, May 11, 2010 9:36 AM
To: William Reich
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
as implied in the first email ( below ) ,
the only thing that I see as different between this particular
process
Post by William Reich
Post by William Reich
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
I don't think this should be an issue ... but can you give some detail
on
how this executable is built?
Post by William Reich
b) the executable has at least 10 threads in it.
the executable doesn't have threads ;-) they're a property of the
running
process, but I know what you mean: that shouldn't be a problem, I just
tried tracing firefox, which has more, and had no issue.
Michael
--
Recursion, n.: see 'Recursion'
_______________________________________________
dtrace-discuss mailing list
_______________________________________________
dtrace-discuss mailing list
_______________________________________________
dtrace-discuss mailing list
William Reich
2010-05-11 19:14:07 UTC
Permalink
yes, this was attempted.
The program ran for a short time ( 2 seconds ? ) and then just stopped
- back to the prompt.

-----Original Message-----
From: Yosef Lev (Sun Labs, Oracle) [mailto:yossi.lev-QHcLZuEGTsvQT0dZR+***@public.gmane.org]
Sent: Tuesday, May 11, 2010 3:01 PM
To: William Reich
Cc: Trond Norbye; dtrace-discuss-***@public.gmane.org
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads

I'm not sure what the problem might be (except for the process being
traced by another program), but have you tried letting DTrace run the
executable for you (with the "-c" switch)?

To do that, you'll have to replace $1 with $target in your DTrace
script, and then run it as follows:

dtrace -s <script file> -c '<command to run your executable>'

DTrace will create a process to run the command specified after the '-c'
switch, assign the pid to $target and pass it to your script.

Cheers,
Yossi
Post by William Reich
as far as I know - no
again, any other executable , say "hello world" , works with dtrace just
fine.
Only this one particular executable is not working with dtrace.
wr
-----Original Message-----
Sent: Tuesday, May 11, 2010 1:32 PM
To: William Reich
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
truss was not being used in this simple test.
Neither was gdb.
are you using watchmalloc or something else that utilize /proc ?
Trond
Post by William Reich
wr
-----Original Message-----
Isn't this what happens if a process is already being traced (e.g., by
truss)?
Nico
--
-----Original Message-----
Reich
Sent: Tuesday, May 11, 2010 9:58 AM
To: Michael Schuster
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
we use the g++ compiler for this c++ executable
g++ -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
Post by William Reich
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
There are many files on a link line with some 3rd party libraries...
g++ -m64 -fPIC /vob/adc/router/core/DiameterAdapter.o
/vob/adc/router/core/DiameterAdapterThread.o \
/vob/adc/router/core/DiameterMessage.o
/vob/adc/router/core/ServerGroup.o /vob/adc/router/core/RoundRobin.o \
/vob/adc/router/core/HashRouting.o
/vob/adc/router/core/AlgorithmFactory.o
/vob/adc/router/core/DiameterConfigException.o \
/vob/adc/router/core/DiameterException.o
/vob/adc/router/core/DiameterMessageException.o
/vob/adc/router/core/RoutingEngine.o \
.
.
.
/vob/adc/router/framework/TraceLoggerThread.o \
-lsocket -lnsl -lpthread -L/vob/diameter/lib \
-L/vob/diameter/sctp/lib -L/vob/adc/router/thirdparty/boost/stage/lib
\
Post by William Reich
-ldiameter -ldiamsctp -lboost_serialization -o ../bin/adc
wr
-----Original Message-----
Sent: Tuesday, May 11, 2010 9:36 AM
To: William Reich
Subject: Re: [dtrace-discuss] dtrace / c++ / lots of threads
Post by William Reich
as implied in the first email ( below ) ,
the only thing that I see as different between this particular
process
Post by William Reich
Post by William Reich
and any other
is that
a) the executable is 8.5 megs as it sits on the disk
I don't think this should be an issue ... but can you give some detail
on
how this executable is built?
Post by William Reich
b) the executable has at least 10 threads in it.
the executable doesn't have threads ;-) they're a property of the
running
process, but I know what you mean: that shouldn't be a problem, I just
tried tracing firefox, which has more, and had no issue.
Michael
--
Recursion, n.: see 'Recursion'
_______________________________________________
dtrace-discuss mailing list
_______________________________________________
dtrace-discuss mailing list
_______________________________________________
dtrace-discuss mailing list
Michael Schuster
2010-05-12 06:19:25 UTC
Permalink
Post by William Reich
as far as I know - no
again, any other executable , say "hello world" , works with dtrace just
fine.
Only this one particular executable is not working with dtrace.
IIRC, it was a fairly complex beast. can you reduce it to the minimal set
that still exhibits this behaviour, maybe thereby showing the difference
that causes this to happpen?

Michael
--
michael.schuster-QHcLZuEGTsvQT0dZR+***@public.gmane.org http://blogs.sun.com/recursion
Recursion, n.: see 'Recursion'
Nicolas Williams
2010-05-11 17:07:35 UTC
Permalink
Post by William Reich
only this process fails -
./adc.d 24930
dtrace: failed to compile script ./adc.d: line 7: failed to grab process 24930
Isn't this what happens if a process is already being traced (e.g., by
truss)?

Nico
--
Loading...