1 //===-- ThreadPlanCallUserExpression.cpp ------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "lldb/Target/ThreadPlanCallUserExpression.h" 11 12 // C Includes 13 // C++ Includes 14 // Other libraries and framework includes 15 #include "llvm/Support/MachO.h" 16 // Project includes 17 #include "lldb/lldb-private-log.h" 18 #include "lldb/Breakpoint/Breakpoint.h" 19 #include "lldb/Breakpoint/BreakpointLocation.h" 20 #include "lldb/Core/Address.h" 21 #include "lldb/Core/Log.h" 22 #include "lldb/Core/Stream.h" 23 #include "lldb/Expression/ClangUserExpression.h" 24 #include "lldb/Target/LanguageRuntime.h" 25 #include "lldb/Target/Process.h" 26 #include "lldb/Target/RegisterContext.h" 27 #include "lldb/Target/StopInfo.h" 28 #include "lldb/Target/Target.h" 29 #include "lldb/Target/Thread.h" 30 #include "lldb/Target/ThreadPlanRunToAddress.h" 31 32 using namespace lldb; 33 using namespace lldb_private; 34 35 //---------------------------------------------------------------------- 36 // ThreadPlanCallUserExpression: Plan to call a single function 37 //---------------------------------------------------------------------- 38 39 ThreadPlanCallUserExpression::ThreadPlanCallUserExpression (Thread &thread, 40 Address &function, 41 lldb::addr_t arg, 42 const EvaluateExpressionOptions &options, 43 lldb::addr_t *this_arg, 44 lldb::addr_t *cmd_arg, 45 ClangUserExpression::ClangUserExpressionSP &user_expression_sp) : 46 ThreadPlanCallFunction (thread, function, ClangASTType(), arg, options, this_arg, cmd_arg), 47 m_user_expression_sp (user_expression_sp) 48 { 49 // User expressions are generally "User generated" so we should set them up to stop when done. 50 SetIsMasterPlan (true); 51 SetOkayToDiscard(false); 52 } 53 54 ThreadPlanCallUserExpression::~ThreadPlanCallUserExpression () 55 { 56 } 57 58 void 59 ThreadPlanCallUserExpression::GetDescription (Stream *s, lldb::DescriptionLevel level) 60 { 61 ThreadPlanCallFunction::GetDescription (s, level); 62 } 63 64 StopInfoSP 65 ThreadPlanCallUserExpression::GetRealStopInfo() 66 { 67 StopInfoSP stop_info_sp = ThreadPlanCallFunction::GetRealStopInfo(); 68 69 if (stop_info_sp) 70 { 71 lldb::addr_t addr = GetStopAddress(); 72 DynamicCheckerFunctions *checkers = m_thread.GetProcess()->GetDynamicCheckers(); 73 StreamString s; 74 75 if (checkers && checkers->DoCheckersExplainStop(addr, s)) 76 stop_info_sp->SetDescription(s.GetData()); 77 } 78 79 return stop_info_sp; 80 } 81