48#pragma mark Modify::CommandOptions
49#define LLDB_OPTIONS_breakpoint_modify
50#include "CommandOptions.inc"
59 return llvm::ArrayRef(g_breakpoint_modify_options);
65 const int short_option =
66 g_breakpoint_modify_options[option_idx].short_option;
68 switch (short_option) {
90 error.SetErrorStringWithFormat(
91 "invalid boolean value '%s' passed for -G option",
92 option_arg.str().c_str());
96 if (option_arg.getAsInteger(0, ignore_count))
97 error.SetErrorStringWithFormat(
"invalid ignore count '%s'",
98 option_arg.str().c_str());
108 error.SetErrorStringWithFormat(
109 "invalid boolean value '%s' passed for -o option",
110 option_arg.str().c_str());
114 if (option_arg ==
"current") {
115 if (!execution_context) {
116 error.SetErrorStringWithFormat(
"No context to determine current "
119 ThreadSP ctx_thread_sp = execution_context->
GetThreadSP();
120 if (!ctx_thread_sp || !ctx_thread_sp->IsValid()) {
121 error.SetErrorStringWithFormat(
"No currently selected thread");
123 thread_id = ctx_thread_sp->GetID();
126 }
else if (option_arg.getAsInteger(0, thread_id)) {
127 error.SetErrorStringWithFormat(
"invalid thread id string '%s'",
128 option_arg.str().c_str());
141 if (option_arg.getAsInteger(0, thread_index)) {
142 error.SetErrorStringWithFormat(
"invalid thread index string '%s'",
143 option_arg.str().c_str());
149 llvm_unreachable(
"Unimplemented option");
162 auto cmd_data = std::make_unique<BreakpointOptions::CommandData>();
165 cmd_data->user_source.AppendString(str);
167 cmd_data->stop_on_error =
true;
179#define LLDB_OPTIONS_breakpoint_dummy
180#include "CommandOptions.inc"
189 return llvm::ArrayRef(g_breakpoint_dummy_options);
195 const int short_option =
196 g_breakpoint_dummy_options[option_idx].short_option;
198 switch (short_option) {
203 llvm_unreachable(
"Unimplemented option");
216#define LLDB_OPTIONS_breakpoint_set
217#include "CommandOptions.inc"
236 interpreter,
"breakpoint set",
237 "Sets a breakpoint or set of breakpoints in the executable.",
238 "breakpoint set <cmd-options>"),
264 const int short_option =
265 g_breakpoint_set_options[option_idx].short_option;
267 switch (short_option) {
283 if (option_arg.getAsInteger(0,
m_column))
284 error.SetErrorStringWithFormat(
"invalid column number: %s",
285 option_arg.str().c_str());
308 error.SetErrorStringWithFormat(
309 "Set exception breakpoints separately for c++ and objective-c");
312 error.SetErrorStringWithFormat(
313 "Unknown language type: '%s' for exception breakpoint",
314 option_arg.str().c_str());
317 error.SetErrorStringWithFormat(
318 "Unsupported language type: '%s' for exception breakpoint",
319 option_arg.str().c_str());
336 error.SetErrorStringWithFormat(
337 "Invalid boolean value for on-catch option: '%s'",
338 option_arg.str().c_str());
355 error.SetErrorStringWithFormat(
356 "Invalid boolean value for skip prologue option: '%s'",
357 option_arg.str().c_str());
362 error.SetErrorStringWithFormat(
"invalid line number: %s.",
363 option_arg.str().c_str());
369 error.SetErrorStringWithFormat(
370 "Unknown language type: '%s' for breakpoint",
371 option_arg.str().c_str());
384 error.SetErrorStringWithFormat(
385 "Invalid boolean value for move-to-nearest-code option: '%s'",
386 option_arg.str().c_str());
404 error.SetErrorStringWithFormat(
"Invalid breakpoint name: %s",
405 option_arg.str().c_str());
412 option_arg, 0, &
error);
443 error.SetErrorStringWithFormat(
444 "Invalid boolean value for on-throw option: '%s'",
445 option_arg.str().c_str());
457 error.SetErrorStringWithFormat(
458 "Invalid value for file:line specifier: %s",
468 llvm_unreachable(
"Unimplemented option");
500 return llvm::ArrayRef(g_breakpoint_set_options);
562 BreakpointSP bp_sp =
nullptr;
564 const bool internal =
false;
572 switch (break_type) {
577 if (num_files == 0) {
579 result.
AppendError(
"No file supplied and no default file available.");
582 }
else if (num_files > 1) {
583 result.
AppendError(
"Only one file at a time is allowed for file and "
584 "line breakpoints.");
605 if (num_modules_specified == 1) {
610 }
else if (num_modules_specified == 0) {
614 result.
AppendError(
"Only one shared library can be specified for "
615 "address breakpoints.");
624 if (name_type_mask == 0)
625 name_type_mask = eFunctionNameTypeAuto;
638 if (llvm::Error err = regexp.
GetError()) {
640 "Function name regular expression could not be compiled: %s",
641 llvm::toString(std::move(err)).c_str());
648 "Function name regex does not accept glob patterns.");
666 "No files provided and could not find default file.");
674 if (llvm::Error err = regexp.
GetError()) {
676 "Source text regular expression could not be compiled: \"%s\"",
677 llvm::toString(std::move(err)).c_str());
691 if (precond_error.
Fail()) {
693 "Error setting extra exception arguments: %s",
708 "Error setting extra exception arguments: %s",
error.AsCString());
725 if (name_error.
Fail()) {
737 const bool show_locations =
false;
741 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
742 "into future targets.\n");
748 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
749 "actual locations.\n");
754 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
768 if (cur_frame ==
nullptr) {
770 "No selected frame to use to find the default file.");
773 result.
AppendError(
"Cannot use the selected frame to find the default "
774 "file, it has no debug info.");
782 result.
AppendError(
"Can't find the file for the selected frame to "
783 "use as the default file.");
805 "Modify the options on a breakpoint or set of "
806 "breakpoints in the executable. "
807 "If no breakpoint is specified, acts on the last "
808 "created breakpoint. "
809 "With the exception of -e, -d and -i, passing an "
810 "empty argument clears the modification.",
842 std::unique_lock<std::recursive_mutex> lock;
848 command, &target, result, &valid_bp_ids,
849 BreakpointName::Permissions::PermissionKinds::disablePerm);
852 const size_t count = valid_bp_ids.
GetSize();
853 for (
size_t i = 0; i < count; ++i) {
889 "Enable the specified disabled breakpoint(s). If "
890 "no breakpoints are specified, enable all of them.",
914 std::unique_lock<std::recursive_mutex> lock;
919 size_t num_breakpoints = breakpoints.
GetSize();
921 if (num_breakpoints == 0) {
922 result.
AppendError(
"No breakpoints exist to be enabled.");
926 if (command.
empty()) {
931 (uint64_t)num_breakpoints);
937 command, &target, result, &valid_bp_ids,
938 BreakpointName::Permissions::PermissionKinds::disablePerm);
941 int enable_count = 0;
943 const size_t count = valid_bp_ids.
GetSize();
944 for (
size_t i = 0; i < count; ++i) {
964 enable_count + loc_count);
980 interpreter,
"breakpoint disable",
981 "Disable the specified breakpoint(s) without deleting "
982 "them. If none are specified, disable all "
986 "Disable the specified breakpoint(s) without deleting them. \
987If none are specified, disable all breakpoints."
991 "Note: disabling a breakpoint will cause none of its locations to be hit \
992regardless of whether individual locations are enabled or disabled. After the sequence:"
995 (lldb) break disable 1
996 (lldb) break enable 1.1
998execution will NOT stop at location 1.1. To achieve that, type:
1000 (lldb) break disable 1.*
1001 (lldb) break enable 1.1
1004 "The first command disables all locations for breakpoint 1, \
1005the second re-enables the first location.");
1028 std::unique_lock<std::recursive_mutex> lock;
1032 size_t num_breakpoints = breakpoints.
GetSize();
1034 if (num_breakpoints == 0) {
1035 result.
AppendError(
"No breakpoints exist to be disabled.");
1039 if (command.
empty()) {
1044 (uint64_t)num_breakpoints);
1051 command, &target, result, &valid_bp_ids,
1052 BreakpointName::Permissions::PermissionKinds::disablePerm);
1055 int disable_count = 0;
1057 const size_t count = valid_bp_ids.
GetSize();
1058 for (
size_t i = 0; i < count; ++i) {
1078 disable_count + loc_count);
1089#pragma mark List::CommandOptions
1090#define LLDB_OPTIONS_breakpoint_list
1091#include "CommandOptions.inc"
1099 interpreter,
"breakpoint list",
1100 "List some or all breakpoints at configurable levels of detail.",
1111 arg.push_back(bp_id_arg);
1132 switch (short_option) {
1149 llvm_unreachable(
"Unimplemented option");
1162 return llvm::ArrayRef(g_breakpoint_list_options);
1179 std::unique_lock<std::recursive_mutex> lock;
1182 size_t num_breakpoints = breakpoints.
GetSize();
1184 if (num_breakpoints == 0) {
1192 if (command.
empty()) {
1195 for (
size_t i = 0; i < num_breakpoints; ++i) {
1206 command, &target, result, &valid_bp_ids,
1207 BreakpointName::Permissions::PermissionKinds::listPerm);
1210 for (
size_t i = 0; i < valid_bp_ids.
GetSize(); ++i) {
1231#pragma mark Clear::CommandOptions
1233#define LLDB_OPTIONS_breakpoint_clear
1234#include "CommandOptions.inc"
1244 "Delete or disable breakpoints matching the "
1245 "specified source file and line.",
1246 "breakpoint clear <cmd-options>") {}
1263 switch (short_option) {
1273 llvm_unreachable(
"Unimplemented option");
1285 return llvm::ArrayRef(g_breakpoint_clear_options);
1307 std::unique_lock<std::recursive_mutex> lock;
1311 size_t num_breakpoints = breakpoints.
GetSize();
1314 if (num_breakpoints == 0) {
1315 result.
AppendError(
"Breakpoint clear: No breakpoint cleared.");
1322 std::vector<break_id_t> BreakIDs;
1323 for (
size_t i = 0; i < num_breakpoints; ++i)
1326 int num_cleared = 0;
1328 switch (break_type) {
1334 for (
size_t i = 0; i < num_breakpoints; ++i) {
1340 if (loc_coll.
GetSize() == 0) {
1354 if (num_cleared > 0) {
1356 output_stream.
Printf(
"%d breakpoints cleared:\n", num_cleared);
1358 output_stream.
EOL();
1361 result.
AppendError(
"Breakpoint clear: No breakpoint cleared.");
1372#define LLDB_OPTIONS_breakpoint_delete
1373#include "CommandOptions.inc"
1381 "Delete the specified breakpoint(s). If no "
1382 "breakpoints are specified, delete them all.",
1415 switch (short_option) {
1429 llvm_unreachable(
"Unimplemented option");
1442 return llvm::ArrayRef(g_breakpoint_delete_options);
1456 std::unique_lock<std::recursive_mutex> lock;
1461 size_t num_breakpoints = breakpoints.
GetSize();
1463 if (num_breakpoints == 0) {
1464 result.
AppendError(
"No breakpoints exist to be deleted.");
1472 "About to delete all breakpoints, do you want to do that?",
1478 "All breakpoints removed. (%" PRIu64
" breakpoint%s)\n",
1479 (uint64_t)num_breakpoints, num_breakpoints > 1 ?
"s" :
"");
1493 if (!command.
empty()) {
1495 command, &target, result, &excluded_bp_ids,
1496 BreakpointName::Permissions::PermissionKinds::deletePerm);
1501 for (
auto breakpoint_sp : breakpoints.
Breakpoints()) {
1502 if (!breakpoint_sp->IsEnabled() && breakpoint_sp->AllowDelete()) {
1509 if (valid_bp_ids.
GetSize() == 0) {
1515 command, &target, result, &valid_bp_ids,
1516 BreakpointName::Permissions::PermissionKinds::deletePerm);
1521 int delete_count = 0;
1522 int disable_count = 0;
1523 const size_t count = valid_bp_ids.
GetSize();
1524 for (
size_t i = 0; i < count; ++i) {
1546 "%d breakpoints deleted; %d breakpoint locations disabled.\n",
1547 delete_count, disable_count);
1557#define LLDB_OPTIONS_breakpoint_name
1558#include "CommandOptions.inc"
1568 return llvm::ArrayRef(g_breakpoint_name_options);
1574 const int short_option = g_breakpoint_name_options[option_idx].short_option;
1576 switch (short_option) {
1584 error.SetErrorStringWithFormat(
1585 "unrecognized value \"%s\" for breakpoint",
1586 option_arg.str().c_str());
1590 error.SetErrorStringWithFormat(
1591 "unrecognized value \"%s\" for use-dummy",
1592 option_arg.str().c_str());
1599 llvm_unreachable(
"Unimplemented option");
1618#define LLDB_OPTIONS_breakpoint_access
1619#include "CommandOptions.inc"
1628 return llvm::ArrayRef(g_breakpoint_access_options);
1633 const int short_option =
1634 g_breakpoint_access_options[option_idx].short_option;
1636 switch (short_option) {
1638 bool value, success;
1643 error.SetErrorStringWithFormat(
1644 "invalid boolean value '%s' passed for -L option",
1645 option_arg.str().c_str());
1648 bool value, success;
1653 error.SetErrorStringWithFormat(
1654 "invalid boolean value '%s' passed for -L option",
1655 option_arg.str().c_str());
1658 bool value, success;
1663 error.SetErrorStringWithFormat(
1664 "invalid boolean value '%s' passed for -L option",
1665 option_arg.str().c_str());
1668 llvm_unreachable(
"Unimplemented option");
1686 interpreter,
"configure",
1687 "Configure the options for the breakpoint"
1689 "If you provide a breakpoint id, the options will be copied from "
1690 "the breakpoint, otherwise only the options specified will be set "
1692 "breakpoint name configure <command-options> "
1693 "<breakpoint-name-list>") {
1700 arg1.push_back(id_arg);
1726 std::unique_lock<std::recursive_mutex> lock;
1730 for (
auto &entry : command.
entries()) {
1734 entry.c_str(),
error.AsCString());
1753 for (
auto &entry : command.
entries()) {
1786 interpreter,
"add",
"Add a name to the breakpoints provided.",
1787 "breakpoint name add <command-options> <breakpoint-id-list>") {
1794 arg1.push_back(id_arg);
1823 std::unique_lock<std::recursive_mutex> lock;
1828 size_t num_breakpoints = breakpoints.
GetSize();
1829 if (num_breakpoints == 0) {
1830 result.
AppendError(
"No breakpoints, cannot add names.");
1837 command, &target, result, &valid_bp_ids,
1838 BreakpointName::Permissions::PermissionKinds::listPerm);
1841 if (valid_bp_ids.
GetSize() == 0) {
1842 result.
AppendError(
"No breakpoints specified, cannot add names.");
1845 size_t num_valid_ids = valid_bp_ids.
GetSize();
1849 for (
size_t index = 0; index < num_valid_ids; index++) {
1869 interpreter,
"delete",
1870 "Delete a name from the breakpoints provided.",
1871 "breakpoint name delete <command-options> <breakpoint-id-list>") {
1878 arg1.push_back(id_arg);
1907 std::unique_lock<std::recursive_mutex> lock;
1912 size_t num_breakpoints = breakpoints.
GetSize();
1913 if (num_breakpoints == 0) {
1914 result.
AppendError(
"No breakpoints, cannot delete names.");
1921 command, &target, result, &valid_bp_ids,
1922 BreakpointName::Permissions::PermissionKinds::deletePerm);
1925 if (valid_bp_ids.
GetSize() == 0) {
1926 result.
AppendError(
"No breakpoints specified, cannot delete names.");
1930 size_t num_valid_ids = valid_bp_ids.
GetSize();
1931 for (
size_t index = 0; index < num_valid_ids; index++) {
1951 "List either the names for a breakpoint or info "
1952 "about a given name. With no arguments, lists all "
1954 "breakpoint name list <command-options>") {
1968 std::vector<std::string> name_list;
1969 if (command.
empty()) {
1973 name_list.push_back(arg.c_str());
1977 if (name_list.empty()) {
1980 for (
const std::string &name_str : name_list) {
1981 const char *name = name_str.c_str();
1993 std::unique_lock<std::recursive_mutex> lock;
1997 bool any_set =
false;
1998 for (BreakpointSP bp_sp : breakpoints.
Breakpoints()) {
1999 if (bp_sp->MatchesName(name)) {
2027 interpreter,
"name",
"Commands to manage breakpoint names") {
2032Breakpoint names provide a general tagging mechanism for breakpoints. Each
2033breakpoint name can be added to any number of breakpoints, and each breakpoint
2034can have any number of breakpoint names attached to it. For instance:
2036 (lldb) break name add -N MyName 1-10
2038adds the name MyName to breakpoints 1-10, and:
2040 (lldb) break set -n myFunc -N Name1 -N Name2
2042adds two names to the breakpoint set at myFunc.
2044They have a number of interrelated uses:
20461) They provide a stable way to refer to a breakpoint (e.g. in another
2047breakpoint's action). Using the breakpoint ID for this purpose is fragile, since
2048it depends on the order of breakpoint creation. Giving a name to the breakpoint
2049you want to act on, and then referring to it by name, is more robust:
2051 (lldb) break set -n myFunc -N BKPT1
2052 (lldb) break set -n myOtherFunc -C "break disable BKPT1"
20542) This is actually just a specific use of a more general feature of breakpoint
2055names. The <breakpt-id-list> argument type used to specify one or more
2056breakpoints in most of the commands that deal with breakpoints also accepts
2057breakpoint names. That allows you to refer to one breakpoint in a stable
2058manner, but also makes them a convenient grouping mechanism, allowing you to
2059easily act on a group of breakpoints by using their name, for instance disabling
2060them all in one action:
2062 (lldb) break set -n myFunc -N Group1
2063 (lldb) break set -n myOtherFunc -N Group1
2064 (lldb) break disable Group1
20663) But breakpoint names are also entities in their own right, and can be
2067configured with all the modifiable attributes of a breakpoint. Then when you
2068add a breakpoint name to a breakpoint, the breakpoint will be configured to
2069match the state of the breakpoint name. The link between the name and the
2070breakpoints sharing it remains live, so if you change the configuration on the
2071name, it will also change the configurations on the breakpoints:
2073 (lldb) break name configure -i 10 IgnoreSome
2074 (lldb) break set -n myFunc -N IgnoreSome
2075 (lldb) break list IgnoreSome
2076 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 10 enabled
2079 (lldb) break name configure -i 5 IgnoreSome
2080 (lldb) break list IgnoreSome
2081 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 5 enabled
2085Options that are not configured on a breakpoint name don't affect the value of
2086those options on the breakpoints they are added to. So for instance, if Name1
2087has the -i option configured and Name2 the -c option, adding both names to a
2088breakpoint will set the -i option from Name1 and the -c option from Name2, and
2089the other options will be unaltered.
2091If you add multiple names to a breakpoint which have configured values for
2092the same option, the last name added's value wins.
2094The "liveness" of these settings is one way, from name to breakpoint.
2095If you use "break modify" to change an option that is also configured on a name
2096which that breakpoint has, the "break modify" command will override the setting
2097for that breakpoint, but won't change the value configured in the name or on the
2098other breakpoints sharing that name.
21004) Breakpoint names are also a convenient way to copy option sets from one
2101breakpoint to another. Using the -B option to "breakpoint name configure" makes
2102a name configured with all the options of the original breakpoint. Then
2103adding that name to another breakpoint copies over all the values from the
2104original breakpoint to the new one.
21065) You can also use breakpoint names to hide breakpoints from the breakpoint
2107operations that act on all breakpoints: "break delete", "break disable" and
2108"break list". You do that by specifying a "false" value for the
2109--allow-{list,delete,disable} options to "breakpoint name configure" and then
2110adding that name to a breakpoint.
2112This won't keep the breakpoint from being deleted or disabled if you refer to it
2113specifically by ID. The point of the feature is to make sure users don't
2114inadvertently delete or disable useful breakpoints (e.g. ones an IDE is using
2115for its own purposes) as part of a "delete all" or "disable all" operation. The
2116list hiding is because it's confusing for people to see breakpoints they
2120 CommandObjectSP add_command_object(
2122 CommandObjectSP delete_command_object(
2124 CommandObjectSP list_command_object(
2126 CommandObjectSP configure_command_object(
2139#pragma mark Read::CommandOptions
2140#define LLDB_OPTIONS_breakpoint_read
2141#include "CommandOptions.inc"
2149 "Read and set the breakpoints previously saved to "
2150 "a file with \"breakpoint write\". ",
2168 switch (short_option) {
2176 error.SetErrorStringWithFormat(
"Invalid breakpoint name: %s",
2179 m_names.push_back(std::string(option_arg));
2183 llvm_unreachable(
"Unimplemented option");
2195 return llvm::ArrayRef(g_breakpoint_read_options);
2201 int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
2202 int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
2212 std::optional<FileSpec> file_spec;
2213 const llvm::StringRef dash_f(
"-f");
2214 for (
int arg_idx = 0; arg_idx < opt_arg_pos; arg_idx++) {
2228 if (!
error.Success())
2235 const size_t num_bkpts = bkpt_array->
GetSize();
2236 for (
size_t i = 0; i < num_bkpts; i++) {
2239 if (!bkpt_object_sp)
2261 size_t num_names = names_array->
GetSize();
2263 for (
size_t i = 0; i < num_names; i++) {
2264 llvm::StringRef name;
2280 std::unique_lock<std::recursive_mutex> lock;
2289 if (!
error.Success()) {
2296 size_t num_breakpoints = new_bps.
GetSize();
2297 if (num_breakpoints == 0) {
2302 for (
size_t i = 0; i < num_breakpoints; ++i) {
2320#pragma mark Write::CommandOptions
2321#define LLDB_OPTIONS_breakpoint_write
2322#include "CommandOptions.inc"
2329 "Write the breakpoints listed to a file that can "
2330 "be read in with \"breakpoint read\". "
2331 "If given no arguments, writes all breakpoints.",
2364 switch (short_option) {
2372 llvm_unreachable(
"Unimplemented option");
2384 return llvm::ArrayRef(g_breakpoint_write_options);
2397 std::unique_lock<std::recursive_mutex> lock;
2401 if (!command.
empty()) {
2403 command, &target, result, &valid_bp_ids,
2404 BreakpointName::Permissions::PermissionKinds::listPerm);
2415 if (!
error.Success()) {
2427#pragma mark MultiwordBreakpoint
2432 interpreter,
"breakpoint",
2433 "Commands for operating on breakpoints (see 'help b' for shorthand.)",
2434 "breakpoint <subcommand> [<command-options>]") {
2435 CommandObjectSP list_command_object(
2437 CommandObjectSP enable_command_object(
2439 CommandObjectSP disable_command_object(
2441 CommandObjectSP clear_command_object(
2443 CommandObjectSP delete_command_object(
2445 CommandObjectSP set_command_object(
2447 CommandObjectSP command_command_object(
2449 CommandObjectSP modify_command_object(
2451 CommandObjectSP name_command_object(
2453 CommandObjectSP write_command_object(
2455 CommandObjectSP read_command_object(
2458 list_command_object->SetCommandName(
"breakpoint list");
2459 enable_command_object->SetCommandName(
"breakpoint enable");
2460 disable_command_object->SetCommandName(
"breakpoint disable");
2461 clear_command_object->SetCommandName(
"breakpoint clear");
2462 delete_command_object->SetCommandName(
"breakpoint delete");
2463 set_command_object->SetCommandName(
"breakpoint set");
2464 command_command_object->SetCommandName(
"breakpoint command");
2465 modify_command_object->SetCommandName(
"breakpoint modify");
2466 name_command_object->SetCommandName(
"breakpoint name");
2467 write_command_object->SetCommandName(
"breakpoint write");
2468 read_command_object->SetCommandName(
"breakpoint read");
2486 Args &args,
Target *target,
bool allow_locations,
2488 BreakpointName::Permissions ::PermissionKinds purpose) {
2509 "No breakpoint specified and no last created breakpoint.");
2521 purpose, result, temp_args);
2536 const size_t count = valid_ids->
GetSize();
2537 for (
size_t i = 0; i < count; ++i) {
2541 if (breakpoint !=
nullptr) {
2543 if (
static_cast<size_t>(cur_bp_id.
GetLocationID()) > num_locations) {
2549 "'%s' is not a currently valid breakpoint/location id.\n",
2555 "'%d' is not a currently valid breakpoint ID.\n",
static void AddBreakpointDescription(Stream *s, Breakpoint *bp, lldb::DescriptionLevel level)
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
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
Options * GetOptions() override
CommandObjectBreakpointClear(CommandInterpreter &interpreter)
~CommandObjectBreakpointClear() override=default
bool DoExecute(Args &command, CommandReturnObject &result) override
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 input array contains a parsed version of the line.
Options * GetOptions() override
bool DoExecute(Args &command, CommandReturnObject &result) override
bool DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointDisable() override=default
CommandObjectBreakpointDisable(CommandInterpreter &interpreter)
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandObjectBreakpointEnable() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointEnable(CommandInterpreter &interpreter)
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
bool DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointList() override=default
Options * GetOptions() override
CommandObjectBreakpointList(CommandInterpreter &interpreter)
BreakpointDummyOptionGroup m_dummy_opts
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
CommandObjectBreakpointModify(CommandInterpreter &interpreter)
BreakpointOptionGroup m_bp_opts
~CommandObjectBreakpointModify() override=default
OptionGroupOptions m_options
bool DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
OptionGroupOptions m_option_group
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointNameAdd(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointNameAdd() override=default
BreakpointNameOptionGroup m_name_options
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
BreakpointNameOptionGroup m_name_options
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
CommandObjectBreakpointNameDelete(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointNameDelete() override=default
OptionGroupOptions m_option_group
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointNameList(CommandInterpreter &interpreter)
Options * GetOptions() override
OptionGroupOptions m_option_group
~CommandObjectBreakpointNameList() override=default
bool DoExecute(Args &command, CommandReturnObject &result) override
BreakpointNameOptionGroup m_name_options
~CommandObjectBreakpointName() override=default
CommandObjectBreakpointName(CommandInterpreter &interpreter)
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
bool 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
bool DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointSet() override=default
BreakpointOptionGroup m_bp_opts
bool GetDefaultFile(Target &target, FileSpec &file, CommandReturnObject &result)
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.
Options * GetOptions() override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
CommandObjectBreakpointWrite(CommandInterpreter &interpreter)
~CommandObjectBreakpointWrite() override=default
bool DoExecute(Args &command, CommandReturnObject &result) override
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.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
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.
void Clear()
Clear the arguments.
const BreakpointID & GetBreakpointIDAtIndex(size_t index) const
static void FindAndReplaceIDRanges(Args &old_args, Target *target, bool allow_locations, BreakpointName::Permissions ::PermissionKinds purpose, CommandReturnObject &result, Args &new_args)
bool AddBreakpointID(BreakpointID bp_id)
bool FindBreakpointID(BreakpointID &bp_id, size_t *position) const
void InsertStringArray(llvm::ArrayRef< const char * > string_array, CommandReturnObject &result)
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,...
BreakpointOptions & GetLocationOptions()
Use this to set location specific breakpoint options.
void SetEnabled(bool enabled)
If enabled is true, enable the breakpoint, if false disable it.
bool SetAllowDisable(bool value)
bool SetAllowList(bool value)
bool SetAllowDelete(bool value)
bool GetDescription(Stream *s, lldb::DescriptionLevel level)
void SetHelp(const char *description)
BreakpointOptions & GetOptions()
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...
Flags m_set_flags
Which options are set at this level.
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
void SetEnabled(bool enabled)
If enable is true, enable the breakpoint, if false disable it.
void SetCondition(const char *condition)
Set the breakpoint option's condition.
ThreadSpec * GetThreadSpec()
Returns a pointer to the ThreadSpec for this option, creating it.
void SetOneShot(bool one_shot)
If enable is true, enable the breakpoint, if false disable it.
void SetAutoContinue(bool auto_continue)
Set the auto-continue state.
void SetThreadID(lldb::tid_t thread_id)
void CopyOverSetOptions(const BreakpointOptions &rhs)
Copy over only the options set in the incoming BreakpointOptions.
void SetCommandDataCallback(std::unique_ptr< CommandData > &cmd_data)
Set a callback based on BreakpointOptions::CommandData.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
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.
static const char * GetSerializationKey()
bool GetMatchingFileLine(ConstString filename, uint32_t line_number, BreakpointLocationCollection &loc_coll)
Find breakpoint locations which match the (filename, line_number) description.
lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id)
Find a breakpoint location for a given breakpoint location ID.
size_t GetNumLocations() const
Return the number of breakpoint locations.
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)
bool Confirm(llvm::StringRef message, bool default_answer)
static void VerifyBreakpointOrLocationIDs(Args &args, Target *target, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions ::PermissionKinds purpose)
static void VerifyIDs(Args &args, Target *target, bool allow_locations, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions::PermissionKinds purpose)
CommandObjectMultiwordBreakpoint(CommandInterpreter &interpreter)
~CommandObjectMultiwordBreakpoint() override
static void VerifyBreakpointIDs(Args &args, Target *target, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions::PermissionKinds purpose)
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
std::vector< CommandArgumentData > CommandArgumentEntry
virtual void SetHelpLong(llvm::StringRef str)
static void AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange)
Target & GetDummyTarget()
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
void AppendErrorWithFormatv(const char *format, Args &&... args)
void AppendMessage(llvm::StringRef in_string)
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendMessageWithFormat(const char *format,...) __attribute__((format(printf
void void AppendWarning(llvm::StringRef in_string)
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 uniqued constant string class.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
const FileSpec * GetFileSpecPointerAtIndex(size_t idx) const
Get file specification pointer at index.
void Clear()
Clears the file list.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
size_t GetSize() const
Get the number of files in the file list.
bool AppendIfUnique(const FileSpec &file)
Append a FileSpec object if unique.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
static FileSystem & Instance()
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
void Append(OptionGroup *group)
Append options from a OptionGroup class.
const std::string & GetName()
const StructuredData::DictionarySP GetStructuredData()
void SetDefaultValue(bool value)
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
bool GetCurrentValue() const
uint32_t GetColumnNumber()
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
const char * GetCurrentValue() const
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
bool OptionWasSet() const
std::optional< T > GetValueAs() const
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.
bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line)
This base class provides an interface to stack frames.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
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.
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
bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result) const
ObjectSP GetValueForKey(llvm::StringRef key) const
bool GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
Dictionary * GetAsDictionary()
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::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec *file_spec, bool request_hardware)
void DisableAllowedBreakpoints()
bool RemoveBreakpointByID(lldb::break_id_t break_id)
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
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 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)
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
lldb::BreakpointSP GetLastCreatedBreakpoint()
void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error)
void SetIndex(uint32_t index)
void SetName(llvm::StringRef name)
void SetQueueName(llvm::StringRef queue_name)
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelInitial
@ eDescriptionLevelVerbose
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus_14
ISO C++:2014.
@ eLanguageTypeC11
ISO C:2011.
@ eLanguageTypeC99
ISO C:1999.
@ eLanguageTypeC_plus_plus_03
ISO C++:2003.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeC_plus_plus_11
ISO C++:2011.
@ eLanguageTypeC89
ISO C:1989.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeBreakpointIDRange
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type
FileSpec file
The source file, possibly mapped by the target.source-map setting.
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)