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
30
32
34 m_break_id = bp_id;
35 m_location_id = loc_id;
36 }
37
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 std::nullopt. Otherwise returns a BreakpointID with members filled
59 /// out accordingly.
60 static std::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
90protected:
93};
94
95} // namespace lldb_private
96
97#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:40
lldb::break_id_t GetBreakpointID() const
Definition: BreakpointID.h:29
void SetBreakpointID(lldb::break_id_t bp_id)
Definition: BreakpointID.h:38
void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id)
Definition: BreakpointID.h:33
lldb::break_id_t GetLocationID() const
Definition: BreakpointID.h:31
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:91
lldb::break_id_t m_location_id
Definition: BreakpointID.h:92
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
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.
Definition: SBAttachInfo.h:14
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
int32_t break_id_t
Definition: lldb-types.h:84