26 if (ref.equals_insensitive(
"false") || ref.equals_insensitive(
"off") ||
27 ref.equals_insensitive(
"no") || ref.equals_insensitive(
"0")) {
29 }
else if (ref.equals_insensitive(
"true") || ref.equals_insensitive(
"on") ||
30 ref.equals_insensitive(
"yes") || ref.equals_insensitive(
"1")) {
39 llvm::StringRef option_arg) {
41 const bool option_value =
42 ToBoolean(option_arg,
false , &parse_success);
46 return llvm::createStringError(
47 "Invalid boolean value for option '%s': '%s'",
48 option_name.str().c_str(),
49 option_arg.empty() ?
"<null>" : option_arg.str().c_str());
68 if (enum_values.empty()) {
78 for (
const auto &enum_value : enum_values) {
79 llvm::StringRef this_enum(enum_value.string_value);
80 if (this_enum.starts_with(s))
81 return enum_value.value;
85 strm.
PutCString(
"invalid enumeration value, valid values are: ");
87 for (
const auto &enum_value : enum_values) {
89 is_first ? is_first =
false,
"" :
", ", enum_value.string_value);
96 size_t *byte_size_ptr) {
103 char *format_char =
nullptr;
104 unsigned long byte_size = ::strtoul(s, &format_char, 0);
105 if (byte_size != ULONG_MAX)
106 *byte_size_ptr = byte_size;
115 "Invalid format character or name '%s'. Valid values are:\n", s);
119 error_strm.
Printf(
"'%c' or ", format_char);
127 "An optional byte size can precede the format character.\n");
135 s ?
"empty" :
"invalid");
145 if (s.equals_insensitive(
"python"))
147 if (s.equals_insensitive(
"lua"))
149 if (s.equals_insensitive(
"default"))
151 if (s.equals_insensitive(
"none"))
155 *success_ptr =
false;
163 std::optional<lldb::addr_t> maybe_addr =
DoToAddress(exe_ctx, s, error_ptr);
164 return maybe_addr ? *maybe_addr : fail_value;
171 std::optional<lldb::addr_t> maybe_addr =
DoToAddress(exe_ctx, s, error_ptr);
178 if (
ABISP abi_sp = process->GetABI())
179 addr = abi_sp->FixCodeAddress(addr);
184std::optional<lldb::addr_t>
190 "invalid address expression \"%s\"", s.str().c_str());
194 llvm::StringRef sref = s;
197 if (!s.getAsInteger(0, addr)) {
205 if (!s.getAsInteger(16, addr)) {
215 "invalid address expression \"%s\"", s.str().c_str());
229 bool success =
false;
232 valobj_sp = valobj_sp->GetQualifiedRepresentationIfAvailable(
233 valobj_sp->GetDynamicValueType(),
true);
236 addr = valobj_sp->GetValueAsUnsigned(0, &success);
244 "address expression \"%s\" resulted in a value whose type "
245 "can't be converted to an address: %s",
246 s.str().c_str(), valobj_sp->GetTypeName().GetCString());
266 "^(\\$[^ +-]+)|(([^ +-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$");
268 llvm::SmallVector<llvm::StringRef, 4> matches;
269 if (g_symbol_plus_offset_regex.
Execute(sref, &matches)) {
271 llvm::StringRef name;
272 if (!matches[1].empty())
277 llvm::StringRef sign = matches[4];
278 llvm::StringRef str_offset = matches[5];
282 std::optional<lldb::addr_t> register_value;
284 llvm::StringRef reg_name = name;
285 if (frame && reg_name.consume_front(
"$")) {
288 const RegisterInfo *reg_info = reg_ctx_sp->GetRegisterInfoByName(reg_name);
291 bool success = reg_ctx_sp->ReadRegister(reg_info, reg_val);
295 register_value.reset();
300 if (!str_offset.empty() && !str_offset.getAsInteger(0, offset)) {
303 addr = register_value.value();
308 return addr + offset;
309 return addr - offset;
311 }
else if (register_value)
314 return register_value.value();
319 "address expression \"%s\" evaluation failed", s.str().c_str());
static llvm::raw_ostream & error(Stream &strm)
void SetUnwindOnError(bool unwind=false)
void SetKeepInMemory(bool keep=true)
void SetCoerceToId(bool coerce=true)
void SetTryAllThreads(bool try_others=true)
"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.
Process * GetProcessPtr() const
Returns a pointer to the process object.
A plug-in interface definition class for debugging a process.
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
RegisterValue::Type GetType() const
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
This base class provides an interface to stack frames.
lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
void Clear()
Clear the object state.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
llvm::StringRef GetString() const
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.
size_t EOL()
Output and End of Line character to the stream.
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
ScriptLanguage
Script interpreter types.
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Format
Display format definitions.
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)
static char ToChar(llvm::StringRef s, char fail_value, bool *success_ptr)
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 lldb::addr_t ToRawAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, Status *error_ptr)
As for ToAddress but do not remove non-address bits from the result.
static std::optional< lldb::addr_t > DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, Status *error)
static Status ToFormat(const char *s, lldb::Format &format, size_t *byte_size_ptr)
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)
Every register is described in detail including its name, alternate name (optional),...