decoding of multi-byte nops in dtrace

perryh at pluto.rain.com perryh at pluto.rain.com
Mon Jun 11 04:01:15 UTC 2012


Andriy Gapon <avg at freebsd.org> wrote:
> on 10/06/2012 23:40 Ryan Stone said the following:
> > On Sun, Jun 10, 2012 at 12:38 PM, Andriy Gapon <avg at freebsd.org>
> > wrote:
> >> Do you use -O2 or higher optimization for kernel/modules build?
> >> I use only -O1.
> >>
> >> Here are some stats from my system:
> >> $ dtrace -ln fbt::: | fgrep -c entry
> >> 16876
> >> $ dtrace -ln fbt::: | fgrep -c return
> >> 16729
> >>
> >> So, 147 functions without return probe.
> > 
> > Try re-compiling with -foptimize-sibling-calls.  That enables
> > the tail call optimization in gcc, and therefore you get many
> > functions with no ret instruction (and thus no return probe in
> > DTrace)

Sounds as if DTrace could use an improvement to recognize and handle
the tail call optimization, maybe something along the lines of:

    If a function has no otherwise-determined return probe
    and it contains a jump to the entry point of another function
    then it inherits that other function's return probe.

I'd expect that to handle cases like

    int bar(...)
    {
        ...
        return baz;
    }

    int foo(...)
    {
        ...
        return bar(...);
    }

(although probably not cases where the return in foo calls a
function pointer).  And no, I am not volunteering to add it --
ENOTIME :(


More information about the freebsd-hackers mailing list