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