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 if (llvm::Error
error = valobj_sp->Dump(*output_stream_p, options)) {
824 "failed to create a value object for: (%s) %s\n",
825 view_as_type_cstr, name_strm.
GetData());
839 (item_byte_size != 1)) {
847 item_count = item_byte_size;
853 "reading memory as characters of size %" PRIu64
" is not supported",
854 (uint64_t)item_byte_size);
859 assert(output_stream_p);
861 data, output_stream_p, 0, format, item_byte_size, item_count,
865 output_stream_p->
EOL();
884#define LLDB_OPTIONS_memory_find
885#include "CommandOptions.inc"
897 return llvm::ArrayRef(g_memory_find_options);
903 const int short_option = g_memory_find_options[option_idx].short_option;
905 switch (short_option) {
916 error.SetErrorString(
"unrecognized value for count");
921 error.SetErrorString(
"unrecognized value for dump-offset");
925 llvm_unreachable(
"Unimplemented option");
944 interpreter,
"memory find",
945 "Find a value in the memory of the current target process.",
946 nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched) {
958 arg1.push_back(addr_arg);
966 arg2.push_back(value_arg);
991 result.
AppendError(
"two addresses needed for memory find");
1009 if (high_addr <= low_addr) {
1011 "starting address must be smaller than ending address");
1020 llvm::StringRef str =
1023 result.
AppendError(
"search string must have non-zero length.");
1034 frame, result_sp)) &&
1036 uint64_t value = result_sp->GetValueAsUnsigned(0);
1037 std::optional<uint64_t> size =
1038 result_sp->GetCompilerType().GetByteSize(
nullptr);
1043 uint8_t
byte = (uint8_t)value;
1047 uint16_t word = (uint16_t)value;
1051 uint32_t lword = (uint32_t)value;
1061 result.
AppendError(
"unknown type. pass a string instead");
1065 "result size larger than 8 bytes. pass a string instead");
1070 "expression evaluation failed. pass a string instead");
1075 "please pass either a block of text, or an expression to evaluate.");
1080 found_location = low_addr;
1081 bool ever_found =
false;
1090 result.
AppendMessage(
"no more matches within the range.\n");
1100 if (!
error.Fail()) {
1126#define LLDB_OPTIONS_memory_write
1127#include "CommandOptions.inc"
1139 return llvm::ArrayRef(g_memory_write_options);
1145 const int short_option = g_memory_write_options[option_idx].short_option;
1147 switch (short_option) {
1153 error.SetErrorStringWithFormat(
"input file does not exist: '%s'",
1154 option_value.str().c_str());
1161 error.SetErrorStringWithFormat(
"invalid offset string '%s'",
1162 option_value.str().c_str());
1167 llvm_unreachable(
"Unimplemented option");
1183 interpreter,
"memory write",
1184 "Write to the memory of the current target process.", nullptr,
1185 eCommandRequiresProcess | eCommandProcessMustBeLaunched),
1190 "The format to use for each of the value to be written."),
1192 "The size in bytes to write from input file or "
1196 CommandArgumentData addr_arg;
1197 CommandArgumentData value_arg;
1205 arg1.push_back(addr_arg);
1214 arg2.push_back(value_arg);
1245 "%s takes a destination address when writing file contents.\n",
1251 "%s takes only a destination address when writing file contents.\n",
1255 }
else if (argc < 2) {
1257 "%s takes a destination address and at least one value.\n",
1275 result.
AppendError(
"invalid address expression\n");
1281 size_t length = SIZE_MAX;
1282 if (item_byte_size > 1)
1283 length = item_byte_size;
1288 length = data_sp->GetByteSize();
1291 size_t bytes_written =
1294 if (bytes_written == length) {
1297 "%" PRIu64
" bytes were written to 0x%" PRIx64
"\n",
1298 (uint64_t)bytes_written, addr);
1300 }
else if (bytes_written > 0) {
1303 "%" PRIu64
" bytes of %" PRIu64
1304 " requested were written to 0x%" PRIx64
"\n",
1305 (uint64_t)bytes_written, (uint64_t)length, addr);
1310 addr,
error.AsCString());
1317 }
else if (item_byte_size == 0) {
1327 bool success =
false;
1328 for (
auto &entry : command) {
1358 result.
AppendError(
"unsupported format for writing memory");
1369 bool success =
false;
1370 if (entry.ref().starts_with(
"0x"))
1371 success = !entry.ref().getAsInteger(0, uval64);
1373 success = !entry.ref().getAsInteger(16, uval64);
1376 "'%s' is not a valid hex string value.\n", entry.c_str());
1378 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1380 " is too large to fit in a %" PRIu64
1381 " byte unsigned integer value.\n",
1382 uval64, (uint64_t)item_byte_size);
1392 "'%s' is not a valid boolean string value.\n", entry.c_str());
1399 if (entry.ref().getAsInteger(2, uval64)) {
1401 "'%s' is not a valid binary string value.\n", entry.c_str());
1403 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1405 " is too large to fit in a %" PRIu64
1406 " byte unsigned integer value.\n",
1407 uval64, (uint64_t)item_byte_size);
1416 if (entry.ref().empty())
1419 size_t len = entry.ref().size();
1429 addr,
error.AsCString());
1435 if (entry.ref().getAsInteger(0, sval64)) {
1437 "'%s' is not a valid signed decimal value.\n", entry.c_str());
1439 }
else if (!llvm::isIntN(item_byte_size * 8, sval64)) {
1441 "Value %" PRIi64
" is too large or small to fit in a %" PRIu64
1442 " byte signed integer value.\n",
1443 sval64, (uint64_t)item_byte_size);
1451 if (entry.ref().getAsInteger(0, uval64)) {
1453 "'%s' is not a valid unsigned decimal string value.\n",
1456 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1458 " is too large to fit in a %" PRIu64
1459 " byte unsigned integer value.\n",
1460 uval64, (uint64_t)item_byte_size);
1467 if (entry.ref().getAsInteger(8, uval64)) {
1469 "'%s' is not a valid octal string value.\n", entry.c_str());
1471 }
else if (!llvm::isUIntN(item_byte_size * 8, uval64)) {
1473 " is too large to fit in a %" PRIu64
1474 " byte unsigned integer value.\n",
1475 uval64, (uint64_t)item_byte_size);
1485 const char *buffer_data = buffer.
GetString().data();
1486 const size_t buffer_size = buffer.
GetString().size();
1487 const size_t write_size =
1490 if (write_size != buffer_size) {
1493 addr,
error.AsCString());
1509 "Print recorded stack traces for "
1510 "allocation/deallocation events "
1511 "associated with an address.",
1513 eCommandRequiresTarget | eCommandRequiresProcess |
1514 eCommandProcessMustBePaused |
1515 eCommandProcessMustBeLaunched) {
1525 arg1.push_back(addr_arg);
1534 uint32_t index)
override {
1542 if (argc == 0 || argc > 1) {
1564 if (!memory_history) {
1565 result.
AppendError(
"no available memory history provider");
1569 HistoryThreads thread_list = memory_history->GetHistoryThreads(addr);
1571 const bool stop_format =
false;
1572 for (
auto thread : thread_list) {
1573 thread->GetStatus(*output_stream, 0,
UINT32_MAX, 0, stop_format);
1581#pragma mark CommandObjectMemoryRegion
1583#define LLDB_OPTIONS_memory_region
1584#include "CommandOptions.inc"
1595 return llvm::ArrayRef(g_memory_region_options);
1601 const int short_option = g_memory_region_options[option_idx].short_option;
1603 switch (short_option) {
1609 llvm_unreachable(
"Unimplemented option");
1624 "Get information on the memory region containing "
1625 "an address in the current target process.",
1626 "memory region <address-expression> (or --all)",
1627 eCommandRequiresProcess | eCommandTryTargetAPILock |
1628 eCommandProcessMustBeLaunched) {
1650 while (section_sp->GetParent())
1651 section_sp = section_sp->GetParent();
1652 section_name = section_sp->GetName();
1658 "[{0:x16}-{1:x16}) {2:r}{3:w}{4:x}{5}{6}{7}{8}",
1662 name, section_name ?
" " :
"", section_name);
1664 if (memory_tagged == MemoryRegionInfo::OptionalBool::eYes)
1667 const std::optional<std::vector<addr_t>> &dirty_page_list =
1669 if (dirty_page_list) {
1670 const size_t page_count = dirty_page_list->size();
1672 "Modified memory (dirty) page list provided, %zu entries.\n",
1674 if (page_count > 0) {
1675 bool print_comma =
false;
1677 for (
size_t i = 0; i < page_count; i++) {
1707 "The \"--all\" option cannot be used when an address "
1708 "argument is given");
1712 auto load_addr_str = command[0].ref();
1717 command[0].c_str(),
error.AsCString());
1720 }
else if (argc > 1 ||
1730 (abi && (abi->FixAnyAddress(load_addr) != load_addr))) {
1732 "'%s' takes one argument or \"--all\" option:\nUsage: %s\n",
1741 std::vector<std::pair<lldb_private::MemoryRegionInfo, lldb::addr_t>>
1751 (!abi || (abi->FixAnyAddress(addr) == addr))) {
1753 error = process_sp->GetMemoryRegionInfo(addr, region_info);
1755 if (
error.Success()) {
1756 region_list.push_back({region_info, addr});
1762 error = process_sp->GetMemoryRegionInfo(load_addr, region_info);
1763 if (
error.Success())
1764 region_list.push_back({region_info, load_addr});
1767 if (
error.Success()) {
1768 for (std::pair<MemoryRegionInfo, addr_t> &range : region_list) {
1769 DumpRegion(result, process_sp->GetTarget(), range.first, range.second);
1781 uint32_t index)
override {
1797 interpreter,
"memory",
1798 "Commands for operating on memory in the current target process.",
1799 "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
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
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
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.
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.
uint32_t GetAddressByteSize() const
Get the address size in bytes.
@ eBinary
Get and put data as binary instead of as the default string mode.
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)
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)
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.
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.
@ 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