1 //===-- Breakpoint.h --------------------------------------------*- 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 #ifndef liblldb_Breakpoint_h_ 11 #define liblldb_Breakpoint_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <unordered_set> 16 17 // Other libraries and framework includes 18 // Project includes 19 #include "lldb/Breakpoint/BreakpointID.h" 20 #include "lldb/Breakpoint/BreakpointLocationList.h" 21 #include "lldb/Breakpoint/BreakpointOptions.h" 22 #include "lldb/Breakpoint/BreakpointLocationCollection.h" 23 #include "lldb/Breakpoint/Stoppoint.h" 24 #include "lldb/Core/SearchFilter.h" 25 #include "lldb/Core/Event.h" 26 #include "lldb/Core/StringList.h" 27 28 namespace lldb_private { 29 30 //---------------------------------------------------------------------- 31 /// @class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" 32 /// @brief Class that manages logical breakpoint setting. 33 //---------------------------------------------------------------------- 34 35 //---------------------------------------------------------------------- 36 /// General Outline: 37 /// A breakpoint has four main parts, a filter, a resolver, the list of breakpoint 38 /// locations that have been determined for the filter/resolver pair, and finally 39 /// a set of options for the breakpoint. 40 /// 41 /// \b Filter: 42 /// This is an object derived from SearchFilter. It manages the search 43 /// for breakpoint location matches through the symbols in the module list of the target 44 /// that owns it. It also filters out locations based on whatever logic it wants. 45 /// 46 /// \b Resolver: 47 /// This is an object derived from BreakpointResolver. It provides a 48 /// callback to the filter that will find breakpoint locations. How it does this is 49 /// determined by what kind of resolver it is. 50 /// 51 /// The Breakpoint class also provides constructors for the common breakpoint cases 52 /// which make the appropriate filter and resolver for you. 53 /// 54 /// \b Location List: 55 /// This stores the breakpoint locations that have been determined 56 /// to date. For a given breakpoint, there will be only one location with a given 57 /// address. Adding a location at an already taken address will just return the location 58 /// already at that address. Locations can be looked up by ID, or by address. 59 /// 60 /// \b Options: 61 /// This includes: 62 /// \b Enabled/Disabled 63 /// \b Ignore Count 64 /// \b Callback 65 /// \b Condition 66 /// Note, these options can be set on the breakpoint, and they can also be set on the 67 /// individual locations. The options set on the breakpoint take precedence over the 68 /// options set on the individual location. 69 /// So for instance disabling the breakpoint will cause NONE of the locations to get hit. 70 /// But if the breakpoint is enabled, then the location's enabled state will be checked 71 /// to determine whether to insert that breakpoint location. 72 /// Similarly, if the breakpoint condition says "stop", we won't check the location's condition. 73 /// But if the breakpoint condition says "continue", then we will check the location for whether 74 /// to actually stop or not. 75 /// One subtle point worth observing here is that you don't actually stop at a Breakpoint, you 76 /// always stop at one of its locations. So the "should stop" tests are done by the location, 77 /// not by the breakpoint. 78 //---------------------------------------------------------------------- 79 class Breakpoint: 80 public std::enable_shared_from_this<Breakpoint>, 81 public Stoppoint 82 { 83 public: 84 85 static const ConstString & 86 GetEventIdentifier (); 87 88 89 //------------------------------------------------------------------ 90 /// An enum specifying the match style for breakpoint settings. At 91 /// present only used for function name style breakpoints. 92 //------------------------------------------------------------------ 93 typedef enum 94 { 95 Exact, 96 Regexp, 97 Glob 98 } MatchType; 99 100 class BreakpointEventData : 101 public EventData 102 { 103 public: 104 105 static const ConstString & 106 GetFlavorString (); 107 108 virtual const ConstString & 109 GetFlavor () const; 110 111 BreakpointEventData (lldb::BreakpointEventType sub_type, 112 const lldb::BreakpointSP &new_breakpoint_sp); 113 114 virtual 115 ~BreakpointEventData(); 116 117 lldb::BreakpointEventType 118 GetBreakpointEventType () const; 119 120 lldb::BreakpointSP & 121 GetBreakpoint (); 122 123 BreakpointLocationCollection & GetBreakpointLocationCollection()124 GetBreakpointLocationCollection() 125 { 126 return m_locations; 127 } 128 129 130 virtual void 131 Dump (Stream *s) const; 132 133 static lldb::BreakpointEventType 134 GetBreakpointEventTypeFromEvent (const lldb::EventSP &event_sp); 135 136 static lldb::BreakpointSP 137 GetBreakpointFromEvent (const lldb::EventSP &event_sp); 138 139 static lldb::BreakpointLocationSP 140 GetBreakpointLocationAtIndexFromEvent (const lldb::EventSP &event_sp, uint32_t loc_idx); 141 142 static size_t 143 GetNumBreakpointLocationsFromEvent (const lldb::EventSP &event_sp); 144 145 static const BreakpointEventData * 146 GetEventDataFromEvent (const Event *event_sp); 147 148 private: 149 150 lldb::BreakpointEventType m_breakpoint_event; 151 lldb::BreakpointSP m_new_breakpoint_sp; 152 BreakpointLocationCollection m_locations; 153 154 DISALLOW_COPY_AND_ASSIGN (BreakpointEventData); 155 }; 156 157 158 class BreakpointPrecondition 159 { 160 public: ~BreakpointPrecondition()161 virtual ~BreakpointPrecondition() {} 162 163 virtual bool 164 EvaluatePrecondition(StoppointCallbackContext &context); 165 166 virtual Error 167 ConfigurePrecondition(Args &options); 168 169 virtual void 170 DescribePrecondition(Stream &stream, lldb::DescriptionLevel level); 171 }; 172 173 typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP; 174 175 //------------------------------------------------------------------ 176 /// Destructor. 177 /// 178 /// The destructor is not virtual since there should be no reason to subclass 179 /// breakpoints. The varieties of breakpoints are specified instead by 180 /// providing different resolvers & filters. 181 //------------------------------------------------------------------ 182 ~Breakpoint(); 183 184 //------------------------------------------------------------------ 185 // Methods 186 //------------------------------------------------------------------ 187 188 //------------------------------------------------------------------ 189 /// Tell whether this breakpoint is an "internal" breakpoint. 190 /// @return 191 /// Returns \b true if this is an internal breakpoint, \b false otherwise. 192 //------------------------------------------------------------------ 193 bool 194 IsInternal () const; 195 196 //------------------------------------------------------------------ 197 /// Standard "Dump" method. At present it does nothing. 198 //------------------------------------------------------------------ 199 void 200 Dump (Stream *s); 201 202 //------------------------------------------------------------------ 203 // The next set of methods provide ways to tell the breakpoint to update 204 // it's location list - usually done when modules appear or disappear. 205 //------------------------------------------------------------------ 206 207 208 //------------------------------------------------------------------ 209 /// Tell this breakpoint to clear all its breakpoint sites. Done 210 /// when the process holding the breakpoint sites is destroyed. 211 //------------------------------------------------------------------ 212 void 213 ClearAllBreakpointSites (); 214 215 //------------------------------------------------------------------ 216 /// Tell this breakpoint to scan it's target's module list and resolve any 217 /// new locations that match the breakpoint's specifications. 218 //------------------------------------------------------------------ 219 void 220 ResolveBreakpoint (); 221 222 //------------------------------------------------------------------ 223 /// Tell this breakpoint to scan a given module list and resolve any 224 /// new locations that match the breakpoint's specifications. 225 /// 226 /// @param[in] module_list 227 /// The list of modules to look in for new locations. 228 /// 229 /// @param[in] send_event 230 /// If \b true, send a breakpoint location added event for non-internal breakpoints. 231 //------------------------------------------------------------------ 232 void 233 ResolveBreakpointInModules (ModuleList &module_list, bool send_event = true); 234 235 //------------------------------------------------------------------ 236 /// Tell this breakpoint to scan a given module list and resolve any 237 /// new locations that match the breakpoint's specifications. 238 /// 239 /// @param[in] changed_modules 240 /// The list of modules to look in for new locations. 241 /// 242 /// @param[in] new_locations 243 /// Fills new_locations with the new locations that were made. 244 //------------------------------------------------------------------ 245 void 246 ResolveBreakpointInModules (ModuleList &module_list, BreakpointLocationCollection &new_locations); 247 248 //------------------------------------------------------------------ 249 /// Like ResolveBreakpointInModules, but allows for "unload" events, in 250 /// which case we will remove any locations that are in modules that got 251 /// unloaded. 252 /// 253 /// @param[in] changedModules 254 /// The list of modules to look in for new locations. 255 /// @param[in] load_event 256 /// If \b true then the modules were loaded, if \b false, unloaded. 257 /// @param[in] delete_locations 258 /// If \b true then the modules were unloaded delete any locations in the changed modules. 259 //------------------------------------------------------------------ 260 void 261 ModulesChanged (ModuleList &changed_modules, 262 bool load_event, 263 bool delete_locations = false); 264 265 266 //------------------------------------------------------------------ 267 /// Tells the breakpoint the old module \a old_module_sp has been 268 /// replaced by new_module_sp (usually because the underlying file has been 269 /// rebuilt, and the old version is gone.) 270 /// 271 /// @param[in] old_module_sp 272 /// The old module that is going away. 273 /// @param[in] new_module_sp 274 /// The new module that is replacing it. 275 //------------------------------------------------------------------ 276 void 277 ModuleReplaced (lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp); 278 279 //------------------------------------------------------------------ 280 // The next set of methods provide access to the breakpoint locations 281 // for this breakpoint. 282 //------------------------------------------------------------------ 283 284 //------------------------------------------------------------------ 285 /// Add a location to the breakpoint's location list. This is only meant 286 /// to be called by the breakpoint's resolver. FIXME: how do I ensure that? 287 /// 288 /// @param[in] addr 289 /// The Address specifying the new location. 290 /// @param[out] new_location 291 /// Set to \b true if a new location was created, to \b false if there 292 /// already was a location at this Address. 293 /// @return 294 /// Returns a pointer to the new location. 295 //------------------------------------------------------------------ 296 lldb::BreakpointLocationSP 297 AddLocation (const Address &addr, 298 bool *new_location = NULL); 299 300 //------------------------------------------------------------------ 301 /// Find a breakpoint location by Address. 302 /// 303 /// @param[in] addr 304 /// The Address specifying the location. 305 /// @return 306 /// Returns a shared pointer to the location at \a addr. The pointer 307 /// in the shared pointer will be NULL if there is no location at that address. 308 //------------------------------------------------------------------ 309 lldb::BreakpointLocationSP 310 FindLocationByAddress (const Address &addr); 311 312 //------------------------------------------------------------------ 313 /// Find a breakpoint location ID by Address. 314 /// 315 /// @param[in] addr 316 /// The Address specifying the location. 317 /// @return 318 /// Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if 319 /// there is no breakpoint location at that address. 320 //------------------------------------------------------------------ 321 lldb::break_id_t 322 FindLocationIDByAddress (const Address &addr); 323 324 //------------------------------------------------------------------ 325 /// Find a breakpoint location for a given breakpoint location ID. 326 /// 327 /// @param[in] bp_loc_id 328 /// The ID specifying the location. 329 /// @return 330 /// Returns a shared pointer to the location with ID \a bp_loc_id. The pointer 331 /// in the shared pointer will be NULL if there is no location with that ID. 332 //------------------------------------------------------------------ 333 lldb::BreakpointLocationSP 334 FindLocationByID (lldb::break_id_t bp_loc_id); 335 336 //------------------------------------------------------------------ 337 /// Get breakpoint locations by index. 338 /// 339 /// @param[in] index 340 /// The location index. 341 /// 342 /// @return 343 /// Returns a shared pointer to the location with index \a 344 /// index. The shared pointer might contain NULL if \a index is 345 /// greater than then number of actual locations. 346 //------------------------------------------------------------------ 347 lldb::BreakpointLocationSP 348 GetLocationAtIndex (size_t index); 349 350 //------------------------------------------------------------------ 351 /// Removes all invalid breakpoint locations. 352 /// 353 /// Removes all breakpoint locations with architectures that aren't 354 /// compatible with \a arch. Also remove any breakpoint locations 355 /// with whose locations have address where the section has been 356 /// deleted (module and object files no longer exist). 357 /// 358 /// This is typically used after the process calls exec, or anytime 359 /// the architecture of the target changes. 360 /// 361 /// @param[in] arch 362 /// If valid, check the module in each breakpoint to make sure 363 /// they are compatible, otherwise, ignore architecture. 364 //------------------------------------------------------------------ 365 void 366 RemoveInvalidLocations (const ArchSpec &arch); 367 368 //------------------------------------------------------------------ 369 // The next section deals with various breakpoint options. 370 //------------------------------------------------------------------ 371 372 //------------------------------------------------------------------ 373 /// If \a enable is \b true, enable the breakpoint, if \b false disable it. 374 //------------------------------------------------------------------ 375 void 376 SetEnabled (bool enable); 377 378 //------------------------------------------------------------------ 379 /// Check the Enable/Disable state. 380 /// @return 381 /// \b true if the breakpoint is enabled, \b false if disabled. 382 //------------------------------------------------------------------ 383 bool 384 IsEnabled (); 385 386 //------------------------------------------------------------------ 387 /// Set the breakpoint to ignore the next \a count breakpoint hits. 388 /// @param[in] count 389 /// The number of breakpoint hits to ignore. 390 //------------------------------------------------------------------ 391 void 392 SetIgnoreCount (uint32_t count); 393 394 //------------------------------------------------------------------ 395 /// Return the current ignore count/ 396 /// @return 397 /// The number of breakpoint hits to be ignored. 398 //------------------------------------------------------------------ 399 uint32_t 400 GetIgnoreCount () const; 401 402 //------------------------------------------------------------------ 403 /// Return the current hit count for all locations. 404 /// @return 405 /// The current hit count for all locations. 406 //------------------------------------------------------------------ 407 uint32_t 408 GetHitCount () const; 409 410 411 //------------------------------------------------------------------ 412 /// If \a one_shot is \b true, breakpoint will be deleted on first hit. 413 //------------------------------------------------------------------ 414 void 415 SetOneShot (bool one_shot); 416 417 //------------------------------------------------------------------ 418 /// Check the OneShot state. 419 /// @return 420 /// \b true if the breakpoint is one shot, \b false otherwise. 421 //------------------------------------------------------------------ 422 bool 423 IsOneShot () const; 424 425 //------------------------------------------------------------------ 426 /// Set the valid thread to be checked when the breakpoint is hit. 427 /// @param[in] thread_id 428 /// If this thread hits the breakpoint, we stop, otherwise not. 429 //------------------------------------------------------------------ 430 void 431 SetThreadID (lldb::tid_t thread_id); 432 433 //------------------------------------------------------------------ 434 /// Return the current stop thread value. 435 /// @return 436 /// The thread id for which the breakpoint hit will stop, LLDB_INVALID_THREAD_ID for all threads. 437 //------------------------------------------------------------------ 438 lldb::tid_t 439 GetThreadID () const; 440 441 void 442 SetThreadIndex (uint32_t index); 443 444 uint32_t 445 GetThreadIndex() const; 446 447 void 448 SetThreadName (const char *thread_name); 449 450 const char * 451 GetThreadName () const; 452 453 void 454 SetQueueName (const char *queue_name); 455 456 const char * 457 GetQueueName () const; 458 459 //------------------------------------------------------------------ 460 /// Set the callback action invoked when the breakpoint is hit. 461 /// 462 /// @param[in] callback 463 /// The method that will get called when the breakpoint is hit. 464 /// @param[in] baton 465 /// A void * pointer that will get passed back to the callback function. 466 /// @param[in] is_synchronous 467 /// If \b true the callback will be run on the private event thread 468 /// before the stop event gets reported. If false, the callback will get 469 /// handled on the public event thread after the stop has been posted. 470 /// 471 /// @return 472 /// \b true if the process should stop when you hit the breakpoint. 473 /// \b false if it should continue. 474 //------------------------------------------------------------------ 475 void 476 SetCallback (BreakpointHitCallback callback, 477 void *baton, 478 bool is_synchronous = false); 479 480 void 481 SetCallback (BreakpointHitCallback callback, 482 const lldb::BatonSP &callback_baton_sp, 483 bool is_synchronous = false); 484 485 void 486 ClearCallback (); 487 488 //------------------------------------------------------------------ 489 /// Set the breakpoint's condition. 490 /// 491 /// @param[in] condition 492 /// The condition expression to evaluate when the breakpoint is hit. 493 /// Pass in NULL to clear the condition. 494 //------------------------------------------------------------------ 495 void SetCondition (const char *condition); 496 497 //------------------------------------------------------------------ 498 /// Return a pointer to the text of the condition expression. 499 /// 500 /// @return 501 /// A pointer to the condition expression text, or NULL if no 502 // condition has been set. 503 //------------------------------------------------------------------ 504 const char *GetConditionText () const; 505 506 //------------------------------------------------------------------ 507 // The next section are various utility functions. 508 //------------------------------------------------------------------ 509 510 //------------------------------------------------------------------ 511 /// Return the number of breakpoint locations that have resolved to 512 /// actual breakpoint sites. 513 /// 514 /// @return 515 /// The number locations resolved breakpoint sites. 516 //------------------------------------------------------------------ 517 size_t 518 GetNumResolvedLocations() const; 519 520 //------------------------------------------------------------------ 521 /// Return the number of breakpoint locations. 522 /// 523 /// @return 524 /// The number breakpoint locations. 525 //------------------------------------------------------------------ 526 size_t 527 GetNumLocations() const; 528 529 //------------------------------------------------------------------ 530 /// Put a description of this breakpoint into the stream \a s. 531 /// 532 /// @param[in] s 533 /// Stream into which to dump the description. 534 /// 535 /// @param[in] level 536 /// The description level that indicates the detail level to 537 /// provide. 538 /// 539 /// @see lldb::DescriptionLevel 540 //------------------------------------------------------------------ 541 void 542 GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations = false); 543 544 //------------------------------------------------------------------ 545 /// Set the "kind" description for a breakpoint. If the breakpoint is hit 546 /// the stop info will show this "kind" description instead of the breakpoint 547 /// number. Mostly useful for internal breakpoints, where the breakpoint number 548 /// doesn't have meaning to the user. 549 /// 550 /// @param[in] kind 551 /// New "kind" description. 552 //------------------------------------------------------------------ 553 void SetBreakpointKind(const char * kind)554 SetBreakpointKind (const char *kind) 555 { 556 m_kind_description.assign (kind); 557 } 558 559 //------------------------------------------------------------------ 560 /// Return the "kind" description for a breakpoint. 561 /// 562 /// @return 563 /// The breakpoint kind, or NULL if none is set. 564 //------------------------------------------------------------------ GetBreakpointKind()565 const char *GetBreakpointKind () const 566 { 567 return m_kind_description.c_str(); 568 } 569 570 //------------------------------------------------------------------ 571 /// Accessor for the breakpoint Target. 572 /// @return 573 /// This breakpoint's Target. 574 //------------------------------------------------------------------ 575 Target & GetTarget()576 GetTarget () 577 { 578 return m_target; 579 } 580 581 const Target & GetTarget()582 GetTarget () const 583 { 584 return m_target; 585 } 586 587 const lldb::TargetSP 588 GetTargetSP (); 589 590 void 591 GetResolverDescription (Stream *s); 592 593 //------------------------------------------------------------------ 594 /// Find breakpoint locations which match the (filename, line_number) description. 595 /// The breakpoint location collection is to be filled with the matching locations. 596 /// It should be initialized with 0 size by the API client. 597 /// 598 /// @return 599 /// True if there is a match 600 /// 601 /// The locations which match the filename and line_number in loc_coll. If its 602 /// size is 0 and true is returned, it means the breakpoint fully matches the 603 /// description. 604 //------------------------------------------------------------------ 605 bool GetMatchingFileLine(const ConstString &filename, uint32_t line_number, 606 BreakpointLocationCollection &loc_coll); 607 608 void 609 GetFilterDescription (Stream *s); 610 611 //------------------------------------------------------------------ 612 /// Returns the BreakpointOptions structure set at the breakpoint level. 613 /// 614 /// Meant to be used by the BreakpointLocation class. 615 /// 616 /// @return 617 /// A pointer to this breakpoint's BreakpointOptions. 618 //------------------------------------------------------------------ 619 BreakpointOptions * 620 GetOptions (); 621 622 623 //------------------------------------------------------------------ 624 /// Invoke the callback action when the breakpoint is hit. 625 /// 626 /// Meant to be used by the BreakpointLocation class. 627 /// 628 /// @param[in] context 629 /// Described the breakpoint event. 630 /// 631 /// @param[in] bp_loc_id 632 /// Which breakpoint location hit this breakpoint. 633 /// 634 /// @return 635 /// \b true if the target should stop at this breakpoint and \b false not. 636 //------------------------------------------------------------------ 637 bool 638 InvokeCallback (StoppointCallbackContext *context, 639 lldb::break_id_t bp_loc_id); 640 641 bool IsHardware()642 IsHardware() const 643 { 644 return m_hardware; 645 } 646 647 lldb::BreakpointResolverSP GetResolver()648 GetResolver() 649 { 650 return m_resolver_sp; 651 } 652 653 lldb::SearchFilterSP GetSearchFilter()654 GetSearchFilter() 655 { 656 return m_filter_sp; 657 } 658 659 bool 660 AddName (const char *new_name, Error &error); 661 662 void RemoveName(const char * name_to_remove)663 RemoveName (const char *name_to_remove) 664 { 665 if (name_to_remove) 666 m_name_list.erase(name_to_remove); 667 } 668 669 bool MatchesName(const char * name)670 MatchesName (const char *name) 671 { 672 return m_name_list.find(name) != m_name_list.end(); 673 } 674 675 void GetNames(std::vector<std::string> & names)676 GetNames (std::vector<std::string> &names) 677 { 678 names.clear(); 679 for (auto name : m_name_list) 680 { 681 names.push_back(name); 682 } 683 } 684 685 //------------------------------------------------------------------ 686 /// Set a pre-condition filter that overrides all user provided filters/callbacks etc. 687 /// 688 /// Used to define fancy breakpoints that can do dynamic hit detection without taking up the condition slot - 689 /// which really belongs to the user anyway... 690 /// 691 /// The Precondition should not continue the target, it should return true if the condition says to stop and 692 /// false otherwise. 693 /// 694 //------------------------------------------------------------------ 695 void SetPrecondition(BreakpointPreconditionSP precondition_sp)696 SetPrecondition(BreakpointPreconditionSP precondition_sp) 697 { 698 m_precondition_sp = precondition_sp; 699 } 700 701 bool 702 EvaluatePrecondition (StoppointCallbackContext &context); 703 704 BreakpointPreconditionSP GetPrecondition()705 GetPrecondition() 706 { 707 return m_precondition_sp; 708 } 709 710 protected: 711 friend class Target; 712 //------------------------------------------------------------------ 713 // Protected Methods 714 //------------------------------------------------------------------ 715 716 717 //------------------------------------------------------------------ 718 /// Constructors and Destructors 719 /// Only the Target can make a breakpoint, and it owns the breakpoint lifespans. 720 /// The constructor takes a filter and a resolver. Up in Target there are convenience 721 /// variants that make breakpoints for some common cases. 722 /// 723 /// @param[in] target 724 /// The target in which the breakpoint will be set. 725 /// 726 /// @param[in] filter_sp 727 /// Shared pointer to the search filter that restricts the search domain of the breakpoint. 728 /// 729 /// @param[in] resolver_sp 730 /// Shared pointer to the resolver object that will determine breakpoint matches. 731 /// 732 /// @param hardware 733 /// If true, request a hardware breakpoint to be used to implement the breakpoint locations. 734 /// 735 /// @param resolve_indirect_symbols 736 /// If true, and the address of a given breakpoint location in this breakpoint is set on an 737 /// indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual breakpoint site will 738 /// be set on the target of the indirect symbol. 739 //------------------------------------------------------------------ 740 // This is the generic constructor 741 Breakpoint(Target &target, 742 lldb::SearchFilterSP &filter_sp, 743 lldb::BreakpointResolverSP &resolver_sp, 744 bool hardware, 745 bool resolve_indirect_symbols = true); 746 747 friend class BreakpointLocation; // To call the following two when determining whether to stop. 748 749 void 750 DecrementIgnoreCount(); 751 752 // BreakpointLocation::IgnoreCountShouldStop & Breakpoint::IgnoreCountShouldStop can only be called once per stop, 753 // and BreakpointLocation::IgnoreCountShouldStop should be tested first, and if it returns false we should 754 // continue, otherwise we should test Breakpoint::IgnoreCountShouldStop. 755 756 bool 757 IgnoreCountShouldStop (); 758 759 void IncrementHitCount()760 IncrementHitCount() 761 { 762 m_hit_count++; 763 } 764 765 void DecrementHitCount()766 DecrementHitCount() 767 { 768 assert (m_hit_count > 0); 769 m_hit_count--; 770 } 771 772 private: 773 // This one should only be used by Target to copy breakpoints from target to target - primarily from the dummy 774 // target to prime new targets. 775 Breakpoint (Target &new_target, 776 Breakpoint &bp_to_copy_from); 777 778 //------------------------------------------------------------------ 779 // For Breakpoint only 780 //------------------------------------------------------------------ 781 bool m_being_created; 782 bool m_hardware; // If this breakpoint is required to use a hardware breakpoint 783 Target &m_target; // The target that holds this breakpoint. 784 std::unordered_set<std::string> m_name_list; // If not empty, this is the name of this breakpoint (many breakpoints can share the same name.) 785 lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain. 786 lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint. 787 BreakpointPreconditionSP m_precondition_sp; // The precondition is a breakpoint-level hit filter that can be used 788 // to skip certain breakpoint hits. For instance, exception breakpoints 789 // use this to limit the stop to certain exception classes, while leaving 790 // the condition & callback free for user specification. 791 BreakpointOptions m_options; // Settable breakpoint options 792 BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint. 793 std::string m_kind_description; 794 bool m_resolve_indirect_symbols; 795 uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit. This is kept 796 // separately from the locations hit counts, since locations can go away when 797 // their backing library gets unloaded, and we would lose hit counts. 798 799 void 800 SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind); 801 802 void 803 SendBreakpointChangedEvent (BreakpointEventData *data); 804 805 DISALLOW_COPY_AND_ASSIGN(Breakpoint); 806 }; 807 808 } // namespace lldb_private 809 810 #endif // liblldb_Breakpoint_h_ 811