Re: dladdr/backtrace_symbols return incorrect symbol names
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Mar 24, 2009, at 9:51 AM, Ethan Tira-Thompson wrote: Yeah. -- Steve Checkoway "Anyone who says that the solution is to educate the users hasn't ever met an actual user." -- Bruce Schneier _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com It's clear what is happening is dladdr is skipping all of the 't' (local text section?) symbols, and only returning the 'T' (external text section?) symbols. Spot checking the correctly returned symbols suggests they are all 'T' symbols. I'm guessing the 't' symbols are static-linked in the executable, and 'T' symbols are dynamically loaded from a build directory somewhere, and thus dladdr is only reporting the 'T' symbols as it ignores static linkage. Does that sound right? Alternatively, I suppose I could figure out what nm is using and emulate that in my code... sounds even more hairy than popen atos though, probably a bunch of manual mach-o parsing...? I've posted code to this list (or maybe xcode-users or unix-porting) that pretty much does what Terry suggested in one of his replies: playing with LC_DYSYMTAB. It gets the address of noninlined static symbols as long as you don't strip the symbol names. smime.p7s
participants (1)
-
Steve Checkoway