LLDBBacktrace::LLDBBacktrace(lldb::SBThread &thread) { m_callstack.clear(); if ( thread.IsValid() ) { m_threadId = thread.GetIndexID(); int nFrames = thread.GetNumFrames(); for(int j=0; j<nFrames; ++j) { lldb::SBFrame frame = thread.GetFrameAtIndex(j); LLDBBacktrace::Entry entry; if ( frame.IsValid() ) { // do we have a file:line? if ( frame.GetLineEntry().IsValid() ) { lldb::SBFileSpec fileSepc = frame.GetLineEntry().GetFileSpec(); entry.filename = wxFileName(fileSepc.GetDirectory(), fileSepc.GetFilename()).GetFullPath(); entry.functionName = frame.GetFunctionName(); entry.line = frame.GetLineEntry().GetLine()-1; entry.id = j; entry.address << wxString::Format("%p", (void*)frame.GetFP()); m_callstack.push_back( entry ); } else { // FIXME: if we dont have a debug symbol, we should learn how to construct a proper entry // for now, we add an empty entry entry.functionName = "??"; entry.id = j; m_callstack.push_back( entry ); } } } } }
SBExecutionContext::SBExecutionContext (lldb::SBThread thread) : m_exe_ctx_sp(new ExecutionContextRef()) { m_exe_ctx_sp->SetThreadPtr(thread.get()); }
SBThreadPlan::SBThreadPlan(lldb::SBThread &sb_thread, const char *class_name) { Thread *thread = sb_thread.get(); if (thread) m_opaque_sp.reset(new ThreadPlanPython(*thread, class_name)); }