summaryrefslogtreecommitdiff
path: root/include/lldb/Breakpoint/BreakpointOptions.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
commit5f29bb8a675e8f96452b632e7129113f7dec850e (patch)
tree3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /include/lldb/Breakpoint/BreakpointOptions.h
parent88c643b6fec27eec436c8d138fee6346e92337d6 (diff)
Notes
Diffstat (limited to 'include/lldb/Breakpoint/BreakpointOptions.h')
-rw-r--r--include/lldb/Breakpoint/BreakpointOptions.h125
1 files changed, 29 insertions, 96 deletions
diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h
index e91df20ed305..cdac5d3dbd75 100644
--- a/include/lldb/Breakpoint/BreakpointOptions.h
+++ b/include/lldb/Breakpoint/BreakpointOptions.h
@@ -1,9 +1,8 @@
//===-- BreakpointOptions.h -------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -21,11 +20,9 @@
namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class BreakpointOptions BreakpointOptions.h
+/// \class BreakpointOptions BreakpointOptions.h
/// "lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a
/// breakpoint or breakpoint location.
-//----------------------------------------------------------------------
class BreakpointOptions {
friend class BreakpointLocation;
@@ -96,32 +93,26 @@ public:
typedef std::shared_ptr<CommandBaton> CommandBatonSP;
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// This constructor allows you to specify all the breakpoint options except
/// the callback. That one is more complicated, and better to do by hand.
///
- /// @param[in] condition
+ /// \param[in] condition
/// The expression which if it evaluates to \b true if we are to stop
///
- /// @param[in] enabled
+ /// \param[in] enabled
/// Is this breakpoint enabled.
///
- /// @param[in] ignore
+ /// \param[in] ignore
/// How many breakpoint hits we should ignore before stopping.
///
- //------------------------------------------------------------------
BreakpointOptions(const char *condition, bool enabled = true,
int32_t ignore = 0, bool one_shot = false,
bool auto_continue = false);
- //------------------------------------------------------------------
/// Breakpoints make options with all flags set. Locations and Names make
/// options with no flags set.
- //------------------------------------------------------------------
BreakpointOptions(bool all_flags_set);
BreakpointOptions(const BreakpointOptions &rhs);
@@ -136,17 +127,12 @@ public:
static const char *GetSerializationKey() { return "BKPTOptions"; }
- //------------------------------------------------------------------
// Operators
- //------------------------------------------------------------------
const BreakpointOptions &operator=(const BreakpointOptions &rhs);
- //------------------------------------------------------------------
/// Copy over only the options set in the incoming BreakpointOptions.
- //------------------------------------------------------------------
void CopyOverSetOptions(const BreakpointOptions &rhs);
- //------------------------------------------------------------------
// Callbacks
//
// Breakpoint callbacks come in two forms, synchronous and asynchronous.
@@ -178,21 +164,18 @@ public:
// should be the last action the callback does. We will relax this condition
// at some point, but it will take a bit of plumbing to get that to work.
//
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Adds a callback to the breakpoint option set.
///
- /// @param[in] callback
+ /// \param[in] callback
/// The function to be called when the breakpoint gets hit.
///
- /// @param[in] baton_sp
+ /// \param[in] baton_sp
/// A baton which will get passed back to the callback when it is invoked.
///
- /// @param[in] synchronous
+ /// \param[in] synchronous
/// Whether this is a synchronous or asynchronous callback. See discussion
/// above.
- //------------------------------------------------------------------
void SetCallback(BreakpointHitCallback callback,
const lldb::BatonSP &baton_sp, bool synchronous = false);
@@ -200,30 +183,25 @@ public:
const BreakpointOptions::CommandBatonSP &command_baton_sp,
bool synchronous = false);
- //------------------------------------------------------------------
/// Returns the command line commands for the callback on this breakpoint.
///
- /// @param[out] command_list
+ /// \param[out] command_list
/// The commands will be appended to this list.
///
- /// @return
+ /// \return
/// \btrue if the command callback is a command-line callback,
/// \bfalse otherwise.
- //------------------------------------------------------------------
bool GetCommandLineCallbacks(StringList &command_list);
- //------------------------------------------------------------------
/// Remove the callback from this option set.
- //------------------------------------------------------------------
void ClearCallback();
// The rest of these functions are meant to be used only within the
// breakpoint handling mechanism.
- //------------------------------------------------------------------
/// Use this function to invoke the callback for a specific stop.
///
- /// @param[in] context
+ /// \param[in] context
/// The context in which the callback is to be invoked. This includes the
/// stop event, the
/// execution context of the stop (since you might hit the same breakpoint
@@ -231,169 +209,128 @@ public:
/// whether we are currently executing synchronous or asynchronous
/// callbacks.
///
- /// @param[in] break_id
+ /// \param[in] break_id
/// The breakpoint ID that owns this option set.
///
- /// @param[in] break_loc_id
+ /// \param[in] break_loc_id
/// The breakpoint location ID that owns this option set.
///
- /// @return
+ /// \return
/// The callback return value.
- //------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context,
lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
- //------------------------------------------------------------------
/// Used in InvokeCallback to tell whether it is the right time to run this
/// kind of callback.
///
- /// @return
+ /// \return
/// The synchronicity of our callback.
- //------------------------------------------------------------------
bool IsCallbackSynchronous() const { return m_callback_is_synchronous; }
- //------------------------------------------------------------------
/// Fetch the baton from the callback.
///
- /// @return
+ /// \return
/// The baton.
- //------------------------------------------------------------------
Baton *GetBaton();
- //------------------------------------------------------------------
/// Fetch a const version of the baton from the callback.
///
- /// @return
+ /// \return
/// The baton.
- //------------------------------------------------------------------
const Baton *GetBaton() const;
- //------------------------------------------------------------------
// Condition
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Set the breakpoint option's condition.
///
- /// @param[in] condition
+ /// \param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
- //------------------------------------------------------------------
void SetCondition(const char *condition);
- //------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
- /// @return
+ /// \return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
- //------------------------------------------------------------------
const char *GetConditionText(size_t *hash = nullptr) const;
- //------------------------------------------------------------------
// Enabled/Ignore Count
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Check the Enable/Disable state.
- /// @return
+ /// \return
/// \b true if the breakpoint is enabled, \b false if disabled.
- //------------------------------------------------------------------
bool IsEnabled() const { return m_enabled; }
- //------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
- //------------------------------------------------------------------
void SetEnabled(bool enabled) {
m_enabled = enabled;
m_set_flags.Set(eEnabled);
}
- //------------------------------------------------------------------
/// Check the auto-continue state.
- /// @return
+ /// \return
/// \b true if the breakpoint is set to auto-continue, \b false otherwise.
- //------------------------------------------------------------------
bool IsAutoContinue() const { return m_auto_continue; }
- //------------------------------------------------------------------
/// Set the auto-continue state.
- //------------------------------------------------------------------
void SetAutoContinue(bool auto_continue) {
m_auto_continue = auto_continue;
m_set_flags.Set(eAutoContinue);
}
- //------------------------------------------------------------------
/// Check the One-shot state.
- /// @return
+ /// \return
/// \b true if the breakpoint is one-shot, \b false otherwise.
- //------------------------------------------------------------------
bool IsOneShot() const { return m_one_shot; }
- //------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
- //------------------------------------------------------------------
void SetOneShot(bool one_shot) {
m_one_shot = one_shot;
m_set_flags.Set(eOneShot);
}
- //------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
- /// @param[in] count
+ /// \param[in] count
/// The number of breakpoint hits to ignore.
- //------------------------------------------------------------------
void SetIgnoreCount(uint32_t n) {
m_ignore_count = n;
m_set_flags.Set(eIgnoreCount);
}
- //------------------------------------------------------------------
/// Return the current Ignore Count.
- /// @return
+ /// \return
/// The number of breakpoint hits to be ignored.
- //------------------------------------------------------------------
uint32_t GetIgnoreCount() const { return m_ignore_count; }
- //------------------------------------------------------------------
/// Return the current thread spec for this option. This will return nullptr
/// if the no thread specifications have been set for this Option yet.
- /// @return
+ /// \return
/// The thread specification pointer for this option, or nullptr if none
/// has
/// been set yet.
- //------------------------------------------------------------------
const ThreadSpec *GetThreadSpecNoCreate() const;
- //------------------------------------------------------------------
/// Returns a pointer to the ThreadSpec for this option, creating it. if it
/// hasn't been created already. This API is used for setting the
/// ThreadSpec items for this option.
- //------------------------------------------------------------------
ThreadSpec *GetThreadSpec();
void SetThreadID(lldb::tid_t thread_id);
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
- //------------------------------------------------------------------
/// Returns true if the breakpoint option has a callback set.
- //------------------------------------------------------------------
bool HasCallback() const;
- //------------------------------------------------------------------
/// This is the default empty callback.
- //------------------------------------------------------------------
static bool NullCallback(void *baton, StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
- //------------------------------------------------------------------
- /// Set a callback based on BreakpointOptions::CommandData. @param[in]
+ /// Set a callback based on BreakpointOptions::CommandData. \param[in]
/// cmd_data
/// A UP holding the new'ed CommandData object.
/// The breakpoint will take ownership of pointer held by this object.
- //------------------------------------------------------------------
void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data);
void Clear();
@@ -403,9 +340,7 @@ public:
}
protected:
-//------------------------------------------------------------------
// Classes that inherit from BreakpointOptions can see and modify these
- //------------------------------------------------------------------
bool IsOptionSet(OptionKind kind)
{
return m_set_flags.Test(kind);
@@ -432,9 +367,7 @@ protected:
void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
private:
- //------------------------------------------------------------------
// For BreakpointOptions only
- //------------------------------------------------------------------
BreakpointHitCallback m_callback; // This is the callback function pointer
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_baton_is_command_baton;
@@ -443,7 +376,7 @@ private:
bool m_one_shot;
uint32_t m_ignore_count; // Number of times to ignore this breakpoint
std::unique_ptr<ThreadSpec>
- m_thread_spec_ap; // Thread for which this breakpoint will take
+ m_thread_spec_up; // Thread for which this breakpoint will take
std::string m_condition_text; // The condition to test.
size_t m_condition_text_hash; // Its hash, so that locations know when the
// condition is updated.