LLDB  mainline
StoppointLocation.h
Go to the documentation of this file.
1 //===-- StoppointLocation.h -------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_StoppointLocation_h_
10 #define liblldb_StoppointLocation_h_
11 
12 #include "lldb/Utility/UserID.h"
13 #include "lldb/lldb-private.h"
14 // #include "lldb/Breakpoint/BreakpointOptions.h"
15 
16 namespace lldb_private {
17 
19 public:
20  // Constructors and Destructors
22 
24  uint32_t byte_size, bool hardware);
25 
26  virtual ~StoppointLocation();
27 
28  // Operators
29 
30  // Methods
31  virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
32 
33  virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
34 
35  uint32_t GetByteSize() const { return m_byte_size; }
36 
37  uint32_t GetHitCount() const { return m_hit_count; }
38 
40 
41  bool HardwareRequired() const { return m_hardware; }
42 
43  virtual bool IsHardware() const {
45  }
46 
47  virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
48 
49  virtual void Dump(Stream *stream) const {}
50 
51  void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
52 
53  lldb::break_id_t GetID() const { return m_loc_id; }
54 
55 protected:
56  // Classes that inherit from StoppointLocation can see and modify these
57  lldb::break_id_t m_loc_id; // Stoppoint location ID
59  m_addr; // The load address of this stop point. The base Stoppoint doesn't
60  // store a full Address since that's not needed for the breakpoint sites.
61  bool m_hardware; // True if this point has been is required to use hardware
62  // (which may fail due to lack of resources)
63  uint32_t m_hardware_index; // The hardware resource index for this
64  // breakpoint/watchpoint
65  uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length
66  // of the trap opcode for
67  // software breakpoints, or the optional length in bytes for hardware
68  // breakpoints, or the length of the watchpoint.
69  uint32_t
70  m_hit_count; // Number of times this breakpoint/watchpoint has been hit
71 
72  // If you override this, be sure to call the base class to increment the
73  // internal counter.
75 
76  void DecrementHitCount();
77 
78 private:
79  // For StoppointLocation only
80  DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
81  StoppointLocation(); // Disallow default constructor
82 };
83 
84 } // namespace lldb_private
85 
86 #endif // liblldb_StoppointLocation_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
int32_t break_id_t
Definition: lldb-types.h:88
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
#define LLDB_INVALID_INDEX32
Definition: lldb-defines.h:86
void SetHardwareIndex(uint32_t index)
uint64_t addr_t
Definition: lldb-types.h:83
virtual void Dump(Stream *stream) const
virtual lldb::addr_t GetLoadAddress() const
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
virtual bool ShouldStop(StoppointCallbackContext *context)
virtual void SetLoadAddress(lldb::addr_t addr)
lldb::break_id_t GetID() const