LLDB mainline
CommandObjectBreakpointCommand.cpp
Go to the documentation of this file.
1//===-- CommandObjectBreakpointCommand.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
14#include "lldb/Core/IOHandler.h"
21#include "lldb/Target/Target.h"
22
23using namespace lldb;
24using namespace lldb_private;
25
26#define LLDB_OPTIONS_breakpoint_command_add
27#include "CommandOptions.inc"
28
31public:
33 : CommandObjectParsed(interpreter, "add",
34 "Add LLDB commands to a breakpoint, to be executed "
35 "whenever the breakpoint is hit. "
36 "The commands added to the breakpoint replace any "
37 "commands previously added to it."
38 " If no breakpoint is specified, adds the "
39 "commands to the last created breakpoint.",
40 nullptr, eCommandAllowsDummyTarget),
43 m_func_options("breakpoint command", false, 'F') {
45 R"(
46General information about entering breakpoint commands
47------------------------------------------------------
48
49)"
50 "This command will prompt for commands to be executed when the specified \
51breakpoint is hit. Each command is typed on its own line following the '> ' \
52prompt until 'DONE' is entered."
53 R"(
54
55)"
56 "Syntactic errors may not be detected when initially entered, and many \
57malformed commands can silently fail when executed. If your breakpoint commands \
58do not appear to be executing, double-check the command syntax."
59 R"(
60
61)"
62 "Note: You may enter any debugger command exactly as you would at the debugger \
63prompt. There is no limit to the number of commands supplied, but do NOT enter \
64more than one command per line."
65 R"(
66
67Special information about PYTHON breakpoint commands
68----------------------------------------------------
69
70)"
71 "You may enter either one or more lines of Python, including function \
72definitions or calls to functions that will have been imported by the time \
73the code executes. Single line breakpoint commands will be interpreted 'as is' \
74when the breakpoint is hit. Multiple lines of Python will be wrapped in a \
75generated function, and a call to the function will be attached to the breakpoint."
76 R"(
77
78This auto-generated function is passed in three arguments:
79
80 frame: an lldb.SBFrame object for the frame which hit breakpoint.
81
82 bp_loc: an lldb.SBBreakpointLocation object that represents the breakpoint location that was hit.
83
84 dict: the python session dictionary hit.
85
86)"
87 "When specifying a python function with the --python-function option, you need \
88to supply the function name prepended by the module name:"
89 R"(
90
91 --python-function myutils.breakpoint_callback
92
93The function itself must have either of the following prototypes:
94
95def breakpoint_callback(frame, bp_loc, internal_dict):
96 # Your code goes here
97
98or:
99
100def breakpoint_callback(frame, bp_loc, extra_args, internal_dict):
101 # Your code goes here
103)"
104 "The arguments are the same as the arguments passed to generated functions as \
105described above. In the second form, any -k and -v pairs provided to the command will \
106be packaged into a SBDictionary in an SBStructuredData and passed as the extra_args parameter. \
107\n\n\
108Note that the global variable 'lldb.frame' will NOT be updated when \
109this function is called, so be sure to use the 'frame' argument. The 'frame' argument \
110can get you to the thread via frame.GetThread(), the thread can get you to the \
111process via thread.GetProcess(), and the process can get you back to the target \
112via process.GetTarget()->"
113 R"(
114
115)"
116 "Important Note: As Python code gets collected into functions, access to global \
117variables requires explicit scoping using the 'global' keyword. Be sure to use correct \
118Python syntax, including indentation, when entering Python breakpoint commands."
119 R"(
120
121Example Python one-line breakpoint command:
122
123(lldb) breakpoint command add -s python 1
124Enter your Python command(s). Type 'DONE' to end.
125def function (frame, bp_loc, internal_dict):
126 """frame: the lldb.SBFrame for the location at which you stopped
127 bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information
128 internal_dict: an LLDB support object not to be used"""
129 print("Hit this breakpoint!")
130 DONE
131
132As a convenience, this also works for a short Python one-liner:
133
134(lldb) breakpoint command add -s python 1 -o 'import time; print(time.asctime())'
135(lldb) run
136Launching '.../a.out' (x86_64)
137(lldb) Fri Sep 10 12:17:45 2010
138Process 21778 Stopped
139* thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread
140 36
141 37 int c(int val)
142 38 {
143 39 -> return val + 3;
144 40 }
145 41
146 42 int main (int argc, char const *argv[])
147
148Example multiple line Python breakpoint command:
149
150(lldb) breakpoint command add -s p 1
151Enter your Python command(s). Type 'DONE' to end.
152def function (frame, bp_loc, internal_dict):
153 """frame: the lldb.SBFrame for the location at which you stopped
154 bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information
155 internal_dict: an LLDB support object not to be used"""
156 global bp_count
157 bp_count = bp_count + 1
158 print("Hit this breakpoint " + repr(bp_count) + " times!")
159 DONE
161)"
162 "In this case, since there is a reference to a global variable, \
163'bp_count', you will also need to make sure 'bp_count' exists and is \
164initialized:"
165 R"(
166
167(lldb) script
168>>> bp_count = 0
169>>> quit()
170
171)"
172 "Your Python code, however organized, can optionally return a value. \
173If the returned value is False, that tells LLDB not to stop at the breakpoint \
174to which the code is associated. Returning anything other than False, or even \
175returning None, or even omitting a return statement entirely, will cause \
176LLDB to stop."
177 R"(
178
179)"
180 "Final Note: A warning that no breakpoint command was generated when there \
181are no syntax errors may indicate that a function was declared but never called.");
182
183 m_all_options.Append(&m_options);
186 m_all_options.Finalize();
187
189 }
190
191 ~CommandObjectBreakpointCommandAdd() override = default;
192
193 Options *GetOptions() override { return &m_all_options; }
194
195 void IOHandlerActivated(IOHandler &io_handler, bool interactive) override {
196 if (interactive) {
197 if (lldb::LockableStreamFileSP output_sp =
198 io_handler.GetOutputStreamFileSP()) {
199 LockedStreamFile locked_stream = output_sp->Lock();
200 locked_stream.PutCString(g_reader_instructions);
201 }
202 }
203 }
204
205 void IOHandlerInputComplete(IOHandler &io_handler,
206 std::string &line) override {
207 io_handler.SetIsDone(true);
209 std::vector<std::reference_wrapper<BreakpointOptions>> *bp_options_vec =
210 (std::vector<std::reference_wrapper<BreakpointOptions>> *)
211 io_handler.GetUserData();
212 for (BreakpointOptions &bp_options : *bp_options_vec) {
213 auto cmd_data = std::make_unique<BreakpointOptions::CommandData>();
214 cmd_data->user_source.SplitIntoLines(line.c_str(), line.size());
215 bp_options.SetCommandDataCallback(cmd_data);
216 }
217 }
218
220 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
221 CommandReturnObject &result) {
222 m_interpreter.GetLLDBCommandsFromIOHandler(
223 "> ", // Prompt
224 *this, // IOHandlerDelegate
225 &bp_options_vec); // Baton for the "io_handler" that will be passed back
226 // into our IOHandlerDelegate functions
228
229 /// Set a one-liner as the callback for the breakpoint.
231 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
232 const char *oneliner) {
233 for (BreakpointOptions &bp_options : bp_options_vec) {
234 auto cmd_data = std::make_unique<BreakpointOptions::CommandData>();
235
236 cmd_data->user_source.AppendString(oneliner);
237 cmd_data->stop_on_error = m_options.m_stop_on_error;
238
239 bp_options.SetCommandDataCallback(cmd_data);
240 }
241 }
242
243 class CommandOptions : public OptionGroup {
244 public:
245 CommandOptions() = default;
246
247 ~CommandOptions() override = default;
248
249 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
250 ExecutionContext *execution_context) override {
252 const int short_option =
253 g_breakpoint_command_add_options[option_idx].short_option;
254
255 switch (short_option) {
256 case 'o':
257 m_use_one_liner = true;
258 m_one_liner = std::string(option_arg);
259 break;
260
261 case 's':
263 option_arg,
264 g_breakpoint_command_add_options[option_idx].enum_values,
266 switch (m_script_language) {
270 break;
273 m_use_script_language = false;
274 break;
275 }
276 break;
277
278 case 'e': {
279 bool success = false;
281 OptionArgParser::ToBoolean(option_arg, false, &success);
282 if (!success)
284 "invalid value for stop-on-error: \"{0}\"", option_arg);
285 } break;
286
287 case 'D':
288 m_use_dummy = true;
289 break;
290
291 default:
292 llvm_unreachable("Unimplemented option");
293 }
294 return error;
295 }
296
297 void OptionParsingStarting(ExecutionContext *execution_context) override {
298 m_use_commands = true;
299 m_use_script_language = false;
301
302 m_use_one_liner = false;
303 m_stop_on_error = true;
304 m_one_liner.clear();
305 m_use_dummy = false;
306 }
307
308 llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
309 return llvm::ArrayRef(g_breakpoint_command_add_options);
310 }
311
312 // Instance variables to hold the values for command options.
313
314 bool m_use_commands = false;
315 bool m_use_script_language = false;
317
318 // Instance variables to hold the values for one_liner options.
319 bool m_use_one_liner = false;
320 std::string m_one_liner;
321 bool m_stop_on_error;
322 bool m_use_dummy;
323 };
324
325protected:
326 void DoExecute(Args &command, CommandReturnObject &result) override {
327 Target *target = m_options.m_use_dummy ? &GetDummyTarget() : GetTarget();
329 const BreakpointList &breakpoints = target->GetBreakpointList();
330 size_t num_breakpoints = breakpoints.GetSize();
332 if (num_breakpoints == 0) {
333 result.AppendError("No breakpoints exist to have commands added");
334 return;
335 }
336
337 if (!m_func_options.GetName().empty()) {
338 m_options.m_use_one_liner = false;
339 if (!m_options.m_use_script_language) {
340 m_options.m_script_language = GetDebugger().GetScriptLanguage();
341 m_options.m_use_script_language = true;
342 }
344
345 BreakpointIDList valid_bp_ids;
347 command, target, result, &valid_bp_ids,
349
350 m_bp_options_vec.clear();
351
352 if (result.Succeeded()) {
353 const size_t count = valid_bp_ids.GetSize();
354
355 for (size_t i = 0; i < count; ++i) {
356 BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
357 if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
358 Breakpoint *bp =
359 target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
360 if (cur_bp_id.GetLocationID() == LLDB_INVALID_BREAK_ID) {
361 // This breakpoint does not have an associated location.
362 m_bp_options_vec.push_back(bp->GetOptions());
363 } else {
364 BreakpointLocationSP bp_loc_sp(
365 bp->FindLocationByID(cur_bp_id.GetLocationID()));
366 // This breakpoint does have an associated location. Get its
367 // breakpoint options.
368 if (bp_loc_sp)
369 m_bp_options_vec.push_back(bp_loc_sp->GetLocationOptions());
370 }
371 }
372 }
373
374 // If we are using script language, get the script interpreter in order
375 // to set or collect command callback. Otherwise, call the methods
376 // associated with this object.
377 if (m_options.m_use_script_language) {
378 ScriptInterpreter *script_interp = GetDebugger().GetScriptInterpreter(
379 /*can_create=*/true, m_options.m_script_language);
380 if (!m_options.m_use_one_liner && m_func_options.GetName().empty()) {
382 m_bp_options_vec, result);
383 // Still gathering input; the IOHandler will set the final status.
384 if (result.GetStatus() != eReturnStatusFailed)
386 return;
387 }
388 llvm::Error error =
389 m_options.m_use_one_liner
390 ? script_interp->SetBreakpointCommandCallback(
391 m_bp_options_vec, m_options.m_one_liner.c_str())
393 m_bp_options_vec, m_func_options.GetName().c_str(),
394 m_func_options.GetStructuredData());
395 if (error)
396 result.SetError(std::move(error));
397 else
399 } else {
400 // Special handling for one-liner specified inline.
401 if (m_options.m_use_one_liner) {
403 m_options.m_one_liner.c_str());
405 } else {
407 // Still gathering input; the IOHandler will set the final status.
409 }
410 }
411 }
412 }
413
414private:
415 CommandOptions m_options;
416 OptionGroupPythonClassWithDict m_func_options;
417 OptionGroupOptions m_all_options;
418
419 std::vector<std::reference_wrapper<BreakpointOptions>>
420 m_bp_options_vec; // This stores the
421 // breakpoint options that
422 // we are currently
423 // collecting commands for. In the CollectData... calls we need to hand this
424 // off to the IOHandler, which may run asynchronously. So we have to have
425 // some way to keep it alive, and not leak it. Making it an ivar of the
426 // command object, which never goes away achieves this. Note that if we were
427 // able to run the same command concurrently in one interpreter we'd have to
428 // make this "per invocation". But there are many more reasons why it is not
429 // in general safe to do that in lldb at present, so it isn't worthwhile to
430 // come up with a more complex mechanism to address this particular weakness
431 // right now.
432 static const char *g_reader_instructions;
433};
434
436 "Enter your debugger command(s). Type 'DONE' to end.\n";
437
438// CommandObjectBreakpointCommandDelete
439
440#define LLDB_OPTIONS_breakpoint_command_delete
441#include "CommandOptions.inc"
442
444public:
446 : CommandObjectParsed(interpreter, "delete",
447 "Delete the set of commands from a breakpoint.",
448 nullptr, eCommandAllowsDummyTarget) {
450 }
451
453
454 Options *GetOptions() override { return &m_options; }
455
456 class CommandOptions : public Options {
457 public:
458 CommandOptions() = default;
459
460 ~CommandOptions() override = default;
461
462 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
463 ExecutionContext *execution_context) override {
465 const int short_option = m_getopt_table[option_idx].val;
466
467 switch (short_option) {
468 case 'D':
469 m_use_dummy = true;
470 break;
471
472 default:
473 llvm_unreachable("Unimplemented option");
474 }
475
476 return error;
477 }
478
479 void OptionParsingStarting(ExecutionContext *execution_context) override {
480 m_use_dummy = false;
481 }
482
483 llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
484 return llvm::ArrayRef(g_breakpoint_command_delete_options);
485 }
486
487 // Instance variables to hold the values for command options.
488 bool m_use_dummy = false;
489 };
490
491protected:
492 void DoExecute(Args &command, CommandReturnObject &result) override {
493 Target *target = m_options.m_use_dummy ? &GetDummyTarget() : GetTarget();
494
495 const BreakpointList &breakpoints = target->GetBreakpointList();
496 size_t num_breakpoints = breakpoints.GetSize();
497
498 if (num_breakpoints == 0) {
499 result.AppendError("No breakpoints exist to have commands deleted");
500 return;
501 }
502
503 if (command.empty()) {
504 result.AppendError(
505 "No breakpoint specified from which to delete the commands");
506 return;
507 }
508
509 BreakpointIDList valid_bp_ids;
511 command, target, result, &valid_bp_ids,
513
514 if (result.Succeeded()) {
515 const size_t count = valid_bp_ids.GetSize();
516 for (size_t i = 0; i < count; ++i) {
517 BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
518 if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
519 Breakpoint *bp =
520 target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
521 if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
522 BreakpointLocationSP bp_loc_sp(
523 bp->FindLocationByID(cur_bp_id.GetLocationID()));
524 if (bp_loc_sp)
525 bp_loc_sp->ClearCallback();
526 else {
527 result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u",
528 cur_bp_id.GetBreakpointID(),
529 cur_bp_id.GetLocationID());
530 return;
531 }
532 } else {
533 bp->ClearCallback();
534 }
535 }
536 }
537 }
538 }
539
540private:
542};
543
544// CommandObjectBreakpointCommandList
545
547public:
549 : CommandObjectParsed(interpreter, "list",
550 "List the script or set of commands to be "
551 "executed when the breakpoint is hit.",
552 nullptr, eCommandRequiresTarget) {
554 }
555
557
558protected:
559 void DoExecute(Args &command, CommandReturnObject &result) override {
560 Target *target = GetTarget();
561 assert(target && "target guaranteed by eCommandRequiresTarget");
562 const BreakpointList &breakpoints = target->GetBreakpointList();
563 size_t num_breakpoints = breakpoints.GetSize();
564
565 if (num_breakpoints == 0) {
566 result.AppendError("No breakpoints exist for which to list commands");
567 return;
568 }
569
570 if (command.empty()) {
571 result.AppendError(
572 "No breakpoint specified for which to list the commands");
573 return;
574 }
575
576 BreakpointIDList valid_bp_ids;
578 command, m_exe_ctx, result, &valid_bp_ids,
580
581 if (result.Succeeded()) {
582 const size_t count = valid_bp_ids.GetSize();
583 for (size_t i = 0; i < count; ++i) {
584 BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
585 if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
586 Breakpoint *bp =
587 target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
588
589 if (bp) {
590 BreakpointLocationSP bp_loc_sp;
591 if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
592 bp_loc_sp = bp->FindLocationByID(cur_bp_id.GetLocationID());
593 if (!bp_loc_sp) {
594 result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u",
595 cur_bp_id.GetBreakpointID(),
596 cur_bp_id.GetLocationID());
597 return;
598 }
599 }
600
601 StreamString id_str;
603 cur_bp_id.GetBreakpointID(),
604 cur_bp_id.GetLocationID());
605 const Baton *baton = nullptr;
606 if (bp_loc_sp)
607 baton =
608 bp_loc_sp
609 ->GetOptionsSpecifyingKind(BreakpointOptions::eCallback)
610 .GetBaton();
611 else
612 baton = bp->GetOptions().GetBaton();
613
614 if (baton) {
615 result.GetOutputStream().Printf("Breakpoint %s:\n",
616 id_str.GetData());
620 2);
621 } else {
623 "Breakpoint {0} does not have an associated command.",
624 id_str.GetData());
625 }
626 }
628 } else {
629 result.AppendErrorWithFormat("Invalid breakpoint ID: %u",
630 cur_bp_id.GetBreakpointID());
631 }
632 }
633 }
634 }
635};
636
637// CommandObjectBreakpointCommand
638
640 CommandInterpreter &interpreter)
642 interpreter, "command",
643 "Commands for adding, removing and listing "
644 "LLDB commands executed when a breakpoint is "
645 "hit.",
646 "command <sub-command> [<sub-command-options>] <breakpoint-id>") {
647 CommandObjectSP add_command_object(
648 new CommandObjectBreakpointCommandAdd(interpreter));
649 CommandObjectSP delete_command_object(
650 new CommandObjectBreakpointCommandDelete(interpreter));
651 CommandObjectSP list_command_object(
652 new CommandObjectBreakpointCommandList(interpreter));
653
654 add_command_object->SetCommandName("breakpoint command add");
655 delete_command_object->SetCommandName("breakpoint command delete");
656 list_command_object->SetCommandName("breakpoint command list");
657
658 LoadSubCommand("add", add_command_object);
659 LoadSubCommand("delete", delete_command_object);
660 LoadSubCommand("list", list_command_object);
661}
662
static llvm::raw_ostream & error(Stream &strm)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void CollectDataForBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, CommandReturnObject &result)
CommandObjectBreakpointCommandAdd(CommandInterpreter &interpreter)
void SetBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *oneliner)
Set a one-liner as the callback for the breakpoint.
~CommandObjectBreakpointCommandAdd() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
void IOHandlerInputComplete(IOHandler &io_handler, std::string &line) override
Called when a line or lines have been retrieved.
void IOHandlerActivated(IOHandler &io_handler, bool interactive) override
std::vector< std::reference_wrapper< BreakpointOptions > > m_bp_options_vec
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandObjectBreakpointCommandDelete() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointCommandDelete(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointCommandList() override=default
CommandObjectBreakpointCommandList(CommandInterpreter &interpreter)
A command line argument class.
Definition Args.h:33
bool empty() const
Definition Args.h:122
A class designed to wrap callback batons so they can cleanup any acquired resources.
Definition Baton.h:35
virtual void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level, unsigned indentation) const =0
BreakpointID GetBreakpointIDAtIndex(size_t index) const
lldb::break_id_t GetBreakpointID() const
lldb::break_id_t GetLocationID() const
static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
Takes a breakpoint ID and the breakpoint location id and returns a string containing the canonical de...
General Outline: Allows adding and removing breakpoints and find by ID and index.
size_t GetSize() const
Returns the number of elements in this breakpoint list.
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
Baton * GetBaton()
Fetch the baton from the callback.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition Breakpoint.h:83
lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id, bool use_facade=true)
Find a breakpoint location for a given breakpoint location ID.
BreakpointOptions & GetOptions()
Returns the BreakpointOptions structure set at the breakpoint level.
static void VerifyBreakpointOrLocationIDs(Args &args, const ExecutionContext &exe_ctx, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions ::PermissionKinds purpose)
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
CommandObjectMultiword(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
virtual void SetHelpLong(llvm::StringRef str)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
CommandInterpreter & m_interpreter
Target * GetTarget()
Get the target this command should operate on.
void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void void AppendMessageWithFormatv(const char *format, Args &&...args)
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
IOHandlerDelegateMultiline(llvm::StringRef end_line, Completion completion=Completion::None)
Definition IOHandler.h:289
A delegate class for use with IOHandler subclasses.
Definition IOHandler.h:184
lldb::LockableStreamFileSP GetOutputStreamFileSP()
Definition IOHandler.cpp:93
void SetIsDone(bool b)
Definition IOHandler.h:81
A command line option parsing protocol class.
Definition Options.h:58
std::vector< Option > m_getopt_table
Definition Options.h:198
virtual void CollectDataForBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &options, CommandReturnObject &result)
llvm::Error SetBreakpointCommandCallbackFunction(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *function_name, StructuredData::ObjectSP extra_args_sp)
llvm::Error SetBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *callback_text)
Set the specified text as the callback for the breakpoint.
An error handling class.
Definition Status.h:118
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition Status.h:151
const char * GetData() const
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition Stream.h:405
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:63
unsigned GetIndentLevel() const
Get the current indentation level.
Definition Stream.cpp:193
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition Target.cpp:457
BreakpointList & GetBreakpointList(bool internal=false)
Definition Target.cpp:443
#define LLDB_OPT_SET_2
#define LLDB_INVALID_BREAK_ID
#define LLDB_OPT_SET_3
A class that represents a running process on the host machine.
ScriptLanguage
Script interpreter types.
@ eScriptLanguageUnknown
@ eScriptLanguageNone
@ eScriptLanguagePython
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
@ eDescriptionLevelFull
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
@ eReturnStatusStarted
@ eReturnStatusFailed
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeBreakpointID
std::shared_ptr< lldb_private::LockableStreamFile > LockableStreamFileSP
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)