merge lldb-platform-work branch (and assorted fixes) into trunk

Summary:
    This merge brings in the improved 'platform' command that knows how to
    interface with remote machines; that is, query OS/kernel information, push
    and pull files, run shell commands, etc... and implementation for the new
    communication packets that back that interface, at least on Darwin based
    operating systems via the POSIXPlatform class. Linux support is coming soon.

    Verified the test suite runs cleanly on Linux (x86_64), build OK on Mac OS
    X Mountain Lion.

    Additional improvements (not in the source SVN branch 'lldb-platform-work'):
    - cmake build scripts for lldb-platform
    - cleanup test suite
    - documentation stub for qPlatform_RunCommand
    - use log class instead of printf() directly
    - reverted work-in-progress-looking changes from test/types/TestAbstract.py that work towards running the test suite remotely.
    - add new logging category 'platform'

    Reviewers: Matt Kopec, Greg Clayton

    Review: http://llvm-reviews.chandlerc.com/D1493

llvm-svn: 189295
This commit is contained in:
Daniel Malea
2013-08-26 23:57:52 +00:00
parent 6b16b43ef9
commit e0f8f574c7
85 changed files with 5865 additions and 333 deletions

View File

@@ -63,20 +63,20 @@ public:
lldb::DynamicValueType use_dynamic,
bool use_synthetic,
const char *name = NULL) :
m_valobj_sp(in_valobj_sp),
m_use_dynamic(use_dynamic),
m_use_synthetic(use_synthetic),
m_name (name)
m_valobj_sp(in_valobj_sp),
m_use_dynamic(use_dynamic),
m_use_synthetic(use_synthetic),
m_name (name)
{
if (!m_name.IsEmpty() && m_valobj_sp)
m_valobj_sp->SetName(m_name);
}
ValueImpl (const ValueImpl& rhs) :
m_valobj_sp(rhs.m_valobj_sp),
m_use_dynamic(rhs.m_use_dynamic),
m_use_synthetic(rhs.m_use_synthetic),
m_name (rhs.m_name)
m_valobj_sp(rhs.m_valobj_sp),
m_use_dynamic(rhs.m_use_dynamic),
m_use_synthetic(rhs.m_use_synthetic),
m_name (rhs.m_name)
{
}
@@ -120,7 +120,7 @@ public:
Target *target = value_sp->GetTargetSP().get();
if (target)
api_locker.Lock(target->GetAPIMutex());
ProcessSP process_sp(value_sp->GetProcessSP());
if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock()))
{
@@ -131,7 +131,7 @@ public:
error.SetErrorString ("process must be stopped.");
return ValueObjectSP();
}
if (value_sp->GetDynamicValue(m_use_dynamic))
value_sp = value_sp->GetDynamicValue(m_use_dynamic);
if (value_sp->GetSyntheticValue(m_use_synthetic))
@@ -167,7 +167,7 @@ public:
{
return m_use_synthetic;
}
// All the derived values that we would make from the m_valobj_sp will share
// the ExecutionContext with m_valobj_sp, so we don't need to do the calculations
// in GetSP to return the Target, Process, Thread or Frame. It is convenient to
@@ -207,7 +207,7 @@ public:
else
return StackFrameSP();
}
private:
lldb::ValueObjectSP m_valobj_sp;
lldb::DynamicValueType m_use_dynamic;
@@ -227,7 +227,7 @@ public:
{
return in_value.GetSP(m_stop_locker, m_api_locker, m_lock_error);
}
Error &
GetError()
{
@@ -238,11 +238,11 @@ private:
Process::StopLocker m_stop_locker;
Mutex::Locker m_api_locker;
Error m_lock_error;
};
SBValue::SBValue () :
m_opaque_sp ()
m_opaque_sp ()
{
}
@@ -318,7 +318,7 @@ SBValue::GetName()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
name = value_sp->GetName().GetCString();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
@@ -327,7 +327,7 @@ SBValue::GetName()
else
log->Printf ("SBValue(%p)::GetName () => NULL", value_sp.get());
}
return name;
}
@@ -350,7 +350,7 @@ SBValue::GetTypeName ()
else
log->Printf ("SBValue(%p)::GetTypeName () => NULL", value_sp.get());
}
return name;
}
@@ -359,17 +359,17 @@ SBValue::GetByteSize ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
size_t result = 0;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
result = value_sp->GetByteSize();
}
if (log)
log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64, value_sp.get(), (uint64_t)result);
return result;
}
@@ -377,18 +377,18 @@ bool
SBValue::IsInScope ()
{
bool result = false;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
result = value_sp->IsInScope ();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::IsInScope () => %i", value_sp.get(), result);
return result;
}
@@ -396,7 +396,7 @@ const char *
SBValue::GetValue ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *cstr = NULL;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
@@ -411,7 +411,7 @@ SBValue::GetValue ()
else
log->Printf ("SBValue(%p)::GetValue() => NULL", value_sp.get());
}
return cstr;
}
@@ -429,14 +429,14 @@ SBValue::GetValueType ()
{
switch (result)
{
case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", value_sp.get()); break;
case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", value_sp.get()); break;
case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", value_sp.get()); break;
case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", value_sp.get()); break;
case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", value_sp.get()); break;
case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", value_sp.get()); break;
case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", value_sp.get()); break;
case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", value_sp.get()); break;
case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", value_sp.get()); break;
case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", value_sp.get()); break;
case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", value_sp.get()); break;
case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", value_sp.get()); break;
case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", value_sp.get()); break;
case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", value_sp.get()); break;
case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", value_sp.get()); break;
case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", value_sp.get()); break;
}
}
return result;
@@ -499,7 +499,7 @@ SBValue::GetValueDidChange ()
}
if (log)
log->Printf ("SBValue(%p)::GetValueDidChange() => %i", value_sp.get(), result);
return result;
}
@@ -571,7 +571,7 @@ SBValue::SetValueFromCString (const char *value_str, lldb::SBError& error)
if (log)
log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", value_sp.get(), value_str, success);
return success;
}
@@ -765,15 +765,15 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
if (pointee_ast_type)
{
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
pointee_ast_type,
ConstString(name),
buffer,
lldb::endian::InlHostByteOrder(),
lldb::endian::InlHostByteOrder(),
exe_ctx.GetAddressByteSize()));
if (ptr_result_valobj_sp)
{
ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
@@ -806,7 +806,7 @@ SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
if (value_sp)
{
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
type.m_opaque_sp->GetClangASTType(),
ConstString(name),
@@ -837,7 +837,7 @@ SBValue::GetChildAtIndex (uint32_t idx)
if (target_sp)
use_dynamic = target_sp->GetPreferDynamicValue();
return GetChildAtIndex (idx, use_dynamic, can_create_synthetic);
}
@@ -846,7 +846,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
{
lldb::ValueObjectSP child_sp;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
@@ -870,7 +870,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
sb_value.SetSP (child_sp, use_dynamic, GetPreferSyntheticValue());
if (log)
log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", value_sp.get(), idx, value_sp.get());
return sb_value;
}
@@ -913,9 +913,9 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
{
lldb::ValueObjectSP child_sp;
const ConstString str_name (name);
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
@@ -925,10 +925,10 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
SBValue sb_value;
sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
if (log)
log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", value_sp.get(), name, value_sp.get());
return sb_value;
}
@@ -1117,7 +1117,7 @@ SBValue::MightHaveChildren ()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
has_children = value_sp->MightHaveChildren();
if (log)
log->Printf ("SBValue(%p)::MightHaveChildren() => %i", value_sp.get(), has_children);
return has_children;
@@ -1127,16 +1127,16 @@ uint32_t
SBValue::GetNumChildren ()
{
uint32_t num_children = 0;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
num_children = value_sp->GetNumChildren();
if (log)
log->Printf ("SBValue(%p)::GetNumChildren () => %u", value_sp.get(), num_children);
return num_children;
}
@@ -1149,13 +1149,13 @@ SBValue::Dereference ()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
Error error;
sb_value = value_sp->Dereference (error);
Error error;
sb_value = value_sp->Dereference (error);
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", value_sp.get(), value_sp.get());
return sb_value;
}
@@ -1163,17 +1163,17 @@ bool
SBValue::TypeIsPointerType ()
{
bool is_ptr_type = false;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
is_ptr_type = value_sp->IsPointerType();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", value_sp.get(), is_ptr_type);
return is_ptr_type;
}
@@ -1390,7 +1390,7 @@ bool
SBValue::GetDescription (SBStream &description)
{
Stream &strm = description.ref();
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
@@ -1399,7 +1399,7 @@ SBValue::GetDescription (SBStream &description)
}
else
strm.PutCString ("No value");
return true;
}
@@ -1653,7 +1653,7 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
size_t byte_size = GetByteSize();
if (byte_size == 0)
return sb_watchpoint;
uint32_t watch_type = 0;
if (read)
watch_type |= LLDB_WATCH_TYPE_READ;
@@ -1664,14 +1664,14 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
ClangASTType type (value_sp->GetClangType());
WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
error.SetError(rc);
if (watchpoint_sp)
if (watchpoint_sp)
{
sb_watchpoint.SetSP (watchpoint_sp);
Declaration decl;
if (value_sp->GetDeclaration (decl))
{
if (decl.GetFile())
if (decl.GetFile())
{
StreamString ss;
// True to show fullpath for declaration file.