blob: 7ebe879f904e63331aad73b2dbb003fd07e77dd3 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:241//===-- 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
Sean Callanan6db73ca2010-11-03 01:37:5215#include "llvm/Support/MachO.h"
Chris Lattner30fdc8d2010-06-08 16:52:2416// Project includes
17#include "lldb/lldb-private-log.h"
Jim Ingham40d871f2010-10-26 00:27:4518#include "lldb/Breakpoint/Breakpoint.h"
19#include "lldb/Breakpoint/BreakpointLocation.h"
Chris Lattner30fdc8d2010-06-08 16:52:2420#include "lldb/Core/Address.h"
21#include "lldb/Core/Log.h"
22#include "lldb/Core/Stream.h"
Sean Callananf2115102010-11-03 22:19:3823#include "lldb/Target/LanguageRuntime.h"
Chris Lattner30fdc8d2010-06-08 16:52:2424#include "lldb/Target/Process.h"
25#include "lldb/Target/RegisterContext.h"
Jim Ingham40d871f2010-10-26 00:27:4526#include "lldb/Target/StopInfo.h"
Chris Lattner30fdc8d2010-06-08 16:52:2427#include "lldb/Target/Target.h"
28#include "lldb/Target/Thread.h"
29#include "lldb/Target/ThreadPlanRunToAddress.h"
30
31using namespace lldb;
32using namespace lldb_private;
33
34//----------------------------------------------------------------------
35// ThreadPlanCallFunction: Plan to call a single function
36//----------------------------------------------------------------------
Jim Ingham0092c8e2012-04-13 20:38:1337bool
38ThreadPlanCallFunction::ConstructorSetup (Thread &thread,
39 bool discard_on_error,
40 ABI *& abi,
41 lldb::addr_t &start_load_addr,
42 lldb::addr_t &function_load_addr)
43{
44 // Call function thread plans need to be master plans so that they can potentially stay on the stack when
45 // a breakpoint is hit during the function call.
46 SetIsMasterPlan (true);
47 SetOkayToDiscard (discard_on_error);
48
49 ProcessSP process_sp (thread.GetProcess());
50 if (!process_sp)
51 return false;
52
53 abi = process_sp->GetABI().get();
54
55 if (!abi)
56 return false;
57
58 TargetSP target_sp (thread.CalculateTarget());
59
Jim Ingham87d0e612012-04-13 23:11:5260 LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
Jim Ingham0092c8e2012-04-13 20:38:1361
62 SetBreakpoints();
63
64 m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
65 // If we can't read memory at the point of the process where we are planning to put our function, we're
66 // not going to get any further...
67 Error error;
68 process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error);
69 if (!error.Success())
70 {
71 if (log)
Jim Ingham87d0e612012-04-13 23:11:5272 log->Printf ("ThreadPlanCallFunction(%p): Trying to put the stack in unreadable memory at: 0x%llx.", this, m_function_sp);
Jim Ingham0092c8e2012-04-13 20:38:1373 return false;
74 }
75
76 Module *exe_module = target_sp->GetExecutableModulePointer();
77
78 if (exe_module == NULL)
79 {
80 if (log)
Jim Ingham87d0e612012-04-13 23:11:5281 log->Printf ("ThreadPlanCallFunction(%p): Can't execute code without an executable module.", this);
Jim Ingham0092c8e2012-04-13 20:38:1382 return false;
83 }
84 else
85 {
86 ObjectFile *objectFile = exe_module->GetObjectFile();
87 if (!objectFile)
88 {
89 if (log)
Jim Ingham87d0e612012-04-13 23:11:5290 log->Printf ("ThreadPlanCallFunction(%p): Could not find object file for module \"%s\".",
91 this, exe_module->GetFileSpec().GetFilename().AsCString());
Jim Ingham0092c8e2012-04-13 20:38:1392 return false;
93 }
94 m_start_addr = objectFile->GetEntryPointAddress();
95 if (!m_start_addr.IsValid())
96 {
97 if (log)
Jim Ingham87d0e612012-04-13 23:11:5298 log->Printf ("ThreadPlanCallFunction(%p): Could not find entry point address for executable module \"%s\".",
99 this, exe_module->GetFileSpec().GetFilename().AsCString());
Jim Ingham0092c8e2012-04-13 20:38:13100 return false;
101 }
102 }
103
104 start_load_addr = m_start_addr.GetLoadAddress (target_sp.get());
105
106 // Checkpoint the thread state so we can restore it later.
107 if (log && log->GetVerbose())
108 ReportRegisterState ("About to checkpoint thread before function call. Original register state was:");
109
110 if (!thread.CheckpointThreadState (m_stored_thread_state))
111 {
112 if (log)
Jim Ingham87d0e612012-04-13 23:11:52113 log->Printf ("ThreadPlanCallFunction(%p): Setting up ThreadPlanCallFunction, failed to checkpoint thread state.", this);
Jim Ingham0092c8e2012-04-13 20:38:13114 return false;
115 }
116 // Now set the thread state to "no reason" so we don't run with whatever signal was outstanding...
117 thread.SetStopInfoToNothing();
118
119 function_load_addr = m_function_addr.GetLoadAddress (target_sp.get());
120
121 return true;
122}
Chris Lattner30fdc8d2010-06-08 16:52:24123
124ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
125 Address &function,
Jim Inghamef651602011-12-22 19:12:40126 const ClangASTType &return_type,
Greg Clayton2a48f522011-05-14 01:50:35127 addr_t arg,
Chris Lattner30fdc8d2010-06-08 16:52:24128 bool stop_other_threads,
Sean Callananfc55f5d2010-09-21 00:44:12129 bool discard_on_error,
Greg Clayton2a48f522011-05-14 01:50:35130 addr_t *this_arg,
131 addr_t *cmd_arg) :
Jim Inghamb01e742a2010-06-19 04:45:32132 ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
Benjamin Kramer1ee0d4f2010-07-16 12:32:33133 m_valid (false),
134 m_stop_other_threads (stop_other_threads),
Jim Ingham16e0c682011-08-12 23:34:31135 m_function_addr (function),
Peter Collingbourne6b5f17a2011-06-03 20:41:09136 m_function_sp (NULL),
Jim Inghamef651602011-12-22 19:12:40137 m_return_type (return_type),
Jim Inghamce553d82011-11-01 02:46:54138 m_takedown_done (false),
139 m_stop_address (LLDB_INVALID_ADDRESS)
Chris Lattner30fdc8d2010-06-08 16:52:24140{
Jim Ingham0092c8e2012-04-13 20:38:13141 lldb::addr_t start_load_addr;
142 ABI *abi;
143 lldb::addr_t function_load_addr;
144 if (!ConstructorSetup (thread, discard_on_error, abi, start_load_addr, function_load_addr))
Greg Clayton1ac04c32012-02-21 00:09:25145 return;
Chris Lattner30fdc8d2010-06-08 16:52:24146
Greg Claytonfdeb1562011-05-12 02:14:56147 if (this_arg && cmd_arg)
148 {
149 if (!abi->PrepareTrivialCall (thread,
150 m_function_sp,
Jim Ingham0092c8e2012-04-13 20:38:13151 function_load_addr,
Greg Clayton2a48f522011-05-14 01:50:35152 start_load_addr,
Greg Claytonfdeb1562011-05-12 02:14:56153 this_arg,
154 cmd_arg,
Greg Clayton2a48f522011-05-14 01:50:35155 &arg))
Greg Claytonfdeb1562011-05-12 02:14:56156 return;
157 }
158 else if (this_arg)
159 {
160 if (!abi->PrepareTrivialCall (thread,
161 m_function_sp,
Jim Ingham0092c8e2012-04-13 20:38:13162 function_load_addr,
Greg Clayton2a48f522011-05-14 01:50:35163 start_load_addr,
Greg Claytonfdeb1562011-05-12 02:14:56164 this_arg,
Greg Clayton2a48f522011-05-14 01:50:35165 &arg))
Greg Claytonfdeb1562011-05-12 02:14:56166 return;
167 }
168 else
169 {
170 if (!abi->PrepareTrivialCall (thread,
171 m_function_sp,
Jim Ingham0092c8e2012-04-13 20:38:13172 function_load_addr,
Greg Clayton2a48f522011-05-14 01:50:35173 start_load_addr,
174 &arg))
175 return;
176 }
177
178 ReportRegisterState ("Function call was set up. Register state was:");
179
180 m_valid = true;
181}
182
183
184ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
185 Address &function,
Jim Inghamef651602011-12-22 19:12:40186 const ClangASTType &return_type,
Greg Clayton2a48f522011-05-14 01:50:35187 bool stop_other_threads,
188 bool discard_on_error,
189 addr_t *arg1_ptr,
190 addr_t *arg2_ptr,
191 addr_t *arg3_ptr,
192 addr_t *arg4_ptr,
193 addr_t *arg5_ptr,
194 addr_t *arg6_ptr) :
195 ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
196 m_valid (false),
197 m_stop_other_threads (stop_other_threads),
Jim Ingham16e0c682011-08-12 23:34:31198 m_function_addr (function),
Peter Collingbourne6b5f17a2011-06-03 20:41:09199 m_function_sp(NULL),
Jim Inghamef651602011-12-22 19:12:40200 m_return_type (return_type),
Jim Ingham0092c8e2012-04-13 20:38:13201 m_takedown_done (false),
202 m_stop_address (LLDB_INVALID_ADDRESS)
Greg Clayton2a48f522011-05-14 01:50:35203{
Jim Ingham0092c8e2012-04-13 20:38:13204 lldb::addr_t start_load_addr;
205 ABI *abi;
206 lldb::addr_t function_load_addr;
207 if (!ConstructorSetup (thread, discard_on_error, abi, start_load_addr, function_load_addr))
Greg Clayton1ac04c32012-02-21 00:09:25208 return;
209
Greg Clayton2a48f522011-05-14 01:50:35210 if (!abi->PrepareTrivialCall (thread,
Jim Ingham0092c8e2012-04-13 20:38:13211 m_function_sp,
212 function_load_addr,
Greg Clayton2a48f522011-05-14 01:50:35213 start_load_addr,
214 arg1_ptr,
215 arg2_ptr,
216 arg3_ptr,
217 arg4_ptr,
218 arg5_ptr,
219 arg6_ptr))
220 {
Greg Claytonfdeb1562011-05-12 02:14:56221 return;
222 }
Chris Lattner30fdc8d2010-06-08 16:52:24223
Jim Ingham9da36832011-01-22 01:27:23224 ReportRegisterState ("Function call was set up. Register state was:");
225
226 m_valid = true;
227}
228
229ThreadPlanCallFunction::~ThreadPlanCallFunction ()
230{
Jim Ingham18de2fd2012-05-10 01:35:39231 DoTakedown(true);
Jim Ingham9da36832011-01-22 01:27:23232}
233
234void
235ThreadPlanCallFunction::ReportRegisterState (const char *message)
236{
Greg Claytonaf247d72011-05-19 03:54:16237 LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_VERBOSE));
Sean Callananece96492010-11-08 03:49:50238 if (log)
239 {
Greg Claytonaf247d72011-05-19 03:54:16240 StreamString strm;
Greg Clayton5ccbd292011-01-06 22:15:06241 RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
Jim Ingham9da36832011-01-22 01:27:23242
243 log->PutCString(message);
244
Greg Claytonaf247d72011-05-19 03:54:16245 RegisterValue reg_value;
246
247 for (uint32_t reg_idx = 0, num_registers = reg_ctx->GetRegisterCount();
248 reg_idx < num_registers;
249 ++reg_idx)
Sean Callananece96492010-11-08 03:49:50250 {
Greg Claytonaf247d72011-05-19 03:54:16251 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx);
252 if (reg_ctx->ReadRegister(reg_info, reg_value))
253 {
254 reg_value.Dump(&strm, reg_info, true, false, eFormatDefault);
255 strm.EOL();
256 }
Sean Callananece96492010-11-08 03:49:50257 }
Greg Claytonaf247d72011-05-19 03:54:16258 log->PutCString(strm.GetData());
Sean Callananece96492010-11-08 03:49:50259 }
Sean Callanan10af7c42010-11-04 01:51:38260}
261
262void
Jim Ingham18de2fd2012-05-10 01:35:39263ThreadPlanCallFunction::DoTakedown (bool success)
Sean Callanan10af7c42010-11-04 01:51:38264{
Jim Ingham87d0e612012-04-13 23:11:52265 LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
266
267 if (!m_valid)
268 {
269 //Don't call DoTakedown if we were never valid to begin with.
270 if (log)
271 log->Printf ("ThreadPlanCallFunction(%p): Log called on ThreadPlanCallFunction that was never valid.", this);
272 return;
273 }
274
Jim Ingham9da36832011-01-22 01:27:23275 if (!m_takedown_done)
Jim Ingham77787032011-01-20 02:03:18276 {
Jim Ingham18de2fd2012-05-10 01:35:39277 if (success)
Greg Clayton70b57652011-05-15 01:25:55278 {
Jim Ingham18de2fd2012-05-10 01:35:39279 ProcessSP process_sp (m_thread.GetProcess());
280 const ABI *abi = process_sp ? process_sp->GetABI().get() : NULL;
281 if (abi && m_return_type.IsValid())
282 {
283 const bool persistent = false;
284 m_return_valobj_sp = abi->GetReturnValueObject (m_thread, m_return_type, persistent);
285 }
Greg Clayton70b57652011-05-15 01:25:55286 }
Jim Ingham9da36832011-01-22 01:27:23287 if (log)
Jim Ingham87d0e612012-04-13 23:11:52288 log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4llx, m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete());
Jim Ingham9da36832011-01-22 01:27:23289 m_takedown_done = true;
Jim Inghamce553d82011-11-01 02:46:54290 m_stop_address = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
Jim Ingham160f78c2011-05-17 01:10:11291 m_real_stop_info_sp = GetPrivateStopReason();
Jim Ingham77787032011-01-20 02:03:18292 m_thread.RestoreThreadStateFromCheckpoint(m_stored_thread_state);
Jim Ingham18de2fd2012-05-10 01:35:39293 SetPlanComplete(success);
Jim Ingham77787032011-01-20 02:03:18294 ClearBreakpoints();
Jim Ingham9da36832011-01-22 01:27:23295 if (log && log->GetVerbose())
296 ReportRegisterState ("Restoring thread state after function call. Restored register state:");
Jim Ingham2c364392011-01-26 19:13:09297
Jim Ingham9da36832011-01-22 01:27:23298 }
299 else
300 {
301 if (log)
Jim Ingham87d0e612012-04-13 23:11:52302 log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called as no-op for thread 0x%4.4llx, m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete());
Jim Ingham77787032011-01-20 02:03:18303 }
Chris Lattner30fdc8d2010-06-08 16:52:24304}
305
306void
Jim Inghambda4e5eb2011-01-18 01:58:06307ThreadPlanCallFunction::WillPop ()
308{
Jim Ingham18de2fd2012-05-10 01:35:39309 DoTakedown(true);
Jim Inghambda4e5eb2011-01-18 01:58:06310}
311
312void
Greg Clayton2a48f522011-05-14 01:50:35313ThreadPlanCallFunction::GetDescription (Stream *s, DescriptionLevel level)
Chris Lattner30fdc8d2010-06-08 16:52:24314{
Greg Clayton2a48f522011-05-14 01:50:35315 if (level == eDescriptionLevelBrief)
Chris Lattner30fdc8d2010-06-08 16:52:24316 {
317 s->Printf("Function call thread plan");
318 }
319 else
320 {
Greg Clayton1ac04c32012-02-21 00:09:25321 TargetSP target_sp (m_thread.CalculateTarget());
322 s->Printf("Thread plan to call 0x%llx", m_function_addr.GetLoadAddress(target_sp.get()));
Chris Lattner30fdc8d2010-06-08 16:52:24323 }
324}
325
326bool
327ThreadPlanCallFunction::ValidatePlan (Stream *error)
328{
329 if (!m_valid)
330 return false;
331
332 return true;
333}
334
335bool
336ThreadPlanCallFunction::PlanExplainsStop ()
Sean Callanan6db73ca2010-11-03 01:37:52337{
Jim Ingham160f78c2011-05-17 01:10:11338 m_real_stop_info_sp = GetPrivateStopReason();
339
Jim Ingham40d871f2010-10-26 00:27:45340 // If our subplan knows why we stopped, even if it's done (which would forward the question to us)
341 // we answer yes.
Enrico Granata20edcdb2011-07-19 18:03:25342 if (m_subplan_sp.get() != NULL && m_subplan_sp->PlanExplainsStop())
Jim Ingham40d871f2010-10-26 00:27:45343 return true;
Sean Callanan3e6fedc2010-10-19 22:24:06344
Sean Callananc98aca62010-11-03 19:36:28345 // Check if the breakpoint is one of ours.
346
Jim Ingham18de2fd2012-05-10 01:35:39347 StopReason stop_reason;
348 if (!m_real_stop_info_sp)
349 stop_reason = eStopReasonNone;
350 else
351 stop_reason = m_real_stop_info_sp->GetStopReason();
352
353 if (stop_reason == eStopReasonBreakpoint && BreakpointsExplainStop())
Sean Callananc98aca62010-11-03 19:36:28354 return true;
355
Jim Ingham40d871f2010-10-26 00:27:45356 // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack.
357 if (!OkayToDiscard())
358 return false;
359
360 // Otherwise, check the case where we stopped for an internal breakpoint, in that case, continue on.
361 // If it is not an internal breakpoint, consult OkayToDiscard.
Sean Callanan6db73ca2010-11-03 01:37:52362
Jim Ingham18de2fd2012-05-10 01:35:39363
364 if (stop_reason == eStopReasonBreakpoint)
Jim Ingham40d871f2010-10-26 00:27:45365 {
Greg Clayton1ac04c32012-02-21 00:09:25366 ProcessSP process_sp (m_thread.CalculateProcess());
Jim Ingham160f78c2011-05-17 01:10:11367 uint64_t break_site_id = m_real_stop_info_sp->GetValue();
Greg Clayton1ac04c32012-02-21 00:09:25368 BreakpointSiteSP bp_site_sp;
369 if (process_sp)
370 bp_site_sp = process_sp->GetBreakpointSiteList().FindByID(break_site_id);
Jim Ingham40d871f2010-10-26 00:27:45371 if (bp_site_sp)
372 {
373 uint32_t num_owners = bp_site_sp->GetNumberOfOwners();
374 bool is_internal = true;
375 for (uint32_t i = 0; i < num_owners; i++)
376 {
Sean Callanan6db73ca2010-11-03 01:37:52377 Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
Sean Callanan6db73ca2010-11-03 01:37:52378
379 if (!bp.IsInternal())
Jim Ingham40d871f2010-10-26 00:27:45380 {
381 is_internal = false;
382 break;
383 }
384 }
385 if (is_internal)
386 return false;
387 }
388
389 return OkayToDiscard();
390 }
391 else
392 {
393 // If the subplan is running, any crashes are attributable to us.
Jim Ingham2c364392011-01-26 19:13:09394 // If we want to discard the plan, then we say we explain the stop
395 // but if we are going to be discarded, let whoever is above us
396 // explain the stop.
Jim Ingham18de2fd2012-05-10 01:35:39397 if (m_subplan_sp != NULL)
398 {
399 if (OkayToDiscard())
400 {
401 DoTakedown(false);
402 return true;
403 }
404 else
405 return false;
406 }
407 else
408 return false;
Jim Ingham40d871f2010-10-26 00:27:45409 }
Chris Lattner30fdc8d2010-06-08 16:52:24410}
411
412bool
413ThreadPlanCallFunction::ShouldStop (Event *event_ptr)
414{
415 if (PlanExplainsStop())
416 {
Jim Ingham9da36832011-01-22 01:27:23417 ReportRegisterState ("Function completed. Register state was:");
Sean Callanan5300d372010-07-31 01:32:05418
Jim Ingham18de2fd2012-05-10 01:35:39419 DoTakedown(true);
Sean Callanan6db73ca2010-11-03 01:37:52420
Chris Lattner30fdc8d2010-06-08 16:52:24421 return true;
422 }
423 else
424 {
425 return false;
426 }
427}
428
429bool
430ThreadPlanCallFunction::StopOthers ()
431{
432 return m_stop_other_threads;
433}
434
435void
436ThreadPlanCallFunction::SetStopOthers (bool new_value)
437{
438 if (m_subplan_sp)
439 {
440 ThreadPlanRunToAddress *address_plan = static_cast<ThreadPlanRunToAddress *>(m_subplan_sp.get());
441 address_plan->SetStopOthers(new_value);
442 }
443 m_stop_other_threads = new_value;
444}
445
446StateType
Jim Ingham06e827c2010-11-11 19:26:09447ThreadPlanCallFunction::GetPlanRunState ()
Chris Lattner30fdc8d2010-06-08 16:52:24448{
449 return eStateRunning;
450}
451
452void
453ThreadPlanCallFunction::DidPush ()
454{
Sean Callananbe3a1b12010-10-26 00:31:56455//#define SINGLE_STEP_EXPRESSIONS
456
457#ifndef SINGLE_STEP_EXPRESSIONS
Chris Lattner30fdc8d2010-06-08 16:52:24458 m_subplan_sp.reset(new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads));
459
460 m_thread.QueueThreadPlan(m_subplan_sp, false);
Jim Ingham77787032011-01-20 02:03:18461 m_subplan_sp->SetPrivate (true);
Sean Callananbe3a1b12010-10-26 00:31:56462#endif
Chris Lattner30fdc8d2010-06-08 16:52:24463}
464
465bool
466ThreadPlanCallFunction::WillStop ()
467{
468 return true;
469}
470
471bool
472ThreadPlanCallFunction::MischiefManaged ()
473{
474 if (IsPlanComplete())
475 {
Greg Clayton2d4edfb2010-11-06 01:53:30476 LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
Chris Lattner30fdc8d2010-06-08 16:52:24477
478 if (log)
Jim Ingham87d0e612012-04-13 23:11:52479 log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", this);
Chris Lattner30fdc8d2010-06-08 16:52:24480
481 ThreadPlan::MischiefManaged ();
482 return true;
483 }
484 else
485 {
486 return false;
487 }
488}
Sean Callanan6db73ca2010-11-03 01:37:52489
490void
491ThreadPlanCallFunction::SetBreakpoints ()
492{
Greg Clayton1ac04c32012-02-21 00:09:25493 ProcessSP process_sp (m_thread.CalculateProcess());
494 if (process_sp)
495 {
496 m_cxx_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeC_plus_plus);
497 m_objc_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeObjC);
Sean Callanan6db73ca2010-11-03 01:37:52498
Greg Clayton1ac04c32012-02-21 00:09:25499 if (m_cxx_language_runtime)
500 m_cxx_language_runtime->SetExceptionBreakpoints();
501 if (m_objc_language_runtime)
502 m_objc_language_runtime->SetExceptionBreakpoints();
503 }
Sean Callanan6db73ca2010-11-03 01:37:52504}
505
506void
507ThreadPlanCallFunction::ClearBreakpoints ()
508{
Sean Callananf2115102010-11-03 22:19:38509 if (m_cxx_language_runtime)
510 m_cxx_language_runtime->ClearExceptionBreakpoints();
511 if (m_objc_language_runtime)
512 m_objc_language_runtime->ClearExceptionBreakpoints();
Sean Callanan6db73ca2010-11-03 01:37:52513}
Sean Callananc98aca62010-11-03 19:36:28514
515bool
516ThreadPlanCallFunction::BreakpointsExplainStop()
517{
Greg Clayton2a48f522011-05-14 01:50:35518 StopInfoSP stop_info_sp = GetPrivateStopReason();
Sean Callananc98aca62010-11-03 19:36:28519
Sean Callananf2115102010-11-03 22:19:38520 if (m_cxx_language_runtime &&
521 m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))
522 return true;
Sean Callananc98aca62010-11-03 19:36:28523
Sean Callananf2115102010-11-03 22:19:38524 if (m_objc_language_runtime &&
525 m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))
526 return true;
Sean Callananc98aca62010-11-03 19:36:28527
528 return false;
529}