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,
395 eCommandAllowsDummyTarget) {
421 const int short_option =
GetDefinitions()[option_idx].short_option;
422 const char *long_option =
GetDefinitions()[option_idx].long_option;
424 switch (short_option) {
435 "Only one shared library can be "
436 "specified for address breakpoints."));
440 llvm_unreachable(
"Unimplemented option");
452 return llvm::ArrayRef(g_breakpoint_add_address_options);
467 "can't set address breakpoints without a real target.");
471 const bool internal =
false;
476 bool has_module =
false;
477 if (
m_options.m_modules.GetSize() != 0) {
479 module_spec =
m_options.m_modules.GetFileSpecAtIndex(0);
484 std::vector<lldb::addr_t> bp_addrs;
492 arg_entry.ref(),
error);
495 bp_addrs.push_back(bp_load_addr);
497 for (
auto bp_addr : bp_addrs) {
500 bp_addr, internal, module_spec,
m_options.m_hardware);
516 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
528#pragma mark AddException::CommandOptions
529#define LLDB_OPTIONS_breakpoint_add_exception
530#include "CommandOptions.inc"
532#pragma mark Add Exception
538 interpreter,
"breakpoint add exception",
539 "Add breakpoints on language exceptions. If no language is "
540 "specified, break on exceptions for all supported languages",
541 nullptr, eCommandAllowsDummyTarget) {
566 const int short_option =
GetDefinitions()[option_idx].short_option;
568 switch (short_option) {
587 llvm_unreachable(
"Unimplemented option");
600 return llvm::ArrayRef(g_breakpoint_add_exception_options);
616 if (command.
size() == 0) {
618 }
else if (command.
size() > 1) {
620 "can only set exception breakpoints on one language at a time");
622 llvm::Expected<LanguageType> language =
625 exception_language = *language;
627 result.
SetError(language.takeError());
632 const bool internal =
false;
636 exception_language, catch_bp, throw_bp, internal,
637 &
m_options.m_exception_extra_args, &precond_error);
638 if (precond_error.
Fail()) {
640 "Error setting extra exception arguments: %s",
657 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
658 "into future targets.\n");
661 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
673#pragma mark AddFile::CommandOptions
674#define LLDB_OPTIONS_breakpoint_add_file
675#include "CommandOptions.inc"
683 interpreter,
"breakpoint add file",
684 "Add breakpoints on lines in specified source files", nullptr,
685 eCommandAllowsDummyTarget) {
695 arg1.push_back(linespec_arg);
703 arg2.push_back(linespec_arg);
732 const int short_option =
GetDefinitions()[option_idx].short_option;
733 const char *long_option =
GetDefinitions()[option_idx].long_option;
735 switch (short_option) {
741 if (option_arg.getAsInteger(0, line_num))
774 if (option_arg.getAsInteger(0, column_num))
818 option_arg, 0, &
error);
824 llvm_unreachable(
"Unimplemented option");
854 return llvm::ArrayRef(g_breakpoint_add_file_options);
869 bool internal =
false;
883 if (!this_arg.ref().getAsInteger(0, line_value)) {
886 std::string error_msg;
891 line_value, error_msg);
906 if (
m_options.m_line_specs.size() != 1) {
907 result.
AppendError(
"Can only make file and line breakpoints with one "
908 "specification at a time.");
930 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
931 "into future targets.\n");
936 if (bp_sp->GetNumLocations() == 0) {
937 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
938 "actual locations.\n");
943 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
955#pragma mark AddName::CommandOptions
956#define LLDB_OPTIONS_breakpoint_add_name
957#include "CommandOptions.inc"
965 "Add breakpoints matching function or symbol names",
966 nullptr, eCommandAllowsDummyTarget) {
992 const int short_option =
GetDefinitions()[option_idx].short_option;
993 const char *long_option =
GetDefinitions()[option_idx].long_option;
995 switch (short_option) {
1038 option_arg, 0, &
error);
1039 if (
error.Success())
1044 llvm_unreachable(
"Unimplemented option");
1061 return llvm::ArrayRef(g_breakpoint_add_name_options);
1077 const bool internal =
false;
1081 std::vector<std::string> func_names;
1083 func_names.push_back(this_arg.ref().str());
1093 if (func_names.size() != 1) {
1094 result.
AppendError(
"Can only set function regular expression "
1095 "breakpoints on one regex at a time.");
1098 std::string &func_regexp = func_names[0];
1100 if (llvm::Error err = regexp.
GetError()) {
1102 "Function name regular expression could not be compiled: %s",
1103 llvm::toString(std::move(err)).c_str());
1106 if (!func_regexp.empty()) {
1107 if (func_regexp[0] ==
'*' || func_regexp[0] ==
'?')
1109 "function name regex does not accept glob patterns");
1126 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1127 "into future targets.\n");
1129 if (bp_sp->GetNumLocations() == 0) {
1130 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1131 "actual locations.\n");
1136 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
1148#pragma mark AddPattern::CommandOptions
1149#define LLDB_OPTIONS_breakpoint_add_pattern
1150#include "CommandOptions.inc"
1152#pragma mark Add Pattern
1158 "Add breakpoints matching patterns in the source text",
1159 "breakpoint add pattern [options] -- <pattern>",
1160 eCommandAllowsDummyTarget) {
1183 const int short_option =
GetDefinitions()[option_idx].short_option;
1184 const char *long_option =
GetDefinitions()[option_idx].long_option;
1186 switch (short_option) {
1226 llvm_unreachable(
"Unimplemented option");
1243 return llvm::ArrayRef(g_breakpoint_add_pattern_options);
1259 const bool internal =
false;
1263 if (command.empty()) {
1276 if (pattern.empty()) {
1285 const size_t num_files =
m_options.m_files.GetSize();
1287 if (num_files == 0 && !
m_options.m_all_files) {
1291 "No files provided and could not find default file.");
1299 if (llvm::Error err = regexp.
GetError()) {
1301 "Source text regular expression could not be compiled: \"%s\"",
1302 llvm::toString(std::move(err)).c_str());
1307 std::move(regexp), internal,
m_options.m_hardware,
1317 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1318 "into future targets.\n");
1323 if (bp_sp->GetNumLocations() == 0) {
1324 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1325 "actual locations.\n");
1330 result.
AppendError(
"Breakpoint creation failed: No breakpoint created.");
1342#pragma mark AddScripted::CommandOptions
1343#define LLDB_OPTIONS_breakpoint_add_scripted
1344#include "CommandOptions.inc"
1346#pragma mark Add Scripted
1352 interpreter,
"breakpoint add scripted",
1353 "Add breakpoints using a scripted breakpoint resolver.", nullptr,
1354 eCommandAllowsDummyTarget),
1380 const int short_option =
GetDefinitions()[option_idx].short_option;
1382 switch (short_option) {
1394 llvm_unreachable(
"Unimplemented option");
1407 return llvm::ArrayRef(g_breakpoint_add_scripted_options);
1429 "error setting extra exception arguments: %s",
error.AsCString());
1441 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
1442 "into future targets.\n");
1447 if (bp_sp->GetNumLocations() == 0) {
1448 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
1449 "actual locations.\n");
1454 result.
AppendError(
"breakpoint creation failed: No breakpoint created.");
1467#pragma mark Add::CommandOptions
1468#define LLDB_OPTIONS_breakpoint_add
1469#include "CommandOptions.inc"
1477 "Commands to add breakpoints of various types") {
1480Access the breakpoint search kernels built into lldb. Along with specifying the
1481search kernel, each breakpoint add operation can specify a common set of
1482"reaction" options for each breakpoint. The reaction options can also be
1483modified after breakpoint creation using the "breakpoint modify" command.
1507#define LLDB_OPTIONS_breakpoint_set
1508#include "CommandOptions.inc"
1527 interpreter,
"breakpoint set",
1528 "Sets a breakpoint or set of breakpoints in the executable.",
1529 "breakpoint set <cmd-options>", eCommandAllowsDummyTarget),
1555 const int short_option =
1556 g_breakpoint_set_options[option_idx].short_option;
1557 const char *long_option =
1558 g_breakpoint_set_options[option_idx].long_option;
1560 switch (short_option) {
1576 if (option_arg.getAsInteger(0,
m_column))
1584 option_arg, short_option, long_option);
1675 "Invalid breakpoint name"));
1682 option_arg, 0, &
error);
1683 if (
error.Success())
1728 option_arg, short_option, long_option, fcl_err.
AsCString()));
1737 llvm_unreachable(
"Unimplemented option");
1769 return llvm::ArrayRef(g_breakpoint_set_options);
1823 else if (!
m_options.m_func_names.empty())
1825 else if (!
m_options.m_func_regexp.empty())
1827 else if (!
m_options.m_source_text_regexp.empty())
1834 const bool internal =
false;
1842 switch (break_type) {
1846 const size_t num_files =
m_options.m_filenames.GetSize();
1847 if (num_files == 0) {
1849 result.
AppendError(
"no file supplied and no default file available.");
1852 }
else if (num_files > 1) {
1853 result.
AppendError(
"only one file at a time is allowed for file and "
1854 "line breakpoints");
1857 file =
m_options.m_filenames.GetFileSpecAtIndex(0);
1874 size_t num_modules_specified =
m_options.m_modules.GetSize();
1875 if (num_modules_specified == 1) {
1877 m_options.m_modules.GetFileSpecAtIndex(0);
1880 }
else if (num_modules_specified == 0) {
1884 result.
AppendError(
"Only one shared library can be specified for "
1885 "address breakpoints.");
1892 FunctionNameType name_type_mask =
m_options.m_func_name_type_mask;
1894 if (name_type_mask == 0)
1895 name_type_mask = eFunctionNameTypeAuto;
1908 if (llvm::Error err = regexp.
GetError()) {
1910 "Function name regular expression could not be compiled: %s",
1911 llvm::toString(std::move(err)).c_str());
1915 if (
m_options.m_func_regexp[0] ==
'*' ||
1918 "function name regex does not accept glob patterns");
1930 const size_t num_files =
m_options.m_filenames.GetSize();
1932 if (num_files == 0 && !
m_options.m_all_files) {
1936 "No files provided and could not find default file.");
1944 if (llvm::Error err = regexp.
GetError()) {
1946 "Source text regular expression could not be compiled: \"%s\"",
1947 llvm::toString(std::move(err)).c_str());
1952 m_options.m_source_regex_func_names, std::move(regexp), internal,
1961 if (precond_error.
Fail()) {
1963 "Error setting extra exception arguments: %s",
1978 "Error setting extra exception arguments: %s",
error.AsCString());
1989 bp_sp->GetOptions().CopyOverSetOptions(
m_bp_opts.GetBreakpointOptions());
1991 if (!
m_options.m_breakpoint_names.empty()) {
1993 for (
auto name :
m_options.m_breakpoint_names) {
1995 if (name_error.
Fail()) {
2007 const bool show_locations =
false;
2011 output_stream.
Printf(
"Breakpoint set in dummy target, will get copied "
2012 "into future targets.\n");
2018 output_stream.
Printf(
"WARNING: Unable to resolve breakpoint to any "
2019 "actual locations.\n");
2023 }
else if (!bp_sp) {
2024 result.
AppendError(
"breakpoint creation failed: no breakpoint created");
2043 "Modify the options on a breakpoint or set of "
2044 "breakpoints in the executable. "
2045 "If no breakpoint is specified, acts on the last "
2046 "created breakpoint. "
2047 "With the exception of -e, -d and -i, passing an "
2048 "empty argument clears the modification.",
2049 nullptr, eCommandAllowsDummyTarget) {
2073 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2074 std::unique_lock<std::recursive_mutex> lock;
2080 command, target, result, &valid_bp_ids,
2084 const size_t count = valid_bp_ids.
GetSize();
2085 for (
size_t i = 0; i < count; ++i) {
2119 "Enable the specified disabled breakpoint(s). If "
2120 "no breakpoints are specified, enable all of them.",
2121 nullptr, eCommandAllowsDummyTarget) {
2137 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2138 std::unique_lock<std::recursive_mutex> lock;
2143 size_t num_breakpoints = breakpoints.
GetSize();
2145 if (num_breakpoints == 0) {
2146 result.
AppendError(
"no breakpoints exist to be enabled");
2150 if (command.
empty()) {
2154 "All breakpoints enabled. ({0} breakpoints)", num_breakpoints);
2160 command,
m_exe_ctx, result, &valid_bp_ids,
2164 int enable_count = 0;
2166 const size_t count = valid_bp_ids.
GetSize();
2167 for (
size_t i = 0; i < count; ++i) {
2179 "failed to enable breakpoint location: {0}",
2180 llvm::fmt_consume(std::move(
error)));
2190 enable_count + loc_count);
2204 interpreter,
"breakpoint disable",
2205 "Disable the specified breakpoint(s) without deleting "
2206 "them. If none are specified, disable all "
2208 nullptr, eCommandAllowsDummyTarget) {
2210 "Disable the specified breakpoint(s) without deleting them. \
2211If none are specified, disable all breakpoints."
2215 "Note: disabling a breakpoint will cause none of its locations to be hit \
2216regardless of whether individual locations are enabled or disabled. After the sequence:"
2219 (lldb) break disable 1
2220 (lldb) break enable 1.1
2222execution will NOT stop at location 1.1. To achieve that, type:
2224 (lldb) break disable 1.*
2225 (lldb) break enable 1.1
2228 "The first command disables all locations for breakpoint 1, \
2229the second re-enables the first location.");
2244 void DoExecute(Args &command, CommandReturnObject &result)
override {
2246 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2247 std::unique_lock<std::recursive_mutex> lock;
2251 size_t num_breakpoints = breakpoints.
GetSize();
2253 if (num_breakpoints == 0) {
2254 result.
AppendError(
"no breakpoints exist to be disabled");
2258 if (command.
empty()) {
2262 "All breakpoints disabled. ({0} breakpoints)\n", num_breakpoints);
2266 BreakpointIDList valid_bp_ids;
2269 command,
m_exe_ctx, result, &valid_bp_ids,
2270 BreakpointName::Permissions::PermissionKinds::disablePerm);
2273 int disable_count = 0;
2275 const size_t count = valid_bp_ids.
GetSize();
2276 for (
size_t i = 0; i < count; ++i) {
2280 Breakpoint *breakpoint =
2283 BreakpointLocation *location =
2288 "failed to disable breakpoint location: {0}",
2289 llvm::fmt_consume(std::move(
error)));
2299 disable_count + loc_count);
2308#pragma mark List::CommandOptions
2309#define LLDB_OPTIONS_breakpoint_list
2310#include "CommandOptions.inc"
2318 interpreter,
"breakpoint list",
2319 "List some or all breakpoints at configurable levels of detail.",
2320 nullptr, eCommandAllowsDummyTarget) {
2341 switch (short_option) {
2358 llvm_unreachable(
"Unimplemented option");
2371 return llvm::ArrayRef(g_breakpoint_list_options);
2385 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2388 std::unique_lock<std::recursive_mutex> lock;
2391 size_t num_breakpoints = breakpoints.
GetSize();
2393 if (num_breakpoints == 0) {
2401 if (command.
empty()) {
2404 for (
size_t i = 0; i < num_breakpoints; ++i) {
2415 command, target, result, &valid_bp_ids,
2419 for (
size_t i = 0; i < valid_bp_ids.
GetSize(); ++i) {
2438#pragma mark Clear::CommandOptions
2440#define LLDB_OPTIONS_breakpoint_clear
2441#include "CommandOptions.inc"
2451 "Delete or disable breakpoints matching the "
2452 "specified source file and line.",
2453 "breakpoint clear <cmd-options>",
2454 eCommandAllowsDummyTarget) {}
2471 switch (short_option) {
2481 llvm_unreachable(
"Unimplemented option");
2493 return llvm::ArrayRef(g_breakpoint_clear_options);
2505 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2515 std::unique_lock<std::recursive_mutex> lock;
2519 size_t num_breakpoints = breakpoints.
GetSize();
2522 if (num_breakpoints == 0) {
2523 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
2530 std::vector<break_id_t> BreakIDs;
2531 for (
size_t i = 0; i < num_breakpoints; ++i)
2534 int num_cleared = 0;
2536 switch (break_type) {
2542 for (
size_t i = 0; i < num_breakpoints; ++i) {
2548 if (loc_coll.
GetSize() == 0) {
2562 if (num_cleared > 0) {
2564 output_stream.
Printf(
"%d breakpoints cleared:\n", num_cleared);
2566 output_stream.
EOL();
2569 result.
AppendError(
"breakpoint clear: no breakpoint cleared");
2578#define LLDB_OPTIONS_breakpoint_delete
2579#include "CommandOptions.inc"
2587 "Delete the specified breakpoint(s). If no "
2588 "breakpoints are specified, delete them all.",
2589 nullptr, eCommandAllowsDummyTarget) {
2615 switch (short_option) {
2629 llvm_unreachable(
"Unimplemented option");
2642 return llvm::ArrayRef(g_breakpoint_delete_options);
2654 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2657 std::unique_lock<std::recursive_mutex> lock;
2662 size_t num_breakpoints = breakpoints.
GetSize();
2664 if (num_breakpoints == 0) {
2665 result.
AppendError(
"no breakpoints exist to be deleted");
2673 "About to delete all breakpoints, do you want to do that?",
2679 "All breakpoints removed. ({0} breakpoint{1})", num_breakpoints,
2680 num_breakpoints > 1 ?
"s" :
"");
2694 if (!command.
empty()) {
2696 command, target, result, &excluded_bp_ids,
2702 for (
auto breakpoint_sp : breakpoints.
Breakpoints()) {
2703 if (!breakpoint_sp->IsEnabled() && breakpoint_sp->AllowDelete()) {
2705 if (!excluded_bp_ids.
Contains(bp_id))
2709 if (valid_bp_ids.
GetSize() == 0) {
2715 command,
m_exe_ctx, result, &valid_bp_ids,
2721 int delete_count = 0;
2722 int disable_count = 0;
2723 const size_t count = valid_bp_ids.
GetSize();
2724 for (
size_t i = 0; i < count; ++i) {
2738 "failed to disable breakpoint location: {0}",
2739 llvm::fmt_consume(std::move(
error)));
2749 "{0} breakpoints deleted; {1} breakpoint locations disabled.",
2750 delete_count, disable_count);
2759#define LLDB_OPTIONS_breakpoint_name
2760#include "CommandOptions.inc"
2770 return llvm::ArrayRef(g_breakpoint_name_options);
2776 const int short_option = g_breakpoint_name_options[option_idx].short_option;
2777 const char *long_option = g_breakpoint_name_options[option_idx].long_option;
2779 switch (short_option) {
2783 m_name.SetValueFromString(option_arg);
2786 if (
m_breakpoint.SetValueFromString(option_arg).Fail())
2792 if (
m_use_dummy.SetValueFromString(option_arg).Fail())
2802 llvm_unreachable(
"Unimplemented option");
2821#define LLDB_OPTIONS_breakpoint_access
2822#include "CommandOptions.inc"
2831 return llvm::ArrayRef(g_breakpoint_access_options);
2836 const int short_option =
2837 g_breakpoint_access_options[option_idx].short_option;
2838 const char *long_option =
2839 g_breakpoint_access_options[option_idx].long_option;
2841 switch (short_option) {
2843 bool value, success;
2853 bool value, success;
2863 bool value, success;
2873 llvm_unreachable(
"Unimplemented option");
2891 interpreter,
"configure",
2892 "Configure the options for the breakpoint"
2894 "If you provide a breakpoint id, the options will be copied from "
2895 "the breakpoint, otherwise only the options specified will be set "
2897 "breakpoint name configure <command-options> "
2898 "<breakpoint-name-list>",
2899 eCommandAllowsDummyTarget) {
2924 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
2925 std::unique_lock<std::recursive_mutex> lock;
2929 for (
auto &entry : command.
entries()) {
2933 entry.c_str(),
error.AsCString());
2940 if (
m_bp_id.m_breakpoint.OptionWasSet()) {
2942 m_bp_id.m_breakpoint.GetValueAs<uint64_t>().value_or(0);
2952 for (
auto &entry : command.
entries()) {
2957 if (
m_bp_id.m_help_string.OptionWasSet())
2958 bp_name->
SetHelp(
m_bp_id.m_help_string.GetValueAs<llvm::StringRef>()
2985 interpreter,
"add",
"Add a name to the breakpoints provided.",
2986 "breakpoint name add <command-options> <breakpoint-id-list>",
2987 eCommandAllowsDummyTarget) {
3015 std::unique_lock<std::recursive_mutex> lock;
3020 size_t num_breakpoints = breakpoints.
GetSize();
3021 if (num_breakpoints == 0) {
3022 result.
AppendError(
"no breakpoints, cannot add names");
3029 command, target, result, &valid_bp_ids,
3033 if (valid_bp_ids.
GetSize() == 0) {
3034 result.
AppendError(
"no breakpoints specified, cannot add names");
3037 size_t num_valid_ids = valid_bp_ids.
GetSize();
3041 for (
size_t index = 0; index < num_valid_ids; index++) {
3059 interpreter,
"delete",
3060 "Delete a name from the breakpoints provided.",
3061 "breakpoint name delete <command-options> <breakpoint-id-list>",
3062 eCommandAllowsDummyTarget) {
3090 std::unique_lock<std::recursive_mutex> lock;
3095 size_t num_breakpoints = breakpoints.
GetSize();
3096 if (num_breakpoints == 0) {
3097 result.
AppendError(
"no breakpoints, cannot delete names");
3104 command, target, result, &valid_bp_ids,
3108 if (valid_bp_ids.
GetSize() == 0) {
3109 result.
AppendError(
"no breakpoints specified, cannot delete names");
3113 size_t num_valid_ids = valid_bp_ids.
GetSize();
3114 for (
size_t index = 0; index < num_valid_ids; index++) {
3132 "List either the names for a breakpoint or info "
3133 "about a given name. With no arguments, lists all "
3135 "breakpoint name list <command-options>",
3136 eCommandAllowsDummyTarget) {
3150 std::vector<std::string> name_list;
3151 if (command.
empty()) {
3155 name_list.push_back(arg.c_str());
3159 if (name_list.empty()) {
3162 for (
const std::string &name : name_list) {
3174 std::unique_lock<std::recursive_mutex> lock;
3178 bool any_set =
false;
3180 if (bp_sp->MatchesName(name.c_str())) {
3207 interpreter,
"name",
"Commands to manage breakpoint names") {
3212Breakpoint names provide a general tagging mechanism for breakpoints. Each
3213breakpoint name can be added to any number of breakpoints, and each breakpoint
3214can have any number of breakpoint names attached to it. For instance:
3216 (lldb) break name add -N MyName 1-10
3218adds the name MyName to breakpoints 1-10, and:
3220 (lldb) break set -n myFunc -N Name1 -N Name2
3222adds two names to the breakpoint set at myFunc.
3224They have a number of interrelated uses:
32261) They provide a stable way to refer to a breakpoint (e.g. in another
3227breakpoint's action). Using the breakpoint ID for this purpose is fragile, since
3228it depends on the order of breakpoint creation. Giving a name to the breakpoint
3229you want to act on, and then referring to it by name, is more robust:
3231 (lldb) break set -n myFunc -N BKPT1
3232 (lldb) break set -n myOtherFunc -C "break disable BKPT1"
32342) This is actually just a specific use of a more general feature of breakpoint
3235names. The <breakpt-id-list> argument type used to specify one or more
3236breakpoints in most of the commands that deal with breakpoints also accepts
3237breakpoint names. That allows you to refer to one breakpoint in a stable
3238manner, but also makes them a convenient grouping mechanism, allowing you to
3239easily act on a group of breakpoints by using their name, for instance disabling
3240them all in one action:
3242 (lldb) break set -n myFunc -N Group1
3243 (lldb) break set -n myOtherFunc -N Group1
3244 (lldb) break disable Group1
32463) But breakpoint names are also entities in their own right, and can be
3247configured with all the modifiable attributes of a breakpoint. Then when you
3248add a breakpoint name to a breakpoint, the breakpoint will be configured to
3249match the state of the breakpoint name. The link between the name and the
3250breakpoints sharing it remains live, so if you change the configuration on the
3251name, it will also change the configurations on the breakpoints:
3253 (lldb) break name configure -i 10 IgnoreSome
3254 (lldb) break set -n myFunc -N IgnoreSome
3255 (lldb) break list IgnoreSome
3256 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 10 enabled
3259 (lldb) break name configure -i 5 IgnoreSome
3260 (lldb) break list IgnoreSome
3261 2: name = 'myFunc', locations = 0 (pending) Options: ignore: 5 enabled
3265Options that are not configured on a breakpoint name don't affect the value of
3266those options on the breakpoints they are added to. So for instance, if Name1
3267has the -i option configured and Name2 the -c option, adding both names to a
3268breakpoint will set the -i option from Name1 and the -c option from Name2, and
3269the other options will be unaltered.
3271If you add multiple names to a breakpoint which have configured values for
3272the same option, the last name added's value wins.
3274The "liveness" of these settings is one way, from name to breakpoint.
3275If you use "break modify" to change an option that is also configured on a name
3276which that breakpoint has, the "break modify" command will override the setting
3277for that breakpoint, but won't change the value configured in the name or on the
3278other breakpoints sharing that name.
32804) Breakpoint names are also a convenient way to copy option sets from one
3281breakpoint to another. Using the -B option to "breakpoint name configure" makes
3282a name configured with all the options of the original breakpoint. Then
3283adding that name to another breakpoint copies over all the values from the
3284original breakpoint to the new one.
32865) You can also use breakpoint names to hide breakpoints from the breakpoint
3287operations that act on all breakpoints: "break delete", "break disable" and
3288"break list". You do that by specifying a "false" value for the
3289--allow-{list,delete,disable} options to "breakpoint name configure" and then
3290adding that name to a breakpoint.
3292This won't keep the breakpoint from being deleted or disabled if you refer to it
3293specifically by ID. The point of the feature is to make sure users don't
3294inadvertently delete or disable useful breakpoints (e.g. ones an IDE is using
3295for its own purposes) as part of a "delete all" or "disable all" operation. The
3296list hiding is because it's confusing for people to see breakpoints they
3319#pragma mark Read::CommandOptions
3320#define LLDB_OPTIONS_breakpoint_read
3321#include "CommandOptions.inc"
3329 "Read and set the breakpoints previously saved to "
3330 "a file with \"breakpoint write\". ",
3331 nullptr, eCommandAllowsDummyTarget) {}
3347 const char *long_option =
3350 switch (short_option) {
3359 option_arg, short_option, long_option, name_error.
AsCString()));
3361 m_names.push_back(std::string(option_arg));
3365 llvm_unreachable(
"Unimplemented option");
3377 return llvm::ArrayRef(g_breakpoint_read_options);
3383 int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
3384 int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
3393 std::optional<FileSpec> file_spec;
3394 const llvm::StringRef dash_f(
"-f");
3395 for (
int arg_idx = 0; arg_idx < opt_arg_pos; arg_idx++) {
3409 if (!
error.Success())
3416 const size_t num_bkpts = bkpt_array->
GetSize();
3417 for (
size_t i = 0; i < num_bkpts; i++) {
3420 if (!bkpt_object_sp)
3424 bkpt_object_sp->GetAsDictionary();
3433 bkpt_dict = bkpt_data_sp->GetAsDictionary();
3442 size_t num_names = names_array->
GetSize();
3444 for (
size_t i = 0; i < num_names; i++) {
3445 if (std::optional<llvm::StringRef> maybe_name =
3460 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
3461 std::unique_lock<std::recursive_mutex> lock;
3468 input_spec,
m_options.m_names, new_bps);
3470 if (!
error.Success()) {
3477 size_t num_breakpoints = new_bps.
GetSize();
3478 if (num_breakpoints == 0) {
3483 for (
size_t i = 0; i < num_breakpoints; ++i) {
3500#pragma mark Write::CommandOptions
3501#define LLDB_OPTIONS_breakpoint_write
3502#include "CommandOptions.inc"
3509 "Write the breakpoints listed to a file that can "
3510 "be read in with \"breakpoint read\". "
3511 "If given no arguments, writes all breakpoints.",
3512 nullptr, eCommandAllowsDummyTarget) {
3538 switch (short_option) {
3546 llvm_unreachable(
"Unimplemented option");
3558 return llvm::ArrayRef(g_breakpoint_write_options);
3570 assert(target &&
"target guaranteed by eCommandAllowsDummyTarget");
3571 std::unique_lock<std::recursive_mutex> lock;
3575 if (!command.
empty()) {
3577 command,
m_exe_ctx, result, &valid_bp_ids,
3589 if (!
error.Success()) {
3599#pragma mark override add
3600#define LLDB_OPTIONS_breakpoint_override_add
3601#include "CommandOptions.inc"
3607 "Add a scripted breakpoint override resolver.",
3608 nullptr, eCommandAllowsDummyTarget),
3629 const int short_option =
GetDefinitions()[option_idx].short_option;
3631 switch (short_option) {
3636 llvm_unreachable(
"Unimplemented option");
3647 return llvm::ArrayRef(g_breakpoint_override_add_options);
3668 llvm::toString(
id.takeError()));
3683 "Delete a scripted breakpoint override resolver.",
3684 nullptr, eCommandAllowsDummyTarget) {
3701 if (
m_interpreter.Confirm(
"Delete all breakpoint overrides?",
false)) {
3708 for (
auto &entry : command.
entries()) {
3711 if (!entry.ref().getAsInteger(0,
id))
3736 interpreter,
"breakpoint override list",
3737 "List the current scripted breakpoint override resolvers.", nullptr,
3738 eCommandAllowsDummyTarget) {
3754 std::vector<uint64_t> idxs;
3756 for (
auto &entry : command.
entries()) {
3758 if (!entry.ref().getAsInteger(0,
id)) {
3774 if (idxs.size() == 1) {
3775 error_strm << llvm::formatv(
"error: invalid index: {0}", idxs[0]);
3778 error_strm <<
"error: invalid indices: ";
3779 auto begin = idxs.begin();
3780 error_strm << llvm::formatv(
"{0}", *begin);
3782 for (
auto elem : idxs)
3783 error_strm << llvm::formatv(
", {0}", elem);
3795 interpreter,
"override",
3796 "Commands to manage breakpoint override resolvers") {
3800Breakpoint override resolvers allow you to intercept breakpoint requests and
3801re-implement them using a custom breakpoint resolver. Override resolvers are
3802implemented by a scripted breakpoint resolver that implements the
3803'overrides_resolver' interface. It takes an SBStructuredData with the
3804serialized form of the original breakpoint resolver. If it returns true, then
3805the provided resolver will be substituted for the one lldb would have produced
3808Add new override resolvers using:
3810 (lldb) breakpoint override add -c class_name
3812This returns the ID of the resolver you added.
3814List the currently added override resolvers using:
3816 (lldb) breakpoint override list
3818Delete an added resolver using:
3820 (lldb) breakpoint override delete <id>
3839#pragma mark MultiwordBreakpoint
3844 interpreter,
"breakpoint",
3845 "Commands for operating on breakpoints (see 'help b' for shorthand.)",
3846 "breakpoint <subcommand> [<command-options>]") {
3874 list_command_object->SetCommandName(
"breakpoint list");
3875 enable_command_object->SetCommandName(
"breakpoint enable");
3876 disable_command_object->SetCommandName(
"breakpoint disable");
3877 clear_command_object->SetCommandName(
"breakpoint clear");
3878 delete_command_object->SetCommandName(
"breakpoint delete");
3879 set_command_object->SetCommandName(
"breakpoint set");
3880 add_command_object->SetCommandName(
"breakpoint add");
3881 command_command_object->SetCommandName(
"breakpoint command");
3882 modify_command_object->SetCommandName(
"breakpoint modify");
3883 name_command_object->SetCommandName(
"breakpoint name");
3884 write_command_object->SetCommandName(
"breakpoint write");
3885 read_command_object->SetCommandName(
"breakpoint read");
3886 override_command_object->SetCommandName(
"breakpoint override");
3908 BreakpointName::Permissions ::PermissionKinds purpose) {
3930 "No breakpoint specified and no last created breakpoint.");
3942 args, exe_ctx, allow_locations, purpose, temp_args)) {
3962 const size_t count = valid_ids->
GetSize();
3963 for (
size_t i = 0; i < count; ++i) {
3967 if (breakpoint !=
nullptr) {
3976 "'%s' is not a currently valid breakpoint/location id",
3982 "'%d' is not a currently valid breakpoint ID",
static bool GetDefaultFile(Target &target, StackFrame *cur_frame, FileSpec &file, CommandReturnObject &result)
static bool CopyOverBreakpointOptions(BreakpointSP bp_sp, BreakpointOptionGroup &bp_opts, const std::vector< std::string > &bp_names, CommandReturnObject &result)
static llvm::Expected< LanguageType > GetExceptionLanguageForLanguage(llvm::StringRef lang_name, char short_option='\0', llvm::StringRef long_option={})
static void AddBreakpointDescription(Stream *s, Breakpoint *bp, lldb::DescriptionLevel level)
static Status CompleteLineEntry(ExecutionContext &exe_ctx, OptionValueFileColonLine &line_entry)
static llvm::raw_ostream & error(Stream &strm)
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
BreakpointAccessOptionGroup()=default
const BreakpointName::Permissions & GetPermissions() const
~BreakpointAccessOptionGroup() override=default
BreakpointName::Permissions m_permissions
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
void OptionParsingStarting(ExecutionContext *execution_context) override
BreakpointDummyOptionGroup()=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~BreakpointDummyOptionGroup() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
OptionValueBoolean m_use_dummy
BreakpointNameOptionGroup()
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
OptionValueString m_help_string
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~BreakpointNameOptionGroup() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
OptionValueUInt64 m_breakpoint
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
const std::vector< std::string > & GetBreakpointNames()
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
~BreakpointNamesOptionGroup() override=default
std::vector< std::string > m_breakpoint_names
BreakpointNamesOptionGroup()=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
BreakpointNamesOptionGroup m_name_opts
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointAddAddress(CommandInterpreter &interpreter)
Options * GetOptions() override
BreakpointDummyOptionGroup m_dummy_options
~CommandObjectBreakpointAddAddress() override=default
BreakpointOptionGroup m_bp_opts
OptionGroupOptions m_all_options
uint32_t m_exception_stage
Args m_exception_extra_args
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
~CommandOptions() override=default
OptionGroupOptions m_all_options
~CommandObjectBreakpointAddException() override=default
BreakpointNamesOptionGroup m_name_opts
CommandObjectBreakpointAddException(CommandInterpreter &interpreter)
BreakpointOptionGroup m_bp_opts
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
BreakpointDummyOptionGroup m_dummy_options
LazyBool m_move_to_nearest_code
OptionValueFileColonLine m_cur_value
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
lldb::addr_t m_offset_addr
Status OptionParsingFinished(ExecutionContext *execution_context) override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
~CommandOptions() override=default
std::vector< OptionValueFileColonLine > m_line_specs
Options * GetOptions() override
CommandObjectBreakpointAddFile(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
BreakpointNamesOptionGroup m_name_opts
OptionGroupOptions m_all_options
~CommandObjectBreakpointAddFile() override=default
BreakpointOptionGroup m_bp_opts
BreakpointDummyOptionGroup m_dummy_options
LazyBool m_move_to_nearest_code
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
NameMatchStyle m_lookup_style
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
lldb::addr_t m_offset_addr
BreakpointOptionGroup m_bp_opts
BreakpointNamesOptionGroup m_name_opts
Options * GetOptions() override
BreakpointDummyOptionGroup m_dummy_options
OptionGroupOptions m_all_options
~CommandObjectBreakpointAddName() override=default
CommandObjectBreakpointAddName(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandOptions() override=default
std::unordered_set< std::string > m_func_names
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
LazyBool m_move_to_nearest_code
BreakpointDummyOptionGroup m_dummy_options
void DoExecute(llvm::StringRef command, CommandReturnObject &result) override
BreakpointNamesOptionGroup m_name_opts
BreakpointOptionGroup m_bp_opts
~CommandObjectBreakpointAddPattern() override=default
Options * GetOptions() override
CommandObjectBreakpointAddPattern(CommandInterpreter &interpreter)
OptionGroupOptions m_all_options
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
BreakpointDummyOptionGroup m_dummy_options
Options * GetOptions() override
~CommandObjectBreakpointAddScripted() override=default
BreakpointNamesOptionGroup m_name_opts
CommandObjectBreakpointAddScripted(CommandInterpreter &interpreter)
OptionGroupOptions m_all_options
BreakpointOptionGroup m_bp_opts
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupPythonClassWithDict m_python_class_options
CommandObjectBreakpointAdd(CommandInterpreter &interpreter)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
CommandObjectBreakpointClear(CommandInterpreter &interpreter)
~CommandObjectBreakpointClear() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandOptions() override=default
CommandObjectBreakpointDelete(CommandInterpreter &interpreter)
~CommandObjectBreakpointDelete() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointDisable() override=default
CommandObjectBreakpointDisable(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
~CommandObjectBreakpointEnable() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointEnable(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
lldb::DescriptionLevel m_level
~CommandObjectBreakpointList() override=default
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointList(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
BreakpointDummyOptionGroup m_dummy_opts
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointModify(CommandInterpreter &interpreter)
BreakpointOptionGroup m_bp_opts
~CommandObjectBreakpointModify() override=default
OptionGroupOptions m_options
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupOptions m_option_group
CommandObjectBreakpointNameAdd(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointNameAdd() override=default
BreakpointNameOptionGroup m_name_options
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
BreakpointNameOptionGroup m_name_options
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointNameDelete(CommandInterpreter &interpreter)
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectBreakpointNameDelete() override=default
OptionGroupOptions m_option_group
CommandObjectBreakpointNameList(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
OptionGroupOptions m_option_group
~CommandObjectBreakpointNameList() override=default
BreakpointNameOptionGroup m_name_options
~CommandObjectBreakpointName() override=default
CommandObjectBreakpointName(CommandInterpreter &interpreter)
std::string m_description
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
~CommandOptions() override=default
Options * GetOptions() override
OptionGroupOptions m_all_options
BreakpointDummyOptionGroup m_dummy_options
CommandObjectBreakpointOverrideAdd(CommandInterpreter &interpreter)
~CommandObjectBreakpointOverrideAdd() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupPythonClassWithDict m_python_class_options
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupOptions m_all_options
CommandObjectBreakpointOverrideDelete(CommandInterpreter &interpreter)
BreakpointDummyOptionGroup m_dummy_options
Options * GetOptions() override
~CommandObjectBreakpointOverrideDelete() override=default
CommandObjectBreakpointOverrideList(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointOverrideList() override=default
BreakpointDummyOptionGroup m_dummy_options
OptionGroupOptions m_all_options
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointOverride(CommandInterpreter &interpreter)
~CommandObjectBreakpointOverride() override=default
void HandleOptionArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector, int opt_element_index, CommandInterpreter &interpreter) override
Handles the generic bits of figuring out whether we are in an option, and if so completing it.
std::vector< std::string > m_names
~CommandOptions() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectBreakpointRead(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectBreakpointRead() override=default
lldb::LanguageType m_language
void OptionParsingStarting(ExecutionContext *execution_context) override
std::string m_func_regexp
std::string m_source_text_regexp
std::vector< std::string > m_breakpoint_names
~CommandOptions() override=default
Args m_exception_extra_args
std::string m_current_key
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
lldb::LanguageType m_exception_language
lldb::addr_t m_offset_addr
LazyBool m_move_to_nearest_code
lldb::FunctionNameType m_func_name_type_mask
std::vector< std::string > m_func_names
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
std::unordered_set< std::string > m_source_regex_func_names
OptionGroupOptions m_all_options
~CommandObjectBreakpointSet() override=default
BreakpointOptionGroup m_bp_opts
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
OptionGroupPythonClassWithDict m_python_class_options
CommandObjectBreakpointSet(CommandInterpreter &interpreter)
BreakpointDummyOptionGroup m_dummy_options
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectBreakpointWrite(CommandInterpreter &interpreter)
~CommandObjectBreakpointWrite() override=default
A section + offset based address class.
A command line argument class.
llvm::ArrayRef< const char * > GetArgumentArrayRef() const
Gets the argument as an ArrayRef.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
llvm::ArrayRef< ArgEntry > entries() const
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
bool Contains(BreakpointID bp_id) const
bool AddBreakpointID(BreakpointID bp_id)
static llvm::Error FindAndReplaceIDRanges(Args &old_args, const ExecutionContext &exe_ctx, bool allow_locations, BreakpointName::Permissions ::PermissionKinds purpose, Args &new_args)
BreakpointID GetBreakpointIDAtIndex(size_t index) const
static std::optional< BreakpointID > ParseCanonicalReference(llvm::StringRef input)
Takes an input string containing the description of a breakpoint or breakpoint and location and retur...
lldb::break_id_t GetBreakpointID() const
lldb::break_id_t GetLocationID() const
static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
Takes a breakpoint ID and the breakpoint location id and returns a string containing the canonical de...
static bool StringIsBreakpointName(llvm::StringRef str, Status &error)
Takes an input string and checks to see whether it is a breakpoint name.
General Outline: Allows adding and removing breakpoints and find by ID and index.
BreakpointIterable Breakpoints()
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const
Returns a shared pointer to the breakpoint with id breakID.
void GetListMutex(std::unique_lock< std::recursive_mutex > &lock)
Sets the passed in Locker to hold the Breakpoint List mutex.
size_t GetSize() const
Returns the number of elements in this breakpoint list.
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const
Returns a shared pointer to the breakpoint with index i.
size_t GetSize() const
Returns the number of elements in this breakpoint location list.
General Outline: A breakpoint location is defined by the breakpoint that produces it,...
llvm::Error SetEnabled(bool enabled)
If enabled is true, enable the breakpoint, if false disable it.
BreakpointOptions & GetLocationOptions()
Use this to set location specific breakpoint options.
bool GetDescription(Stream *s, lldb::DescriptionLevel level)
void SetHelp(const char *description)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status OptionParsingFinished(ExecutionContext *execution_context) override
const BreakpointOptions & GetBreakpointOptions()
BreakpointOptions m_bp_opts
std::vector< std::string > m_commands
~BreakpointOptionGroup() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
void CopyOverSetOptions(const BreakpointOptions &rhs)
Copy over only the options set in the incoming BreakpointOptions.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id, bool use_facade=true)
Find a breakpoint location for a given breakpoint location ID.
void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_locations=false)
Put a description of this breakpoint into the stream s.
BreakpointOptions & GetOptions()
Returns the BreakpointOptions structure set at the breakpoint level.
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(bool adopt_dummy_target=true) const
Returns the execution context the interpreter should run a command in.
static void VerifyIDs(Args &args, const ExecutionContext &exe_ctx, bool allow_locations, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions::PermissionKinds purpose)
CommandObjectMultiwordBreakpoint(CommandInterpreter &interpreter)
static void VerifyBreakpointOrLocationIDs(Args &args, const ExecutionContext &exe_ctx, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions ::PermissionKinds purpose)
~CommandObjectMultiwordBreakpoint() override
static void VerifyBreakpointIDs(Args &args, const ExecutionContext &exe_ctx, CommandReturnObject &result, BreakpointIDList *valid_ids, BreakpointName::Permissions::PermissionKinds purpose)
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
CommandObjectMultiword(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
friend class CommandInterpreter
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
std::vector< CommandArgumentData > CommandArgumentEntry
virtual void SetHelpLong(llvm::StringRef str)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
Target & GetDummyTarget()
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
void AddIDsArgumentData(IDType type)
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
Target * GetTarget()
Get the target this command should operate on.
void AppendMessage(llvm::StringRef in_string)
void AppendError(llvm::StringRef in_string)
std::string GetErrorString(bool with_diagnostics=true) const
Return the errors as a string.
Stream & GetErrorStream()
void SetStatus(lldb::ReturnStatus status)
void SetError(Status error)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void void AppendMessageWithFormatv(const char *format, Args &&...args)
void AppendWarning(llvm::StringRef in_string)
void AppendErrorWithFormatv(const char *format, Args &&...args)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
const Args & GetParsedLine() const
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
A 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.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static llvm::Expected< lldb::LanguageType > GetExceptionLanguageForLanguage(llvm::StringRef lang_name)
static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions()
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
uint32_t GetColumnNumber()
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
void SetLine(uint32_t line)
void SetFile(const FileSpec &file_spec)
A pair of an option list with a 'raw' string as a suffix.
bool HasArgs() const
Returns true if there are any arguments before the raw suffix.
Args & GetArgs()
Returns the list of arguments.
const std::string & GetRawPart() const
Returns the raw suffix part of the parsed string.
A command line option parsing protocol class.
std::vector< Option > m_getopt_table
llvm::Error GetError() const
Return an error if the regular expression failed to compile.
std::optional< SupportFileAndLine > GetDefaultFileAndLine()
This base class provides an interface to stack frames.
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
virtual bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
static Status FromErrorString(const char *str)
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
bool Success() const
Test for success condition.
lldb::break_id_t GetID() const
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
ObjectSP GetItemAtIndex(size_t idx) const
std::optional< llvm::StringRef > GetItemAtIndexAsString(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
bool GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
std::shared_ptr< Object > ObjectSP
static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error)
Defines a symbol context baton that can be handed other debug core functions.
LineEntry line_entry
The LineEntry for a given query.
void DescribeBreakpointOverrides(Stream &stream, std::vector< lldb::user_id_t > &idxs)
Describe the breakpoint overrides.
lldb::BreakpointSP CreateScriptedBreakpoint(const llvm::StringRef class_name, const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, bool internal, bool request_hardware, StructuredData::ObjectSP extra_args_sp, Status *creation_error=nullptr)
lldb::BreakpointSP CreateFuncRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, RegularExpression func_regexp, lldb::LanguageType requested_language, LazyBool skip_prologue, bool internal, bool request_hardware)
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
BreakpointList & GetBreakpointList(bool internal=false)
SourceManager & GetSourceManager()
lldb::user_id_t AddBreakpointResolverOverride(BreakpointResolverOverrideUP override_up)
Add a breakpoint override resolver. This version can't fail.
Debugger & GetDebugger() const
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
void DisableAllowedBreakpoints()
bool RemoveBreakpointByID(lldb::break_id_t break_id)
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
void ClearBreakpointResolverOverrides()
bool RemoveBreakpointResolverOverride(lldb::user_id_t override_id)
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
lldb::BreakpointSP CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args=nullptr, Status *additional_args_error=nullptr)
void EnableAllowedBreakpoints()
void RemoveAllowedBreakpoints()
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
lldb::BreakpointSP CreateSourceRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *source_file_list, const std::unordered_set< std::string > &function_names, RegularExpression source_regex, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
void GetBreakpointNames(std::vector< std::string > &names)
bool IsDummyTarget() const
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
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)