diff options
author | Greg Clayton <gclayton@apple.com> | 2015-06-25 21:46:34 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2015-06-25 21:46:34 +0000 |
commit | 358cf1ea302ebc9c2f307aa710c22821a4ab670a (patch) | |
tree | 6107730cfdba431365534feddc2af4c36d12facc /lldb/source/Plugins/LanguageRuntime | |
parent | aed187c76e884dcb96e55312c16e1335580a2ed9 (diff) | |
download | bcm5719-llvm-358cf1ea302ebc9c2f307aa710c22821a4ab670a.tar.gz bcm5719-llvm-358cf1ea302ebc9c2f307aa710c22821a4ab670a.zip |
Resubmitting 240466 after fixing the linux test suite failures.
A few extras were fixed
- Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected.
- Since some places want to access the address as a reference, I added a few new functions to symbol:
Address &Symbol::GetAddressRef();
const Address &Symbol::GetAddressRef() const;
Linux test suite passes just fine now.
<rdar://problem/21494354>
llvm-svn: 240702
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime')
4 files changed, 16 insertions, 18 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index 792886f1bcf..9f0f6aa3c48 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -299,13 +299,13 @@ AppleObjCRuntimeV1::GetISAHashTablePointer () static ConstString g_objc_debug_class_hash("_objc_debug_class_hash"); const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(g_objc_debug_class_hash, lldb::eSymbolTypeData); - if (symbol) + if (symbol && symbol->ValueIsAddress()) { Process *process = GetProcess(); if (process) { - lldb::addr_t objc_debug_class_hash_addr = symbol->GetAddress().GetLoadAddress(&process->GetTarget()); + lldb::addr_t objc_debug_class_hash_addr = symbol->GetAddressRef().GetLoadAddress(&process->GetTarget()); if (objc_debug_class_hash_addr != LLDB_INVALID_ADDRESS) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 02d9350ba90..54a253c8200 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -321,9 +321,9 @@ ExtractRuntimeGlobalSymbol (Process* process, if (!byte_size) byte_size = process->GetAddressByteSize(); const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(name, lldb::eSymbolTypeData); - if (symbol) + if (symbol && symbol->ValueIsAddress()) { - lldb::addr_t symbol_load_addr = symbol->GetAddress().GetLoadAddress(&process->GetTarget()); + lldb::addr_t symbol_load_addr = symbol->GetAddressRef().GetLoadAddress(&process->GetTarget()); if (symbol_load_addr != LLDB_INVALID_ADDRESS) { if (read_value) @@ -815,7 +815,7 @@ AppleObjCRuntimeV2::GetByteOffsetForIvar (ClangASTType &parent_ast_type, const c if (sc_list.GetSize() == 1 && sc_list.GetContextAtIndex(0, ivar_offset_symbol)) { if (ivar_offset_symbol.symbol) - ivar_offset_address = ivar_offset_symbol.symbol->GetAddress().GetLoadAddress (&target); + ivar_offset_address = ivar_offset_symbol.symbol->GetLoadAddress (&target); } //---------------------------------------------------------------------- @@ -1191,7 +1191,7 @@ AppleObjCRuntimeV2::GetISAHashTablePointer () const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_objc_realized_classes, lldb::eSymbolTypeAny); if (symbol) { - lldb::addr_t gdb_objc_realized_classes_ptr = symbol->GetAddress().GetLoadAddress(&process->GetTarget()); + lldb::addr_t gdb_objc_realized_classes_ptr = symbol->GetLoadAddress(&process->GetTarget()); if (gdb_objc_realized_classes_ptr != LLDB_INVALID_ADDRESS) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index dd2d0e035d9..5d82f16722e 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -471,10 +471,7 @@ AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols () eSymbolTypeData); if (trampoline_symbol != NULL) { - if (!trampoline_symbol->GetAddress().IsValid()) - return false; - - m_trampoline_header = trampoline_symbol->GetAddress().GetLoadAddress(&target); + m_trampoline_header = trampoline_symbol->GetLoadAddress(&target); if (m_trampoline_header == LLDB_INVALID_ADDRESS) return false; @@ -484,10 +481,11 @@ AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols () eSymbolTypeCode); if (changed_symbol != NULL) { - if (!changed_symbol->GetAddress().IsValid()) + const Address changed_symbol_addr = changed_symbol->GetAddress(); + if (!changed_symbol_addr.IsValid()) return false; - lldb::addr_t changed_addr = changed_symbol->GetAddress().GetOpcodeLoadAddress (&target); + lldb::addr_t changed_addr = changed_symbol_addr.GetOpcodeLoadAddress (&target); if (changed_addr != LLDB_INVALID_ADDRESS) { BreakpointSP trampolines_changed_bp_sp = target.CreateBreakpoint (changed_addr, true, false); @@ -703,13 +701,13 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process { ConstString name_const_str(g_dispatch_functions[i].name); const Symbol *msgSend_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType (name_const_str, eSymbolTypeCode); - if (msgSend_symbol) + if (msgSend_symbol && msgSend_symbol->ValueIsAddress()) { // FixMe: Make g_dispatch_functions static table of DispatchFunctions, and have the map be address->index. // Problem is we also need to lookup the dispatch function. For now we could have a side table of stret & non-stret // dispatch functions. If that's as complex as it gets, we're fine. - lldb::addr_t sym_addr = msgSend_symbol->GetAddress().GetOpcodeLoadAddress(target); + lldb::addr_t sym_addr = msgSend_symbol->GetAddressRef().GetOpcodeLoadAddress(target); m_msgSend_map.insert(std::pair<lldb::addr_t, int>(sym_addr, i)); } diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index da36b19f321..2490cf31409 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -422,7 +422,7 @@ RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module, ModuleKind kind) const Symbol *sym = module->FindFirstSymbolWithNameAndType(ConstString(hook_defn->symbol_name), eSymbolTypeCode); - addr_t addr = sym->GetAddress().GetLoadAddress(&target); + addr_t addr = sym->GetLoadAddress(&target); if (addr == LLDB_INVALID_ADDRESS) { if(log) @@ -542,7 +542,7 @@ RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp) Error error; uint32_t flag = 0x00000001U; Target &target = GetProcess()->GetTarget(); - addr_t addr = debug_present->GetAddress().GetLoadAddress(&target); + addr_t addr = debug_present->GetLoadAddress(&target); GetProcess()->WriteMemory(addr, &flag, sizeof(flag), error); if(error.Success()) { @@ -597,7 +597,7 @@ RSModuleDescriptor::ParseRSInfo() const Symbol *info_sym = m_module->FindFirstSymbolWithNameAndType(ConstString(".rs.info"), eSymbolTypeData); if (info_sym) { - const addr_t addr = info_sym->GetAddress().GetFileAddress(); + const addr_t addr = info_sym->GetAddressRef().GetFileAddress(); const addr_t size = info_sym->GetByteSize(); const FileSpec fs = m_module->GetFileSpec(); @@ -809,7 +809,7 @@ RenderScriptRuntime::AttemptBreakpointAtKernelName(Stream &strm, const char* nam } } - addr_t bp_addr = kernel_sym->GetAddress().GetLoadAddress(&GetProcess()->GetTarget()); + addr_t bp_addr = kernel_sym->GetLoadAddress(&GetProcess()->GetTarget()); if (bp_addr == LLDB_INVALID_ADDRESS) { error.SetErrorStringWithFormat("Could not locate load address for symbols of kernel '%s'.", name); |