[lldb-dev] finding the symbol dependencies of a bundle, like dyldinfo -lazy_bind -export

Greg Clayton gclayton at apple.com
Mon Apr 2 14:05:50 PDT 2012


A quick clarification on the args to CreateTarget:

"filename" is just a full path to the local object file you want to observer. "target_triple" is your <arch>-<vendor>-<os>, or something like "x86_64-apple-darwin" or "i386-pc-linux" and can be NULL if the file is only a single architecture. "platform_name" can be NULL. "add_dependent_modules" should be false, since you are only interested in seeing the one object file itself, an SBError instance  should be created and passed in.

On Apr 2, 2012, at 1:13 PM, Greg Clayton wrote:

> So your flow should be:
> 
> SBDebugger::Initialize();
> SBDebugger debugger(SBDebugger::Create());
> SBTarget target (debugger.CreateTarget (const char *filename,
> 			                const char *target_triple,
> 				        const char *platform_name,
> 		                        bool add_dependent_modules,
>                                        lldb::SBError& error));
> 
> SBFileSpec exe_file_spec (filename);
> SBModule exe_module (target.FindModule(exe_file_spec));
> if (exe_module.IsValid()
> {
>    const size_t num_symbols = exe_module. GetNumSymbols();
>    for (size_t i=0; i<num_symbols; ++i)
>    {
>        SBSymbol symbol (exe_module. GetSymbolAtIndex(i));
>        if (symbol.IsExternal())
>        {
>        }
> 
> 	if (symbol.GetType() == lldb::eSymbolTypeTrampoline)
>        {
>        }
>    }
> }
> 




More information about the lldb-dev mailing list