your mail

Mark Johnston markj at freebsd.org
Tue Nov 12 04:18:13 UTC 2013


On Tue, Nov 12, 2013 at 12:03:05PM +0800, Prashanth Kumar wrote:
> Hello, 
> 
> I had been doing some work on the pid provider in Dtrace.

Hi Prashanth,

I've been going through your patches and committing them as time permits.

>  I have made a few modification
>  so that it will list all the functions used in the program as seen in Solaris or MacOSX.
>  Presently in FreeBSD, you have to name each functions you have to probe in the program. For
>  example "dtrace -n 'pid$target:program::entry' -c ./program" will list all the functions called
>  in the program.This modification was made in libproc library(proc_sym.c).

This has been fixed:

http://svnweb.freebsd.org/base?view=revision&revision=257300
http://svnweb.freebsd.org/base?view=revision&revision=258000

> 
>             Also while creating probe points for return probe type, any function with more than one return
>  path will fail.This is because "fasttrap_probe_spec_t" type variable is not fully copied into the
>  kernel in fasttrap_ioctl() function.I have modified in line with Solaris code where the copying  is
>  done manually by Dtrace, rather than the kernel.(fasttap.c, fasttrap.h)

I'm working on this one.

>  Also in "fasttrap_pid_probe()" (fasttrap_isa.c) for the case of "FASTTRAP_T_PUSHL_EBP", the ebp register
>  has to be copied to the stack not esp.
>         I had attached the patch files for review.

This has been fixed:

http://svnweb.freebsd.org/base?view=revision&revision=257679
http://svnweb.freebsd.org/base?view=revision&revision=257143

> 
>  One other issue i noticed is that if the program being traced uses Thread Local Storage than
>  for the case of entry probe, it will hang in ___tls_get_addr function in ld-elf.so.
>  If you use scanf or fscanf in your program you can notice this behaviour. This i believe is due to
>  Dtrace using gs segment register to point to the scratch space, and TLS also loading the thread variable
>  from gs register.

I haven't been able to reproduce this one yet. If you can send me a
program and D script that does the trick, that'd be very helpful.

> 
>  if you change the following code in fasttrap_isa.c
>  <code>
>  #ifdef __i386__
>          addr = USD_GETBASE(&curthread->td_pcb->pcb_gsd);
>  #else
>          addr = curthread->td_pcb->pcb_gsbase;
>  #endif
>          addr += sizeof (void *);   
>  </code>
> 
>  to
> 
>  <code>
>  #ifdef __i386__
>          addr = USD_GETBASE(&curthread->td_pcb->pcb_gsd);
>  #else
>          addr = curthread->td_pcb->pcb_gsbase;
>  #endif
>          addr += sizeof (void *) * 3;   
>  </code>
> 
>  the Dtrace will not hang. I am not sure what is happening here and
>  whether this is the correct solution.

Neither am I. :)

>  This changes were made in FreeBSD 9.2-386-RELEASE. I applied the above patches on
>  FreeBSD 10-BETA (with some manual work) and it was still working.
> _______________________________________________
> freebsd-dtrace at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace
> To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe at freebsd.org"


More information about the freebsd-dtrace mailing list