DTrace complains about struct thread - FreeBSD

This is a discussion on DTrace complains about struct thread - FreeBSD ; 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/...ok.html#DTRACE I added these options to my kernel config: ,---- | options KDTRACE_HOOKS | options DDB_CTF | options KDTRACE_FRAME `---- And rebuilt ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: DTrace complains about struct thread

  1. DTrace complains about struct thread

    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/...ok.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/...#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 (curthread->td_proc);
    `----

    ,----
    | # uname -a
    | FreeBSD casibsd 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Tue Oct 14
    | 11:40:44 CEST 2008 root@casibsd:/usr/obj/usr/src/sys/CASIBSD_CONF
    | amd64
    `----

    What am I doing wrong?


    --
    Lionel Flandrin
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  2. Re: DTrace complains about struct thread

    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/...ok.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/...#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 (curthread->td_proc);
    > > `----
    > >
    > > ,----
    > > | # uname -a
    > > | FreeBSD casibsd 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Tue Oct 14
    > > | 11:40:44 CEST 2008 root@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
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  3. Re: DTrace complains about struct thread

    On Wed, Oct 15, 2008 at 08:36:58PM +0400, swell.k@gmail.com wrote:
    > I believe only kernel should be rebuilt with WITH_CTF=1 since there is
    > no userland tracing yet.
    >
    > Try building world as usual and enable WITH_CTF only for kernel, then
    > rerun the test.


    Ok, so i rebuilt everything using WITH_CTF only for
    build/installkernel.

    It fixed my "abort" problem with gcc (I guess it didn't like the
    additional CTF section in the ELF), but I still get the "failed to
    resolve type kernel`struct thread" error when I run dtrace. I tried
    with "hotkernel" from the DTraceToolkit-0.99 and several one liner
    syscall tracing. Always the same error message.

    --
    Lionel Flandrin
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  4. Re: DTrace complains about struct thread

    Lionel Flandrin wrote:
    > On Wed, Oct 15, 2008 at 08:36:58PM +0400, swell.k@gmail.com wrote:
    >> I believe only kernel should be rebuilt with WITH_CTF=1 since there is
    >> no userland tracing yet.
    >>
    >> Try building world as usual and enable WITH_CTF only for kernel, then
    >> rerun the test.

    >
    > Ok, so i rebuilt everything using WITH_CTF only for
    > build/installkernel.
    >
    > It fixed my "abort" problem with gcc (I guess it didn't like the
    > additional CTF section in the ELF), but I still get the "failed to
    > resolve type kernel`struct thread" error when I run dtrace. I tried
    > with "hotkernel" from the DTraceToolkit-0.99 and several one liner
    > syscall tracing. Always the same error message.
    >


    Yes, this 'struct thread' error message is a regression in HEAD. It
    is not present in FreeBSD 7.1, so I'd recommend that you focus on
    that if at all possible. I don't know where the regression is or how
    to fix it, but hopefully John Birrell will take notice and help out.

    Scott

    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  5. Re: DTrace complains about struct thread

    On Wed, Oct 15, 2008 at 07:55:31PM -0600, Scott Long wrote:
    > Yes, this 'struct thread' error message is a regression in HEAD. It
    > is not present in FreeBSD 7.1, so I'd recommend that you focus on
    > that if at all possible. I don't know where the regression is or how
    > to fix it, but hopefully John Birrell will take notice and help out.
    >
    > Scott
    >


    Thanks for your help.

    What do you mean exactly by FreeBSD 7.1 ? 7.1-BETA2 ? Because I *am*
    running RELENG_7:

    FreeBSD casibsd 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Wed Oct 15
    23:23:28 CEST 2008 root@casibsd:/usr/obj/usr/src/sys/CASIBSD_CONF
    amd64

    --
    Lionel Flandrin
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


+ Reply to Thread