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