aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Host/common/NativeBreakpoint.h
blob: 2f872e1d5a528aab43742088b1780a4f1a43be4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//===-- NativeBreakpoint.h --------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_NativeBreakpoint_h_
#define liblldb_NativeBreakpoint_h_

#include "lldb/lldb-types.h"

namespace lldb_private {
class NativeBreakpointList;

class NativeBreakpoint {
  friend class NativeBreakpointList;

public:
  // The assumption is that derived breakpoints are enabled when created.
  NativeBreakpoint(lldb::addr_t addr);

  virtual ~NativeBreakpoint();

  Error Enable();

  Error Disable();

  lldb::addr_t GetAddress() const { return m_addr; }

  bool IsEnabled() const { return m_enabled; }

  virtual bool IsSoftwareBreakpoint() const = 0;

protected:
  const lldb::addr_t m_addr;
  int32_t m_ref_count;

  virtual Error DoEnable() = 0;

  virtual Error DoDisable() = 0;

private:
  bool m_enabled;

  // -----------------------------------------------------------
  // interface for NativeBreakpointList
  // -----------------------------------------------------------
  void AddRef();
  int32_t DecRef();
};
}

#endif // ifndef liblldb_NativeBreakpoint_h_