[lldb-dev] Misinterpreting Symbols Issue since LLDB-310

Greg Clayton gclayton at apple.com
Thu Jan 22 09:36:21 PST 2015


You can work around this issue for now by adding the following line to your .lldbinit file:

settings set target.load-script-from-symbol-file false

This should disable the code that is looking for scripting resources inside debug symbol files and should avoid the code that is causing your executable to get messed up.

Another way you can fix this is to get a copy of the executable file that you are debugging on your local system. The reason it is having trouble is because it is loading your executable from memory because it doesn't have an on disk representation. This reading from the process is what is sensitive to requiring that sections be loaded before any data from the symbol table can be read from memory.

Is there a reason you don't have a local copy of the executable?

Greg Clayton

> On Jan 21, 2015, at 11:13 PM, Lei Shi <cosmo.shih at gmail.com> wrote:
> 
> My current solution is change the code from this:
> 
> void
> Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
> {
>     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
>     ClearModules(false);
>  
>     if (executable_sp.get())
>     {
>         ...
>     }
>     ...
> }
> 
>  to this:
> 
> void
> Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
> {
>     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
>     //ClearModules(false);
>     ModulesDidUnload (m_images, false);
>     //m_section_load_history.Clear();
>     m_images.Clear();
>     m_scratch_ast_context_ap.reset();
>     m_scratch_ast_source_ap.reset();
>     m_ast_importer_ap.reset();
> 
>     if (executable_sp.get())
>     {
>         ...
>     }
>     ...
> }
> 
> It's work, although, it isn't the right way.
> 
> I think these code needs refine by someone who familiar with lldb codebase. 
> Hope the issue would be fixed in the next Xcode release.
> 
> Best Wishes,
> Lei Shi
> 
> On Tue, Jan 20, 2015 at 8:20 AM, Greg Clayton <gclayton at apple.com> wrote:
> 
> > On Jan 18, 2015, at 6:38 PM, Lei Shi <cosmo.shih at gmail.com> wrote:
> >
> > Hi, everyone
> >
> > The Target::SetExecutableModule invoke Target::ClearModules at the very beginning. Target::ClearModules clears the m_section_load_histroy which maintains the section list of the target. the following symbol parsing phase needs section list of the executable. Empty section list will leads to Misinterpreting various symbol data including Function Starts.
> 
> How are you setting up your symbols prior to setting the target executable? Or is the dynamic loader plug-in doing this? Either way the target's main executable should be set, then the sections should be setup.
> 
> How are you getting this to happen?
> 
> >
> > I've tried to fix the issue by avoiding clear the m_section_history in Target::SetExecutableModule. It's work, but I not show weather it's a proper way to fix the issue.
> 
> This isn't the right way to do things. Let me know how you are getting Target::SetExecutableModule() to be called and I might be able to tell you more.
> 
> >
> > Hope someone can review the fix.
> >
> > Best,
> > Lei Shi
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 
> 





More information about the lldb-dev mailing list