From owner-freebsd-hackers@freebsd.org Sun Oct 21 21:46:08 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0CB310375D1 for ; Sun, 21 Oct 2018 21:46:08 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 538B579FF1; Sun, 21 Oct 2018 21:46:08 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f177.google.com with SMTP id x3-v6so35132463lji.13; Sun, 21 Oct 2018 14:46:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3ekOnP5FYMvK2rIgqcb/GI1Cg0GIl2Cqix8tbhwbEm8=; b=lTIBAygcX+QdvgxfL9f9wjpD2GI+vELWiZ4o5VwtqeUqHHDvbbXAtUfuNMBFqZX8O9 DUrSviTY825QGU2XJuV4c1pZp0ERuOK1XlRdvG5Gf4a968PRuZ0cDnvtzM6PJR3X5ooa tGV4StKvAS2w0fI6EI9M5TiFRjMjiMUgoaj2Eay4+x/DsJRdHS8qrBKXX2uxcayaX/nB BR42JB1FSKgy/cMnFkv5Yr8ZrL0z40w6nYZS/dcLhlBBhea4OnzABsqx2wS1S4CMv2c3 vj/eyFfB6VQDYSCE7oWXHiiWGT8jbsVSFmiWLh6eKab1VYZLTDqwPzgfvbnjcF+b5XEt cORQ== X-Gm-Message-State: ABuFfogFTr99Q/C30R93XtArT9ZI0/HAca0/sMPQm1p/P8yZEstNZXVC AkWQE2FGIHDjxb+3j5eDoFhezwy7LgFxiyGr+pKjotsS X-Google-Smtp-Source: ACcGV62es0S3kliv0OJ/PJ9SYSlKKGhZauGXaVPsO/LAsuqfkGuEHpenQ3FyAnIUzhSW5RXLi7/Ei8vu/YWfZyc9plc= X-Received: by 2002:a2e:9c89:: with SMTP id x9-v6mr28058342lji.110.1540156957602; Sun, 21 Oct 2018 14:22:37 -0700 (PDT) MIME-Version: 1.0 References: <170994671.20181021201021@serebryakov.spb.ru> <4210174731.20181021202652@serebryakov.spb.ru> In-Reply-To: <4210174731.20181021202652@serebryakov.spb.ru> From: Alan Somers Date: Sun, 21 Oct 2018 15:22:25 -0600 Message-ID: Subject: Re: What is wrong with dtrace's stack()? To: Lev Serebryakov Cc: cse.cem@gmail.com, "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Oct 2018 21:46:09 -0000 On Sun, Oct 21, 2018 at 11:27 AM Lev Serebryakov 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" >