From owner-cvs-src@FreeBSD.ORG Mon Jan 8 19:20:27 2007 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0DD2016A417; Mon, 8 Jan 2007 19:20:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 923AB13C478; Mon, 8 Jan 2007 19:20:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id l08JKDdh068399; Mon, 8 Jan 2007 14:20:24 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Peter Jeremy Date: Mon, 8 Jan 2007 13:36:44 -0500 User-Agent: KMail/1.9.1 References: <200701052104.l05L4cO7037092@repoman.freebsd.org> <200701051607.59334.jhb@freebsd.org> <20070106043515.GD839@turion.vk2pj.dyndns.org> In-Reply-To: <20070106043515.GD839@turion.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200701081336.45214.jhb@freebsd.org> Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 08 Jan 2007 14:20:24 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2424/Mon Jan 8 11:46:49 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/usr.bin/kdump kdump.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2007 19:20:27 -0000 On Friday 05 January 2007 23:35, Peter Jeremy wrote: > On Fri, 2007-Jan-05 16:07:58 -0500, John Baldwin wrote: > >On Friday 05 January 2007 16:04, John Baldwin wrote: > >> jhb 2007-01-05 21:04:37 UTC > >> > >> FreeBSD src repository > >> > >> Modified files: > >> usr.bin/kdump kdump.c > >> Log: > >> Add code to parse the utrace(2) entries generated by malloc(3) in a more > >> human-readable format. Note that we report 'realloc(p, 0)' as 'free(p)' > >> since both cases are encoded the same way and 'free()' is more common > >> than a realloc() to 0. > >> > >> MFC after: 1 week > > This is much nicer than having to run kdump output thru my perl script > to do this. The only downside I see is that the code in kdump assumes > that any utrace records that are sizeof(struct utrace_malloc) are > generated by malloc. This isn't necessarily true - whilst nothing in > the base system apart from malloc currently uses utrace, it's possible > that people are using utrace in their own code. I'd prefer to see > this decoding controlled by a command line option. (Ideally, kdump > would grow a configuration file so that a user could define their own > decoding rules - but that is a lot of work). We could turn it off if we want. I agree that having to depend on size to determine the malloc case sucks as a signature, but that format has been fairly well established at this point. > >I also have patches I use at work that allow kdump to recognize a 32-bit > >malloc utrace on an amd64 machine (for when you run an i386 binary) if folks > >are interested. I'm not sure how many i386 on amd64 hacks we want in the > >official CVS tree. :) > > Personally, I'd like FreeBSD to behave similarly to Solaris: You choose > whether to compile 32-bit or 64-bit executables with a compiler switch > and everything else is transparent. FreeBSD 3.x had smarts so that nm, > ld, gdb etc could transparently handle either a.out or ELF executables. > It would be nice if FreeBSD/amd64 could do the same (though I realise > that we don't want the overheads on other platforms, which would make it > more difficult to implement). We have several things at work that we don't currently feed back because it makes things ugly. For example, at work we let 32-bit tcpdump work on amd64 via compat ioctl's, etc. (That one is ugly as the kernel actually has to send a different header on each packet due to struct timeval being different sizes.) > >I also have another set of patches to add various utrace(2) events to the > >runtime linker as well as logic in kdump to parse them that I hope to commit > >in the near future. > > Sounds good. This goes back to my first point above - I don't think it's > safe to rely on the size of a utrace record to determine its type. For RTLD I am using a 4 byte signature 'RTLD' followed by a byte specifying the type of record that follows and do not depend on the size. I think it would be best if any new utrace's used a similar 4-char signature (you could even dynamically add handlers based on the signature to kdump that way), but for malloc() I was stuck with what we had. See www.freebsd.org/~jhb/patches/rtld_utrace.patch for the approach I used. -- John Baldwin