aboutsummaryrefslogtreecommitdiff
path: root/source/Core/ModuleList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Core/ModuleList.cpp')
-rw-r--r--source/Core/ModuleList.cpp83
1 files changed, 58 insertions, 25 deletions
diff --git a/source/Core/ModuleList.cpp b/source/Core/ModuleList.cpp
index 669b3d9274cc..75b2ca11103a 100644
--- a/source/Core/ModuleList.cpp
+++ b/source/Core/ModuleList.cpp
@@ -22,7 +22,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Symbols.h"
-#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/VariableList.h"
@@ -70,7 +69,7 @@ ModuleList::operator= (const ModuleList& rhs)
// That's probably me nit-picking, but in theoretical situation:
//
// * that two threads A B and
- // * two ModuleList's x y do opposite assignemnts ie.:
+ // * two ModuleList's x y do opposite assignments ie.:
//
// in thread A: | in thread B:
// x = y; | y = x;
@@ -372,6 +371,7 @@ ModuleList::FindFunctions (const ConstString &name,
uint32_t lookup_name_type_mask = 0;
bool match_name_after_lookup = false;
Module::PrepareForFunctionNameLookup (name, name_type_mask,
+ eLanguageTypeUnknown, // TODO: add support
lookup_name,
lookup_name_type_mask,
match_name_after_lookup);
@@ -436,6 +436,7 @@ ModuleList::FindFunctionSymbols (const ConstString &name,
uint32_t lookup_name_type_mask = 0;
bool match_name_after_lookup = false;
Module::PrepareForFunctionNameLookup (name, name_type_mask,
+ eLanguageTypeUnknown, // TODO: add support
lookup_name,
lookup_name_type_mask,
match_name_after_lookup);
@@ -682,7 +683,7 @@ ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool na
{
// Search the module if the module is not equal to the one in the symbol
// context "sc". If "sc" contains a empty module shared pointer, then
- // the comparisong will always be true (valid_module_ptr != NULL).
+ // the comparison will always be true (valid_module_ptr != NULL).
if (sc.module_sp.get() != (*pos).get())
total_matches += (*pos)->FindTypes (world_sc, name, name_is_fully_qualified, max_matches, types);
@@ -988,18 +989,31 @@ ModuleList::GetSharedModule
// If we get in here we got the correct arch, now we just need
// to verify the UUID if one was given
if (uuid_ptr && *uuid_ptr != module_sp->GetUUID())
+ {
module_sp.reset();
+ }
else
{
- if (did_create_ptr)
- *did_create_ptr = true;
+ if (module_sp->GetObjectFile() && module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeStubLibrary)
+ {
+ module_sp.reset();
+ }
+ else
+ {
+ if (did_create_ptr)
+ {
+ *did_create_ptr = true;
+ }
- shared_module_list.ReplaceEquivalent(module_sp);
- return error;
+ shared_module_list.ReplaceEquivalent(module_sp);
+ return error;
+ }
}
}
else
+ {
module_sp.reset();
+ }
if (module_search_paths_ptr)
{
@@ -1023,18 +1037,29 @@ ModuleList::GetSharedModule
// If we get in here we got the correct arch, now we just need
// to verify the UUID if one was given
if (uuid_ptr && *uuid_ptr != module_sp->GetUUID())
+ {
module_sp.reset();
+ }
else
{
- if (did_create_ptr)
- *did_create_ptr = true;
-
- shared_module_list.ReplaceEquivalent(module_sp);
- return Error();
+ if (module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeStubLibrary)
+ {
+ module_sp.reset();
+ }
+ else
+ {
+ if (did_create_ptr)
+ *did_create_ptr = true;
+
+ shared_module_list.ReplaceEquivalent(module_sp);
+ return Error();
+ }
}
}
else
+ {
module_sp.reset();
+ }
}
}
@@ -1044,19 +1069,19 @@ ModuleList::GetSharedModule
// Fixup the incoming path in case the path points to a valid file, yet
// the arch or UUID (if one was passed in) don't match.
- FileSpec file_spec = Symbols::LocateExecutableObjectFile (module_spec);
+ ModuleSpec located_binary_modulespec = Symbols::LocateExecutableObjectFile (module_spec);
// Don't look for the file if it appears to be the same one we already
// checked for above...
- if (file_spec != module_file_spec)
+ if (located_binary_modulespec.GetFileSpec() != module_file_spec)
{
- if (!file_spec.Exists())
+ if (!located_binary_modulespec.GetFileSpec().Exists())
{
- file_spec.GetPath(path, sizeof(path));
+ located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
if (path[0] == '\0')
module_file_spec.GetPath(path, sizeof(path));
// How can this check ever be true? This branch it is false, and we haven't modified file_spec.
- if (file_spec.Exists())
+ if (located_binary_modulespec.GetFileSpec().Exists())
{
std::string uuid_str;
if (uuid_ptr && uuid_ptr->IsValid())
@@ -1084,8 +1109,9 @@ ModuleList::GetSharedModule
// function is actively working on it by doing an extra lock on the
// global mutex list.
ModuleSpec platform_module_spec(module_spec);
- platform_module_spec.GetFileSpec() = file_spec;
- platform_module_spec.GetPlatformFileSpec() = file_spec;
+ platform_module_spec.GetFileSpec() = located_binary_modulespec.GetFileSpec();
+ platform_module_spec.GetPlatformFileSpec() = located_binary_modulespec.GetFileSpec();
+ platform_module_spec.GetSymbolFileSpec() = located_binary_modulespec.GetSymbolFileSpec();
ModuleList matching_module_list;
if (shared_module_list.FindModules (platform_module_spec, matching_module_list) > 0)
{
@@ -1095,7 +1121,7 @@ ModuleList::GetSharedModule
// then we should make sure the modification time hasn't changed!
if (platform_module_spec.GetUUIDPtr() == NULL)
{
- TimeValue file_spec_mod_time(file_spec.GetModificationTime());
+ TimeValue file_spec_mod_time(located_binary_modulespec.GetFileSpec().GetModificationTime());
if (file_spec_mod_time.IsValid())
{
if (file_spec_mod_time != module_sp->GetModificationTime())
@@ -1117,16 +1143,23 @@ ModuleList::GetSharedModule
// By getting the object file we can guarantee that the architecture matches
if (module_sp && module_sp->GetObjectFile())
{
- if (did_create_ptr)
- *did_create_ptr = true;
+ if (module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeStubLibrary)
+ {
+ module_sp.reset();
+ }
+ else
+ {
+ if (did_create_ptr)
+ *did_create_ptr = true;
- shared_module_list.ReplaceEquivalent(module_sp);
+ shared_module_list.ReplaceEquivalent(module_sp);
+ }
}
else
{
- file_spec.GetPath(path, sizeof(path));
+ located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
- if (file_spec)
+ if (located_binary_modulespec.GetFileSpec())
{
if (arch.IsValid())
error.SetErrorStringWithFormat("unable to open %s architecture in '%s'", arch.GetArchitectureName(), path);