1 //===-- BreakpointID.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_BreakpointID_h_
11 #define liblldb_BreakpointID_h_
15 // Other libraries and framework includes
18 #include "lldb/lldb-private.h"
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/Optional.h"
22 #include "llvm/ADT/StringRef.h"
24 namespace lldb_private {
26 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
32 BreakpointID(lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
33 lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
35 virtual ~BreakpointID();
37 lldb::break_id_t GetBreakpointID() const { return m_break_id; }
39 lldb::break_id_t GetLocationID() const { return m_location_id; }
41 void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) {
43 m_location_id = loc_id;
46 void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; }
48 void SetBreakpointLocationID(lldb::break_id_t loc_id) {
49 m_location_id = loc_id;
52 void GetDescription(Stream *s, lldb::DescriptionLevel level);
54 static bool IsRangeIdentifier(llvm::StringRef str);
55 static bool IsValidIDExpression(llvm::StringRef str);
56 static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers();
58 //------------------------------------------------------------------
59 /// Takes an input string containing the description of a breakpoint or
60 /// breakpoint and location and returns the a BreakpointID filled out with
61 /// the proper id and location.
64 /// A string containing JUST the breakpoint description.
66 /// If \p input was not a valid breakpoint ID string, returns
67 /// \b llvm::None. Otherwise returns a BreakpointID with members filled
69 //------------------------------------------------------------------
70 static llvm::Optional<BreakpointID>
71 ParseCanonicalReference(llvm::StringRef input);
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
79 /// A string containing JUST the breakpoint description.
81 /// If the name is a well-formed breakpoint name, set to success,
82 /// otherwise set to an error.
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, Error &error);
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.
94 /// @param[out] break_id
95 /// This is the break id.
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);
105 lldb::break_id_t m_break_id;
106 lldb::break_id_t m_location_id;
109 } // namespace lldb_private
111 #endif // liblldb_BreakpointID_h_