Skip to content

[lldb] Fix merge after r375160 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lldb/source/Core/ModuleList.cpp
Original file line number Diff line number Diff line change
@@ -424,6 +424,8 @@ void ModuleList::FindFunctionSymbols(ConstString name,
void ModuleList::FindFunctions(const RegularExpression &name,
bool include_symbols, bool include_inlines,
SymbolContextList &sc_list) {
const size_t initial_size = sc_list.GetSize();

std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
collection::const_iterator pos, end = m_modules.end();
collection dylinker_modules;
@@ -504,6 +506,8 @@ void ModuleList::FindSymbolsWithNameAndType(ConstString name,
SymbolType symbol_type,
SymbolContextList &sc_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
const size_t initial_size = sc_list.GetSize();

collection::const_iterator pos, end = m_modules.end();
collection dylinker_modules;
for (pos = m_modules.begin(); pos != end; ++pos) {
@@ -528,6 +532,8 @@ void ModuleList::FindSymbolsMatchingRegExAndType(
const RegularExpression &regex, lldb::SymbolType symbol_type,
SymbolContextList &sc_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
const size_t initial_size = sc_list.GetSize();

collection::const_iterator pos, end = m_modules.end();
collection dylinker_modules;
for (pos = m_modules.begin(); pos != end; ++pos) {
8 changes: 4 additions & 4 deletions lldb/source/Core/SourceManager.cpp
Original file line number Diff line number Diff line change
@@ -334,10 +334,10 @@ static lldb_private::LineEntry FindEntryPoint(Module *exe_module) {
SymbolContextList sc_list;
bool symbols_okay = false; // Force it to be a debug symbol.
bool inlines_okay = true;
bool append = false;
size_t num_matches = exe_module->FindFunctions(
entry_point_name, NULL, lldb::eFunctionNameTypeBase, inlines_okay,
symbols_okay, append, sc_list);
exe_module->FindFunctions(entry_point_name, NULL,
lldb::eFunctionNameTypeBase, inlines_okay,
symbols_okay, sc_list);
size_t num_matches = sc_list.GetSize();
for (size_t idx = 0; idx < num_matches; idx++) {
SymbolContext sc;
sc_list.GetContextAtIndex(idx, sc);
10 changes: 6 additions & 4 deletions lldb/source/Symbol/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
@@ -3846,8 +3846,9 @@ void SwiftASTContext::LoadModule(swift::ModuleDecl *swift_module,
module_spec.GetFileSpec().GetFilename() = library_cstr;
lldb_private::ModuleList matching_module_list;
bool module_already_loaded = false;
if (process.GetTarget().GetImages().FindModules(module_spec,
matching_module_list)) {
process.GetTarget().GetImages().FindModules(module_spec,
matching_module_list);
if (!matching_module_list.IsEmpty()) {
matching_module_list.ForEach(
[&module_already_loaded, &module_spec,
&framework_name](const ModuleSP &module_sp) -> bool {
@@ -4037,8 +4038,9 @@ bool SwiftASTContext::LoadLibraryUsingPaths(
module_spec.GetFileSpec().GetFilename().SetCString(library_fullname.c_str());
lldb_private::ModuleList matching_module_list;

if (process.GetTarget().GetImages().FindModules(module_spec,
matching_module_list) > 0) {
process.GetTarget().GetImages().FindModules(module_spec,
matching_module_list);
if (!matching_module_list.IsEmpty()) {
LOG_PRINTF(LIBLLDB_LOG_TYPES, "Skipping module %s as it is already loaded.",
library_fullname.c_str());
return true;
15 changes: 9 additions & 6 deletions lldb/source/Target/SwiftLanguageRuntime.cpp
Original file line number Diff line number Diff line change
@@ -192,8 +192,8 @@ FindSymbolForSwiftObject(Target &target, ConstString object,
llvm::Optional<lldb::addr_t> retval;

SymbolContextList sc_list;
if (target.GetImages().FindSymbolsWithNameAndType(object, sym_type,
sc_list)) {
target.GetImages().FindSymbolsWithNameAndType(object, sym_type, sc_list);
if (!sc_list.IsEmpty()) {
SymbolContext SwiftObject_Class;
if (sc_list.GetSize() == 1 &&
sc_list.GetContextAtIndex(0, SwiftObject_Class)) {
@@ -965,8 +965,9 @@ class LLDBMemoryReader : public swift::remote::MemoryReader {

ConstString name_cs(name.c_str(), name.size());
SymbolContextList sc_list;
if (!m_process->GetTarget().GetImages().FindSymbolsWithNameAndType(
name_cs, lldb::eSymbolTypeAny, sc_list)) {
m_process->GetTarget().GetImages().FindSymbolsWithNameAndType(
name_cs, lldb::eSymbolTypeAny, sc_list);
if (sc_list.IsEmpty()) {
LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
"[MemoryReader] symbol resoution failed {0}", name);
return swift::remote::RemoteAddress(nullptr);
@@ -2516,8 +2517,10 @@ bool SwiftLanguageRuntime::GetTargetOfPartialApply(SymbolContext &curr_sc,

std::string apply_target = demangle_ctx.getThunkTarget(apply_name.GetStringRef());
if (!apply_target.empty()) {
size_t num_symbols = curr_sc.module_sp->FindFunctions(
ConstString(apply_target), NULL, eFunctionNameTypeFull, true, false, false, sc_list);
curr_sc.module_sp->FindFunctions(ConstString(apply_target), NULL,
eFunctionNameTypeFull, true, false,
sc_list);
size_t num_symbols = sc_list.GetSize();
if (num_symbols == 0)
return false;

4 changes: 2 additions & 2 deletions lldb/source/Target/Target.cpp
Original file line number Diff line number Diff line change
@@ -3085,8 +3085,8 @@ lldb::addr_t Target::FindLoadAddrForNameInSymbolsAndPersistentVariables(
lldb::addr_t symbol_addr = LLDB_INVALID_ADDRESS;
SymbolContextList sc_list;

if (GetImages().FindSymbolsWithNameAndType(name_const_str, symbol_type,
sc_list)) {
GetImages().FindSymbolsWithNameAndType(name_const_str, symbol_type, sc_list);
if (!sc_list.IsEmpty()) {
SymbolContext desired_symbol;

if (sc_list.GetSize() == 1 &&