• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why no execinfo.h?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why no execinfo.h?


  • Subject: Re: Why no execinfo.h?
  • From: Rush Manbert <email@hidden>
  • Date: Thu, 20 Apr 2006 16:56:14 -0700

Eric Albert wrote:
On Apr 20, 2006, at 9:42 PM, Rush Manbert wrote:

This is addressed to the Apple Gods of Xcode (AGX) who read this list.

I see that we can use __builtin_return_address() and __builtin_frame_address(), but I would also like to use backtrace() and backtrace_symbols().

When I try, the compiler tells me that it can't find the file execinfo.h. Is there a reason that this (and presumably the functions I want) is excluded from the system?

Alternatively, if I have a return address, is there a runtime lookup mechanism to resolve it to a symbol + offset?


backtrace and backtrace_symbols are Linux-specific APIs (more properly, they're glibc-specific). So they're not so much "excluded" as not part of Mac OS X (or FreeBSD, Solaris, etc.) to begin with. dladdr might give you want on Mac OS X and so might the NSModule man page, but we don't currently provide a generic backtracing or backtrace+symbols API on the system.

Dang, Eric, you really are an AGX!

I tried dladdr and it seems to be giving me something very close to what I want. (I need this to work for C++ code, so didn't go the NSModule route.)

The only remaining issue is that the name returned by dladdr is mangled. My function called "level" is returned as _Z5leveli. I know about c++filt, is there any library function that can demangle the names?

Thank you,
Rush
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Why no execinfo.h?
      • From: Steve Checkoway <email@hidden>
    • Re: Why no execinfo.h?
      • From: Steve Sisak <email@hidden>
References: 
 >Why no execinfo.h? (From: Rush Manbert <email@hidden>)
 >Re: Why no execinfo.h? (From: Eric Albert <email@hidden>)

  • Prev by Date: Re: OT: "Electrical interference" builds up on DSL line.
  • Next by Date: What causes this and how can I fix it ?
  • Previous by thread: Re: Why no execinfo.h?
  • Next by thread: Re: Why no execinfo.h?
  • Index(es):
    • Date
    • Thread