From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24658 invoked by alias); 26 May 2007 21:00:17 -0000 Received: (qmail 24634 invoked by uid 22791); 26 May 2007 21:00:11 -0000 X-Spam-Check-By: sourceware.org Received: from smtp1.dnsmadeeasy.com (HELO smtp1.dnsmadeeasy.com) (205.234.170.134) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 26 May 2007 21:00:03 +0000 Received: from smtp1.dnsmadeeasy.com (localhost [127.0.0.1]) by smtp1.dnsmadeeasy.com (Postfix) with ESMTP id 98E3F2A2082; Sat, 26 May 2007 21:00:01 +0000 (GMT) X-Authenticated-Name: js.dnsmadeeasy X-Transit-System: In case of SPAM please contact abuse@dnsmadeeasy.com Received: from avtrex.com (unknown [67.116.42.147]) by smtp1.dnsmadeeasy.com (Postfix) with ESMTP; Sat, 26 May 2007 21:00:01 +0000 (GMT) Received: from [127.0.0.1] ([192.168.7.227]) by avtrex.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 26 May 2007 13:59:40 -0700 Message-ID: <46589FB9.3030504@avtrex.com> Date: Sat, 26 May 2007 21:00:00 -0000 From: David Daney User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: "Paulo J. Matos" Cc: gcc-help@gcc.gnu.org Subject: Re: Accessing symbol table to find function given address References: <11b141710705261329k4e3e866bt898663aa85cd46f@mail.gmail.com> In-Reply-To: <11b141710705261329k4e3e866bt898663aa85cd46f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2007-05/txt/msg00273.txt.bz2 Paulo J. Matos wrote: > Hello all, > > Is there a way to access the symbol table during runtime to know which > function belongs to a given address. The problem is to print the > function name if I am instrumenting functions. I get the address, can > I during runtime print the function name? (or the solution is get it > through addr2line after program as run)? If you are using glibc, you could try the dladdr() function. Otherwise you can try addr2line as you suggested. David Daney.