Author: xiaobai Date: Mon Jun 3 15:41:48 2019 New Revision: 362458 URL: http://llvm.org/viewvc/llvm-project?rev=362458&view=rev Log: [Target] Move ObjCLanguageRuntime::LookupRuntimeSymbol into LanguageRuntime
Summary: LookupRuntimeSymbol seems like a general LanguageRuntime method. Although no other language runtime currently implements this, there's no reason another language runtime couldn't use this. Additionally, this breaks IRExecutionUnit's dependency on ObjCLanguageRuntime. Reviewers: compnerd, labath, JDevlieghere, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D62795 Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h lldb/trunk/source/Expression/IRExecutionUnit.cpp Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=362458&r1=362457&r2=362458&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Mon Jun 3 15:41:48 2019 @@ -166,6 +166,13 @@ public: return false; } + // Given the name of a runtime symbol (e.g. in Objective-C, an ivar offset + // symbol), try to determine from the runtime what the value of that symbol + // would be. Useful when the underlying binary is stripped. + virtual lldb::addr_t LookupRuntimeSymbol(ConstString name) { + return LLDB_INVALID_ADDRESS; + } + protected: // Classes that inherit from LanguageRuntime can see and modify these Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=362458&r1=362457&r2=362458&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Mon Jun 3 15:41:48 2019 @@ -264,13 +264,6 @@ public: virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name); - // Given the name of an Objective-C runtime symbol (e.g., ivar offset - // symbol), try to determine from the runtime what the value of that symbol - // would be. Useful when the underlying binary is stripped. - virtual lldb::addr_t LookupRuntimeSymbol(ConstString name) { - return LLDB_INVALID_ADDRESS; - } - bool HasNewLiteralsAndIndexing() { if (m_has_new_literals_and_indexing == eLazyBoolCalculate) { if (CalculateHasNewLiteralsAndIndexing()) Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=362458&r1=362457&r2=362458&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original) +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Mon Jun 3 15:41:48 2019 @@ -24,7 +24,7 @@ #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" @@ -902,10 +902,8 @@ IRExecutionUnit::FindInRuntimes(const st return LLDB_INVALID_ADDRESS; } - ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); - - if (runtime) { - for (const SearchSpec &spec : specs) { + for (const SearchSpec &spec : specs) { + for (LanguageRuntime *runtime : process_sp->GetLanguageRuntimes()) { lldb::addr_t symbol_load_addr = runtime->LookupRuntimeSymbol(spec.name); if (symbol_load_addr != LLDB_INVALID_ADDRESS) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits