1f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//===-- WatchpointOptions.h -------------------------------------*- C++ -*-===//
2f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//
3f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//                     The LLVM Compiler Infrastructure
4f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//
5f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen// This file is distributed under the University of Illinois Open Source
6f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen// License. See LICENSE.TXT for details.
7f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//
8f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//===----------------------------------------------------------------------===//
9f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
10f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen#ifndef liblldb_WatchpointOptions_h_
11f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen#define liblldb_WatchpointOptions_h_
12f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
13f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen// C Includes
14f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen// C++ Includes
15f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen// Other libraries and framework includes
16f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen// Project includes
17f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen#include "lldb/lldb-private.h"
18f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen#include "lldb/Core/Baton.h"
19f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen#include "lldb/Core/StringList.h"
20f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
21f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chennamespace lldb_private {
22f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
23f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//----------------------------------------------------------------------
24f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen/// @class WatchpointOptions WatchpointOptions.h "lldb/Breakpoint/WatchpointOptions.h"
25f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen/// @brief Class that manages the options on a watchpoint.
26f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen//----------------------------------------------------------------------
27f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
28f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chenclass WatchpointOptions
29f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen{
30f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chenpublic:
31f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
32f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // Constructors and Destructors
33f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
34f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
35f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Default constructor.  The watchpoint is enabled, and has no condition,
36f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// callback, ignore count, etc...
37f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
38f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    WatchpointOptions();
39f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    WatchpointOptions(const WatchpointOptions& rhs);
40f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
41f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    static WatchpointOptions *
42f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    CopyOptionsNoCallback (WatchpointOptions &rhs);
43f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
44f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// This constructor allows you to specify all the watchpoint options.
45f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
46f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] callback
47f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    This is the plugin for some code that gets run, returns \b true if we are to stop.
48f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
49f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] baton
50f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    Client data that will get passed to the callback.
51f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
52f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] thread_id
53f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    Only stop if \a thread_id hits the watchpoint.
54f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
55f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    WatchpointOptions(WatchpointHitCallback callback,
56f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen                      void *baton,
57f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen                      lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
58f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
59f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    virtual ~WatchpointOptions();
60f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
61f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
62f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // Operators
63f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
64f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    const WatchpointOptions&
65f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    operator=(const WatchpointOptions& rhs);
66f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
67f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
68f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // Callbacks
69f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //
70f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // Watchpoint callbacks come in two forms, synchronous and asynchronous.  Synchronous callbacks will get
71f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // run before any of the thread plans are consulted, and if they return false the target will continue
72f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // "under the radar" of the thread plans.  There are a couple of restrictions to synchronous callbacks:
73f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // 1) They should NOT resume the target themselves.  Just return false if you want the target to restart.
74f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // 2) Watchpoints with synchronous callbacks can't have conditions (or rather, they can have them, but they
75f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //    won't do anything.  Ditto with ignore counts, etc...  You are supposed to control that all through the
76f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //    callback.
77f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan.  The logic there is:
78f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //   a) If the watchpoint is thread specific and not for this thread, continue w/o running the callback.
79f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //   b) If the ignore count says we shouldn't stop, then ditto.
80f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //   c) If the condition says we shouldn't stop, then ditto.
81f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //   d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.
82f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //  The asynchronous callback can run the target itself, but at present that should be the last action the
83f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //  callback does.  We will relax this condition at some point, but it will take a bit of plumbing to get
84f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //  that to work.
85f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //
86f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
87f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
88f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
89f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Adds a callback to the watchpoint option set.
90f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
91f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] callback
92f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    The function to be called when the watchpoint gets hit.
93f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
94f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] baton_sp
95f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    A baton which will get passed back to the callback when it is invoked.
96f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
97f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] synchronous
98f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    Whether this is a synchronous or asynchronous callback.  See discussion above.
99f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
100f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    void SetCallback (WatchpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false);
101f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
102f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
103f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
104f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Remove the callback from this option set.
105f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
106f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    void ClearCallback ();
107f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
108f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // The rest of these functions are meant to be used only within the watchpoint handling mechanism.
109f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
110f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
111f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Use this function to invoke the callback for a specific stop.
112f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
113f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] context
114f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    The context in which the callback is to be invoked.  This includes the stop event, the
115f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    execution context of the stop (since you might hit the same watchpoint on multiple threads) and
116f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    whether we are currently executing synchronous or asynchronous callbacks.
117f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
118f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @param[in] watch_id
119f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///    The watchpoint ID that owns this option set.
120f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
121f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @return
122f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     The callback return value.
123f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
124f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t watch_id);
125f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
126f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
127f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
128f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
129f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @return
130f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     The synchronicity of our callback.
131f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
132f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    bool IsCallbackSynchronous () {
133f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        return m_callback_is_synchronous;
134f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    }
135f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
136f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
137f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Fetch the baton from the callback.
138f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
139f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @return
140f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     The baton.
141f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
142f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    Baton *GetBaton ();
143f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
144f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
145f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Fetch  a const version of the baton from the callback.
146f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///
147f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @return
148f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     The baton.
149f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
150f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    const Baton *GetBaton () const;
151f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
152f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
153f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Return the current thread spec for this option.  This will return NULL if the no thread
154f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// specifications have been set for this Option yet.
155f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @return
156f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     The thread specification pointer for this option, or NULL if none has
157f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     been set yet.
158f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
159f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    const ThreadSpec *
160f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    GetThreadSpecNoCreate () const;
161f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
162f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
163f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Returns a pointer to the ThreadSpec for this option, creating it.
164f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// if it hasn't been created already.   This API is used for setting the
165f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// ThreadSpec items for this option.
166f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
167f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ThreadSpec *
168f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    GetThreadSpec ();
169f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
170f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    void
171f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    SetThreadID(lldb::tid_t thread_id);
172f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
173f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    void
174f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    GetDescription (Stream *s, lldb::DescriptionLevel level) const;
175f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
176f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
177f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Get description for callback only.
178f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
179f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    void
180f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    GetCallbackDescription (Stream *s, lldb::DescriptionLevel level) const;
181f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
182f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
183f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// Returns true if the watchpoint option has a callback set.
184f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
185f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    bool
186f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    HasCallback();
187f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
188f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
189f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// This is the default empty callback.
190f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    /// @return
191f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     The thread id for which the watchpoint hit will stop,
192f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    ///     LLDB_INVALID_THREAD_ID for all threads.
193f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
194f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    static bool
195f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    NullCallback (void *baton,
196f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen                  StoppointCallbackContext *context,
197f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen                  lldb::user_id_t watch_id);
198f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
199f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
200f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    struct CommandData
201f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    {
202f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        CommandData () :
203f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen            user_source(),
204f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen            script_source(),
205f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen            stop_on_error(true)
206f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        {
207f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        }
208f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
209f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        ~CommandData ()
210f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        {
211f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        }
212f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
213f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        StringList user_source;
214f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        std::string script_source;
215f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        bool stop_on_error;
216f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    };
217f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
218f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    class CommandBaton : public Baton
219f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    {
220f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    public:
221f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        CommandBaton (CommandData *data) :
222f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen            Baton (data)
223f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        {
224f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        }
225f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
226f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        virtual
227f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        ~CommandBaton ()
228f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        {
229f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen            delete ((CommandData *)m_data);
230f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen            m_data = NULL;
231f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        }
232f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
233f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        virtual void
234f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen        GetDescription (Stream *s, lldb::DescriptionLevel level) const;
235f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
236f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    };
237f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
238f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chenprotected:
239f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
240f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // Classes that inherit from WatchpointOptions can see and modify these
241f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
242f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
243f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chenprivate:
244f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
245f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    // For WatchpointOptions only
246f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    //------------------------------------------------------------------
247f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    WatchpointHitCallback m_callback; // This is the callback function pointer
248f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
249f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen    bool m_callback_is_synchronous;
250102b2c2681c9a830afe25bfea35557421905e42cGreg Clayton    std::unique_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this watchpoint will take
251f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen};
252f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
253f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen} // namespace lldb_private
254f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen
255f3ec4617297810223deb545cb68214ca4dd8009cJohnny Chen#endif  // liblldb_WatchpointOptions_h_
256