LLDB mainline
CommandObjectRegister.cpp
Go to the documentation of this file.
1//===-- CommandObjectRegister.cpp -----------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "lldb/Core/Debugger.h"
24#include "lldb/Target/Process.h"
28#include "lldb/Target/Thread.h"
29#include "lldb/Utility/Args.h"
32#include "lldb/Utility/Status.h"
35#include "llvm/Support/Errno.h"
36#include "llvm/Support/Error.h"
37
38#include <string>
39#include <vector>
40
41using namespace lldb;
42using namespace lldb_private;
43
44// "register read"
45#define LLDB_OPTIONS_register_read
46#include "CommandOptions.inc"
47
48static size_t GetNameSize(const RegisterInfo *reg_info, bool use_primary_name) {
49 const char *reg_name = use_primary_name ? reg_info->name : reg_info->alt_name;
50 return reg_name ? strlen(reg_name) : 0;
51}
52
54 const RegisterSet &reg_set,
55 bool use_primary_name,
56 bool primitive_only) {
57 const size_t num_registers = reg_set.num_registers;
58 size_t name_right_align_at = 0;
59
60 // Loop through all the registers to find the longest register name.
61 for (size_t reg_idx = 0; reg_idx < num_registers; ++reg_idx) {
62 const size_t reg = reg_set.registers[reg_idx];
63 if (const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex(reg)) {
64 // Derived registers are skipped if primitive_only is true.
65 if (primitive_only && reg_info->value_regs)
66 continue;
67
68 name_right_align_at = std::max(name_right_align_at,
69 GetNameSize(reg_info, use_primary_name));
70 }
71 }
72
73 return name_right_align_at;
74}
75
77public:
80 interpreter, "register read",
81 "Dump the contents of one or more register values from the current "
82 "frame. If no register is specified, dumps them all.",
83 nullptr,
84 eCommandRequiresFrame | eCommandRequiresRegContext |
85 eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
88 "Specify a format to be used for display. This "
89 "overrides any other register type information."}}) {
91
92 // Add the "--format"
99 }
100
101 ~CommandObjectRegisterRead() override = default;
102
103 void
105 OptionElementVector &opt_element_vector) override {
106 if (!m_exe_ctx.HasProcessScope())
107 return;
108 CommandObject::HandleArgumentCompletion(request, opt_element_vector);
109 }
110
111 Options *GetOptions() override { return &m_option_group; }
112
113 bool DumpRegister(const ExecutionContext &exe_ctx, Stream &strm,
114 RegisterContext &reg_ctx, const RegisterInfo &reg_info,
115 bool print_type, size_t reg_name_right_align_at) {
116 RegisterValue reg_value;
117 if (!reg_ctx.ReadRegister(&reg_info, reg_value))
118 return false;
119
120 strm.Indent();
121
122 bool prefix_with_altname = (bool)m_command_options.alternate_name;
123 bool prefix_with_name = !prefix_with_altname;
124 DumpRegisterValue(reg_value, strm, reg_info, prefix_with_name,
125 prefix_with_altname, m_format_options.GetFormat(),
126 reg_name_right_align_at,
127 exe_ctx.GetBestExecutionContextScope(), print_type,
128 exe_ctx.GetTargetSP());
129 if ((reg_info.encoding == eEncodingUint) ||
130 (reg_info.encoding == eEncodingSint)) {
131 Process *process = exe_ctx.GetProcessPtr();
132 if (process && reg_info.byte_size == process->GetAddressByteSize()) {
133 addr_t reg_addr = reg_value.GetAsUInt64(LLDB_INVALID_ADDRESS);
134 if (reg_addr != LLDB_INVALID_ADDRESS) {
135 Address so_reg_addr;
136 if (exe_ctx.GetTargetRef().ResolveLoadAddress(reg_addr,
137 so_reg_addr)) {
138 strm.PutCString(" ");
139 so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(),
141 }
142 }
143 }
144 }
145 strm.EOL();
146 return true;
147 }
148
149 void DumpRegisterField(Stream &strm, const RegisterInfo &reg_info,
150 const ValueObjectSP &value_sp,
151 size_t reg_name_right_align_at,
152 CommandReturnObject &result) {
153 DumpValueObjectOptions options(*value_sp);
154 options.SetHideRootType(true)
155 .SetHideRootName(true)
156 .SetHideName(true)
158 if (m_format_options.GetFormatValue().OptionWasSet())
159 options.SetFormat(m_format_options.GetFormatValue().GetCurrentValue());
160
161 StreamString value_stream;
162 if (llvm::Error error = value_sp->Dump(value_stream, options)) {
163 result.AppendError(toString(std::move(error)));
164 return;
165 }
166
167 llvm::StringRef value = value_stream.GetString();
168 value.consume_back("\n");
169 const char *register_name =
170 m_command_options.alternate_name && reg_info.alt_name
171 ? reg_info.alt_name
172 : reg_info.name;
173
174 StreamString expression_stream;
175 value_sp->GetExpressionPath(expression_stream);
176 llvm::StringRef expression = expression_stream.GetString();
177 expression.consume_front("$");
178 llvm::StringRef expression_path = expression;
179
180 strm.Indent();
181 // Keep the resolved suffix while allowing an alternate register name.
182 if (expression_path.consume_front(reg_info.name))
183 strm.Printf("%*s%s = ", static_cast<int>(reg_name_right_align_at),
184 register_name, expression_path.str().c_str());
185 else
186 strm.Printf("%*s = ", static_cast<int>(reg_name_right_align_at),
187 expression.str().c_str());
188 strm << value << '\n';
189 }
190
191 bool DumpRegisterSet(const ExecutionContext &exe_ctx, Stream &strm,
192 RegisterContext *reg_ctx, size_t set_idx,
193 bool primitive_only = false) {
194 uint32_t unavailable_count = 0;
195 uint32_t available_count = 0;
196
197 if (!reg_ctx)
198 return false; // thread has no registers (i.e. core files are corrupt,
199 // incomplete crash logs...)
200
201 const RegisterSet *const reg_set = reg_ctx->GetRegisterSet(set_idx);
202 if (reg_set) {
203 strm.Printf("%s:\n", (reg_set->name ? reg_set->name : "unknown"));
204 strm.IndentMore();
205 const size_t num_registers = reg_set->num_registers;
206 size_t reg_name_right_align_at = ComputeLongestRegisterName(
207 reg_ctx, *reg_set, !m_command_options.alternate_name, primitive_only);
208 for (size_t reg_idx = 0; reg_idx < num_registers; ++reg_idx) {
209 const uint32_t reg = reg_set->registers[reg_idx];
210 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex(reg);
211 // Skip the dumping of derived register if primitive_only is true.
212 if (primitive_only && reg_info && reg_info->value_regs)
213 continue;
214
215 if (reg_info &&
216 DumpRegister(exe_ctx, strm, *reg_ctx, *reg_info,
217 /*print_type=*/false, reg_name_right_align_at))
218 ++available_count;
219 else
220 ++unavailable_count;
221 }
222 strm.IndentLess();
223 if (unavailable_count) {
224 strm.Indent();
225 strm.Printf("%u registers were unavailable.\n", unavailable_count);
226 }
227 strm.EOL();
228 }
229 return available_count > 0;
230 }
231
232protected:
233 void DoExecute(Args &command, CommandReturnObject &result) override {
234 Stream &strm = result.GetOutputStream();
235 RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext();
236
237 if (command.GetArgumentCount() == 0) {
238 size_t set_idx;
239
240 size_t num_register_sets = 1;
241 const size_t set_array_size = m_command_options.set_indexes.GetSize();
242 if (set_array_size > 0) {
243 for (size_t i = 0; i < set_array_size; ++i) {
244 set_idx =
245 m_command_options.set_indexes[i]->GetValueAs<uint64_t>().value_or(
246 UINT32_MAX);
247 if (set_idx < reg_ctx->GetRegisterSetCount()) {
248 if (!DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx)) {
249 if (errno)
250 result.AppendErrorWithFormatv("register read failed: {0}\n",
251 llvm::sys::StrError());
252 else
253 result.AppendError("unknown error while reading registers.\n");
254 break;
255 }
256 } else {
257 result.AppendErrorWithFormat("invalid register set index: %" PRIu64,
258 (uint64_t)set_idx);
259 break;
260 }
261 }
262 } else {
263 if (m_command_options.dump_all_sets)
264 num_register_sets = reg_ctx->GetRegisterSetCount();
265
266 for (set_idx = 0; set_idx < num_register_sets; ++set_idx) {
267 // When dump_all_sets option is set, dump primitive as well as
268 // derived registers.
269 DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx,
270 !m_command_options.dump_all_sets.GetCurrentValue());
271 }
272 }
273 } else {
274 if (m_command_options.dump_all_sets) {
275 result.AppendError("the --all option can't be used when registers "
276 "names are supplied as arguments\n");
277 } else if (m_command_options.set_indexes.GetSize() > 0) {
278 result.AppendError("the --set <set> option can't be used when "
279 "registers names are supplied as arguments\n");
280 } else {
281 struct RegisterArgument {
282 std::string expression;
283 const RegisterInfo *reg_info = nullptr;
284 ValueObjectSP value_sp;
286 };
287
288 StackFrame *frame = m_exe_ctx.GetFramePtr();
289 if (!frame) {
290 result.AppendError("no frame");
291 return;
292 }
293 std::vector<RegisterArgument> register_arguments;
294 register_arguments.reserve(command.GetArgumentCount());
295 size_t reg_name_right_align_at = 0;
296
297 for (auto &entry : command) {
298 RegisterArgument argument;
299 argument.expression = entry.ref().str();
300
301 llvm::StringRef expression = entry.ref();
302 expression.consume_front("$");
303 std::string variable_path = "$" + expression.str();
304 VariableSP variable_sp;
305 argument.value_sp = frame->GetValueForVariableExpressionPath(
306 variable_path, eNoDynamicValues,
308 argument.error, eDILModeLegacy);
309 if (argument.error.Fail() &&
310 expression.find_first_of(".[") == llvm::StringRef::npos &&
311 !expression.contains("->")) {
312 argument.error = Status::FromErrorStringWithFormat(
313 "Invalid register name or identifier '%s'",
314 argument.expression.c_str());
315 }
316 if (argument.error.Success()) {
317 ValueObject *root = argument.value_sp->GetRoot();
318 if (root && root->GetValueType() == eValueTypeRegister)
319 argument.reg_info = reg_ctx->GetRegisterInfoByName(
320 root->GetName().GetStringRef());
321 }
322
323 if (argument.error.Success() && !argument.reg_info)
324 argument.error = Status::FromErrorStringWithFormat(
325 "Invalid register expression '%s'",
326 argument.expression.c_str());
327 else if (argument.error.Success())
328 reg_name_right_align_at =
329 std::max(reg_name_right_align_at,
330 GetNameSize(argument.reg_info,
331 !m_command_options.alternate_name));
332 register_arguments.push_back(std::move(argument));
333 }
334
335 // Extra ident to be consistent with register sets dumping.
336 strm.IndentMore();
337 for (const RegisterArgument &argument : register_arguments) {
338 if (argument.error.Fail()) {
339 result.AppendError(argument.error.AsCString());
340 continue;
341 }
342
343 if (argument.value_sp.get() == argument.value_sp->GetRoot()) {
344 // If they have asked for a specific format don't obscure that by
345 // printing a structured value afterwards.
346 bool print_type = !m_format_options.GetFormatValue().OptionWasSet();
347 if (!DumpRegister(m_exe_ctx, strm, *reg_ctx, *argument.reg_info,
348 print_type, reg_name_right_align_at))
349 strm.Printf("%-12s = error: unavailable\n",
350 argument.reg_info->name);
351 } else {
352 DumpRegisterField(strm, *argument.reg_info, argument.value_sp,
353 reg_name_right_align_at, result);
354 }
355 }
356 strm.IndentLess();
357 }
358 }
359 if (result.GetStatus() != eReturnStatusFailed)
361 }
362
364 public:
366 : set_indexes(OptionValue::ConvertTypeToMask(OptionValue::eTypeUInt64)),
367 dump_all_sets(false, false), // Initial and default values are false
368 alternate_name(false, false) {}
369
370 ~CommandOptions() override = default;
371
372 llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
373 return llvm::ArrayRef(g_register_read_options);
374 }
375
376 void OptionParsingStarting(ExecutionContext *execution_context) override {
377 set_indexes.Clear();
378 dump_all_sets.Clear();
379 alternate_name.Clear();
380 }
381
382 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
383 ExecutionContext *execution_context) override {
385 const int short_option = GetDefinitions()[option_idx].short_option;
386 switch (short_option) {
387 case 's': {
388 OptionValueSP value_sp(OptionValueUInt64::Create(option_value, error));
389 if (value_sp)
390 set_indexes.AppendValue(value_sp);
391 } break;
392
393 case 'a':
394 // When we don't use OptionValue::SetValueFromCString(const char *) to
395 // set an option value, it won't be marked as being set in the options
396 // so we make a call to let users know the value was set via option
397 dump_all_sets.SetCurrentValue(true);
398 dump_all_sets.SetOptionWasSet();
399 break;
400
401 case 'A':
402 // When we don't use OptionValue::SetValueFromCString(const char *) to
403 // set an option value, it won't be marked as being set in the options
404 // so we make a call to let users know the value was set via option
405 alternate_name.SetCurrentValue(true);
406 dump_all_sets.SetOptionWasSet();
407 break;
408
409 default:
410 llvm_unreachable("Unimplemented option");
411 }
412 return error;
413 }
414
415 // Instance variables to hold the values for command options.
419 };
420
424};
425
426// "register write"
428public:
430 : CommandObjectParsed(interpreter, "register write",
431 "Modify a single register value.", nullptr,
432 eCommandRequiresFrame | eCommandRequiresRegContext |
433 eCommandProcessMustBeLaunched |
434 eCommandProcessMustBePaused) {
437 CommandArgumentData register_arg;
438 CommandArgumentData value_arg;
439
440 // Define the first (and only) variant of this arg.
441 register_arg.arg_type = eArgTypeRegisterName;
442 register_arg.arg_repetition = eArgRepeatPlain;
443
444 // There is only one variant this argument could be; put it into the
445 // argument entry.
446 arg1.push_back(register_arg);
447
448 // Define the first (and only) variant of this arg.
449 value_arg.arg_type = eArgTypeValue;
451
452 // There is only one variant this argument could be; put it into the
453 // argument entry.
454 arg2.push_back(value_arg);
455
456 // Push the data for the first argument into the m_arguments vector.
457 m_arguments.push_back(arg1);
458 m_arguments.push_back(arg2);
459 }
460
461 ~CommandObjectRegisterWrite() override = default;
462
463 void
465 OptionElementVector &opt_element_vector) override {
466 if (!m_exe_ctx.HasProcessScope() || request.GetCursorIndex() != 0)
467 return;
468
471 }
472
473protected:
474 void DoExecute(Args &command, CommandReturnObject &result) override {
475 DataExtractor reg_data;
476 RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext();
477
478 if (command.GetArgumentCount() != 2) {
479 result.AppendError(
480 "register write takes exactly 2 arguments: <reg-name> <value>");
481 } else {
482 auto reg_name = command[0].ref();
483 auto value_str = command[1].ref();
484
485 // in most LLDB commands we accept $rbx as the name for register RBX -
486 // and here we would reject it and non-existant. we should be more
487 // consistent towards the user and allow them to say reg write $rbx -
488 // internally, however, we should be strict and not allow ourselves to
489 // call our registers $rbx in our own API
490 reg_name.consume_front("$");
491
492 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(reg_name);
493
494 if (reg_info) {
495 RegisterValue reg_value;
496
497 Status error(reg_value.SetValueFromString(reg_info, value_str));
498 if (error.Success()) {
499 if (reg_ctx->WriteRegister(reg_info, reg_value)) {
500 // Toss all frames and anything else in the thread after a register
501 // has been written.
502 m_exe_ctx.GetThreadRef().Flush();
504 return;
505 }
506 }
507 if (error.AsCString()) {
509 "Failed to write register '%s' with value '%s': %s",
510 reg_name.str().c_str(), value_str.str().c_str(),
511 error.AsCString());
512 } else {
514 "Failed to write register '%s' with value '%s'",
515 reg_name.str().c_str(), value_str.str().c_str());
516 }
517 } else {
518 result.AppendErrorWithFormat("Register not found for '%s'",
519 reg_name.str().c_str());
520 }
521 }
522 }
523};
524
525// "register info"
527public:
529 : CommandObjectParsed(interpreter, "register info",
530 "View information about a register.", nullptr,
531 eCommandRequiresFrame | eCommandRequiresRegContext |
532 eCommandProcessMustBeLaunched |
533 eCommandProcessMustBePaused) {
534 SetHelpLong(R"(
535Name The name lldb uses for the register, optionally with an alias.
536Size The size of the register in bytes and again in bits.
537Invalidates (*) The registers that would be changed if you wrote this
538 register. For example, writing to a narrower alias of a wider
539 register would change the value of the wider register.
540Read from (*) The registers that the value of this register is constructed
541 from. For example, a narrower alias of a wider register will be
542 read from the wider register.
543In sets (*) The register sets that contain this register. For example the
544 PC will be in the "General Purpose Register" set.
545Fields (*) A table of the names and bit positions of the values contained
546 in this register.
547
548Fields marked with (*) may not always be present. Some information may be
549different for the same register when connected to different debug servers.)");
552 }
553
554 ~CommandObjectRegisterInfo() override = default;
555
556 void
558 OptionElementVector &opt_element_vector) override {
559 if (!m_exe_ctx.HasProcessScope() || request.GetCursorIndex() != 0)
560 return;
561 CommandObject::HandleArgumentCompletion(request, opt_element_vector);
562 }
563
564protected:
565 void DoExecute(Args &command, CommandReturnObject &result) override {
566 if (command.GetArgumentCount() != 1) {
567 result.AppendError("register info takes exactly 1 argument: <reg-name>");
568 return;
569 }
570
571 llvm::StringRef reg_name = command[0].ref();
572 RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext();
573 const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(reg_name);
574 if (reg_info) {
576 result.GetOutputStream(), *reg_ctx, *reg_info,
577 GetCommandInterpreter().GetDebugger().GetTerminalWidth());
579 } else
580 result.AppendErrorWithFormat("No register found with name '%s'",
581 reg_name.str().c_str());
582 }
583};
584
585// CommandObjectRegister constructor
587 : CommandObjectMultiword(interpreter, "register",
588 "Commands to access registers for the current "
589 "thread and stack frame.",
590 "register [read|write|info] ...") {
591 LoadSubCommand("read",
593 LoadSubCommand("write",
595 LoadSubCommand("info",
597}
598
static size_t GetNameSize(const RegisterInfo *reg_info, bool use_primary_name)
static size_t ComputeLongestRegisterName(RegisterContext *reg_ctx, const RegisterSet &reg_set, bool use_primary_name, bool primitive_only)
static llvm::raw_ostream & error(Stream &strm)
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectRegisterInfo() override=default
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
CommandObjectRegisterInfo(CommandInterpreter &interpreter)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
bool DumpRegister(const ExecutionContext &exe_ctx, Stream &strm, RegisterContext &reg_ctx, const RegisterInfo &reg_info, bool print_type, size_t reg_name_right_align_at)
bool DumpRegisterSet(const ExecutionContext &exe_ctx, Stream &strm, RegisterContext *reg_ctx, size_t set_idx, bool primitive_only=false)
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The default version handles argument definitions that have only one argument type,...
~CommandObjectRegisterRead() override=default
void DumpRegisterField(Stream &strm, const RegisterInfo &reg_info, const ValueObjectSP &value_sp, size_t reg_name_right_align_at, CommandReturnObject &result)
CommandObjectRegisterRead(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,...
~CommandObjectRegisterWrite() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectRegisterWrite(CommandInterpreter &interpreter)
A section + offset based address class.
Definition Address.h:62
@ DumpStyleResolvedDescription
Display the details about what an address resolves to.
Definition Address.h:104
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX, bool all_ranges=false, std::optional< Stream::HighlightSettings > settings=std::nullopt) const
Dump a description of this object to a Stream.
Definition Address.cpp:398
A command line argument class.
Definition Args.h:33
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
Definition Args.h:120
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
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)
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
CommandObjectRegister(CommandInterpreter &interpreter)
std::vector< CommandArgumentData > CommandArgumentEntry
virtual void SetHelpLong(llvm::StringRef str)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
virtual void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector)
The default version handles argument definitions that have only one argument type,...
void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendErrorWithFormatv(const char *format, Args &&...args)
"lldb/Utility/ArgCompletionRequest.h"
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
An data extractor class.
DumpValueObjectOptions & SetHideName(bool hide_name=false)
DumpValueObjectOptions & SetHideRootType(bool hide_root_type=false)
DumpValueObjectOptions & SetHideRootName(bool hide_root_name)
DumpValueObjectOptions & SetFormat(lldb::Format format=lldb::eFormatDefault)
DumpValueObjectOptions & SetAllowOnelinerMode(bool oneliner=false)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool HasProcessScope() const
Returns true the ExecutionContext object contains a valid target and process.
ExecutionContextScope * GetBestExecutionContextScope() const
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
Target & GetTargetRef() const
Returns a reference to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
static const uint32_t OPTION_GROUP_GDB_FMT
static const uint32_t OPTION_GROUP_FORMAT
void Append(OptionGroup *group)
Append options from a OptionGroup class.
Definition Options.cpp:759
static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error)
A command line option parsing protocol class.
Definition Options.h:58
A plug-in interface definition class for debugging a process.
Definition Process.h:369
uint32_t GetAddressByteSize() const
Definition Process.cpp:3964
virtual const RegisterSet * GetRegisterSet(size_t reg_set)=0
virtual const RegisterInfo * GetRegisterInfoAtIndex(size_t reg)=0
virtual bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue &reg_value)=0
virtual size_t GetRegisterSetCount()=0
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
virtual bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value)=0
Status SetValueFromString(const RegisterInfo *reg_info, llvm::StringRef value_str)
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
This base class provides an interface to stack frames.
Definition StackFrame.h:44
virtual lldb::ValueObjectSP GetValueForVariableExpressionPath(llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error, lldb::DILMode mode=lldb::eDILModeFull)
Create a ValueObject for a variable name / pathname, possibly including simple dereference/child sele...
An error handling class.
Definition Status.h:118
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition Stream.cpp:157
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:63
size_t EOL()
Output and End of Line character to the stream.
Definition Stream.cpp:155
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition Stream.cpp:204
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Definition Stream.cpp:201
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
Definition Target.cpp:3521
virtual lldb::ValueType GetValueType() const =0
ConstString GetName() const
#define UINT64_MAX
#define LLDB_OPT_SET_ALL
#define LLDB_INVALID_ADDRESS
#define UINT32_MAX
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
Definition Options.h:43
void DumpRegisterValue(const RegisterValue &reg_val, Stream &s, const RegisterInfo &reg_info, bool prefix_with_name, bool prefix_with_alt_name, lldb::Format format, uint32_t reg_name_right_align_at=0, ExecutionContextScope *exe_scope=nullptr, bool print_type=false, lldb::TargetSP target_sp=nullptr)
void DumpRegisterInfo(Stream &strm, RegisterContext &ctx, const RegisterInfo &info, uint32_t terminal_width)
std::string toString(FormatterBytecode::OpCodes op)
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
@ eEncodingUint
unsigned integer
@ eEncodingSint
signed integer
@ eReturnStatusFailed
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeRegisterName
std::shared_ptr< lldb_private::Variable > VariableSP
@ eValueTypeRegister
stack frame register value
uint64_t addr_t
Definition lldb-types.h:80
@ eDILModeLegacy
Allowed: identifiers, integers, operators: '.', '->', '*', '&', '[]'.
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
Used to build individual command argument lists.
Every register is described in detail including its name, alternate name (optional),...
lldb::Encoding encoding
Encoding of the register bits.
const char * alt_name
Alternate name of this register, can be NULL.
uint32_t * value_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
uint32_t byte_size
Size in bytes of the register.
const char * name
Name of this register, can't be NULL.
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.
const uint32_t * registers
An array of register indicies in this set.
const char * name
Name of this register set.