From owner-freebsd-dtrace@FreeBSD.ORG Tue Mar 11 16:00:14 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C9351872 for ; Tue, 11 Mar 2014 16:00:14 +0000 (UTC) Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9E2188A0 for ; Tue, 11 Mar 2014 16:00:14 +0000 (UTC) Received: by mail-pb0-f49.google.com with SMTP id jt11so8956431pbb.36 for ; Tue, 11 Mar 2014 09:00:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=gkH9936h57oUQ5+++BJkXyyWZNirMTKDmLB25qghtwY=; b=hOC69YQfrlp28guJOo0DbFnOcjfQCJqUgBPNNsAfHxgzPc5l0Z0+SLThmSP/iSLhqY DnobhhDZhmX7o3YRdbdDoDpy8f7Qm4f5HdwChyrwpmHqKN6V8JNG7iDBTMlUFhOPmnDa PlaeMh49m02l0KGzd9EeizBmTjJG6BH4g4CokMSTPg6At4CYt4iBTK9nbrjZyLEnB//t 9wMmlqUgWzmGpH44uHzhdjlHVNEVIIktMfDSKrp6rCxTrcy2vLWn3HoYoB9VoeZFizBH mjV/X/29ZVALnclyCY35QBpFcYaDZ6Fdb+jj900B/Vf/PFo+YURED/PrVAb/Udvaslof IP4Q== X-Gm-Message-State: ALoCoQkyfGzbF2DKLk/V+KSYHu4nbABXacWGTzGJ+Gu3vvUX+eAj75Xko7w9uduqUBerGtA+cykG X-Received: by 10.68.170.36 with SMTP id aj4mr48863064pbc.54.1394553605920; Tue, 11 Mar 2014 09:00:05 -0700 (PDT) Received: from [10.138.0.3] (c-67-180-178-113.hsd1.ca.comcast.net. [67.180.178.113]) by mx.google.com with ESMTPSA id q7sm75620270pbc.20.2014.03.11.09.00.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Mar 2014 09:00:03 -0700 (PDT) Message-ID: <531F3302.8010106@joyent.com> Date: Tue, 11 Mar 2014 09:00:02 -0700 From: Robert Mustacchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: freebsd-dtrace@freebsd.org Subject: Re: dtracing static symbols References: <1394514256.45492.YahooMailBasic@web192604.mail.sg3.yahoo.com> <7C202659-0BD9-4F93-8886-24DD7AEB495F@gsoft.com.au> In-Reply-To: <7C202659-0BD9-4F93-8886-24DD7AEB495F@gsoft.com.au> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Mar 2014 16:00:14 -0000 On 03/10/2014 10:34 PM, Daniel O'Connor wrote: > > On 11 Mar 2014, at 15:34, Prashanth Kumar wrote: >> If the binary being traced has static symbols in its symbol table, DTrace should >> be able to trace the function. Can you describe the example where you found this >> difference in FreeBSD and OSX? > > Unfortunately the static symbols don't show up in the symbol table (as shown by nm). > > Is there a compile or link flag which will change that? Because it's a static function the compiler may inline it, which may be why you don't actually see an entry in nm nor that it can be found by DTrace. You'll want to look at the disassembled output of your program to see if it was inlined. Different compilers can and will do different things. There generally are flags you can pass to the compiler to tell it not to inline it, but that's compiler specific. > On OSX you see.. > ... > 956613 pid46749 static foo return > 956614 pid46749 static foo entry > 956615 pid46749 static foo 0 > 956616 pid46749 static foo 1 > 956617 pid46749 static foo 4 > 956618 pid46749 static foo 8 > 956619 pid46749 static foo f > 956620 pid46749 static foo 11 > 956621 pid46749 static foo 16 > 956622 pid46749 static foo 19 > 956623 pid46749 static foo 1d > 956624 pid46749 static foo 1e > .. > > (I'm not sure what the various numbers mean) The pid provider can instrument any instruction in a function, those are the instruction offsets. Robert