Added checks to the expresssion parser which make

searching for variables and symbols in the target
more robust.  These checks prevent variables from
being reported as existing if they cannot actually
be evaluated in the current context.

llvm-svn: 134656
This commit is contained in:
Sean Callanan 2011-07-07 23:05:43 +00:00
parent 7fcce6829d
commit c6466fc9ab
1 changed files with 13 additions and 1 deletions

View File

@ -552,6 +552,9 @@ ClangExpressionDeclMap::GetFunctionAddress
else
return false;
if (!func_so_addr || !func_so_addr->IsValid())
return false;
func_addr = func_so_addr->GetCallableLoadAddress (m_parser_vars->m_exe_ctx->target);
return true;
@ -573,6 +576,10 @@ ClangExpressionDeclMap::GetSymbolAddress (Target &target, const ConstString &nam
sc_list.GetContextAtIndex(i, sym_ctx);
const Address *sym_address = &sym_ctx.symbol->GetAddressRangeRef().GetBaseAddress();
if (!sym_address || !sym_address->IsValid())
return LLDB_INVALID_ADDRESS;
if (sym_address)
{
switch (sym_ctx.symbol->GetType())
@ -1592,6 +1599,11 @@ ClangExpressionDeclMap::FindVariableInScope
}
}
if (!var_sp ||
!var_sp->IsInScope(&frame) ||
!var_sp->LocationIsValidForFrame (&frame))
return lldb::VariableSP();
if (var_sp && type)
{
if (type->GetASTContext() == var_sp->GetType()->GetClangAST())