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()) {
69 error.SetErrorString(
"invalid enumeration argument");
74 error.SetErrorString(
"empty enumeration string");
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");
134 error.SetErrorStringWithFormat(
"%s option string", s ?
"empty" :
"invalid");
144 if (s.equals_insensitive(
"python"))
146 if (s.equals_insensitive(
"lua"))
148 if (s.equals_insensitive(
"default"))
150 if (s.equals_insensitive(
"none"))
154 *success_ptr =
false;
162 std::optional<lldb::addr_t> maybe_addr =
DoToAddress(exe_ctx, s, error_ptr);
163 return maybe_addr ? *maybe_addr : fail_value;
170 std::optional<lldb::addr_t> maybe_addr =
DoToAddress(exe_ctx, s, error_ptr);
177 if (
ABISP abi_sp = process->GetABI())
178 addr = abi_sp->FixCodeAddress(addr);
183std::optional<lldb::addr_t>
193 llvm::StringRef sref = s;
196 if (!s.getAsInteger(0, addr)) {
204 if (!s.getAsInteger(16, addr)) {
228 bool success =
false;
231 valobj_sp = valobj_sp->GetQualifiedRepresentationIfAvailable(
232 valobj_sp->GetDynamicValueType(),
true);
235 addr = valobj_sp->GetValueAsUnsigned(0, &success);
243 "address expression \"%s\" resulted in a value whose type "
244 "can't be converted to an address: %s",
245 s.str().c_str(), valobj_sp->GetTypeName().GetCString());
265 "^(\\$[^ +-]+)|(([^ +-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$");
267 llvm::SmallVector<llvm::StringRef, 4> matches;
268 if (g_symbol_plus_offset_regex.
Execute(sref, &matches)) {
270 llvm::StringRef name;
271 if (!matches[1].empty())
276 llvm::StringRef sign = matches[4];
277 llvm::StringRef str_offset = matches[5];
281 std::optional<lldb::addr_t> register_value;
283 llvm::StringRef reg_name = name;
284 if (frame && reg_name.consume_front(
"$")) {
287 const RegisterInfo *reg_info = reg_ctx_sp->GetRegisterInfoByName(reg_name);
290 bool success = reg_ctx_sp->ReadRegister(reg_info, reg_val);
294 register_value.reset();
299 if (!str_offset.empty() && !str_offset.getAsInteger(0, offset)) {
302 addr = register_value.value();
307 return addr + offset;
308 return addr - offset;
310 }
else if (register_value)
313 return register_value.value();
318 "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.
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
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),...