From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5050 invoked by alias); 1 May 2006 00:11:43 -0000 Received: (qmail 5041 invoked by uid 22791); 1 May 2006 00:11:42 -0000 X-Spam-Check-By: sourceware.org Received: from smtp.andrew.cmu.edu (HELO smtp.andrew.cmu.edu) (128.2.10.82) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 01 May 2006 00:11:41 +0000 Received: from [192.168.0.3] (c-67-186-35-79.hsd1.pa.comcast.net [67.186.35.79]) (user=ejt mech=PLAIN (0 bits)) by smtp.andrew.cmu.edu (8.13.5/8.13.6) with ESMTP id k410Be55011617 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sun, 30 Apr 2006 20:11:40 -0400 Mime-Version: 1.0 (Apple Message framework v746.3) Content-Transfer-Encoding: 7bit Message-Id: <2119EFE1-B864-43C7-9847-279395E88148@andrew.cmu.edu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: binutils@sourceware.org From: Ethan Tira-Thompson Subject: libbfd Mac OS X support? Date: Mon, 01 May 2006 00:11:00 -0000 X-Mailer: Apple Mail (2.746.3) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00000.txt.bz2 I was hoping someone could give me a heads up on the status of libbfd for Mac OS X. I've written a nice (IMHO) little bit of code that can do stack unrolling on a variety of platforms -- my aim is to provide a C/C++ debugging capability similar to what is found in Java, where it dumps a stack trace any time something goes wrong. But this would be far more user friendly if the stack trace includes the actual function names and filename:linenumber in the output instead of just displaying raw return addresses. libbfd seems the sensible choice to pull the information out of the executable (assuming it was compiled with -g of course). So I've gotten this all working under linux (thanks to looking at the source of addr2line to get around a few rough edges!), but I seem to be at an impasse with OS X because bfd_find_nearest_line maps to _bfd_nosymbols_find_nearest_line, which in turn maps to bfd_false, which does nothing ;) E.g.: addr2line does compile under OS X, it just doesn't seem to work: ./addr2line -f -e ../../../trace_test 0x3f1c ?? ??:0 However, I see GDB is somehow able to extract file/function info, and afaik, it's using libbfd... 1. Which copy of bfd should I be linking against (i.e. the one in gcc, or gdb, or binutils...?) 2. Is bfd_find_nearest_line simply unimplemented on OS X, or is there something deeper? 3. Do you know how GDB extracts line info? (i.e. suggestions for workaround/next step?) thank you for your time -ethan