From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 29 10:32:29 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4686116A4CE for ; Thu, 29 Apr 2004 10:32:29 -0700 (PDT) Received: from 15pc221.sshunet.nl (15pc221.sshunet.nl [131.211.221.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F1AD43D3F for ; Thu, 29 Apr 2004 10:32:28 -0700 (PDT) (envelope-from pieter@thelostparadise.com) Received: from thedarkside.nl ([172.16.0.4]) by 15pc221.sshunet.nl (8.12.8p2/8.12.8) with ESMTP id i3THWHKM083287; Thu, 29 Apr 2004 19:32:18 +0200 (CEST) (envelope-from pieter@thelostparadise.com) Received: from [10.0.0.3] (edinburgh [10.0.0.3]) by thedarkside.nl (8.12.8p2/8.12.8) with ESMTP id i3THWEPQ084877; Thu, 29 Apr 2004 19:32:14 +0200 (CEST) (envelope-from pieter@thelostparadise.com) From: "P. de Boer" To: John-Mark Gurney In-Reply-To: <20040429165916.GL567@funkthat.com> References: <1083167960.653.23.camel@edinburgh.thedarkside.tix> <20040429165916.GL567@funkthat.com> Content-Type: text/plain Organization: The Lost Paradise Message-Id: <1083259932.640.20.camel@edinburgh.thedarkside.tix> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Thu, 29 Apr 2004 19:32:13 +0200 Content-Transfer-Encoding: 7bit X-TheLostParadise-MailScanner-Information: Please contact the ISP for more information X-TheLostParadise-MailScanner: Found to be clean cc: freebsd-hackers@freebsd.org Subject: Re: Extracting symbol info out of processes at runtime X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: pieter@thelostparadise.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2004 17:32:29 -0000 On Thu, 2004-04-29 at 18:59, John-Mark Gurney wrote: > > For a little private project I'm working at, I need to find the address > > of a function which is inside a shared library of a running process, OR > > the base address the library is running at (in that case, I can simply > > do a base_address+known_offset_of_function). The executable nor > > libraries have their symbols stripped. > > Well, if you don't mind not doing all the code, you could use gcore + gdb > to extract the function and library... It may not be the most elegant > solution, but it will work.. I'm afraid I really need to do all the code, since I want to use it for a program which needs to set breakpoints at the functions I'm trying to get the addresses for. I looked at the gdb sources to see if I could get a sense of how gdb extracts the data, but couldn't get the hang of it. Another option would be to use /proc, but that's evil.. -- Pieter