]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointID.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Breakpoint / BreakpointID.h
1 //===-- BreakpointID.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_BreakpointID_h_
11 #define liblldb_BreakpointID_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17
18 #include "lldb/lldb-private.h"
19
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/Optional.h"
22 #include "llvm/ADT/StringRef.h"
23
24 namespace lldb_private {
25
26 //----------------------------------------------------------------------
27 // class BreakpointID
28 //----------------------------------------------------------------------
29
30 class BreakpointID {
31 public:
32   BreakpointID(lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
33                lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
34
35   virtual ~BreakpointID();
36
37   lldb::break_id_t GetBreakpointID() const { return m_break_id; }
38
39   lldb::break_id_t GetLocationID() const { return m_location_id; }
40
41   void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) {
42     m_break_id = bp_id;
43     m_location_id = loc_id;
44   }
45
46   void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; }
47
48   void SetBreakpointLocationID(lldb::break_id_t loc_id) {
49     m_location_id = loc_id;
50   }
51
52   void GetDescription(Stream *s, lldb::DescriptionLevel level);
53
54   static bool IsRangeIdentifier(llvm::StringRef str);
55   static bool IsValidIDExpression(llvm::StringRef str);
56   static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers();
57
58   //------------------------------------------------------------------
59   /// Takes an input string containing the description of a breakpoint or
60   /// breakpoint and location and returns a BreakpointID filled out with
61   /// the proper id and location.
62   ///
63   /// @param[in] input
64   ///     A string containing JUST the breakpoint description.
65   /// @return
66   ///     If \p input was not a valid breakpoint ID string, returns
67   ///     \b llvm::None.  Otherwise returns a BreakpointID with members filled
68   ///     out accordingly.
69   //------------------------------------------------------------------
70   static llvm::Optional<BreakpointID>
71   ParseCanonicalReference(llvm::StringRef input);
72
73   //------------------------------------------------------------------
74   /// Takes an input string and checks to see whether it is a breakpoint name.
75   /// If it is a mal-formed breakpoint name, error will be set to an appropriate
76   /// error string.
77   ///
78   /// @param[in] input
79   ///     A string containing JUST the breakpoint description.
80   /// @param[out] error
81   ///     If the name is a well-formed breakpoint name, set to success,
82   ///     otherwise set to an error.
83   /// @return
84   ///     \b true if the name is a breakpoint name (as opposed to an ID or
85   ///     range) false otherwise.
86   //------------------------------------------------------------------
87   static bool StringIsBreakpointName(llvm::StringRef str, Status &error);
88
89   //------------------------------------------------------------------
90   /// Takes a breakpoint ID and the breakpoint location id and returns
91   /// a string containing the canonical description for the breakpoint
92   /// or breakpoint location.
93   ///
94   /// @param[out] break_id
95   ///     This is the break id.
96   ///
97   /// @param[out] break_loc_id
98   ///     This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
99   ///     location is to be specified.
100   //------------------------------------------------------------------
101   static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id,
102                                     lldb::break_id_t break_loc_id);
103
104 protected:
105   lldb::break_id_t m_break_id;
106   lldb::break_id_t m_location_id;
107 };
108
109 } // namespace lldb_private
110
111 #endif // liblldb_BreakpointID_h_