10b57cec5SDimitry Andric //===-- BreakpointOptions.h -------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 95ffd83dbSDimitry Andric #ifndef LLDB_BREAKPOINT_BREAKPOINTOPTIONS_H 105ffd83dbSDimitry Andric #define LLDB_BREAKPOINT_BREAKPOINTOPTIONS_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include <memory> 130b57cec5SDimitry Andric #include <string> 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric #include "lldb/Utility/Baton.h" 160b57cec5SDimitry Andric #include "lldb/Utility/Flags.h" 170b57cec5SDimitry Andric #include "lldb/Utility/StringList.h" 180b57cec5SDimitry Andric #include "lldb/Utility/StructuredData.h" 190b57cec5SDimitry Andric #include "lldb/lldb-private.h" 200b57cec5SDimitry Andric 210b57cec5SDimitry Andric namespace lldb_private { 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric /// \class BreakpointOptions BreakpointOptions.h 240b57cec5SDimitry Andric /// "lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a 250b57cec5SDimitry Andric /// breakpoint or breakpoint location. 260b57cec5SDimitry Andric 270b57cec5SDimitry Andric class BreakpointOptions { 280b57cec5SDimitry Andric friend class BreakpointLocation; 290b57cec5SDimitry Andric friend class BreakpointName; 300b57cec5SDimitry Andric friend class lldb_private::BreakpointOptionGroup; 310b57cec5SDimitry Andric friend class Breakpoint; 320b57cec5SDimitry Andric 330b57cec5SDimitry Andric public: 340b57cec5SDimitry Andric enum OptionKind { 350b57cec5SDimitry Andric eCallback = 1 << 0, 360b57cec5SDimitry Andric eEnabled = 1 << 1, 370b57cec5SDimitry Andric eOneShot = 1 << 2, 380b57cec5SDimitry Andric eIgnoreCount = 1 << 3, 390b57cec5SDimitry Andric eThreadSpec = 1 << 4, 400b57cec5SDimitry Andric eCondition = 1 << 5, 410b57cec5SDimitry Andric eAutoContinue = 1 << 6, 420b57cec5SDimitry Andric eAllOptions = (eCallback | eEnabled | eOneShot | eIgnoreCount | eThreadSpec 430b57cec5SDimitry Andric | eCondition | eAutoContinue) 440b57cec5SDimitry Andric }; 450b57cec5SDimitry Andric struct CommandData { 4681ad6265SDimitry Andric CommandData() = default; 470b57cec5SDimitry Andric CommandDataCommandData480b57cec5SDimitry Andric CommandData(const StringList &user_source, lldb::ScriptLanguage interp) 4904eeddc0SDimitry Andric : user_source(user_source), interpreter(interp), stop_on_error(true) {} 500b57cec5SDimitry Andric 51e8d8bef9SDimitry Andric virtual ~CommandData() = default; 520b57cec5SDimitry Andric GetSerializationKeyCommandData530b57cec5SDimitry Andric static const char *GetSerializationKey() { return "BKPTCMDData"; } 540b57cec5SDimitry Andric 550b57cec5SDimitry Andric StructuredData::ObjectSP SerializeToStructuredData(); 560b57cec5SDimitry Andric 570b57cec5SDimitry Andric static std::unique_ptr<CommandData> 580b57cec5SDimitry Andric CreateFromStructuredData(const StructuredData::Dictionary &options_dict, 590b57cec5SDimitry Andric Status &error); 600b57cec5SDimitry Andric 610b57cec5SDimitry Andric StringList user_source; 620b57cec5SDimitry Andric std::string script_source; 63fe6060f1SDimitry Andric enum lldb::ScriptLanguage interpreter = 64fe6060f1SDimitry Andric lldb::eScriptLanguageNone; // eScriptLanguageNone means command 65fe6060f1SDimitry Andric // interpreter. 66fe6060f1SDimitry Andric bool stop_on_error = true; 670b57cec5SDimitry Andric 680b57cec5SDimitry Andric private: 690b57cec5SDimitry Andric enum class OptionNames : uint32_t { 700b57cec5SDimitry Andric UserSource = 0, 710b57cec5SDimitry Andric Interpreter, 720b57cec5SDimitry Andric StopOnError, 730b57cec5SDimitry Andric LastOptionName 740b57cec5SDimitry Andric }; 750b57cec5SDimitry Andric 760b57cec5SDimitry Andric static const char 770b57cec5SDimitry Andric *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)]; 780b57cec5SDimitry Andric GetKeyCommandData790b57cec5SDimitry Andric static const char *GetKey(OptionNames enum_value) { 800b57cec5SDimitry Andric return g_option_names[static_cast<uint32_t>(enum_value)]; 810b57cec5SDimitry Andric } 820b57cec5SDimitry Andric }; 830b57cec5SDimitry Andric 840b57cec5SDimitry Andric class CommandBaton : public TypedBaton<CommandData> { 850b57cec5SDimitry Andric public: CommandBaton(std::unique_ptr<CommandData> Data)860b57cec5SDimitry Andric explicit CommandBaton(std::unique_ptr<CommandData> Data) 870b57cec5SDimitry Andric : TypedBaton(std::move(Data)) {} 880b57cec5SDimitry Andric 89480093f4SDimitry Andric void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level, 90480093f4SDimitry Andric unsigned indentation) const override; 910b57cec5SDimitry Andric }; 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric typedef std::shared_ptr<CommandBaton> CommandBatonSP; 940b57cec5SDimitry Andric 950b57cec5SDimitry Andric // Constructors and Destructors 960b57cec5SDimitry Andric 970b57cec5SDimitry Andric /// This constructor allows you to specify all the breakpoint options except 980b57cec5SDimitry Andric /// the callback. That one is more complicated, and better to do by hand. 990b57cec5SDimitry Andric /// 1000b57cec5SDimitry Andric /// \param[in] condition 1010b57cec5SDimitry Andric /// The expression which if it evaluates to \b true if we are to stop 1020b57cec5SDimitry Andric /// 1030b57cec5SDimitry Andric /// \param[in] enabled 1040b57cec5SDimitry Andric /// Is this breakpoint enabled. 1050b57cec5SDimitry Andric /// 1060b57cec5SDimitry Andric /// \param[in] ignore 1070b57cec5SDimitry Andric /// How many breakpoint hits we should ignore before stopping. 1080b57cec5SDimitry Andric /// 1099dba64beSDimitry Andric /// \param[in] one_shot 1109dba64beSDimitry Andric /// Should this breakpoint delete itself after being hit once. 1119dba64beSDimitry Andric /// 1129dba64beSDimitry Andric /// \param[in] auto_continue 1139dba64beSDimitry Andric /// Should this breakpoint auto-continue after running its commands. 1149dba64beSDimitry Andric /// 1150b57cec5SDimitry Andric BreakpointOptions(const char *condition, bool enabled = true, 1160b57cec5SDimitry Andric int32_t ignore = 0, bool one_shot = false, 1170b57cec5SDimitry Andric bool auto_continue = false); 1180b57cec5SDimitry Andric 1190b57cec5SDimitry Andric /// Breakpoints make options with all flags set. Locations and Names make 1200b57cec5SDimitry Andric /// options with no flags set. 1210b57cec5SDimitry Andric BreakpointOptions(bool all_flags_set); 1220b57cec5SDimitry Andric BreakpointOptions(const BreakpointOptions &rhs); 1230b57cec5SDimitry Andric 1240b57cec5SDimitry Andric virtual ~BreakpointOptions(); 1250b57cec5SDimitry Andric 1260b57cec5SDimitry Andric static std::unique_ptr<BreakpointOptions> 1270b57cec5SDimitry Andric CreateFromStructuredData(Target &target, 1280b57cec5SDimitry Andric const StructuredData::Dictionary &data_dict, 1290b57cec5SDimitry Andric Status &error); 1300b57cec5SDimitry Andric 1310b57cec5SDimitry Andric virtual StructuredData::ObjectSP SerializeToStructuredData(); 1320b57cec5SDimitry Andric GetSerializationKey()1330b57cec5SDimitry Andric static const char *GetSerializationKey() { return "BKPTOptions"; } 1340b57cec5SDimitry Andric 1350b57cec5SDimitry Andric // Operators 1360b57cec5SDimitry Andric const BreakpointOptions &operator=(const BreakpointOptions &rhs); 1370b57cec5SDimitry Andric 1380b57cec5SDimitry Andric /// Copy over only the options set in the incoming BreakpointOptions. 1390b57cec5SDimitry Andric void CopyOverSetOptions(const BreakpointOptions &rhs); 1400b57cec5SDimitry Andric 1410b57cec5SDimitry Andric // Callbacks 1420b57cec5SDimitry Andric // 1430b57cec5SDimitry Andric // Breakpoint callbacks come in two forms, synchronous and asynchronous. 1440b57cec5SDimitry Andric // Synchronous callbacks will get run before any of the thread plans are 1450b57cec5SDimitry Andric // consulted, and if they return false the target will continue "under the 1460b57cec5SDimitry Andric // radar" of the thread plans. There are a couple of restrictions to 1470b57cec5SDimitry Andric // synchronous callbacks: 1480b57cec5SDimitry Andric // 1) They should NOT resume the target themselves. 1490b57cec5SDimitry Andric // Just return false if you want the target to restart. 1500b57cec5SDimitry Andric // 2) Breakpoints with synchronous callbacks can't have conditions 1510b57cec5SDimitry Andric // (or rather, they can have them, but they won't do anything. 1520b57cec5SDimitry Andric // Ditto with ignore counts, etc... You are supposed to control that all 1530b57cec5SDimitry Andric // through the callback. 1540b57cec5SDimitry Andric // Asynchronous callbacks get run as part of the "ShouldStop" logic in the 1550b57cec5SDimitry Andric // thread plan. The logic there is: 1560b57cec5SDimitry Andric // a) If the breakpoint is thread specific and not for this thread, continue 1570b57cec5SDimitry Andric // w/o running the callback. 1580b57cec5SDimitry Andric // NB. This is actually enforced underneath the breakpoint system, the 1590b57cec5SDimitry Andric // Process plugin is expected to 1600b57cec5SDimitry Andric // call BreakpointSite::IsValidForThread, and set the thread's StopInfo 1610b57cec5SDimitry Andric // to "no reason". That way, 1620b57cec5SDimitry Andric // thread displays won't show stops for breakpoints not for that 1630b57cec5SDimitry Andric // thread... 1640b57cec5SDimitry Andric // b) If the ignore count says we shouldn't stop, then ditto. 1650b57cec5SDimitry Andric // c) If the condition says we shouldn't stop, then ditto. 1660b57cec5SDimitry Andric // d) Otherwise, the callback will get run, and if it returns true we will 1670b57cec5SDimitry Andric // stop, and if false we won't. 1680b57cec5SDimitry Andric // The asynchronous callback can run the target itself, but at present that 1690b57cec5SDimitry Andric // should be the last action the callback does. We will relax this condition 1700b57cec5SDimitry Andric // at some point, but it will take a bit of plumbing to get that to work. 1710b57cec5SDimitry Andric // 1720b57cec5SDimitry Andric 1730b57cec5SDimitry Andric /// Adds a callback to the breakpoint option set. 1740b57cec5SDimitry Andric /// 1750b57cec5SDimitry Andric /// \param[in] callback 1760b57cec5SDimitry Andric /// The function to be called when the breakpoint gets hit. 1770b57cec5SDimitry Andric /// 1780b57cec5SDimitry Andric /// \param[in] baton_sp 1790b57cec5SDimitry Andric /// A baton which will get passed back to the callback when it is invoked. 1800b57cec5SDimitry Andric /// 1810b57cec5SDimitry Andric /// \param[in] synchronous 1820b57cec5SDimitry Andric /// Whether this is a synchronous or asynchronous callback. See discussion 1830b57cec5SDimitry Andric /// above. 1840b57cec5SDimitry Andric void SetCallback(BreakpointHitCallback callback, 1850b57cec5SDimitry Andric const lldb::BatonSP &baton_sp, bool synchronous = false); 1860b57cec5SDimitry Andric 1870b57cec5SDimitry Andric void SetCallback(BreakpointHitCallback callback, 1880b57cec5SDimitry Andric const BreakpointOptions::CommandBatonSP &command_baton_sp, 1890b57cec5SDimitry Andric bool synchronous = false); 1900b57cec5SDimitry Andric 1910b57cec5SDimitry Andric /// Returns the command line commands for the callback on this breakpoint. 1920b57cec5SDimitry Andric /// 1930b57cec5SDimitry Andric /// \param[out] command_list 1940b57cec5SDimitry Andric /// The commands will be appended to this list. 1950b57cec5SDimitry Andric /// 1960b57cec5SDimitry Andric /// \return 1970b57cec5SDimitry Andric /// \b true if the command callback is a command-line callback, 1980b57cec5SDimitry Andric /// \b false otherwise. 1990b57cec5SDimitry Andric bool GetCommandLineCallbacks(StringList &command_list); 2000b57cec5SDimitry Andric 2010b57cec5SDimitry Andric /// Remove the callback from this option set. 2020b57cec5SDimitry Andric void ClearCallback(); 2030b57cec5SDimitry Andric 2040b57cec5SDimitry Andric // The rest of these functions are meant to be used only within the 2050b57cec5SDimitry Andric // breakpoint handling mechanism. 2060b57cec5SDimitry Andric 2070b57cec5SDimitry Andric /// Use this function to invoke the callback for a specific stop. 2080b57cec5SDimitry Andric /// 2090b57cec5SDimitry Andric /// \param[in] context 2100b57cec5SDimitry Andric /// The context in which the callback is to be invoked. This includes the 2110b57cec5SDimitry Andric /// stop event, the 2120b57cec5SDimitry Andric /// execution context of the stop (since you might hit the same breakpoint 2130b57cec5SDimitry Andric /// on multiple threads) and 2140b57cec5SDimitry Andric /// whether we are currently executing synchronous or asynchronous 2150b57cec5SDimitry Andric /// callbacks. 2160b57cec5SDimitry Andric /// 2170b57cec5SDimitry Andric /// \param[in] break_id 2180b57cec5SDimitry Andric /// The breakpoint ID that owns this option set. 2190b57cec5SDimitry Andric /// 2200b57cec5SDimitry Andric /// \param[in] break_loc_id 2210b57cec5SDimitry Andric /// The breakpoint location ID that owns this option set. 2220b57cec5SDimitry Andric /// 2230b57cec5SDimitry Andric /// \return 2240b57cec5SDimitry Andric /// The callback return value. 2250b57cec5SDimitry Andric bool InvokeCallback(StoppointCallbackContext *context, 2260b57cec5SDimitry Andric lldb::user_id_t break_id, lldb::user_id_t break_loc_id); 2270b57cec5SDimitry Andric 2280b57cec5SDimitry Andric /// Used in InvokeCallback to tell whether it is the right time to run this 2290b57cec5SDimitry Andric /// kind of callback. 2300b57cec5SDimitry Andric /// 2310b57cec5SDimitry Andric /// \return 2320b57cec5SDimitry Andric /// The synchronicity of our callback. IsCallbackSynchronous()2330b57cec5SDimitry Andric bool IsCallbackSynchronous() const { return m_callback_is_synchronous; } 2340b57cec5SDimitry Andric 2350b57cec5SDimitry Andric /// Fetch the baton from the callback. 2360b57cec5SDimitry Andric /// 2370b57cec5SDimitry Andric /// \return 2380b57cec5SDimitry Andric /// The baton. 2390b57cec5SDimitry Andric Baton *GetBaton(); 2400b57cec5SDimitry Andric 2410b57cec5SDimitry Andric /// Fetch a const version of the baton from the callback. 2420b57cec5SDimitry Andric /// 2430b57cec5SDimitry Andric /// \return 2440b57cec5SDimitry Andric /// The baton. 2450b57cec5SDimitry Andric const Baton *GetBaton() const; 2460b57cec5SDimitry Andric 2470b57cec5SDimitry Andric // Condition 2480b57cec5SDimitry Andric /// Set the breakpoint option's condition. 2490b57cec5SDimitry Andric /// 2500b57cec5SDimitry Andric /// \param[in] condition 2510b57cec5SDimitry Andric /// The condition expression to evaluate when the breakpoint is hit. 2520b57cec5SDimitry Andric void SetCondition(const char *condition); 2530b57cec5SDimitry Andric 2540b57cec5SDimitry Andric /// Return a pointer to the text of the condition expression. 2550b57cec5SDimitry Andric /// 2560b57cec5SDimitry Andric /// \return 2570b57cec5SDimitry Andric /// A pointer to the condition expression text, or nullptr if no 2580b57cec5SDimitry Andric // condition has been set. 2590b57cec5SDimitry Andric const char *GetConditionText(size_t *hash = nullptr) const; 2600b57cec5SDimitry Andric 2610b57cec5SDimitry Andric // Enabled/Ignore Count 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andric /// Check the Enable/Disable state. 2640b57cec5SDimitry Andric /// \return 2650b57cec5SDimitry Andric /// \b true if the breakpoint is enabled, \b false if disabled. IsEnabled()2660b57cec5SDimitry Andric bool IsEnabled() const { return m_enabled; } 2670b57cec5SDimitry Andric 2680b57cec5SDimitry Andric /// If \a enable is \b true, enable the breakpoint, if \b false disable it. SetEnabled(bool enabled)2690b57cec5SDimitry Andric void SetEnabled(bool enabled) { 2700b57cec5SDimitry Andric m_enabled = enabled; 2710b57cec5SDimitry Andric m_set_flags.Set(eEnabled); 2720b57cec5SDimitry Andric } 2730b57cec5SDimitry Andric 2740b57cec5SDimitry Andric /// Check the auto-continue state. 2750b57cec5SDimitry Andric /// \return 2760b57cec5SDimitry Andric /// \b true if the breakpoint is set to auto-continue, \b false otherwise. IsAutoContinue()2770b57cec5SDimitry Andric bool IsAutoContinue() const { return m_auto_continue; } 2780b57cec5SDimitry Andric 2790b57cec5SDimitry Andric /// Set the auto-continue state. SetAutoContinue(bool auto_continue)2800b57cec5SDimitry Andric void SetAutoContinue(bool auto_continue) { 2810b57cec5SDimitry Andric m_auto_continue = auto_continue; 2820b57cec5SDimitry Andric m_set_flags.Set(eAutoContinue); 2830b57cec5SDimitry Andric } 2840b57cec5SDimitry Andric 2850b57cec5SDimitry Andric /// Check the One-shot state. 2860b57cec5SDimitry Andric /// \return 2870b57cec5SDimitry Andric /// \b true if the breakpoint is one-shot, \b false otherwise. IsOneShot()2880b57cec5SDimitry Andric bool IsOneShot() const { return m_one_shot; } 2890b57cec5SDimitry Andric 2900b57cec5SDimitry Andric /// If \a enable is \b true, enable the breakpoint, if \b false disable it. SetOneShot(bool one_shot)2910b57cec5SDimitry Andric void SetOneShot(bool one_shot) { 2920b57cec5SDimitry Andric m_one_shot = one_shot; 2930b57cec5SDimitry Andric m_set_flags.Set(eOneShot); 2940b57cec5SDimitry Andric } 2950b57cec5SDimitry Andric 2960b57cec5SDimitry Andric /// Set the breakpoint to ignore the next \a count breakpoint hits. 297480093f4SDimitry Andric /// \param[in] n 2980b57cec5SDimitry Andric /// The number of breakpoint hits to ignore. SetIgnoreCount(uint32_t n)2990b57cec5SDimitry Andric void SetIgnoreCount(uint32_t n) { 3000b57cec5SDimitry Andric m_ignore_count = n; 3010b57cec5SDimitry Andric m_set_flags.Set(eIgnoreCount); 3020b57cec5SDimitry Andric } 3030b57cec5SDimitry Andric 3040b57cec5SDimitry Andric /// Return the current Ignore Count. 3050b57cec5SDimitry Andric /// \return 3060b57cec5SDimitry Andric /// The number of breakpoint hits to be ignored. GetIgnoreCount()3070b57cec5SDimitry Andric uint32_t GetIgnoreCount() const { return m_ignore_count; } 3080b57cec5SDimitry Andric 3090b57cec5SDimitry Andric /// Return the current thread spec for this option. This will return nullptr 3100b57cec5SDimitry Andric /// if the no thread specifications have been set for this Option yet. 3110b57cec5SDimitry Andric /// \return 3120b57cec5SDimitry Andric /// The thread specification pointer for this option, or nullptr if none 3130b57cec5SDimitry Andric /// has 3140b57cec5SDimitry Andric /// been set yet. 3150b57cec5SDimitry Andric const ThreadSpec *GetThreadSpecNoCreate() const; 3160b57cec5SDimitry Andric 3170b57cec5SDimitry Andric /// Returns a pointer to the ThreadSpec for this option, creating it. if it 3180b57cec5SDimitry Andric /// hasn't been created already. This API is used for setting the 3190b57cec5SDimitry Andric /// ThreadSpec items for this option. 3200b57cec5SDimitry Andric ThreadSpec *GetThreadSpec(); 3210b57cec5SDimitry Andric 3220b57cec5SDimitry Andric void SetThreadID(lldb::tid_t thread_id); 3230b57cec5SDimitry Andric 3240b57cec5SDimitry Andric void GetDescription(Stream *s, lldb::DescriptionLevel level) const; 3250b57cec5SDimitry Andric 3269dba64beSDimitry Andric /// Check if the breakpoint option has a callback set. 3279dba64beSDimitry Andric /// 3289dba64beSDimitry Andric /// \return 3299dba64beSDimitry Andric /// If the breakpoint option has a callback, \b true otherwise \b false. 3300b57cec5SDimitry Andric bool HasCallback() const; 3310b57cec5SDimitry Andric 3320b57cec5SDimitry Andric /// This is the default empty callback. 3330b57cec5SDimitry Andric static bool NullCallback(void *baton, StoppointCallbackContext *context, 3340b57cec5SDimitry Andric lldb::user_id_t break_id, 3350b57cec5SDimitry Andric lldb::user_id_t break_loc_id); 3360b57cec5SDimitry Andric 3370b57cec5SDimitry Andric /// Set a callback based on BreakpointOptions::CommandData. \param[in] 3380b57cec5SDimitry Andric /// cmd_data 3390b57cec5SDimitry Andric /// A UP holding the new'ed CommandData object. 3400b57cec5SDimitry Andric /// The breakpoint will take ownership of pointer held by this object. 3410b57cec5SDimitry Andric void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data); 3420b57cec5SDimitry Andric 3430b57cec5SDimitry Andric void Clear(); 3440b57cec5SDimitry Andric AnySet()3450b57cec5SDimitry Andric bool AnySet() const { 3460b57cec5SDimitry Andric return m_set_flags.AnySet(eAllOptions); 3470b57cec5SDimitry Andric } 3480b57cec5SDimitry Andric 3490b57cec5SDimitry Andric protected: 3500b57cec5SDimitry Andric // Classes that inherit from BreakpointOptions can see and modify these IsOptionSet(OptionKind kind)3510b57cec5SDimitry Andric bool IsOptionSet(OptionKind kind) 3520b57cec5SDimitry Andric { 3530b57cec5SDimitry Andric return m_set_flags.Test(kind); 3540b57cec5SDimitry Andric } 3550b57cec5SDimitry Andric 3560b57cec5SDimitry Andric enum class OptionNames { 3570b57cec5SDimitry Andric ConditionText = 0, 3580b57cec5SDimitry Andric IgnoreCount, 3590b57cec5SDimitry Andric EnabledState, 3600b57cec5SDimitry Andric OneShotState, 3610b57cec5SDimitry Andric AutoContinue, 3620b57cec5SDimitry Andric LastOptionName 3630b57cec5SDimitry Andric }; 3640b57cec5SDimitry Andric static const char *g_option_names[(size_t)OptionNames::LastOptionName]; 3650b57cec5SDimitry Andric GetKey(OptionNames enum_value)3660b57cec5SDimitry Andric static const char *GetKey(OptionNames enum_value) { 3670b57cec5SDimitry Andric return g_option_names[(size_t)enum_value]; 3680b57cec5SDimitry Andric } 3690b57cec5SDimitry Andric 3700b57cec5SDimitry Andric static bool BreakpointOptionsCallbackFunction( 3710b57cec5SDimitry Andric void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, 3720b57cec5SDimitry Andric lldb::user_id_t break_loc_id); 3730b57cec5SDimitry Andric 3740b57cec5SDimitry Andric void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up); 3750b57cec5SDimitry Andric 3760b57cec5SDimitry Andric private: 3779dba64beSDimitry Andric /// For BreakpointOptions only 3789dba64beSDimitry Andric 3799dba64beSDimitry Andric /// This is the callback function pointer 3809dba64beSDimitry Andric BreakpointHitCallback m_callback; 3819dba64beSDimitry Andric /// This is the client data for the callback 3829dba64beSDimitry Andric lldb::BatonSP m_callback_baton_sp; 3830b57cec5SDimitry Andric bool m_baton_is_command_baton; 3840b57cec5SDimitry Andric bool m_callback_is_synchronous; 3850b57cec5SDimitry Andric bool m_enabled; 3869dba64beSDimitry Andric /// If set, the breakpoint delete itself after being hit once. 3870b57cec5SDimitry Andric bool m_one_shot; 3889dba64beSDimitry Andric /// Number of times to ignore this breakpoint. 3899dba64beSDimitry Andric uint32_t m_ignore_count; 3909dba64beSDimitry Andric /// Thread for which this breakpoint will stop. 3919dba64beSDimitry Andric std::unique_ptr<ThreadSpec> m_thread_spec_up; 3929dba64beSDimitry Andric /// The condition to test. 3939dba64beSDimitry Andric std::string m_condition_text; 3949dba64beSDimitry Andric /// Its hash, so that locations know when the condition is updated. 3959dba64beSDimitry Andric size_t m_condition_text_hash; 3969dba64beSDimitry Andric /// If set, inject breakpoint condition into process. 3979dba64beSDimitry Andric bool m_inject_condition; 3989dba64beSDimitry Andric /// If set, auto-continue from breakpoint. 3999dba64beSDimitry Andric bool m_auto_continue; 4009dba64beSDimitry Andric /// Which options are set at this level. 4019dba64beSDimitry Andric /// Drawn from BreakpointOptions::SetOptionsFlags. 4029dba64beSDimitry Andric Flags m_set_flags; 4030b57cec5SDimitry Andric }; 4040b57cec5SDimitry Andric 4050b57cec5SDimitry Andric } // namespace lldb_private 4060b57cec5SDimitry Andric 4075ffd83dbSDimitry Andric #endif // LLDB_BREAKPOINT_BREAKPOINTOPTIONS_H 408