forked from OSchip/llvm-project
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:
parent
1490c7996f
commit
c9858e4d05
|
@ -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);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log)
|
||||
log->Printf ("SBFrame(%p)::GetCompileUnit () => error: process is running", frame);
|
||||
}
|
||||
}
|
||||
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)",
|
||||
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;
|
||||
|
@ -445,12 +509,8 @@ SBFrame::GetValueForVariablePath (const char *var_path)
|
|||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -134,37 +134,28 @@ 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)
|
||||
{
|
||||
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
|
||||
if (process_sp->GetState() == eStateConnected)
|
||||
{
|
||||
if (stop_at_entry)
|
||||
launch_flags |= eLaunchFlagStopAtEntry;
|
||||
ProcessLaunchInfo launch_info (stdin_path,
|
||||
stdout_path,
|
||||
stderr_path,
|
||||
working_directory,
|
||||
launch_flags);
|
||||
Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer();
|
||||
if (exe_module)
|
||||
launch_info.SetExecutableFile(exe_module->GetFileSpec(), true);
|
||||
if (argv)
|
||||
launch_info.GetArguments().AppendArguments (argv);
|
||||
if (envp)
|
||||
launch_info.GetEnvironmentEntries ().SetArguments (envp);
|
||||
error.SetError (process_sp->Launch (launch_info));
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("must be in eStateConnected to call RemoteLaunch");
|
||||
}
|
||||
if (stop_at_entry)
|
||||
launch_flags |= eLaunchFlagStopAtEntry;
|
||||
ProcessLaunchInfo launch_info (stdin_path,
|
||||
stdout_path,
|
||||
stderr_path,
|
||||
working_directory,
|
||||
launch_flags);
|
||||
Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer();
|
||||
if (exe_module)
|
||||
launch_info.SetExecutableFile(exe_module->GetFileSpec(), true);
|
||||
if (argv)
|
||||
launch_info.GetArguments().AppendArguments (argv);
|
||||
if (envp)
|
||||
launch_info.GetEnvironmentEntries ().SetArguments (envp);
|
||||
error.SetError (process_sp->Launch (launch_info));
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("process is running");
|
||||
error.SetErrorString ("must be in eStateConnected to call RemoteLaunch");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -187,25 +178,16 @@ 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)
|
||||
{
|
||||
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
|
||||
if (process_sp->GetState() == eStateConnected)
|
||||
{
|
||||
ProcessAttachInfo attach_info;
|
||||
attach_info.SetProcessID (pid);
|
||||
error.SetError (process_sp->Attach (attach_info));
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("must be in eStateConnected to call RemoteAttachToProcessWithID");
|
||||
}
|
||||
ProcessAttachInfo attach_info;
|
||||
attach_info.SetProcessID (pid);
|
||||
error.SetError (process_sp->Attach (attach_info));
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("process is running");
|
||||
error.SetErrorString ("must be in eStateConnected to call RemoteAttachToProcessWithID");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
exe_ctx.GetThreadPtr()->SetResumeState (eStateSuspended);
|
||||
return true;
|
||||
Process::StopLocker stop_locker;
|
||||
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
|
||||
{
|
||||
exe_ctx.GetThreadPtr()->SetResumeState (eStateSuspended);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log)
|
||||
log->Printf ("SBThread(%p)::Suspend() => error: process is running", exe_ctx.GetThreadPtr());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
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())
|
||||
{
|
||||
exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning);
|
||||
return true;
|
||||
Process::StopLocker stop_locker;
|
||||
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
|
||||
{
|
||||
exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log)
|
||||
log->Printf ("SBThread(%p)::Resume() => error: process is running", exe_ctx.GetThreadPtr());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
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)
|
||||
|
|
|
@ -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,24 +195,35 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
cstr = value_sp->GetValueAsCString ();
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetValue() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
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,24 +258,34 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
cstr = value_sp->GetObjectDescription ();
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetObjectDescription() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
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,20 +315,30 @@ SBValue::GetType()
|
|||
bool
|
||||
SBValue::GetValueDidChange ()
|
||||
{
|
||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
bool result = false;
|
||||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
result = value_sp->GetValueDidChange ();
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetValueDidChange() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
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,24 +347,34 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
cstr = value_sp->GetSummaryAsCString();
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetSummary() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
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,24 +383,34 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
cstr = value_sp->GetLocationAsCString();
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetLocation() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
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,15 +420,29 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
success = value_sp->SetValueFromCString (value_str);
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::SetValueFromCString() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
success = value_sp->SetValueFromCString (value_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", value_sp.get(), value_str, success);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -412,15 +476,26 @@ SBValue::GetTypeSummary ()
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
if (value_sp->UpdateValueIfNeeded(true))
|
||||
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)
|
||||
{
|
||||
lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
|
||||
if (summary_sp)
|
||||
summary.SetSP(summary_sp);
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
if (value_sp->UpdateValueIfNeeded(true))
|
||||
{
|
||||
lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
|
||||
if (summary_sp)
|
||||
summary.SetSP(summary_sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -435,18 +510,29 @@ SBValue::GetTypeFilter ()
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
if (value_sp->UpdateValueIfNeeded(true))
|
||||
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)
|
||||
{
|
||||
lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
|
||||
|
||||
if (synthetic_sp && !synthetic_sp->IsScripted())
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
if (value_sp->UpdateValueIfNeeded(true))
|
||||
{
|
||||
TypeFilterImplSP filter_sp = STD_STATIC_POINTER_CAST(TypeFilterImpl,synthetic_sp);
|
||||
filter.SetSP(filter_sp);
|
||||
lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
|
||||
|
||||
if (synthetic_sp && !synthetic_sp->IsScripted())
|
||||
{
|
||||
TypeFilterImplSP filter_sp = STD_STATIC_POINTER_CAST(TypeFilterImpl,synthetic_sp);
|
||||
filter.SetSP(filter_sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -462,18 +548,29 @@ SBValue::GetTypeSynthetic ()
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
if (value_sp->UpdateValueIfNeeded(true))
|
||||
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)
|
||||
{
|
||||
lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
|
||||
|
||||
if (children_sp && children_sp->IsScripted())
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
if (value_sp->UpdateValueIfNeeded(true))
|
||||
{
|
||||
TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
|
||||
synthetic.SetSP(synth_sp);
|
||||
lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
|
||||
|
||||
if (children_sp && children_sp->IsScripted())
|
||||
{
|
||||
TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
|
||||
synthetic.SetSP(synth_sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,37 +621,54 @@ 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());
|
||||
Target* target = exe_ctx.GetTargetPtr();
|
||||
if (target)
|
||||
ProcessSP process_sp(exe_ctx.GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
target->EvaluateExpression (expression,
|
||||
exe_ctx.GetFramePtr(),
|
||||
eExecutionPolicyOnlyWhenNeeded,
|
||||
false, // coerce to id
|
||||
true, // unwind on error
|
||||
true, // keep in memory
|
||||
eNoDynamicValues,
|
||||
new_value_sp);
|
||||
if (new_value_sp)
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::CreateValueFromExpression() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
Target* target = exe_ctx.GetTargetPtr();
|
||||
if (target)
|
||||
{
|
||||
new_value_sp->SetName(ConstString(name));
|
||||
sb_value.SetSP(new_value_sp);
|
||||
target->EvaluateExpression (expression,
|
||||
exe_ctx.GetFramePtr(),
|
||||
eExecutionPolicyOnlyWhenNeeded,
|
||||
false, // coerce to id
|
||||
true, // unwind on error
|
||||
true, // keep in memory
|
||||
eNoDynamicValues,
|
||||
new_value_sp);
|
||||
if (new_value_sp)
|
||||
{
|
||||
new_value_sp->SetName(ConstString(name));
|
||||
sb_value.SetSP(new_value_sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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,42 +769,52 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
const bool can_create = true;
|
||||
child_sp = value_sp->GetChildAtIndex (idx, can_create);
|
||||
if (can_create_synthetic && !child_sp)
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetChildAtIndex() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
if (value_sp->IsPointerType())
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
const bool can_create = true;
|
||||
child_sp = value_sp->GetChildAtIndex (idx, can_create);
|
||||
if (can_create_synthetic && !child_sp)
|
||||
{
|
||||
child_sp = value_sp->GetSyntheticArrayMemberFromPointer(idx, can_create);
|
||||
if (value_sp->IsPointerType())
|
||||
{
|
||||
child_sp = value_sp->GetSyntheticArrayMemberFromPointer(idx, can_create);
|
||||
}
|
||||
else if (value_sp->IsArrayType())
|
||||
{
|
||||
child_sp = value_sp->GetSyntheticArrayMemberFromArray(idx, can_create);
|
||||
}
|
||||
}
|
||||
else if (value_sp->IsArrayType())
|
||||
|
||||
if (child_sp)
|
||||
{
|
||||
child_sp = value_sp->GetSyntheticArrayMemberFromArray(idx, can_create);
|
||||
}
|
||||
}
|
||||
|
||||
if (child_sp)
|
||||
{
|
||||
if (use_dynamic != lldb::eNoDynamicValues)
|
||||
{
|
||||
lldb::ValueObjectSP dynamic_sp(child_sp->GetDynamicValue (use_dynamic));
|
||||
if (dynamic_sp)
|
||||
child_sp = dynamic_sp;
|
||||
if (use_dynamic != lldb::eNoDynamicValues)
|
||||
{
|
||||
lldb::ValueObjectSP dynamic_sp(child_sp->GetDynamicValue (use_dynamic));
|
||||
if (dynamic_sp)
|
||||
child_sp = dynamic_sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,22 +871,33 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
child_sp = value_sp->GetChildMemberWithName (str_name, true);
|
||||
if (use_dynamic_value != lldb::eNoDynamicValues)
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetChildMemberWithName() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
if (child_sp)
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
child_sp = value_sp->GetChildMemberWithName (str_name, true);
|
||||
if (use_dynamic_value != lldb::eNoDynamicValues)
|
||||
{
|
||||
lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic_value);
|
||||
if (dynamic_sp)
|
||||
child_sp = dynamic_sp;
|
||||
if (child_sp)
|
||||
{
|
||||
lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic_value);
|
||||
if (dynamic_sp)
|
||||
child_sp = dynamic_sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -770,7 +905,6 @@ 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());
|
||||
|
||||
|
@ -783,11 +917,22 @@ SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
return SBValue (value_sp->GetDynamicValue(use_dynamic));
|
||||
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)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
return SBValue (value_sp->GetDynamicValue(use_dynamic));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -854,22 +999,32 @@ 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)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
// using default values for all the fancy options, just do it if you can
|
||||
child_sp = value_sp->GetValueForExpressionPath(expr_path);
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetValueForExpressionPath() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
// using default values for all the fancy options, just do it if you can
|
||||
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());
|
||||
|
||||
|
@ -883,18 +1038,30 @@ SBValue::GetValueAsSigned(SBError& error, int64_t fail_value)
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
else
|
||||
error.SetErrorString("could not get value");
|
||||
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
|
||||
error.SetErrorString("could not get target");
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
else
|
||||
error.SetErrorString("could not get value");
|
||||
}
|
||||
else
|
||||
error.SetErrorString("could not get target");
|
||||
}
|
||||
}
|
||||
error.SetErrorString("invalid SBValue");
|
||||
return fail_value;
|
||||
|
@ -907,18 +1074,30 @@ SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
else
|
||||
error.SetErrorString("could not get value");
|
||||
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
|
||||
error.SetErrorString("could not get target");
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
else
|
||||
error.SetErrorString("could not get value");
|
||||
}
|
||||
else
|
||||
error.SetErrorString("could not get target");
|
||||
}
|
||||
}
|
||||
error.SetErrorString("invalid SBValue");
|
||||
return fail_value;
|
||||
|
@ -930,13 +1109,24 @@ SBValue::GetValueAsSigned(int64_t fail_value)
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
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)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fail_value;
|
||||
|
@ -948,13 +1138,24 @@ SBValue::GetValueAsUnsigned(uint64_t fail_value)
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
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)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
Scalar scalar;
|
||||
if (value_sp->ResolveValue (scalar))
|
||||
return scalar.GetRawBits64(fail_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fail_value;
|
||||
|
@ -965,19 +1166,29 @@ SBValue::GetNumChildren ()
|
|||
{
|
||||
uint32_t num_children = 0;
|
||||
|
||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetNumChildren() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp(value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
|
||||
num_children = value_sp->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);
|
||||
|
||||
|
@ -1187,7 +1398,18 @@ SBValue::GetDescription (SBStream &description)
|
|||
lldb::ValueObjectSP value_sp(GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
ValueObject::DumpValueObject (strm, value_sp.get());
|
||||
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,21 +1533,31 @@ 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)
|
||||
{
|
||||
TargetSP target_sp (value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
DataExtractorSP data_sp(new DataExtractor());
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
value_sp->GetPointeeData(*data_sp, item_idx, item_count);
|
||||
if (data_sp->GetByteSize() > 0)
|
||||
*sb_data = data_sp;
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetPointeeData() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp (value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
DataExtractorSP data_sp(new DataExtractor());
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
value_sp->GetPointeeData(*data_sp, item_idx, item_count);
|
||||
if (data_sp->GetByteSize() > 0)
|
||||
*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,21 +1571,31 @@ 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)
|
||||
{
|
||||
TargetSP target_sp (value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
ProcessSP process_sp(value_sp->GetProcessSP());
|
||||
Process::StopLocker stop_locker;
|
||||
if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock()))
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
DataExtractorSP data_sp(new DataExtractor());
|
||||
value_sp->GetData(*data_sp);
|
||||
if (data_sp->GetByteSize() > 0)
|
||||
*sb_data = data_sp;
|
||||
if (log)
|
||||
log->Printf ("SBValue(%p)::GetData() => error: process is running", value_sp.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetSP target_sp (value_sp->GetTargetSP());
|
||||
if (target_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
DataExtractorSP data_sp(new DataExtractor());
|
||||
value_sp->GetData(*data_sp);
|
||||
if (data_sp->GetByteSize() > 0)
|
||||
*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;
|
||||
|
|
Loading…
Reference in New Issue