]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Breakpoint/StoppointLocation.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Breakpoint / StoppointLocation.h
1 //===-- StoppointLocation.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_StoppointLocation_h_
11 #define liblldb_StoppointLocation_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Utility/UserID.h"
18 #include "lldb/lldb-private.h"
19 // #include "lldb/Breakpoint/BreakpointOptions.h"
20
21 namespace lldb_private {
22
23 class StoppointLocation {
24 public:
25   //------------------------------------------------------------------
26   // Constructors and Destructors
27   //------------------------------------------------------------------
28   StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
29
30   StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr,
31                     uint32_t byte_size, bool hardware);
32
33   virtual ~StoppointLocation();
34
35   //------------------------------------------------------------------
36   // Operators
37   //------------------------------------------------------------------
38
39   //------------------------------------------------------------------
40   // Methods
41   //------------------------------------------------------------------
42   virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
43
44   virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
45
46   uint32_t GetByteSize() const { return m_byte_size; }
47
48   uint32_t GetHitCount() const { return m_hit_count; }
49
50   uint32_t GetHardwareIndex() const { return m_hardware_index; }
51
52   bool HardwareRequired() const { return m_hardware; }
53
54   virtual bool IsHardware() const {
55     return m_hardware_index != LLDB_INVALID_INDEX32;
56   }
57
58   virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
59
60   virtual void Dump(Stream *stream) const {}
61
62   void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
63
64   lldb::break_id_t GetID() const { return m_loc_id; }
65
66 protected:
67   //------------------------------------------------------------------
68   // Classes that inherit from StoppointLocation can see and modify these
69   //------------------------------------------------------------------
70   lldb::break_id_t m_loc_id; // Stoppoint location ID
71   lldb::addr_t
72       m_addr; // The load address of this stop point. The base Stoppoint doesn't
73   // store a full Address since that's not needed for the breakpoint sites.
74   bool m_hardware; // True if this point has been is required to use hardware
75                    // (which may fail due to lack of resources)
76   uint32_t m_hardware_index; // The hardware resource index for this
77                              // breakpoint/watchpoint
78   uint32_t m_byte_size; // The size in bytes of stop location.  e.g. the length
79                         // of the trap opcode for
80   // software breakpoints, or the optional length in bytes for hardware
81   // breakpoints, or the length of the watchpoint.
82   uint32_t
83       m_hit_count; // Number of times this breakpoint/watchpoint has been hit
84
85   // If you override this, be sure to call the base class to increment the
86   // internal counter.
87   void IncrementHitCount() { ++m_hit_count; }
88
89   void DecrementHitCount();
90
91 private:
92   //------------------------------------------------------------------
93   // For StoppointLocation only
94   //------------------------------------------------------------------
95   DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
96   StoppointLocation(); // Disallow default constructor
97 };
98
99 } // namespace lldb_private
100
101 #endif // liblldb_StoppointLocation_h_