[Lldb-commits] [lldb] r113313 - in /lldb/trunk: include/lldb/Core/Module.h source/Core/Module.cpp source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
Greg Clayton
gclayton at apple.com
Tue Sep 7 16:40:05 PDT 2010
Author: gclayton
Date: Tue Sep 7 18:40:05 2010
New Revision: 113313
URL: http://llvm.org/viewvc/llvm-project?rev=113313&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=113313&r1=113312&r2=113313&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Sep 7 18:40:05 2010
@@ -49,13 +49,6 @@
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 @@
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 @@
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 @@
/// @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);
};
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=113313&r1=113312&r2=113313&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue Sep 7 18:40:05 2010
@@ -26,10 +26,13 @@
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 @@
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 @@
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 @@
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()));
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=113313&r1=113312&r2=113313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue Sep 7 18:40:05 2010
@@ -601,6 +601,9 @@
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)
{
More information about the lldb-commits
mailing list