LLDB  mainline
BreakpointID.h
Go to the documentation of this file.
1 //===-- BreakpointID.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_BreakpointID_h_
10 #define liblldb_BreakpointID_h_
11 
12 
13 #include "lldb/lldb-private.h"
14 
15 #include "llvm/ADT/ArrayRef.h"
16 #include "llvm/ADT/Optional.h"
17 #include "llvm/ADT/StringRef.h"
18 
19 namespace lldb_private {
20 
21 // class BreakpointID
22 
23 class BreakpointID {
24 public:
27 
28  virtual ~BreakpointID();
29 
31 
33 
34  void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) {
35  m_break_id = bp_id;
36  m_location_id = loc_id;
37  }
38 
39  void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; }
40 
42  m_location_id = loc_id;
43  }
44 
46 
47  static bool IsRangeIdentifier(llvm::StringRef str);
48  static bool IsValidIDExpression(llvm::StringRef str);
49  static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers();
50 
51  /// Takes an input string containing the description of a breakpoint or
52  /// breakpoint and location and returns a BreakpointID filled out with
53  /// the proper id and location.
54  ///
55  /// \param[in] input
56  /// A string containing JUST the breakpoint description.
57  /// \return
58  /// If \p input was not a valid breakpoint ID string, returns
59  /// \b llvm::None. Otherwise returns a BreakpointID with members filled
60  /// out accordingly.
61  static llvm::Optional<BreakpointID>
62  ParseCanonicalReference(llvm::StringRef input);
63 
64  /// Takes an input string and checks to see whether it is a breakpoint name.
65  /// If it is a mal-formed breakpoint name, error will be set to an appropriate
66  /// error string.
67  ///
68  /// \param[in] input
69  /// A string containing JUST the breakpoint description.
70  /// \param[out] error
71  /// If the name is a well-formed breakpoint name, set to success,
72  /// otherwise set to an error.
73  /// \return
74  /// \b true if the name is a breakpoint name (as opposed to an ID or
75  /// range) false otherwise.
76  static bool StringIsBreakpointName(llvm::StringRef str, Status &error);
77 
78  /// Takes a breakpoint ID and the breakpoint location id and returns
79  /// a string containing the canonical description for the breakpoint
80  /// or breakpoint location.
81  ///
82  /// \param[out] break_id
83  /// This is the break id.
84  ///
85  /// \param[out] break_loc_id
86  /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
87  /// location is to be specified.
88  static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id,
89  lldb::break_id_t break_loc_id);
90 
91 protected:
94 };
95 
96 } // namespace lldb_private
97 
98 #endif // liblldb_BreakpointID_h_
void SetBreakpointLocationID(lldb::break_id_t loc_id)
Definition: BreakpointID.h:41
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
void SetBreakpointID(lldb::break_id_t bp_id)
Definition: BreakpointID.h:39
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
static bool IsRangeIdentifier(llvm::StringRef str)
lldb::break_id_t GetBreakpointID() const
Definition: BreakpointID.h:30
static bool IsValidIDExpression(llvm::StringRef str)
void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id)
Definition: BreakpointID.h:34
static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
Takes a breakpoint ID and the breakpoint location id and returns a string containing the canonical de...
lldb::break_id_t m_break_id
Definition: BreakpointID.h:92
static llvm::Optional< BreakpointID > ParseCanonicalReference(llvm::StringRef input)
Takes an input string containing the description of a breakpoint or breakpoint and location and retur...
lldb::break_id_t GetLocationID() const
Definition: BreakpointID.h:32
void GetDescription(Stream *s, lldb::DescriptionLevel level)
static llvm::ArrayRef< llvm::StringRef > GetRangeSpecifiers()
lldb::break_id_t m_location_id
Definition: BreakpointID.h:93
BreakpointID(lldb::break_id_t bp_id=LLDB_INVALID_BREAK_ID, lldb::break_id_t loc_id=LLDB_INVALID_BREAK_ID)
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:49
static bool StringIsBreakpointName(llvm::StringRef str, Status &error)
Takes an input string and checks to see whether it is a breakpoint name.
An error handling class.
Definition: Status.h:44