summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp63
1 files changed, 41 insertions, 22 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 1944495591e..4570e018619 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -515,6 +515,7 @@ FindCodeSymbolInContext
{
case eSymbolTypeCode:
case eSymbolTypeResolver:
+ case eSymbolTypeReExported:
sc_list.Append(sym_ctx);
break;
@@ -547,7 +548,8 @@ ClangExpressionDeclMap::GetFunctionAddress
FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list);
- if (!sc_list.GetSize())
+ uint32_t sc_list_size = sc_list.GetSize();
+ if (sc_list_size == 0)
{
// We occasionally get debug information in which a const function is reported
// as non-const, so the mangled name is wrong. This is a hack to compensate.
@@ -563,32 +565,49 @@ ClangExpressionDeclMap::GetFunctionAddress
log->Printf("Failed to find symbols given non-const name %s; trying %s", name.GetCString(), fixed_name.GetCString());
FindCodeSymbolInContext(fixed_name, m_parser_vars->m_sym_ctx, sc_list);
+ sc_list_size = sc_list.GetSize();
}
}
-
- if (!sc_list.GetSize())
- return false;
-
- SymbolContext sym_ctx;
- sc_list.GetContextAtIndex(0, sym_ctx);
-
- const Address *func_so_addr = NULL;
- bool is_indirect_function = false;
-
- if (sym_ctx.function)
- func_so_addr = &sym_ctx.function->GetAddressRange().GetBaseAddress();
- else if (sym_ctx.symbol) {
- func_so_addr = &sym_ctx.symbol->GetAddress();
- is_indirect_function = sym_ctx.symbol->IsIndirect();
- } else
- return false;
- if (!func_so_addr || !func_so_addr->IsValid())
- return false;
+ for (uint32_t i=0; i<sc_list_size; ++i)
+ {
+ SymbolContext sym_ctx;
+ sc_list.GetContextAtIndex(i, sym_ctx);
- func_addr = func_so_addr->GetCallableLoadAddress (target, is_indirect_function);
+ const Address *func_so_addr = NULL;
+ bool is_indirect_function = false;
+ if (sym_ctx.function)
+ func_so_addr = &sym_ctx.function->GetAddressRange().GetBaseAddress();
+ else if (sym_ctx.symbol)
+ {
+ if (sym_ctx.symbol->GetType() == eSymbolTypeReExported)
+ {
+ Symbol *reexported_symbol = sym_ctx.symbol->ResolveReExportedSymbol(*target);
+ if (reexported_symbol)
+ {
+ func_so_addr = &reexported_symbol->GetAddress();
+ is_indirect_function = reexported_symbol->IsIndirect();
+ }
+ }
+ else
+ {
+ func_so_addr = &sym_ctx.symbol->GetAddress();
+ is_indirect_function = sym_ctx.symbol->IsIndirect();
+ }
+ }
- return true;
+ if (func_so_addr && func_so_addr->IsValid())
+ {
+ lldb::addr_t load_addr = func_so_addr->GetCallableLoadAddress (target, is_indirect_function);
+
+ if (load_addr != LLDB_INVALID_ADDRESS)
+ {
+ func_addr = load_addr;
+ return true;
+ }
+ }
+ }
+ return false;
}
addr_t
OpenPOWER on IntegriCloud