Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:43

0001 //===-- BreakpointID.h ------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_BREAKPOINT_BREAKPOINTID_H
0010 #define LLDB_BREAKPOINT_BREAKPOINTID_H
0011 
0012 #include "lldb/lldb-private.h"
0013 
0014 #include "llvm/ADT/ArrayRef.h"
0015 #include "llvm/ADT/StringRef.h"
0016 #include <optional>
0017 
0018 namespace lldb_private {
0019 
0020 // class BreakpointID
0021 
0022 class BreakpointID {
0023 public:
0024   BreakpointID(lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
0025                lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
0026 
0027   virtual ~BreakpointID();
0028 
0029   bool operator==(BreakpointID rhs) const {
0030     return m_break_id == rhs.m_break_id && m_location_id == rhs.m_location_id;
0031   }
0032 
0033   lldb::break_id_t GetBreakpointID() const { return m_break_id; }
0034 
0035   lldb::break_id_t GetLocationID() const { return m_location_id; }
0036 
0037   void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) {
0038     m_break_id = bp_id;
0039     m_location_id = loc_id;
0040   }
0041 
0042   void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; }
0043 
0044   void SetBreakpointLocationID(lldb::break_id_t loc_id) {
0045     m_location_id = loc_id;
0046   }
0047 
0048   void GetDescription(Stream *s, lldb::DescriptionLevel level);
0049 
0050   static bool IsRangeIdentifier(llvm::StringRef str);
0051   static bool IsValidIDExpression(llvm::StringRef str);
0052   static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers();
0053 
0054   /// Takes an input string containing the description of a breakpoint or
0055   /// breakpoint and location and returns a BreakpointID filled out with
0056   /// the proper id and location.
0057   ///
0058   /// \param[in] input
0059   ///     A string containing JUST the breakpoint description.
0060   /// \return
0061   ///     If \p input was not a valid breakpoint ID string, returns
0062   ///     \b std::nullopt.  Otherwise returns a BreakpointID with members filled
0063   ///     out accordingly.
0064   static std::optional<BreakpointID>
0065   ParseCanonicalReference(llvm::StringRef input);
0066 
0067   /// Takes an input string and checks to see whether it is a breakpoint name.
0068   /// If it is a mal-formed breakpoint name, error will be set to an appropriate
0069   /// error string.
0070   ///
0071   /// \param[in] str
0072   ///     A string containing JUST the breakpoint description.
0073   /// \param[out] error
0074   ///     If the name is a well-formed breakpoint name, set to success,
0075   ///     otherwise set to an error.
0076   /// \return
0077   ///     \b true if the name is a breakpoint name (as opposed to an ID or
0078   ///     range) false otherwise.
0079   static bool StringIsBreakpointName(llvm::StringRef str, Status &error);
0080 
0081   /// Takes a breakpoint ID and the breakpoint location id and returns
0082   /// a string containing the canonical description for the breakpoint
0083   /// or breakpoint location.
0084   ///
0085   /// \param[out] break_id
0086   ///     This is the break id.
0087   ///
0088   /// \param[out] break_loc_id
0089   ///     This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
0090   ///     location is to be specified.
0091   static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id,
0092                                     lldb::break_id_t break_loc_id);
0093 
0094 protected:
0095   lldb::break_id_t m_break_id;
0096   lldb::break_id_t m_location_id;
0097 };
0098 
0099 } // namespace lldb_private
0100 
0101 #endif // LLDB_BREAKPOINT_BREAKPOINTID_H