31#include "llvm/Support/FormatAdapters.h"
49#pragma mark Modify::CommandOptions
50#define LLDB_OPTIONS_breakpoint_modify
51#include "CommandOptions.inc"
60 return llvm::ArrayRef(g_breakpoint_modify_options);
66 const int short_option =
67 g_breakpoint_modify_options[option_idx].short_option;
68 const char *long_option =
69 g_breakpoint_modify_options[option_idx].long_option;
71 switch (short_option) {
75 m_bp_opts.GetCondition().SetText(option_arg.str());
98 uint32_t ignore_count;
99 if (option_arg.getAsInteger(0, ignore_count))
118 if (option_arg ==
"current") {
119 if (!execution_context) {
121 option_arg, short_option, long_option,
122 "No context to determine current thread"));
125 if (!ctx_thread_sp || !ctx_thread_sp->IsValid()) {
128 "No currently selected thread"));
130 thread_id = ctx_thread_sp->GetID();
133 }
else if (option_arg.getAsInteger(0, thread_id)) {
142 m_bp_opts.GetThreadSpec()->SetName(option_arg.str().c_str());
145 m_bp_opts.GetThreadSpec()->SetQueueName(option_arg.str().c_str());
149 if (option_arg.getAsInteger(0, thread_index)) {
154 m_bp_opts.GetThreadSpec()->SetIndex(thread_index);
164 option_arg, short_option, long_option,
"invalid language"));
165 else if (!languages_for_expressions[language])
168 "no expression support for language"));
170 m_bp_opts.GetCondition().SetLanguage(language);
173 llvm_unreachable(
"Unimplemented option");
186 auto cmd_data = std::make_unique<BreakpointOptions::CommandData>();
189 cmd_data->user_source.AppendString(str);
191 cmd_data->stop_on_error =
true;
192 m_bp_opts.SetCommandDataCallback(cmd_data);
203#define LLDB_OPTIONS_breakpoint_dummy
204#include "CommandOptions.inc"
213 return llvm::ArrayRef(g_breakpoint_dummy_options);
219 const int short_option =
220 g_breakpoint_dummy_options[option_idx].short_option;
222 switch (short_option) {
227 llvm_unreachable(
"Unimplemented option");
240#define LLDB_OPTIONS_breakpoint_set
241#include "CommandOptions.inc"
260 interpreter,
"breakpoint set",
261 "Sets a breakpoint or set of breakpoints in the executable.",
262 "breakpoint set <cmd-options>"),
288 const int short_option =
289 g_breakpoint_set_options[option_idx].short_option;
290 const char *long_option =
291 g_breakpoint_set_options[option_idx].long_option;
293 switch (short_option) {
309 if (option_arg.getAsInteger(0,
m_column))
318 llvm::StringRef error_context;
334 "Set exception breakpoints separately for c++ and objective-c";
337 error_context =
"Unknown language type for exception breakpoint";
341 if (languagePlugin->SupportsExceptionBreakpointsOnThrow() ||
342 languagePlugin->SupportsExceptionBreakpointsOnCatch()) {
347 error_context =
"Unsupported language type for exception breakpoint";
349 if (!error_context.empty())
351 option_arg, short_option, long_option, error_context));
438 "Invalid breakpoint name"));
445 option_arg, 0, &
error);
491 option_arg, short_option, long_option, fcl_err.
AsCString()));
500 llvm_unreachable(
"Unimplemented option");
532 return llvm::ArrayRef(g_breakpoint_set_options);
586 else if (!
m_options.m_func_names.empty())
588 else if (!
m_options.m_func_regexp.empty())
590 else if (!
m_options.m_source_text_regexp.empty())
597 const bool internal =
false;
605 switch (break_type) {
609 const size_t num_files =
m_options.m_filenames.GetSize();
610 if (num_files == 0) {
612 result.
AppendError(
"no file supplied and no default file available");
615 }
else if (num_files > 1) {
616 result.
AppendError(
"only one file at a time is allowed for file and "
620 file =
m_options.m_filenames.GetFileSpecAtIndex(0);
637 size_t num_modules_specified =
m_options.m_modules.GetSize();
638 if (num_modules_specified == 1) {
640 m_options.m_modules.GetFileSpecAtIndex(0);
643 }
else if (num_modules_specified == 0) {
647 result.
AppendError(
"Only one shared library can be specified for "
648 "address breakpoints.");
655 FunctionNameType name_type_mask =
m_options.m_func_name_type_mask;
657 if (name_type_mask == 0)
658 name_type_mask = eFunctionNameTypeAuto;
671 if (llvm::Error err = regexp.
GetError()) {
673 "Function name regular expression could not be compiled: %s",
674 llvm::toString(std::move(err)).c_str());
681 "Function name regex does not accept glob patterns.");
693 const size_t num_files =
m_options.m_filenames.GetSize();
695 if (num_files == 0 && !
m_options.m_all_files) {
699 "No files provided and could not find default file.");
707 if (llvm::Error err = regexp.
GetError()) {
709 "Source text regular expression could not be compiled: \"%s\"",
710 llvm::toString(std::move(err)).c_str());
715 m_options.m_source_regex_func_names, std::move(regexp), internal,
724 if (precond_error.
Fail()) {
726 "Error setting extra exception arguments: %s",
741 "Error setting extra exception arguments: %s",
error.AsCString());
752 bp_sp->GetOptions().CopyOverSetOptions(
m_bp_opts.GetBreakpointOptions());
754 if (!
m_options.m_breakpoint_names.empty()) {
756 for (
auto name :
m_options.m_breakpoint_names) {
758 if (name_error.
Fail()) {
770 const bool show_locations =
false;
774 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
775 "into future targets.\n");
781 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
782 "actual locations.\n");
787 result.
AppendError(
"breakpoint creation failed: no breakpoint created");
796 if (
auto maybe_file_and_line =
798 file = maybe_file_and_line->support_file_sp->GetSpecOnly();
803 if (cur_frame ==
nullptr) {
805 "No selected frame to use to find the default file.");
809 result.
AppendError(
"Cannot use the selected frame to find the default "
810 "file, it has no debug info.");
819 result.
AppendError(
"Can't find the file for the selected frame to "
820 "use as the default file.");
840 "Modify the options on a breakpoint or set of "
841 "breakpoints in the executable. "
842 "If no breakpoint is specified, acts on the last "
843 "created breakpoint. "
844 "With the exception of -e, -d and -i, passing an "
845 "empty argument clears the modification.",
871 std::unique_lock<std::recursive_mutex> lock;
877 command, target, result, &valid_bp_ids,
881 const size_t count = valid_bp_ids.
GetSize();
882 for (
size_t i = 0; i < count; ++i) {
916 "Enable the specified disabled breakpoint(s). If "
917 "no breakpoints are specified, enable all of them.",
935 std::unique_lock<std::recursive_mutex> lock;
940 size_t num_breakpoints = breakpoints.
GetSize();
942 if (num_breakpoints == 0) {
943 result.
AppendError(
"no breakpoints exist to be enabled");
947 if (command.
empty()) {
952 (uint64_t)num_breakpoints);
958 command, target, result, &valid_bp_ids,
962 int enable_count = 0;
964 const size_t count = valid_bp_ids.
GetSize();
965 for (
size_t i = 0; i < count; ++i) {
977 "failed to enable breakpoint location: {0}",
978 llvm::fmt_consume(std::move(
error)));
988 enable_count + loc_count);
1002 interpreter,
"breakpoint disable",
1003 "Disable the specified breakpoint(s) without deleting "
1004 "them. If none are specified, disable all "
1008 "Disable the specified breakpoint(s) without deleting them. \
1009If none are specified, disable all breakpoints."
1013 "Note: disabling a breakpoint will cause none of its locations to be hit \
1014regardless of whether individual locations are enabled or disabled. After the sequence:"
1017 (lldb) break disable 1
1018 (lldb) break enable 1.1
1020execution will NOT stop at location 1.1. To achieve that, type:
1022 (lldb) break disable 1.*
1023 (lldb) break enable 1.1
1026 "The first command disables all locations for breakpoint 1, \
1027the second re-enables the first location.");
1042 void DoExecute(Args &command, CommandReturnObject &result)
override {
1044 std::unique_lock<std::recursive_mutex> lock;
1048 size_t num_breakpoints = breakpoints.
GetSize();
1050 if (num_breakpoints == 0) {
1051 result.
AppendError(
"no breakpoints exist to be disabled");
1055 if (command.
empty()) {
1060 (uint64_t)num_breakpoints);
1064 BreakpointIDList valid_bp_ids;
1067 command, target, result, &valid_bp_ids,
1068 BreakpointName::Permissions::PermissionKinds::disablePerm);
1071 int disable_count = 0;
1073 const size_t count = valid_bp_ids.
GetSize();
1074 for (
size_t i = 0; i < count; ++i) {
1078 Breakpoint *breakpoint =
1081 BreakpointLocation *location =
1086 "failed to disable breakpoint location: {0}",
1087 llvm::fmt_consume(std::move(
error)));
1097 disable_count + loc_count);
1106#pragma mark List::CommandOptions
1107#define LLDB_OPTIONS_breakpoint_list
1108#include "CommandOptions.inc"
1116 interpreter,
"breakpoint list",
1117 "List some or all breakpoints at configurable levels of detail.",
1140 switch (short_option) {
1157 llvm_unreachable(
"Unimplemented option");
1170 return llvm::ArrayRef(g_breakpoint_list_options);
1187 std::unique_lock<std::recursive_mutex> lock;
1190 size_t num_breakpoints = breakpoints.
GetSize();
1192 if (num_breakpoints == 0) {
1200 if (command.
empty()) {
1203 for (
size_t i = 0; i < num_breakpoints; ++i) {
1214 command, target, result, &valid_bp_ids,
1218 for (
size_t i = 0; i < valid_bp_ids.
GetSize(); ++i) {
1237#pragma mark Clear::CommandOptions
1239#define LLDB_OPTIONS_breakpoint_clear
1240#include "CommandOptions.inc"
1250 "Delete or disable breakpoints matching the "
1251 "specified source file and line.",
1252 "breakpoint clear <cmd-options>") {}
1269 switch (short_option) {
1279 llvm_unreachable(
"Unimplemented option");
1291 return llvm::ArrayRef(g_breakpoint_clear_options);
1313 std::unique_lock<std::recursive_mutex> lock;
1317 size_t num_breakpoints = breakpoints.
GetSize();
1320 if (num_breakpoints == 0) {
1321 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
1328 std::vector<break_id_t> BreakIDs;
1329 for (
size_t i = 0; i < num_breakpoints; ++i)
1332 int num_cleared = 0;
1334 switch (break_type) {
1340 for (
size_t i = 0; i < num_breakpoints; ++i) {
1346 if (loc_coll.
GetSize() == 0) {
1360 if (num_cleared > 0) {
1362 output_stream.
Printf(
"%d breakpoints cleared:\n", num_cleared);
1364 output_stream.
EOL();
1367 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
1376#define LLDB_OPTIONS_breakpoint_delete
1377#include "CommandOptions.inc"
1385 "Delete the specified breakpoint(s). If no "
1386 "breakpoints are specified, delete them all.",
1413 switch (short_option) {
1427 llvm_unreachable(
"Unimplemented option");
1440 return llvm::ArrayRef(g_breakpoint_delete_options);
1454 std::unique_lock<std::recursive_mutex> lock;
1459 size_t num_breakpoints = breakpoints.
GetSize();
1461 if (num_breakpoints == 0) {
1462 result.
AppendError(
"no breakpoints exist to be deleted");
1470 "About to delete all breakpoints, do you want to do that?",
1476 "All breakpoints removed. (%" PRIu64
" breakpoint%s)\n",
1477 (uint64_t)num_breakpoints, num_breakpoints > 1 ?
"s" :
"");
1491 if (!command.
empty()) {
1493 command, target, result, &excluded_bp_ids,
1499 for (
auto breakpoint_sp : breakpoints.
Breakpoints()) {
1500 if (!breakpoint_sp->IsEnabled() && breakpoint_sp->AllowDelete()) {
1502 if (!excluded_bp_ids.
Contains(bp_id))
1506 if (valid_bp_ids.
GetSize() == 0) {
1512 command, target, result, &valid_bp_ids,
1518 int delete_count = 0;
1519 int disable_count = 0;
1520 const size_t count = valid_bp_ids.
GetSize();
1521 for (
size_t i = 0; i < count; ++i) {
1535 "failed to disable breakpoint location: {0}",
1536 llvm::fmt_consume(std::move(
error)));
1546 "%d breakpoints deleted; %d breakpoint locations disabled.\n",
1547 delete_count, disable_count);
1556#define LLDB_OPTIONS_breakpoint_name
1557#include "CommandOptions.inc"
1567 return llvm::ArrayRef(g_breakpoint_name_options);
1573 const int short_option = g_breakpoint_name_options[option_idx].short_option;
1574 const char *long_option = g_breakpoint_name_options[option_idx].long_option;
1576 switch (short_option) {
1580 m_name.SetValueFromString(option_arg);
1583 if (
m_breakpoint.SetValueFromString(option_arg).Fail())
1589 if (
m_use_dummy.SetValueFromString(option_arg).Fail())
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;
1635 const char *long_option =
1636 g_breakpoint_access_options[option_idx].long_option;
1638 switch (short_option) {
1640 bool value, success;
1650 bool value, success;
1660 bool value, success;
1670 llvm_unreachable(
"Unimplemented option");
1688 interpreter,
"configure",
1689 "Configure the options for the breakpoint"
1691 "If you provide a breakpoint id, the options will be copied from "
1692 "the breakpoint, otherwise only the options specified will be set "
1694 "breakpoint name configure <command-options> "
1695 "<breakpoint-name-list>") {
1721 std::unique_lock<std::recursive_mutex> lock;
1725 for (
auto &entry : command.
entries()) {
1729 entry.c_str(),
error.AsCString());
1736 if (
m_bp_id.m_breakpoint.OptionWasSet()) {
1738 m_bp_id.m_breakpoint.GetValueAs<uint64_t>().value_or(0);
1748 for (
auto &entry : command.
entries()) {
1753 if (
m_bp_id.m_help_string.OptionWasSet())
1754 bp_name->
SetHelp(
m_bp_id.m_help_string.GetValueAs<llvm::StringRef>()
1780 interpreter,
"add",
"Add a name to the breakpoints provided.",
1781 "breakpoint name add <command-options> <breakpoint-id-list>") {
1809 std::unique_lock<std::recursive_mutex> lock;
1814 size_t num_breakpoints = breakpoints.
GetSize();
1815 if (num_breakpoints == 0) {
1816 result.
AppendError(
"no breakpoints, cannot add names");
1823 command, target, result, &valid_bp_ids,
1827 if (valid_bp_ids.
GetSize() == 0) {
1828 result.
AppendError(
"no breakpoints specified, cannot add names");
1831 size_t num_valid_ids = valid_bp_ids.
GetSize();
1835 for (
size_t index = 0; index < num_valid_ids; index++) {
1853 interpreter,
"delete",
1854 "Delete a name from the breakpoints provided.",
1855 "breakpoint name delete <command-options> <breakpoint-id-list>") {
1883 std::unique_lock<std::recursive_mutex> lock;
1888 size_t num_breakpoints = breakpoints.
GetSize();
1889 if (num_breakpoints == 0) {
1890 result.
AppendError(
"no breakpoints, cannot delete names");
1897 command, target, result, &valid_bp_ids,
1901 if (valid_bp_ids.
GetSize() == 0) {
1902 result.
AppendError(
"no breakpoints specified, cannot delete names");
1906 size_t num_valid_ids = valid_bp_ids.
GetSize();
1907 for (
size_t index = 0; index < num_valid_ids; index++) {
1925 "List either the names for a breakpoint or info "
1926 "about a given name. With no arguments, lists all "
1928 "breakpoint name list <command-options>") {
1942 std::vector<std::string> name_list;
1943 if (command.
empty()) {
1947 name_list.push_back(arg.c_str());
1951 if (name_list.empty()) {
1954 for (
const std::string &name_str : name_list) {
1955 const char *name = name_str.c_str();
1967 std::unique_lock<std::recursive_mutex> lock;
1971 bool any_set =
false;
1973 if (bp_sp->MatchesName(name)) {
2000 interpreter,
"name",
"Commands to manage breakpoint names") {
2005Breakpoint names provide a general tagging mechanism for breakpoints. Each
2006breakpoint name can be added to any number of breakpoints, and each breakpoint
2007can have any number of breakpoint names attached to it. For instance:
2009 (lldb) break name add -N MyName 1-10
2011adds the name MyName to breakpoints 1-10, and:
2013 (lldb) break set -n myFunc -N Name1 -N Name2
2015adds two names to the breakpoint set at myFunc.
2017They have a number of interrelated uses:
20191) They provide a stable way to refer to a breakpoint (e.g. in another
2020breakpoint's action). Using the breakpoint ID for this purpose is fragile, since
2021it depends on the order of breakpoint creation. Giving a name to the breakpoint
2022you want to act on, and then referring to it by name, is more robust:
2024 (lldb) break set -n myFunc -N BKPT1
2025 (lldb) break set -n myOtherFunc -C "break disable BKPT1"
20272) This is actually just a specific use of a more general feature of breakpoint
2028names. The <breakpt-id-list> argument type used to specify one or more
2029breakpoints in most of the commands that deal with breakpoints also accepts
2030breakpoint names. That allows you to refer to one breakpoint in a stable
2031manner, but also makes them a convenient grouping mechanism, allowing you to
2032easily act on a group of breakpoints by using their name, for instance disabling
2033them all in one action:
2035 (lldb) break set -n myFunc -N Group1
2036 (lldb) break set -n myOtherFunc -N Group1
2037 (lldb) break disable Group1
20393) But breakpoint names are also entities in their own right, and can be
2040configured with all the modifiable attributes of a breakpoint. Then when you
2041add a breakpoint name to a breakpoint, the breakpoint will be configured to
2042match the state of the breakpoint name. The link between the name and the
2043breakpoints sharing it remains live, so if you change the configuration on the
2044name, it will also change the configurations on the breakpoints:
2046 (lldb) break name configure -i 10 IgnoreSome
2047 (lldb) break set -n myFunc -N IgnoreSome
2048 (lldb) break list IgnoreSome
2049 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 10 enabled
2052 (lldb) break name configure -i 5 IgnoreSome
2053 (lldb) break list IgnoreSome
2054 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 5 enabled
2058Options that are not configured on a breakpoint name don't affect the value of
2059those options on the breakpoints they are added to. So for instance, if Name1
2060has the -i option configured and Name2 the -c option, adding both names to a
2061breakpoint will set the -i option from Name1 and the -c option from Name2, and
2062the other options will be unaltered.
2064If you add multiple names to a breakpoint which have configured values for
2065the same option, the last name added's value wins.
2067The "liveness" of these settings is one way, from name to breakpoint.
2068If you use "break modify" to change an option that is also configured on a name
2069which that breakpoint has, the "break modify" command will override the setting
2070for that breakpoint, but won't change the value configured in the name or on the
2071other breakpoints sharing that name.
20734) Breakpoint names are also a convenient way to copy option sets from one
2074breakpoint to another. Using the -B option to "breakpoint name configure" makes
2075a name configured with all the options of the original breakpoint. Then
2076adding that name to another breakpoint copies over all the values from the
2077original breakpoint to the new one.
20795) You can also use breakpoint names to hide breakpoints from the breakpoint
2080operations that act on all breakpoints: "break delete", "break disable" and
2081"break list". You do that by specifying a "false" value for the
2082--allow-{list,delete,disable} options to "breakpoint name configure" and then
2083adding that name to a breakpoint.
2085This won't keep the breakpoint from being deleted or disabled if you refer to it
2086specifically by ID. The point of the feature is to make sure users don't
2087inadvertently delete or disable useful breakpoints (e.g. ones an IDE is using
2088for its own purposes) as part of a "delete all" or "disable all" operation. The
2089list hiding is because it's confusing for people to see breakpoints they
2112#pragma mark Read::CommandOptions
2113#define LLDB_OPTIONS_breakpoint_read
2114#include "CommandOptions.inc"
2122 "Read and set the breakpoints previously saved to "
2123 "a file with \"breakpoint write\". ",
2140 const char *long_option =
2143 switch (short_option) {
2152 option_arg, short_option, long_option, name_error.
AsCString()));
2154 m_names.push_back(std::string(option_arg));
2158 llvm_unreachable(
"Unimplemented option");
2170 return llvm::ArrayRef(g_breakpoint_read_options);
2176 int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
2177 int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
2186 std::optional<FileSpec> file_spec;
2187 const llvm::StringRef dash_f(
"-f");
2188 for (
int arg_idx = 0; arg_idx < opt_arg_pos; arg_idx++) {
2202 if (!
error.Success())
2209 const size_t num_bkpts = bkpt_array->
GetSize();
2210 for (
size_t i = 0; i < num_bkpts; i++) {
2213 if (!bkpt_object_sp)
2235 size_t num_names = names_array->
GetSize();
2237 for (
size_t i = 0; i < num_names; i++) {
2238 if (std::optional<llvm::StringRef> maybe_name =
2254 std::unique_lock<std::recursive_mutex> lock;
2263 if (!
error.Success()) {
2270 size_t num_breakpoints = new_bps.
GetSize();
2271 if (num_breakpoints == 0) {
2276 for (
size_t i = 0; i < num_breakpoints; ++i) {
2293#pragma mark Write::CommandOptions
2294#define LLDB_OPTIONS_breakpoint_write
2295#include "CommandOptions.inc"
2302 "Write the breakpoints listed to a file that can "
2303 "be read in with \"breakpoint read\". "
2304 "If given no arguments, writes all breakpoints.",
2331 switch (short_option) {
2339 llvm_unreachable(
"Unimplemented option");
2351 return llvm::ArrayRef(g_breakpoint_write_options);
2364 std::unique_lock<std::recursive_mutex> lock;
2368 if (!command.
empty()) {
2370 command, target, result, &valid_bp_ids,
2382 if (!
error.Success()) {
2393#pragma mark MultiwordBreakpoint
2398 interpreter,
"breakpoint",
2399 "Commands for operating on breakpoints (see 'help b' for shorthand.)",
2400 "breakpoint <subcommand> [<command-options>]") {
2424 list_command_object->SetCommandName(
"breakpoint list");
2425 enable_command_object->SetCommandName(
"breakpoint enable");
2426 disable_command_object->SetCommandName(
"breakpoint disable");
2427 clear_command_object->SetCommandName(
"breakpoint clear");
2428 delete_command_object->SetCommandName(
"breakpoint delete");
2429 set_command_object->SetCommandName(
"breakpoint set");
2430 command_command_object->SetCommandName(
"breakpoint command");
2431 modify_command_object->SetCommandName(
"breakpoint modify");
2432 name_command_object->SetCommandName(
"breakpoint name");
2433 write_command_object->SetCommandName(
"breakpoint write");
2434 read_command_object->SetCommandName(
"breakpoint read");
2452 Args &args,
Target &target,
bool allow_locations,
2454 BreakpointName::Permissions ::PermissionKinds purpose) {
2475 "No breakpoint specified and no last created breakpoint.");
2487 args, &target, allow_locations, purpose, temp_args)) {
2507 const size_t count = valid_ids->
GetSize();
2508 for (
size_t i = 0; i < count; ++i) {
2512 if (breakpoint !=
nullptr) {
2521 "'%s' is not a currently valid breakpoint/location id.\n",
2527 "'%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
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)
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
bool GetDefaultFile(Target &target, FileSpec &file, CommandReturnObject &result)
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 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)
BreakpointID GetBreakpointIDAtIndex(size_t index) const
static llvm::Error FindAndReplaceIDRanges(Args &old_args, Target *target, bool allow_locations, BreakpointName::Permissions ::PermissionKinds purpose, Args &new_args)
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)
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...
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...
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.
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)
static void VerifyIDs(Args &args, Target &target, bool allow_locations, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions::PermissionKinds purpose)
static void VerifyBreakpointOrLocationIDs(Args &args, Target &target, 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
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)
virtual void SetHelpLong(llvm::StringRef str)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
Target & GetDummyTarget()
ExecutionContext m_exe_ctx
void AddIDsArgumentData(IDType type)
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
void AppendMessage(llvm::StringRef in_string)
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void SetError(Status error)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendMessageWithFormat(const char *format,...) __attribute__((format(printf
void 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 uniqued constant string class.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
static FileSystem & Instance()
static Language * FindPlugin(lldb::LanguageType language)
static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions()
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
uint32_t GetColumnNumber()
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
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.
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.
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
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()
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
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 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)
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
lldb::BreakpointSP GetLastCreatedBreakpoint()
#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
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
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.
@ 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.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
Used to build individual command argument lists.
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
const FileSpec & GetFile() const
Helper to access the file.
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)