| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 1 | //===-- SBBreakpointName.cpp ----------------------------------------*- C++ -*-===// | 
|  | 2 | // | 
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | 
|  | 4 | // See https://llvm.org/LICENSE.txt for license information. | 
|  | 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 6 | // | 
|  | 7 | //===----------------------------------------------------------------------===// | 
|  | 8 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 9 | #include "lldb/API/SBBreakpointName.h" | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 10 | #include "SBReproducerPrivate.h" | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 11 | #include "lldb/API/SBDebugger.h" | 
|  | 12 | #include "lldb/API/SBError.h" | 
|  | 13 | #include "lldb/API/SBStream.h" | 
|  | 14 | #include "lldb/API/SBStringList.h" | 
|  | 15 | #include "lldb/API/SBTarget.h" | 
|  | 16 |  | 
|  | 17 | #include "lldb/Breakpoint/BreakpointName.h" | 
|  | 18 | #include "lldb/Breakpoint/StoppointCallbackContext.h" | 
|  | 19 | #include "lldb/Core/Debugger.h" | 
|  | 20 | #include "lldb/Interpreter/CommandInterpreter.h" | 
|  | 21 | #include "lldb/Interpreter/ScriptInterpreter.h" | 
|  | 22 | #include "lldb/Target/Target.h" | 
|  | 23 | #include "lldb/Target/ThreadSpec.h" | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 24 | #include "lldb/Utility/Stream.h" | 
|  | 25 |  | 
|  | 26 | #include "SBBreakpointOptionCommon.h" | 
|  | 27 |  | 
|  | 28 | using namespace lldb; | 
|  | 29 | using namespace lldb_private; | 
|  | 30 |  | 
|  | 31 | namespace lldb | 
|  | 32 | { | 
|  | 33 | class SBBreakpointNameImpl { | 
|  | 34 | public: | 
| Davide Italiano | c218ee5 | 2017-12-07 18:06:06 +0000 | [diff] [blame] | 35 | SBBreakpointNameImpl(TargetSP target_sp, const char *name) { | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 36 | if (!name || name[0] == '\0') | 
|  | 37 | return; | 
|  | 38 | m_name.assign(name); | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 39 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 40 | if (!target_sp) | 
|  | 41 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 42 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 43 | m_target_wp = target_sp; | 
|  | 44 | } | 
| Davide Italiano | c218ee5 | 2017-12-07 18:06:06 +0000 | [diff] [blame] | 45 |  | 
|  | 46 | SBBreakpointNameImpl(SBTarget &sb_target, const char *name); | 
|  | 47 | bool operator==(const SBBreakpointNameImpl &rhs); | 
|  | 48 | bool operator!=(const SBBreakpointNameImpl &rhs); | 
|  | 49 |  | 
| Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 50 | // For now we take a simple approach and only keep the name, and relook up | 
|  | 51 | // the location when we need it. | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 52 |  | 
| Jim Ingham | 576628b | 2017-09-15 17:54:37 +0000 | [diff] [blame] | 53 | TargetSP GetTarget() const { | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 54 | return m_target_wp.lock(); | 
|  | 55 | } | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 56 |  | 
| Jim Ingham | 576628b | 2017-09-15 17:54:37 +0000 | [diff] [blame] | 57 | const char *GetName() const { | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 58 | return m_name.c_str(); | 
|  | 59 | } | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 60 |  | 
| Jim Ingham | 576628b | 2017-09-15 17:54:37 +0000 | [diff] [blame] | 61 | bool IsValid() const { | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 62 | return !m_name.empty() && m_target_wp.lock(); | 
|  | 63 | } | 
| Davide Italiano | c218ee5 | 2017-12-07 18:06:06 +0000 | [diff] [blame] | 64 |  | 
|  | 65 | lldb_private::BreakpointName *GetBreakpointName() const; | 
|  | 66 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 67 | private: | 
|  | 68 | TargetWP m_target_wp; | 
|  | 69 | std::string m_name; | 
|  | 70 | }; | 
| Davide Italiano | c218ee5 | 2017-12-07 18:06:06 +0000 | [diff] [blame] | 71 |  | 
|  | 72 | SBBreakpointNameImpl::SBBreakpointNameImpl(SBTarget &sb_target, | 
|  | 73 | const char *name) { | 
|  | 74 | if (!name || name[0] == '\0') | 
|  | 75 | return; | 
|  | 76 | m_name.assign(name); | 
|  | 77 |  | 
|  | 78 | if (!sb_target.IsValid()) | 
|  | 79 | return; | 
|  | 80 |  | 
|  | 81 | TargetSP target_sp = sb_target.GetSP(); | 
|  | 82 | if (!target_sp) | 
|  | 83 | return; | 
|  | 84 |  | 
|  | 85 | m_target_wp = target_sp; | 
|  | 86 | } | 
|  | 87 |  | 
|  | 88 | bool SBBreakpointNameImpl::operator==(const SBBreakpointNameImpl &rhs) { | 
|  | 89 | return m_name == rhs.m_name && m_target_wp.lock() == rhs.m_target_wp.lock(); | 
|  | 90 | } | 
|  | 91 |  | 
|  | 92 | bool SBBreakpointNameImpl::operator!=(const SBBreakpointNameImpl &rhs) { | 
|  | 93 | return m_name != rhs.m_name || m_target_wp.lock() != rhs.m_target_wp.lock(); | 
|  | 94 | } | 
|  | 95 |  | 
|  | 96 | lldb_private::BreakpointName *SBBreakpointNameImpl::GetBreakpointName() const { | 
|  | 97 | if (!IsValid()) | 
|  | 98 | return nullptr; | 
|  | 99 | TargetSP target_sp = GetTarget(); | 
|  | 100 | if (!target_sp) | 
|  | 101 | return nullptr; | 
|  | 102 | Status error; | 
|  | 103 | return target_sp->FindBreakpointName(ConstString(m_name), true, error); | 
|  | 104 | } | 
|  | 105 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 106 | } // namespace lldb | 
|  | 107 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 108 | SBBreakpointName::SBBreakpointName() { | 
|  | 109 | LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBreakpointName); | 
|  | 110 | } | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 111 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 112 | SBBreakpointName::SBBreakpointName(SBTarget &sb_target, const char *name) { | 
|  | 113 | LLDB_RECORD_CONSTRUCTOR(SBBreakpointName, (lldb::SBTarget &, const char *), | 
|  | 114 | sb_target, name); | 
|  | 115 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 116 | m_impl_up.reset(new SBBreakpointNameImpl(sb_target, name)); | 
| Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 117 | // Call FindBreakpointName here to make sure the name is valid, reset if not: | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 118 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 119 | if (!bp_name) | 
|  | 120 | m_impl_up.reset(); | 
|  | 121 | } | 
|  | 122 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 123 | SBBreakpointName::SBBreakpointName(SBBreakpoint &sb_bkpt, const char *name) { | 
|  | 124 | LLDB_RECORD_CONSTRUCTOR(SBBreakpointName, | 
|  | 125 | (lldb::SBBreakpoint &, const char *), sb_bkpt, name); | 
|  | 126 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 127 | if (!sb_bkpt.IsValid()) { | 
|  | 128 | m_impl_up.reset(); | 
|  | 129 | return; | 
|  | 130 | } | 
|  | 131 | BreakpointSP bkpt_sp = sb_bkpt.GetSP(); | 
|  | 132 | Target &target = bkpt_sp->GetTarget(); | 
|  | 133 |  | 
|  | 134 | m_impl_up.reset(new SBBreakpointNameImpl(target.shared_from_this(), name)); | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 135 |  | 
| Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 136 | // Call FindBreakpointName here to make sure the name is valid, reset if not: | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 137 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 138 | if (!bp_name) { | 
|  | 139 | m_impl_up.reset(); | 
|  | 140 | return; | 
|  | 141 | } | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 142 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 143 | // Now copy over the breakpoint's options: | 
|  | 144 | target.ConfigureBreakpointName(*bp_name, *bkpt_sp->GetOptions(), | 
|  | 145 | BreakpointName::Permissions()); | 
|  | 146 | } | 
|  | 147 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 148 | SBBreakpointName::SBBreakpointName(const SBBreakpointName &rhs) { | 
|  | 149 | LLDB_RECORD_CONSTRUCTOR(SBBreakpointName, (const lldb::SBBreakpointName &), | 
|  | 150 | rhs); | 
|  | 151 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 152 | if (!rhs.m_impl_up) | 
|  | 153 | return; | 
|  | 154 | else | 
|  | 155 | m_impl_up.reset(new SBBreakpointNameImpl(rhs.m_impl_up->GetTarget(), | 
|  | 156 | rhs.m_impl_up->GetName())); | 
|  | 157 | } | 
|  | 158 |  | 
|  | 159 | SBBreakpointName::~SBBreakpointName() = default; | 
|  | 160 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 161 | const SBBreakpointName &SBBreakpointName:: | 
|  | 162 | operator=(const SBBreakpointName &rhs) { | 
|  | 163 | LLDB_RECORD_METHOD( | 
|  | 164 | const lldb::SBBreakpointName &, | 
|  | 165 | SBBreakpointName, operator=,(const lldb::SBBreakpointName &), rhs); | 
|  | 166 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 167 | if (!rhs.m_impl_up) { | 
|  | 168 | m_impl_up.reset(); | 
|  | 169 | return *this; | 
|  | 170 | } | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 171 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 172 | m_impl_up.reset(new SBBreakpointNameImpl(rhs.m_impl_up->GetTarget(), | 
|  | 173 | rhs.m_impl_up->GetName())); | 
|  | 174 | return *this; | 
|  | 175 | } | 
|  | 176 |  | 
|  | 177 | bool SBBreakpointName::operator==(const lldb::SBBreakpointName &rhs) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 178 | LLDB_RECORD_METHOD( | 
|  | 179 | bool, SBBreakpointName, operator==,(const lldb::SBBreakpointName &), rhs); | 
|  | 180 |  | 
| Jonas Devlieghere | 3447077 | 2018-12-20 21:02:55 +0000 | [diff] [blame] | 181 | return *m_impl_up == *rhs.m_impl_up; | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 182 | } | 
|  | 183 |  | 
|  | 184 | bool SBBreakpointName::operator!=(const lldb::SBBreakpointName &rhs) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 185 | LLDB_RECORD_METHOD( | 
|  | 186 | bool, SBBreakpointName, operator!=,(const lldb::SBBreakpointName &), rhs); | 
|  | 187 |  | 
| Jonas Devlieghere | 3447077 | 2018-12-20 21:02:55 +0000 | [diff] [blame] | 188 | return *m_impl_up != *rhs.m_impl_up; | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 189 | } | 
|  | 190 |  | 
|  | 191 | bool SBBreakpointName::IsValid() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 192 | LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpointName, IsValid); | 
| Pavel Labath | 7f5237b | 2019-03-11 13:58:46 +0000 | [diff] [blame^] | 193 | return this->operator bool(); | 
|  | 194 | } | 
|  | 195 | SBBreakpointName::operator bool() const { | 
|  | 196 | LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpointName, operator bool); | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 197 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 198 | if (!m_impl_up) | 
|  | 199 | return false; | 
|  | 200 | return m_impl_up->IsValid(); | 
|  | 201 | } | 
|  | 202 |  | 
|  | 203 | const char *SBBreakpointName::GetName() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 204 | LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpointName, GetName); | 
|  | 205 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 206 | if (!m_impl_up) | 
|  | 207 | return "<Invalid Breakpoint Name Object>"; | 
|  | 208 | return m_impl_up->GetName(); | 
|  | 209 | } | 
|  | 210 |  | 
|  | 211 | void SBBreakpointName::SetEnabled(bool enable) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 212 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetEnabled, (bool), enable); | 
|  | 213 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 214 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 215 | if (!bp_name) | 
|  | 216 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 217 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 218 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 219 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 220 |  | 
|  | 221 | bp_name->GetOptions().SetEnabled(enable); | 
|  | 222 | } | 
|  | 223 |  | 
|  | 224 | void SBBreakpointName::UpdateName(BreakpointName &bp_name) { | 
|  | 225 | if (!IsValid()) | 
|  | 226 | return; | 
|  | 227 |  | 
|  | 228 | TargetSP target_sp = m_impl_up->GetTarget(); | 
|  | 229 | if (!target_sp) | 
|  | 230 | return; | 
|  | 231 | target_sp->ApplyNameToBreakpoints(bp_name); | 
|  | 232 |  | 
|  | 233 | } | 
|  | 234 |  | 
|  | 235 | bool SBBreakpointName::IsEnabled() { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 236 | LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpointName, IsEnabled); | 
|  | 237 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 238 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 239 | if (!bp_name) | 
|  | 240 | return false; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 241 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 242 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 243 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 244 |  | 
|  | 245 | return bp_name->GetOptions().IsEnabled(); | 
|  | 246 | } | 
|  | 247 |  | 
|  | 248 | void SBBreakpointName::SetOneShot(bool one_shot) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 249 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetOneShot, (bool), one_shot); | 
|  | 250 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 251 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 252 | if (!bp_name) | 
|  | 253 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 254 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 255 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 256 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 257 |  | 
|  | 258 | bp_name->GetOptions().SetOneShot(one_shot); | 
|  | 259 | UpdateName(*bp_name); | 
|  | 260 | } | 
|  | 261 |  | 
|  | 262 | bool SBBreakpointName::IsOneShot() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 263 | LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpointName, IsOneShot); | 
|  | 264 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 265 | const BreakpointName *bp_name = GetBreakpointName(); | 
|  | 266 | if (!bp_name) | 
|  | 267 | return false; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 268 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 269 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 270 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 271 |  | 
|  | 272 | return bp_name->GetOptions().IsOneShot(); | 
|  | 273 | } | 
|  | 274 |  | 
|  | 275 | void SBBreakpointName::SetIgnoreCount(uint32_t count) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 276 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetIgnoreCount, (uint32_t), count); | 
|  | 277 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 278 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 279 | if (!bp_name) | 
|  | 280 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 281 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 282 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 283 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 284 |  | 
|  | 285 | bp_name->GetOptions().SetIgnoreCount(count); | 
|  | 286 | UpdateName(*bp_name); | 
|  | 287 | } | 
|  | 288 |  | 
|  | 289 | uint32_t SBBreakpointName::GetIgnoreCount() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 290 | LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpointName, GetIgnoreCount); | 
|  | 291 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 292 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 293 | if (!bp_name) | 
|  | 294 | return false; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 295 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 296 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 297 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 298 |  | 
|  | 299 | return bp_name->GetOptions().GetIgnoreCount(); | 
|  | 300 | } | 
|  | 301 |  | 
|  | 302 | void SBBreakpointName::SetCondition(const char *condition) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 303 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetCondition, (const char *), | 
|  | 304 | condition); | 
|  | 305 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 306 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 307 | if (!bp_name) | 
|  | 308 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 309 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 310 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 311 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 312 |  | 
|  | 313 | bp_name->GetOptions().SetCondition(condition); | 
|  | 314 | UpdateName(*bp_name); | 
|  | 315 | } | 
|  | 316 |  | 
|  | 317 | const char *SBBreakpointName::GetCondition() { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 318 | LLDB_RECORD_METHOD_NO_ARGS(const char *, SBBreakpointName, GetCondition); | 
|  | 319 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 320 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 321 | if (!bp_name) | 
|  | 322 | return nullptr; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 323 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 324 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 325 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 326 |  | 
|  | 327 | return bp_name->GetOptions().GetConditionText(); | 
|  | 328 | } | 
|  | 329 |  | 
|  | 330 | void SBBreakpointName::SetAutoContinue(bool auto_continue) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 331 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetAutoContinue, (bool), | 
|  | 332 | auto_continue); | 
|  | 333 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 334 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 335 | if (!bp_name) | 
|  | 336 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 337 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 338 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 339 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 340 |  | 
|  | 341 | bp_name->GetOptions().SetAutoContinue(auto_continue); | 
|  | 342 | UpdateName(*bp_name); | 
|  | 343 | } | 
|  | 344 |  | 
|  | 345 | bool SBBreakpointName::GetAutoContinue() { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 346 | LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpointName, GetAutoContinue); | 
|  | 347 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 348 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 349 | if (!bp_name) | 
| Jim Ingham | 576628b | 2017-09-15 17:54:37 +0000 | [diff] [blame] | 350 | return false; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 351 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 352 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 353 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 354 |  | 
|  | 355 | return bp_name->GetOptions().IsAutoContinue(); | 
|  | 356 | } | 
|  | 357 |  | 
|  | 358 | void SBBreakpointName::SetThreadID(tid_t tid) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 359 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetThreadID, (lldb::tid_t), tid); | 
|  | 360 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 361 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 362 | if (!bp_name) | 
|  | 363 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 364 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 365 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 366 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 367 |  | 
|  | 368 | bp_name->GetOptions().SetThreadID(tid); | 
|  | 369 | UpdateName(*bp_name); | 
|  | 370 | } | 
|  | 371 |  | 
|  | 372 | tid_t SBBreakpointName::GetThreadID() { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 373 | LLDB_RECORD_METHOD_NO_ARGS(lldb::tid_t, SBBreakpointName, GetThreadID); | 
|  | 374 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 375 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 376 | if (!bp_name) | 
|  | 377 | return LLDB_INVALID_THREAD_ID; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 378 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 379 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 380 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 381 |  | 
|  | 382 | return bp_name->GetOptions().GetThreadSpec()->GetTID(); | 
|  | 383 | } | 
|  | 384 |  | 
|  | 385 | void SBBreakpointName::SetThreadIndex(uint32_t index) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 386 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetThreadIndex, (uint32_t), index); | 
|  | 387 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 388 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 389 | if (!bp_name) | 
|  | 390 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 391 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 392 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 393 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 394 |  | 
|  | 395 | bp_name->GetOptions().GetThreadSpec()->SetIndex(index); | 
|  | 396 | UpdateName(*bp_name); | 
|  | 397 | } | 
|  | 398 |  | 
|  | 399 | uint32_t SBBreakpointName::GetThreadIndex() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 400 | LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBBreakpointName, GetThreadIndex); | 
|  | 401 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 402 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 403 | if (!bp_name) | 
|  | 404 | return LLDB_INVALID_THREAD_ID; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 405 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 406 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 407 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 408 |  | 
|  | 409 | return bp_name->GetOptions().GetThreadSpec()->GetIndex(); | 
|  | 410 | } | 
|  | 411 |  | 
|  | 412 | void SBBreakpointName::SetThreadName(const char *thread_name) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 413 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetThreadName, (const char *), | 
|  | 414 | thread_name); | 
|  | 415 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 416 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 417 | if (!bp_name) | 
|  | 418 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 419 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 420 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 421 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 422 |  | 
|  | 423 | bp_name->GetOptions().GetThreadSpec()->SetName(thread_name); | 
|  | 424 | UpdateName(*bp_name); | 
|  | 425 | } | 
|  | 426 |  | 
|  | 427 | const char *SBBreakpointName::GetThreadName() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 428 | LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpointName, | 
|  | 429 | GetThreadName); | 
|  | 430 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 431 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 432 | if (!bp_name) | 
|  | 433 | return nullptr; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 434 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 435 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 436 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 437 |  | 
|  | 438 | return bp_name->GetOptions().GetThreadSpec()->GetName(); | 
|  | 439 | } | 
|  | 440 |  | 
|  | 441 | void SBBreakpointName::SetQueueName(const char *queue_name) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 442 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetQueueName, (const char *), | 
|  | 443 | queue_name); | 
|  | 444 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 445 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 446 | if (!bp_name) | 
|  | 447 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 448 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 449 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 450 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 451 |  | 
|  | 452 | bp_name->GetOptions().GetThreadSpec()->SetQueueName(queue_name); | 
|  | 453 | UpdateName(*bp_name); | 
|  | 454 | } | 
|  | 455 |  | 
|  | 456 | const char *SBBreakpointName::GetQueueName() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 457 | LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpointName, | 
|  | 458 | GetQueueName); | 
|  | 459 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 460 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 461 | if (!bp_name) | 
|  | 462 | return nullptr; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 463 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 464 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 465 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 466 |  | 
|  | 467 | return bp_name->GetOptions().GetThreadSpec()->GetQueueName(); | 
|  | 468 | } | 
|  | 469 |  | 
|  | 470 | void SBBreakpointName::SetCommandLineCommands(SBStringList &commands) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 471 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetCommandLineCommands, | 
|  | 472 | (lldb::SBStringList &), commands); | 
|  | 473 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 474 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 475 | if (!bp_name) | 
|  | 476 | return; | 
|  | 477 | if (commands.GetSize() == 0) | 
|  | 478 | return; | 
|  | 479 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 480 |  | 
|  | 481 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 482 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 483 | std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up( | 
|  | 484 | new BreakpointOptions::CommandData(*commands, eScriptLanguageNone)); | 
|  | 485 |  | 
|  | 486 | bp_name->GetOptions().SetCommandDataCallback(cmd_data_up); | 
|  | 487 | UpdateName(*bp_name); | 
|  | 488 | } | 
|  | 489 |  | 
|  | 490 | bool SBBreakpointName::GetCommandLineCommands(SBStringList &commands) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 491 | LLDB_RECORD_METHOD(bool, SBBreakpointName, GetCommandLineCommands, | 
|  | 492 | (lldb::SBStringList &), commands); | 
|  | 493 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 494 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 495 | if (!bp_name) | 
|  | 496 | return false; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 497 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 498 | StringList command_list; | 
|  | 499 | bool has_commands = | 
|  | 500 | bp_name->GetOptions().GetCommandLineCallbacks(command_list); | 
|  | 501 | if (has_commands) | 
|  | 502 | commands.AppendList(command_list); | 
|  | 503 | return has_commands; | 
|  | 504 | } | 
|  | 505 |  | 
| Jim Ingham | e9632eb | 2017-09-15 00:52:35 +0000 | [diff] [blame] | 506 | const char *SBBreakpointName::GetHelpString() const { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 507 | LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBBreakpointName, | 
|  | 508 | GetHelpString); | 
|  | 509 |  | 
| Jim Ingham | e9632eb | 2017-09-15 00:52:35 +0000 | [diff] [blame] | 510 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 511 | if (!bp_name) | 
|  | 512 | return ""; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 513 |  | 
| Jim Ingham | e9632eb | 2017-09-15 00:52:35 +0000 | [diff] [blame] | 514 | return bp_name->GetHelp(); | 
|  | 515 | } | 
|  | 516 |  | 
|  | 517 | void SBBreakpointName::SetHelpString(const char *help_string) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 518 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetHelpString, (const char *), | 
|  | 519 | help_string); | 
|  | 520 |  | 
| Jim Ingham | e9632eb | 2017-09-15 00:52:35 +0000 | [diff] [blame] | 521 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 522 | if (!bp_name) | 
|  | 523 | return; | 
|  | 524 |  | 
| Jim Ingham | e9632eb | 2017-09-15 00:52:35 +0000 | [diff] [blame] | 525 |  | 
|  | 526 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 527 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 528 | bp_name->SetHelp(help_string); | 
|  | 529 | } | 
|  | 530 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 531 | bool SBBreakpointName::GetDescription(SBStream &s) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 532 | LLDB_RECORD_METHOD(bool, SBBreakpointName, GetDescription, (lldb::SBStream &), | 
|  | 533 | s); | 
|  | 534 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 535 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 536 | if (!bp_name) | 
|  | 537 | { | 
|  | 538 | s.Printf("No value"); | 
|  | 539 | return false; | 
|  | 540 | } | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 541 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 542 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 543 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 544 | bp_name->GetDescription(s.get(), eDescriptionLevelFull); | 
|  | 545 | return true; | 
|  | 546 | } | 
|  | 547 |  | 
|  | 548 | void SBBreakpointName::SetCallback(SBBreakpointHitCallback callback, | 
|  | 549 | void *baton) { | 
| Jonas Devlieghere | 0d7b0c9 | 2019-03-08 19:09:27 +0000 | [diff] [blame] | 550 | LLDB_RECORD_DUMMY(void, SBBreakpointName, SetCallback, | 
|  | 551 | (lldb::SBBreakpointHitCallback, void *), callback, baton); | 
|  | 552 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 553 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 554 | if (!bp_name) | 
|  | 555 | return; | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 556 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 557 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 558 |  | 
|  | 559 | BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton)); | 
|  | 560 | bp_name->GetOptions().SetCallback(SBBreakpointCallbackBaton | 
|  | 561 | ::PrivateBreakpointHitCallback, | 
|  | 562 | baton_sp, | 
|  | 563 | false); | 
|  | 564 | UpdateName(*bp_name); | 
|  | 565 | } | 
|  | 566 |  | 
|  | 567 | void SBBreakpointName::SetScriptCallbackFunction( | 
|  | 568 | const char *callback_function_name) { | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 569 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetScriptCallbackFunction, | 
|  | 570 | (const char *), callback_function_name); | 
|  | 571 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 572 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 573 | if (!bp_name) | 
|  | 574 | return; | 
| Jonas Devlieghere | 581af8b | 2019-03-07 22:47:13 +0000 | [diff] [blame] | 575 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 576 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 577 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 578 |  | 
|  | 579 | BreakpointOptions &bp_options = bp_name->GetOptions(); | 
|  | 580 | m_impl_up->GetTarget() | 
|  | 581 | ->GetDebugger() | 
|  | 582 | .GetCommandInterpreter() | 
|  | 583 | .GetScriptInterpreter() | 
|  | 584 | ->SetBreakpointCommandCallbackFunction(&bp_options, | 
|  | 585 | callback_function_name); | 
|  | 586 | UpdateName(*bp_name); | 
|  | 587 | } | 
|  | 588 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 589 | SBError | 
|  | 590 | SBBreakpointName::SetScriptCallbackBody(const char *callback_body_text) { | 
|  | 591 | LLDB_RECORD_METHOD(lldb::SBError, SBBreakpointName, SetScriptCallbackBody, | 
|  | 592 | (const char *), callback_body_text); | 
|  | 593 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 594 | SBError sb_error; | 
|  | 595 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 596 | if (!bp_name) | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 597 | return LLDB_RECORD_RESULT(sb_error); | 
|  | 598 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 599 | std::lock_guard<std::recursive_mutex> guard( | 
|  | 600 | m_impl_up->GetTarget()->GetAPIMutex()); | 
|  | 601 |  | 
|  | 602 | BreakpointOptions &bp_options = bp_name->GetOptions(); | 
|  | 603 | Status error = | 
|  | 604 | m_impl_up->GetTarget() | 
|  | 605 | ->GetDebugger() | 
|  | 606 | .GetCommandInterpreter() | 
|  | 607 | .GetScriptInterpreter() | 
|  | 608 | ->SetBreakpointCommandCallback(&bp_options, callback_body_text); | 
|  | 609 | sb_error.SetError(error); | 
|  | 610 | if (!sb_error.Fail()) | 
|  | 611 | UpdateName(*bp_name); | 
|  | 612 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 613 | return LLDB_RECORD_RESULT(sb_error); | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 614 | } | 
|  | 615 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 616 | bool SBBreakpointName::GetAllowList() const { | 
|  | 617 | LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBreakpointName, GetAllowList); | 
|  | 618 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 619 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 620 | if (!bp_name) | 
|  | 621 | return false; | 
|  | 622 | return bp_name->GetPermissions().GetAllowList(); | 
|  | 623 | } | 
|  | 624 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 625 | void SBBreakpointName::SetAllowList(bool value) { | 
|  | 626 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetAllowList, (bool), value); | 
|  | 627 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 628 |  | 
|  | 629 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 630 | if (!bp_name) | 
|  | 631 | return; | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 632 | bp_name->GetPermissions().SetAllowList(value); | 
|  | 633 | } | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 634 |  | 
|  | 635 | bool SBBreakpointName::GetAllowDelete() { | 
|  | 636 | LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpointName, GetAllowDelete); | 
|  | 637 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 638 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 639 | if (!bp_name) | 
|  | 640 | return false; | 
|  | 641 | return bp_name->GetPermissions().GetAllowDelete(); | 
|  | 642 | } | 
|  | 643 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 644 | void SBBreakpointName::SetAllowDelete(bool value) { | 
|  | 645 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetAllowDelete, (bool), value); | 
|  | 646 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 647 |  | 
|  | 648 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 649 | if (!bp_name) | 
|  | 650 | return; | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 651 | bp_name->GetPermissions().SetAllowDelete(value); | 
|  | 652 | } | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 653 |  | 
|  | 654 | bool SBBreakpointName::GetAllowDisable() { | 
|  | 655 | LLDB_RECORD_METHOD_NO_ARGS(bool, SBBreakpointName, GetAllowDisable); | 
|  | 656 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 657 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 658 | if (!bp_name) | 
|  | 659 | return false; | 
|  | 660 | return bp_name->GetPermissions().GetAllowDisable(); | 
|  | 661 | } | 
|  | 662 |  | 
| Jonas Devlieghere | baf5664 | 2019-03-06 00:06:00 +0000 | [diff] [blame] | 663 | void SBBreakpointName::SetAllowDisable(bool value) { | 
|  | 664 | LLDB_RECORD_METHOD(void, SBBreakpointName, SetAllowDisable, (bool), value); | 
|  | 665 |  | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 666 | BreakpointName *bp_name = GetBreakpointName(); | 
|  | 667 | if (!bp_name) | 
|  | 668 | return; | 
| Jim Ingham | b842f2e | 2017-09-14 20:22:49 +0000 | [diff] [blame] | 669 | bp_name->GetPermissions().SetAllowDisable(value); | 
|  | 670 | } | 
|  | 671 |  | 
|  | 672 | lldb_private::BreakpointName *SBBreakpointName::GetBreakpointName() const | 
|  | 673 | { | 
|  | 674 | if (!IsValid()) | 
|  | 675 | return nullptr; | 
|  | 676 | return m_impl_up->GetBreakpointName(); | 
|  | 677 | } | 
|  | 678 |  |