StoppointLocation.h revision 54e7afa84d945f9137f9372ecde432f9e1a702fc
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/lldb-private.h"
18#include "lldb/Core/UserID.h"
19// #include "lldb/Breakpoint/BreakpointOptions.h"
20
21namespace lldb_private {
22
23class StoppointLocation
24{
25public:
26    //------------------------------------------------------------------
27    // Constructors and Destructors
28    //------------------------------------------------------------------
29    StoppointLocation (lldb::break_id_t bid,
30                       lldb::addr_t m_addr,
31                       bool hardware);
32
33    StoppointLocation (lldb::break_id_t bid,
34                       lldb::addr_t m_addr,
35                       size_t size,
36                       bool hardware);
37
38    virtual
39    ~StoppointLocation ();
40
41    //------------------------------------------------------------------
42    // Operators
43    //------------------------------------------------------------------
44
45    //------------------------------------------------------------------
46    // Methods
47    //------------------------------------------------------------------
48    virtual lldb::addr_t
49    GetLoadAddress () const;
50
51    size_t
52    GetByteSize () const;
53
54    uint32_t
55    GetHitCount () const;
56
57    void
58    IncrementHitCount ();
59
60    uint32_t
61    GetHardwareIndex () const;
62
63    bool
64    HardwarePreferred () const;
65
66    bool
67    IsHardware () const;
68
69    virtual bool
70    ShouldStop (StoppointCallbackContext *context);
71
72    virtual void
73    Dump (Stream *stream) const;
74
75    void
76    SetHardwareIndex (uint32_t index);
77
78    lldb::break_id_t
79    GetID () const;
80
81protected:
82    //------------------------------------------------------------------
83    // Classes that inherit from StoppointLocation can see and modify these
84    //------------------------------------------------------------------
85    lldb::break_id_t  m_loc_id;     // Break ID
86    lldb::addr_t      m_addr;       // The load address of this stop point. The base Stoppoint doesn't
87                                    // store a full Address since that's not needed for the breakpoint sites.
88    bool        m_hw_preferred;     // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources)
89    uint32_t    m_hw_index;         // The hardware resource index for this breakpoint/watchpoint
90    uint32_t    m_byte_size;        // The size in bytes of stop location.  e.g. the length of the trap opcode for
91                                    // software breakpoints, or the optional length in bytes for
92                                    // hardware breakpoints, or the length of the watchpoint.
93    uint32_t    m_hit_count;        // Number of times this breakpoint has been hit
94
95private:
96    //------------------------------------------------------------------
97    // For StoppointLocation only
98    //------------------------------------------------------------------
99    DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
100    StoppointLocation(); // Disallow default constructor
101};
102
103} // namespace lldb_private
104
105#endif  // liblldb_StoppointLocation_h_
106