forked from OSchip/llvm-project
Remove the Flags member in lldb_private::Module in favor of bitfield boolean
member variables. Modified lldb_private::Module to have an accessor that can be used to tell if a module is a dynamic link editor (dyld) as there are functions in dyld on darwin that mirror functions in libc (malloc, free, etc) that should not be used when doing function lookups by name in expressions if there are more than one match when looking up functions by name. llvm-svn: 113313
This commit is contained in:
parent
331b3dd2ad
commit
e83e731ec1
|
@ -49,13 +49,6 @@ public:
|
|||
friend class ModuleList;
|
||||
friend bool ObjectFile::SetModulesArchitecture (const ArchSpec &new_arch);
|
||||
|
||||
enum
|
||||
{
|
||||
flagsSearchedForObjParser = (1 << 0),
|
||||
flagsSearchedForSymVendor = (1 << 1),
|
||||
flagsParsedUUID = (1 << 2)
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with file specification and architecture.
|
||||
///
|
||||
|
@ -553,6 +546,18 @@ public:
|
|||
SetFileSpecAndObjectName (const FileSpec &file,
|
||||
const ConstString &object_name);
|
||||
|
||||
bool
|
||||
GetIsDynamicLinkEditor () const
|
||||
{
|
||||
return m_is_dynamic_loader_module;
|
||||
}
|
||||
|
||||
void
|
||||
SetIsDynamicLinkEditor (bool b)
|
||||
{
|
||||
m_is_dynamic_loader_module = b;
|
||||
}
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member Variables
|
||||
|
@ -562,10 +567,14 @@ protected:
|
|||
ArchSpec m_arch; ///< The architecture for this module.
|
||||
UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
|
||||
FileSpec m_file; ///< The file representation on disk for this module (if there is one).
|
||||
Flags m_flags; ///< Flags for this module to track what has been parsed already.
|
||||
ConstString m_object_name; ///< The name an object within this module that is selected, or empty of the module is represented by \a m_file.
|
||||
std::auto_ptr<ObjectFile> m_objfile_ap; ///< A pointer to the object file parser for this module.
|
||||
std::auto_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module.
|
||||
bool m_did_load_objfile:1,
|
||||
m_did_load_symbol_vendor:1,
|
||||
m_did_parse_uuid:1,
|
||||
m_is_dynamic_loader_module:1;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Resolve a file or load virtual address.
|
||||
///
|
||||
|
@ -601,14 +610,21 @@ protected:
|
|||
/// @see SymbolContext::Scope
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
ResolveSymbolContextForAddress (lldb::addr_t vm_addr, bool vm_addr_is_file_addr, uint32_t resolve_scope, Address& so_addr, SymbolContext& sc);
|
||||
|
||||
void SymbolIndicesToSymbolContextList (Symtab *symtab, std::vector<uint32_t> &symbol_indexes, SymbolContextList &sc_list);
|
||||
ResolveSymbolContextForAddress (lldb::addr_t vm_addr,
|
||||
bool vm_addr_is_file_addr,
|
||||
uint32_t resolve_scope,
|
||||
Address& so_addr,
|
||||
SymbolContext& sc);
|
||||
|
||||
bool SetArchitecture (const ArchSpec &new_arch);
|
||||
void
|
||||
SymbolIndicesToSymbolContextList (Symtab *symtab,
|
||||
std::vector<uint32_t> &symbol_indexes,
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
bool
|
||||
SetArchitecture (const ArchSpec &new_arch);
|
||||
|
||||
private:
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (Module);
|
||||
};
|
||||
|
||||
|
|
|
@ -26,10 +26,13 @@ Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstStrin
|
|||
m_arch (arch),
|
||||
m_uuid (),
|
||||
m_file (file_spec),
|
||||
m_flags (),
|
||||
m_object_name (),
|
||||
m_objfile_ap (),
|
||||
m_symfile_ap ()
|
||||
m_symfile_ap (),
|
||||
m_did_load_objfile (false),
|
||||
m_did_load_symbol_vendor (false),
|
||||
m_did_parse_uuid (false),
|
||||
m_is_dynamic_loader_module (false)
|
||||
{
|
||||
if (object_name)
|
||||
m_object_name = *object_name;
|
||||
|
@ -70,14 +73,14 @@ const UUID&
|
|||
Module::GetUUID()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
if (m_flags.IsClear(flagsParsedUUID))
|
||||
if (m_did_parse_uuid == false)
|
||||
{
|
||||
ObjectFile * obj_file = GetObjectFile ();
|
||||
|
||||
if (obj_file != NULL)
|
||||
{
|
||||
obj_file->GetUUID(&m_uuid);
|
||||
m_flags.Set(flagsParsedUUID);
|
||||
m_did_parse_uuid = true;
|
||||
}
|
||||
}
|
||||
return m_uuid;
|
||||
|
@ -330,14 +333,14 @@ SymbolVendor*
|
|||
Module::GetSymbolVendor (bool can_create)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
if (m_flags.IsClear(flagsSearchedForSymVendor) && can_create)
|
||||
if (m_did_load_symbol_vendor == false && can_create)
|
||||
{
|
||||
ObjectFile *obj_file = GetObjectFile ();
|
||||
if (obj_file != NULL)
|
||||
{
|
||||
Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
||||
m_symfile_ap.reset(SymbolVendor::FindPlugin(this));
|
||||
m_flags.Set (flagsSearchedForSymVendor);
|
||||
m_did_load_symbol_vendor = true;
|
||||
}
|
||||
}
|
||||
return m_symfile_ap.get();
|
||||
|
@ -412,9 +415,9 @@ ObjectFile *
|
|||
Module::GetObjectFile()
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
if (m_flags.IsClear(flagsSearchedForObjParser))
|
||||
if (m_did_load_objfile == false)
|
||||
{
|
||||
m_flags.Set (flagsSearchedForObjParser);
|
||||
m_did_load_objfile = true;
|
||||
Timer scoped_timer(__PRETTY_FUNCTION__,
|
||||
"Module::GetObjectFile () module = %s", GetFileSpec().GetFilename().AsCString(""));
|
||||
m_objfile_ap.reset(ObjectFile::FindPlugin(this, &m_file, 0, m_file.GetByteSize()));
|
||||
|
|
|
@ -601,6 +601,9 @@ DynamicLoaderMacOSXDYLD::UpdateAllImageInfos()
|
|||
|
||||
if (image_module_sp)
|
||||
{
|
||||
if (m_dyld_image_infos[idx].header.filetype == HeaderFileTypeDynamicLinkEditor)
|
||||
image_module_sp->SetIsDynamicLinkEditor (true);
|
||||
|
||||
ObjectFile *objfile = image_module_sp->GetObjectFile ();
|
||||
if (objfile)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue