39#include "llvm/Support/MathExtras.h"
47#define LLDB_OPTIONS_memory_read
48#include "CommandOptions.inc"
59 return llvm::ArrayRef(g_memory_read_options);
65 const int short_option = g_memory_read_options[option_idx].short_option;
67 switch (short_option) {
72 "invalid value for --num-per-line option '%s'",
73 option_value.str().c_str());
97 llvm_unreachable(
"Unimplemented option");
115 const bool byte_size_option_set = byte_size_value.
OptionWasSet();
116 const bool num_per_line_option_set =
m_num_per_line.OptionWasSet();
124 if (!byte_size_option_set)
126 if (!num_per_line_option_set)
128 if (!count_option_set)
136 if (count_option_set)
142 if (!byte_size_option_set)
145 if (!count_option_set)
151 if (!num_per_line_option_set)
153 if (!count_option_set)
168 if (!byte_size_option_set)
170 if (!num_per_line_option_set)
172 if (!count_option_set)
178 if (byte_size_option_set) {
179 if (byte_size_value > 1)
181 "display format (bytes/bytes with ASCII) conflicts with the "
182 "specified byte size %" PRIu64
"\n"
183 "\tconsider using a different display format or don't specify "
188 if (!num_per_line_option_set)
190 if (!count_option_set)
197 if (!byte_size_option_set)
199 if (!num_per_line_option_set)
201 if (!count_option_set)
206 if (!byte_size_option_set)
208 if (!num_per_line_option_set)
210 if (!count_option_set)
215 if (!byte_size_option_set)
217 if (!num_per_line_option_set)
219 if (!count_option_set)
224 if (!byte_size_option_set)
226 if (!num_per_line_option_set) {
227 switch (byte_size_value) {
243 if (!count_option_set)
260 if (!byte_size_option_set)
261 byte_size_value = 128;
262 if (!num_per_line_option_set)
264 if (!count_option_set)
290 interpreter,
"memory read",
291 "Read from the memory of the current target process.", nullptr,
292 eCommandRequiresTarget | eCommandProcessMustBePaused),
307 arg1.push_back(start_addr_arg);
315 arg2.push_back(end_addr_arg);
347 uint32_t index)
override {
361 "an optional end address expression.\n",
363 result.
AppendWarning(
"expressions should be quoted if they contain "
364 "spaces or other special characters");
373 const char *view_as_type_cstr =
375 if (view_as_type_cstr && view_as_type_cstr[0]) {
378 uint32_t reference_count = 0;
379 uint32_t pointer_count = 0;
382#define ALL_KEYWORDS \
384 KEYWORD("volatile") \
385 KEYWORD("restrict") \
394#define KEYWORD(s) (sizeof(s) - 1),
400 static size_t g_num_keywords =
sizeof(g_keywords) /
sizeof(
const char *);
401 std::string type_str(view_as_type_cstr);
404 for (
size_t i = 0; i < g_num_keywords; ++i) {
405 const char *keyword = g_keywords[i];
406 int keyword_len = g_keyword_lengths[i];
409 while ((idx = type_str.find(keyword, idx)) != std::string::npos) {
410 if (type_str[idx + keyword_len] ==
' ' ||
411 type_str[idx + keyword_len] ==
'\t') {
412 type_str.erase(idx, keyword_len + 1);
419 bool done = type_str.empty();
421 idx = type_str.find_first_not_of(
" \t");
422 if (idx > 0 && idx != std::string::npos)
423 type_str.erase(0, idx);
426 if (type_str.empty())
429 switch (type_str[type_str.size() - 1]) {
435 type_str.erase(type_str.size() - 1);
439 if (reference_count == 0) {
441 type_str.erase(type_str.size() - 1);
462 TypeQueryOptions::e_find_one);
467 if (!type_sp && lookup_type_name.
GetCString()) {
470 std::set<LanguageType> languages_to_check;
472 languages_to_check.insert(language_for_type);
477 std::set<CompilerType> user_defined_types;
478 for (
auto lang : languages_to_check) {
479 if (
auto *persistent_vars =
481 if (std::optional<CompilerType> type =
482 persistent_vars->GetCompilerTypeFromPersistentDecl(
484 user_defined_types.emplace(*type);
489 if (user_defined_types.size() > 1) {
491 "Mutiple types found matching raw type '%s', please disambiguate "
492 "by specifying the language with -x",
497 if (user_defined_types.size() == 1) {
498 compiler_type = *user_defined_types.begin();
502 if (!compiler_type.
IsValid()) {
504 compiler_type = type_sp->GetFullCompilerType();
507 "the raw type '%s' for full type '%s'\n",
514 while (pointer_count > 0) {
517 compiler_type = pointer_type;
519 result.
AppendError(
"unable make a pointer type\n");
525 auto size_or_err = compiler_type.
GetByteSize(exe_scope);
528 "unable to get the byte size of the type '%s'\n%s",
529 view_as_type_cstr, llvm::toString(size_or_err.takeError()).c_str());
547 size_t total_byte_size = 0;
568 size_t item_byte_size =
570 const size_t num_per_line =
573 if (total_byte_size == 0) {
574 total_byte_size = item_count * item_byte_size;
575 if (total_byte_size == 0)
576 total_byte_size = 32;
584 result.
AppendError(
"invalid start address expression.");
594 result.
AppendError(
"invalid end address expression.");
597 }
else if (end_addr <= addr) {
599 "end address (0x%" PRIx64
600 ") must be greater than the start address (0x%" PRIx64
").\n",
605 "specify either the end address (0x%" PRIx64
606 ") or the count (--count %" PRIu64
"), not both.\n",
607 end_addr, (uint64_t)item_count);
611 total_byte_size = end_addr - addr;
612 item_count = total_byte_size / item_byte_size;
619 "Normally, \'memory read\' will not read over %" PRIu32
623 "Please use --force to override this restriction just once.\n");
625 "will often need a larger limit.\n");
630 size_t bytes_read = 0;
637 auto size_or_err = compiler_type.
GetByteSize(exe_scope);
639 result.
AppendError(llvm::toString(size_or_err.takeError()));
642 auto size = *size_or_err;
649 data_sp = std::make_shared<DataBufferHeap>(total_byte_size,
'\0');
650 if (data_sp->GetBytes() ==
nullptr) {
652 "can't allocate 0x%" PRIx32
653 " bytes for the memory read buffer, specify a smaller size to read",
654 (uint32_t)total_byte_size);
659 bytes_read = target->
ReadMemory(address, data_sp->GetBytes(),
660 data_sp->GetByteSize(),
error,
true);
661 if (bytes_read == 0) {
662 const char *error_cstr =
error.AsCString();
663 if (error_cstr && error_cstr[0]) {
667 "failed to read memory from 0x%" PRIx64
".\n", addr);
672 if (bytes_read < total_byte_size)
674 "were able to be read from {2:x}",
675 bytes_read, total_byte_size, addr);
686 data_sp = std::make_shared<DataBufferHeap>(
687 (item_byte_size + 1) * item_count,
689 if (data_sp->GetBytes() ==
nullptr) {
691 "can't allocate 0x%" PRIx64
692 " bytes for the memory read buffer, specify a smaller size to read",
693 (uint64_t)((item_byte_size + 1) * item_count));
696 uint8_t *data_ptr = data_sp->GetBytes();
697 auto data_addr = addr;
698 auto count = item_count;
700 bool break_on_no_NULL =
false;
701 while (item_count < count) {
703 buffer.resize(item_byte_size + 1, 0);
706 Address(data_addr), &buffer[0], item_byte_size + 1,
error);
709 "failed to read memory from 0x%" PRIx64
".\n", addr);
713 if (item_byte_size == read) {
715 "unable to find a NULL terminated string at {0:x}"
716 ". Consider increasing the maximum read length",
719 break_on_no_NULL =
true;
723 memcpy(data_ptr, &buffer[0], read);
730 if (break_on_no_NULL)
734 std::make_shared<DataBufferHeap>(data_sp->GetBytes(), bytes_read + 1);
746 std::unique_ptr<Stream> output_stream_storage;
747 Stream *output_stream_p =
nullptr;
751 std::string path = outfile_spec.
GetPath();
763 auto outfile_stream_up =
764 std::make_unique<StreamFile>(std::move(outfile.get()));
766 const size_t bytes_written =
767 outfile_stream_up->Write(data_sp->GetBytes(), bytes_read);
768 if (bytes_written > 0) {
770 "%zi bytes %s to '%s'\n", bytes_written,
771 append ?
"appended" :
"written", path.c_str());
776 (uint64_t)bytes_read, path.c_str());
782 output_stream_storage = std::move(outfile_stream_up);
783 output_stream_p = output_stream_storage.get();
787 path.c_str(), append ?
"append" :
"write");
789 result.
AppendError(llvm::toString(outfile.takeError()));
797 for (uint32_t i = 0; i < item_count; ++i) {
798 addr_t item_addr = addr + (i * item_byte_size);
801 name_strm.
Printf(
"0x%" PRIx64, item_addr);
803 exe_scope, name_strm.
GetString(), address, compiler_type));
807 valobj_sp->SetFormat(format);
812 if (llvm::Error
error = valobj_sp->Dump(*output_stream_p, options)) {
818 "failed to create a value object for: (%s) %s\n",
819 view_as_type_cstr, name_strm.
GetData());
832 (item_byte_size != 1)) {
840 item_count = item_byte_size;
846 "reading memory as characters of size %" PRIu64
" is not supported",
847 (uint64_t)item_byte_size);
852 assert(output_stream_p);
853 size_t bytes_dumped =
855 item_count, num_per_line, addr, 0, 0, exe_scope,
858 output_stream_p->
EOL();
877#define LLDB_OPTIONS_memory_find
878#include "CommandOptions.inc"
886 return size_or_err.takeError();
888 switch (*size_or_err) {
890 uint8_t
byte = (uint8_t)value;
894 uint16_t word = (uint16_t)value;
898 uint32_t lword = (uint32_t)value;
905 return llvm::createStringError(
906 "Only expressions resulting in 1, 2, 4, or 8-byte-sized values are "
907 "supported. For other pattern sizes the --string (-s) option may be "
911 return llvm::Error::success();
914static llvm::Expected<ValueObjectSP>
921 return llvm::createStringError(
922 "No result returned from expression. Exit status: %d", status);
925 return result_sp->GetError().ToError();
927 result_sp = result_sp->GetQualifiedRepresentationIfAvailable(
928 result_sp->GetDynamicValueType(),
true);
930 return llvm::createStringError(
"failed to get dynamic result type");
945 return llvm::ArrayRef(g_memory_find_options);
951 const int short_option = g_memory_find_options[option_idx].short_option;
953 switch (short_option) {
955 m_expr.SetValueFromString(option_value);
959 m_string.SetValueFromString(option_value);
963 if (
m_count.SetValueFromString(option_value).Fail())
968 if (
m_offset.SetValueFromString(option_value).Fail())
973 llvm_unreachable(
"Unimplemented option");
992 interpreter,
"memory find",
993 "Find a value in the memory of the current target process.",
994 nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched) {
1006 arg1.push_back(addr_arg);
1014 arg2.push_back(value_arg);
1039 result.
AppendError(
"two addresses needed for memory find");
1057 if (high_addr <= low_addr) {
1059 "starting address must be smaller than ending address");
1068 llvm::StringRef str =
1071 result.
AppendError(
"search string must have non-zero length.");
1079 if (!result_or_err) {
1080 result.
AppendError(
"Expression evaluation failed: ");
1081 result.
AppendError(llvm::toString(result_or_err.takeError()));
1089 result.
AppendError(llvm::toString(std::move(err)));
1094 "please pass either a block of text, or an expression to evaluate.");
1099 found_location = low_addr;
1100 bool ever_found =
false;
1109 result.
AppendMessage(
"no more matches within the range.\n");
1119 if (!
error.Fail()) {
1127 m_exe_ctx.GetBestExecutionContextScope(),
1145#define LLDB_OPTIONS_memory_write
1146#include "CommandOptions.inc"
1158 return llvm::ArrayRef(g_memory_write_options);
1164 const int short_option = g_memory_write_options[option_idx].short_option;
1166 switch (short_option) {
1168 m_infile.SetFile(option_value, FileSpec::Style::native);
1173 "input file does not exist: '%s'", option_value.str().c_str());
1181 "invalid offset string '%s'", option_value.str().c_str());
1186 llvm_unreachable(
"Unimplemented option");
1202 interpreter,
"memory write",
1203 "Write to the memory of the current target process.", nullptr,
1204 eCommandRequiresProcess | eCommandProcessMustBeLaunched),
1209 "The format to use for each of the value to be written."),
1211 "The size in bytes to write from input file or "
1215 CommandArgumentData addr_arg;
1216 CommandArgumentData value_arg;
1224 arg1.push_back(addr_arg);
1233 arg2.push_back(value_arg);
1264 "%s takes a destination address when writing file contents.\n",
1270 "%s takes only a destination address when writing file contents.\n",
1274 }
else if (argc < 2) {
1276 "%s takes a destination address and at least one value.\n",
1291 result.
AppendError(
"invalid address expression\n");
1297 size_t length = SIZE_MAX;
1298 if (item_byte_size > 1)
1299 length = item_byte_size;
1304 length = data_sp->GetByteSize();
1307 size_t bytes_written =
1310 if (bytes_written == length) {
1313 "%" PRIu64
" bytes were written to 0x%" PRIx64
"\n",
1314 (uint64_t)bytes_written, addr);
1316 }
else if (bytes_written > 0) {
1319 "%" PRIu64
" bytes of %" PRIu64
1320 " requested were written to 0x%" PRIx64
"\n",
1321 (uint64_t)bytes_written, (uint64_t)length, addr);
1326 addr,
error.AsCString());
1333 }
else if (item_byte_size == 0) {
1343 bool success =
false;
1344 for (
auto &entry : command) {
1375 result.
AppendError(
"unsupported format for writing memory");
1386 bool success =
false;
1387 if (entry.ref().starts_with(
"0x"))
1388 success = !entry.ref().getAsInteger(0, uval64);
1390 success = !entry.ref().getAsInteger(16, uval64);
1393 "'%s' is not a valid hex string value.\n", entry.c_str());
1395 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1397 " is too large to fit in a %" PRIu64
1398 " byte unsigned integer value.\n",
1399 uval64, (uint64_t)item_byte_size);
1409 "'%s' is not a valid boolean string value.\n", entry.c_str());
1416 if (entry.ref().getAsInteger(2, uval64)) {
1418 "'%s' is not a valid binary string value.\n", entry.c_str());
1420 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1422 " is too large to fit in a %" PRIu64
1423 " byte unsigned integer value.\n",
1424 uval64, (uint64_t)item_byte_size);
1433 if (entry.ref().empty())
1436 size_t len = entry.ref().size();
1446 addr,
error.AsCString());
1452 if (entry.ref().getAsInteger(0, sval64)) {
1454 "'%s' is not a valid signed decimal value.\n", entry.c_str());
1456 }
else if (!llvm::isIntN(item_byte_size * 8, sval64)) {
1458 "Value %" PRIi64
" is too large or small to fit in a %" PRIu64
1459 " byte signed integer value.\n",
1460 sval64, (uint64_t)item_byte_size);
1468 if (entry.ref().getAsInteger(0, uval64)) {
1470 "'%s' is not a valid unsigned decimal string value.\n",
1473 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1475 " is too large to fit in a %" PRIu64
1476 " byte unsigned integer value.\n",
1477 uval64, (uint64_t)item_byte_size);
1484 if (entry.ref().getAsInteger(8, uval64)) {
1486 "'%s' is not a valid octal string value.\n", entry.c_str());
1488 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1490 " is too large to fit in a %" PRIu64
1491 " byte unsigned integer value.\n",
1492 uval64, (uint64_t)item_byte_size);
1502 const char *buffer_data = buffer.
GetString().data();
1503 const size_t buffer_size = buffer.
GetString().size();
1504 const size_t write_size =
1507 if (write_size != buffer_size) {
1510 addr,
error.AsCString());
1526 "Print recorded stack traces for "
1527 "allocation/deallocation events "
1528 "associated with an address.",
1530 eCommandRequiresTarget | eCommandRequiresProcess |
1531 eCommandProcessMustBePaused |
1532 eCommandProcessMustBeLaunched) {
1542 arg1.push_back(addr_arg);
1551 uint32_t index)
override {
1559 if (argc == 0 || argc > 1) {
1581 if (!memory_history) {
1582 result.
AppendError(
"no available memory history provider");
1586 HistoryThreads thread_list = memory_history->GetHistoryThreads(addr);
1588 const bool stop_format =
false;
1589 for (
auto thread : thread_list) {
1590 thread->GetStatus(*output_stream, 0,
UINT32_MAX, 0, stop_format,
1599#pragma mark CommandObjectMemoryRegion
1601#define LLDB_OPTIONS_memory_region
1602#include "CommandOptions.inc"
1613 return llvm::ArrayRef(g_memory_region_options);
1619 const int short_option = g_memory_region_options[option_idx].short_option;
1621 switch (short_option) {
1623 m_all.SetCurrentValue(
true);
1624 m_all.SetOptionWasSet();
1627 llvm_unreachable(
"Unimplemented option");
1642 interpreter,
"memory region",
1643 "Get information on the memory region containing "
1644 "an address in the current target process.\n"
1645 "If this command is given an <address-expression> once "
1646 "and then repeated without options, it will try to print "
1647 "the memory region that follows the previously printed "
1648 "region. The command can be repeated until the end of "
1649 "the address range is reached.",
1650 "memory region <address-expression> (or --all)",
1651 eCommandRequiresProcess | eCommandTryTargetAPILock |
1652 eCommandProcessMustBeLaunched) {
1674 while (section_sp->GetParent())
1675 section_sp = section_sp->GetParent();
1676 section_name = section_sp->GetName();
1682 "[{0:x16}-{1:x16}) {2:r}{3:w}{4:x}{5}{6}{7}{8}",
1686 name, section_name ?
" " :
"", section_name);
1694 const std::optional<std::vector<addr_t>> &dirty_page_list =
1696 if (dirty_page_list) {
1697 const size_t page_count = dirty_page_list->size();
1699 "Modified memory (dirty) page list provided, {0} entries.",
1701 if (page_count > 0) {
1702 bool print_comma =
false;
1704 strm <<
"Dirty pages: ";
1705 for (
size_t i = 0; i < page_count; i++) {
1710 strm << llvm::formatv(
"{0:x}", (*dirty_page_list)[i]);
1742 (abi && (abi->FixAnyAddress(load_addr) != load_addr))) {
1744 "No next region address set: one address expression argument or "
1745 "\"--all\" option required:\nUsage: %s\n",
1750 }
else if (argc == 1) {
1753 "The \"--all\" option cannot be used when an address "
1754 "argument is given");
1758 auto load_addr_str = command[0].ref();
1763 command[0].c_str(),
error.AsCString());
1769 "'%s' takes one argument or \"--all\" option:\nUsage: %s\n",
1778 std::vector<std::pair<lldb_private::MemoryRegionInfo, lldb::addr_t>>
1788 (!abi || (abi->FixAnyAddress(addr) == addr))) {
1790 error = process_sp->GetMemoryRegionInfo(addr, region_info);
1792 if (
error.Success()) {
1793 region_list.push_back({region_info, addr});
1799 error = process_sp->GetMemoryRegionInfo(load_addr, region_info);
1800 if (
error.Success())
1801 region_list.push_back({region_info, load_addr});
1804 if (
error.Success()) {
1805 for (std::pair<MemoryRegionInfo, addr_t> &range : region_list) {
1806 DumpRegion(result, process_sp->GetTarget(), range.first, range.second);
1818 uint32_t index)
override {
1834 interpreter,
"memory",
1835 "Commands for operating on memory in the current target process.",
1836 "memory <subcommand> [<subcommand-options>]") {
static llvm::Error CopyExpressionResult(ValueObject &result, DataBufferHeap &buffer, ExecutionContextScope *scope)
static llvm::Expected< ValueObjectSP > EvaluateExpression(llvm::StringRef expression, StackFrame &frame, Process &process)
static llvm::raw_ostream & error(Stream &strm)
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
OptionValueUInt64 m_offset
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
OptionValueString m_string
OptionValueUInt64 m_count
~OptionGroupFindMemory() override=default
OptionGroupMemoryTag m_memory_tag_options
OptionGroupOptions m_option_group
Options * GetOptions() override
OptionGroupFindMemory m_memory_options
~CommandObjectMemoryFind() override=default
CommandObjectMemoryFind(CommandInterpreter &interpreter)
void DoExecute(Args &command, CommandReturnObject &result) override
std::optional< std::string > GetRepeatCommand(Args ¤t_command_args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectMemoryHistory() override=default
CommandObjectMemoryHistory(CommandInterpreter &interpreter)
Options * GetOptions() override
~CommandObjectMemoryRead() override=default
OptionGroupOptions m_option_group
OptionGroupMemoryTag m_memory_tag_options
OptionGroupOutputFile m_prev_outfile_options
OptionGroupValueObjectDisplay m_prev_varobj_options
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupValueObjectDisplay m_varobj_options
CompilerType m_prev_compiler_type
CommandObjectMemoryRead(CommandInterpreter &interpreter)
lldb::addr_t m_prev_byte_size
OptionGroupOutputFile m_outfile_options
OptionGroupReadMemory m_memory_options
OptionGroupFormat m_format_options
std::optional< std::string > GetRepeatCommand(Args ¤t_command_args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
OptionGroupMemoryTag m_prev_memory_tag_options
OptionGroupFormat m_prev_format_options
OptionGroupReadMemory m_prev_memory_options
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
OptionGroupMemoryRegion()
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
~OptionGroupMemoryRegion() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
OptionGroupOptions m_option_group
CommandObjectMemoryRegion(CommandInterpreter &interpreter)
void DumpRegion(CommandReturnObject &result, Target &target, const MemoryRegionInfo &range_info, lldb::addr_t load_addr)
OptionGroupMemoryRegion m_memory_region_options
std::optional< std::string > GetRepeatCommand(Args ¤t_command_args, uint32_t index) override
Get the command that appropriate for a "repeat" of the current command.
~CommandObjectMemoryRegion() override=default
Options * GetOptions() override
lldb::addr_t m_prev_end_addr
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
OptionGroupWriteMemory()=default
void OptionParsingStarting(ExecutionContext *execution_context) override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
~OptionGroupWriteMemory() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectMemoryWrite(CommandInterpreter &interpreter)
OptionGroupWriteMemory m_memory_options
Options * GetOptions() override
OptionGroupFormat m_format_options
OptionGroupOptions m_option_group
~CommandObjectMemoryWrite() override=default
Status FinalizeSettings(Target *target, OptionGroupFormat &format_options)
OptionValueUInt64 m_num_per_line
OptionValueUInt64 m_offset
OptionValueString m_view_as_type
void OptionParsingStarting(ExecutionContext *execution_context) override
bool AnyOptionWasSet() const
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
~OptionGroupReadMemory() override=default
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
OptionValueLanguage m_language_for_type
A section + offset based address class.
lldb::SectionSP GetSection() const
Get const accessor for the section.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
uint32_t GetMaximumOpcodeByteSize() const
A command line argument class.
void Shift()
Shifts the first argument C string value of the array off the argument array.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
CommandObjectMemory(CommandInterpreter &interpreter)
~CommandObjectMemory() override
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)
friend class CommandInterpreter
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
std::vector< CommandArgumentData > CommandArgumentEntry
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
void AppendMessage(llvm::StringRef in_string)
void AppendError(llvm::StringRef in_string)
void AppendWarningWithFormatv(const char *format, Args &&...args)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void void AppendMessageWithFormatv(const char *format, Args &&...args)
void AppendWarning(llvm::StringRef in_string)
Stream & GetOutputStream()
Generic representation of a type in a programming language.
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
lldb::opaque_compiler_type_t GetOpaqueQualType() const
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
void CopyData(const void *src, lldb::offset_t src_len)
Makes a copy of the src_len bytes in src.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
int Open(const char *path, int flags, int mode=0600)
Wraps open in a platform-independent way.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
std::shared_ptr< DataBuffer > CreateDataBuffer(const llvm::Twine &path, uint64_t size=0, uint64_t offset=0)
Create memory buffer from path.
static std::set< lldb::LanguageType > GetSupportedLanguages()
static lldb::MemoryHistorySP FindPlugin(const lldb::ProcessSP process)
LazyBool GetReadable() const
ConstString GetName() const
LazyBool GetExecutable() const
LazyBool IsShadowStack() const
const std::optional< std::vector< lldb::addr_t > > & GetDirtyPageList() const
Get a vector of target VM pages that are dirty – that have been modified – within this memory region.
LazyBool GetWritable() const
LazyBool GetMemoryTagged() const
void FindTypes(Module *search_first, const TypeQuery &query, lldb_private::TypeResults &results) const
Find types using a type-matching object that contains all search parameters.
void Append(OptionGroup *group)
Append options from a OptionGroup class.
uint64_t GetCurrentValue() const
bool OptionWasSet() const
A command line option parsing protocol class.
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
lldb::ByteOrder GetByteOrder() const
lldb::addr_t FindInMemory(lldb::addr_t low, lldb::addr_t high, const uint8_t *buf, size_t size)
Find a pattern within a memory region.
uint32_t GetAddressByteSize() const
size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error)
Write memory to a process.
Target & GetTarget()
Get the target object pointer for this module.
This base class provides an interface to stack frames.
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
@ eBinary
Get and put data as binary instead of as the default string mode.
size_t EOL()
Output and End of Line character to the stream.
size_t PutMaxHex64(uint64_t uvalue, size_t byte_size, lldb::ByteOrder byte_order=lldb::eByteOrderInvalid)
lldb::ModuleSP module_sp
The Module for a given query.
uint32_t GetMaximumSizeOfStringSummary() const
uint32_t GetMaximumMemReadSize() const
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr, bool *did_read_live_memory=nullptr)
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
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)
A class that contains all state required for type lookups.
This class tracks the state and results of a TypeQuery.
lldb::TypeSP GetFirstType() const
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, llvm::StringRef name, const Address &address, lldb::TypeSP &type_sp)
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
CompilerType GetCompilerType()
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
std::vector< lldb::ThreadSP > HistoryThreads
lldb::offset_t DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset, lldb::Format item_format, size_t item_byte_size, size_t item_count, size_t num_per_line, uint64_t base_addr, uint32_t item_bit_size, uint32_t item_bit_offset, ExecutionContextScope *exe_scope=nullptr, bool show_memory_tags=false)
Dumps item_count objects into the stream s.
@ eLanguageRuntimeDescriptionDisplayVerbosityFull
std::string toString(FormatterBytecode::OpCodes op)
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Format
Display format definitions.
@ eFormatCString
NULL terminated C strings.
@ eFormatCharArray
Print characters with no single quotes, used for character arrays that can contain non printable char...
@ eFormatInstruction
Disassemble an opcode.
@ eFormatVoid
Do not print this.
@ eFormatComplex
Floating point complex type.
@ eFormatHexFloat
ISO C99 hex float string.
@ eFormatOSType
OS character codes encoded into an integer 'PICT' 'text' etc...
@ eFormatAddressInfo
Describe what an address points to (func + offset with file/line, symbol + offset,...
@ eFormatCharPrintable
Only printable characters, '.' if not printable.
@ eFormatComplexInteger
Integer complex type.
@ eFormatFloat128
Disambiguate between 128-bit long double (which uses eFormatFloat) and __float128 (which uses eFormat...
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::MemoryHistory > MemoryHistorySP
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Process > ProcessSP
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
@ eArgTypeAddressOrExpression
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
std::shared_ptr< lldb_private::Module > ModuleSP
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type
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 bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)
BaseType GetRangeBase() const
BaseType GetRangeEnd() const