• 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: Shark and dlopen(): debug symbols, "unknown library"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shark and dlopen(): debug symbols, "unknown library"


  • Subject: Re: Shark and dlopen(): debug symbols, "unknown library"
  • From: Rick Altherr <email@hidden>
  • Date: Fri, 17 Apr 2009 10:51:02 -0700


On Apr 17, 2009, at 9:36 AM, Guido Lorenz wrote:

Hi,

I already posted the message attached below a few weeks ago but did not get an answer. Maybe I did not make myself clear, so I am posting my problem again, hoping somebody can help.


I usually respond to all the emails related to Shark. Somehow I missed yours. Sorry.


* Setting:
I am working with a C++ application that is dynamically linked to a library, that in turn loads additional code from a plugin library using dlopen() and dlsym() from the C dlfcn.h header.


* Debug Symbols:
Both the library and the plugin are compiled in release mode, but with debug symbols ("Generate Debug Symbols" is enabled in Xcode). These debug symbols are actually available, since I can successfully debug code inside the plugin (i.e. I can place a breakpoint and the main application will stop there). The main application does not contain debug symbols.


* Problem:
However, if I use Shark to generate a "Time Profile", only the library is identified correctly, while the plugin is referred to as an "Unknown Library".


* Things I already tried:
Google. Found a post by someone who tried to profile a similar setup and gave up: http://www.cocoabuilder.com/archive/message/xcode/2006/3/7/4628
I tried all combinations of RTLD_LAZY/RTLD_NOW and RTLD_LOCAL/ RTLD_GLOBAL.
I also tried different levels of debug symbols (default, full) and "Generate Profiling Code" for the plugin.


* Questions:
Does anyone have an idea why this is happening?

To keep the overhead during the sampling low, Shark only collects symbol information at either the end of sampling or when the process terminates, whichever comes first. Shark looks at the dyld loaded library list to determine what is in a given process space and where it was loaded. If you dlopen() your plugin during the session and dlclose() it before the session is stopped (and analysis has finished), Shark won't know that it was loaded. We are aware that this causes problems for applications that are aggressive about unloading plugins.



Do I have to enable some other code generation options?

Just having -g should be sufficient. I believe this is entirely a timing problem.



Are there known issues with Shark and dlopen()?

Yes, per above. The dlopen()'d library needs to still be open when sampling stops for Shark to know about it.



Has anyone successfully used Shark in a similar scenario?

We have tested Shark with dlopen()'d plugins but the program never unloads the plugins.




Any kind of hint would be greatly appreciated. :)

// Guido


Am 30.03.2009 um 15:13 schrieb Guido Lorenz:

Hello,

I'm trying to profile a C++ application that uses "plugins", i.e. dylibs loaded at runtime using dlopen(). I can debug code inside these plugins, so the necessary debug symbols seem to be available. But Shark only displays calls to an "Unkown library" where code from a plugin is executed.

Has anyone used Shark successfully to profile an application with plugins, and any ideas why it isn't working for me? Can I help Shark find the plugin library?

Thanks.

Guido

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com


This email sent to email@hidden

-- Rick Altherr Performance Tools Development Technologies email@hidden




Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: Shark and dlopen(): debug symbols, "unknown library"
      • From: Guido Lorenz <email@hidden>
    • Re: Shark and dlopen(): debug symbols, "unknown library"
      • From: Guido Lorenz <email@hidden>
References: 
 >Shark and dlopen(): debug symbols, "unknown library" (From: Guido Lorenz <email@hidden>)

  • Prev by Date: Shark and dlopen(): debug symbols, "unknown library"
  • Next by Date: How does Xcode preserve SCM meta-data?
  • Previous by thread: Shark and dlopen(): debug symbols, "unknown library"
  • Next by thread: Re: Shark and dlopen(): debug symbols, "unknown library"
  • Index(es):
    • Date
    • Thread