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) {
71 error.SetErrorStringWithFormat(
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();
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)
167 if (!byte_size_option_set)
169 if (!num_per_line_option_set)
171 if (!count_option_set)
177 if (byte_size_option_set) {
178 if (byte_size_value > 1)
179 error.SetErrorStringWithFormat(
180 "display format (bytes/bytes with ASCII) conflicts with the "
181 "specified byte size %" PRIu64
"\n"
182 "\tconsider using a different display format or don't specify "
187 if (!num_per_line_option_set)
189 if (!count_option_set)
196 if (!byte_size_option_set)
198 if (!num_per_line_option_set)
200 if (!count_option_set)
205 if (!byte_size_option_set)
207 if (!num_per_line_option_set)
209 if (!count_option_set)
214 if (!byte_size_option_set)
216 if (!num_per_line_option_set)
218 if (!count_option_set)
223 if (!byte_size_option_set)
225 if (!num_per_line_option_set) {
226 switch (byte_size_value) {
242 if (!count_option_set)
259 if (!byte_size_option_set)
260 byte_size_value = 128;
261 if (!num_per_line_option_set)
263 if (!count_option_set)
289 interpreter,
"memory read",
290 "Read from the memory of the current target process.", nullptr,
291 eCommandRequiresTarget | eCommandProcessMustBePaused),
306 arg1.push_back(start_addr_arg);
314 arg2.push_back(end_addr_arg);
346 uint32_t index)
override {
360 "an optional end address expression.\n",
362 result.
AppendWarning(
"Expressions should be quoted if they contain "
363 "spaces or other special characters.");
370 const char *view_as_type_cstr =
372 if (view_as_type_cstr && view_as_type_cstr[0]) {
375 uint32_t reference_count = 0;
376 uint32_t pointer_count = 0;
379#define ALL_KEYWORDS \
381 KEYWORD("volatile") \
382 KEYWORD("restrict") \
391#define KEYWORD(s) (sizeof(s) - 1),
397 static size_t g_num_keywords =
sizeof(g_keywords) /
sizeof(
const char *);
398 std::string type_str(view_as_type_cstr);
401 for (
size_t i = 0; i < g_num_keywords; ++i) {
402 const char *keyword = g_keywords[i];
403 int keyword_len = g_keyword_lengths[i];
406 while ((idx = type_str.find(keyword, idx)) != std::string::npos) {
407 if (type_str[idx + keyword_len] ==
' ' ||
408 type_str[idx + keyword_len] ==
'\t') {
409 type_str.erase(idx, keyword_len + 1);
416 bool done = type_str.empty();
418 idx = type_str.find_first_not_of(
" \t");
419 if (idx > 0 && idx != std::string::npos)
420 type_str.erase(0, idx);
423 if (type_str.empty())
426 switch (type_str[type_str.size() - 1]) {
432 type_str.erase(type_str.size() - 1);
436 if (reference_count == 0) {
438 type_str.erase(type_str.size() - 1);
459 TypeQueryOptions::e_find_one);
464 if (!type_sp && lookup_type_name.
GetCString()) {
467 std::set<LanguageType> languages_to_check;
469 languages_to_check.insert(language_for_type);
474 std::set<CompilerType> user_defined_types;
475 for (
auto lang : languages_to_check) {
476 if (
auto *persistent_vars =
478 if (std::optional<CompilerType> type =
479 persistent_vars->GetCompilerTypeFromPersistentDecl(
481 user_defined_types.emplace(*type);
486 if (user_defined_types.size() > 1) {
488 "Mutiple types found matching raw type '%s', please disambiguate "
489 "by specifying the language with -x",
494 if (user_defined_types.size() == 1) {
495 compiler_type = *user_defined_types.begin();
499 if (!compiler_type.
IsValid()) {
501 compiler_type = type_sp->GetFullCompilerType();
504 "the raw type '%s' for full type '%s'\n",
511 while (pointer_count > 0) {
514 compiler_type = pointer_type;
516 result.
AppendError(
"unable make a pointer type\n");
522 std::optional<uint64_t> size = compiler_type.
GetByteSize(
nullptr);
525 "unable to get the byte size of the type '%s'\n",
544 size_t total_byte_size = 0;
570 size_t item_byte_size =
575 const size_t num_per_line =
578 if (total_byte_size == 0) {
579 total_byte_size = item_count * item_byte_size;
580 if (total_byte_size == 0)
581 total_byte_size = 32;
589 result.
AppendError(
"invalid start address expression.");
599 result.
AppendError(
"invalid end address expression.");
602 }
else if (end_addr <= addr) {
604 "end address (0x%" PRIx64
605 ") must be greater than the start address (0x%" PRIx64
").\n",
610 "specify either the end address (0x%" PRIx64
611 ") or the count (--count %" PRIu64
"), not both.\n",
612 end_addr, (uint64_t)item_count);
616 total_byte_size = end_addr - addr;
617 item_count = total_byte_size / item_byte_size;
624 "Normally, \'memory read\' will not read over %" PRIu32
628 "Please use --force to override this restriction just once.\n");
630 "will often need a larger limit.\n");
635 size_t bytes_read = 0;
642 std::optional<uint64_t> size = compiler_type.
GetByteSize(
nullptr);
653 data_sp = std::make_shared<DataBufferHeap>(total_byte_size,
'\0');
654 if (data_sp->GetBytes() ==
nullptr) {
656 "can't allocate 0x%" PRIx32
657 " bytes for the memory read buffer, specify a smaller size to read",
658 (uint32_t)total_byte_size);
662 Address address(addr,
nullptr);
663 bytes_read = target->
ReadMemory(address, data_sp->GetBytes(),
664 data_sp->GetByteSize(),
error,
true);
665 if (bytes_read == 0) {
666 const char *error_cstr =
error.AsCString();
667 if (error_cstr && error_cstr[0]) {
671 "failed to read memory from 0x%" PRIx64
".\n", addr);
676 if (bytes_read < total_byte_size)
678 "Not all bytes (%" PRIu64
"/%" PRIu64
679 ") were able to be read from 0x%" PRIx64
".\n",
680 (uint64_t)bytes_read, (uint64_t)total_byte_size, addr);
691 data_sp = std::make_shared<DataBufferHeap>(
692 (item_byte_size + 1) * item_count,
694 if (data_sp->GetBytes() ==
nullptr) {
696 "can't allocate 0x%" PRIx64
697 " bytes for the memory read buffer, specify a smaller size to read",
698 (uint64_t)((item_byte_size + 1) * item_count));
701 uint8_t *data_ptr = data_sp->GetBytes();
702 auto data_addr = addr;
703 auto count = item_count;
705 bool break_on_no_NULL =
false;
706 while (item_count < count) {
708 buffer.resize(item_byte_size + 1, 0);
711 item_byte_size + 1,
error);
714 "failed to read memory from 0x%" PRIx64
".\n", addr);
718 if (item_byte_size == read) {
720 "unable to find a NULL terminated string at 0x%" PRIx64
721 ". Consider increasing the maximum read length.\n",
724 break_on_no_NULL =
true;
728 memcpy(data_ptr, &buffer[0], read);
735 if (break_on_no_NULL)
739 std::make_shared<DataBufferHeap>(data_sp->GetBytes(), bytes_read + 1);
751 std::unique_ptr<Stream> output_stream_storage;
752 Stream *output_stream_p =
nullptr;
756 std::string path = outfile_spec.
GetPath();
768 auto outfile_stream_up =
769 std::make_unique<StreamFile>(std::move(outfile.get()));
771 const size_t bytes_written =
772 outfile_stream_up->Write(data_sp->GetBytes(), bytes_read);
773 if (bytes_written > 0) {
775 "%zi bytes %s to '%s'\n", bytes_written,
776 append ?
"appended" :
"written", path.c_str());
781 (uint64_t)bytes_read, path.c_str());
787 output_stream_storage = std::move(outfile_stream_up);
788 output_stream_p = output_stream_storage.get();
792 path.c_str(), append ?
"append" :
"write");
794 result.
AppendError(llvm::toString(outfile.takeError()));
803 for (uint32_t i = 0; i < item_count; ++i) {
804 addr_t item_addr = addr + (i * item_byte_size);
807 name_strm.
Printf(
"0x%" PRIx64, item_addr);
809 exe_scope, name_strm.
GetString(), address, compiler_type));
813 valobj_sp->SetFormat(format);
818 valobj_sp->Dump(*output_stream_p, options);
821 "failed to create a value object for: (%s) %s\n",
822 view_as_type_cstr, name_strm.
GetData());
836 (item_byte_size != 1)) {
844 item_count = item_byte_size;
850 "reading memory as characters of size %" PRIu64
" is not supported",
851 (uint64_t)item_byte_size);
856 assert(output_stream_p);
858 data, output_stream_p, 0, format, item_byte_size, item_count,
862 output_stream_p->
EOL();
881#define LLDB_OPTIONS_memory_find
882#include "CommandOptions.inc"
894 return llvm::ArrayRef(g_memory_find_options);
900 const int short_option = g_memory_find_options[option_idx].short_option;
902 switch (short_option) {
913 error.SetErrorString(
"unrecognized value for count");
918 error.SetErrorString(
"unrecognized value for dump-offset");
922 llvm_unreachable(
"Unimplemented option");
941 interpreter,
"memory find",
942 "Find a value in the memory of the current target process.",
943 nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched) {
955 arg1.push_back(addr_arg);
963 arg2.push_back(value_arg);
1017 result.
AppendError(
"two addresses needed for memory find");
1035 if (high_addr <= low_addr) {
1037 "starting address must be smaller than ending address");
1046 llvm::StringRef str =
1049 result.
AppendError(
"search string must have non-zero length.");
1060 frame, result_sp)) &&
1062 uint64_t value = result_sp->GetValueAsUnsigned(0);
1063 std::optional<uint64_t> size =
1064 result_sp->GetCompilerType().GetByteSize(
nullptr);
1069 uint8_t
byte = (uint8_t)value;
1073 uint16_t word = (uint16_t)value;
1077 uint32_t lword = (uint32_t)value;
1087 result.
AppendError(
"unknown type. pass a string instead");
1091 "result size larger than 8 bytes. pass a string instead");
1096 "expression evaluation failed. pass a string instead");
1101 "please pass either a block of text, or an expression to evaluate.");
1106 found_location = low_addr;
1107 bool ever_found =
false;
1116 result.
AppendMessage(
"no more matches within the range.\n");
1126 if (!
error.Fail()) {
1148 size_t buffer_size) {
1149 const size_t region_size = high - low;
1151 if (region_size < buffer_size)
1154 std::vector<size_t> bad_char_heuristic(256, buffer_size);
1158 for (
size_t idx = 0; idx < buffer_size - 1; idx++) {
1159 decltype(bad_char_heuristic)::size_type bcu_idx = buffer[idx];
1160 bad_char_heuristic[bcu_idx] = buffer_size - idx - 1;
1162 for (
size_t s = 0; s <= (region_size - buffer_size);) {
1163 int64_t j = buffer_size - 1;
1164 while (j >= 0 && buffer[j] == iterator[s + j])
1169 s += bad_char_heuristic[iterator[s + buffer_size - 1]];
1180#define LLDB_OPTIONS_memory_write
1181#include "CommandOptions.inc"
1193 return llvm::ArrayRef(g_memory_write_options);
1199 const int short_option = g_memory_write_options[option_idx].short_option;
1201 switch (short_option) {
1207 error.SetErrorStringWithFormat(
"input file does not exist: '%s'",
1208 option_value.str().c_str());
1215 error.SetErrorStringWithFormat(
"invalid offset string '%s'",
1216 option_value.str().c_str());
1221 llvm_unreachable(
"Unimplemented option");
1237 interpreter,
"memory write",
1238 "Write to the memory of the current target process.", nullptr,
1239 eCommandRequiresProcess | eCommandProcessMustBeLaunched),
1244 "The format to use for each of the value to be written."),
1246 "The size in bytes to write from input file or "
1250 CommandArgumentData addr_arg;
1251 CommandArgumentData value_arg;
1259 arg1.push_back(addr_arg);
1268 arg2.push_back(value_arg);
1299 "%s takes a destination address when writing file contents.\n",
1305 "%s takes only a destination address when writing file contents.\n",
1309 }
else if (argc < 2) {
1311 "%s takes a destination address and at least one value.\n",
1329 result.
AppendError(
"invalid address expression\n");
1335 size_t length = SIZE_MAX;
1336 if (item_byte_size > 1)
1337 length = item_byte_size;
1342 length = data_sp->GetByteSize();
1345 size_t bytes_written =
1348 if (bytes_written == length) {
1351 "%" PRIu64
" bytes were written to 0x%" PRIx64
"\n",
1352 (uint64_t)bytes_written, addr);
1354 }
else if (bytes_written > 0) {
1357 "%" PRIu64
" bytes of %" PRIu64
1358 " requested were written to 0x%" PRIx64
"\n",
1359 (uint64_t)bytes_written, (uint64_t)length, addr);
1364 addr,
error.AsCString());
1371 }
else if (item_byte_size == 0) {
1381 bool success =
false;
1382 for (
auto &entry : command) {
1412 result.
AppendError(
"unsupported format for writing memory");
1423 bool success =
false;
1424 if (entry.ref().starts_with(
"0x"))
1425 success = !entry.ref().getAsInteger(0, uval64);
1427 success = !entry.ref().getAsInteger(16, uval64);
1430 "'%s' is not a valid hex string value.\n", entry.c_str());
1432 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1434 " is too large to fit in a %" PRIu64
1435 " byte unsigned integer value.\n",
1436 uval64, (uint64_t)item_byte_size);
1446 "'%s' is not a valid boolean string value.\n", entry.c_str());
1453 if (entry.ref().getAsInteger(2, uval64)) {
1455 "'%s' is not a valid binary string value.\n", entry.c_str());
1457 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1459 " is too large to fit in a %" PRIu64
1460 " byte unsigned integer value.\n",
1461 uval64, (uint64_t)item_byte_size);
1470 if (entry.ref().empty())
1473 size_t len = entry.ref().size();
1483 addr,
error.AsCString());
1489 if (entry.ref().getAsInteger(0, sval64)) {
1491 "'%s' is not a valid signed decimal value.\n", entry.c_str());
1493 }
else if (!llvm::isIntN(item_byte_size * 8, sval64)) {
1495 "Value %" PRIi64
" is too large or small to fit in a %" PRIu64
1496 " byte signed integer value.\n",
1497 sval64, (uint64_t)item_byte_size);
1505 if (entry.ref().getAsInteger(0, uval64)) {
1507 "'%s' is not a valid unsigned decimal string value.\n",
1510 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1512 " is too large to fit in a %" PRIu64
1513 " byte unsigned integer value.\n",
1514 uval64, (uint64_t)item_byte_size);
1521 if (entry.ref().getAsInteger(8, uval64)) {
1523 "'%s' is not a valid octal string value.\n", entry.c_str());
1525 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1527 " is too large to fit in a %" PRIu64
1528 " byte unsigned integer value.\n",
1529 uval64, (uint64_t)item_byte_size);
1539 const char *buffer_data = buffer.
GetString().data();
1540 const size_t buffer_size = buffer.
GetString().size();
1541 const size_t write_size =
1544 if (write_size != buffer_size) {
1547 addr,
error.AsCString());
1563 "Print recorded stack traces for "
1564 "allocation/deallocation events "
1565 "associated with an address.",
1567 eCommandRequiresTarget | eCommandRequiresProcess |
1568 eCommandProcessMustBePaused |
1569 eCommandProcessMustBeLaunched) {
1579 arg1.push_back(addr_arg);
1588 uint32_t index)
override {
1596 if (argc == 0 || argc > 1) {
1618 if (!memory_history) {
1619 result.
AppendError(
"no available memory history provider");
1623 HistoryThreads thread_list = memory_history->GetHistoryThreads(addr);
1625 const bool stop_format =
false;
1626 for (
auto thread : thread_list) {
1627 thread->GetStatus(*output_stream, 0,
UINT32_MAX, 0, stop_format);
1635#pragma mark CommandObjectMemoryRegion
1637#define LLDB_OPTIONS_memory_region
1638#include "CommandOptions.inc"
1649 return llvm::ArrayRef(g_memory_region_options);
1655 const int short_option = g_memory_region_options[option_idx].short_option;
1657 switch (short_option) {
1663 llvm_unreachable(
"Unimplemented option");
1678 "Get information on the memory region containing "
1679 "an address in the current target process.",
1680 "memory region <address-expression> (or --all)",
1681 eCommandRequiresProcess | eCommandTryTargetAPILock |
1682 eCommandProcessMustBeLaunched) {
1704 while (section_sp->GetParent())
1705 section_sp = section_sp->GetParent();
1706 section_name = section_sp->GetName();
1712 "[{0:x16}-{1:x16}) {2:r}{3:w}{4:x}{5}{6}{7}{8}",
1716 name, section_name ?
" " :
"", section_name);
1718 if (memory_tagged == MemoryRegionInfo::OptionalBool::eYes)
1721 const std::optional<std::vector<addr_t>> &dirty_page_list =
1723 if (dirty_page_list) {
1724 const size_t page_count = dirty_page_list->size();
1726 "Modified memory (dirty) page list provided, %zu entries.\n",
1728 if (page_count > 0) {
1729 bool print_comma =
false;
1731 for (
size_t i = 0; i < page_count; i++) {
1761 "The \"--all\" option cannot be used when an address "
1762 "argument is given");
1766 auto load_addr_str = command[0].ref();
1771 command[0].c_str(),
error.AsCString());
1774 }
else if (argc > 1 ||
1784 (abi && (abi->FixAnyAddress(load_addr) != load_addr))) {
1786 "'%s' takes one argument or \"--all\" option:\nUsage: %s\n",
1795 std::vector<std::pair<lldb_private::MemoryRegionInfo, lldb::addr_t>>
1805 (!abi || (abi->FixAnyAddress(addr) == addr))) {
1807 error = process_sp->GetMemoryRegionInfo(addr, region_info);
1809 if (
error.Success()) {
1810 region_list.push_back({region_info, addr});
1816 error = process_sp->GetMemoryRegionInfo(load_addr, region_info);
1817 if (
error.Success())
1818 region_list.push_back({region_info, load_addr});
1821 if (
error.Success()) {
1822 for (std::pair<MemoryRegionInfo, addr_t> &range : region_list) {
1823 DumpRegion(result, process_sp->GetTarget(), range.first, range.second);
1835 uint32_t index)
override {
1851 interpreter,
"memory",
1852 "Commands for operating on memory in the current target process.",
1853 "memory <subcommand> [<subcommand-options>]") {
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
uint8_t operator[](lldb::addr_t offset)
ProcessMemoryIterator(ProcessSP process_sp, lldb::addr_t base)
OptionGroupMemoryTag m_memory_tag_options
lldb::addr_t FastSearch(lldb::addr_t low, lldb::addr_t high, uint8_t *buffer, size_t buffer_size)
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.
uint32_t GetDataByteSize() const
Architecture data byte width accessor.
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
std::vector< CommandArgumentData > CommandArgumentEntry
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
void AppendMessage(llvm::StringRef in_string)
void void AppendError(llvm::StringRef in_string)
void AppendWarningWithFormat(const char *format,...) __attribute__((format(printf
void SetStatus(lldb::ReturnStatus status)
void void AppendMessageWithFormatv(const char *format, Args &&... args)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendMessageWithFormat(const char *format,...) __attribute__((format(printf
void void AppendWarning(llvm::StringRef in_string)
Stream & GetOutputStream()
Generic representation of a type in a programming language.
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
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.
ExecutionContextScope * GetBestExecutionContextScope() const
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
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.
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void Clear()
Clears the object state.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
int Open(const char *path, int flags, int mode=0600)
Wraps ::open in a platform-independent way.
static FileSystem & Instance()
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)
OptionalBool GetWritable() const
ConstString GetName() const
OptionalBool GetMemoryTagged() 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.
OptionalBool GetReadable() const
OptionalBool GetExecutable() 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.
OptionValueBoolean GetShowTags()
bool AnyOptionWasSet() const
void Append(OptionGroup *group)
Append options from a OptionGroup class.
bool AnyOptionWasSet() const
const OptionValueFileSpec & GetFile()
const OptionValueBoolean & GetAppend()
bool AnyOptionWasSet() const
DumpValueObjectOptions GetAsDumpOptions(LanguageRuntimeDescriptionDisplayVerbosity lang_descr_verbosity=eLanguageRuntimeDescriptionDisplayVerbosityFull, lldb::Format format=lldb::eFormatDefault, lldb::TypeSummaryImplSP summary_sp=lldb::TypeSummaryImplSP())
void SetCurrentValue(bool value)
bool GetCurrentValue() const
FileSpec & GetCurrentValue()
lldb::LanguageType GetCurrentValue() const
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
const char * GetCurrentValue() const
uint64_t GetCurrentValue() const
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
bool OptionWasSet() const
std::optional< T > GetValueAs() 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
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.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
bool Fail() const
Test for error condition.
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
@ eBinary
Get and put data as binary instead of as the default string mode.
uint32_t GetAddressByteSize() const
Get the address size in bytes.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
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)
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)
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
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)
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::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.
@ eFormatCharPrintable
Only printable characters, '.' if not printable.
@ eFormatComplexInteger
Integer complex type.
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 bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)
BaseType GetRangeBase() const
BaseType GetRangeEnd() const