summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/ValueObject.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-02-24 01:59:29 +0000
committerGreg Clayton <gclayton@apple.com>2012-02-24 01:59:29 +0000
commite72dfb321c5977c65f2d95b8b9d250b69a290b6c (patch)
tree1141c7e9afa82b440290a8b2578501deb85fb096 /lldb/source/Core/ValueObject.cpp
parentda970541146d44d426b4306d3692cce19fae9689 (diff)
downloadbcm5719-llvm-e72dfb321c5977c65f2d95b8b9d250b69a290b6c.tar.gz
bcm5719-llvm-e72dfb321c5977c65f2d95b8b9d250b69a290b6c.zip
<rdar://problem/10103468>
I started work on being able to add symbol files after a debug session had started with a new "target symfile add" command and quickly ran into problems with stale Address objects in breakpoint locations that had lldb_private::Section pointers into modules that had been removed or replaced. This also let to grabbing stale modules from those sections. So I needed to thread harded the Address, Section and related objects. To do this I modified the ModuleChild class to now require a ModuleSP on initialization so that a weak reference can created. I also changed all places that were handing out "Section *" to have them hand out SectionSP. All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild so all of the find plug-in, static creation function and constructors now require ModuleSP references instead of Module *. Address objects now have weak references to their sections which can safely go stale when a module gets destructed. This checkin doesn't complete the "target symfile add" command, but it does get us a lot clioser to being able to do such things without a high risk of crashing or memory corruption. llvm-svn: 151336
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
-rw-r--r--lldb/source/Core/ValueObject.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 15885eb691f..7c8cd7f62ed 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -817,11 +817,11 @@ ValueObject::GetPointeeData (DataExtractor& data,
{
case eAddressTypeFile:
{
- Module* module = GetModule();
- if (module)
+ ModuleSP module_sp (GetModule());
+ if (module_sp)
{
Address so_addr;
- module->ResolveFileAddress(addr, so_addr);
+ module_sp->ResolveFileAddress(addr, so_addr);
ExecutionContext exe_ctx (GetExecutionContextRef());
Target* target = exe_ctx.GetTargetPtr();
if (target)
@@ -873,7 +873,7 @@ ValueObject::GetData (DataExtractor& data)
{
UpdateValueIfNeeded(false);
ExecutionContext exe_ctx (GetExecutionContextRef());
- Error error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), data, 0, GetModule());
+ Error error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), data, 0, GetModule().get());
if (error.Fail())
return 0;
data.SetAddressByteSize(m_data.GetAddressByteSize());
@@ -956,7 +956,7 @@ ValueObject::ReadPointedString (Stream& s,
}
if (cstr_address != 0 && cstr_address != LLDB_INVALID_ADDRESS)
{
- Address cstr_so_addr (NULL, cstr_address);
+ Address cstr_so_addr (cstr_address);
DataExtractor data;
size_t bytes_read = 0;
if (cstr_len > 0 && honor_array)
@@ -3383,7 +3383,7 @@ ValueObject::CreateConstantValue (const ConstString &name)
data.SetByteOrder (m_data.GetByteOrder());
data.SetAddressByteSize(m_data.GetAddressByteSize());
- m_error = m_value.GetValueAsData (&exe_ctx, ast, data, 0, GetModule());
+ m_error = m_value.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
ast,
@@ -3543,7 +3543,7 @@ ValueObject::CastPointerType (const char *name, ClangASTType &clang_ast_type)
if (ptr_value != LLDB_INVALID_ADDRESS)
{
- Address ptr_addr (NULL, ptr_value);
+ Address ptr_addr (ptr_value);
ExecutionContext exe_ctx (GetExecutionContextRef());
valobj_sp = ValueObjectMemory::Create (exe_ctx.GetBestExecutionContextScope(),
name,
@@ -3562,7 +3562,7 @@ ValueObject::CastPointerType (const char *name, TypeSP &type_sp)
if (ptr_value != LLDB_INVALID_ADDRESS)
{
- Address ptr_addr (NULL, ptr_value);
+ Address ptr_addr (ptr_value);
ExecutionContext exe_ctx (GetExecutionContextRef());
valobj_sp = ValueObjectMemory::Create (exe_ctx.GetBestExecutionContextScope(),
name,
OpenPOWER on IntegriCloud