Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Sep 2013 16:49:56 -0700
From:      Shrikanth Kamath <shrikanth07@gmail.com>
To:        freebsd-hackers@freebsd.org, freebsd-dtrace@freebsd.org
Subject:   Glitch in ctfconvert
Message-ID:  <CAEOAkMXKjNN=_dGRQSzhHK85KD4sMHK7g9f_Cj8qCgJ2gGXKPQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
There is a glitch with ctfconvert builds the .SUNW_ctf section. It affects
debugging the kernel modules with FBT provider of DTrace.

I observe that the CTF sections built for the kernel modules have a
problem if module symtab stripped or if the symbol table has symbols
reordered. This messes up the FBT probes and shows wrong function name against a
set of arguments.

I presume the ctf mapping of a function to its arguments is done this way after
looking at ctfdump code.

func_name from symtab           arguments dump from ctf_data_t
         ^                                                        ^
         |___symidx____ctfdump_____________|

The detais are fetched from two different places. So when ctfconvert is run the
function arguments are mapped with a particular symbol order.

Post the linker stage the symbols may get reordered. Or if a strip utility is
run the symtab may be removed completely.

When first ctfconvert is run on module.kld
        symbol_X (idx 1)        <-> [args set a in ctf_data_t]
        symbol_Y (idx 2)        <-> [args set b in ctf_data_t]

if symbols get re-arranged post the linker stage

        symbol_Y (idx 1)        <-> [args set a in ctf_data_t]
        symbol_X (idx 2)        <-> [args set b in ctf_data_t]

which means symbol_Y now has args set of symbol_X
Or if 'strip' is run it has totally junk shown against symbol_Y and symbol_X.

Overall this affects when we do a Function Boundary Tracing on the functions to
inspect arguments.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAEOAkMXKjNN=_dGRQSzhHK85KD4sMHK7g9f_Cj8qCgJ2gGXKPQ>