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