Jim Ingham | 360f53f | 2010-11-30 02:22:11 +0000 | [diff] [blame] | 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 | bool stop_other_threads, |
| 43 | bool discard_on_error, |
| 44 | lldb::addr_t *this_arg, |
Sean Callanan | 3aa7da5 | 2010-12-13 22:46:15 +0000 | [diff] [blame] | 45 | lldb::addr_t *cmd_arg, |
Jim Ingham | 360f53f | 2010-11-30 02:22:11 +0000 | [diff] [blame] | 46 | ClangUserExpression::ClangUserExpressionSP &user_expression_sp) : |
Jim Ingham | 016ef88 | 2011-12-22 19:12:40 +0000 | [diff] [blame] | 47 | ThreadPlanCallFunction (thread, function, ClangASTType(), arg, stop_other_threads, discard_on_error, this_arg, cmd_arg), |
Jim Ingham | 360f53f | 2010-11-30 02:22:11 +0000 | [diff] [blame] | 48 | m_user_expression_sp (user_expression_sp) |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | ThreadPlanCallUserExpression::~ThreadPlanCallUserExpression () |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | void |
| 57 | ThreadPlanCallUserExpression::GetDescription (Stream *s, lldb::DescriptionLevel level) |
Jim Ingham | ba560cc | 2011-11-01 02:46:54 +0000 | [diff] [blame] | 58 | { |
Jim Ingham | 360f53f | 2010-11-30 02:22:11 +0000 | [diff] [blame] | 59 | ThreadPlanCallFunction::GetDescription (s, level); |
| 60 | } |
Jim Ingham | ba560cc | 2011-11-01 02:46:54 +0000 | [diff] [blame] | 61 | |
| 62 | StopInfoSP |
| 63 | ThreadPlanCallUserExpression::GetRealStopInfo() |
| 64 | { |
| 65 | StopInfoSP stop_info_sp = ThreadPlanCallFunction::GetRealStopInfo(); |
| 66 | lldb::addr_t addr = GetStopAddress(); |
Greg Clayton | f4124de | 2012-02-21 00:09:25 +0000 | [diff] [blame^] | 67 | DynamicCheckerFunctions *checkers = m_thread.GetProcess()->GetDynamicCheckers(); |
Jim Ingham | ba560cc | 2011-11-01 02:46:54 +0000 | [diff] [blame] | 68 | StreamString s; |
| 69 | |
| 70 | if (checkers && checkers->DoCheckersExplainStop(addr, s)) |
| 71 | stop_info_sp->SetDescription(s.GetData()); |
| 72 | |
| 73 | return stop_info_sp; |
| 74 | } |