Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- BreakpointLocation.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 | |
Daniel Malea | 93a6430 | 2012-12-05 00:20:57 +0000 | [diff] [blame] | 10 | #include "lldb/lldb-python.h" |
| 11 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 12 | // C Includes |
| 13 | // C++ Includes |
| 14 | #include <string> |
| 15 | |
| 16 | // Other libraries and framework includes |
| 17 | // Project includes |
| 18 | #include "lldb/Breakpoint/BreakpointLocation.h" |
| 19 | #include "lldb/Breakpoint/BreakpointID.h" |
| 20 | #include "lldb/Breakpoint/StoppointCallbackContext.h" |
Jim Ingham | 5b52f0c | 2011-06-02 23:58:26 +0000 | [diff] [blame] | 21 | #include "lldb/Core/Debugger.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 22 | #include "lldb/Core/Log.h" |
Greg Clayton | 1f74607 | 2012-08-29 21:13:06 +0000 | [diff] [blame] | 23 | #include "lldb/Core/Module.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 24 | #include "lldb/Core/StreamString.h" |
Zachary Turner | a78bd7f | 2015-03-03 23:11:11 +0000 | [diff] [blame] | 25 | #include "lldb/Core/ValueObject.h" |
Zachary Turner | fc85881 | 2015-03-04 17:43:00 +0000 | [diff] [blame] | 26 | #include "lldb/Expression/ClangUserExpression.h" |
Greg Clayton | 1f74607 | 2012-08-29 21:13:06 +0000 | [diff] [blame] | 27 | #include "lldb/Symbol/CompileUnit.h" |
| 28 | #include "lldb/Symbol/Symbol.h" |
| 29 | #include "lldb/Target/Target.h" |
| 30 | #include "lldb/Target/Process.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 31 | #include "lldb/Target/Thread.h" |
Jim Ingham | 1b54c88 | 2010-06-16 02:00:15 +0000 | [diff] [blame] | 32 | #include "lldb/Target/ThreadSpec.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 33 | |
| 34 | using namespace lldb; |
| 35 | using namespace lldb_private; |
| 36 | |
| 37 | BreakpointLocation::BreakpointLocation |
| 38 | ( |
| 39 | break_id_t loc_id, |
| 40 | Breakpoint &owner, |
Greg Clayton | c0d3446 | 2011-02-05 00:38:04 +0000 | [diff] [blame] | 41 | const Address &addr, |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 42 | lldb::tid_t tid, |
Jim Ingham | 1460e4b | 2014-01-10 23:46:59 +0000 | [diff] [blame] | 43 | bool hardware, |
| 44 | bool check_for_resolver |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 45 | ) : |
Greg Clayton | f3ef3d2 | 2011-05-22 22:46:53 +0000 | [diff] [blame] | 46 | StoppointLocation (loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), hardware), |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 47 | m_being_created(true), |
Jim Ingham | 1460e4b | 2014-01-10 23:46:59 +0000 | [diff] [blame] | 48 | m_should_resolve_indirect_functions (false), |
| 49 | m_is_reexported (false), |
| 50 | m_is_indirect (false), |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 51 | m_address (addr), |
| 52 | m_owner (owner), |
| 53 | m_options_ap (), |
Sean Callanan | b4987e3 | 2013-06-06 20:18:50 +0000 | [diff] [blame] | 54 | m_bp_site_sp (), |
| 55 | m_condition_mutex () |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 56 | { |
Jim Ingham | 1460e4b | 2014-01-10 23:46:59 +0000 | [diff] [blame] | 57 | if (check_for_resolver) |
| 58 | { |
| 59 | Symbol *symbol = m_address.CalculateSymbolContextSymbol(); |
| 60 | if (symbol && symbol->IsIndirect()) |
| 61 | { |
| 62 | SetShouldResolveIndirectFunctions (true); |
| 63 | } |
| 64 | } |
| 65 | |
Jim Ingham | 1b54c88 | 2010-06-16 02:00:15 +0000 | [diff] [blame] | 66 | SetThreadID (tid); |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 67 | m_being_created = false; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | BreakpointLocation::~BreakpointLocation() |
| 71 | { |
| 72 | ClearBreakpointSite(); |
| 73 | } |
| 74 | |
| 75 | lldb::addr_t |
Greg Clayton | 13238c4 | 2010-06-14 04:18:27 +0000 | [diff] [blame] | 76 | BreakpointLocation::GetLoadAddress () const |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 77 | { |
Greg Clayton | f3ef3d2 | 2011-05-22 22:46:53 +0000 | [diff] [blame] | 78 | return m_address.GetOpcodeLoadAddress (&m_owner.GetTarget()); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | Address & |
| 82 | BreakpointLocation::GetAddress () |
| 83 | { |
| 84 | return m_address; |
| 85 | } |
| 86 | |
| 87 | Breakpoint & |
| 88 | BreakpointLocation::GetBreakpoint () |
| 89 | { |
| 90 | return m_owner; |
| 91 | } |
| 92 | |
| 93 | bool |
Johnny Chen | fdad679 | 2012-02-01 19:05:20 +0000 | [diff] [blame] | 94 | BreakpointLocation::IsEnabled () const |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 95 | { |
Johnny Chen | 50df1f9 | 2012-01-30 22:48:10 +0000 | [diff] [blame] | 96 | if (!m_owner.IsEnabled()) |
| 97 | return false; |
| 98 | else if (m_options_ap.get() != NULL) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 99 | return m_options_ap->IsEnabled(); |
| 100 | else |
Johnny Chen | 50df1f9 | 2012-01-30 22:48:10 +0000 | [diff] [blame] | 101 | return true; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | void |
| 105 | BreakpointLocation::SetEnabled (bool enabled) |
| 106 | { |
| 107 | GetLocationOptions()->SetEnabled(enabled); |
| 108 | if (enabled) |
| 109 | { |
| 110 | ResolveBreakpointSite(); |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | ClearBreakpointSite(); |
| 115 | } |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 116 | SendBreakpointLocationChangedEvent (enabled ? eBreakpointEventTypeEnabled : eBreakpointEventTypeDisabled); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | void |
| 120 | BreakpointLocation::SetThreadID (lldb::tid_t thread_id) |
| 121 | { |
Jim Ingham | 1b54c88 | 2010-06-16 02:00:15 +0000 | [diff] [blame] | 122 | if (thread_id != LLDB_INVALID_THREAD_ID) |
| 123 | GetLocationOptions()->SetThreadID(thread_id); |
| 124 | else |
| 125 | { |
| 126 | // If we're resetting this to an invalid thread id, then |
| 127 | // don't make an options pointer just to do that. |
| 128 | if (m_options_ap.get() != NULL) |
| 129 | m_options_ap->SetThreadID (thread_id); |
| 130 | } |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 131 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); |
| 132 | } |
| 133 | |
| 134 | lldb::tid_t |
| 135 | BreakpointLocation::GetThreadID () |
| 136 | { |
| 137 | if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) |
| 138 | return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(); |
| 139 | else |
| 140 | return LLDB_INVALID_THREAD_ID; |
| 141 | } |
| 142 | |
| 143 | void |
| 144 | BreakpointLocation::SetThreadIndex (uint32_t index) |
| 145 | { |
| 146 | if (index != 0) |
| 147 | GetLocationOptions()->GetThreadSpec()->SetIndex(index); |
| 148 | else |
| 149 | { |
| 150 | // If we're resetting this to an invalid thread id, then |
| 151 | // don't make an options pointer just to do that. |
| 152 | if (m_options_ap.get() != NULL) |
| 153 | m_options_ap->GetThreadSpec()->SetIndex(index); |
| 154 | } |
| 155 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); |
| 156 | |
| 157 | } |
| 158 | |
| 159 | uint32_t |
| 160 | BreakpointLocation::GetThreadIndex() const |
| 161 | { |
| 162 | if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) |
| 163 | return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetIndex(); |
| 164 | else |
| 165 | return 0; |
| 166 | } |
| 167 | |
| 168 | void |
| 169 | BreakpointLocation::SetThreadName (const char *thread_name) |
| 170 | { |
| 171 | if (thread_name != NULL) |
| 172 | GetLocationOptions()->GetThreadSpec()->SetName(thread_name); |
| 173 | else |
| 174 | { |
| 175 | // If we're resetting this to an invalid thread id, then |
| 176 | // don't make an options pointer just to do that. |
| 177 | if (m_options_ap.get() != NULL) |
| 178 | m_options_ap->GetThreadSpec()->SetName(thread_name); |
| 179 | } |
| 180 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); |
| 181 | } |
| 182 | |
| 183 | const char * |
| 184 | BreakpointLocation::GetThreadName () const |
| 185 | { |
| 186 | if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) |
| 187 | return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetName(); |
| 188 | else |
| 189 | return NULL; |
| 190 | } |
| 191 | |
| 192 | void |
| 193 | BreakpointLocation::SetQueueName (const char *queue_name) |
| 194 | { |
| 195 | if (queue_name != NULL) |
| 196 | GetLocationOptions()->GetThreadSpec()->SetQueueName(queue_name); |
| 197 | else |
| 198 | { |
| 199 | // If we're resetting this to an invalid thread id, then |
| 200 | // don't make an options pointer just to do that. |
| 201 | if (m_options_ap.get() != NULL) |
| 202 | m_options_ap->GetThreadSpec()->SetQueueName(queue_name); |
| 203 | } |
| 204 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); |
| 205 | } |
| 206 | |
| 207 | const char * |
| 208 | BreakpointLocation::GetQueueName () const |
| 209 | { |
| 210 | if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) |
| 211 | return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetQueueName(); |
| 212 | else |
| 213 | return NULL; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | bool |
| 217 | BreakpointLocation::InvokeCallback (StoppointCallbackContext *context) |
| 218 | { |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 219 | if (m_options_ap.get() != NULL && m_options_ap->HasCallback()) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 220 | return m_options_ap->InvokeCallback (context, m_owner.GetID(), GetID()); |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 221 | else |
| 222 | return m_owner.InvokeCallback (context, GetID()); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | void |
| 226 | BreakpointLocation::SetCallback (BreakpointHitCallback callback, void *baton, |
| 227 | bool is_synchronous) |
| 228 | { |
| 229 | // The default "Baton" class will keep a copy of "baton" and won't free |
| 230 | // or delete it when it goes goes out of scope. |
| 231 | GetLocationOptions()->SetCallback(callback, BatonSP (new Baton(baton)), is_synchronous); |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 232 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeCommandChanged); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | void |
| 236 | BreakpointLocation::SetCallback (BreakpointHitCallback callback, const BatonSP &baton_sp, |
| 237 | bool is_synchronous) |
| 238 | { |
| 239 | GetLocationOptions()->SetCallback (callback, baton_sp, is_synchronous); |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 240 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeCommandChanged); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 241 | } |
| 242 | |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 243 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 244 | void |
| 245 | BreakpointLocation::ClearCallback () |
| 246 | { |
| 247 | GetLocationOptions()->ClearCallback(); |
| 248 | } |
| 249 | |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 250 | void |
| 251 | BreakpointLocation::SetCondition (const char *condition) |
| 252 | { |
| 253 | GetLocationOptions()->SetCondition (condition); |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 254 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeConditionChanged); |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 257 | const char * |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 258 | BreakpointLocation::GetConditionText (size_t *hash) const |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 259 | { |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 260 | return GetOptionsNoCreate()->GetConditionText(hash); |
| 261 | } |
| 262 | |
| 263 | bool |
| 264 | BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error) |
| 265 | { |
| 266 | Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); |
Sean Callanan | b4987e3 | 2013-06-06 20:18:50 +0000 | [diff] [blame] | 267 | |
| 268 | Mutex::Locker evaluation_locker(m_condition_mutex); |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 269 | |
| 270 | size_t condition_hash; |
| 271 | const char *condition_text = GetConditionText(&condition_hash); |
| 272 | |
| 273 | if (!condition_text) |
Sean Callanan | ec537a2 | 2013-05-10 21:58:45 +0000 | [diff] [blame] | 274 | { |
| 275 | m_user_expression_sp.reset(); |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 276 | return false; |
Sean Callanan | ec537a2 | 2013-05-10 21:58:45 +0000 | [diff] [blame] | 277 | } |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 278 | |
| 279 | if (condition_hash != m_condition_hash || |
| 280 | !m_user_expression_sp || |
| 281 | !m_user_expression_sp->MatchesContext(exe_ctx)) |
| 282 | { |
| 283 | m_user_expression_sp.reset(new ClangUserExpression(condition_text, |
| 284 | NULL, |
| 285 | lldb::eLanguageTypeUnknown, |
| 286 | ClangUserExpression::eResultTypeAny)); |
| 287 | |
| 288 | StreamString errors; |
| 289 | |
| 290 | if (!m_user_expression_sp->Parse(errors, |
| 291 | exe_ctx, |
| 292 | eExecutionPolicyOnlyWhenNeeded, |
Greg Clayton | 23f8c95 | 2014-03-24 23:10:19 +0000 | [diff] [blame] | 293 | true, |
| 294 | false)) |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 295 | { |
| 296 | error.SetErrorStringWithFormat("Couldn't parse conditional expression:\n%s", |
| 297 | errors.GetData()); |
| 298 | m_user_expression_sp.reset(); |
| 299 | return false; |
| 300 | } |
| 301 | |
| 302 | m_condition_hash = condition_hash; |
| 303 | } |
| 304 | |
| 305 | // We need to make sure the user sees any parse errors in their condition, so we'll hook the |
| 306 | // constructor errors up to the debugger's Async I/O. |
| 307 | |
| 308 | ValueObjectSP result_value_sp; |
Greg Clayton | 62afb9f | 2013-11-04 19:35:17 +0000 | [diff] [blame] | 309 | |
| 310 | EvaluateExpressionOptions options; |
| 311 | options.SetUnwindOnError(true); |
| 312 | options.SetIgnoreBreakpoints(true); |
Jim Ingham | 6fbc48b | 2013-11-07 00:11:47 +0000 | [diff] [blame] | 313 | options.SetTryAllThreads(true); |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 314 | |
| 315 | Error expr_error; |
| 316 | |
| 317 | StreamString execution_errors; |
| 318 | |
| 319 | ClangExpressionVariableSP result_variable_sp; |
| 320 | |
Jim Ingham | 1624a2d | 2014-05-05 02:26:40 +0000 | [diff] [blame] | 321 | ExpressionResults result_code = |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 322 | m_user_expression_sp->Execute(execution_errors, |
| 323 | exe_ctx, |
Greg Clayton | 62afb9f | 2013-11-04 19:35:17 +0000 | [diff] [blame] | 324 | options, |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 325 | m_user_expression_sp, |
Greg Clayton | 62afb9f | 2013-11-04 19:35:17 +0000 | [diff] [blame] | 326 | result_variable_sp); |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 327 | |
| 328 | bool ret; |
| 329 | |
Jim Ingham | 8646d3c | 2014-05-05 02:47:44 +0000 | [diff] [blame] | 330 | if (result_code == eExpressionCompleted) |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 331 | { |
Sean Callanan | 467441d5 | 2013-05-29 20:22:18 +0000 | [diff] [blame] | 332 | if (!result_variable_sp) |
| 333 | { |
Sean Callanan | 467441d5 | 2013-05-29 20:22:18 +0000 | [diff] [blame] | 334 | error.SetErrorString("Expression did not return a result"); |
Sean Callanan | 879425f | 2013-06-24 17:58:46 +0000 | [diff] [blame] | 335 | return false; |
Sean Callanan | 467441d5 | 2013-05-29 20:22:18 +0000 | [diff] [blame] | 336 | } |
| 337 | |
Sean Callanan | 3dbf346 | 2013-04-19 07:09:15 +0000 | [diff] [blame] | 338 | result_value_sp = result_variable_sp->GetValueObject(); |
| 339 | |
| 340 | if (result_value_sp) |
| 341 | { |
| 342 | Scalar scalar_value; |
| 343 | if (result_value_sp->ResolveValue (scalar_value)) |
| 344 | { |
| 345 | if (scalar_value.ULongLong(1) == 0) |
| 346 | ret = false; |
| 347 | else |
| 348 | ret = true; |
| 349 | if (log) |
| 350 | log->Printf("Condition successfully evaluated, result is %s.\n", |
| 351 | ret ? "true" : "false"); |
| 352 | } |
| 353 | else |
| 354 | { |
| 355 | ret = false; |
| 356 | error.SetErrorString("Failed to get an integer result from the expression"); |
| 357 | } |
| 358 | } |
| 359 | else |
| 360 | { |
| 361 | ret = false; |
| 362 | error.SetErrorString("Failed to get any result from the expression"); |
| 363 | } |
| 364 | } |
| 365 | else |
| 366 | { |
| 367 | ret = false; |
| 368 | error.SetErrorStringWithFormat("Couldn't execute expression:\n%s", execution_errors.GetData()); |
| 369 | } |
| 370 | |
| 371 | return ret; |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 372 | } |
| 373 | |
Greg Clayton | c982c76 | 2010-07-09 20:39:50 +0000 | [diff] [blame] | 374 | uint32_t |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 375 | BreakpointLocation::GetIgnoreCount () |
| 376 | { |
Jim Ingham | 05407f6 | 2010-06-22 21:12:54 +0000 | [diff] [blame] | 377 | return GetOptionsNoCreate()->GetIgnoreCount(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | void |
Greg Clayton | c982c76 | 2010-07-09 20:39:50 +0000 | [diff] [blame] | 381 | BreakpointLocation::SetIgnoreCount (uint32_t n) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 382 | { |
| 383 | GetLocationOptions()->SetIgnoreCount(n); |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 384 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeIgnoreChanged); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 385 | } |
| 386 | |
Jim Ingham | 0fd1b75 | 2012-06-26 22:27:55 +0000 | [diff] [blame] | 387 | void |
| 388 | BreakpointLocation::DecrementIgnoreCount() |
| 389 | { |
| 390 | if (m_options_ap.get() != NULL) |
| 391 | { |
| 392 | uint32_t loc_ignore = m_options_ap->GetIgnoreCount(); |
| 393 | if (loc_ignore != 0) |
| 394 | m_options_ap->SetIgnoreCount(loc_ignore - 1); |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | bool |
| 399 | BreakpointLocation::IgnoreCountShouldStop() |
| 400 | { |
| 401 | if (m_options_ap.get() != NULL) |
| 402 | { |
| 403 | uint32_t loc_ignore = m_options_ap->GetIgnoreCount(); |
| 404 | if (loc_ignore != 0) |
| 405 | { |
| 406 | m_owner.DecrementIgnoreCount(); |
| 407 | DecrementIgnoreCount(); // Have to decrement our owners' ignore count, since it won't get a |
| 408 | // chance to. |
| 409 | return false; |
| 410 | } |
| 411 | } |
| 412 | return true; |
| 413 | } |
| 414 | |
Jim Ingham | 1b54c88 | 2010-06-16 02:00:15 +0000 | [diff] [blame] | 415 | const BreakpointOptions * |
Jim Ingham | 05407f6 | 2010-06-22 21:12:54 +0000 | [diff] [blame] | 416 | BreakpointLocation::GetOptionsNoCreate () const |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 417 | { |
| 418 | if (m_options_ap.get() != NULL) |
| 419 | return m_options_ap.get(); |
| 420 | else |
| 421 | return m_owner.GetOptions (); |
| 422 | } |
| 423 | |
| 424 | BreakpointOptions * |
| 425 | BreakpointLocation::GetLocationOptions () |
| 426 | { |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 427 | // If we make the copy we don't copy the callbacks because that is potentially |
| 428 | // expensive and we don't want to do that for the simple case where someone is |
| 429 | // just disabling the location. |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 430 | if (m_options_ap.get() == NULL) |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 431 | m_options_ap.reset(BreakpointOptions::CopyOptionsNoCallback(*m_owner.GetOptions ())); |
| 432 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 433 | return m_options_ap.get(); |
| 434 | } |
| 435 | |
Jim Ingham | 1b54c88 | 2010-06-16 02:00:15 +0000 | [diff] [blame] | 436 | bool |
| 437 | BreakpointLocation::ValidForThisThread (Thread *thread) |
| 438 | { |
Jim Ingham | 05407f6 | 2010-06-22 21:12:54 +0000 | [diff] [blame] | 439 | return thread->MatchesSpec(GetOptionsNoCreate()->GetThreadSpecNoCreate()); |
Jim Ingham | 1b54c88 | 2010-06-16 02:00:15 +0000 | [diff] [blame] | 440 | } |
| 441 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 442 | // RETURNS - true if we should stop at this breakpoint, false if we |
Jim Ingham | 1b54c88 | 2010-06-16 02:00:15 +0000 | [diff] [blame] | 443 | // should continue. Note, we don't check the thread spec for the breakpoint |
| 444 | // here, since if the breakpoint is not for this thread, then the event won't |
| 445 | // even get reported, so the check is redundant. |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 446 | |
| 447 | bool |
| 448 | BreakpointLocation::ShouldStop (StoppointCallbackContext *context) |
| 449 | { |
| 450 | bool should_stop = true; |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 +0000 | [diff] [blame] | 451 | Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 452 | |
Jim Ingham | a672ece | 2014-10-22 01:54:17 +0000 | [diff] [blame] | 453 | // Do this first, if a location is disabled, it shouldn't increment its hit count. |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 454 | if (!IsEnabled()) |
| 455 | return false; |
| 456 | |
Jim Ingham | 0fd1b75 | 2012-06-26 22:27:55 +0000 | [diff] [blame] | 457 | if (!IgnoreCountShouldStop()) |
| 458 | return false; |
| 459 | |
| 460 | if (!m_owner.IgnoreCountShouldStop()) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 461 | return false; |
| 462 | |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 463 | // We only run synchronous callbacks in ShouldStop: |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 464 | context->is_synchronous = true; |
| 465 | should_stop = InvokeCallback (context); |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 466 | |
Jim Ingham | 5b52f0c | 2011-06-02 23:58:26 +0000 | [diff] [blame] | 467 | if (log) |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 468 | { |
Jim Ingham | 5b52f0c | 2011-06-02 23:58:26 +0000 | [diff] [blame] | 469 | StreamString s; |
| 470 | GetDescription (&s, lldb::eDescriptionLevelVerbose); |
| 471 | log->Printf ("Hit breakpoint location: %s, %s.\n", s.GetData(), should_stop ? "stopping" : "continuing"); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 472 | } |
Jim Ingham | 5b52f0c | 2011-06-02 23:58:26 +0000 | [diff] [blame] | 473 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 474 | return should_stop; |
| 475 | } |
| 476 | |
Jim Ingham | a672ece | 2014-10-22 01:54:17 +0000 | [diff] [blame] | 477 | void |
| 478 | BreakpointLocation::BumpHitCount() |
| 479 | { |
| 480 | if (IsEnabled()) |
Jim Ingham | d762df8 | 2015-01-15 01:41:04 +0000 | [diff] [blame] | 481 | { |
| 482 | // Step our hit count, and also step the hit count of the owner. |
Jim Ingham | a672ece | 2014-10-22 01:54:17 +0000 | [diff] [blame] | 483 | IncrementHitCount(); |
Jim Ingham | d762df8 | 2015-01-15 01:41:04 +0000 | [diff] [blame] | 484 | m_owner.IncrementHitCount(); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | void |
| 489 | BreakpointLocation::UndoBumpHitCount() |
| 490 | { |
| 491 | if (IsEnabled()) |
| 492 | { |
| 493 | // Step our hit count, and also step the hit count of the owner. |
| 494 | DecrementHitCount(); |
| 495 | m_owner.DecrementHitCount(); |
| 496 | } |
Jim Ingham | a672ece | 2014-10-22 01:54:17 +0000 | [diff] [blame] | 497 | } |
| 498 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 499 | bool |
| 500 | BreakpointLocation::IsResolved () const |
| 501 | { |
| 502 | return m_bp_site_sp.get() != NULL; |
| 503 | } |
| 504 | |
Jim Ingham | 36f3b36 | 2010-10-14 23:45:03 +0000 | [diff] [blame] | 505 | lldb::BreakpointSiteSP |
| 506 | BreakpointLocation::GetBreakpointSite() const |
| 507 | { |
| 508 | return m_bp_site_sp; |
| 509 | } |
| 510 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 511 | bool |
| 512 | BreakpointLocation::ResolveBreakpointSite () |
| 513 | { |
| 514 | if (m_bp_site_sp) |
| 515 | return true; |
| 516 | |
Greg Clayton | f5e56de | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 517 | Process *process = m_owner.GetTarget().GetProcessSP().get(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 518 | if (process == NULL) |
| 519 | return false; |
| 520 | |
Greg Clayton | eb023e7 | 2013-10-11 19:48:25 +0000 | [diff] [blame] | 521 | lldb::break_id_t new_id = process->CreateBreakpointSite (shared_from_this(), m_owner.IsHardware()); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 522 | |
Stephen Wilson | 50bd94f | 2010-07-17 00:56:13 +0000 | [diff] [blame] | 523 | if (new_id == LLDB_INVALID_BREAK_ID) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 524 | { |
Greg Clayton | 5160ce5 | 2013-03-27 23:08:40 +0000 | [diff] [blame] | 525 | Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 526 | if (log) |
Daniel Malea | d01b295 | 2012-11-29 21:49:15 +0000 | [diff] [blame] | 527 | log->Warning ("Tried to add breakpoint site at 0x%" PRIx64 " but it was already present.\n", |
Greg Clayton | f3ef3d2 | 2011-05-22 22:46:53 +0000 | [diff] [blame] | 528 | m_address.GetOpcodeLoadAddress (&m_owner.GetTarget())); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 529 | return false; |
| 530 | } |
| 531 | |
| 532 | return true; |
| 533 | } |
| 534 | |
| 535 | bool |
| 536 | BreakpointLocation::SetBreakpointSite (BreakpointSiteSP& bp_site_sp) |
| 537 | { |
| 538 | m_bp_site_sp = bp_site_sp; |
Ilia K | 9b618d2 | 2015-04-09 12:55:13 +0000 | [diff] [blame^] | 539 | SendBreakpointLocationChangedEvent (eBreakpointEventTypeLocationsResolved); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 540 | return true; |
| 541 | } |
| 542 | |
| 543 | bool |
| 544 | BreakpointLocation::ClearBreakpointSite () |
| 545 | { |
| 546 | if (m_bp_site_sp.get()) |
| 547 | { |
Jim Ingham | 1578313 | 2014-03-12 22:03:13 +0000 | [diff] [blame] | 548 | ProcessSP process_sp(m_owner.GetTarget().GetProcessSP()); |
| 549 | // If the process exists, get it to remove the owner, it will remove the physical implementation |
| 550 | // of the breakpoint as well if there are no more owners. Otherwise just remove this owner. |
| 551 | if (process_sp) |
| 552 | process_sp->RemoveOwnerFromBreakpointSite (GetBreakpoint().GetID(), |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 553 | GetID(), m_bp_site_sp); |
Jim Ingham | 1578313 | 2014-03-12 22:03:13 +0000 | [diff] [blame] | 554 | else |
| 555 | m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID()); |
| 556 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 557 | m_bp_site_sp.reset(); |
| 558 | return true; |
| 559 | } |
| 560 | return false; |
| 561 | } |
| 562 | |
| 563 | void |
| 564 | BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level) |
| 565 | { |
| 566 | SymbolContext sc; |
Jim Ingham | 1391cc7 | 2012-09-22 00:04:04 +0000 | [diff] [blame] | 567 | |
| 568 | // If the description level is "initial" then the breakpoint is printing out our initial state, |
| 569 | // and we should let it decide how it wants to print our label. |
| 570 | if (level != eDescriptionLevelInitial) |
| 571 | { |
| 572 | s->Indent(); |
| 573 | BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID()); |
| 574 | } |
| 575 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 576 | if (level == lldb::eDescriptionLevelBrief) |
| 577 | return; |
| 578 | |
Jim Ingham | 1391cc7 | 2012-09-22 00:04:04 +0000 | [diff] [blame] | 579 | if (level != eDescriptionLevelInitial) |
| 580 | s->PutCString(": "); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 581 | |
| 582 | if (level == lldb::eDescriptionLevelVerbose) |
| 583 | s->IndentMore(); |
| 584 | |
| 585 | if (m_address.IsSectionOffset()) |
| 586 | { |
| 587 | m_address.CalculateSymbolContext(&sc); |
| 588 | |
Jim Ingham | 1391cc7 | 2012-09-22 00:04:04 +0000 | [diff] [blame] | 589 | if (level == lldb::eDescriptionLevelFull || level == eDescriptionLevelInitial) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 590 | { |
Jim Ingham | 1460e4b | 2014-01-10 23:46:59 +0000 | [diff] [blame] | 591 | if (IsReExported()) |
| 592 | s->PutCString ("re-exported target = "); |
| 593 | else |
| 594 | s->PutCString("where = "); |
Jason Molenda | c980fa9 | 2015-02-13 23:24:21 +0000 | [diff] [blame] | 595 | sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false, true, true); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 596 | } |
| 597 | else |
| 598 | { |
| 599 | if (sc.module_sp) |
| 600 | { |
| 601 | s->EOL(); |
| 602 | s->Indent("module = "); |
| 603 | sc.module_sp->GetFileSpec().Dump (s); |
| 604 | } |
| 605 | |
| 606 | if (sc.comp_unit != NULL) |
| 607 | { |
| 608 | s->EOL(); |
| 609 | s->Indent("compile unit = "); |
Jim Ingham | 517b3b2 | 2010-10-27 22:58:34 +0000 | [diff] [blame] | 610 | static_cast<FileSpec*>(sc.comp_unit)->GetFilename().Dump (s); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 611 | |
| 612 | if (sc.function != NULL) |
| 613 | { |
| 614 | s->EOL(); |
| 615 | s->Indent("function = "); |
| 616 | s->PutCString (sc.function->GetMangled().GetName().AsCString("<unknown>")); |
| 617 | } |
| 618 | |
| 619 | if (sc.line_entry.line > 0) |
| 620 | { |
| 621 | s->EOL(); |
| 622 | s->Indent("location = "); |
Greg Clayton | 6dadd50 | 2010-09-02 21:44:10 +0000 | [diff] [blame] | 623 | sc.line_entry.DumpStopContext (s, true); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 624 | } |
| 625 | |
| 626 | } |
| 627 | else |
| 628 | { |
| 629 | // If we don't have a comp unit, see if we have a symbol we can print. |
| 630 | if (sc.symbol) |
| 631 | { |
| 632 | s->EOL(); |
Jim Ingham | 1460e4b | 2014-01-10 23:46:59 +0000 | [diff] [blame] | 633 | if (IsReExported()) |
| 634 | s->Indent ("re-exported target = "); |
| 635 | else |
| 636 | s->Indent("symbol = "); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 637 | s->PutCString(sc.symbol->GetMangled().GetName().AsCString("<unknown>")); |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | if (level == lldb::eDescriptionLevelVerbose) |
| 644 | { |
| 645 | s->EOL(); |
| 646 | s->Indent(); |
| 647 | } |
Jim Ingham | 1391cc7 | 2012-09-22 00:04:04 +0000 | [diff] [blame] | 648 | |
| 649 | if (m_address.IsSectionOffset() && (level == eDescriptionLevelFull || level == eDescriptionLevelInitial)) |
| 650 | s->Printf (", "); |
| 651 | s->Printf ("address = "); |
| 652 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 653 | ExecutionContextScope *exe_scope = NULL; |
| 654 | Target *target = &m_owner.GetTarget(); |
| 655 | if (target) |
| 656 | exe_scope = target->GetProcessSP().get(); |
| 657 | if (exe_scope == NULL) |
| 658 | exe_scope = target; |
| 659 | |
Jim Ingham | 8f63266 | 2014-03-04 03:09:00 +0000 | [diff] [blame] | 660 | if (level == eDescriptionLevelInitial) |
Jim Ingham | 1391cc7 | 2012-09-22 00:04:04 +0000 | [diff] [blame] | 661 | m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress); |
| 662 | else |
| 663 | m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress); |
Jim Ingham | 1460e4b | 2014-01-10 23:46:59 +0000 | [diff] [blame] | 664 | |
| 665 | if (IsIndirect() && m_bp_site_sp) |
| 666 | { |
| 667 | Address resolved_address; |
| 668 | resolved_address.SetLoadAddress(m_bp_site_sp->GetLoadAddress(), target); |
| 669 | Symbol *resolved_symbol = resolved_address.CalculateSymbolContextSymbol(); |
| 670 | if (resolved_symbol) |
| 671 | { |
| 672 | if (level == eDescriptionLevelFull || level == eDescriptionLevelInitial) |
| 673 | s->Printf (", "); |
| 674 | else if (level == lldb::eDescriptionLevelVerbose) |
| 675 | { |
| 676 | s->EOL(); |
| 677 | s->Indent(); |
| 678 | } |
| 679 | s->Printf ("indirect target = %s", resolved_symbol->GetName().GetCString()); |
| 680 | } |
| 681 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 682 | |
| 683 | if (level == lldb::eDescriptionLevelVerbose) |
| 684 | { |
| 685 | s->EOL(); |
| 686 | s->Indent(); |
| 687 | s->Printf("resolved = %s\n", IsResolved() ? "true" : "false"); |
| 688 | |
| 689 | s->Indent(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 690 | s->Printf ("hit count = %-4u\n", GetHitCount()); |
| 691 | |
| 692 | if (m_options_ap.get()) |
| 693 | { |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 694 | s->Indent(); |
| 695 | m_options_ap->GetDescription (s, level); |
| 696 | s->EOL(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 697 | } |
| 698 | s->IndentLess(); |
| 699 | } |
Jim Ingham | 1391cc7 | 2012-09-22 00:04:04 +0000 | [diff] [blame] | 700 | else if (level != eDescriptionLevelInitial) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 701 | { |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 702 | s->Printf(", %sresolved, hit count = %u ", |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 703 | (IsResolved() ? "" : "un"), |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 704 | GetHitCount()); |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 705 | if (m_options_ap.get()) |
| 706 | { |
| 707 | m_options_ap->GetDescription (s, level); |
| 708 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 709 | } |
| 710 | } |
| 711 | |
| 712 | void |
| 713 | BreakpointLocation::Dump(Stream *s) const |
| 714 | { |
| 715 | if (s == NULL) |
| 716 | return; |
| 717 | |
Daniel Malea | d01b295 | 2012-11-29 21:49:15 +0000 | [diff] [blame] | 718 | s->Printf("BreakpointLocation %u: tid = %4.4" PRIx64 " load addr = 0x%8.8" PRIx64 " state = %s type = %s breakpoint " |
Jim Ingham | 0136309 | 2010-06-18 01:00:58 +0000 | [diff] [blame] | 719 | "hw_index = %i hit_count = %-4u ignore_count = %-4u", |
Johnny Chen | 9ec3c4f | 2012-01-26 00:08:14 +0000 | [diff] [blame] | 720 | GetID(), |
| 721 | GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(), |
| 722 | (uint64_t) m_address.GetOpcodeLoadAddress (&m_owner.GetTarget()), |
Johnny Chen | 50df1f9 | 2012-01-30 22:48:10 +0000 | [diff] [blame] | 723 | (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled", |
Johnny Chen | 9ec3c4f | 2012-01-26 00:08:14 +0000 | [diff] [blame] | 724 | IsHardware() ? "hardware" : "software", |
| 725 | GetHardwareIndex(), |
| 726 | GetHitCount(), |
| 727 | GetOptionsNoCreate()->GetIgnoreCount()); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 728 | } |
Jim Ingham | e6bc6cb | 2012-02-08 05:23:15 +0000 | [diff] [blame] | 729 | |
| 730 | void |
| 731 | BreakpointLocation::SendBreakpointLocationChangedEvent (lldb::BreakpointEventType eventKind) |
| 732 | { |
| 733 | if (!m_being_created |
| 734 | && !m_owner.IsInternal() |
| 735 | && m_owner.GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) |
| 736 | { |
| 737 | Breakpoint::BreakpointEventData *data = new Breakpoint::BreakpointEventData (eventKind, |
| 738 | m_owner.shared_from_this()); |
| 739 | data->GetBreakpointLocationCollection().Add (shared_from_this()); |
| 740 | m_owner.GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); |
| 741 | } |
| 742 | } |
Jim Ingham | 77fd738 | 2014-09-10 21:40:47 +0000 | [diff] [blame] | 743 | |
| 744 | void |
| 745 | BreakpointLocation::SwapLocation (BreakpointLocationSP swap_from) |
| 746 | { |
| 747 | m_address = swap_from->m_address; |
| 748 | m_should_resolve_indirect_functions = swap_from->m_should_resolve_indirect_functions; |
| 749 | m_is_reexported = swap_from->m_is_reexported; |
| 750 | m_is_indirect = swap_from->m_is_indirect; |
| 751 | m_user_expression_sp.reset(); |
| 752 | } |