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;
573 size_t item_byte_size =
578 const size_t num_per_line =
581 if (total_byte_size == 0) {
582 total_byte_size = item_count * item_byte_size;
583 if (total_byte_size == 0)
584 total_byte_size = 32;
592 result.
AppendError(
"invalid start address expression.");
602 result.
AppendError(
"invalid end address expression.");
605 }
else if (end_addr <= addr) {
607 "end address (0x%" PRIx64
608 ") must be greater than the start address (0x%" PRIx64
").\n",
613 "specify either the end address (0x%" PRIx64
614 ") or the count (--count %" PRIu64
"), not both.\n",
615 end_addr, (uint64_t)item_count);
619 total_byte_size = end_addr - addr;
620 item_count = total_byte_size / item_byte_size;
627 "Normally, \'memory read\' will not read over %" PRIu32
631 "Please use --force to override this restriction just once.\n");
633 "will often need a larger limit.\n");
638 size_t bytes_read = 0;
645 auto size_or_err = compiler_type.
GetByteSize(exe_scope);
647 result.
AppendError(llvm::toString(size_or_err.takeError()));
650 auto size = *size_or_err;
657 data_sp = std::make_shared<DataBufferHeap>(total_byte_size,
'\0');
658 if (data_sp->GetBytes() ==
nullptr) {
660 "can't allocate 0x%" PRIx32
661 " bytes for the memory read buffer, specify a smaller size to read",
662 (uint32_t)total_byte_size);
666 Address address(addr,
nullptr);
667 bytes_read = target->
ReadMemory(address, data_sp->GetBytes(),
668 data_sp->GetByteSize(),
error,
true);
669 if (bytes_read == 0) {
670 const char *error_cstr =
error.AsCString();
671 if (error_cstr && error_cstr[0]) {
675 "failed to read memory from 0x%" PRIx64
".\n", addr);
680 if (bytes_read < total_byte_size)
682 "Not all bytes (%" PRIu64
"/%" PRIu64
683 ") were able to be read from 0x%" PRIx64
".\n",
684 (uint64_t)bytes_read, (uint64_t)total_byte_size, addr);
695 data_sp = std::make_shared<DataBufferHeap>(
696 (item_byte_size + 1) * item_count,
698 if (data_sp->GetBytes() ==
nullptr) {
700 "can't allocate 0x%" PRIx64
701 " bytes for the memory read buffer, specify a smaller size to read",
702 (uint64_t)((item_byte_size + 1) * item_count));
705 uint8_t *data_ptr = data_sp->GetBytes();
706 auto data_addr = addr;
707 auto count = item_count;
709 bool break_on_no_NULL =
false;
710 while (item_count < count) {
712 buffer.resize(item_byte_size + 1, 0);
715 item_byte_size + 1,
error);
718 "failed to read memory from 0x%" PRIx64
".\n", addr);
722 if (item_byte_size == read) {
724 "unable to find a NULL terminated string at 0x%" PRIx64
725 ". Consider increasing the maximum read length.\n",
728 break_on_no_NULL =
true;
732 memcpy(data_ptr, &buffer[0], read);
739 if (break_on_no_NULL)
743 std::make_shared<DataBufferHeap>(data_sp->GetBytes(), bytes_read + 1);
755 std::unique_ptr<Stream> output_stream_storage;
756 Stream *output_stream_p =
nullptr;
760 std::string path = outfile_spec.
GetPath();
772 auto outfile_stream_up =
773 std::make_unique<StreamFile>(std::move(outfile.get()));
775 const size_t bytes_written =
776 outfile_stream_up->Write(data_sp->GetBytes(), bytes_read);
777 if (bytes_written > 0) {
779 "%zi bytes %s to '%s'\n", bytes_written,
780 append ?
"appended" :
"written", path.c_str());
785 (uint64_t)bytes_read, path.c_str());
791 output_stream_storage = std::move(outfile_stream_up);
792 output_stream_p = output_stream_storage.get();
796 path.c_str(), append ?
"append" :
"write");
798 result.
AppendError(llvm::toString(outfile.takeError()));
806 for (uint32_t i = 0; i < item_count; ++i) {
807 addr_t item_addr = addr + (i * item_byte_size);
810 name_strm.
Printf(
"0x%" PRIx64, item_addr);
812 exe_scope, name_strm.
GetString(), address, compiler_type));
816 valobj_sp->SetFormat(format);
821 if (llvm::Error
error = valobj_sp->Dump(*output_stream_p, options)) {
827 "failed to create a value object for: (%s) %s\n",
828 view_as_type_cstr, name_strm.
GetData());
842 (item_byte_size != 1)) {
850 item_count = item_byte_size;
856 "reading memory as characters of size %" PRIu64
" is not supported",
857 (uint64_t)item_byte_size);
862 assert(output_stream_p);
864 data, output_stream_p, 0, format, item_byte_size, item_count,
868 output_stream_p->
EOL();
887#define LLDB_OPTIONS_memory_find
888#include "CommandOptions.inc"
896 return size_or_err.takeError();
898 switch (*size_or_err) {
900 uint8_t
byte = (uint8_t)value;
904 uint16_t word = (uint16_t)value;
908 uint32_t lword = (uint32_t)value;
915 return llvm::createStringError(
916 "Only expressions resulting in 1, 2, 4, or 8-byte-sized values are "
917 "supported. For other pattern sizes the --string (-s) option may be "
921 return llvm::Error::success();
924static llvm::Expected<ValueObjectSP>
931 return llvm::createStringError(
932 "No result returned from expression. Exit status: %d", status);
935 return result_sp->GetError().ToError();
937 result_sp = result_sp->GetQualifiedRepresentationIfAvailable(
938 result_sp->GetDynamicValueType(),
true);
940 return llvm::createStringError(
"failed to get dynamic result type");
955 return llvm::ArrayRef(g_memory_find_options);
961 const int short_option = g_memory_find_options[option_idx].short_option;
963 switch (short_option) {
965 m_expr.SetValueFromString(option_value);
969 m_string.SetValueFromString(option_value);
973 if (
m_count.SetValueFromString(option_value).Fail())
978 if (
m_offset.SetValueFromString(option_value).Fail())
983 llvm_unreachable(
"Unimplemented option");
1002 interpreter,
"memory find",
1003 "Find a value in the memory of the current target process.",
1004 nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched) {
1016 arg1.push_back(addr_arg);
1024 arg2.push_back(value_arg);
1049 result.
AppendError(
"two addresses needed for memory find");
1067 if (high_addr <= low_addr) {
1069 "starting address must be smaller than ending address");
1078 llvm::StringRef str =
1081 result.
AppendError(
"search string must have non-zero length.");
1089 if (!result_or_err) {
1090 result.
AppendError(
"Expression evaluation failed: ");
1091 result.
AppendError(llvm::toString(result_or_err.takeError()));
1099 result.
AppendError(llvm::toString(std::move(err)));
1104 "please pass either a block of text, or an expression to evaluate.");
1109 found_location = low_addr;
1110 bool ever_found =
false;
1119 result.
AppendMessage(
"no more matches within the range.\n");
1129 if (!
error.Fail()) {
1137 m_exe_ctx.GetBestExecutionContextScope(),
1155#define LLDB_OPTIONS_memory_write
1156#include "CommandOptions.inc"
1168 return llvm::ArrayRef(g_memory_write_options);
1174 const int short_option = g_memory_write_options[option_idx].short_option;
1176 switch (short_option) {
1178 m_infile.SetFile(option_value, FileSpec::Style::native);
1183 "input file does not exist: '%s'", option_value.str().c_str());
1191 "invalid offset string '%s'", option_value.str().c_str());
1196 llvm_unreachable(
"Unimplemented option");
1212 interpreter,
"memory write",
1213 "Write to the memory of the current target process.", nullptr,
1214 eCommandRequiresProcess | eCommandProcessMustBeLaunched),
1219 "The format to use for each of the value to be written."),
1221 "The size in bytes to write from input file or "
1225 CommandArgumentData addr_arg;
1226 CommandArgumentData value_arg;
1234 arg1.push_back(addr_arg);
1243 arg2.push_back(value_arg);
1274 "%s takes a destination address when writing file contents.\n",
1280 "%s takes only a destination address when writing file contents.\n",
1284 }
else if (argc < 2) {
1286 "%s takes a destination address and at least one value.\n",
1304 result.
AppendError(
"invalid address expression\n");
1310 size_t length = SIZE_MAX;
1311 if (item_byte_size > 1)
1312 length = item_byte_size;
1317 length = data_sp->GetByteSize();
1320 size_t bytes_written =
1323 if (bytes_written == length) {
1326 "%" PRIu64
" bytes were written to 0x%" PRIx64
"\n",
1327 (uint64_t)bytes_written, addr);
1329 }
else if (bytes_written > 0) {
1332 "%" PRIu64
" bytes of %" PRIu64
1333 " requested were written to 0x%" PRIx64
"\n",
1334 (uint64_t)bytes_written, (uint64_t)length, addr);
1339 addr,
error.AsCString());
1346 }
else if (item_byte_size == 0) {
1356 bool success =
false;
1357 for (
auto &entry : command) {
1388 result.
AppendError(
"unsupported format for writing memory");
1399 bool success =
false;
1400 if (entry.ref().starts_with(
"0x"))
1401 success = !entry.ref().getAsInteger(0, uval64);
1403 success = !entry.ref().getAsInteger(16, uval64);
1406 "'%s' is not a valid hex string value.\n", entry.c_str());
1408 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1410 " is too large to fit in a %" PRIu64
1411 " byte unsigned integer value.\n",
1412 uval64, (uint64_t)item_byte_size);
1422 "'%s' is not a valid boolean string value.\n", entry.c_str());
1429 if (entry.ref().getAsInteger(2, uval64)) {
1431 "'%s' is not a valid binary string value.\n", entry.c_str());
1433 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1435 " is too large to fit in a %" PRIu64
1436 " byte unsigned integer value.\n",
1437 uval64, (uint64_t)item_byte_size);
1446 if (entry.ref().empty())
1449 size_t len = entry.ref().size();
1459 addr,
error.AsCString());
1465 if (entry.ref().getAsInteger(0, sval64)) {
1467 "'%s' is not a valid signed decimal value.\n", entry.c_str());
1469 }
else if (!llvm::isIntN(item_byte_size * 8, sval64)) {
1471 "Value %" PRIi64
" is too large or small to fit in a %" PRIu64
1472 " byte signed integer value.\n",
1473 sval64, (uint64_t)item_byte_size);
1481 if (entry.ref().getAsInteger(0, uval64)) {
1483 "'%s' is not a valid unsigned decimal string value.\n",
1486 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1488 " is too large to fit in a %" PRIu64
1489 " byte unsigned integer value.\n",
1490 uval64, (uint64_t)item_byte_size);
1497 if (entry.ref().getAsInteger(8, uval64)) {
1499 "'%s' is not a valid octal string value.\n", entry.c_str());
1501 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1503 " is too large to fit in a %" PRIu64
1504 " byte unsigned integer value.\n",
1505 uval64, (uint64_t)item_byte_size);
1515 const char *buffer_data = buffer.
GetString().data();
1516 const size_t buffer_size = buffer.
GetString().size();
1517 const size_t write_size =
1520 if (write_size != buffer_size) {
1523 addr,
error.AsCString());
1539 "Print recorded stack traces for "
1540 "allocation/deallocation events "
1541 "associated with an address.",
1543 eCommandRequiresTarget | eCommandRequiresProcess |
1544 eCommandProcessMustBePaused |
1545 eCommandProcessMustBeLaunched) {
1555 arg1.push_back(addr_arg);
1564 uint32_t index)
override {
1572 if (argc == 0 || argc > 1) {
1594 if (!memory_history) {
1595 result.
AppendError(
"no available memory history provider");
1599 HistoryThreads thread_list = memory_history->GetHistoryThreads(addr);
1601 const bool stop_format =
false;
1602 for (
auto thread : thread_list) {
1603 thread->GetStatus(*output_stream, 0,
UINT32_MAX, 0, stop_format,
1612#pragma mark CommandObjectMemoryRegion
1614#define LLDB_OPTIONS_memory_region
1615#include "CommandOptions.inc"
1626 return llvm::ArrayRef(g_memory_region_options);
1632 const int short_option = g_memory_region_options[option_idx].short_option;
1634 switch (short_option) {
1636 m_all.SetCurrentValue(
true);
1637 m_all.SetOptionWasSet();
1640 llvm_unreachable(
"Unimplemented option");
1655 "Get information on the memory region containing "
1656 "an address in the current target process.",
1657 "memory region <address-expression> (or --all)",
1658 eCommandRequiresProcess | eCommandTryTargetAPILock |
1659 eCommandProcessMustBeLaunched) {
1681 while (section_sp->GetParent())
1682 section_sp = section_sp->GetParent();
1683 section_name = section_sp->GetName();
1689 "[{0:x16}-{1:x16}) {2:r}{3:w}{4:x}{5}{6}{7}{8}",
1693 name, section_name ?
" " :
"", section_name);
1701 const std::optional<std::vector<addr_t>> &dirty_page_list =
1703 if (dirty_page_list) {
1704 const size_t page_count = dirty_page_list->size();
1706 "Modified memory (dirty) page list provided, %zu entries.\n",
1708 if (page_count > 0) {
1709 bool print_comma =
false;
1711 for (
size_t i = 0; i < page_count; i++) {
1741 "The \"--all\" option cannot be used when an address "
1742 "argument is given");
1746 auto load_addr_str = command[0].ref();
1751 command[0].c_str(),
error.AsCString());
1754 }
else if (argc > 1 ||
1764 (abi && (abi->FixAnyAddress(load_addr) != load_addr))) {
1766 "'%s' takes one argument or \"--all\" option:\nUsage: %s\n",
1775 std::vector<std::pair<lldb_private::MemoryRegionInfo, lldb::addr_t>>
1785 (!abi || (abi->FixAnyAddress(addr) == addr))) {
1787 error = process_sp->GetMemoryRegionInfo(addr, region_info);
1789 if (
error.Success()) {
1790 region_list.push_back({region_info, addr});
1796 error = process_sp->GetMemoryRegionInfo(load_addr, region_info);
1797 if (
error.Success())
1798 region_list.push_back({region_info, load_addr});
1801 if (
error.Success()) {
1802 for (std::pair<MemoryRegionInfo, addr_t> &range : region_list) {
1803 DumpRegion(result, process_sp->GetTarget(), range.first, range.second);
1815 uint32_t index)
override {
1831 interpreter,
"memory",
1832 "Commands for operating on memory in the current target process.",
1833 "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.
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
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 void AppendError(llvm::StringRef in_string)
void AppendWarningWithFormat(const char *format,...) __attribute__((format(printf
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendMessageWithFormat(const char *format,...) __attribute__((format(printf
void void AppendMessageWithFormatv(const char *format, Args &&...args)
void 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.
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
OptionalBool IsShadowStack() 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.
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.
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.
@ eBinary
Get and put data as binary instead of as the default string mode.
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)
CompilerType GetCompilerType()
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
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.
const char * toString(AppleArm64ExceptionClass EC)
@ 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 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 bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)
BaseType GetRangeBase() const
BaseType GetRangeEnd() const