InstructionList &instruction_list = disassembler_sp->GetInstructionList();
instruction_list.Dump(&stream, true, true, &exe_ctx);
-
+
// FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
// I'll fix that but for now, just clear the list and it will go away nicely.
disassembler_sp->GetInstructionList().Clear();
{
relocModel = llvm::Reloc::PIC_;
}
-
+
// This will be small for 32-bit and large for 64-bit.
codeModel = llvm::CodeModel::JITDefault;
mAttrs);
m_execution_engine_ap.reset(builder.create(target_machine));
-
+
m_strip_underscore = (m_execution_engine_ap->getDataLayout().getGlobalPrefix() == '_');
if (!m_execution_engine_ap.get())
if (m_failed_lookups.size())
{
StreamString ss;
-
+
ss.PutCString("Couldn't lookup symbols:\n");
-
+
bool emitNewLine = false;
-
+
for (const ConstString &failed_lookup : m_failed_lookups)
{
if (emitNewLine)
ss.PutCString(" ");
ss.PutCString(Mangled(failed_lookup).GetDemangledName(lldb::eLanguageTypeObjC_plus_plus).AsCString());
}
-
+
m_failed_lookups.clear();
-
+
error.SetErrorString(ss.GetData());
-
+
return;
}
-
+
m_function_load_addr = LLDB_INVALID_ADDRESS;
m_function_end_load_addr = LLDB_INVALID_ADDRESS;
else
{
record.dump(log);
-
+
DataExtractor my_extractor ((const void*)record.m_host_address, record.m_size, lldb::eByteOrderBig, 8);
my_extractor.PutToLog(log, 0, record.m_size, record.m_host_address, 16, DataExtractor::TypeUInt8);
}
{
Mangled mangled(name, true);
ConstString demangled = mangled.GetDemangledName(lldb::eLanguageTypeC_plus_plus);
-
+
if (demangled)
{
ConstString best_alternate_mangled_name = FindBestAlternateMangledName(demangled, lldb::eLanguageTypeC_plus_plus, sc);
-
+
if (best_alternate_mangled_name)
{
CPP_specs.push_back(best_alternate_mangled_name);
}
-
+
CPP_specs.push_back(SearchSpec(demangled, lldb::eFunctionNameTypeFull));
}
}
-
+
// Maybe we're looking for a const symbol but the debug info told us it was const...
if (!strncmp(name.GetCString(), "_ZN", 3) &&
strncmp(name.GetCString(), "_ZNK", 4))
fixed_scratch.append(name.GetCString() + 3);
CPP_specs.push_back(ConstString(fixed_scratch.c_str()));
}
-
+
// Maybe we're looking for a static symbol but we thought it was global...
if (!strncmp(name.GetCString(), "_Z", 2) &&
strncmp(name.GetCString(), "_ZL", 3))
const bool is_external = (candidate_sc.function) ||
(candidate_sc.symbol && candidate_sc.symbol->IsExternal());
- AddressRange range;
+ load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
- if (candidate_sc.GetAddressRange(lldb::eSymbolContextFunction | lldb::eSymbolContextSymbol,
- 0,
- false,
- range))
- {
- load_address = range.GetBaseAddress().GetCallableLoadAddress(target);
+ if (load_address == LLDB_INVALID_ADDRESS)
+ load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target);
- if (load_address != LLDB_INVALID_ADDRESS)
+ if (load_address != LLDB_INVALID_ADDRESS)
+ {
+ if (is_external)
{
- if (is_external)
- {
- return true;
- }
- else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
- {
- best_internal_load_address = load_address;
- load_address = LLDB_INVALID_ADDRESS;
- }
+ return true;
+ }
+ else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
+ {
+ best_internal_load_address = load_address;
+ load_address = LLDB_INVALID_ADDRESS;
}
}
}
return false;
};
-
+
if (sc.module_sp)
{
sc.module_sp->FindFunctions(spec.name,
{
sc_list.Clear();
}
-
+
if (sc_list.GetSize() == 0 && sc.target_sp)
{
sc.target_sp->GetImages().FindFunctions(spec.name,
true, // append
sc_list);
}
-
+
if (get_external_load_address(load_address, sc_list, sc))
{
return load_address;
return best_internal_load_address;
}
}
-
+
return LLDB_INVALID_ADDRESS;
}
IRExecutionUnit::FindInRuntimes(const std::vector<SearchSpec> &specs, const lldb_private::SymbolContext &sc)
{
lldb::TargetSP target_sp = sc.target_sp;
-
+
if (!target_sp)
{
return LLDB_INVALID_ADDRESS;
}
-
+
lldb::ProcessSP process_sp = sc.target_sp->GetProcessSP();
-
+
if (!process_sp)
{
return LLDB_INVALID_ADDRESS;
for (const SearchSpec &spec : specs)
{
lldb::addr_t symbol_load_addr = runtime->LookupRuntimeSymbol(spec.name);
-
+
if (symbol_load_addr != LLDB_INVALID_ADDRESS)
return symbol_load_addr;
}
}
-
+
return LLDB_INVALID_ADDRESS;
}
{
std::vector<SearchSpec> candidate_C_names;
std::vector<SearchSpec> candidate_CPlusPlus_names;
-
+
CollectCandidateCNames(candidate_C_names, name);
lldb::addr_t ret = FindInSymbols(candidate_C_names, m_sym_ctx);
if (ret == LLDB_INVALID_ADDRESS)
ret = FindInRuntimes(candidate_C_names, m_sym_ctx);
-
+
if (ret == LLDB_INVALID_ADDRESS)
{
CollectCandidateCPlusPlusNames(candidate_CPlusPlus_names, candidate_C_names, m_sym_ctx);
ret = FindInSymbols(candidate_CPlusPlus_names, m_sym_ctx);
}
-
+
return ret;
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
ConstString name_cs(Name.c_str());
-
+
lldb::addr_t ret = m_parent.FindSymbol(name_cs);
-
+
if (ret == LLDB_INVALID_ADDRESS)
{
if (log)
IRExecutionUnit::MemoryManager::getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure) {
assert (sizeof(void *) == 8);
-
+
return (void*)getSymbolAddress(Name);
}