summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/JITLoader
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-07-31 11:57:34 +0000
committerPavel Labath <pavel@labath.sk>2019-07-31 11:57:34 +0000
commite84f78412bb6cf06e7ff35cb49da60596f582aa7 (patch)
tree1bbeff32b511cb6b91a5c210e0f188517db0c5bb /lldb/source/Plugins/JITLoader
parent24e4e8087f3af2f3df1d5447006d0bb87c0ebd8b (diff)
downloadbcm5719-llvm-e84f78412bb6cf06e7ff35cb49da60596f582aa7.tar.gz
bcm5719-llvm-e84f78412bb6cf06e7ff35cb49da60596f582aa7.zip
Add llvm-style RTTI to ObjectFile hierarchy
Summary: On the heels of D62934, this patch uses the same approach to introduce llvm RTTI support to the ObjectFile hierarchy. It also replaces the existing uses of GetPluginName doing run-time type checks with llvm::dyn_cast and friends. This formally introduces new dependencies from some other plugins to ObjectFile plugins. However, I believe this is fine because: - these dependencies were already kind of there, and the only reason we could get away with not modeling them explicitly was because the code was relying on magically knowing what will GetPluginName() return for a particular kind of object files. - the dependencies themselves are logical (it makes sense for SymbolVendorELF to depend on ObjectFileELF), or at least don't actively get in the way (the JitLoaderGDB->MachO thing). - they don't introduce any new dependency loops as ObjectFile plugins don't depend on any other plugins Reviewers: xiaobai, JDevlieghere, espindola Subscribers: emaste, mgorny, arichardson, MaskRay, lldb-commits Differential Revision: https://reviews.llvm.org/D65450 llvm-svn: 367413
Diffstat (limited to 'lldb/source/Plugins/JITLoader')
-rw-r--r--lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt1
-rw-r--r--lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp32
2 files changed, 14 insertions, 19 deletions
diff --git a/lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt b/lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt
index 774d85b16a2..ecdff2823d4 100644
--- a/lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt
+++ b/lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt
@@ -16,6 +16,7 @@ add_lldb_library(lldbPluginJITLoaderGDB PLUGIN
lldbSymbol
lldbTarget
lldbUtility
+ lldbPluginObjectFileMachO
LINK_COMPONENTS
Support
)
diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
index 0593af4caad..2aa284f2a5c 100644
--- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/MathExtras.h"
-
+#include "JITLoaderGDB.h"
+#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
@@ -26,8 +25,7 @@
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
-
-#include "JITLoaderGDB.h"
+#include "llvm/Support/MathExtras.h"
#include <memory>
@@ -326,20 +324,16 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
module_sp->GetObjectFile()->GetSymtab();
m_jit_objects.insert(std::make_pair(symbolfile_addr, module_sp));
- if (module_sp->GetObjectFile()->GetPluginName() ==
- ConstString("mach-o")) {
- ObjectFile *image_object_file = module_sp->GetObjectFile();
- if (image_object_file) {
- const SectionList *section_list =
- image_object_file->GetSectionList();
- if (section_list) {
- uint64_t vmaddrheuristic = 0;
- uint64_t lower = (uint64_t)-1;
- uint64_t upper = 0;
- updateSectionLoadAddress(*section_list, target, symbolfile_addr,
- symbolfile_size, vmaddrheuristic, lower,
- upper);
- }
+ if (auto image_object_file =
+ llvm::dyn_cast<ObjectFileMachO>(module_sp->GetObjectFile())) {
+ const SectionList *section_list = image_object_file->GetSectionList();
+ if (section_list) {
+ uint64_t vmaddrheuristic = 0;
+ uint64_t lower = (uint64_t)-1;
+ uint64_t upper = 0;
+ updateSectionLoadAddress(*section_list, target, symbolfile_addr,
+ symbolfile_size, vmaddrheuristic, lower,
+ upper);
}
} else {
bool changed = false;
OpenPOWER on IntegriCloud