From owner-freebsd-sparc Fri Sep 13 14: 4:44 2002 Delivered-To: freebsd-sparc@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 41AFE37B401 for ; Fri, 13 Sep 2002 14:04:41 -0700 (PDT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id D38BF43E6E for ; Fri, 13 Sep 2002 14:04:39 -0700 (PDT) (envelope-from tmoestl@gmx.net) Received: (qmail 18223 invoked by uid 0); 13 Sep 2002 21:04:38 -0000 Received: from pd9538d06.dip.t-dialin.net (HELO forge.local) (217.83.141.6) by mail.gmx.net (mp003-rz3) with SMTP; 13 Sep 2002 21:04:38 -0000 Received: from tmm by forge.local with local (Exim 4.10 #1) id 17pxd9-0009bl-00; Fri, 13 Sep 2002 23:05:35 +0200 Date: Fri, 13 Sep 2002 23:05:35 +0200 From: Thomas Moestl To: John Polstra Cc: sparc@freebsd.org, jhb@freebsd.org Subject: Re: No gdb yet? Message-ID: <20020913210535.GC6560@crow.dom2ip.de> Mail-Followup-To: John Polstra , sparc@freebsd.org, jhb@freebsd.org References: <200209132045.g8DKjloj035471@vashon.polstra.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200209132045.g8DKjloj035471@vashon.polstra.com> User-Agent: Mutt/1.4i Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 2002/09/13 at 13:45:47 -0700, John Polstra wrote: > In article , John Baldwin > wrote: > > > Jake has some sort of core dump analyzer. > > Hey, Jake! Yoohoo! Could you point me to a copy of it? :-) It's at http://people.freebsd.org/~jake/coredump.tar I've attached a small patch that should make it work better with stripped dynamic objects (particularly rtld) by looking for symbols in the dynamic symtab too. - Thomas -- Thomas Moestl http://www.tu-bs.de/~y0015675/ http://people.FreeBSD.org/~tmm/ PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C diff -ur coredump/coredump.c coredump.tmm/coredump.c --- coredump/coredump.c Thu Jul 18 00:27:29 2002 +++ coredump.tmm/coredump.c Fri Sep 13 23:04:02 2002 @@ -252,18 +252,26 @@ static Elf_Sym * elf_find_sym_by_name(Elf_Ehdr *e, char *name) { - Elf_Shdr *sh; + Elf_Shdr *shstr, *shtab; Elf_Sym *st; char *strtab; int i; - if ((sh = elf_find_shdr(e, ".strtab", 0)) == NULL) + if ((shstr = elf_find_shdr(e, ".strtab", 0)) != NULL && + (shtab = elf_find_shdr(e, ".symtab", 0)) != NULL) { + strtab = (char *)e + shstr->sh_offset; + st = (Elf_Sym *)((char *)e + shtab->sh_offset); + for (i = 0; i < shtab->sh_size / sizeof(*st); i++) { + if (strcmp(name, strtab + st[i].st_name) == 0) + return (&st[i]); + } + } + if ((shstr = elf_find_shdr(e, ".dynstr", 0)) == NULL || + (shtab = elf_find_shdr(e, ".dynsym", 0)) == NULL) return (NULL); - strtab = (char *)e + sh->sh_offset; - if ((sh = elf_find_shdr(e, ".symtab", 0)) == NULL) - return (NULL); - st = (Elf_Sym *)((char *)e + sh->sh_offset); - for (i = 0; i < sh->sh_size / sizeof(*st); i++) { + strtab = (char *)e + shstr->sh_offset; + st = (Elf_Sym *)((char *)e + shtab->sh_offset); + for (i = 0; i < shtab->sh_size / sizeof(*st); i++) { if (strcmp(name, strtab + st[i].st_name) == 0) return (&st[i]); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message