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