From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21273 invoked by alias); 7 Apr 2003 16:06:37 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 21260 invoked from network); 7 Apr 2003 16:06:31 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 7 Apr 2003 16:06:31 -0000 Received: from toenail.toronto.redhat.com (toenail.toronto.redhat.com [172.16.14.211]) by touchme.toronto.redhat.com (Postfix) with ESMTP id DC6E1800075; Mon, 7 Apr 2003 12:06:30 -0400 (EDT) Received: from toenail.toronto.redhat.com (IDENT:fche@localhost [127.0.0.1]) by toenail.toronto.redhat.com (8.11.6/8.11.6) with ESMTP id h37G6Uk25852; Mon, 7 Apr 2003 12:06:30 -0400 Received: (from fche@localhost) by toenail.toronto.redhat.com (8.12.8/8.12.8/Submit) id h37G6TSU025848; Mon, 7 Apr 2003 12:06:29 -0400 Date: Mon, 07 Apr 2003 19:54:00 -0000 From: "Frank Ch. Eigler" To: Eyal Lebedinsky Cc: gcc@gcc.gnu.org Subject: Re: mudflap: how do I give size for 'void *' objects? - example Message-ID: <20030407120627.C10802@redhat.com> References: <3E8CCC43.3F317393@eyal.emu.id.au> <3E8E7721.FAAEF08F@eyal.emu.id.au> <20030405152716.GA16333@redhat.com> <3E8F9FE5.ED8FFCE@eyal.emu.id.au> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <3E8F9FE5.ED8FFCE@eyal.emu.id.au>; from eyal@eyal.emu.id.au on Sun, Apr 06, 2003 at 01:32:53PM +1000 X-SW-Source: 2003-04/txt/msg00268.txt.bz2 --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2118 Hi - On Sun, Apr 06, 2003 at 01:32:53PM +1000, Eyal Lebedinsky wrote: > [...] > Good, I now wrapped ctime() and shmat() with __mf_[un]register() > calls and this removed the reports.=20 (Patch please?) > BTW, for such foreign objects, > how do I set the size when it is unknown (e.g. for 'ctime' I now > cheat and say '64'), and what type do I use (I use GUESS)? For ctime, the size is probably 26 or 27, and the type should be STATIC. For other functions, it varies case by case. > And just to be sure I did not miss a post, the getmem/usemem example > does show a real problem, right? [...] It shows a real problem in your test program. You're allocating a piece of memory with malloc(), so it is uninitialized. Its contents are undefined, but you're reading from it. The libmudflap default option "-check-initialization" is designed to detect exactly this. Had you used calloc(), or wrote to the buffer first, there would be no violation shown. (This is a pretty naive algorithm - nowhere near what valgrind does.) > So, the "location=3D`zz.c:19 (usemem)'" is from compile time, but the > following traceback is from glibc runtime?=20 Yes. > I never saw line numbers in this trace, only hex offsets, > and I do use '-g'. Can I make it show line numbers (am I > missing an option)?=20 I don't think glibc can do that. By supplying "--export-dynamic", your shared library may have more of the symbols glibc may use to get at least function names. > [...] here is an example report which I find very hard to use: > [...]/libmudflap.so.0(__mfwrap_memcmp+0x13c) [0x40b39bac] > /ssa/builds/20030404n/bin/libssaiok.so [0x40a85d51] > /ssa/builds/20030404n/bin/libssaiok.so [0x40a84c93] Yeah. Unfortunately libmudflap and glibc don't use debugging data to get more precise locations. I expect we could use an external "addr2line" child process to map raw PC values to source:line coordinates. Care to try writing up such an option for libmudflap, perhaps based on libjava/gnu/gcj/runtime/NameFinder.java? (I believe there used to be a C/C++ version of that little function too.) - FChE --vkogqOf2sHV7VnPd Content-Type: application/pgp-signature Content-Disposition: inline Content-length: 189 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+kaIDVZbdDOm/ZT0RAm1nAJ4/jXI3LjuVz3jYDoxiwPUrD+XY9gCbBHG6 xjhmEQiJDhDJKfH/NFWrzsY= =wM8t -----END PGP SIGNATURE----- --vkogqOf2sHV7VnPd--