summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionVariable.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-01-13 08:53:35 +0000
committerSean Callanan <scallanan@apple.com>2011-01-13 08:53:35 +0000
commit92adcac9ec01e0751db8d775b12ece52625b8804 (patch)
treeb4726e59e8eda9ef4cf12f228d23ab1fdb292919 /lldb/source/Expression/ClangExpressionVariable.cpp
parent02cde7ffa49a637366e0d7f05122c582cc90d011 (diff)
downloadbcm5719-llvm-92adcac9ec01e0751db8d775b12ece52625b8804.tar.gz
bcm5719-llvm-92adcac9ec01e0751db8d775b12ece52625b8804.zip
Implemented a major overhaul of the way variables are handled
by LLDB. Instead of being materialized into the input structure passed to the expression, variables are left in place and pointers to them are materialzied into the structure. Variables not resident in memory (notably, registers) get temporary memory regions allocated for them. Persistent variables are the most complex part of this, because they are made in various ways and there are different expectations about their lifetime. Persistent variables now have flags indicating their status and what the expectations for longevity are. They can be marked as residing in target memory permanently -- this is the default for result variables from expressions entered on the command line and for explicitly declared persistent variables (but more on that below). Other result variables have their memory freed. Some major improvements resulting from this include being able to properly take the address of variables, better and cleaner support for functions that return references, and cleaner C++ support in general. One problem that remains is the problem of explicitly declared persistent variables; I have not yet implemented the code that makes references to them into indirect references, so currently materialization and dematerialization of these variables is broken. llvm-svn: 123371
Diffstat (limited to 'lldb/source/Expression/ClangExpressionVariable.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionVariable.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/lldb/source/Expression/ClangExpressionVariable.cpp b/lldb/source/Expression/ClangExpressionVariable.cpp
index 79a7e4f2fb9..bf1a3dad648 100644
--- a/lldb/source/Expression/ClangExpressionVariable.cpp
+++ b/lldb/source/Expression/ClangExpressionVariable.cpp
@@ -28,14 +28,16 @@ using namespace clang;
ClangExpressionVariable::ClangExpressionVariable(lldb::ByteOrder byte_order, uint32_t addr_byte_size) :
m_parser_vars(),
m_jit_vars (),
- m_valojb_sp (new ValueObjectConstResult(byte_order, addr_byte_size))
+ m_frozen_sp (new ValueObjectConstResult(byte_order, addr_byte_size)),
+ m_flags (EVNone)
{
}
ClangExpressionVariable::ClangExpressionVariable (const lldb::ValueObjectSP &valobj_sp) :
m_parser_vars(),
m_jit_vars (),
- m_valojb_sp (valobj_sp)
+ m_frozen_sp (valobj_sp),
+ m_flags (EVNone)
{
}
@@ -45,76 +47,76 @@ ClangExpressionVariable::ClangExpressionVariable (const lldb::ValueObjectSP &val
size_t
ClangExpressionVariable::GetByteSize ()
{
- return m_valojb_sp->GetByteSize();
+ return m_frozen_sp->GetByteSize();
}
const ConstString &
ClangExpressionVariable::GetName ()
{
- return m_valojb_sp->GetName();
+ return m_frozen_sp->GetName();
}
lldb::ValueObjectSP
ClangExpressionVariable::GetValueObject()
{
- return m_valojb_sp;
+ return m_frozen_sp;
}
lldb::RegisterInfo *
ClangExpressionVariable::GetRegisterInfo()
{
- return m_valojb_sp->GetValue().GetRegisterInfo();
+ return m_frozen_sp->GetValue().GetRegisterInfo();
}
void
ClangExpressionVariable::SetRegisterInfo (const lldb::RegisterInfo *reg_info)
{
- return m_valojb_sp->GetValue().SetContext (Value::eContextTypeRegisterInfo, const_cast<lldb::RegisterInfo *>(reg_info));
+ return m_frozen_sp->GetValue().SetContext (Value::eContextTypeRegisterInfo, const_cast<lldb::RegisterInfo *>(reg_info));
}
lldb::clang_type_t
ClangExpressionVariable::GetClangType()
{
- return m_valojb_sp->GetClangType();
+ return m_frozen_sp->GetClangType();
}
void
ClangExpressionVariable::SetClangType(lldb::clang_type_t clang_type)
{
- m_valojb_sp->GetValue().SetContext(Value::eContextTypeClangType, clang_type);
+ m_frozen_sp->GetValue().SetContext(Value::eContextTypeClangType, clang_type);
}
clang::ASTContext *
ClangExpressionVariable::GetClangAST()
{
- return m_valojb_sp->GetClangAST();
+ return m_frozen_sp->GetClangAST();
}
void
ClangExpressionVariable::SetClangAST (clang::ASTContext *ast)
{
- m_valojb_sp->SetClangAST (ast);
+ m_frozen_sp->SetClangAST (ast);
}
TypeFromUser
ClangExpressionVariable::GetTypeFromUser()
{
- TypeFromUser tfu (m_valojb_sp->GetClangType(), m_valojb_sp->GetClangAST());
+ TypeFromUser tfu (m_frozen_sp->GetClangType(), m_frozen_sp->GetClangAST());
return tfu;
}
uint8_t *
ClangExpressionVariable::GetValueBytes()
{
- const size_t byte_size = m_valojb_sp->GetByteSize();
+ const size_t byte_size = m_frozen_sp->GetByteSize();
if (byte_size > 0)
{
- if (m_valojb_sp->GetDataExtractor().GetByteSize() < byte_size)
+ if (m_frozen_sp->GetDataExtractor().GetByteSize() < byte_size)
{
- m_valojb_sp->GetValue().ResizeData(byte_size);
- m_valojb_sp->GetValue().GetData (m_valojb_sp->GetDataExtractor());
+ m_frozen_sp->GetValue().ResizeData(byte_size);
+ m_frozen_sp->GetValue().GetData (m_frozen_sp->GetDataExtractor());
}
- return const_cast<uint8_t *>(m_valojb_sp->GetDataExtractor().GetDataStart());
+ return const_cast<uint8_t *>(m_frozen_sp->GetDataExtractor().GetDataStart());
}
return NULL;
}
@@ -122,12 +124,12 @@ ClangExpressionVariable::GetValueBytes()
void
ClangExpressionVariable::SetName (const ConstString &name)
{
- m_valojb_sp->SetName (name);
+ m_frozen_sp->SetName (name);
}
void
ClangExpressionVariable::ValueUpdated ()
{
- m_valojb_sp->ValueUpdated ();
+ m_frozen_sp->ValueUpdated ();
}
OpenPOWER on IntegriCloud