15#include "llvm/Support/FormatAdapters.h"
22 return "Register names can be specified using the architecture specific "
24 "They can also be specified using generic names. Not all generic "
26 "registers backing them on all architectures. When they don't the "
28 "will return an error.\n"
29 "The generic names defined in lldb are:\n"
31 "pc - program counter register\n"
32 "ra - return address register\n"
33 "fp - frame pointer register\n"
34 "sp - stack pointer register\n"
35 "flags - the flags register\n"
36 "arg{1-6} - integer argument passing registers.\n";
40 return "Breakpoints are identified using major and minor numbers; the major "
41 "number corresponds to the single entity that was created with a "
43 "set' command; the minor numbers correspond to all the locations that "
45 "actually found/set based on the major breakpoint. A full breakpoint "
47 "look like 3.14, meaning the 14th location set for the 3rd "
49 "can specify all the locations of a breakpoint by just indicating the "
51 "breakpoint number. A valid breakpoint ID consists either of just the "
53 "number, or the major number followed by a dot and the location "
55 "3 or 3.2 could both be valid breakpoint IDs.)\n"
57 "You can use . to refer to the breakpoint location(s) at which the "
58 "current thread is stopped.";
62 return "A 'breakpoint ID list' is a manner of specifying multiple "
64 "This can be done through several mechanisms. The easiest way is to "
66 "enter a space-separated list of breakpoint IDs. To specify all the "
67 "breakpoint locations under a major breakpoint, you can use the major "
68 "breakpoint number followed by '.*', eg. '5.*' means all the "
70 "breakpoint 5. You can also indicate a range of breakpoints by using "
71 "<start-bp-id> - <end-bp-id>. The start-bp-id and end-bp-id for a "
73 "be any valid breakpoint IDs. It is not legal, however, to specify a "
75 "using specific locations that cross major breakpoint numbers. I.e. "
77 " is legal; 2 - 5 is legal; but 3.2 - 4.4 is not legal.";
81 return "A name that can be added to a breakpoint when it is created, or "
83 "on with the \"breakpoint name add\" command. "
84 "Breakpoint names can be used to specify breakpoints in all the "
85 "places breakpoint IDs "
86 "and breakpoint ID ranges can be used. As such they provide a "
87 "convenient way to group breakpoints, "
88 "and to operate on breakpoints you create without having to track the "
90 "Note, the attributes you set when using a breakpoint name in a "
91 "breakpoint command don't "
92 "adhere to the name, but instead are set individually on all the "
93 "breakpoints currently tagged with that "
94 "name. Future breakpoints "
95 "tagged with that name will not pick up the attributes previously "
96 "given using that name. "
97 "In order to distinguish breakpoint names from breakpoint IDs and "
99 "names must start with a letter from a-z or A-Z and cannot contain "
100 "spaces, \".\" or \"-\". "
101 "Also, breakpoint names can only be applied to breakpoints, not to "
102 "breakpoint locations.";
106 return "A GDB format consists of a repeat count, a format letter and a size "
108 "The repeat count is optional and defaults to 1. The format letter is "
110 "and defaults to the previous format that was used. The size letter "
112 "and defaults to the previous size that was used.\n"
114 "Format letters include:\n"
118 "u - unsigned decimal\n"
128 "Size letters include:\n"
129 "b - 1 byte (byte)\n"
130 "h - 2 bytes (halfword)\n"
131 "w - 4 bytes (word)\n"
132 "g - 8 bytes (giant)\n"
135 "32xb - show 32 1 byte hexadecimal integer values\n"
136 "16xh - show 16 2 byte hexadecimal integer values\n"
137 "64 - show 64 2 byte hexadecimal integer values (format and size "
138 "from the last format)\n"
139 "dw - show 1 4 byte decimal integer value\n";
143 static std::string help_text;
145 if (!help_text.empty())
149 sstr <<
"One of the format names (or one-character names) that can be used "
150 "to show a variable's value:\n";
157 sstr.
Printf(
"'%c' or ", format_char);
164 help_text = std::string(sstr.
GetString());
170 static std::string help_text;
172 if (!help_text.empty())
176 sstr <<
"One of the following languages:\n";
182 help_text = std::string(sstr.
GetString());
188 static std::string help_text;
190 llvm::SmallVector<std::pair<llvm::StringRef, llvm::StringRef>> extensions;
194 llvm::StringRef name =
196 longest = std::max(longest, name.size());
197 extensions.emplace_back(name, instance.
description);
201 sstr <<
"The name of a scripting extension. One of the following:\n";
202 for (
const auto &[name, description] : extensions)
203 sstr.
Format(
" {0} - {1}\n",
204 llvm::fmt_align(name, llvm::AlignStyle::Left, longest),
207 help_text = std::string(sstr.GetString());
212 return "A summary string is a way to extract information from variables in "
213 "order to present them using a summary.\n"
214 "Summary strings contain static text, variables, scopes and control "
216 " - Static text can be any sequence of non-special characters, i.e. "
217 "anything but '{', '}', '$', or '\\'.\n"
218 " - Variables are sequences of characters beginning with ${, ending "
219 "with } and that contain symbols in the format described below.\n"
220 " - Scopes are any sequence of text between { and }. Anything "
221 "included in a scope will only appear in the output summary if there "
223 " - Control sequences are the usual C/C++ '\\a', '\\n', ..., plus "
224 "'\\$', '\\{' and '\\}'.\n"
225 "A summary string works by copying static text verbatim, turning "
226 "control sequences into their character counterpart, expanding "
227 "variables and trying to expand scopes.\n"
228 "A variable is expanded by giving it a value other than its textual "
229 "representation, and the way this is done depends on what comes after "
231 "The most common sequence if ${var followed by an expression path, "
232 "which is the text one would type to access a member of an aggregate "
233 "types, given a variable of that type"
234 " (e.g. if type T has a member named x, which has a member named y, "
235 "and if t is of type T, the expression path would be .x.y and the way "
236 "to fit that into a summary string would be"
237 " ${var.x.y}). You can also use ${*var followed by an expression path "
238 "and in that case the object referred by the path will be "
239 "dereferenced before being displayed."
240 " If the object is not a pointer, doing so will cause an error. For "
241 "additional details on expression paths, you can type 'help "
243 "By default, summary strings attempt to display the summary for any "
244 "variable they reference, and if that fails the value. If neither can "
245 "be shown, nothing is displayed."
246 "In a summary string, you can also use an array index [n], or a "
247 "slice-like range [n-m]. This can have two different meanings "
248 "depending on what kind of object the expression"
250 " - if it is a scalar type (any basic type like int, float, ...) the "
251 "expression is a bitfield, i.e. the bits indicated by the indexing "
252 "operator are extracted out of the number"
253 " and displayed as an individual variable\n"
254 " - if it is an array or pointer the array items indicated by the "
255 "indexing operator are shown as the result of the variable. if the "
256 "expression is an array, real array items are"
257 " printed; if it is a pointer, the pointer-as-array syntax is used to "
258 "obtain the values (this means, the latter case can have no range "
260 "If you are trying to display an array for which the size is known, "
261 "you can also use [] instead of giving an exact range. This has the "
262 "effect of showing items 0 thru size - 1.\n"
263 "Additionally, a variable can contain an (optional) format code, as "
264 "in ${var.x.y%code}, where code can be any of the valid formats "
265 "described in 'help format', or one of the"
266 " special symbols only allowed as part of a variable:\n"
267 " %V: show the value of the object by default\n"
268 " %S: show the summary of the object by default\n"
269 " %@: show the runtime-provided object description (for "
270 "Objective-C, it calls NSPrintForDebugger; for C/C++ it does "
272 " %L: show the location of the object (memory address or a "
274 " %#: show the number of children of the object\n"
275 " %T: show the type of the object\n"
276 "Another variable that you can use in summary strings is ${svar . "
277 "This sequence works exactly like ${var, including the fact that "
278 "${*svar is an allowed sequence, but uses"
279 " the object's synthetic children provider instead of the actual "
280 "objects. For instance, if you are using STL synthetic children "
281 "providers, the following summary string would"
282 " count the number of actual elements stored in an std::list:\n"
283 "type summary add -s \"${svar%#}\" -x \"std::list<\"";
287 return "An expression path is the sequence of symbols that is used in C/C++ "
288 "to access a member variable of an aggregate object (class).\n"
289 "For instance, given a class:\n"
295 "the expression to read item b in the item pointed to by next for foo "
296 "aFoo would be aFoo.next->b.\n"
297 "Given that aFoo could just be any object of type foo, the string "
298 "'.next->b' is the expression path, because it can be attached to any "
299 "foo instance to achieve the effect.\n"
300 "Expression paths in LLDB include dot (.) and arrow (->) operators, "
301 "and most commands using expression paths have ways to also accept "
302 "the star (*) operator.\n"
303 "The meaning of these operators is the same as the usual one given to "
304 "them by the C/C++ standards.\n"
305 "LLDB also has support for indexing ([ ]) in expression paths, and "
306 "extends the traditional meaning of the square brackets operator to "
307 "allow bitfield extraction:\n"
308 "for objects of native types (int, float, char, ...) saying '[n-m]' "
309 "as an expression path (where n and m are any positive integers, e.g. "
310 "[3-5]) causes LLDB to extract"
311 " bits n thru m from the value of the variable. If n == m, [n] is "
312 "also allowed as a shortcut syntax. For arrays and pointers, "
313 "expression paths can only contain one index"
314 " and the meaning of the operation is the same as the one defined by "
315 "C/C++ (item extraction). Some commands extend bitfield-like syntax "
316 "for arrays and pointers with the"
317 " meaning of array slicing (taking elements n thru m inside the array "
318 "or pointed-to memory).";
323 if (g_archs_help.
Empty()) {
327 g_archs_help.
PutCString(
"These are the supported architecture names:\n");
328 archs.
Join(
"\n", g_archs_help);
336 "g_argument_table order doesn't match CommandArgumentType enumeration");
static void ListSupportedArchNames(StringList &list)
static void PrintAllLanguages(Stream &s, const char *prefix, const char *suffix)
static void ForEachScriptedExtension(llvm::function_ref< void(const ScriptedInterfaceInstance &)> callback, lldb::ScriptLanguage language=lldb::eScriptLanguageUnknown)
Invoke callback once per registered scripted extension, passing the first interface registered for it...
static llvm::StringLiteral ExtensionToString(lldb::ScriptedExtension extension)
void Flush() override
Flush the stream.
llvm::StringRef GetString() const
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes to the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void Join(const char *separator, Stream &strm)
A class that represents a running process on the host machine.
llvm::StringRef GDBFormatHelpTextCallback()
llvm::StringRef ScriptedExtensionHelpTextCallback()
llvm::StringRef arch_helper()
llvm::StringRef SummaryStringHelpTextCallback()
llvm::StringRef RegisterNameHelpTextCallback()
llvm::StringRef ExprPathHelpTextCallback()
llvm::StringRef BreakpointIDRangeHelpTextCallback()
TableValidator< 0 > validator
llvm::StringRef BreakpointIDHelpTextCallback()
llvm::StringRef LanguageTypeHelpTextCallback()
llvm::StringRef BreakpointNameHelpTextCallback()
llvm::StringRef FormatHelpTextCallback()
static constexpr CommandObject::ArgumentTableEntry g_argument_table[]
Format
Display format definitions.
llvm::StringRef description
lldb::ScriptedExtension extension