Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Oct 2018 15:22:25 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        Lev Serebryakov <lev@freebsd.org>
Cc:        cse.cem@gmail.com,  "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: What is wrong with dtrace's stack()?
Message-ID:  <CAOtMX2gKNbSRgMGnTdaOzvL7V3o%2B5HRJh-MM5DLUvezD4EFsaQ@mail.gmail.com>
In-Reply-To: <4210174731.20181021202652@serebryakov.spb.ru>
References:  <170994671.20181021201021@serebryakov.spb.ru> <CAG6CVpVCe-8OVU%2BKEyAh8swFSAjRshNcNLN0tjAS3W8bZxyrTA@mail.gmail.com> <4210174731.20181021202652@serebryakov.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 21, 2018 at 11:27 AM Lev Serebryakov <lev@freebsd.org> wrote:

> Hello Conrad,
>
> Sunday, October 21, 2018, 8:21:43 PM, you wrote:
>
> > Your assembler dump offsets are in decimal.
>  Ooops!
>

Also, rather than inspecting the assembly, you can fire up kgdb and type
(kgdb) list *(soo_write+0x33)
And it will tell you the corresponding source line.


>
> >  Look for offset 0x33 = +51, not +33.
>  It is call to sosend(), which could call many other things, but why it is
> missed at stack output!?
>

dtrace doesn't have visibility into functions that get automatically
inlined.  So effectively it leaves out some stack frames.  Also, dtrace
doesn't indicate when a function got called via a function pointer as
opposed to a direct call.  ipsec_hdrsiz_input, for example, gets called
only via function pointers, referenced by the IPSEC_HDRSIZE macro.  That,
in turn, is called by tcp_output.  Finally, if the compiler uses a tail
call optimization, then dtrace won't see the tail caller's stack frame.  In
your case, it looks like there are several layers that are invisible to
dtrace.  The true stack probably looks something like this:

soo_write->sosend->sosend_generic (via pru_sosend function
pointer)->tcp_usr_send(via pru_send function pointer)->tcp_output(via
tfb_tcp_output function pointer)->IPSEC_HDRSIZE->ipsec_hdrsiz_inpcb (via
hdrsiz function pointer)

Hope that helps.
-Alan


>
> --
> Best regards,
>  Lev                            mailto:lev@FreeBSD.org
>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2gKNbSRgMGnTdaOzvL7V3o%2B5HRJh-MM5DLUvezD4EFsaQ>