Added logging when API calls try to do something that shouldn't be done when the process is stopped by having logging calls that end with "error: process is running".

Also test for the process to be stopped when many SBValue API calls are made to make sure it is safe to evaluate values, children of values and much more.

llvm-svn: 154160
This commit is contained in:
Greg Clayton 2012-04-06 02:17:47 +00:00
parent 1490c7996f
commit c9858e4d05
4 changed files with 704 additions and 249 deletions

View File

@ -104,7 +104,7 @@ SBFrame::IsValid() const
SBSymbolContext
SBFrame::GetSymbolContext (uint32_t resolve_scope) const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBSymbolContext sb_sym_ctx;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -117,9 +117,13 @@ SBFrame::GetSymbolContext (uint32_t resolve_scope) const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext (resolve_scope));
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetSymbolContext () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
frame, resolve_scope, sb_sym_ctx.get());
@ -130,6 +134,7 @@ SBFrame::GetSymbolContext (uint32_t resolve_scope) const
SBModule
SBFrame::GetModule () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBModule sb_module;
ModuleSP module_sp;
ExecutionContext exe_ctx(m_opaque_sp.get());
@ -144,9 +149,13 @@ SBFrame::GetModule () const
module_sp = frame->GetSymbolContext (eSymbolContextModule).module_sp;
sb_module.SetSP (module_sp);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetModule () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
frame, module_sp.get());
@ -157,6 +166,7 @@ SBFrame::GetModule () const
SBCompileUnit
SBFrame::GetCompileUnit () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBCompileUnit sb_comp_unit;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -169,10 +179,14 @@ SBFrame::GetCompileUnit () const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_comp_unit.reset (frame->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
else
{
if (log)
log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)",
log->Printf ("SBFrame(%p)::GetCompileUnit () => error: process is running", frame);
}
}
if (log)
log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)",
frame, sb_comp_unit.get());
return sb_comp_unit;
@ -181,6 +195,7 @@ SBFrame::GetCompileUnit () const
SBFunction
SBFrame::GetFunction () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBFunction sb_function;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -193,8 +208,12 @@ SBFrame::GetFunction () const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_function.reset(frame->GetSymbolContext (eSymbolContextFunction).function);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetFunction () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
frame, sb_function.get());
@ -205,6 +224,7 @@ SBFrame::GetFunction () const
SBSymbol
SBFrame::GetSymbol () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBSymbol sb_symbol;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -217,8 +237,12 @@ SBFrame::GetSymbol () const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_symbol.reset(frame->GetSymbolContext (eSymbolContextSymbol).symbol);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetSymbol () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
frame, sb_symbol.get());
@ -228,6 +252,7 @@ SBFrame::GetSymbol () const
SBBlock
SBFrame::GetBlock () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBlock sb_block;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -240,8 +265,12 @@ SBFrame::GetBlock () const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_block.SetPtr (frame->GetSymbolContext (eSymbolContextBlock).block);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetBlock () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
frame, sb_block.GetPtr());
@ -255,6 +284,7 @@ SBFrame::GetFrameBlock () const
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (frame && target)
{
Process::StopLocker stop_locker;
@ -263,8 +293,12 @@ SBFrame::GetFrameBlock () const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_block.SetPtr(frame->GetFrameBlock ());
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetFrameBlock () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
frame, sb_block.GetPtr());
@ -274,6 +308,7 @@ SBFrame::GetFrameBlock () const
SBLineEntry
SBFrame::GetLineEntry () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBLineEntry sb_line_entry;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -286,8 +321,12 @@ SBFrame::GetLineEntry () const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_line_entry.SetLineEntry (frame->GetSymbolContext (eSymbolContextLineEntry).line_entry);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetLineEntry () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
frame, sb_line_entry.get());
@ -314,6 +353,7 @@ SBFrame::GetFrameID () const
addr_t
SBFrame::GetPC () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
addr_t addr = LLDB_INVALID_ADDRESS;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -326,9 +366,13 @@ SBFrame::GetPC () const
Mutex::Locker api_locker (target->GetAPIMutex());
addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress (target);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetPC () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetPC () => 0x%llx", frame, addr);
@ -338,6 +382,7 @@ SBFrame::GetPC () const
bool
SBFrame::SetPC (addr_t new_pc)
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_val = false;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -350,9 +395,13 @@ SBFrame::SetPC (addr_t new_pc)
Mutex::Locker api_locker (target->GetAPIMutex());
ret_val = frame->GetRegisterContext()->SetPC (new_pc);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::SetPC () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i",
frame, new_pc, ret_val);
@ -363,6 +412,7 @@ SBFrame::SetPC (addr_t new_pc)
addr_t
SBFrame::GetSP () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
addr_t addr = LLDB_INVALID_ADDRESS;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -375,8 +425,12 @@ SBFrame::GetSP () const
Mutex::Locker api_locker (target->GetAPIMutex());
addr = frame->GetRegisterContext()->GetSP();
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetSP () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetSP () => 0x%llx", frame, addr);
@ -387,6 +441,7 @@ SBFrame::GetSP () const
addr_t
SBFrame::GetFP () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
addr_t addr = LLDB_INVALID_ADDRESS;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -399,9 +454,13 @@ SBFrame::GetFP () const
Mutex::Locker api_locker (target->GetAPIMutex());
addr = frame->GetRegisterContext()->GetFP();
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetFP () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFP () => 0x%llx", frame, addr);
return addr;
@ -411,6 +470,7 @@ SBFrame::GetFP () const
SBAddress
SBFrame::GetPCAddress () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBAddress sb_addr;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -423,8 +483,12 @@ SBFrame::GetPCAddress () const
Mutex::Locker api_locker (target->GetAPIMutex());
sb_addr.SetAddress (&frame->GetFrameCodeAddress());
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetPCAddress () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", frame, sb_addr.get());
return sb_addr;
@ -444,14 +508,10 @@ SBFrame::GetValueForVariablePath (const char *var_path)
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (frame && target)
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue();
sb_value = GetValueForVariablePath (var_path, use_dynamic);
}
}
return sb_value;
}
@ -477,6 +537,12 @@ SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dyn
error));
sb_value.SetSP(value_sp);
}
else
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetValueForVariablePath () => error: process is running", frame);
}
}
return sb_value;
}
@ -500,6 +566,7 @@ SBFrame::FindVariable (const char *name)
SBValue
SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
VariableSP var_sp;
SBValue sb_value;
ValueObjectSP value_sp;
@ -536,9 +603,13 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
sb_value.SetSP(value_sp);
}
}
else
{
if (log)
log->Printf ("SBFrame(%p)::FindVariable () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
frame, name, value_sp.get());
@ -564,6 +635,7 @@ SBFrame::FindValue (const char *name, ValueType value_type)
SBValue
SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic)
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBValue sb_value;
ValueObjectSP value_sp;
ExecutionContext exe_ctx(m_opaque_sp.get());
@ -674,9 +746,13 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
break;
}
}
else
{
if (log)
log->Printf ("SBFrame(%p)::FindValue () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
frame, name, value_type, value_sp.get());
@ -730,6 +806,7 @@ SBFrame::GetThread () const
const char *
SBFrame::Disassemble () const
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *disassembly = NULL;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
@ -742,8 +819,12 @@ SBFrame::Disassemble () const
Mutex::Locker api_locker (target->GetAPIMutex());
disassembly = frame->Disassemble();
}
else
{
if (log)
log->Printf ("SBFrame(%p)::Disassemble () => error: process is running", frame);
}
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::Disassemble () => %s", frame, disassembly);
@ -846,6 +927,11 @@ SBFrame::GetVariables (bool arguments,
}
}
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetVariables () => error: process is running", frame);
}
}
if (log)
@ -882,10 +968,15 @@ SBFrame::GetRegisters ()
}
}
}
else
{
if (log)
log->Printf ("SBFrame(%p)::GetRegisters () => error: process is running", frame);
}
}
if (log)
log->Printf ("SBFrame(%p)::Registers () => SBValueList(%p)", frame, value_list.get());
log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)", frame, value_list.get());
return value_list;
}
@ -906,6 +997,13 @@ SBFrame::GetDescription (SBStream &description)
Mutex::Locker api_locker (target->GetAPIMutex());
frame->DumpUsingSettingsFormat (&strm);
}
else
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetDescription () => error: process is running", frame);
}
}
else
strm.PutCString ("No value");
@ -975,6 +1073,11 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
expr_result.SetSP(expr_value_sp);
Host::SetCrashDescription (NULL);
}
else
{
if (log)
log->Printf ("SBFrame(%p)::EvaluateExpression () => error: process is running", frame);
}
}
#ifndef LLDB_DISABLE_PYTHON
@ -1010,6 +1113,13 @@ SBFrame::IsInlined()
if (block)
return block->GetContainingInlinedBlock () != NULL;
}
else
{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::IsInlined () => error: process is running", frame);
}
}
return false;
}
@ -1049,6 +1159,13 @@ SBFrame::GetFunctionName()
name = sc.symbol->GetName().GetCString();
}
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFunctionName() => error: process is running", frame);
}
}
return name;
}

View File

@ -133,10 +133,6 @@ SBProcess::RemoteLaunch (char const **argv,
ProcessSP process_sp(GetSP());
if (process_sp)
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
if (process_sp->GetState() == eStateConnected)
@ -163,11 +159,6 @@ SBProcess::RemoteLaunch (char const **argv,
}
}
else
{
error.SetErrorString ("process is running");
}
}
else
{
error.SetErrorString ("unable to attach pid");
}
@ -186,10 +177,6 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
{
ProcessSP process_sp(GetSP());
if (process_sp)
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
if (process_sp->GetState() == eStateConnected)
@ -204,11 +191,6 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
}
}
else
{
error.SetErrorString ("process is running");
}
}
else
{
error.SetErrorString ("unable to attach pid");
}
@ -827,6 +809,8 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
}
else
{
if (log)
log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}
@ -867,6 +851,9 @@ SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBE
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::ReadCStringFromMemory() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}
@ -892,6 +879,9 @@ SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBErro
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::ReadUnsignedFromMemory() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}
@ -917,6 +907,9 @@ SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &sb_error)
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::ReadPointerFromMemory() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}
@ -956,6 +949,8 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
}
else
{
if (log)
log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}
@ -1019,6 +1014,9 @@ SBProcess::LoadImage (lldb::SBFileSpec &sb_image_spec, lldb::SBError &sb_error)
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::LoadImage() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}
@ -1040,6 +1038,9 @@ SBProcess::UnloadImage (uint32_t image_token)
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::UnloadImage() => error: process is running", process_sp.get());
sb_error.SetErrorString("process is running");
}
}

View File

@ -107,6 +107,11 @@ SBThread::GetStopReason()
if (stop_info_sp)
reason = stop_info_sp->GetStopReason();
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetStopReason() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (log)
@ -161,6 +166,12 @@ SBThread::GetStopReasonDataCount ()
}
}
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running", exe_ctx.GetThreadPtr());
}
}
return 0;
}
@ -227,6 +238,12 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
}
}
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
}
}
return 0;
}
@ -332,6 +349,12 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
}
}
}
else
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (dst)
*dst = 0;
@ -341,6 +364,7 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
SBValue
SBThread::GetStopReturnValue ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ValueObjectSP return_valobj_sp;
ExecutionContext exe_ctx (m_opaque_sp.get());
if (exe_ctx.HasThreadScope())
@ -355,9 +379,13 @@ SBThread::GetStopReturnValue ()
return_valobj_sp = StopInfo::GetReturnValueObject (stop_info_sp);
}
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running", exe_ctx.GetThreadPtr());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", exe_ctx.GetThreadPtr(),
return_valobj_sp.get()
@ -395,6 +423,7 @@ SBThread::GetIndexID () const
const char *
SBThread::GetName () const
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *name = NULL;
ExecutionContext exe_ctx (m_opaque_sp.get());
if (exe_ctx.HasThreadScope())
@ -405,9 +434,13 @@ SBThread::GetName () const
Mutex::Locker api_locker (exe_ctx.GetTargetPtr()->GetAPIMutex());
name = exe_ctx.GetThreadPtr()->GetName();
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetName() => error: process is running", exe_ctx.GetThreadPtr());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
@ -419,6 +452,7 @@ SBThread::GetQueueName () const
{
const char *name = NULL;
ExecutionContext exe_ctx (m_opaque_sp.get());
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope())
{
Process::StopLocker stop_locker;
@ -427,9 +461,13 @@ SBThread::GetQueueName () const
Mutex::Locker api_locker (exe_ctx.GetTargetPtr()->GetAPIMutex());
name = exe_ctx.GetThreadPtr()->GetQueueName();
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetQueueName() => error: process is running", exe_ctx.GetThreadPtr());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetQueueName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
@ -846,25 +884,51 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
bool
SBThread::Suspend()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ExecutionContext exe_ctx (m_opaque_sp.get());
bool result = false;
if (exe_ctx.HasThreadScope())
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
exe_ctx.GetThreadPtr()->SetResumeState (eStateSuspended);
return true;
result = true;
}
return false;
else
{
if (log)
log->Printf ("SBThread(%p)::Suspend() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (log)
log->Printf ("SBThread(%p)::Suspend() => %i", exe_ctx.GetThreadPtr(), result);
return result;
}
bool
SBThread::Resume ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ExecutionContext exe_ctx (m_opaque_sp.get());
bool result = false;
if (exe_ctx.HasThreadScope())
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning);
return true;
result = true;
}
return false;
else
{
if (log)
log->Printf ("SBThread(%p)::Resume() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (log)
log->Printf ("SBThread(%p)::Resume() => %i", exe_ctx.GetThreadPtr(), result);
return result;
}
bool
@ -916,6 +980,11 @@ SBThread::GetNumFrames ()
Mutex::Locker api_locker (exe_ctx.GetTargetPtr()->GetAPIMutex());
num_frames = exe_ctx.GetThreadPtr()->GetStackFrameCount();
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (log)
@ -941,6 +1010,11 @@ SBThread::GetFrameAtIndex (uint32_t idx)
frame_sp = exe_ctx.GetThreadPtr()->GetStackFrameAtIndex (idx);
sb_frame.SetFrameSP (frame_sp);
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (log)
@ -971,6 +1045,11 @@ SBThread::GetSelectedFrame ()
frame_sp = exe_ctx.GetThreadPtr()->GetSelectedFrame ();
sb_frame.SetFrameSP (frame_sp);
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (log)
@ -1006,6 +1085,11 @@ SBThread::SetSelectedFrame (uint32_t idx)
sb_frame.SetFrameSP (frame_sp);
}
}
else
{
if (log)
log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
}
}
if (log)

View File

@ -140,7 +140,6 @@ SBValue::GetTypeName ()
const char *name = NULL;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
//name = value_sp->GetTypeName().GetCString();
name = value_sp->GetQualifiedTypeName().GetCString();
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
@ -196,9 +195,20 @@ SBValue::IsInScope ()
const char *
SBValue::GetValue ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *cstr = NULL;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetValue() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -207,13 +217,13 @@ SBValue::GetValue ()
cstr = value_sp->GetValueAsCString ();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
{
if (cstr)
log->Printf ("SBValue(%p)::GetValue => \"%s\"", value_sp.get(), cstr);
log->Printf ("SBValue(%p)::GetValue() => \"%s\"", value_sp.get(), cstr);
else
log->Printf ("SBValue(%p)::GetValue => NULL", value_sp.get());
log->Printf ("SBValue(%p)::GetValue() => NULL", value_sp.get());
}
return cstr;
@ -248,9 +258,19 @@ SBValue::GetValueType ()
const char *
SBValue::GetObjectDescription ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *cstr = NULL;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetObjectDescription() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -259,13 +279,13 @@ SBValue::GetObjectDescription ()
cstr = value_sp->GetObjectDescription ();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
{
if (cstr)
log->Printf ("SBValue(%p)::GetObjectDescription => \"%s\"", value_sp.get(), cstr);
log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"", value_sp.get(), cstr);
else
log->Printf ("SBValue(%p)::GetObjectDescription => NULL", value_sp.get());
log->Printf ("SBValue(%p)::GetObjectDescription() => NULL", value_sp.get());
}
return cstr;
}
@ -295,9 +315,19 @@ SBValue::GetType()
bool
SBValue::GetValueDidChange ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetValueDidChange() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -306,9 +336,9 @@ SBValue::GetValueDidChange ()
result = value_sp->GetValueDidChange ();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
log->Printf ("SBValue(%p)::GetValueDidChange => %i", value_sp.get(), result);
log->Printf ("SBValue(%p)::GetValueDidChange() => %i", value_sp.get(), result);
return result;
}
@ -317,9 +347,19 @@ SBValue::GetValueDidChange ()
const char *
SBValue::GetSummary ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *cstr = NULL;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetSummary() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -328,13 +368,13 @@ SBValue::GetSummary ()
cstr = value_sp->GetSummaryAsCString();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
{
if (cstr)
log->Printf ("SBValue(%p)::GetSummary => \"%s\"", value_sp.get(), cstr);
log->Printf ("SBValue(%p)::GetSummary() => \"%s\"", value_sp.get(), cstr);
else
log->Printf ("SBValue(%p)::GetSummary => NULL", value_sp.get());
log->Printf ("SBValue(%p)::GetSummary() => NULL", value_sp.get());
}
return cstr;
}
@ -343,9 +383,19 @@ SBValue::GetSummary ()
const char *
SBValue::GetLocation ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *cstr = NULL;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetLocation() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -354,13 +404,13 @@ SBValue::GetLocation ()
cstr = value_sp->GetLocationAsCString();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
{
if (cstr)
log->Printf ("SBValue(%p)::GetSummary => \"%s\"", value_sp.get(), cstr);
log->Printf ("SBValue(%p)::GetLocation() => \"%s\"", value_sp.get(), cstr);
else
log->Printf ("SBValue(%p)::GetSummary => NULL", value_sp.get());
log->Printf ("SBValue(%p)::GetLocation() => NULL", value_sp.get());
}
return cstr;
}
@ -370,7 +420,17 @@ SBValue::SetValueFromCString (const char *value_str)
{
bool success = false;
lldb::ValueObjectSP value_sp(GetSP());
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::SetValueFromCString() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -379,6 +439,10 @@ SBValue::SetValueFromCString (const char *value_str)
success = value_sp->SetValueFromCString (value_str);
}
}
}
if (log)
log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", value_sp.get(), value_str, success);
return success;
}
@ -411,6 +475,16 @@ SBValue::GetTypeSummary ()
lldb::SBTypeSummary summary;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetTypeSummary() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -424,6 +498,7 @@ SBValue::GetTypeSummary ()
}
}
}
}
return summary;
}
#endif // LLDB_DISABLE_PYTHON
@ -434,6 +509,16 @@ SBValue::GetTypeFilter ()
lldb::SBTypeFilter filter;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetTypeFilter() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -451,6 +536,7 @@ SBValue::GetTypeFilter ()
}
}
}
}
return filter;
}
@ -461,6 +547,16 @@ SBValue::GetTypeSynthetic ()
lldb::SBTypeSynthetic synthetic;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetTypeSynthetic() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -478,6 +574,7 @@ SBValue::GetTypeSynthetic ()
}
}
}
}
return synthetic;
}
#endif
@ -524,12 +621,22 @@ SBValue::Cast (SBType type)
lldb::SBValue
SBValue::CreateValueFromExpression (const char *name, const char* expression)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::SBValue sb_value;
lldb::ValueObjectSP value_sp(GetSP());
lldb::ValueObjectSP new_value_sp;
if (value_sp)
{
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
ProcessSP process_sp(exe_ctx.GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::CreateValueFromExpression() => error: process is running", value_sp.get());
}
else
{
Target* target = exe_ctx.GetTargetPtr();
if (target)
{
@ -548,13 +655,20 @@ SBValue::CreateValueFromExpression (const char *name, const char* expression)
}
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
{
if (new_value_sp)
log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
log->Printf ("SBValue(%p)::GetChildFromExpression(name=\"%s\", expression=\"%s\") => SBValue (%p)",
value_sp.get(),
name,
expression,
new_value_sp.get());
else
log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", value_sp.get());
log->Printf ("SBValue(%p)::GetChildFromExpression(name=\"%s\", expression=\"%s\") => NULL",
value_sp.get(),
name,
expression);
}
return sb_value;
}
@ -655,9 +769,19 @@ SBValue
SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool can_create_synthetic)
{
lldb::ValueObjectSP child_sp;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetChildAtIndex() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -688,9 +812,9 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
}
}
}
}
SBValue sb_value (child_sp);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", value_sp.get(), idx, value_sp.get());
@ -747,9 +871,19 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
lldb::ValueObjectSP child_sp;
const ConstString str_name (name);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetChildMemberWithName() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -767,10 +901,10 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
}
}
}
}
SBValue sb_value (child_sp);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", value_sp.get(), name, value_sp.get());
@ -782,6 +916,16 @@ SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
{
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetDynamicValue() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -790,6 +934,7 @@ SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
return SBValue (value_sp->GetDynamicValue(use_dynamic));
}
}
}
return SBValue();
}
@ -854,9 +999,19 @@ SBValue::IsDynamic()
lldb::SBValue
SBValue::GetValueForExpressionPath(const char* expr_path)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::ValueObjectSP child_sp;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetValueForExpressionPath() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -866,10 +1021,10 @@ SBValue::GetValueForExpressionPath(const char* expr_path)
child_sp = value_sp->GetValueForExpressionPath(expr_path);
}
}
}
SBValue sb_value (child_sp);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", value_sp.get(), expr_path, value_sp.get());
@ -882,6 +1037,17 @@ SBValue::GetValueAsSigned(SBError& error, int64_t fail_value)
error.Clear();
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetValueAsSigned() => error: process is running", value_sp.get());
error.SetErrorString("process is running");
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -896,6 +1062,7 @@ SBValue::GetValueAsSigned(SBError& error, int64_t fail_value)
else
error.SetErrorString("could not get target");
}
}
error.SetErrorString("invalid SBValue");
return fail_value;
}
@ -906,6 +1073,17 @@ SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
error.Clear();
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetValueAsUnsigned() => error: process is running", value_sp.get());
error.SetErrorString("process is running");
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -920,6 +1098,7 @@ SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
else
error.SetErrorString("could not get target");
}
}
error.SetErrorString("invalid SBValue");
return fail_value;
}
@ -929,6 +1108,16 @@ SBValue::GetValueAsSigned(int64_t fail_value)
{
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetValueAsSigned() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -939,6 +1128,7 @@ SBValue::GetValueAsSigned(int64_t fail_value)
return scalar.GetRawBits64(fail_value);
}
}
}
return fail_value;
}
@ -947,6 +1137,16 @@ SBValue::GetValueAsUnsigned(uint64_t fail_value)
{
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetValueAsUnsigned() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -957,6 +1157,7 @@ SBValue::GetValueAsUnsigned(uint64_t fail_value)
return scalar.GetRawBits64(fail_value);
}
}
}
return fail_value;
}
@ -965,8 +1166,18 @@ SBValue::GetNumChildren ()
{
uint32_t num_children = 0;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetNumChildren() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
@ -976,8 +1187,8 @@ SBValue::GetNumChildren ()
num_children = value_sp->GetNumChildren();
}
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetNumChildren () => %u", value_sp.get(), num_children);
@ -1186,9 +1397,20 @@ SBValue::GetDescription (SBStream &description)
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetDescription() => error: process is running", value_sp.get());
}
else
{
ValueObject::DumpValueObject (strm, value_sp.get());
}
}
else
strm.PutCString ("No value");
@ -1311,9 +1533,19 @@ lldb::SBData
SBValue::GetPointeeData (uint32_t item_idx,
uint32_t item_count)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::SBData sb_data;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetPointeeData() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp (value_sp->GetTargetSP());
if (target_sp)
@ -1325,7 +1557,7 @@ SBValue::GetPointeeData (uint32_t item_idx,
*sb_data = data_sp;
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
log->Printf ("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)",
value_sp.get(),
@ -1339,9 +1571,19 @@ SBValue::GetPointeeData (uint32_t item_idx,
lldb::SBData
SBValue::GetData ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::SBData sb_data;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
if (log)
log->Printf ("SBValue(%p)::GetData() => error: process is running", value_sp.get());
}
else
{
TargetSP target_sp (value_sp->GetTargetSP());
if (target_sp)
@ -1353,7 +1595,7 @@ SBValue::GetData ()
*sb_data = data_sp;
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
}
if (log)
log->Printf ("SBValue(%p)::GetData () => SBData(%p)",
value_sp.get(),
@ -1372,6 +1614,17 @@ SBValue::Watch (bool resolve_location, bool read, bool write)
TargetSP target_sp (GetTarget().GetSP());
if (value_sp && target_sp)
{
// Can't watch this if the process is running
ProcessSP process_sp(value_sp->GetProcessSP());
Process::StopLocker stop_locker;
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::Watch() => error: process is running", value_sp.get());
return sb_watchpoint;
}
// Read and Write cannot both be false.
if (!read && !write)
return sb_watchpoint;