31#include "llvm/Support/FormatAdapters.h"
52 if (
auto maybe_file_and_line =
54 file = maybe_file_and_line->support_file_nsp->GetSpecOnly();
58 if (cur_frame ==
nullptr) {
59 result.
AppendError(
"No selected frame to use to find the default file.");
63 result.
AppendError(
"Cannot use the selected frame to find the default "
64 "file, it has no debug info.");
73 result.
AppendError(
"Can't find the file for the selected frame to "
74 "use as the default file.");
81#pragma mark Modify::CommandOptions
82#define LLDB_OPTIONS_breakpoint_modify
83#include "CommandOptions.inc"
92 return llvm::ArrayRef(g_breakpoint_modify_options);
98 const int short_option =
99 g_breakpoint_modify_options[option_idx].short_option;
100 const char *long_option =
101 g_breakpoint_modify_options[option_idx].long_option;
103 switch (short_option) {
107 m_bp_opts.GetCondition().SetText(option_arg.str());
111 m_commands.push_back(std::string(option_arg));
130 uint32_t ignore_count;
131 if (option_arg.getAsInteger(0, ignore_count))
150 if (option_arg ==
"current") {
151 if (!execution_context) {
153 option_arg, short_option, long_option,
154 "No context to determine current thread"));
157 if (!ctx_thread_sp || !ctx_thread_sp->IsValid()) {
160 "No currently selected thread"));
162 thread_id = ctx_thread_sp->GetID();
165 }
else if (option_arg.getAsInteger(0, thread_id)) {
174 m_bp_opts.GetThreadSpec()->SetName(option_arg.str().c_str());
177 m_bp_opts.GetThreadSpec()->SetQueueName(option_arg.str().c_str());
181 if (option_arg.getAsInteger(0, thread_index)) {
186 m_bp_opts.GetThreadSpec()->SetIndex(thread_index);
196 option_arg, short_option, long_option,
"invalid language"));
197 else if (!languages_for_expressions[language])
200 "no expression support for language"));
202 m_bp_opts.GetCondition().SetLanguage(language);
205 auto condition_mode =
209 m_bp_opts.GetCondition().SetMode(condition_mode);
212 llvm_unreachable(
"Unimplemented option");
225 auto cmd_data = std::make_unique<BreakpointOptions::CommandData>();
228 cmd_data->user_source.AppendString(str);
230 cmd_data->stop_on_error =
true;
231 m_bp_opts.SetCommandDataCallback(cmd_data);
245#define LLDB_OPTIONS_breakpoint_names
246#include "CommandOptions.inc"
255 return g_breakpoint_names_options;
261 const int short_option =
GetDefinitions()[option_idx].short_option;
262 const char *long_option =
GetDefinitions()[option_idx].long_option;
264 switch (short_option) {
271 "Invalid breakpoint name"));
289#define LLDB_OPTIONS_breakpoint_dummy
290#include "CommandOptions.inc"
299 return llvm::ArrayRef(g_breakpoint_dummy_options);
305 const int short_option =
306 g_breakpoint_dummy_options[option_idx].short_option;
308 switch (short_option) {
313 llvm_unreachable(
"Unimplemented option");
326#pragma mark AddAddress::CommandOptions
327#define LLDB_OPTIONS_breakpoint_add_address
328#include "CommandOptions.inc"
330#pragma mark Add Address
334 const std::vector<std::string> &bp_names,
336 assert(bp_sp &&
"CopyOverBreakpointOptions called with no breakpoint");
339 Target &target = bp_sp->GetTarget();
340 if (!bp_names.empty()) {
342 for (
auto name : bp_names) {
344 if (name_error.
Fail()) {
355static llvm::Expected<LanguageType>
357 char short_option =
'\0',
358 llvm::StringRef long_option = {}) {
359 llvm::Expected<LanguageType> exception_language =
361 if (!exception_language) {
362 std::string error_msg = llvm::toString(exception_language.takeError());
366 return exception_language;
375 std::string error_msg;
378 error.FromErrorString(
"Can't complete a line entry with no "
386 error.FromErrorStringWithFormatv(
"{0}/nCouldn't get default file for "
392 line_entry.
SetFile(default_file_spec);
401 "Add breakpoints by raw address", nullptr,
402 eCommandAllowsDummyTarget) {
428 const int short_option =
GetDefinitions()[option_idx].short_option;
429 const char *long_option =
GetDefinitions()[option_idx].long_option;
431 switch (short_option) {
442 "Only one shared library can be "
443 "specified for address breakpoints."));
447 llvm_unreachable(
"Unimplemented option");
459 return llvm::ArrayRef(g_breakpoint_add_address_options);
474 "can't set address breakpoints without a real target.");
478 const bool internal =
false;
483 bool has_module =
false;
484 if (
m_options.m_modules.GetSize() != 0) {
486 module_spec =
m_options.m_modules.GetFileSpecAtIndex(0);
491 std::vector<lldb::addr_t> bp_addrs;
499 arg_entry.ref(),
error);
502 bp_addrs.push_back(bp_load_addr);
504 for (
auto bp_addr : bp_addrs) {
507 bp_addr, internal, module_spec,
m_options.m_hardware);
523 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
535#pragma mark AddException::CommandOptions
536#define LLDB_OPTIONS_breakpoint_add_exception
537#include "CommandOptions.inc"
539#pragma mark Add Exception
545 interpreter,
"breakpoint add exception",
546 "Add breakpoints on language exceptions. If no language is "
547 "specified, break on exceptions for all supported languages",
548 nullptr, eCommandAllowsDummyTarget) {
573 const int short_option =
GetDefinitions()[option_idx].short_option;
575 switch (short_option) {
594 llvm_unreachable(
"Unimplemented option");
607 return llvm::ArrayRef(g_breakpoint_add_exception_options);
623 if (command.
size() == 0) {
625 }
else if (command.
size() > 1) {
627 "can only set exception breakpoints on one language at a time");
629 llvm::Expected<LanguageType> language =
632 exception_language = *language;
634 result.
SetError(language.takeError());
639 const bool internal =
false;
643 exception_language, catch_bp, throw_bp, internal,
644 &
m_options.m_exception_extra_args, &precond_error);
645 if (precond_error.
Fail()) {
647 "Error setting extra exception arguments: %s",
664 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
665 "into future targets.\n");
668 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
680#pragma mark AddFile::CommandOptions
681#define LLDB_OPTIONS_breakpoint_add_file
682#include "CommandOptions.inc"
690 interpreter,
"breakpoint add file",
691 "Add breakpoints on lines in specified source files", nullptr,
692 eCommandAllowsDummyTarget) {
702 arg1.push_back(linespec_arg);
710 arg2.push_back(linespec_arg);
739 const int short_option =
GetDefinitions()[option_idx].short_option;
740 const char *long_option =
GetDefinitions()[option_idx].long_option;
742 switch (short_option) {
748 if (option_arg.getAsInteger(0, line_num))
781 if (option_arg.getAsInteger(0, column_num))
825 option_arg, 0, &
error);
831 llvm_unreachable(
"Unimplemented option");
861 return llvm::ArrayRef(g_breakpoint_add_file_options);
876 bool internal =
false;
890 if (!this_arg.ref().getAsInteger(0, line_value)) {
893 std::string error_msg;
898 line_value, error_msg);
913 if (
m_options.m_line_specs.size() != 1) {
914 result.
AppendError(
"Can only make file and line breakpoints with one "
915 "specification at a time.");
937 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
938 "into future targets.\n");
943 if (bp_sp->GetNumLocations() == 0) {
944 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
945 "actual locations.\n");
950 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
962#pragma mark AddName::CommandOptions
963#define LLDB_OPTIONS_breakpoint_add_name
964#include "CommandOptions.inc"
972 "Add breakpoints matching function or symbol names",
973 nullptr, eCommandAllowsDummyTarget) {
999 const int short_option =
GetDefinitions()[option_idx].short_option;
1000 const char *long_option =
GetDefinitions()[option_idx].long_option;
1002 switch (short_option) {
1045 option_arg, 0, &
error);
1046 if (
error.Success())
1051 llvm_unreachable(
"Unimplemented option");
1068 return llvm::ArrayRef(g_breakpoint_add_name_options);
1084 const bool internal =
false;
1088 std::vector<std::string> func_names;
1090 func_names.push_back(this_arg.ref().str());
1100 if (func_names.size() != 1) {
1101 result.
AppendError(
"Can only set function regular expression "
1102 "breakpoints on one regex at a time.");
1105 std::string &func_regexp = func_names[0];
1107 if (llvm::Error err = regexp.
GetError()) {
1109 "Function name regular expression could not be compiled: %s",
1110 llvm::toString(std::move(err)).c_str());
1113 if (!func_regexp.empty()) {
1114 if (func_regexp[0] ==
'*' || func_regexp[0] ==
'?')
1116 "function name regex does not accept glob patterns");
1133 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1134 "into future targets.\n");
1136 if (bp_sp->GetNumLocations() == 0) {
1137 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1138 "actual locations.\n");
1143 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
1155#pragma mark AddPattern::CommandOptions
1156#define LLDB_OPTIONS_breakpoint_add_pattern
1157#include "CommandOptions.inc"
1159#pragma mark Add Pattern
1165 "Add breakpoints matching patterns in the source text",
1166 "breakpoint add pattern [options] -- <pattern>",
1167 eCommandAllowsDummyTarget) {
1190 const int short_option =
GetDefinitions()[option_idx].short_option;
1191 const char *long_option =
GetDefinitions()[option_idx].long_option;
1193 switch (short_option) {
1233 llvm_unreachable(
"Unimplemented option");
1250 return llvm::ArrayRef(g_breakpoint_add_pattern_options);
1266 const bool internal =
false;
1270 if (command.empty()) {
1283 if (pattern.empty()) {
1292 const size_t num_files =
m_options.m_files.GetSize();
1294 if (num_files == 0 && !
m_options.m_all_files) {
1298 "No files provided and could not find default file.");
1306 if (llvm::Error err = regexp.
GetError()) {
1308 "Source text regular expression could not be compiled: \"%s\"",
1309 llvm::toString(std::move(err)).c_str());
1314 std::move(regexp), internal,
m_options.m_hardware,
1324 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1325 "into future targets.\n");
1330 if (bp_sp->GetNumLocations() == 0) {
1331 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1332 "actual locations.\n");
1337 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
1349#pragma mark AddScripted::CommandOptions
1350#define LLDB_OPTIONS_breakpoint_add_scripted
1351#include "CommandOptions.inc"
1353#pragma mark Add Scripted
1359 interpreter,
"breakpoint add scripted",
1360 "Add breakpoints using a scripted breakpoint resolver.", nullptr,
1361 eCommandAllowsDummyTarget),
1387 const int short_option =
GetDefinitions()[option_idx].short_option;
1389 switch (short_option) {
1401 llvm_unreachable(
"Unimplemented option");
1414 return llvm::ArrayRef(g_breakpoint_add_scripted_options);
1436 "error setting extra exception arguments: %s",
error.AsCString());
1448 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1449 "into future targets.\n");
1454 if (bp_sp->GetNumLocations() == 0) {
1455 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1456 "actual locations.\n");
1461 result.
AppendError(
"breakpoint creation failed: No breakpoint created.");
1474#pragma mark Add::CommandOptions
1475#define LLDB_OPTIONS_breakpoint_add
1476#include "CommandOptions.inc"
1484 "Commands to add breakpoints of various types") {
1487Access the breakpoint search kernels built into lldb. Along with specifying the
1488search kernel, each breakpoint add operation can specify a common set of
1489"reaction" options for each breakpoint. The reaction options can also be
1490modified after breakpoint creation using the "breakpoint modify" command.
1514#define LLDB_OPTIONS_breakpoint_set
1515#include "CommandOptions.inc"
1534 interpreter,
"breakpoint set",
1535 "Sets a breakpoint or set of breakpoints in the executable.",
1536 "breakpoint set <cmd-options>", eCommandAllowsDummyTarget),
1562 const int short_option =
1563 g_breakpoint_set_options[option_idx].short_option;
1564 const char *long_option =
1565 g_breakpoint_set_options[option_idx].long_option;
1567 switch (short_option) {
1583 if (option_arg.getAsInteger(0,
m_column))
1591 option_arg, short_option, long_option);
1682 "Invalid breakpoint name"));
1689 option_arg, 0, &
error);
1690 if (
error.Success())
1735 option_arg, short_option, long_option, fcl_err.
AsCString()));
1744 llvm_unreachable(
"Unimplemented option");
1776 return llvm::ArrayRef(g_breakpoint_set_options);
1830 else if (!
m_options.m_func_names.empty())
1832 else if (!
m_options.m_func_regexp.empty())
1834 else if (!
m_options.m_source_text_regexp.empty())
1841 const bool internal =
false;
1849 switch (break_type) {
1853 const size_t num_files =
m_options.m_filenames.GetSize();
1854 if (num_files == 0) {
1856 result.
AppendError(
"no file supplied and no default file available.");
1859 }
else if (num_files > 1) {
1860 result.
AppendError(
"only one file at a time is allowed for file and "
1861 "line breakpoints");
1864 file =
m_options.m_filenames.GetFileSpecAtIndex(0);
1881 size_t num_modules_specified =
m_options.m_modules.GetSize();
1882 if (num_modules_specified == 1) {
1884 m_options.m_modules.GetFileSpecAtIndex(0);
1887 }
else if (num_modules_specified == 0) {
1891 result.
AppendError(
"Only one shared library can be specified for "
1892 "address breakpoints.");
1899 FunctionNameType name_type_mask =
m_options.m_func_name_type_mask;
1901 if (name_type_mask == 0)
1902 name_type_mask = eFunctionNameTypeAuto;
1915 if (llvm::Error err = regexp.
GetError()) {
1917 "Function name regular expression could not be compiled: %s",
1918 llvm::toString(std::move(err)).c_str());
1922 if (
m_options.m_func_regexp[0] ==
'*' ||
1925 "function name regex does not accept glob patterns");
1937 const size_t num_files =
m_options.m_filenames.GetSize();
1939 if (num_files == 0 && !
m_options.m_all_files) {
1943 "No files provided and could not find default file.");
1951 if (llvm::Error err = regexp.
GetError()) {
1953 "Source text regular expression could not be compiled: \"%s\"",
1954 llvm::toString(std::move(err)).c_str());
1959 m_options.m_source_regex_func_names, std::move(regexp), internal,
1968 if (precond_error.
Fail()) {
1970 "Error setting extra exception arguments: %s",
1985 "Error setting extra exception arguments: %s",
error.AsCString());
1996 bp_sp->GetOptions().CopyOverSetOptions(
m_bp_opts.GetBreakpointOptions());
1998 if (!
m_options.m_breakpoint_names.empty()) {
2000 for (
auto name :
m_options.m_breakpoint_names) {
2002 if (name_error.
Fail()) {
2014 const bool show_locations =
false;
2018 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
2019 "into future targets.\n");
2025 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
2026 "actual locations.\n");
2030 }
else if (!bp_sp) {
2031 result.
AppendError(
"breakpoint creation failed: no breakpoint created");
2050 "Modify the options on a breakpoint or set of "
2051 "breakpoints in the executable. "
2052 "If no breakpoint is specified, acts on the last "
2053 "created breakpoint. "
2054 "With the exception of -e, -d and -i, passing an "
2055 "empty argument clears the modification.",
2056 nullptr, eCommandAllowsDummyTarget) {
2080 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2081 std::unique_lock<std::recursive_mutex> lock;
2087 command, target, result, &valid_bp_ids,
2091 const size_t count = valid_bp_ids.
GetSize();
2092 for (
size_t i = 0; i < count; ++i) {
2126 "Enable the specified disabled breakpoint(s). If "
2127 "no breakpoints are specified, enable all of them.",
2128 nullptr, eCommandAllowsDummyTarget) {
2144 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2145 std::unique_lock<std::recursive_mutex> lock;
2150 size_t num_breakpoints = breakpoints.
GetSize();
2152 if (num_breakpoints == 0) {
2153 result.
AppendError(
"no breakpoints exist to be enabled");
2157 if (command.
empty()) {
2161 "All breakpoints enabled. ({0} breakpoints)", num_breakpoints);
2167 command,
m_exe_ctx, result, &valid_bp_ids,
2171 int enable_count = 0;
2173 const size_t count = valid_bp_ids.
GetSize();
2174 for (
size_t i = 0; i < count; ++i) {
2186 "failed to enable breakpoint location: {0}",
2187 llvm::fmt_consume(std::move(
error)));
2197 enable_count + loc_count);
2211 interpreter,
"breakpoint disable",
2212 "Disable the specified breakpoint(s) without deleting "
2213 "them. If none are specified, disable all "
2215 nullptr, eCommandAllowsDummyTarget) {
2217 "Disable the specified breakpoint(s) without deleting them. \
2218If none are specified, disable all breakpoints."
2222 "Note: disabling a breakpoint will cause none of its locations to be hit \
2223regardless of whether individual locations are enabled or disabled. After the sequence:"
2226 (lldb) break disable 1
2227 (lldb) break enable 1.1
2229execution will NOT stop at location 1.1. To achieve that, type:
2231 (lldb) break disable 1.*
2232 (lldb) break enable 1.1
2235 "The first command disables all locations for breakpoint 1, \
2236the second re-enables the first location.");
2251 void DoExecute(Args &command, CommandReturnObject &result)
override {
2253 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2254 std::unique_lock<std::recursive_mutex> lock;
2258 size_t num_breakpoints = breakpoints.
GetSize();
2260 if (num_breakpoints == 0) {
2261 result.
AppendError(
"no breakpoints exist to be disabled");
2265 if (command.
empty()) {
2269 "All breakpoints disabled. ({0} breakpoints)\n", num_breakpoints);
2273 BreakpointIDList valid_bp_ids;
2276 command,
m_exe_ctx, result, &valid_bp_ids,
2277 BreakpointName::Permissions::PermissionKinds::disablePerm);
2280 int disable_count = 0;
2282 const size_t count = valid_bp_ids.
GetSize();
2283 for (
size_t i = 0; i < count; ++i) {
2287 Breakpoint *breakpoint =
2290 BreakpointLocation *location =
2295 "failed to disable breakpoint location: {0}",
2296 llvm::fmt_consume(std::move(
error)));
2306 disable_count + loc_count);
2315#pragma mark List::CommandOptions
2316#define LLDB_OPTIONS_breakpoint_list
2317#include "CommandOptions.inc"
2325 interpreter,
"breakpoint list",
2326 "List some or all breakpoints at configurable levels of detail.",
2327 nullptr, eCommandAllowsDummyTarget) {
2348 switch (short_option) {
2365 llvm_unreachable(
"Unimplemented option");
2378 return llvm::ArrayRef(g_breakpoint_list_options);
2392 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2395 std::unique_lock<std::recursive_mutex> lock;
2398 size_t num_breakpoints = breakpoints.
GetSize();
2400 if (num_breakpoints == 0) {
2408 if (command.
empty()) {
2411 for (
size_t i = 0; i < num_breakpoints; ++i) {
2422 command, target, result, &valid_bp_ids,
2426 for (
size_t i = 0; i < valid_bp_ids.
GetSize(); ++i) {
2445#pragma mark Clear::CommandOptions
2447#define LLDB_OPTIONS_breakpoint_clear
2448#include "CommandOptions.inc"
2458 "Delete or disable breakpoints matching the "
2459 "specified source file and line.",
2460 "breakpoint clear <cmd-options>",
2461 eCommandAllowsDummyTarget) {}
2478 switch (short_option) {
2488 llvm_unreachable(
"Unimplemented option");
2500 return llvm::ArrayRef(g_breakpoint_clear_options);
2512 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2522 std::unique_lock<std::recursive_mutex> lock;
2526 size_t num_breakpoints = breakpoints.
GetSize();
2529 if (num_breakpoints == 0) {
2530 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
2537 std::vector<break_id_t> BreakIDs;
2538 for (
size_t i = 0; i < num_breakpoints; ++i)
2541 int num_cleared = 0;
2543 switch (break_type) {
2546 llvm::StringRef filename(
m_options.m_filename);
2549 for (
size_t i = 0; i < num_breakpoints; ++i) {
2555 if (loc_coll.
GetSize() == 0) {
2569 if (num_cleared > 0) {
2571 output_stream.
Printf(
"%d breakpoints cleared:\n", num_cleared);
2573 output_stream.
EOL();
2576 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
2585#define LLDB_OPTIONS_breakpoint_delete
2586#include "CommandOptions.inc"
2594 "Delete the specified breakpoint(s). If no "
2595 "breakpoints are specified, delete them all.",
2596 nullptr, eCommandAllowsDummyTarget) {
2622 switch (short_option) {
2636 llvm_unreachable(
"Unimplemented option");
2649 return llvm::ArrayRef(g_breakpoint_delete_options);
2661 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2664 std::unique_lock<std::recursive_mutex> lock;
2669 size_t num_breakpoints = breakpoints.
GetSize();
2671 if (num_breakpoints == 0) {
2672 result.
AppendError(
"no breakpoints exist to be deleted");
2680 "About to delete all breakpoints, do you want to do that?",
2686 "All breakpoints removed. ({0} breakpoint{1})", num_breakpoints,
2687 num_breakpoints > 1 ?
"s" :
"");
2701 if (!command.
empty()) {
2703 command, target, result, &excluded_bp_ids,
2709 for (
auto breakpoint_sp : breakpoints.
Breakpoints()) {
2710 if (!breakpoint_sp->IsEnabled() && breakpoint_sp->AllowDelete()) {
2712 if (!excluded_bp_ids.
Contains(bp_id))
2716 if (valid_bp_ids.
GetSize() == 0) {
2722 command,
m_exe_ctx, result, &valid_bp_ids,
2728 int delete_count = 0;
2729 int disable_count = 0;
2730 const size_t count = valid_bp_ids.
GetSize();
2731 for (
size_t i = 0; i < count; ++i) {
2745 "failed to disable breakpoint location: {0}",
2746 llvm::fmt_consume(std::move(
error)));
2756 "{0} breakpoints deleted; {1} breakpoint locations disabled.",
2757 delete_count, disable_count);
2766#define LLDB_OPTIONS_breakpoint_name
2767#include "CommandOptions.inc"
2777 return llvm::ArrayRef(g_breakpoint_name_options);
2783 const int short_option = g_breakpoint_name_options[option_idx].short_option;
2784 const char *long_option = g_breakpoint_name_options[option_idx].long_option;
2786 switch (short_option) {
2790 m_name.SetValueFromString(option_arg);
2793 if (
m_breakpoint.SetValueFromString(option_arg).Fail())
2799 if (
m_use_dummy.SetValueFromString(option_arg).Fail())
2809 llvm_unreachable(
"Unimplemented option");
2828#define LLDB_OPTIONS_breakpoint_access
2829#include "CommandOptions.inc"
2838 return llvm::ArrayRef(g_breakpoint_access_options);
2843 const int short_option =
2844 g_breakpoint_access_options[option_idx].short_option;
2845 const char *long_option =
2846 g_breakpoint_access_options[option_idx].long_option;
2848 switch (short_option) {
2850 bool value, success;
2860 bool value, success;
2870 bool value, success;
2880 llvm_unreachable(
"Unimplemented option");
2898 interpreter,
"configure",
2899 "Configure the options for the breakpoint"
2901 "If you provide a breakpoint id, the options will be copied from "
2902 "the breakpoint, otherwise only the options specified will be set "
2904 "breakpoint name configure <command-options> "
2905 "<breakpoint-name-list>",
2906 eCommandAllowsDummyTarget) {
2931 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2932 std::unique_lock<std::recursive_mutex> lock;
2936 for (
auto &entry : command.
entries()) {
2940 entry.c_str(),
error.AsCString());
2947 if (
m_bp_id.m_breakpoint.OptionWasSet()) {
2949 m_bp_id.m_breakpoint.GetValueAs<uint64_t>().value_or(0);
2959 for (
auto &entry : command.
entries()) {
2960 llvm::StringRef name(entry.ref());
2964 if (
m_bp_id.m_help_string.OptionWasSet())
2965 bp_name->
SetHelp(
m_bp_id.m_help_string.GetValueAs<llvm::StringRef>()
2992 interpreter,
"add",
"Add a name to the breakpoints provided.",
2993 "breakpoint name add <command-options> <breakpoint-id-list>",
2994 eCommandAllowsDummyTarget) {
3022 std::unique_lock<std::recursive_mutex> lock;
3027 size_t num_breakpoints = breakpoints.
GetSize();
3028 if (num_breakpoints == 0) {
3029 result.
AppendError(
"no breakpoints, cannot add names");
3036 command, target, result, &valid_bp_ids,
3040 if (valid_bp_ids.
GetSize() == 0) {
3041 result.
AppendError(
"no breakpoints specified, cannot add names");
3044 size_t num_valid_ids = valid_bp_ids.
GetSize();
3048 for (
size_t index = 0; index < num_valid_ids; index++) {
3066 interpreter,
"delete",
3067 "Delete a name from the breakpoints provided.",
3068 "breakpoint name delete <command-options> <breakpoint-id-list>",
3069 eCommandAllowsDummyTarget) {
3097 std::unique_lock<std::recursive_mutex> lock;
3102 size_t num_breakpoints = breakpoints.
GetSize();
3103 if (num_breakpoints == 0) {
3104 result.
AppendError(
"no breakpoints, cannot delete names");
3111 command, target, result, &valid_bp_ids,
3115 if (valid_bp_ids.
GetSize() == 0) {
3116 result.
AppendError(
"no breakpoints specified, cannot delete names");
3119 llvm::StringRef bp_name(
m_name_options.m_name.GetCurrentValueAsRef());
3120 size_t num_valid_ids = valid_bp_ids.
GetSize();
3121 for (
size_t index = 0; index < num_valid_ids; index++) {
3139 "List either the names for a breakpoint or info "
3140 "about a given name. With no arguments, lists all "
3142 "breakpoint name list <command-options>",
3143 eCommandAllowsDummyTarget) {
3157 std::vector<std::string> name_list;
3158 if (command.
empty()) {
3162 name_list.push_back(arg.c_str());
3166 if (name_list.empty()) {
3169 for (
const std::string &name : name_list) {
3181 std::unique_lock<std::recursive_mutex> lock;
3185 bool any_set =
false;
3187 if (bp_sp->MatchesName(name.c_str())) {
3214 interpreter,
"name",
"Commands to manage breakpoint names") {
3219Breakpoint names provide a general tagging mechanism for breakpoints. Each
3220breakpoint name can be added to any number of breakpoints, and each breakpoint
3221can have any number of breakpoint names attached to it. For instance:
3223 (lldb) break name add -N MyName 1-10
3225adds the name MyName to breakpoints 1-10, and:
3227 (lldb) break set -n myFunc -N Name1 -N Name2
3229adds two names to the breakpoint set at myFunc.
3231They have a number of interrelated uses:
32331) They provide a stable way to refer to a breakpoint (e.g. in another
3234breakpoint's action). Using the breakpoint ID for this purpose is fragile, since
3235it depends on the order of breakpoint creation. Giving a name to the breakpoint
3236you want to act on, and then referring to it by name, is more robust:
3238 (lldb) break set -n myFunc -N BKPT1
3239 (lldb) break set -n myOtherFunc -C "break disable BKPT1"
32412) This is actually just a specific use of a more general feature of breakpoint
3242names. The <breakpt-id-list> argument type used to specify one or more
3243breakpoints in most of the commands that deal with breakpoints also accepts
3244breakpoint names. That allows you to refer to one breakpoint in a stable
3245manner, but also makes them a convenient grouping mechanism, allowing you to
3246easily act on a group of breakpoints by using their name, for instance disabling
3247them all in one action:
3249 (lldb) break set -n myFunc -N Group1
3250 (lldb) break set -n myOtherFunc -N Group1
3251 (lldb) break disable Group1
32533) But breakpoint names are also entities in their own right, and can be
3254configured with all the modifiable attributes of a breakpoint. Then when you
3255add a breakpoint name to a breakpoint, the breakpoint will be configured to
3256match the state of the breakpoint name. The link between the name and the
3257breakpoints sharing it remains live, so if you change the configuration on the
3258name, it will also change the configurations on the breakpoints:
3260 (lldb) break name configure -i 10 IgnoreSome
3261 (lldb) break set -n myFunc -N IgnoreSome
3262 (lldb) break list IgnoreSome
3263 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 10 enabled
3266 (lldb) break name configure -i 5 IgnoreSome
3267 (lldb) break list IgnoreSome
3268 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 5 enabled
3272Options that are not configured on a breakpoint name don't affect the value of
3273those options on the breakpoints they are added to. So for instance, if Name1
3274has the -i option configured and Name2 the -c option, adding both names to a
3275breakpoint will set the -i option from Name1 and the -c option from Name2, and
3276the other options will be unaltered.
3278If you add multiple names to a breakpoint which have configured values for
3279the same option, the last name added's value wins.
3281The "liveness" of these settings is one way, from name to breakpoint.
3282If you use "break modify" to change an option that is also configured on a name
3283which that breakpoint has, the "break modify" command will override the setting
3284for that breakpoint, but won't change the value configured in the name or on the
3285other breakpoints sharing that name.
32874) Breakpoint names are also a convenient way to copy option sets from one
3288breakpoint to another. Using the -B option to "breakpoint name configure" makes
3289a name configured with all the options of the original breakpoint. Then
3290adding that name to another breakpoint copies over all the values from the
3291original breakpoint to the new one.
32935) You can also use breakpoint names to hide breakpoints from the breakpoint
3294operations that act on all breakpoints: "break delete", "break disable" and
3295"break list". You do that by specifying a "false" value for the
3296--allow-{list,delete,disable} options to "breakpoint name configure" and then
3297adding that name to a breakpoint.
3299This won't keep the breakpoint from being deleted or disabled if you refer to it
3300specifically by ID. The point of the feature is to make sure users don't
3301inadvertently delete or disable useful breakpoints (e.g. ones an IDE is using
3302for its own purposes) as part of a "delete all" or "disable all" operation. The
3303list hiding is because it's confusing for people to see breakpoints they
3326#pragma mark Read::CommandOptions
3327#define LLDB_OPTIONS_breakpoint_read
3328#include "CommandOptions.inc"
3336 "Read and set the breakpoints previously saved to "
3337 "a file with \"breakpoint write\". ",
3338 nullptr, eCommandAllowsDummyTarget) {}
3354 const char *long_option =
3357 switch (short_option) {
3366 option_arg, short_option, long_option, name_error.
AsCString()));
3368 m_names.push_back(std::string(option_arg));
3372 llvm_unreachable(
"Unimplemented option");
3384 return llvm::ArrayRef(g_breakpoint_read_options);
3390 int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
3391 int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
3400 std::optional<FileSpec> file_spec;
3401 const llvm::StringRef dash_f(
"-f");
3402 for (
int arg_idx = 0; arg_idx < opt_arg_pos; arg_idx++) {
3416 if (!
error.Success())
3423 const size_t num_bkpts = bkpt_array->
GetSize();
3424 for (
size_t i = 0; i < num_bkpts; i++) {
3427 if (!bkpt_object_sp)
3431 bkpt_object_sp->GetAsDictionary();
3440 bkpt_dict = bkpt_data_sp->GetAsDictionary();
3449 size_t num_names = names_array->
GetSize();
3451 for (
size_t i = 0; i < num_names; i++) {
3452 if (std::optional<llvm::StringRef> maybe_name =
3467 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
3468 std::unique_lock<std::recursive_mutex> lock;
3475 input_spec,
m_options.m_names, new_bps);
3477 if (!
error.Success()) {
3484 size_t num_breakpoints = new_bps.
GetSize();
3485 if (num_breakpoints == 0) {
3490 for (
size_t i = 0; i < num_breakpoints; ++i) {
3507#pragma mark Write::CommandOptions
3508#define LLDB_OPTIONS_breakpoint_write
3509#include "CommandOptions.inc"
3516 "Write the breakpoints listed to a file that can "
3517 "be read in with \"breakpoint read\". "
3518 "If given no arguments, writes all breakpoints.",
3519 nullptr, eCommandAllowsDummyTarget) {
3545 switch (short_option) {
3553 llvm_unreachable(
"Unimplemented option");
3565 return llvm::ArrayRef(g_breakpoint_write_options);
3577 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
3578 std::unique_lock<std::recursive_mutex> lock;
3582 if (!command.
empty()) {
3584 command,
m_exe_ctx, result, &valid_bp_ids,
3596 if (!
error.Success()) {
3606#pragma mark override add
3607#define LLDB_OPTIONS_breakpoint_override_add
3608#include "CommandOptions.inc"
3614 "Add a scripted breakpoint override resolver.",
3615 nullptr, eCommandAllowsDummyTarget),
3636 const int short_option =
GetDefinitions()[option_idx].short_option;
3638 switch (short_option) {
3645 g_breakpoint_override_add_options[option_idx].enum_values,
3646 eResolverUnknown,
error);
3647 if (
error.Success())
3651 llvm_unreachable(
"Unimplemented option");
3663 return llvm::ArrayRef(g_breakpoint_override_add_options);
3679 m_options.m_mask = eResolverFileAndLine;
3688 llvm::toString(
id.takeError()));
3703 "Delete a scripted breakpoint override resolver.",
3704 nullptr, eCommandAllowsDummyTarget) {
3721 if (
m_interpreter.Confirm(
"Delete all breakpoint overrides?",
false)) {
3728 for (
auto &entry : command.
entries()) {
3731 if (!entry.ref().getAsInteger(0,
id))
3756 interpreter,
"breakpoint override list",
3757 "List the current scripted breakpoint override resolvers.", nullptr,
3758 eCommandAllowsDummyTarget) {
3774 std::vector<uint64_t> idxs;
3776 for (
auto &entry : command.
entries()) {
3778 if (!entry.ref().getAsInteger(0,
id)) {
3798 if (idxs.size() == 1) {
3799 error_strm << llvm::formatv(
"error: invalid index: {0}", idxs[0]);
3802 error_strm <<
"error: invalid indices: ";
3803 auto begin = idxs.begin();
3804 error_strm << llvm::formatv(
"{0}", *begin);
3806 for (
auto elem : idxs)
3807 error_strm << llvm::formatv(
", {0}", elem);
3819 interpreter,
"override",
3820 "Commands to manage breakpoint override resolvers") {
3824Breakpoint override resolvers allow you to intercept breakpoint requests and
3825re-implement them using a custom breakpoint resolver. Override resolvers are
3826implemented by a scripted breakpoint resolver that implements the
3827'overrides_resolver' interface. It takes an SBStructuredData with the
3828serialized form of the original breakpoint resolver. If it returns true, then
3829the provided resolver will be substituted for the one lldb would have produced
3832Add new override resolvers using:
3834 (lldb) breakpoint override add -c class_name
3836This returns the ID of the resolver you added.
3838List the currently added override resolvers using:
3840 (lldb) breakpoint override list
3842Delete an added resolver using:
3844 (lldb) breakpoint override delete <id>
3863#pragma mark MultiwordBreakpoint
3868 interpreter,
"breakpoint",
3869 "Commands for operating on breakpoints (see 'help b' for shorthand.)",
3870 "breakpoint <subcommand> [<command-options>]") {
3898 list_command_object->SetCommandName(
"breakpoint list");
3899 enable_command_object->SetCommandName(
"breakpoint enable");
3900 disable_command_object->SetCommandName(
"breakpoint disable");
3901 clear_command_object->SetCommandName(
"breakpoint clear");
3902 delete_command_object->SetCommandName(
"breakpoint delete");
3903 set_command_object->SetCommandName(
"breakpoint set");
3904 add_command_object->SetCommandName(
"breakpoint add");
3905 command_command_object->SetCommandName(
"breakpoint command");
3906 modify_command_object->SetCommandName(
"breakpoint modify");
3907 name_command_object->SetCommandName(
"breakpoint name");
3908 write_command_object->SetCommandName(
"breakpoint write");
3909 read_command_object->SetCommandName(
"breakpoint read");
3910 override_command_object->SetCommandName(
"breakpoint override");
3932 BreakpointName::Permissions ::PermissionKinds purpose) {
3954 "No breakpoint specified and no last created breakpoint.");
3966 args, exe_ctx, allow_locations, purpose, temp_args)) {
3986 const size_t count = valid_ids->
GetSize();
3987 for (
size_t i = 0; i < count; ++i) {
3991 if (breakpoint !=
nullptr) {
4000 "'%s' is not a currently valid breakpoint/location id",
4006 "'%d' is not a currently valid breakpoint ID",
static bool GetDefaultFile(Target &target, StackFrame *cur_frame, FileSpec &file, CommandReturnObject &result)
static bool CopyOverBreakpointOptions(BreakpointSP bp_sp, BreakpointOptionGroup &bp_opts, const std::vector< std::string > &bp_names, CommandReturnObject &result)
static llvm::Expected< LanguageType > GetExceptionLanguageForLanguage(llvm::StringRef lang_name, char short_option='\0', llvm::StringRef long_option={})
static void AddBreakpointDescription(Stream *s, Breakpoint *bp, lldb::DescriptionLevel level)
static Status CompleteLineEntry(ExecutionContext &exe_ctx, OptionValueFileColonLine &line_entry)
static llvm::raw_ostream & error(Stream &strm)
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
BreakpointAccessOptionGroup()=default
const BreakpointName::Permissions & GetPermissions() const
~BreakpointAccessOptionGroup() override=default
BreakpointName::Permissions m_permissions
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
void OptionParsingStarting(ExecutionContext *execution_context) override
BreakpointDummyOptionGroup()=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~BreakpointDummyOptionGroup() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
OptionValueBoolean m_use_dummy
BreakpointNameOptionGroup()
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
OptionValueString m_help_string
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~BreakpointNameOptionGroup() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
OptionValueUInt64 m_breakpoint
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
const std::vector< std::string > & GetBreakpointNames()
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
~BreakpointNamesOptionGroup() override=default
std::vector< std::string > m_breakpoint_names
BreakpointNamesOptionGroup()=default
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
~CommandOptions() override=default
BreakpointNamesOptionGroup m_name_opts
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointAddAddress(CommandInterpreter &interpreter)
Options * GetOptions() override
BreakpointDummyOptionGroup m_dummy_options
~CommandObjectBreakpointAddAddress() override=default
BreakpointOptionGroup m_bp_opts
OptionGroupOptions m_all_options
uint32_t m_exception_stage
Args m_exception_extra_args
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
~CommandOptions() override=default
OptionGroupOptions m_all_options
~CommandObjectBreakpointAddException() override=default
BreakpointNamesOptionGroup m_name_opts
CommandObjectBreakpointAddException(CommandInterpreter &interpreter)
BreakpointOptionGroup m_bp_opts
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
BreakpointDummyOptionGroup m_dummy_options
LazyBool m_move_to_nearest_code
OptionValueFileColonLine m_cur_value
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
lldb::addr_t m_offset_addr
Status OptionParsingFinished(ExecutionContext *execution_context) override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
~CommandOptions() override=default
std::vector< OptionValueFileColonLine > m_line_specs
Options * GetOptions() override
CommandObjectBreakpointAddFile(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
BreakpointNamesOptionGroup m_name_opts
OptionGroupOptions m_all_options
~CommandObjectBreakpointAddFile() override=default
BreakpointOptionGroup m_bp_opts
BreakpointDummyOptionGroup m_dummy_options
LazyBool m_move_to_nearest_code
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
NameMatchStyle m_lookup_style
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
lldb::addr_t m_offset_addr
BreakpointOptionGroup m_bp_opts
BreakpointNamesOptionGroup m_name_opts
Options * GetOptions() override
BreakpointDummyOptionGroup m_dummy_options
OptionGroupOptions m_all_options
~CommandObjectBreakpointAddName() override=default
CommandObjectBreakpointAddName(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandOptions() override=default
std::unordered_set< std::string > m_func_names
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
LazyBool m_move_to_nearest_code
BreakpointDummyOptionGroup m_dummy_options
void DoExecute(llvm::StringRef command, CommandReturnObject &result) override
BreakpointNamesOptionGroup m_name_opts
BreakpointOptionGroup m_bp_opts
~CommandObjectBreakpointAddPattern() override=default
Options * GetOptions() override
CommandObjectBreakpointAddPattern(CommandInterpreter &interpreter)
OptionGroupOptions m_all_options
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
BreakpointDummyOptionGroup m_dummy_options
Options * GetOptions() override
~CommandObjectBreakpointAddScripted() override=default
BreakpointNamesOptionGroup m_name_opts
CommandObjectBreakpointAddScripted(CommandInterpreter &interpreter)
OptionGroupOptions m_all_options
BreakpointOptionGroup m_bp_opts
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupPythonClassWithDict m_python_class_options
CommandObjectBreakpointAdd(CommandInterpreter &interpreter)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
CommandObjectBreakpointClear(CommandInterpreter &interpreter)
~CommandObjectBreakpointClear() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandOptions() override=default
CommandObjectBreakpointDelete(CommandInterpreter &interpreter)
~CommandObjectBreakpointDelete() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointDisable() override=default
CommandObjectBreakpointDisable(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
~CommandObjectBreakpointEnable() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointEnable(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
lldb::DescriptionLevel m_level
~CommandObjectBreakpointList() override=default
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointList(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
BreakpointDummyOptionGroup m_dummy_opts
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointModify(CommandInterpreter &interpreter)
BreakpointOptionGroup m_bp_opts
~CommandObjectBreakpointModify() override=default
OptionGroupOptions m_options
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupOptions m_option_group
CommandObjectBreakpointNameAdd(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointNameAdd() override=default
BreakpointNameOptionGroup m_name_options
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
BreakpointNameOptionGroup m_name_options
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointNameDelete(CommandInterpreter &interpreter)
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointNameDelete() override=default
OptionGroupOptions m_option_group
CommandObjectBreakpointNameList(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
OptionGroupOptions m_option_group
~CommandObjectBreakpointNameList() override=default
BreakpointNameOptionGroup m_name_options
~CommandObjectBreakpointName() override=default
CommandObjectBreakpointName(CommandInterpreter &interpreter)
std::string m_description
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
~CommandOptions() override=default
Options * GetOptions() override
OptionGroupOptions m_all_options
BreakpointDummyOptionGroup m_dummy_options
CommandObjectBreakpointOverrideAdd(CommandInterpreter &interpreter)
~CommandObjectBreakpointOverrideAdd() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupPythonClassWithDict m_python_class_options
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupOptions m_all_options
CommandObjectBreakpointOverrideDelete(CommandInterpreter &interpreter)
BreakpointDummyOptionGroup m_dummy_options
Options * GetOptions() override
~CommandObjectBreakpointOverrideDelete() override=default
CommandObjectBreakpointOverrideList(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointOverrideList() override=default
BreakpointDummyOptionGroup m_dummy_options
OptionGroupOptions m_all_options
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointOverride(CommandInterpreter &interpreter)
~CommandObjectBreakpointOverride() override=default
void HandleOptionArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector, int opt_element_index, CommandInterpreter &interpreter) override
Handles the generic bits of figuring out whether we are in an option, and if so completing it.
std::vector< std::string > m_names
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointRead(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointRead() override=default
lldb::LanguageType m_language
void OptionParsingStarting(ExecutionContext *execution_context) override
std::string m_func_regexp
std::string m_source_text_regexp
std::vector< std::string > m_breakpoint_names
~CommandOptions() override=default
Args m_exception_extra_args
std::string m_current_key
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
lldb::LanguageType m_exception_language
lldb::addr_t m_offset_addr
LazyBool m_move_to_nearest_code
lldb::FunctionNameType m_func_name_type_mask
std::vector< std::string > m_func_names
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
std::unordered_set< std::string > m_source_regex_func_names
OptionGroupOptions m_all_options
~CommandObjectBreakpointSet() override=default
BreakpointOptionGroup m_bp_opts
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
OptionGroupPythonClassWithDict m_python_class_options
CommandObjectBreakpointSet(CommandInterpreter &interpreter)
BreakpointDummyOptionGroup m_dummy_options
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointWrite(CommandInterpreter &interpreter)
~CommandObjectBreakpointWrite() override=default
A section + offset based address class.
A command line argument class.
llvm::ArrayRef< const char * > GetArgumentArrayRef() const
Gets the argument as an ArrayRef.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
llvm::ArrayRef< ArgEntry > entries() const
const char * GetArgumentAtIndex(size_t idx) const
Gets the null-terminated C string argument pointer for the argument at index idx.
bool Contains(BreakpointID bp_id) const
bool AddBreakpointID(BreakpointID bp_id)
static llvm::Error FindAndReplaceIDRanges(Args &old_args, const ExecutionContext &exe_ctx, bool allow_locations, BreakpointName::Permissions ::PermissionKinds purpose, Args &new_args)
BreakpointID GetBreakpointIDAtIndex(size_t index) const
static std::optional< BreakpointID > ParseCanonicalReference(llvm::StringRef input)
Takes an input string containing the description of a breakpoint or breakpoint and location and retur...
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...
static bool StringIsBreakpointName(llvm::StringRef str, Status &error)
Takes an input string and checks to see whether it is a breakpoint name.
General Outline: Allows adding and removing breakpoints and find by ID and index.
BreakpointIterable Breakpoints()
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const
Returns a shared pointer to the breakpoint with id breakID.
void GetListMutex(std::unique_lock< std::recursive_mutex > &lock)
Sets the passed in Locker to hold the Breakpoint List mutex.
size_t GetSize() const
Returns the number of elements in this breakpoint list.
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const
Returns a shared pointer to the breakpoint with index i.
size_t GetSize() const
Returns the number of elements in this breakpoint location list.
General Outline: A breakpoint location is defined by the breakpoint that produces it,...
llvm::Error SetEnabled(bool enabled)
If enabled is true, enable the breakpoint, if false disable it.
BreakpointOptions & GetLocationOptions()
Use this to set location specific breakpoint options.
bool GetDescription(Stream *s, lldb::DescriptionLevel level)
void SetHelp(const char *description)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status OptionParsingFinished(ExecutionContext *execution_context) override
const BreakpointOptions & GetBreakpointOptions()
BreakpointOptions m_bp_opts
std::vector< std::string > m_commands
~BreakpointOptionGroup() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
void CopyOverSetOptions(const BreakpointOptions &rhs)
Copy over only the options set in the incoming BreakpointOptions.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id, bool use_facade=true)
Find a breakpoint location for a given breakpoint location ID.
void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_locations=false)
Put a description of this breakpoint into the stream s.
BreakpointOptions & GetOptions()
Returns the BreakpointOptions structure set at the breakpoint level.
bool GetMatchingFileLine(llvm::StringRef filename, uint32_t line_number, BreakpointLocationCollection &loc_coll)
Find breakpoint locations which match the (filename, line_number) description.
static const char * GetSerializationKey()
void SetEnabled(bool enable) override
If enable is true, enable the breakpoint, if false disable it.
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
ExecutionContext GetExecutionContext(bool adopt_dummy_target=true) const
Returns the execution context the interpreter should run a command in.
static void VerifyIDs(Args &args, const ExecutionContext &exe_ctx, bool allow_locations, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions::PermissionKinds purpose)
CommandObjectMultiwordBreakpoint(CommandInterpreter &interpreter)
static void VerifyBreakpointOrLocationIDs(Args &args, const ExecutionContext &exe_ctx, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions ::PermissionKinds purpose)
~CommandObjectMultiwordBreakpoint() override
static void VerifyBreakpointIDs(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)
friend class CommandInterpreter
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
std::vector< CommandArgumentData > CommandArgumentEntry
virtual void SetHelpLong(llvm::StringRef str)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
Target & GetDummyTarget()
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
void AddIDsArgumentData(IDType type)
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
Target * GetTarget()
Get the target this command should operate on.
void AppendMessage(llvm::StringRef in_string)
void AppendError(llvm::StringRef in_string)
std::string GetErrorString(bool with_diagnostics=true) const
Return the errors as a string.
Stream & GetErrorStream()
void SetStatus(lldb::ReturnStatus status)
void SetError(Status error)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void void AppendMessageWithFormatv(const char *format, Args &&...args)
void AppendWarning(llvm::StringRef in_string)
void AppendErrorWithFormatv(const char *format, Args &&...args)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
const Args & GetParsedLine() const
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
A class to manage flag bits.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
bool HasTargetScope() const
Returns true the ExecutionContext object contains a valid target.
Target & GetTargetRef() const
Returns a reference to the target object.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static llvm::Expected< lldb::LanguageType > GetExceptionLanguageForLanguage(llvm::StringRef lang_name)
static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions()
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
uint32_t GetColumnNumber()
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
void SetLine(uint32_t line)
void SetFile(const FileSpec &file_spec)
A pair of an option list with a 'raw' string as a suffix.
bool HasArgs() const
Returns true if there are any arguments before the raw suffix.
Args & GetArgs()
Returns the list of arguments.
const std::string & GetRawPart() const
Returns the raw suffix part of the parsed string.
A command line option parsing protocol class.
std::vector< Option > m_getopt_table
llvm::Error GetError() const
Return an error if the regular expression failed to compile.
std::optional< SupportFileAndLine > GetDefaultFileAndLine()
This base class provides an interface to stack frames.
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
virtual bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
static Status FromErrorString(const char *str)
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
bool Success() const
Test for success condition.
lldb::break_id_t GetID() const
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
ObjectSP GetItemAtIndex(size_t idx) const
std::optional< llvm::StringRef > GetItemAtIndexAsString(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
bool GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
std::shared_ptr< Object > ObjectSP
static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error)
Defines a symbol context baton that can be handed other debug core functions.
LineEntry line_entry
The LineEntry for a given query.
lldb::BreakpointSP CreateScriptedBreakpoint(const llvm::StringRef class_name, const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, bool internal, bool request_hardware, StructuredData::ObjectSP extra_args_sp, Status *creation_error=nullptr)
lldb::BreakpointSP CreateFuncRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, RegularExpression func_regexp, lldb::LanguageType requested_language, LazyBool skip_prologue, bool internal, bool request_hardware)
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
BreakpointList & GetBreakpointList(bool internal=false)
SourceManager & GetSourceManager()
lldb::user_id_t AddBreakpointResolverOverride(BreakpointResolverOverrideUP override_up)
Add a breakpoint override resolver. This version can't fail.
Debugger & GetDebugger() const
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
void DisableAllowedBreakpoints()
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name)
bool RemoveBreakpointByID(lldb::break_id_t break_id)
void DescribeBreakpointOverrides(Stream &stream, std::vector< lldb::user_id_t > &idxs, uint32_t terminal_width, bool use_color)
Describe the breakpoint overrides.
void ClearBreakpointResolverOverrides()
bool RemoveBreakpointResolverOverride(lldb::user_id_t override_id)
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
lldb::BreakpointSP CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args=nullptr, Status *additional_args_error=nullptr)
void EnableAllowedBreakpoints()
void RemoveAllowedBreakpoints()
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
lldb::BreakpointSP CreateSourceRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *source_file_list, const std::unordered_set< std::string > &function_names, RegularExpression source_regex, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
void GetBreakpointNames(std::vector< std::string > &names)
bool IsDummyTarget() const
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
BreakpointName * FindBreakpointName(llvm::StringRef name, bool can_create, Status &error)
lldb::BreakpointSP GetLastCreatedBreakpoint()
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_LINE_NUMBER
#define LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
static constexpr llvm::StringLiteral g_bool_parsing_error_message
static constexpr llvm::StringLiteral g_int_parsing_error_message
llvm::Error CreateOptionParsingError(llvm::StringRef option_arg, const char short_option, llvm::StringRef long_option={}, llvm::StringRef additional_context={})
Creates an error that represents the failure to parse an command line option argument.
static constexpr llvm::StringLiteral g_language_parsing_error_message
BreakpointConditionMode
Modes for evaluating breakpoint conditions.
@ eBreakpointConditionModeDefault
Use the mode specified by the target.breakpoints-condition-mode setting.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelInitial
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeFunctionOrSymbol
@ eArgTypeRegularExpression
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type
uint32_t arg_opt_set_association
This arg might be associated only with some particular option set(s).
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
const FileSpec & GetFile() const
Helper to access the file.
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, Status *error_ptr)
Try to parse an address.
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)