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())
return 0;
{
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;
}

View File

@ -521,7 +521,7 @@ public:
}
void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));