1//===-- BreakpointID.h ------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_BreakpointID_h_
11#define liblldb_BreakpointID_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17
18#include "lldb/lldb-private.h"
19
20namespace lldb_private {
21
22//----------------------------------------------------------------------
23// class BreakpointID
24//----------------------------------------------------------------------
25
26class BreakpointID
27{
28public:
29
30    BreakpointID (lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
31                  lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
32
33    virtual
34    ~BreakpointID ();
35
36    lldb::break_id_t
37    GetBreakpointID ()
38    {
39        return m_break_id;
40    }
41
42    lldb::break_id_t
43    GetLocationID ()
44    {
45        return m_location_id;
46    }
47
48    void
49    SetID (lldb::break_id_t bp_id, lldb::break_id_t loc_id)
50    {
51        m_break_id = bp_id;
52        m_location_id = loc_id;
53    }
54
55    void
56    SetBreakpointID (lldb::break_id_t bp_id)
57    {
58        m_break_id = bp_id;
59    }
60
61    void
62    SetBreakpointLocationID (lldb::break_id_t loc_id)
63    {
64        m_location_id = loc_id;
65    }
66
67    void
68    GetDescription (Stream *s, lldb::DescriptionLevel level);
69
70    static bool
71    IsRangeIdentifier (const char *str);
72
73    static bool
74    IsValidIDExpression (const char *str);
75
76    static const char *g_range_specifiers[];
77
78    //------------------------------------------------------------------
79    /// Takes an input string containing the description of a breakpoint or breakpoint and location
80    /// and returns the breakpoint ID and the breakpoint location id.
81    ///
82    /// @param[in] input
83    ///     A string containing JUST the breakpoint description.
84    /// @param[out] break_id
85    ///     This is the break id.
86    /// @param[out] break_loc_id
87    ///     This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no location was specified.
88    /// @return
89    ///     \b true if the call was able to extract a breakpoint location from the string.  \b false otherwise.
90    //------------------------------------------------------------------
91    static bool
92    ParseCanonicalReference (const char *input, lldb::break_id_t *break_id, lldb::break_id_t *break_loc_id);
93
94
95    //------------------------------------------------------------------
96    /// Takes a breakpoint ID and the breakpoint location id and returns
97    /// a string containing the canonical description for the breakpoint
98    /// or breakpoint location.
99    ///
100    /// @param[out] break_id
101    ///     This is the break id.
102    ///
103    /// @param[out] break_loc_id
104    ///     This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
105    ///     location is to be specified.
106    //------------------------------------------------------------------
107    static void
108    GetCanonicalReference (Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
109
110protected:
111    lldb::break_id_t m_break_id;
112    lldb::break_id_t m_location_id;
113};
114
115} // namespace lldb_private
116
117#endif  // liblldb_BreakpointID_h_
118