LLDB mainline
BreakpointOptions.cpp
Go to the documentation of this file.
1//===-- BreakpointOptions.cpp ---------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
10
12#include "lldb/Core/Value.h"
15#include "lldb/Target/Process.h"
16#include "lldb/Target/Target.h"
18#include "lldb/Utility/Stream.h"
20
21#include "llvm/ADT/STLExtras.h"
22
23using namespace lldb;
24using namespace lldb_private;
25
26const char
28 BreakpointOptions::CommandData::OptionNames::LastOptionName)]{
29 "UserSource", "ScriptSource", "StopOnError"};
30
33 size_t num_strings = user_source.GetSize();
34 if (num_strings == 0 && script_source.empty()) {
35 // We shouldn't serialize commands if there aren't any, return an empty sp
36 // to indicate this.
38 }
39
40 StructuredData::DictionarySP options_dict_sp(
42 options_dict_sp->AddBooleanItem(GetKey(OptionNames::StopOnError),
44
46 for (size_t i = 0; i < num_strings; i++) {
49 user_source_sp->AddItem(item_sp);
50 options_dict_sp->AddItem(GetKey(OptionNames::UserSource), user_source_sp);
51 }
52
53 options_dict_sp->AddStringItem(
56 return options_dict_sp;
57}
58
59std::unique_ptr<BreakpointOptions::CommandData>
61 const StructuredData::Dictionary &options_dict, Status &error) {
62 std::unique_ptr<CommandData> data_up(new CommandData());
63
64 bool success = options_dict.GetValueForKeyAsBoolean(
65 GetKey(OptionNames::StopOnError), data_up->stop_on_error);
66
67 llvm::StringRef interpreter_str;
68 ScriptLanguage interp_language;
69 success = options_dict.GetValueForKeyAsString(
70 GetKey(OptionNames::Interpreter), interpreter_str);
71
72 if (!success) {
73 error.SetErrorString("Missing command language value.");
74 return data_up;
75 }
76
77 interp_language = ScriptInterpreter::StringToLanguage(interpreter_str);
78 if (interp_language == eScriptLanguageUnknown) {
79 error.SetErrorStringWithFormatv("Unknown breakpoint command language: {0}.",
80 interpreter_str);
81 return data_up;
82 }
83 data_up->interpreter = interp_language;
84
85 StructuredData::Array *user_source;
86 success = options_dict.GetValueForKeyAsArray(GetKey(OptionNames::UserSource),
87 user_source);
88 if (success) {
89 size_t num_elems = user_source->GetSize();
90 for (size_t i = 0; i < num_elems; i++) {
91 llvm::StringRef elem_string;
92 success = user_source->GetItemAtIndexAsString(i, elem_string);
93 if (success)
94 data_up->user_source.AppendString(elem_string);
95 }
96 }
97
98 return data_up;
99}
100
103 "ConditionText", "IgnoreCount",
104 "EnabledState", "OneShotState", "AutoContinue"};
105
108 lldb::user_id_t break_id,
109 lldb::user_id_t break_loc_id) {
110 return true;
111}
112
113// BreakpointOptions constructor
117 m_enabled(true), m_one_shot(false), m_ignore_count(0),
119 m_auto_continue(false), m_set_flags(0) {
120 if (all_flags_set)
122}
123
124BreakpointOptions::BreakpointOptions(const char *condition, bool enabled,
125 int32_t ignore, bool one_shot,
126 bool auto_continue)
127 : m_callback(nullptr), m_baton_is_command_baton(false),
128 m_callback_is_synchronous(false), m_enabled(enabled),
129 m_one_shot(one_shot), m_ignore_count(ignore), m_condition_text_hash(0),
130 m_inject_condition(false), m_auto_continue(auto_continue) {
132 if (condition && *condition != '\0') {
133 SetCondition(condition);
134 }
135}
136
137// BreakpointOptions copy constructor
139 : m_callback(rhs.m_callback), m_callback_baton_sp(rhs.m_callback_baton_sp),
140 m_baton_is_command_baton(rhs.m_baton_is_command_baton),
141 m_callback_is_synchronous(rhs.m_callback_is_synchronous),
142 m_enabled(rhs.m_enabled), m_one_shot(rhs.m_one_shot),
143 m_ignore_count(rhs.m_ignore_count), m_inject_condition(false),
144 m_auto_continue(rhs.m_auto_continue), m_set_flags(rhs.m_set_flags) {
145 if (rhs.m_thread_spec_up != nullptr)
146 m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
149}
150
151// BreakpointOptions assignment operator
153operator=(const BreakpointOptions &rhs) {
158 m_enabled = rhs.m_enabled;
161 if (rhs.m_thread_spec_up != nullptr)
162 m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
168 return *this;
169}
170
172{
173 if (incoming.m_set_flags.Test(eEnabled))
174 {
175 m_enabled = incoming.m_enabled;
177 }
178 if (incoming.m_set_flags.Test(eOneShot))
179 {
180 m_one_shot = incoming.m_one_shot;
182 }
183 if (incoming.m_set_flags.Test(eCallback))
184 {
185 m_callback = incoming.m_callback;
190 }
191 if (incoming.m_set_flags.Test(eIgnoreCount))
192 {
195 }
196 if (incoming.m_set_flags.Test(eCondition))
197 {
198 // If we're copying over an empty condition, mark it as unset.
199 if (incoming.m_condition_text.empty()) {
200 m_condition_text.clear();
203 } else {
207 }
208 }
209 if (incoming.m_set_flags.Test(eAutoContinue))
210 {
213 }
214 if (incoming.m_set_flags.Test(eThreadSpec) && incoming.m_thread_spec_up) {
215 if (!m_thread_spec_up)
217 std::make_unique<ThreadSpec>(*incoming.m_thread_spec_up);
218 else
221 }
222}
223
224// Destructor
226
227std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
228 Target &target, const StructuredData::Dictionary &options_dict,
229 Status &error) {
230 bool enabled = true;
231 bool one_shot = false;
232 bool auto_continue = false;
233 uint32_t ignore_count = 0;
234 llvm::StringRef condition_ref("");
235 Flags set_options;
236
237 const char *key = GetKey(OptionNames::EnabledState);
238 bool success;
239 if (key && options_dict.HasKey(key)) {
240 success = options_dict.GetValueForKeyAsBoolean(key, enabled);
241 if (!success) {
242 error.SetErrorStringWithFormat("%s key is not a boolean.", key);
243 return nullptr;
244 }
245 set_options.Set(eEnabled);
246 }
247
249 if (key && options_dict.HasKey(key)) {
250 success = options_dict.GetValueForKeyAsBoolean(key, one_shot);
251 if (!success) {
252 error.SetErrorStringWithFormat("%s key is not a boolean.", key);
253 return nullptr;
254 }
255 set_options.Set(eOneShot);
256 }
257
259 if (key && options_dict.HasKey(key)) {
260 success = options_dict.GetValueForKeyAsBoolean(key, auto_continue);
261 if (!success) {
262 error.SetErrorStringWithFormat("%s key is not a boolean.", key);
263 return nullptr;
264 }
265 set_options.Set(eAutoContinue);
266 }
267
269 if (key && options_dict.HasKey(key)) {
270 success = options_dict.GetValueForKeyAsInteger(key, ignore_count);
271 if (!success) {
272 error.SetErrorStringWithFormat("%s key is not an integer.", key);
273 return nullptr;
274 }
275 set_options.Set(eIgnoreCount);
276 }
277
279 if (key && options_dict.HasKey(key)) {
280 success = options_dict.GetValueForKeyAsString(key, condition_ref);
281 if (!success) {
282 error.SetErrorStringWithFormat("%s key is not an string.", key);
283 return nullptr;
284 }
285 set_options.Set(eCondition);
286 }
287
288 std::unique_ptr<CommandData> cmd_data_up;
290 success = options_dict.GetValueForKeyAsDictionary(
292 if (success && cmds_dict) {
293 Status cmds_error;
294 cmd_data_up = CommandData::CreateFromStructuredData(*cmds_dict, cmds_error);
295 if (cmds_error.Fail()) {
296 error.SetErrorStringWithFormat(
297 "Failed to deserialize breakpoint command options: %s.",
298 cmds_error.AsCString());
299 return nullptr;
300 }
301 }
302
303 auto bp_options = std::make_unique<BreakpointOptions>(
304 condition_ref.str().c_str(), enabled,
305 ignore_count, one_shot, auto_continue);
306 if (cmd_data_up) {
307 if (cmd_data_up->interpreter == eScriptLanguageNone)
308 bp_options->SetCommandDataCallback(cmd_data_up);
309 else {
311 if (!interp) {
312 error.SetErrorString(
313 "Can't set script commands - no script interpreter");
314 return nullptr;
315 }
316 if (interp->GetLanguage() != cmd_data_up->interpreter) {
317 error.SetErrorStringWithFormat(
318 "Current script language doesn't match breakpoint's language: %s",
319 ScriptInterpreter::LanguageToString(cmd_data_up->interpreter)
320 .c_str());
321 return nullptr;
322 }
323 Status script_error;
324 script_error =
325 interp->SetBreakpointCommandCallback(*bp_options, cmd_data_up);
326 if (script_error.Fail()) {
327 error.SetErrorStringWithFormat("Error generating script callback: %s.",
328 error.AsCString());
329 return nullptr;
330 }
331 }
332 }
333
334 StructuredData::Dictionary *thread_spec_dict;
335 success = options_dict.GetValueForKeyAsDictionary(
336 ThreadSpec::GetSerializationKey(), thread_spec_dict);
337 if (success) {
338 Status thread_spec_error;
339 std::unique_ptr<ThreadSpec> thread_spec_up =
340 ThreadSpec::CreateFromStructuredData(*thread_spec_dict,
341 thread_spec_error);
342 if (thread_spec_error.Fail()) {
343 error.SetErrorStringWithFormat(
344 "Failed to deserialize breakpoint thread spec options: %s.",
345 thread_spec_error.AsCString());
346 return nullptr;
347 }
348 bp_options->SetThreadSpec(thread_spec_up);
349 }
350 return bp_options;
351}
352
354 StructuredData::DictionarySP options_dict_sp(
357 options_dict_sp->AddBooleanItem(GetKey(OptionNames::EnabledState),
358 m_enabled);
360 options_dict_sp->AddBooleanItem(GetKey(OptionNames::OneShotState),
361 m_one_shot);
363 options_dict_sp->AddBooleanItem(GetKey(OptionNames::AutoContinue),
366 options_dict_sp->AddIntegerItem(GetKey(OptionNames::IgnoreCount),
369 options_dict_sp->AddStringItem(GetKey(OptionNames::ConditionText),
371
373 auto cmd_baton =
374 std::static_pointer_cast<CommandBaton>(m_callback_baton_sp);
375 StructuredData::ObjectSP commands_sp =
376 cmd_baton->getItem()->SerializeToStructuredData();
377 if (commands_sp) {
378 options_dict_sp->AddItem(
380 }
381 }
383 StructuredData::ObjectSP thread_spec_sp =
384 m_thread_spec_up->SerializeToStructuredData();
385 options_dict_sp->AddItem(ThreadSpec::GetSerializationKey(), thread_spec_sp);
386 }
387
388 return options_dict_sp;
389}
390
391// Callbacks
393 const lldb::BatonSP &callback_baton_sp,
394 bool callback_is_synchronous) {
395 // FIXME: This seems unsafe. If BatonSP actually *is* a CommandBaton, but
396 // in a shared_ptr<Baton> instead of a shared_ptr<CommandBaton>, then we will
397 // set m_baton_is_command_baton to false, which is incorrect. One possible
398 // solution is to make the base Baton class provide a method such as:
399 // virtual StringRef getBatonId() const { return ""; }
400 // and have CommandBaton override this to return something unique, and then
401 // check for it here. Another option might be to make Baton using the llvm
402 // casting infrastructure, so that we could write something like:
403 // if (llvm::isa<CommandBaton>(callback_baton_sp))
404 // at relevant callsites instead of storing a boolean.
405 m_callback_is_synchronous = callback_is_synchronous;
406 m_callback = callback;
407 m_callback_baton_sp = callback_baton_sp;
410}
411
413 BreakpointHitCallback callback,
414 const BreakpointOptions::CommandBatonSP &callback_baton_sp,
415 bool callback_is_synchronous) {
416 m_callback_is_synchronous = callback_is_synchronous;
417 m_callback = callback;
418 m_callback_baton_sp = callback_baton_sp;
421}
422
426 m_callback_baton_sp.reset();
429}
430
432
434 return m_callback_baton_sp.get();
435}
436
438 lldb::user_id_t break_id,
439 lldb::user_id_t break_loc_id) {
440 if (m_callback) {
441 if (context->is_synchronous == IsCallbackSynchronous()) {
443 : nullptr,
444 context, break_id, break_loc_id);
445 } else if (IsCallbackSynchronous()) {
446 return false;
447 }
448 }
449 return true;
450}
451
454}
455
457 if (!HasCallback())
458 return false;
460 return false;
461
462 auto cmd_baton = std::static_pointer_cast<CommandBaton>(m_callback_baton_sp);
463 CommandData *data = cmd_baton->getItem();
464 if (!data)
465 return false;
466 command_list = data->user_source;
467 return true;
468}
469
470void BreakpointOptions::SetCondition(const char *condition) {
471 if (!condition || condition[0] == '\0') {
472 condition = "";
474 }
475 else
477
478 m_condition_text.assign(condition);
479 std::hash<std::string> hasher;
481}
482
483const char *BreakpointOptions::GetConditionText(size_t *hash) const {
484 if (!m_condition_text.empty()) {
485 if (hash)
486 *hash = m_condition_text_hash;
487
488 return m_condition_text.c_str();
489 } else {
490 return nullptr;
491 }
492}
493
495 return m_thread_spec_up.get();
496}
497
499 if (m_thread_spec_up == nullptr) {
501 m_thread_spec_up = std::make_unique<ThreadSpec>();
502 }
503
504 return m_thread_spec_up.get();
505}
506
508 GetThreadSpec()->SetTID(thread_id);
510}
511
513 std::unique_ptr<ThreadSpec> &thread_spec_up) {
514 m_thread_spec_up = std::move(thread_spec_up);
516}
517
519 lldb::DescriptionLevel level) const {
520 // Figure out if there are any options not at their default value, and only
521 // print anything if there are:
522
524 (GetThreadSpecNoCreate() != nullptr &&
525 GetThreadSpecNoCreate()->HasSpecification())) {
526 if (level == lldb::eDescriptionLevelVerbose) {
527 s->EOL();
528 s->IndentMore();
529 s->Indent();
530 s->PutCString("Breakpoint Options:\n");
531 s->IndentMore();
532 s->Indent();
533 } else
534 s->PutCString(" Options: ");
535
536 if (m_ignore_count > 0)
537 s->Printf("ignore: %d ", m_ignore_count);
538 s->Printf("%sabled ", m_enabled ? "en" : "dis");
539
540 if (m_one_shot)
541 s->Printf("one-shot ");
542
543 if (m_auto_continue)
544 s->Printf("auto-continue ");
545
547 m_thread_spec_up->GetDescription(s, level);
548
549 if (level == lldb::eDescriptionLevelFull) {
550 s->IndentLess();
551 s->IndentMore();
552 }
553 }
554
555 if (m_callback_baton_sp.get()) {
556 if (level != eDescriptionLevelBrief) {
557 s->EOL();
558 m_callback_baton_sp->GetDescription(s->AsRawOstream(), level,
559 s->GetIndentLevel());
560 }
561 }
562 if (!m_condition_text.empty()) {
563 if (level != eDescriptionLevelBrief) {
564 s->EOL();
565 s->Printf("Condition: %s\n", m_condition_text.c_str());
566 }
567 }
568}
569
571 llvm::raw_ostream &s, lldb::DescriptionLevel level,
572 unsigned indentation) const {
573 const CommandData *data = getItem();
574
575 if (level == eDescriptionLevelBrief) {
576 s << ", commands = "
577 << ((data && data->user_source.GetSize() > 0) ? "yes" : "no");
578 return;
579 }
580
581 indentation += 2;
582 s.indent(indentation);
583 s << "Breakpoint commands";
584 if (data->interpreter != eScriptLanguageNone)
585 s << llvm::formatv(" ({0}):\n",
587 else
588 s << ":\n";
589
590 indentation += 2;
591 if (data && data->user_source.GetSize() > 0) {
592 for (llvm::StringRef str : data->user_source) {
593 s.indent(indentation);
594 s << str << "\n";
595 }
596 } else
597 s << "No commands.\n";
598}
599
601 std::unique_ptr<CommandData> &cmd_data) {
602 cmd_data->interpreter = eScriptLanguageNone;
603 auto baton_sp = std::make_shared<CommandBaton>(std::move(cmd_data));
606}
607
609 void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
610 lldb::user_id_t break_loc_id) {
611 bool ret_value = true;
612 if (baton == nullptr)
613 return true;
614
615 CommandData *data = (CommandData *)baton;
616 StringList &commands = data->user_source;
617
618 if (commands.GetSize() > 0) {
619 ExecutionContext exe_ctx(context->exe_ctx_ref);
620 Target *target = exe_ctx.GetTargetPtr();
621 if (target) {
622 Debugger &debugger = target->GetDebugger();
623 CommandReturnObject result(debugger.GetUseColor());
624
625 // Rig up the results secondary output stream to the debugger's, so the
626 // output will come out synchronously if the debugger is set up that way.
627 StreamSP output_stream(debugger.GetAsyncOutputStream());
628 StreamSP error_stream(debugger.GetAsyncErrorStream());
629 result.SetImmediateOutputStream(output_stream);
630 result.SetImmediateErrorStream(error_stream);
631
633 options.SetStopOnContinue(true);
634 options.SetStopOnError(data->stop_on_error);
635 options.SetEchoCommands(true);
636 options.SetPrintResults(true);
637 options.SetPrintErrors(true);
638 options.SetAddToHistory(false);
639
640 debugger.GetCommandInterpreter().HandleCommands(commands, exe_ctx,
641 options, result);
642 result.GetImmediateOutputStream()->Flush();
643 result.GetImmediateErrorStream()->Flush();
644 }
645 }
646 return ret_value;
647}
648
650{
652 m_thread_spec_up.release();
653 m_one_shot = false;
654 m_ignore_count = 0;
655 m_auto_continue = false;
656 m_callback = nullptr;
657 m_callback_baton_sp.reset();
660 m_enabled = false;
661 m_condition_text.clear();
662}
static llvm::raw_ostream & error(Stream &strm)
A class designed to wrap callback batons so they can cleanup any acquired resources.
Definition: Baton.h:35
void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level, unsigned indentation) const override
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
bool IsCallbackSynchronous() const
Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
bool InvokeCallback(StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Use this function to invoke the callback for a specific stop.
void ClearCallback()
Remove the callback from this option set.
Flags m_set_flags
Which options are set at this level.
void SetCondition(const char *condition)
Set the breakpoint option's condition.
bool GetCommandLineCallbacks(StringList &command_list)
Returns the command line commands for the callback on this breakpoint.
std::shared_ptr< CommandBaton > CommandBatonSP
static const char * GetKey(OptionNames enum_value)
Baton * GetBaton()
Fetch the baton from the callback.
static bool BreakpointOptionsCallbackFunction(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
virtual StructuredData::ObjectSP SerializeToStructuredData()
void GetDescription(Stream *s, lldb::DescriptionLevel level) const
bool m_one_shot
If set, the breakpoint delete itself after being hit once.
static const char * g_option_names[(size_t) OptionNames::LastOptionName]
lldb::BatonSP m_callback_baton_sp
This is the client data for the callback.
ThreadSpec * GetThreadSpec()
Returns a pointer to the ThreadSpec for this option, creating it.
const ThreadSpec * GetThreadSpecNoCreate() const
Return the current thread spec for this option.
std::unique_ptr< ThreadSpec > m_thread_spec_up
Thread for which this breakpoint will stop.
BreakpointHitCallback m_callback
For BreakpointOptions only.
bool m_inject_condition
If set, inject breakpoint condition into process.
std::string m_condition_text
The condition to test.
bool m_auto_continue
If set, auto-continue from breakpoint.
static std::unique_ptr< BreakpointOptions > CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, Status &error)
uint32_t m_ignore_count
Number of times to ignore this breakpoint.
void SetThreadID(lldb::tid_t thread_id)
void CopyOverSetOptions(const BreakpointOptions &rhs)
Copy over only the options set in the incoming BreakpointOptions.
BreakpointOptions(const char *condition, bool enabled=true, int32_t ignore=0, bool one_shot=false, bool auto_continue=false)
This constructor allows you to specify all the breakpoint options except the callback.
size_t m_condition_text_hash
Its hash, so that locations know when the condition is updated.
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
bool HasCallback() const
Check if the breakpoint option has a callback set.
static bool NullCallback(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
This is the default empty callback.
const BreakpointOptions & operator=(const BreakpointOptions &rhs)
void SetCommandDataCallback(std::unique_ptr< CommandData > &cmd_data)
Set a callback based on BreakpointOptions::CommandData.
void SetThreadSpec(std::unique_ptr< ThreadSpec > &thread_spec_up)
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
Adds a callback to the breakpoint option set.
void SetStopOnContinue(bool stop_on_continue)
void HandleCommands(const StringList &commands, const ExecutionContext &context, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
Execute a list of commands in sequence.
void SetImmediateErrorStream(const lldb::StreamSP &stream_sp)
void SetImmediateOutputStream(const lldb::StreamSP &stream_sp)
A class to manage flag bits.
Definition: Debugger.h:79
lldb::StreamSP GetAsyncOutputStream()
Definition: Debugger.cpp:1263
CommandInterpreter & GetCommandInterpreter()
Definition: Debugger.h:175
bool GetUseColor() const
Definition: Debugger.cpp:402
lldb::StreamSP GetAsyncErrorStream()
Definition: Debugger.cpp:1267
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
Definition: Debugger.cpp:1632
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Target * GetTargetPtr() const
Returns a pointer to the target object.
A class to manage flags.
Definition: Flags.h:22
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
Definition: Flags.h:61
uint32_t ValueType
The value type for flags is a 32 bit unsigned integer type.
Definition: Flags.h:25
bool Test(ValueType bit) const
Test a single flag bit.
Definition: Flags.h:96
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Definition: Flags.h:73
static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string)
Status SetBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *callback_text)
Set the specified text as the callback for the breakpoint.
static std::string LanguageToString(lldb::ScriptLanguage language)
lldb::ScriptLanguage GetLanguage()
An error handling class.
Definition: Status.h:44
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:357
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:130
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:128
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition: Stream.cpp:171
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Definition: Stream.cpp:168
unsigned GetIndentLevel() const
Get the current indentation level.
Definition: Stream.cpp:160
size_t GetSize() const
Definition: StringList.cpp:74
bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result) const
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const
bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result) const
bool GetValueForKeyAsBoolean(llvm::StringRef key, bool &result) const
bool HasKey(llvm::StringRef key) const
bool GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
bool GetValueForKeyAsDictionary(llvm::StringRef key, Dictionary *&result) const
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
std::shared_ptr< String > StringSP
std::shared_ptr< Array > ArraySP
Debugger & GetDebugger()
Definition: Target.h:1050
void SetTID(lldb::tid_t tid)
Definition: ThreadSpec.h:47
static const char * GetSerializationKey()
Definition: ThreadSpec.h:43
static std::unique_ptr< ThreadSpec > CreateFromStructuredData(const StructuredData::Dictionary &data_dict, Status &error)
Definition: ThreadSpec.cpp:22
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
bool(* BreakpointHitCallback)(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Definition: SBAddress.h:15
ScriptLanguage
Script interpreter types.
@ eScriptLanguageUnknown
@ eScriptLanguageNone
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelBrief
@ eDescriptionLevelFull
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Stream > StreamSP
Definition: lldb-forward.h:407
std::shared_ptr< lldb_private::Baton > BatonSP
Definition: lldb-forward.h:301
uint64_t user_id_t
Definition: lldb-types.h:80
uint64_t tid_t
Definition: lldb-types.h:82
static std::unique_ptr< CommandData > CreateFromStructuredData(const StructuredData::Dictionary &options_dict, Status &error)
StructuredData::ObjectSP SerializeToStructuredData()
static const char * GetKey(OptionNames enum_value)
static const char * g_option_names[static_cast< uint32_t >(OptionNames::LastOptionName)]