Re: DTrace complains about struct thread

From: Lionel Flandrin <simias.n_at_gmail.com>
Date: Wed, 15 Oct 2008 17:34:24 +0200
On Wed, Oct 15, 2008 at 02:39:53PM +0200, Roman Divacky wrote:
> On Wed, Oct 15, 2008 at 11:04:53AM +0200, Lionel Flandrin wrote:
> > I tried to play with DTrace on a fresh FreeBSD 7.1, so I followed the
> > steps described here:
> > http://www.freebsd.org/doc/en/books/handbook/book.html#DTRACE
> > 
> > I added these options to my kernel config:
> > ,----
> > | options KDTRACE_HOOKS
> > | options DDB_CTF
> > | options KDTRACE_FRAME
> > `----
> > 
> > And rebuilt everything with "WITH_CTF=1"
> > (http://www.freebsd.org/doc/en/books/handbook/book.html#DTRACE-ENABLE
> > says make *WITH_CTF*=1 buildworld and then make *WITH_CFT* afterwards,
> > is it a typo? If not I think it should be more explicit because it
> > really looks like one).
> > 
> > I restarted the computer, kldloaded the dtraceall module and dtrace -l
> > seems to work right:
> > ,----
> > | # dtrace -l | wc -l
> > |    25825
> > `----
> > 
> > However, whenever I try to trace something, I get:
> > ,----
> > | # dtrace -n 'proc:::exec-success { trace(curpsinfo->pr_psargs); }'
> > | dtrace: invalid probe specifier proc:::exec-success {
> > | trace(curpsinfo->pr_psargs); }:
> > | "/usr/lib/dtrace/psinfo.d", line 88:
> > | failed to resolve type kernel`struct thread * for identifier
> > | curthread: Unknown type name
> > `----
> > 
> > Same message with ./hotkernel from the DTraceToolkit and everything
> > else I've tried:
> > ,----
> > | "/usr/lib/dtrace/psinfo.d", line 88: failed to resolve type
> > | kernel`struct thread * for identifier curthread: Unknown type name
> > `----
> > 
> > line 88 of /usr/lib/dtrace/psinfo.d is:
> > ,----
> > | inline psinfo_t *curpsinfo = xlate <psinfo_t *> (curthread->td_proc);
> > `----
> > 
> > ,----
> > | # uname -a
> > | FreeBSD casibsd 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Tue Oct 14
> > | 11:40:44 CEST 2008 root_at_casibsd:/usr/obj/usr/src/sys/CASIBSD_CONF
> > | amd64
> > `----
> > 
> > What am I doing wrong?
> 
> if I am not mistaken FreeBSD currently does not support userland tracing.
> this might be the cause, though the error message is strange
> 
> roman

Mmmh, and I've just noticed that gcc aborts when I try to execute it
(but not g++):

,----
| $ /usr/bin/gcc
| Abort trap
| $ objdump -h /usr/bin/gcc
| 
| /usr/bin/gcc:     file format elf64-x86-64
| 
| Sections:
| Idx Name          Size      VMA               LMA               File off  Algn
|   0 .init         00000013  0000000000400100  0000000000400100  00000100  2**2
|                   CONTENTS, ALLOC, LOAD, READONLY, CODE
|   1 .text         0003422e  0000000000400120  0000000000400120  00000120  2**4
|                   CONTENTS, ALLOC, LOAD, READONLY, CODE
|   2 .fini         0000000e  0000000000434350  0000000000434350  00034350  2**2
|                   CONTENTS, ALLOC, LOAD, READONLY, CODE
|   3 .rodata       0001972e  0000000000434360  0000000000434360  00034360  2**5
|                   CONTENTS, ALLOC, LOAD, READONLY, DATA
|   4 .data         000039a8  000000000054e000  000000000054e000  0004daa0  2**5
|                   CONTENTS, ALLOC, LOAD, DATA
|   5 .eh_frame     00005038  00000000005519a8  00000000005519a8  00051448  2**3
|                   CONTENTS, ALLOC, LOAD, READONLY, DATA
|   6 .ctors        00000010  00000000005569e0  00000000005569e0  00056480  2**3
|                   CONTENTS, ALLOC, LOAD, DATA
|   7 .dtors        00000018  00000000005569f0  00000000005569f0  00056490  2**3
|                   CONTENTS, ALLOC, LOAD, DATA
|   8 .jcr          00000008  0000000000556a08  0000000000556a08  000564a8  2**3
|                   CONTENTS, ALLOC, LOAD, DATA
|   9 .bss          00004f40  0000000000556a20  0000000000556a20  000564c0  2**5
|                   ALLOC
|  10 .comment      00003c35  0000000000000000  0000000000000000  000564c0  2**0
|                   CONTENTS, READONLY
|  11 .note.ABI-tag 00000018  00000000004000e8  00000000004000e8  000000e8  2**2
|                   CONTENTS, ALLOC, LOAD, READONLY, DATA
|  12 .SUNW_ctf     00000c4f  0000000000000000  0000000000000000  0005a0f8  2**2
|                   CONTENTS, READONLY
`----

Well, I guess I'll try dtrace again some other day then...

-- 
Lionel Flandrin
Received on Wed Oct 15 2008 - 13:34:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:36 UTC