From owner-freebsd-dtrace@freebsd.org Tue Jun 7 19:09:52 2016 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E2A6B6EDE5 for ; Tue, 7 Jun 2016 19:09:52 +0000 (UTC) (envelope-from shrikanth07@gmail.com) Received: from mail-oi0-x244.google.com (mail-oi0-x244.google.com [IPv6:2607:f8b0:4003:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18B731FFE for ; Tue, 7 Jun 2016 19:09:52 +0000 (UTC) (envelope-from shrikanth07@gmail.com) Received: by mail-oi0-x244.google.com with SMTP id r4so13034970oib.1 for ; Tue, 07 Jun 2016 12:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=jr0BoxxwK9gJ41C9Nk2Yf5FtOafHxh0pAwB7noCznxY=; b=cpyB5tD1A7m0qfE/bd64YjgCxLxqP4T7Gowkp37UJtqrywRj31CaTv+hgxf6sx3Dxq 5A/+TlUXidY1293RV+iKSZ6l24sTpE3oxukEBhO1nfEHyE2wJy4OyuV48JJUt431b/9i jr70/sLdQTRQY7ZcuuUvmBURXFSW31djr5c8A1iA/fwzYPYJ4I0ei5YBHi3NGAnWbm+p lx1pqbKCSMyIzEHOWIkk0wbtamGZvYZ+uL7z+bvD/gWYFEn+uc9Sew3sXYzcoVo1Igjf VE33cjsX5IPcALbYuVPRho7DidxoQKpVpOrTy7Z3dt5nraa3cOVA8aSh4rekyd0xQJhw Uagw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=jr0BoxxwK9gJ41C9Nk2Yf5FtOafHxh0pAwB7noCznxY=; b=YlZqGOWpYEdFZgk2UQiQthcAh2ffabJ/BMOpdKSM79CIVeOfIeKVHkZ0I9Unhb4Vps 9lRTH2we713JGIhLXwVlG9+Fs6jC7HTaJTy0VPFzXQsIn4XrwzXuJnoKWD1aC3+svGeN 4JgPFvhYZOTGNwdifb/OiXtyM0iH/IfIqvsowq/pkuJihdizTB8c6WQn3NdjnughRoZq tO8Juqp8CH9Rne+Gss8bnHAfO4Um2IE6Q1PFn3/iMGB7gEN+8DZoO148vHjJHe95TVHx m096ivg1SYrFLcYBwFmk1mIzJC09YLud3UZCiHOXXFmedE2GR/2EFrptInXmm+SHPBO1 zupw== X-Gm-Message-State: ALyK8tKTzIAl3iO2usw6tCfvfA8uOjIh7IZfUBisPWt0KYeMcrod5OOlVAiq2hRXTI6cUAk7YBMsenFjX03X+w== X-Received: by 10.202.252.137 with SMTP id a131mr720668oii.58.1465326591133; Tue, 07 Jun 2016 12:09:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.63.70 with HTTP; Tue, 7 Jun 2016 12:09:50 -0700 (PDT) From: Shrikanth Kamath Date: Tue, 7 Jun 2016 12:09:50 -0700 Message-ID: Subject: Problem mapping multiple definitions of a structure coming from different modules To: freebsd-dtrace@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.22 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, 07 Jun 2016 19:09:52 -0000 I have two drivers loaded if_igb.ko and if_em.ko on a machine and both expose a different definition of struct tx_ring, so if we look at the CTF sections of both drivers they have the individual definitions of struct tx_ring. Now when we run a dtrace probe I see the following error, #dtrace -n 'fbt::igb_start_locked:entry { printf("%d\n", args[0]->num_desc); } ' dtrace: invalid probe specifier fbt::igb_start_locked:entry { printf("%d\n", args[0]->num_desc); } : in action list: num_desc is not a member of struct tx_ring The problem is definition of struct tx_ring in if_igb.ko does contain member num_desc but dtrace when it starts reads the symbols from if_em.ko first and then from if_igb.ko, guess this is what is causing dtrace to report that num_desc is not part of struct tx_ring. The order in which it read the symbols from modules ... libdtrace DEBUG: loaded if_em.ko [.SUNW_ctf] (17182 bytes) libdtrace DEBUG: loaded if_em.ko [.symtab] (25704 bytes) libdtrace DEBUG: loaded if_em.ko [.strtab] (25690 bytes) libdtrace DEBUG: hashed if_em.ko [.symtab] (1058 symbols) libdtrace DEBUG: sorted if_em.ko [.symtab] (880 symbols) libdtrace DEBUG: loaded CTF container for if_em.ko (0xc56c80) libdtrace DEBUG: loaded if_igb.ko [.SUNW_ctf] (17403 bytes) libdtrace DEBUG: loaded if_igb.ko [.symtab] (22536 bytes) libdtrace DEBUG: loaded if_igb.ko [.strtab] (22595 bytes) libdtrace DEBUG: hashed if_igb.ko [.symtab] (926 symbols) libdtrace DEBUG: sorted if_igb.ko [.symtab] (746 symbols) ... Is there a way for dtrace to map the definition that we are asking to the module probes that we use. To put plainly if my probe was from if_igb then we should try to resolve struct tx_ring from if_igb first. I am not very familiar but I guess dtrace is handicapped because of the order in which linker passes these files to it. But yeah should this be a genuine bug? -- Shrikanth R K From owner-freebsd-dtrace@freebsd.org Wed Jun 8 13:32:16 2016 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30D56B6F87E for ; Wed, 8 Jun 2016 13:32:16 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0BF81D07 for ; Wed, 8 Jun 2016 13:32:15 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by mail-io0-x244.google.com with SMTP id 5so1277529ioy.0 for ; Wed, 08 Jun 2016 06:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GJiegQezBnHRSogVnqjAcb6pyt8+2sxIJk9sY4i8PG8=; b=G0rwhbMW5UoViX1isaMshv/HI56TP+fd4M8Joz9gXwbkxzGDbFXXFikPW9Jz9Ly6iU 2d4uDxANdZ2Z51cICbnbpVgAELJY6DI3rMSdFtn71ZFgv1Qs731h3C3AStplvPEd/C5s lJg8PcHK6yb3TAicWPRIFrf6Du7HJIDFjP6XsgzdXGR3cD7SpurBfwbpr0xvKsx7UoKd sqynKzq9HxKvgEHayN/s56bh1FEvAkI4rHFX5/skRaq7S3Ydcw2GCQZgKz5RzoDmINTb Bxv/uf+UOP1IqmjHmX4ondb5ff5o8z/m7LwUNQhozshTh5+SmROp4IdCfnIwI0+3sWsh M76Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GJiegQezBnHRSogVnqjAcb6pyt8+2sxIJk9sY4i8PG8=; b=PBv40ryBL6b+nkDKfwQuxL/HpVUByRfZDISirq/YkdVFoPGPYxc4T0IM9NMAm8LWK/ KU97gWtjWKJtxTJPWusQa512Uoqf6w//LUShtDC0ZEMZx8re2yyVKCy8zQMZ35sitWkL 7mS8md/biKVSsdm3utQPNkGgJj3kQY9fen3oHyrsUExsDvjihezq9AgLUcrb4O4u+sBJ qC0KgY74arNUyU9AX1j0Qi6Lq9v3OWUpnDgiGtbbNPGqSuAo+9jSUvY5kxg8ZANDjk2n woA7ToamojMCVeerDLWKeYU1N1uUNUTTNdd+Vs0NtPoUBgYy8agk0PDwPGtQ4xlI+Smc sCTQ== X-Gm-Message-State: ALyK8tIwM/mK6bGUfXdmk/hf3uDpnelmudTb0rCevSuaJ51uGpLVNJa63DPl+trxqDQsbP2Z96hJ1/TuND7vrQ== X-Received: by 10.107.175.3 with SMTP id y3mr8221083ioe.113.1465392735450; Wed, 08 Jun 2016 06:32:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.57.9 with HTTP; Wed, 8 Jun 2016 06:32:14 -0700 (PDT) In-Reply-To: References: From: Ryan Stone Date: Wed, 8 Jun 2016 09:32:14 -0400 Message-ID: Subject: Re: Problem mapping multiple definitions of a structure coming from different modules To: Shrikanth Kamath Cc: "freebsd-dtrace@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.22 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: Wed, 08 Jun 2016 13:32:16 -0000 I don't have a system with separate em or igb modules so I can't test this, but I was under the impression that you could make this work with a syntax along the lines of: struct if_em`tx_ring or struct if_em.ko`tx_ring Unfortunately, this doesn't help those who have the drivers compiler into their kernel, but it should work for you.