diff options
author | Greg Clayton <gclayton@apple.com> | 2012-02-24 21:55:59 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-02-24 21:55:59 +0000 |
commit | c7f09cca6d8cd0f6da76a351548a548585d5f321 (patch) | |
tree | e98a2b6b4a7558c873acee4134557473aa082042 /lldb/source/Target/Process.cpp | |
parent | 7f99142804a94856bf2f9006922db1ed491598da (diff) | |
download | bcm5719-llvm-c7f09cca6d8cd0f6da76a351548a548585d5f321.tar.gz bcm5719-llvm-c7f09cca6d8cd0f6da76a351548a548585d5f321.zip |
Fixed a crasher that was happening after making ObjectFile objects have a
weak reference back to the Module. We were crashing when trying to make a
memory object file since it was trying to get the object in the Module
constructor before the "Module *" had been put into a shared pointer, and the
module was trying to initialize a weak pointer back to it.
llvm-svn: 151397
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index d0b7a2b8a53..fc498c6cd5a 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2222,20 +2222,26 @@ Process::ReadModuleFromMemory (const FileSpec& file_spec, bool add_image_to_target, bool load_sections_in_target) { - ModuleSP module_sp (new Module (file_spec, shared_from_this(), header_addr)); + ModuleSP module_sp (new Module (file_spec, ArchSpec())); if (module_sp) { - if (add_image_to_target) + Error error; + ObjectFile *objfile = module_sp->GetMemoryObjectFile (shared_from_this(), header_addr, error); + if (objfile) { - m_target.GetImages().Append(module_sp); - if (load_sections_in_target) + if (add_image_to_target) { - bool changed = false; - module_sp->SetLoadAddress (m_target, 0, changed); + m_target.GetImages().Append(module_sp); + if (load_sections_in_target) + { + bool changed = false; + module_sp->SetLoadAddress (m_target, 0, changed); + } } + return module_sp; } } - return module_sp; + return ModuleSP(); } Error |