From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106655 invoked by alias); 23 Apr 2015 14:22:43 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 106635 invoked by uid 89); 23 Apr 2015 14:22:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 23 Apr 2015 14:22:41 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3NELXMm004665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 Apr 2015 10:21:34 -0400 Received: from bordewijk.wildebeest.org (ovpn-116-24.ams2.redhat.com [10.36.116.24]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3NELWvH014837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 23 Apr 2015 10:21:33 -0400 Received: by bordewijk.wildebeest.org (Postfix, from userid 1000) id 3AD428148038; Thu, 23 Apr 2015 16:21:32 +0200 (CEST) Message-ID: <1429798891.1938.97.camel@bordewijk.wildebeest.org> Subject: Re: [PATCH v4 1/3] systemtap/tapsets.cxx: Fix dwarfless probes on multiple static functions From: Mark Wielaard To: Hemant Kumar Cc: systemtap@sourceware.org, naveen.n.rao@linux.vnet.ibm.com, ulrich.weigand@de.ibm.com, uweigand@gcc.gnu.org, anton@samba.org, fche@redhat.com Date: Thu, 23 Apr 2015 14:22:00 -0000 In-Reply-To: <5537B1CA.8030302@linux.vnet.ibm.com> References: <1429525764-23471-1-git-send-email-hemant@linux.vnet.ibm.com> <1429710017.1938.71.camel@bordewijk.wildebeest.org> <5537B1CA.8030302@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 X-SW-Source: 2015-q2/txt/msg00065.txt.bz2 On Wed, 2015-04-22 at 20:05 +0530, Hemant Kumar wrote: > On 04/22/2015 07:10 PM, Mark Wielaard wrote: > > @@ -8242,6 +8242,8 @@ symbol_table::purge_syscall_stubs() > > if (!addrs || addrs->empty()) > > return; > > /* Highly unlikely that multiple symbols named "sys_ni_syscall" may= exist */ > > + if (addrs->size() > 1) > > + cerr << _("Multiple 'sys_ni_syscall' symbols found."); > > Dwarf_Addr stub_addr =3D addrs->front(); > > > > Just so that if this highly unlikely scenario does occur we get a > > warning something is fishy. > > > Right! looks good. And I am glad we did add that warning. Martin found it triggered on ppc64be (ELFv1 ABI). It was caused by ppc64be using function descriptors and stap using both the actual function entry symbol .sys_ni_syscall and the function descriptor symbol sys_ni_syscall. Both resolved to the same address. And we mangle the name of the function entry symbol to remove the leading dot. So they also have the same name. This was mostly harmless. But it showed some inefficiencies. Frank solved the immediate issue by using address sets instead of lists, so duplicate addresses are just not returned: commit fb5b48419b8d74e6cb82e90ba0aa9e188db07043 Author: Frank Ch. Eigler Date: Wed Apr 22 16:53:51 2015 -0400 tapsets.cxx: fix symbol/address lookup returned-data to sets passed by value =20=20=20=20 The symbol_table lookup_symbol[_address] functions are safer if they return their result-sets by value rather than by pointer. The latter in specific should be a set rather than a list, to properly eliminate duplicates. Then I removed the hardcoded #ifdef __powerpc__ constructs in tapsets.cxx and replaced them with a check of whether the target is ppc64 ELFv1 abi. That way cross-stapping (is that a word?) should work across arches too (but I haven't tested that, just that ppc64be and ppc64le both work correctly). This also removes the actual duplicates, so the maps aren't filled with extra func_infos (there could be lots of duplicates in the kernel when using function descriptors). commit 064a90a93b8702a9f2649b5d46494e6218c8a145 Author: Mark Wielaard Date: Thu Apr 23 15:59:49 2015 +0200 ppc64le doesn't have function descriptors. Remove __powerpc__ in tapsets.cxx =20=20=20=20 Only process the opd section and do function descriptor mangling when the target is ppc64 ELFv1 ABI. Also filter out any duplicate func_infos. When seeing a symbol with a name starting with '.' we assume it is a regular function pointer and not a pointer to a function descriptor and mangle its name. That might create duplicates if there is also a function descriptor with that name (the address will already have been resolved to the same address). Cheers, Mark