summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-03-24 23:10:19 +0000
committerGreg Clayton <gclayton@apple.com>2014-03-24 23:10:19 +0000
commit23f8c95a4439767cf9c7dc9d7a35eb55dc78b9d0 (patch)
tree3e56f285be57acf15b3fb73195567727a329aca9 /lldb/source/Core/Module.cpp
parent2256d0dcedf887593ebfb35db860827e8682807e (diff)
downloadbcm5719-llvm-23f8c95a4439767cf9c7dc9d7a35eb55dc78b9d0.tar.gz
bcm5719-llvm-23f8c95a4439767cf9c7dc9d7a35eb55dc78b9d0.zip
JITed functions can now have debug info and be debugged with debug and source info:
(lldb) b puts (lldb) expr -g -i0 -- (int)puts("hello") First we will stop at the entry point of the expression before it runs, then we can step over a few times and hit the breakpoint in "puts", then we can continue and finishing stepping and fininsh the expression. Main features: - New ObjectFileJIT class that can be easily created for JIT functions - debug info can now be enabled when parsing expressions - source for any function that is run throught the JIT is now saved in LLDB process specific temp directory and cleaned up on exit - "expr -g --" allows you to single step through your expression function with source code <rdar://problem/16382881> llvm-svn: 204682
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 588c3eacc11..e6f2daa76e7 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -37,6 +37,8 @@
#include "lldb/Target/Target.h"
#include "lldb/Symbol/SymbolFile.h"
+#include "Plugins/ObjectFile/JIT/ObjectFileJIT.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -145,6 +147,7 @@ Module::Module (const ModuleSpec &module_spec) :
m_symfile_ap (),
m_ast (),
m_source_mappings (),
+ m_sections_ap(),
m_did_load_objfile (false),
m_did_load_symbol_vendor (false),
m_did_parse_uuid (false),
@@ -219,6 +222,7 @@ Module::Module(const FileSpec& file_spec,
m_symfile_ap (),
m_ast (),
m_source_mappings (),
+ m_sections_ap(),
m_did_load_objfile (false),
m_did_load_symbol_vendor (false),
m_did_parse_uuid (false),
@@ -250,6 +254,35 @@ Module::Module(const FileSpec& file_spec,
m_object_name.IsEmpty() ? "" : ")");
}
+Module::Module () :
+ m_mutex (Mutex::eMutexTypeRecursive),
+ m_mod_time (),
+ m_arch (),
+ m_uuid (),
+ m_file (),
+ m_platform_file(),
+ m_remote_install_file (),
+ m_symfile_spec (),
+ m_object_name (),
+ m_object_offset (0),
+ m_object_mod_time (),
+ m_objfile_sp (),
+ m_symfile_ap (),
+ m_ast (),
+ m_source_mappings (),
+ m_sections_ap(),
+ m_did_load_objfile (false),
+ m_did_load_symbol_vendor (false),
+ m_did_parse_uuid (false),
+ m_did_init_ast (false),
+ m_is_dynamic_loader_module (false),
+ m_file_has_changed (false),
+ m_first_file_changed_log (false)
+{
+ Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+ GetModuleCollection().push_back(this);
+}
+
Module::~Module()
{
// Lock our module down while we tear everything down to make sure
@@ -1722,3 +1755,27 @@ Module::PrepareForFunctionNameLookup (const ConstString &name,
match_name_after_lookup = false;
}
}
+
+ModuleSP
+Module::CreateJITModule (const lldb::ObjectFileJITDelegateSP &delegate_sp)
+{
+ if (delegate_sp)
+ {
+ // Must create a module and place it into a shared pointer before
+ // we can create an object file since it has a std::weak_ptr back
+ // to the module, so we need to control the creation carefully in
+ // this static function
+ ModuleSP module_sp(new Module());
+ module_sp->m_objfile_sp.reset (new ObjectFileJIT (module_sp, delegate_sp));
+ if (module_sp->m_objfile_sp)
+ {
+ // Once we get the object file, update our module with the object file's
+ // architecture since it might differ in vendor/os if some parts were
+ // unknown.
+ module_sp->m_objfile_sp->GetArchitecture (module_sp->m_arch);
+ }
+ return module_sp;
+ }
+ return ModuleSP();
+}
+
OpenPOWER on IntegriCloud