bool DoExecute (Args& command, CommandReturnObject &result) { ExecutionContext exe_ctx(m_interpreter.GetExecutionContext()); StackFrame *frame = exe_ctx.GetFramePtr(); if (frame) { frame->DumpUsingSettingsFormat (&result.GetOutputStream()); result.SetStatus (eReturnStatusSuccessFinishResult); } else { result.AppendError ("no current frame"); result.SetStatus (eReturnStatusFailed); } return result.Succeeded(); }
void StackFrameList::Dump(Stream *s) { if (s == nullptr) return; std::lock_guard<std::recursive_mutex> guard(m_mutex); const_iterator pos, begin = m_frames.begin(), end = m_frames.end(); for (pos = begin; pos != end; ++pos) { StackFrame *frame = (*pos).get(); s->Printf("%p: ", static_cast<void *>(frame)); if (frame) { frame->GetStackID().Dump(s); frame->DumpUsingSettingsFormat(s); } else s->Printf("frame #%u", (uint32_t)std::distance(begin, pos)); s->EOL(); } s->EOL(); }
bool SBFrame::GetDescription (SBStream &description) { LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); Stream &strm = description.ref(); Mutex::Locker api_locker; ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); StackFrame *frame; Target *target = exe_ctx.GetTargetPtr(); Process *process = exe_ctx.GetProcessPtr(); if (target && process) { Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) { frame = exe_ctx.GetFramePtr(); if (frame) { frame->DumpUsingSettingsFormat (&strm); } else { if (log) log->Printf ("SBFrame::GetDescription () => error: could not reconstruct frame object for this SBFrame."); } } else { if (log) log->Printf ("SBFrame::GetDescription () => error: process is running"); } } else strm.PutCString ("No value"); return true; }
void StackFrameList::Dump (Stream *s) { if (s == NULL) return; Mutex::Locker locker (m_mutex); const_iterator pos, begin = m_frames.begin(), end = m_frames.end(); for (pos = begin; pos != end; ++pos) { StackFrame *frame = (*pos).get(); s->Printf("%p: ", frame); if (frame) { frame->GetStackID().Dump (s); frame->DumpUsingSettingsFormat (s); } else s->Printf("frame #%u", (uint32_t)std::distance (begin, pos)); s->EOL(); } s->EOL(); }
lldb::SBValue SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &options) { LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); LogSP expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); ExecutionResults exe_results = eExecutionSetupError; SBValue expr_result; if (expr == NULL || expr[0] == '\0') { if (log) log->Printf ("SBFrame::EvaluateExpression called with an empty expression"); return expr_result; } ValueObjectSP expr_value_sp; Mutex::Locker api_locker; ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); if (log) log->Printf ("SBFrame()::EvaluateExpression (expr=\"%s\")...", expr); StackFrame *frame = NULL; Target *target = exe_ctx.GetTargetPtr(); Process *process = exe_ctx.GetProcessPtr(); if (target && process) { Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) { frame = exe_ctx.GetFramePtr(); if (frame) { #ifdef LLDB_CONFIGURATION_DEBUG StreamString frame_description; frame->DumpUsingSettingsFormat (&frame_description); Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s", expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str()); #endif exe_results = target->EvaluateExpression (expr, frame, expr_value_sp, options.ref()); expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue()); #ifdef LLDB_CONFIGURATION_DEBUG Host::SetCrashDescription (NULL); #endif } else { if (log) log->Printf ("SBFrame::EvaluateExpression () => error: could not reconstruct frame object for this SBFrame."); } } else { if (log) log->Printf ("SBFrame::EvaluateExpression () => error: process is running"); } } #ifndef LLDB_DISABLE_PYTHON if (expr_log) expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **", expr_result.GetValue(), expr_result.GetSummary()); if (log) log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)", frame, expr, expr_value_sp.get(), exe_results); #endif return expr_result; }