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 llvm_unreachable(
"Unimplemented option");
218 auto cmd_data = std::make_unique<BreakpointOptions::CommandData>();
221 cmd_data->user_source.AppendString(str);
223 cmd_data->stop_on_error =
true;
224 m_bp_opts.SetCommandDataCallback(cmd_data);
238#define LLDB_OPTIONS_breakpoint_names
239#include "CommandOptions.inc"
248 return g_breakpoint_names_options;
254 const int short_option =
GetDefinitions()[option_idx].short_option;
255 const char *long_option =
GetDefinitions()[option_idx].long_option;
257 switch (short_option) {
264 "Invalid breakpoint name"));
282#define LLDB_OPTIONS_breakpoint_dummy
283#include "CommandOptions.inc"
292 return llvm::ArrayRef(g_breakpoint_dummy_options);
298 const int short_option =
299 g_breakpoint_dummy_options[option_idx].short_option;
301 switch (short_option) {
306 llvm_unreachable(
"Unimplemented option");
319#pragma mark AddAddress::CommandOptions
320#define LLDB_OPTIONS_breakpoint_add_address
321#include "CommandOptions.inc"
323#pragma mark Add Address
327 const std::vector<std::string> &bp_names,
329 assert(bp_sp &&
"CopyOverBreakpointOptions called with no breakpoint");
332 Target &target = bp_sp->GetTarget();
333 if (!bp_names.empty()) {
335 for (
auto name : bp_names) {
337 if (name_error.
Fail()) {
348static llvm::Expected<LanguageType>
350 char short_option =
'\0',
351 llvm::StringRef long_option = {}) {
352 llvm::Expected<LanguageType> exception_language =
354 if (!exception_language) {
355 std::string error_msg = llvm::toString(exception_language.takeError());
359 return exception_language;
368 std::string error_msg;
371 error.FromErrorString(
"Can't complete a line entry with no "
379 error.FromErrorStringWithFormatv(
"{0}/nCouldn't get default file for "
385 line_entry.
SetFile(default_file_spec);
394 "Add breakpoints by raw address", nullptr) {
420 const int short_option =
GetDefinitions()[option_idx].short_option;
421 const char *long_option =
GetDefinitions()[option_idx].long_option;
423 switch (short_option) {
434 "Only one shared library can be "
435 "specified for address breakpoints."));
439 llvm_unreachable(
"Unimplemented option");
451 return llvm::ArrayRef(g_breakpoint_add_address_options);
466 "can't set address breakpoints without a real target.");
470 const bool internal =
false;
475 bool has_module =
false;
476 if (
m_options.m_modules.GetSize() != 0) {
478 module_spec =
m_options.m_modules.GetFileSpecAtIndex(0);
483 std::vector<lldb::addr_t> bp_addrs;
491 arg_entry.ref(),
error);
494 bp_addrs.push_back(bp_load_addr);
496 for (
auto bp_addr : bp_addrs) {
499 bp_addr, internal, module_spec,
m_options.m_hardware);
515 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
527#pragma mark AddException::CommandOptions
528#define LLDB_OPTIONS_breakpoint_add_exception
529#include "CommandOptions.inc"
531#pragma mark Add Exception
537 interpreter,
"breakpoint add exception",
538 "Add breakpoints on language exceptions. If no language is "
539 "specified, break on exceptions for all supported languages",
565 const int short_option =
GetDefinitions()[option_idx].short_option;
567 switch (short_option) {
586 llvm_unreachable(
"Unimplemented option");
599 return llvm::ArrayRef(g_breakpoint_add_exception_options);
615 if (command.
size() == 0) {
617 }
else if (command.
size() > 1) {
619 "can only set exception breakpoints on one language at a time");
621 llvm::Expected<LanguageType> language =
624 exception_language = *language;
626 result.
SetError(language.takeError());
631 const bool internal =
false;
635 exception_language, catch_bp, throw_bp, internal,
636 &
m_options.m_exception_extra_args, &precond_error);
637 if (precond_error.
Fail()) {
639 "Error setting extra exception arguments: %s",
656 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
657 "into future targets.\n");
660 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
672#pragma mark AddFile::CommandOptions
673#define LLDB_OPTIONS_breakpoint_add_file
674#include "CommandOptions.inc"
682 interpreter,
"breakpoint add file",
683 "Add breakpoints on lines in specified source files", nullptr) {
693 arg1.push_back(linespec_arg);
701 arg2.push_back(linespec_arg);
730 const int short_option =
GetDefinitions()[option_idx].short_option;
731 const char *long_option =
GetDefinitions()[option_idx].long_option;
733 switch (short_option) {
739 if (option_arg.getAsInteger(0, line_num))
772 if (option_arg.getAsInteger(0, column_num))
816 option_arg, 0, &
error);
822 llvm_unreachable(
"Unimplemented option");
852 return llvm::ArrayRef(g_breakpoint_add_file_options);
867 bool internal =
false;
881 if (!this_arg.ref().getAsInteger(0, line_value)) {
884 std::string error_msg;
889 line_value, error_msg);
904 if (
m_options.m_line_specs.size() != 1) {
905 result.
AppendError(
"Can only make file and line breakpoints with one "
906 "specification at a time.");
928 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
929 "into future targets.\n");
934 if (bp_sp->GetNumLocations() == 0) {
935 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
936 "actual locations.\n");
941 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
953#pragma mark AddName::CommandOptions
954#define LLDB_OPTIONS_breakpoint_add_name
955#include "CommandOptions.inc"
963 "Add breakpoints matching function or symbol names",
990 const int short_option =
GetDefinitions()[option_idx].short_option;
991 const char *long_option =
GetDefinitions()[option_idx].long_option;
993 switch (short_option) {
1036 option_arg, 0, &
error);
1037 if (
error.Success())
1042 llvm_unreachable(
"Unimplemented option");
1059 return llvm::ArrayRef(g_breakpoint_add_name_options);
1075 const bool internal =
false;
1079 std::vector<std::string> func_names;
1081 func_names.push_back(this_arg.ref().str());
1091 if (func_names.size() != 1) {
1092 result.
AppendError(
"Can only set function regular expression "
1093 "breakpoints on one regex at a time.");
1096 std::string &func_regexp = func_names[0];
1098 if (llvm::Error err = regexp.
GetError()) {
1100 "Function name regular expression could not be compiled: %s",
1101 llvm::toString(std::move(err)).c_str());
1104 if (!func_regexp.empty()) {
1105 if (func_regexp[0] ==
'*' || func_regexp[0] ==
'?')
1107 "Function name regex does not accept glob patterns.");
1124 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1125 "into future targets.\n");
1127 if (bp_sp->GetNumLocations() == 0) {
1128 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1129 "actual locations.\n");
1134 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
1146#pragma mark AddPattern::CommandOptions
1147#define LLDB_OPTIONS_breakpoint_add_pattern
1148#include "CommandOptions.inc"
1150#pragma mark Add Pattern
1156 "Add breakpoints matching patterns in the source text",
1157 "breakpoint add pattern [options] -- <pattern>") {
1180 const int short_option =
GetDefinitions()[option_idx].short_option;
1181 const char *long_option =
GetDefinitions()[option_idx].long_option;
1183 switch (short_option) {
1223 llvm_unreachable(
"Unimplemented option");
1240 return llvm::ArrayRef(g_breakpoint_add_pattern_options);
1256 const bool internal =
false;
1260 if (command.empty()) {
1273 if (pattern.empty()) {
1282 const size_t num_files =
m_options.m_files.GetSize();
1284 if (num_files == 0 && !
m_options.m_all_files) {
1288 "No files provided and could not find default file.");
1296 if (llvm::Error err = regexp.
GetError()) {
1298 "Source text regular expression could not be compiled: \"%s\"",
1299 llvm::toString(std::move(err)).c_str());
1304 std::move(regexp), internal,
m_options.m_hardware,
1314 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1315 "into future targets.\n");
1320 if (bp_sp->GetNumLocations() == 0) {
1321 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1322 "actual locations.\n");
1327 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
1339#pragma mark AddScripted::CommandOptions
1340#define LLDB_OPTIONS_breakpoint_add_scripted
1341#include "CommandOptions.inc"
1343#pragma mark Add Scripted
1349 interpreter,
"breakpoint add scripted",
1350 "Add breakpoints using a scripted breakpoint resolver.", nullptr),
1376 const int short_option =
GetDefinitions()[option_idx].short_option;
1378 switch (short_option) {
1390 llvm_unreachable(
"Unimplemented option");
1403 return llvm::ArrayRef(g_breakpoint_add_scripted_options);
1425 "error setting extra exception arguments: %s",
error.AsCString());
1437 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1438 "into future targets.\n");
1443 if (bp_sp->GetNumLocations() == 0) {
1444 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1445 "actual locations.\n");
1450 result.
AppendError(
"breakpoint creation failed: No breakpoint created.");
1463#pragma mark Add::CommandOptions
1464#define LLDB_OPTIONS_breakpoint_add
1465#include "CommandOptions.inc"
1473 "Commands to add breakpoints of various types") {
1476Access the breakpoint search kernels built into lldb. Along with specifying the
1477search kernel, each breakpoint add operation can specify a common set of
1478"reaction" options for each breakpoint. The reaction options can also be
1479modified after breakpoint creation using the "breakpoint modify" command.
1503#define LLDB_OPTIONS_breakpoint_set
1504#include "CommandOptions.inc"
1523 interpreter,
"breakpoint set",
1524 "Sets a breakpoint or set of breakpoints in the executable.",
1525 "breakpoint set <cmd-options>"),
1551 const int short_option =
1552 g_breakpoint_set_options[option_idx].short_option;
1553 const char *long_option =
1554 g_breakpoint_set_options[option_idx].long_option;
1556 switch (short_option) {
1572 if (option_arg.getAsInteger(0,
m_column))
1580 option_arg, short_option, long_option);
1671 "Invalid breakpoint name"));
1678 option_arg, 0, &
error);
1679 if (
error.Success())
1724 option_arg, short_option, long_option, fcl_err.
AsCString()));
1733 llvm_unreachable(
"Unimplemented option");
1765 return llvm::ArrayRef(g_breakpoint_set_options);
1819 else if (!
m_options.m_func_names.empty())
1821 else if (!
m_options.m_func_regexp.empty())
1823 else if (!
m_options.m_source_text_regexp.empty())
1830 const bool internal =
false;
1838 switch (break_type) {
1842 const size_t num_files =
m_options.m_filenames.GetSize();
1843 if (num_files == 0) {
1845 result.
AppendError(
"no file supplied and no default file available.");
1848 }
else if (num_files > 1) {
1849 result.
AppendError(
"only one file at a time is allowed for file and "
1850 "line breakpoints");
1853 file =
m_options.m_filenames.GetFileSpecAtIndex(0);
1870 size_t num_modules_specified =
m_options.m_modules.GetSize();
1871 if (num_modules_specified == 1) {
1873 m_options.m_modules.GetFileSpecAtIndex(0);
1876 }
else if (num_modules_specified == 0) {
1880 result.
AppendError(
"Only one shared library can be specified for "
1881 "address breakpoints.");
1888 FunctionNameType name_type_mask =
m_options.m_func_name_type_mask;
1890 if (name_type_mask == 0)
1891 name_type_mask = eFunctionNameTypeAuto;
1904 if (llvm::Error err = regexp.
GetError()) {
1906 "Function name regular expression could not be compiled: %s",
1907 llvm::toString(std::move(err)).c_str());
1911 if (
m_options.m_func_regexp[0] ==
'*' ||
1914 "Function name regex does not accept glob patterns.");
1926 const size_t num_files =
m_options.m_filenames.GetSize();
1928 if (num_files == 0 && !
m_options.m_all_files) {
1932 "No files provided and could not find default file.");
1940 if (llvm::Error err = regexp.
GetError()) {
1942 "Source text regular expression could not be compiled: \"%s\"",
1943 llvm::toString(std::move(err)).c_str());
1948 m_options.m_source_regex_func_names, std::move(regexp), internal,
1957 if (precond_error.
Fail()) {
1959 "Error setting extra exception arguments: %s",
1974 "Error setting extra exception arguments: %s",
error.AsCString());
1985 bp_sp->GetOptions().CopyOverSetOptions(
m_bp_opts.GetBreakpointOptions());
1987 if (!
m_options.m_breakpoint_names.empty()) {
1989 for (
auto name :
m_options.m_breakpoint_names) {
1991 if (name_error.
Fail()) {
2003 const bool show_locations =
false;
2007 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
2008 "into future targets.\n");
2014 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
2015 "actual locations.\n");
2019 }
else if (!bp_sp) {
2020 result.
AppendError(
"breakpoint creation failed: no breakpoint created");
2039 "Modify the options on a breakpoint or set of "
2040 "breakpoints in the executable. "
2041 "If no breakpoint is specified, acts on the last "
2042 "created breakpoint. "
2043 "With the exception of -e, -d and -i, passing an "
2044 "empty argument clears the modification.",
2070 std::unique_lock<std::recursive_mutex> lock;
2076 command, target, result, &valid_bp_ids,
2080 const size_t count = valid_bp_ids.
GetSize();
2081 for (
size_t i = 0; i < count; ++i) {
2115 "Enable the specified disabled breakpoint(s). If "
2116 "no breakpoints are specified, enable all of them.",
2134 std::unique_lock<std::recursive_mutex> lock;
2139 size_t num_breakpoints = breakpoints.
GetSize();
2141 if (num_breakpoints == 0) {
2142 result.
AppendError(
"no breakpoints exist to be enabled");
2146 if (command.
empty()) {
2151 (uint64_t)num_breakpoints);
2157 command, target, result, &valid_bp_ids,
2161 int enable_count = 0;
2163 const size_t count = valid_bp_ids.
GetSize();
2164 for (
size_t i = 0; i < count; ++i) {
2176 "failed to enable breakpoint location: {0}",
2177 llvm::fmt_consume(std::move(
error)));
2187 enable_count + loc_count);
2201 interpreter,
"breakpoint disable",
2202 "Disable the specified breakpoint(s) without deleting "
2203 "them. If none are specified, disable all "
2207 "Disable the specified breakpoint(s) without deleting them. \
2208If none are specified, disable all breakpoints."
2212 "Note: disabling a breakpoint will cause none of its locations to be hit \
2213regardless of whether individual locations are enabled or disabled. After the sequence:"
2216 (lldb) break disable 1
2217 (lldb) break enable 1.1
2219execution will NOT stop at location 1.1. To achieve that, type:
2221 (lldb) break disable 1.*
2222 (lldb) break enable 1.1
2225 "The first command disables all locations for breakpoint 1, \
2226the second re-enables the first location.");
2241 void DoExecute(Args &command, CommandReturnObject &result)
override {
2243 std::unique_lock<std::recursive_mutex> lock;
2247 size_t num_breakpoints = breakpoints.
GetSize();
2249 if (num_breakpoints == 0) {
2250 result.
AppendError(
"no breakpoints exist to be disabled");
2254 if (command.
empty()) {
2259 (uint64_t)num_breakpoints);
2263 BreakpointIDList valid_bp_ids;
2266 command, target, result, &valid_bp_ids,
2267 BreakpointName::Permissions::PermissionKinds::disablePerm);
2270 int disable_count = 0;
2272 const size_t count = valid_bp_ids.
GetSize();
2273 for (
size_t i = 0; i < count; ++i) {
2277 Breakpoint *breakpoint =
2280 BreakpointLocation *location =
2285 "failed to disable breakpoint location: {0}",
2286 llvm::fmt_consume(std::move(
error)));
2296 disable_count + loc_count);
2305#pragma mark List::CommandOptions
2306#define LLDB_OPTIONS_breakpoint_list
2307#include "CommandOptions.inc"
2315 interpreter,
"breakpoint list",
2316 "List some or all breakpoints at configurable levels of detail.") {
2337 switch (short_option) {
2354 llvm_unreachable(
"Unimplemented option");
2367 return llvm::ArrayRef(g_breakpoint_list_options);
2384 std::unique_lock<std::recursive_mutex> lock;
2387 size_t num_breakpoints = breakpoints.
GetSize();
2389 if (num_breakpoints == 0) {
2397 if (command.
empty()) {
2400 for (
size_t i = 0; i < num_breakpoints; ++i) {
2411 command, target, result, &valid_bp_ids,
2415 for (
size_t i = 0; i < valid_bp_ids.
GetSize(); ++i) {
2434#pragma mark Clear::CommandOptions
2436#define LLDB_OPTIONS_breakpoint_clear
2437#include "CommandOptions.inc"
2447 "Delete or disable breakpoints matching the "
2448 "specified source file and line.",
2449 "breakpoint clear <cmd-options>") {}
2466 switch (short_option) {
2476 llvm_unreachable(
"Unimplemented option");
2488 return llvm::ArrayRef(g_breakpoint_clear_options);
2510 std::unique_lock<std::recursive_mutex> lock;
2514 size_t num_breakpoints = breakpoints.
GetSize();
2517 if (num_breakpoints == 0) {
2518 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
2525 std::vector<break_id_t> BreakIDs;
2526 for (
size_t i = 0; i < num_breakpoints; ++i)
2529 int num_cleared = 0;
2531 switch (break_type) {
2537 for (
size_t i = 0; i < num_breakpoints; ++i) {
2543 if (loc_coll.
GetSize() == 0) {
2557 if (num_cleared > 0) {
2559 output_stream.
Printf(
"%d breakpoints cleared:\n", num_cleared);
2561 output_stream.
EOL();
2564 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
2573#define LLDB_OPTIONS_breakpoint_delete
2574#include "CommandOptions.inc"
2582 "Delete the specified breakpoint(s). If no "
2583 "breakpoints are specified, delete them all.",
2610 switch (short_option) {
2624 llvm_unreachable(
"Unimplemented option");
2637 return llvm::ArrayRef(g_breakpoint_delete_options);
2651 std::unique_lock<std::recursive_mutex> lock;
2656 size_t num_breakpoints = breakpoints.
GetSize();
2658 if (num_breakpoints == 0) {
2659 result.
AppendError(
"no breakpoints exist to be deleted");
2667 "About to delete all breakpoints, do you want to do that?",
2673 "All breakpoints removed. (%" PRIu64
" breakpoint%s)\n",
2674 (uint64_t)num_breakpoints, num_breakpoints > 1 ?
"s" :
"");
2688 if (!command.
empty()) {
2690 command, target, result, &excluded_bp_ids,
2696 for (
auto breakpoint_sp : breakpoints.
Breakpoints()) {
2697 if (!breakpoint_sp->IsEnabled() && breakpoint_sp->AllowDelete()) {
2699 if (!excluded_bp_ids.
Contains(bp_id))
2703 if (valid_bp_ids.
GetSize() == 0) {
2709 command, target, result, &valid_bp_ids,
2715 int delete_count = 0;
2716 int disable_count = 0;
2717 const size_t count = valid_bp_ids.
GetSize();
2718 for (
size_t i = 0; i < count; ++i) {
2732 "failed to disable breakpoint location: {0}",
2733 llvm::fmt_consume(std::move(
error)));
2743 "%d breakpoints deleted; %d breakpoint locations disabled.\n",
2744 delete_count, disable_count);
2753#define LLDB_OPTIONS_breakpoint_name
2754#include "CommandOptions.inc"
2764 return llvm::ArrayRef(g_breakpoint_name_options);
2770 const int short_option = g_breakpoint_name_options[option_idx].short_option;
2771 const char *long_option = g_breakpoint_name_options[option_idx].long_option;
2773 switch (short_option) {
2777 m_name.SetValueFromString(option_arg);
2780 if (
m_breakpoint.SetValueFromString(option_arg).Fail())
2786 if (
m_use_dummy.SetValueFromString(option_arg).Fail())
2796 llvm_unreachable(
"Unimplemented option");
2815#define LLDB_OPTIONS_breakpoint_access
2816#include "CommandOptions.inc"
2825 return llvm::ArrayRef(g_breakpoint_access_options);
2830 const int short_option =
2831 g_breakpoint_access_options[option_idx].short_option;
2832 const char *long_option =
2833 g_breakpoint_access_options[option_idx].long_option;
2835 switch (short_option) {
2837 bool value, success;
2847 bool value, success;
2857 bool value, success;
2867 llvm_unreachable(
"Unimplemented option");
2885 interpreter,
"configure",
2886 "Configure the options for the breakpoint"
2888 "If you provide a breakpoint id, the options will be copied from "
2889 "the breakpoint, otherwise only the options specified will be set "
2891 "breakpoint name configure <command-options> "
2892 "<breakpoint-name-list>") {
2918 std::unique_lock<std::recursive_mutex> lock;
2922 for (
auto &entry : command.
entries()) {
2926 entry.c_str(),
error.AsCString());
2933 if (
m_bp_id.m_breakpoint.OptionWasSet()) {
2935 m_bp_id.m_breakpoint.GetValueAs<uint64_t>().value_or(0);
2945 for (
auto &entry : command.
entries()) {
2950 if (
m_bp_id.m_help_string.OptionWasSet())
2951 bp_name->
SetHelp(
m_bp_id.m_help_string.GetValueAs<llvm::StringRef>()
2977 interpreter,
"add",
"Add a name to the breakpoints provided.",
2978 "breakpoint name add <command-options> <breakpoint-id-list>") {
3006 std::unique_lock<std::recursive_mutex> lock;
3011 size_t num_breakpoints = breakpoints.
GetSize();
3012 if (num_breakpoints == 0) {
3013 result.
AppendError(
"no breakpoints, cannot add names");
3020 command, target, result, &valid_bp_ids,
3024 if (valid_bp_ids.
GetSize() == 0) {
3025 result.
AppendError(
"no breakpoints specified, cannot add names");
3028 size_t num_valid_ids = valid_bp_ids.
GetSize();
3032 for (
size_t index = 0; index < num_valid_ids; index++) {
3050 interpreter,
"delete",
3051 "Delete a name from the breakpoints provided.",
3052 "breakpoint name delete <command-options> <breakpoint-id-list>") {
3080 std::unique_lock<std::recursive_mutex> lock;
3085 size_t num_breakpoints = breakpoints.
GetSize();
3086 if (num_breakpoints == 0) {
3087 result.
AppendError(
"no breakpoints, cannot delete names");
3094 command, target, result, &valid_bp_ids,
3098 if (valid_bp_ids.
GetSize() == 0) {
3099 result.
AppendError(
"no breakpoints specified, cannot delete names");
3103 size_t num_valid_ids = valid_bp_ids.
GetSize();
3104 for (
size_t index = 0; index < num_valid_ids; index++) {
3122 "List either the names for a breakpoint or info "
3123 "about a given name. With no arguments, lists all "
3125 "breakpoint name list <command-options>") {
3139 std::vector<std::string> name_list;
3140 if (command.
empty()) {
3144 name_list.push_back(arg.c_str());
3148 if (name_list.empty()) {
3151 for (
const std::string &name_str : name_list) {
3152 const char *name = name_str.c_str();
3164 std::unique_lock<std::recursive_mutex> lock;
3168 bool any_set =
false;
3170 if (bp_sp->MatchesName(name)) {
3197 interpreter,
"name",
"Commands to manage breakpoint names") {
3202Breakpoint names provide a general tagging mechanism for breakpoints. Each
3203breakpoint name can be added to any number of breakpoints, and each breakpoint
3204can have any number of breakpoint names attached to it. For instance:
3206 (lldb) break name add -N MyName 1-10
3208adds the name MyName to breakpoints 1-10, and:
3210 (lldb) break set -n myFunc -N Name1 -N Name2
3212adds two names to the breakpoint set at myFunc.
3214They have a number of interrelated uses:
32161) They provide a stable way to refer to a breakpoint (e.g. in another
3217breakpoint's action). Using the breakpoint ID for this purpose is fragile, since
3218it depends on the order of breakpoint creation. Giving a name to the breakpoint
3219you want to act on, and then referring to it by name, is more robust:
3221 (lldb) break set -n myFunc -N BKPT1
3222 (lldb) break set -n myOtherFunc -C "break disable BKPT1"
32242) This is actually just a specific use of a more general feature of breakpoint
3225names. The <breakpt-id-list> argument type used to specify one or more
3226breakpoints in most of the commands that deal with breakpoints also accepts
3227breakpoint names. That allows you to refer to one breakpoint in a stable
3228manner, but also makes them a convenient grouping mechanism, allowing you to
3229easily act on a group of breakpoints by using their name, for instance disabling
3230them all in one action:
3232 (lldb) break set -n myFunc -N Group1
3233 (lldb) break set -n myOtherFunc -N Group1
3234 (lldb) break disable Group1
32363) But breakpoint names are also entities in their own right, and can be
3237configured with all the modifiable attributes of a breakpoint. Then when you
3238add a breakpoint name to a breakpoint, the breakpoint will be configured to
3239match the state of the breakpoint name. The link between the name and the
3240breakpoints sharing it remains live, so if you change the configuration on the
3241name, it will also change the configurations on the breakpoints:
3243 (lldb) break name configure -i 10 IgnoreSome
3244 (lldb) break set -n myFunc -N IgnoreSome
3245 (lldb) break list IgnoreSome
3246 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 10 enabled
3249 (lldb) break name configure -i 5 IgnoreSome
3250 (lldb) break list IgnoreSome
3251 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 5 enabled
3255Options that are not configured on a breakpoint name don't affect the value of
3256those options on the breakpoints they are added to. So for instance, if Name1
3257has the -i option configured and Name2 the -c option, adding both names to a
3258breakpoint will set the -i option from Name1 and the -c option from Name2, and
3259the other options will be unaltered.
3261If you add multiple names to a breakpoint which have configured values for
3262the same option, the last name added's value wins.
3264The "liveness" of these settings is one way, from name to breakpoint.
3265If you use "break modify" to change an option that is also configured on a name
3266which that breakpoint has, the "break modify" command will override the setting
3267for that breakpoint, but won't change the value configured in the name or on the
3268other breakpoints sharing that name.
32704) Breakpoint names are also a convenient way to copy option sets from one
3271breakpoint to another. Using the -B option to "breakpoint name configure" makes
3272a name configured with all the options of the original breakpoint. Then
3273adding that name to another breakpoint copies over all the values from the
3274original breakpoint to the new one.
32765) You can also use breakpoint names to hide breakpoints from the breakpoint
3277operations that act on all breakpoints: "break delete", "break disable" and
3278"break list". You do that by specifying a "false" value for the
3279--allow-{list,delete,disable} options to "breakpoint name configure" and then
3280adding that name to a breakpoint.
3282This won't keep the breakpoint from being deleted or disabled if you refer to it
3283specifically by ID. The point of the feature is to make sure users don't
3284inadvertently delete or disable useful breakpoints (e.g. ones an IDE is using
3285for its own purposes) as part of a "delete all" or "disable all" operation. The
3286list hiding is because it's confusing for people to see breakpoints they
3309#pragma mark Read::CommandOptions
3310#define LLDB_OPTIONS_breakpoint_read
3311#include "CommandOptions.inc"
3319 "Read and set the breakpoints previously saved to "
3320 "a file with \"breakpoint write\". ",
3337 const char *long_option =
3340 switch (short_option) {
3349 option_arg, short_option, long_option, name_error.
AsCString()));
3351 m_names.push_back(std::string(option_arg));
3355 llvm_unreachable(
"Unimplemented option");
3367 return llvm::ArrayRef(g_breakpoint_read_options);
3373 int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
3374 int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
3383 std::optional<FileSpec> file_spec;
3384 const llvm::StringRef dash_f(
"-f");
3385 for (
int arg_idx = 0; arg_idx < opt_arg_pos; arg_idx++) {
3399 if (!
error.Success())
3406 const size_t num_bkpts = bkpt_array->
GetSize();
3407 for (
size_t i = 0; i < num_bkpts; i++) {
3410 if (!bkpt_object_sp)
3414 bkpt_object_sp->GetAsDictionary();
3423 bkpt_dict = bkpt_data_sp->GetAsDictionary();
3432 size_t num_names = names_array->
GetSize();
3434 for (
size_t i = 0; i < num_names; i++) {
3435 if (std::optional<llvm::StringRef> maybe_name =
3451 std::unique_lock<std::recursive_mutex> lock;
3460 if (!
error.Success()) {
3467 size_t num_breakpoints = new_bps.
GetSize();
3468 if (num_breakpoints == 0) {
3473 for (
size_t i = 0; i < num_breakpoints; ++i) {
3490#pragma mark Write::CommandOptions
3491#define LLDB_OPTIONS_breakpoint_write
3492#include "CommandOptions.inc"
3499 "Write the breakpoints listed to a file that can "
3500 "be read in with \"breakpoint read\". "
3501 "If given no arguments, writes all breakpoints.",
3528 switch (short_option) {
3536 llvm_unreachable(
"Unimplemented option");
3548 return llvm::ArrayRef(g_breakpoint_write_options);
3561 std::unique_lock<std::recursive_mutex> lock;
3565 if (!command.
empty()) {
3567 command, target, result, &valid_bp_ids,
3579 if (!
error.Success()) {
3590#pragma mark MultiwordBreakpoint
3595 interpreter,
"breakpoint",
3596 "Commands for operating on breakpoints (see 'help b' for shorthand.)",
3597 "breakpoint <subcommand> [<command-options>]") {
3623 list_command_object->SetCommandName(
"breakpoint list");
3624 enable_command_object->SetCommandName(
"breakpoint enable");
3625 disable_command_object->SetCommandName(
"breakpoint disable");
3626 clear_command_object->SetCommandName(
"breakpoint clear");
3627 delete_command_object->SetCommandName(
"breakpoint delete");
3628 set_command_object->SetCommandName(
"breakpoint set");
3629 add_command_object->SetCommandName(
"breakpoint add");
3630 command_command_object->SetCommandName(
"breakpoint command");
3631 modify_command_object->SetCommandName(
"breakpoint modify");
3632 name_command_object->SetCommandName(
"breakpoint name");
3633 write_command_object->SetCommandName(
"breakpoint write");
3634 read_command_object->SetCommandName(
"breakpoint read");
3653 Args &args,
Target &target,
bool allow_locations,
3655 BreakpointName::Permissions ::PermissionKinds purpose) {
3676 "No breakpoint specified and no last created breakpoint.");
3688 args, &target, allow_locations, purpose, temp_args)) {
3708 const size_t count = valid_ids->
GetSize();
3709 for (
size_t i = 0; i < count; ++i) {
3713 if (breakpoint !=
nullptr) {
3722 "'%s' is not a currently valid breakpoint/location id.\n",
3728 "'%d' is not a currently valid breakpoint ID.\n",
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)
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)
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)
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.
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.
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() const
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)
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
void AppendMessage(llvm::StringRef in_string)
void void AppendError(llvm::StringRef in_string)
std::string GetErrorString(bool with_diagnostics=true) const
Return the errors as a 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.
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.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
static FileSystem & Instance()
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()
Debugger & GetDebugger() const
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)
bool IsDummyTarget() const
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_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
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)