Fixed two problems when reading constant/register

variables in the ValueObject code:

  - Report an error if the variable does not have
    a valid address.

  - Return the contents of the data to GetData(),
    even if the value is constant.

<rdar://problem/13690855>

llvm-svn: 179876
This commit is contained in:
Sean Callanan 2013-04-19 19:47:32 +00:00
parent e8f9bfdb71
commit ed185ab5c7
2 changed files with 19 additions and 2 deletions

View File

@ -1007,7 +1007,17 @@ ValueObject::GetData (DataExtractor& data)
ExecutionContext exe_ctx (GetExecutionContextRef());
Error error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), data, 0, GetModule().get());
if (error.Fail())
{
if (m_data.GetByteSize())
{
data = m_data;
return data.GetByteSize();
}
else
{
return 0;
}
}
data.SetAddressByteSize(m_data.GetAddressByteSize());
data.SetByteOrder(m_data.GetByteOrder());
return data.GetByteSize();
@ -3832,6 +3842,13 @@ ValueObject::AddressOf (Error &error)
break;
}
}
else
{
StreamString expr_path_strm;
GetExpressionPath(expr_path_strm, true);
error.SetErrorStringWithFormat("'%s' doesn't have a valid address", expr_path_strm.GetString().c_str());
}
return m_addr_of_valobj_sp;
}