Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 1 | //===-- ThreadPlanCallFunction.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/ThreadPlanCallFunction.h" |
| 11 | |
| 12 | // C Includes |
| 13 | // C++ Includes |
| 14 | // Other libraries and framework includes |
Jim Ingham | 46d005d | 2014-04-02 22:53:21 | [diff] [blame] | 15 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 16 | // Project includes |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 17 | #include "lldb/Breakpoint/Breakpoint.h" |
| 18 | #include "lldb/Breakpoint/BreakpointLocation.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 19 | #include "lldb/Core/Address.h" |
| 20 | #include "lldb/Core/Log.h" |
Greg Clayton | 1f74607 | 2012-08-29 21:13:06 | [diff] [blame] | 21 | #include "lldb/Core/Module.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 22 | #include "lldb/Core/Stream.h" |
Greg Clayton | 1f74607 | 2012-08-29 21:13:06 | [diff] [blame] | 23 | #include "lldb/Symbol/ObjectFile.h" |
Zachary Turner | 32abc6e | 2015-03-03 19:23:09 | [diff] [blame] | 24 | #include "lldb/Target/ABI.h" |
Sean Callanan | f211510 | 2010-11-03 22:19:38 | [diff] [blame] | 25 | #include "lldb/Target/LanguageRuntime.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 26 | #include "lldb/Target/Process.h" |
| 27 | #include "lldb/Target/RegisterContext.h" |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 28 | #include "lldb/Target/StopInfo.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 29 | #include "lldb/Target/Target.h" |
| 30 | #include "lldb/Target/Thread.h" |
| 31 | #include "lldb/Target/ThreadPlanRunToAddress.h" |
| 32 | |
| 33 | using namespace lldb; |
| 34 | using namespace lldb_private; |
| 35 | |
| 36 | //---------------------------------------------------------------------- |
| 37 | // ThreadPlanCallFunction: Plan to call a single function |
| 38 | //---------------------------------------------------------------------- |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 39 | bool |
| 40 | ThreadPlanCallFunction::ConstructorSetup (Thread &thread, |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 41 | ABI *& abi, |
| 42 | lldb::addr_t &start_load_addr, |
| 43 | lldb::addr_t &function_load_addr) |
| 44 | { |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 45 | SetIsMasterPlan (true); |
Jim Ingham | 923886c | 2012-05-11 18:43:38 | [diff] [blame] | 46 | SetOkayToDiscard (false); |
Andrew Kaylor | 327c267 | 2012-12-07 17:56:31 | [diff] [blame] | 47 | SetPrivate (true); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 48 | |
| 49 | ProcessSP process_sp (thread.GetProcess()); |
| 50 | if (!process_sp) |
| 51 | return false; |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 52 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 53 | abi = process_sp->GetABI().get(); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 54 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 55 | if (!abi) |
| 56 | return false; |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 57 | |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 | [diff] [blame] | 58 | Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP)); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 59 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 60 | SetBreakpoints(); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 61 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 62 | m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize(); |
| 63 | // If we can't read memory at the point of the process where we are planning to put our function, we're |
| 64 | // not going to get any further... |
| 65 | Error error; |
| 66 | process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error); |
| 67 | if (!error.Success()) |
| 68 | { |
Jim Ingham | ea06f3b | 2013-03-28 00:04:05 | [diff] [blame] | 69 | m_constructor_errors.Printf ("Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".", m_function_sp); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 70 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 71 | log->Printf ("ThreadPlanCallFunction(%p): %s.", |
| 72 | static_cast<void*>(this), |
| 73 | m_constructor_errors.GetData()); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 74 | return false; |
| 75 | } |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 76 | |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 77 | Module *exe_module = GetTarget().GetExecutableModulePointer(); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 78 | |
| 79 | if (exe_module == NULL) |
| 80 | { |
Jim Ingham | ea06f3b | 2013-03-28 00:04:05 | [diff] [blame] | 81 | m_constructor_errors.Printf ("Can't execute code without an executable module."); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 82 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 83 | log->Printf ("ThreadPlanCallFunction(%p): %s.", |
| 84 | static_cast<void*>(this), |
| 85 | m_constructor_errors.GetData()); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 86 | return false; |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | ObjectFile *objectFile = exe_module->GetObjectFile(); |
| 91 | if (!objectFile) |
| 92 | { |
Jim Ingham | ea06f3b | 2013-03-28 00:04:05 | [diff] [blame] | 93 | m_constructor_errors.Printf ("Could not find object file for module \"%s\".", |
| 94 | exe_module->GetFileSpec().GetFilename().AsCString()); |
| 95 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 96 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 97 | log->Printf ("ThreadPlanCallFunction(%p): %s.", |
| 98 | static_cast<void*>(this), |
| 99 | m_constructor_errors.GetData()); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 100 | return false; |
| 101 | } |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 102 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 103 | m_start_addr = objectFile->GetEntryPointAddress(); |
| 104 | if (!m_start_addr.IsValid()) |
| 105 | { |
Jim Ingham | ea06f3b | 2013-03-28 00:04:05 | [diff] [blame] | 106 | m_constructor_errors.Printf ("Could not find entry point address for executable module \"%s\".", |
| 107 | exe_module->GetFileSpec().GetFilename().AsCString()); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 108 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 109 | log->Printf ("ThreadPlanCallFunction(%p): %s.", |
| 110 | static_cast<void*>(this), |
| 111 | m_constructor_errors.GetData()); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 112 | return false; |
| 113 | } |
| 114 | } |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 115 | |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 116 | start_load_addr = m_start_addr.GetLoadAddress (&GetTarget()); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 117 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 118 | // Checkpoint the thread state so we can restore it later. |
| 119 | if (log && log->GetVerbose()) |
| 120 | ReportRegisterState ("About to checkpoint thread before function call. Original register state was:"); |
| 121 | |
| 122 | if (!thread.CheckpointThreadState (m_stored_thread_state)) |
| 123 | { |
Jim Ingham | ea06f3b | 2013-03-28 00:04:05 | [diff] [blame] | 124 | m_constructor_errors.Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state."); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 125 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 126 | log->Printf ("ThreadPlanCallFunction(%p): %s.", |
| 127 | static_cast<void*>(this), |
| 128 | m_constructor_errors.GetData()); |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 129 | return false; |
| 130 | } |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 131 | function_load_addr = m_function_addr.GetLoadAddress (&GetTarget()); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 132 | |
Jim Ingham | 0092c8e | 2012-04-13 20:38:13 | [diff] [blame] | 133 | return true; |
| 134 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 135 | |
| 136 | ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, |
Matt Kopec | 00049b8 | 2013-02-27 20:13:38 | [diff] [blame] | 137 | const Address &function, |
Jim Ingham | ef65160 | 2011-12-22 19:12:40 | [diff] [blame] | 138 | const ClangASTType &return_type, |
Sean Callanan | a464f3d | 2013-11-08 01:14:26 | [diff] [blame] | 139 | llvm::ArrayRef<addr_t> args, |
| 140 | const EvaluateExpressionOptions &options) : |
Jim Ingham | b01e742a | 2010-06-19 04:45:32 | [diff] [blame] | 141 | ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion), |
Benjamin Kramer | 1ee0d4f | 2010-07-16 12:32:33 | [diff] [blame] | 142 | m_valid (false), |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 143 | m_stop_other_threads (options.GetStopOthers()), |
| 144 | m_unwind_on_error (options.DoesUnwindOnError()), |
| 145 | m_ignore_breakpoints (options.DoesIgnoreBreakpoints()), |
| 146 | m_debug_execution (options.GetDebug()), |
| 147 | m_trap_exceptions (options.GetTrapExceptions()), |
Jim Ingham | 16e0c68 | 2011-08-12 23:34:31 | [diff] [blame] | 148 | m_function_addr (function), |
Filipe Cabecinhas | b4cb0be | 2012-09-11 18:11:07 | [diff] [blame] | 149 | m_function_sp (0), |
Jim Ingham | ce553d8 | 2011-11-01 02:46:54 | [diff] [blame] | 150 | m_takedown_done (false), |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 151 | m_should_clear_objc_exception_bp(false), |
| 152 | m_should_clear_cxx_exception_bp (false), |
Ewan Crawford | 90ff791 | 2015-07-14 10:56:58 | [diff] [blame^] | 153 | m_stop_address (LLDB_INVALID_ADDRESS), |
| 154 | m_return_type (return_type) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 155 | { |
Ewan Crawford | 90ff791 | 2015-07-14 10:56:58 | [diff] [blame^] | 156 | lldb::addr_t start_load_addr = LLDB_INVALID_ADDRESS; |
| 157 | lldb::addr_t function_load_addr = LLDB_INVALID_ADDRESS; |
| 158 | ABI *abi = nullptr; |
| 159 | |
Jim Ingham | 923886c | 2012-05-11 18:43:38 | [diff] [blame] | 160 | if (!ConstructorSetup (thread, abi, start_load_addr, function_load_addr)) |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 161 | return; |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 162 | |
Sean Callanan | a464f3d | 2013-11-08 01:14:26 | [diff] [blame] | 163 | if (!abi->PrepareTrivialCall(thread, |
| 164 | m_function_sp, |
| 165 | function_load_addr, |
| 166 | start_load_addr, |
| 167 | args)) |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 168 | return; |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 169 | |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 170 | ReportRegisterState ("Function call was set up. Register state was:"); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 171 | |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 172 | m_valid = true; |
| 173 | } |
| 174 | |
Ewan Crawford | 90ff791 | 2015-07-14 10:56:58 | [diff] [blame^] | 175 | ThreadPlanCallFunction::ThreadPlanCallFunction(Thread &thread, |
| 176 | const Address &function, |
| 177 | const EvaluateExpressionOptions &options) : |
| 178 | ThreadPlan(ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion), |
| 179 | m_valid(false), |
| 180 | m_stop_other_threads(options.GetStopOthers()), |
| 181 | m_unwind_on_error(options.DoesUnwindOnError()), |
| 182 | m_ignore_breakpoints(options.DoesIgnoreBreakpoints()), |
| 183 | m_debug_execution(options.GetDebug()), |
| 184 | m_trap_exceptions(options.GetTrapExceptions()), |
| 185 | m_function_addr(function), |
| 186 | m_function_sp(0), |
| 187 | m_takedown_done(false), |
| 188 | m_should_clear_objc_exception_bp(false), |
| 189 | m_should_clear_cxx_exception_bp(false), |
| 190 | m_stop_address(LLDB_INVALID_ADDRESS), |
| 191 | m_return_type(ClangASTType()) |
| 192 | { |
| 193 | |
| 194 | } |
| 195 | |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 196 | ThreadPlanCallFunction::~ThreadPlanCallFunction () |
| 197 | { |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 198 | DoTakedown(PlanSucceeded()); |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | void |
| 202 | ThreadPlanCallFunction::ReportRegisterState (const char *message) |
| 203 | { |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 | [diff] [blame] | 204 | Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_VERBOSE)); |
Sean Callanan | ece9649 | 2010-11-08 03:49:50 | [diff] [blame] | 205 | if (log) |
| 206 | { |
Greg Clayton | af247d7 | 2011-05-19 03:54:16 | [diff] [blame] | 207 | StreamString strm; |
Greg Clayton | 5ccbd29 | 2011-01-06 22:15:06 | [diff] [blame] | 208 | RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 209 | |
| 210 | log->PutCString(message); |
| 211 | |
Greg Clayton | af247d7 | 2011-05-19 03:54:16 | [diff] [blame] | 212 | RegisterValue reg_value; |
| 213 | |
| 214 | for (uint32_t reg_idx = 0, num_registers = reg_ctx->GetRegisterCount(); |
| 215 | reg_idx < num_registers; |
| 216 | ++reg_idx) |
Sean Callanan | ece9649 | 2010-11-08 03:49:50 | [diff] [blame] | 217 | { |
Greg Clayton | af247d7 | 2011-05-19 03:54:16 | [diff] [blame] | 218 | const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx); |
| 219 | if (reg_ctx->ReadRegister(reg_info, reg_value)) |
| 220 | { |
| 221 | reg_value.Dump(&strm, reg_info, true, false, eFormatDefault); |
| 222 | strm.EOL(); |
| 223 | } |
Sean Callanan | ece9649 | 2010-11-08 03:49:50 | [diff] [blame] | 224 | } |
Greg Clayton | af247d7 | 2011-05-19 03:54:16 | [diff] [blame] | 225 | log->PutCString(strm.GetData()); |
Sean Callanan | ece9649 | 2010-11-08 03:49:50 | [diff] [blame] | 226 | } |
Sean Callanan | 10af7c4 | 2010-11-04 01:51:38 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | void |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 230 | ThreadPlanCallFunction::DoTakedown (bool success) |
Sean Callanan | 10af7c4 | 2010-11-04 01:51:38 | [diff] [blame] | 231 | { |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 | [diff] [blame] | 232 | Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP)); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 233 | |
Jim Ingham | 87d0e61 | 2012-04-13 23:11:52 | [diff] [blame] | 234 | if (!m_valid) |
| 235 | { |
| 236 | //Don't call DoTakedown if we were never valid to begin with. |
| 237 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 238 | log->Printf ("ThreadPlanCallFunction(%p): Log called on ThreadPlanCallFunction that was never valid.", |
| 239 | static_cast<void*>(this)); |
Jim Ingham | 87d0e61 | 2012-04-13 23:11:52 | [diff] [blame] | 240 | return; |
| 241 | } |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 242 | |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 243 | if (!m_takedown_done) |
Jim Ingham | 7778703 | 2011-01-20 02:03:18 | [diff] [blame] | 244 | { |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 245 | if (success) |
Greg Clayton | 70b5765 | 2011-05-15 01:25:55 | [diff] [blame] | 246 | { |
Ewan Crawford | 90ff791 | 2015-07-14 10:56:58 | [diff] [blame^] | 247 | SetReturnValue(); |
Greg Clayton | 70b5765 | 2011-05-15 01:25:55 | [diff] [blame] | 248 | } |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 249 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 250 | log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", |
| 251 | static_cast<void*>(this), m_thread.GetID(), m_valid, |
| 252 | IsPlanComplete()); |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 253 | m_takedown_done = true; |
Jim Ingham | ce553d8 | 2011-11-01 02:46:54 | [diff] [blame] | 254 | m_stop_address = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC(); |
Jim Ingham | 60c4118 | 2013-06-04 01:40:51 | [diff] [blame] | 255 | m_real_stop_info_sp = GetPrivateStopInfo (); |
Ed Maste | 7b24e95 | 2013-11-12 16:47:08 | [diff] [blame] | 256 | if (!m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state)) |
| 257 | { |
| 258 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 259 | log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore register state", |
| 260 | static_cast<void*>(this)); |
Ed Maste | 7b24e95 | 2013-11-12 16:47:08 | [diff] [blame] | 261 | } |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 262 | SetPlanComplete(success); |
Jim Ingham | 7778703 | 2011-01-20 02:03:18 | [diff] [blame] | 263 | ClearBreakpoints(); |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 264 | if (log && log->GetVerbose()) |
| 265 | ReportRegisterState ("Restoring thread state after function call. Restored register state:"); |
Jim Ingham | 2c36439 | 2011-01-26 19:13:09 | [diff] [blame] | 266 | |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 267 | } |
| 268 | else |
| 269 | { |
| 270 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 271 | log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called as no-op for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", |
| 272 | static_cast<void*>(this), m_thread.GetID(), m_valid, |
| 273 | IsPlanComplete()); |
Jim Ingham | 7778703 | 2011-01-20 02:03:18 | [diff] [blame] | 274 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | void |
Jim Ingham | bda4e5eb | 2011-01-18 01:58:06 | [diff] [blame] | 278 | ThreadPlanCallFunction::WillPop () |
| 279 | { |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 280 | DoTakedown(PlanSucceeded()); |
Jim Ingham | bda4e5eb | 2011-01-18 01:58:06 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | void |
Greg Clayton | 2a48f52 | 2011-05-14 01:50:35 | [diff] [blame] | 284 | ThreadPlanCallFunction::GetDescription (Stream *s, DescriptionLevel level) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 285 | { |
Greg Clayton | 2a48f52 | 2011-05-14 01:50:35 | [diff] [blame] | 286 | if (level == eDescriptionLevelBrief) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 287 | { |
| 288 | s->Printf("Function call thread plan"); |
| 289 | } |
| 290 | else |
| 291 | { |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 292 | TargetSP target_sp (m_thread.CalculateTarget()); |
Daniel Malea | d01b295 | 2012-11-29 21:49:15 | [diff] [blame] | 293 | s->Printf("Thread plan to call 0x%" PRIx64, m_function_addr.GetLoadAddress(target_sp.get())); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 294 | } |
| 295 | } |
| 296 | |
| 297 | bool |
| 298 | ThreadPlanCallFunction::ValidatePlan (Stream *error) |
| 299 | { |
| 300 | if (!m_valid) |
Jim Ingham | ea06f3b | 2013-03-28 00:04:05 | [diff] [blame] | 301 | { |
| 302 | if (error) |
| 303 | { |
| 304 | if (m_constructor_errors.GetSize() > 0) |
| 305 | error->PutCString (m_constructor_errors.GetData()); |
| 306 | else |
| 307 | error->PutCString ("Unknown error"); |
| 308 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 309 | return false; |
Jim Ingham | ea06f3b | 2013-03-28 00:04:05 | [diff] [blame] | 310 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 311 | |
| 312 | return true; |
| 313 | } |
| 314 | |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 315 | |
| 316 | Vote |
| 317 | ThreadPlanCallFunction::ShouldReportStop(Event *event_ptr) |
| 318 | { |
| 319 | if (m_takedown_done || IsPlanComplete()) |
| 320 | return eVoteYes; |
| 321 | else |
| 322 | return ThreadPlan::ShouldReportStop(event_ptr); |
| 323 | } |
| 324 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 325 | bool |
Jim Ingham | 221d51c | 2013-05-08 00:35:16 | [diff] [blame] | 326 | ThreadPlanCallFunction::DoPlanExplainsStop (Event *event_ptr) |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 327 | { |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 | [diff] [blame] | 328 | Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP|LIBLLDB_LOG_PROCESS)); |
Jim Ingham | 60c4118 | 2013-06-04 01:40:51 | [diff] [blame] | 329 | m_real_stop_info_sp = GetPrivateStopInfo (); |
Jim Ingham | 160f78c | 2011-05-17 01:10:11 | [diff] [blame] | 330 | |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 331 | // If our subplan knows why we stopped, even if it's done (which would forward the question to us) |
| 332 | // we answer yes. |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 333 | if (m_subplan_sp.get() != NULL && m_subplan_sp->PlanExplainsStop(event_ptr)) |
Jim Ingham | 184e981 | 2013-01-15 02:47:48 | [diff] [blame] | 334 | { |
| 335 | SetPlanComplete(); |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 336 | return true; |
Jim Ingham | 184e981 | 2013-01-15 02:47:48 | [diff] [blame] | 337 | } |
Sean Callanan | 3e6fedc | 2010-10-19 22:24:06 | [diff] [blame] | 338 | |
Sean Callanan | c98aca6 | 2010-11-03 19:36:28 | [diff] [blame] | 339 | // Check if the breakpoint is one of ours. |
| 340 | |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 341 | StopReason stop_reason; |
| 342 | if (!m_real_stop_info_sp) |
| 343 | stop_reason = eStopReasonNone; |
| 344 | else |
| 345 | stop_reason = m_real_stop_info_sp->GetStopReason(); |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 346 | if (log) |
| 347 | log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.", Thread::StopReasonAsCString(stop_reason)); |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 348 | |
| 349 | if (stop_reason == eStopReasonBreakpoint && BreakpointsExplainStop()) |
Sean Callanan | c98aca6 | 2010-11-03 19:36:28 | [diff] [blame] | 350 | return true; |
| 351 | |
Jim Ingham | 35878c4 | 2014-04-08 21:33:21 | [diff] [blame] | 352 | // One more quirk here. If this event was from Halt interrupting the target, then we should not consider |
| 353 | // ourselves complete. Return true to acknowledge the stop. |
| 354 | if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) |
| 355 | { |
| 356 | if (log) |
| 357 | log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: The event is an Interrupt, returning true."); |
| 358 | return true; |
| 359 | } |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 360 | // We control breakpoints separately from other "stop reasons." So first, |
| 361 | // check the case where we stopped for an internal breakpoint, in that case, continue on. |
| 362 | // If it is not an internal breakpoint, consult m_ignore_breakpoints. |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 363 | |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 364 | |
| 365 | if (stop_reason == eStopReasonBreakpoint) |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 366 | { |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 367 | ProcessSP process_sp (m_thread.CalculateProcess()); |
Jim Ingham | 160f78c | 2011-05-17 01:10:11 | [diff] [blame] | 368 | uint64_t break_site_id = m_real_stop_info_sp->GetValue(); |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 369 | BreakpointSiteSP bp_site_sp; |
| 370 | if (process_sp) |
| 371 | bp_site_sp = process_sp->GetBreakpointSiteList().FindByID(break_site_id); |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 372 | if (bp_site_sp) |
| 373 | { |
| 374 | uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); |
| 375 | bool is_internal = true; |
| 376 | for (uint32_t i = 0; i < num_owners; i++) |
| 377 | { |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 378 | Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint(); |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 379 | if (log) |
| 380 | log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: hit breakpoint %d while calling function", bp.GetID()); |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 381 | |
| 382 | if (!bp.IsInternal()) |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 383 | { |
| 384 | is_internal = false; |
| 385 | break; |
| 386 | } |
| 387 | } |
| 388 | if (is_internal) |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 389 | { |
| 390 | if (log) |
| 391 | log->Printf ("ThreadPlanCallFunction::PlanExplainsStop hit an internal breakpoint, not stopping."); |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 392 | return false; |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 393 | } |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 394 | } |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 395 | |
Jim Ingham | 184e981 | 2013-01-15 02:47:48 | [diff] [blame] | 396 | if (m_ignore_breakpoints) |
Jim Ingham | 923886c | 2012-05-11 18:43:38 | [diff] [blame] | 397 | { |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 398 | if (log) |
| 399 | log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are ignoring breakpoints, overriding breakpoint stop info ShouldStop, returning true"); |
| 400 | m_real_stop_info_sp->OverrideShouldStop(false); |
Jim Ingham | 923886c | 2012-05-11 18:43:38 | [diff] [blame] | 401 | return true; |
| 402 | } |
| 403 | else |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 404 | { |
| 405 | if (log) |
| 406 | log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are not ignoring breakpoints, overriding breakpoint stop info ShouldStop, returning true"); |
| 407 | m_real_stop_info_sp->OverrideShouldStop(true); |
Jim Ingham | 923886c | 2012-05-11 18:43:38 | [diff] [blame] | 408 | return false; |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 409 | } |
| 410 | } |
| 411 | else if (!m_unwind_on_error) |
| 412 | { |
| 413 | // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack. |
| 414 | return false; |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 415 | } |
| 416 | else |
| 417 | { |
| 418 | // If the subplan is running, any crashes are attributable to us. |
Jim Ingham | 2c36439 | 2011-01-26 19:13:09 | [diff] [blame] | 419 | // If we want to discard the plan, then we say we explain the stop |
| 420 | // but if we are going to be discarded, let whoever is above us |
| 421 | // explain the stop. |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 422 | // But don't discard the plan if the stop would restart itself (for instance if it is a |
| 423 | // signal that is set not to stop. Check that here first. We just say we explain the stop |
| 424 | // but aren't done and everything will continue on from there. |
| 425 | |
Jim Ingham | 841ee9b | 2015-05-07 18:51:04 | [diff] [blame] | 426 | if (m_real_stop_info_sp && m_real_stop_info_sp->ShouldStopSynchronous(event_ptr)) |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 427 | { |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 428 | SetPlanComplete(false); |
| 429 | if (m_subplan_sp) |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 430 | { |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 431 | if (m_unwind_on_error) |
| 432 | return true; |
| 433 | else |
| 434 | return false; |
Jim Ingham | 18de2fd | 2012-05-10 01:35:39 | [diff] [blame] | 435 | } |
| 436 | else |
| 437 | return false; |
| 438 | } |
| 439 | else |
Jim Ingham | 0161b49 | 2013-02-09 01:29:05 | [diff] [blame] | 440 | return true; |
Jim Ingham | 40d871f | 2010-10-26 00:27:45 | [diff] [blame] | 441 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | bool |
| 445 | ThreadPlanCallFunction::ShouldStop (Event *event_ptr) |
| 446 | { |
Jim Ingham | 221d51c | 2013-05-08 00:35:16 | [diff] [blame] | 447 | // We do some computation in DoPlanExplainsStop that may or may not set the plan as complete. |
Jim Ingham | 184e981 | 2013-01-15 02:47:48 | [diff] [blame] | 448 | // We need to do that here to make sure our state is correct. |
Jim Ingham | 221d51c | 2013-05-08 00:35:16 | [diff] [blame] | 449 | DoPlanExplainsStop(event_ptr); |
Jim Ingham | 184e981 | 2013-01-15 02:47:48 | [diff] [blame] | 450 | |
| 451 | if (IsPlanComplete()) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 452 | { |
Jim Ingham | 9da3683 | 2011-01-22 01:27:23 | [diff] [blame] | 453 | ReportRegisterState ("Function completed. Register state was:"); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 454 | return true; |
| 455 | } |
| 456 | else |
| 457 | { |
| 458 | return false; |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | bool |
| 463 | ThreadPlanCallFunction::StopOthers () |
| 464 | { |
| 465 | return m_stop_other_threads; |
| 466 | } |
| 467 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 468 | StateType |
Jim Ingham | 06e827c | 2010-11-11 19:26:09 | [diff] [blame] | 469 | ThreadPlanCallFunction::GetPlanRunState () |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 470 | { |
| 471 | return eStateRunning; |
| 472 | } |
| 473 | |
| 474 | void |
| 475 | ThreadPlanCallFunction::DidPush () |
| 476 | { |
Sean Callanan | be3a1b1 | 2010-10-26 00:31:56 | [diff] [blame] | 477 | //#define SINGLE_STEP_EXPRESSIONS |
| 478 | |
Jim Ingham | 8559a35 | 2012-11-26 23:52:18 | [diff] [blame] | 479 | // Now set the thread state to "no reason" so we don't run with whatever signal was outstanding... |
| 480 | // Wait till the plan is pushed so we aren't changing the stop info till we're about to run. |
| 481 | |
| 482 | GetThread().SetStopInfoToNothing(); |
| 483 | |
Sean Callanan | be3a1b1 | 2010-10-26 00:31:56 | [diff] [blame] | 484 | #ifndef SINGLE_STEP_EXPRESSIONS |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 485 | m_subplan_sp.reset(new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads)); |
| 486 | |
| 487 | m_thread.QueueThreadPlan(m_subplan_sp, false); |
Jim Ingham | 7778703 | 2011-01-20 02:03:18 | [diff] [blame] | 488 | m_subplan_sp->SetPrivate (true); |
Sean Callanan | be3a1b1 | 2010-10-26 00:31:56 | [diff] [blame] | 489 | #endif |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | bool |
| 493 | ThreadPlanCallFunction::WillStop () |
| 494 | { |
| 495 | return true; |
| 496 | } |
| 497 | |
| 498 | bool |
| 499 | ThreadPlanCallFunction::MischiefManaged () |
| 500 | { |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 | [diff] [blame] | 501 | Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 502 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 503 | if (IsPlanComplete()) |
| 504 | { |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 505 | if (log) |
Saleem Abdulrasool | 324a103 | 2014-04-04 04:06:10 | [diff] [blame] | 506 | log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", |
| 507 | static_cast<void*>(this)); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 508 | |
| 509 | ThreadPlan::MischiefManaged (); |
| 510 | return true; |
| 511 | } |
| 512 | else |
| 513 | { |
| 514 | return false; |
| 515 | } |
| 516 | } |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 517 | |
| 518 | void |
| 519 | ThreadPlanCallFunction::SetBreakpoints () |
| 520 | { |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 521 | ProcessSP process_sp (m_thread.CalculateProcess()); |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 522 | if (m_trap_exceptions && process_sp) |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 523 | { |
| 524 | m_cxx_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeC_plus_plus); |
| 525 | m_objc_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeObjC); |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 526 | |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 527 | if (m_cxx_language_runtime) |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 528 | { |
| 529 | m_should_clear_cxx_exception_bp = !m_cxx_language_runtime->ExceptionBreakpointsAreSet(); |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 530 | m_cxx_language_runtime->SetExceptionBreakpoints(); |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 531 | } |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 532 | if (m_objc_language_runtime) |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 533 | { |
| 534 | m_should_clear_objc_exception_bp = !m_objc_language_runtime->ExceptionBreakpointsAreSet(); |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 535 | m_objc_language_runtime->SetExceptionBreakpoints(); |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 536 | } |
Greg Clayton | 1ac04c3 | 2012-02-21 00:09:25 | [diff] [blame] | 537 | } |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | void |
| 541 | ThreadPlanCallFunction::ClearBreakpoints () |
| 542 | { |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 543 | if (m_trap_exceptions) |
| 544 | { |
| 545 | if (m_cxx_language_runtime && m_should_clear_cxx_exception_bp) |
| 546 | m_cxx_language_runtime->ClearExceptionBreakpoints(); |
| 547 | if (m_objc_language_runtime && m_should_clear_objc_exception_bp) |
| 548 | m_objc_language_runtime->ClearExceptionBreakpoints(); |
| 549 | } |
Sean Callanan | 6db73ca | 2010-11-03 01:37:52 | [diff] [blame] | 550 | } |
Sean Callanan | c98aca6 | 2010-11-03 19:36:28 | [diff] [blame] | 551 | |
| 552 | bool |
| 553 | ThreadPlanCallFunction::BreakpointsExplainStop() |
| 554 | { |
Jim Ingham | 60c4118 | 2013-06-04 01:40:51 | [diff] [blame] | 555 | StopInfoSP stop_info_sp = GetPrivateStopInfo (); |
Sean Callanan | c98aca6 | 2010-11-03 19:36:28 | [diff] [blame] | 556 | |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 557 | if (m_trap_exceptions) |
Jim Ingham | 184e981 | 2013-01-15 02:47:48 | [diff] [blame] | 558 | { |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 | [diff] [blame] | 559 | if ((m_cxx_language_runtime && |
| 560 | m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp)) |
| 561 | ||(m_objc_language_runtime && |
| 562 | m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))) |
| 563 | { |
| 564 | Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP)); |
| 565 | if (log) |
| 566 | log->Printf ("ThreadPlanCallFunction::BreakpointsExplainStop - Hit an exception breakpoint, setting plan complete."); |
| 567 | |
| 568 | SetPlanComplete(false); |
| 569 | |
| 570 | // If the user has set the ObjC language breakpoint, it would normally get priority over our internal |
| 571 | // catcher breakpoint, but in this case we can't let that happen, so force the ShouldStop here. |
| 572 | stop_info_sp->OverrideShouldStop (true); |
| 573 | return true; |
| 574 | } |
Jim Ingham | 184e981 | 2013-01-15 02:47:48 | [diff] [blame] | 575 | } |
Sean Callanan | c98aca6 | 2010-11-03 19:36:28 | [diff] [blame] | 576 | |
Sean Callanan | c98aca6 | 2010-11-03 19:36:28 | [diff] [blame] | 577 | return false; |
| 578 | } |
Jim Ingham | 8559a35 | 2012-11-26 23:52:18 | [diff] [blame] | 579 | |
Jim Ingham | 0ff099f | 2014-03-07 11:16:37 | [diff] [blame] | 580 | void |
| 581 | ThreadPlanCallFunction::SetStopOthers (bool new_value) |
| 582 | { |
| 583 | m_subplan_sp->SetStopOthers(new_value); |
| 584 | } |
| 585 | |
| 586 | |
Jim Ingham | 8559a35 | 2012-11-26 23:52:18 | [diff] [blame] | 587 | bool |
| 588 | ThreadPlanCallFunction::RestoreThreadState() |
| 589 | { |
| 590 | return GetThread().RestoreThreadStateFromCheckpoint(m_stored_thread_state); |
| 591 | } |
| 592 | |
Ewan Crawford | 90ff791 | 2015-07-14 10:56:58 | [diff] [blame^] | 593 | |
| 594 | void |
| 595 | ThreadPlanCallFunction::SetReturnValue() |
| 596 | { |
| 597 | ProcessSP process_sp(m_thread.GetProcess()); |
| 598 | const ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; |
| 599 | if (abi && m_return_type.IsValid()) |
| 600 | { |
| 601 | const bool persistent = false; |
| 602 | m_return_valobj_sp = abi->GetReturnValueObject(m_thread, m_return_type, persistent); |
| 603 | } |
| 604 | } |