24 if (ref.equals_insensitive(
"false") || ref.equals_insensitive(
"off") ||
25 ref.equals_insensitive(
"no") || ref.equals_insensitive(
"0")) {
27 }
else if (ref.equals_insensitive(
"true") || ref.equals_insensitive(
"on") ||
28 ref.equals_insensitive(
"yes") || ref.equals_insensitive(
"1")) {
52 if (enum_values.empty()) {
53 error.SetErrorString(
"invalid enumeration argument");
58 error.SetErrorString(
"empty enumeration string");
62 for (
const auto &enum_value : enum_values) {
63 llvm::StringRef this_enum(enum_value.string_value);
64 if (this_enum.startswith(s))
65 return enum_value.value;
69 strm.
PutCString(
"invalid enumeration value, valid values are: ");
71 for (
const auto &enum_value : enum_values) {
73 is_first ? is_first =
false,
"" :
", ", enum_value.string_value);
80 size_t *byte_size_ptr) {
87 char *format_char =
nullptr;
88 unsigned long byte_size = ::strtoul(s, &format_char, 0);
89 if (byte_size != ULONG_MAX)
90 *byte_size_ptr = byte_size;
96 const bool partial_match_ok =
true;
100 "Invalid format character or name '%s'. Valid values are:\n", s);
104 error_strm.
Printf(
"'%c' or ", format_char);
112 "An optional byte size can precede the format character.\n");
119 error.SetErrorStringWithFormat(
"%s option string", s ?
"empty" :
"invalid");
129 if (s.equals_insensitive(
"python"))
131 if (s.equals_insensitive(
"lua"))
133 if (s.equals_insensitive(
"default"))
135 if (s.equals_insensitive(
"none"))
139 *success_ptr =
false;
147 std::optional<lldb::addr_t> maybe_addr =
DoToAddress(exe_ctx, s, error_ptr);
148 return maybe_addr ? *maybe_addr : fail_value;
155 std::optional<lldb::addr_t> maybe_addr =
DoToAddress(exe_ctx, s, error_ptr);
162 if (
ABISP abi_sp = process->GetABI())
163 addr = abi_sp->FixCodeAddress(addr);
168std::optional<lldb::addr_t>
171 bool error_set =
false;
179 llvm::StringRef sref = s;
182 if (!s.getAsInteger(0, addr)) {
190 if (!s.getAsInteger(16, addr)) {
214 bool success =
false;
217 valobj_sp = valobj_sp->GetQualifiedRepresentationIfAvailable(
218 valobj_sp->GetDynamicValueType(),
true);
221 addr = valobj_sp->GetValueAsUnsigned(0, &success);
230 "address expression \"%s\" resulted in a value whose type "
231 "can't be converted to an address: %s",
232 s.str().c_str(), valobj_sp->GetTypeName().GetCString());
241 "^(.*)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*$");
243 llvm::SmallVector<llvm::StringRef, 4> matches;
244 if (g_symbol_plus_offset_regex.
Execute(sref, &matches)) {
246 std::string name = matches[1].str();
247 std::string sign = matches[2].str();
248 std::string str_offset = matches[3].str();
249 if (!llvm::StringRef(str_offset).getAsInteger(0, offset)) {
254 return addr + offset;
256 return addr - offset;
264 "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.
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...
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.
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)