35#include "lldb/Host/Config.h"
38#include "llvm/ADT/StringSwitch.h"
39#include "llvm/Support/JSON.h"
41#if defined(HAVE_LIBCOMPRESSION)
42#include <compression.h>
48using namespace std::chrono;
52 return os << llvm::formatv(
53 "QOffsets({0}, [{1:@[x]}])", offsets.
segments,
61 m_supports_qProcessInfoPID(true), m_supports_qfProcessInfo(true),
62 m_supports_qUserName(true), m_supports_qGroupName(true),
63 m_supports_qThreadStopInfo(true), m_supports_z0(true),
64 m_supports_z1(true), m_supports_z2(true), m_supports_z3(true),
65 m_supports_z4(true), m_supports_QEnvironment(true),
66 m_supports_QEnvironmentHexEncoded(true), m_supports_qSymbol(true),
67 m_qSymbol_requests_done(false), m_supports_qModuleInfo(true),
68 m_supports_jThreadsInfo(true), m_supports_jModulesInfo(true),
69 m_supports_vFileSize(true), m_supports_vFileMode(true),
70 m_supports_vFileExists(true), m_supports_vRun(true),
72 m_host_arch(), m_process_arch(), m_os_build(), m_os_kernel(),
73 m_hostname(), m_gdb_server_name(), m_default_packet_timeout(0),
74 m_qSupported_response(), m_supported_async_json_packets_sp(),
75 m_qXfer_memory_map() {}
88 std::chrono::steady_clock::time_point start_of_handshake =
89 std::chrono::steady_clock::now();
98 std::chrono::steady_clock::time_point end_of_handshake =
99 std::chrono::steady_clock::now();
100 auto handshake_timeout =
101 std::chrono::duration<double>(end_of_handshake - start_of_handshake)
106 "while waiting for reply to initial "
110 "failed to get reply to handshake packet within timeout of "
351 std::vector<std::string> features = {
"xmlRegisters=i386,arm,mips,arc",
352 "multiprocess+",
"fork-events+",
356 for (
uint32_t i = 0; i < features.size(); ++i) {
368 for (llvm::StringRef x : llvm::split(response.
GetStringRef(),
';')) {
369 if (x ==
"qXfer:auxv:read+")
371 else if (x ==
"qXfer:libraries-svr4:read+")
373 else if (x ==
"augmented-libraries-svr4-read") {
376 }
else if (x ==
"qXfer:libraries:read+")
378 else if (x ==
"qXfer:features:read+")
380 else if (x ==
"qXfer:memory-map:read+")
382 else if (x ==
"qXfer:siginfo:read+")
384 else if (x ==
"qEcho")
386 else if (x ==
"QPassSignals+")
388 else if (x ==
"multiprocess+")
390 else if (x ==
"memory-tagging+")
392 else if (x ==
"qSaveCore+")
394 else if (x ==
"native-signals+")
399 else if (x.consume_front(
"SupportedCompressions=")) {
400 llvm::SmallVector<llvm::StringRef, 4> compressions;
401 x.split(compressions,
',');
402 if (!compressions.empty())
404 }
else if (x.consume_front(
"PacketSize=")) {
411 LLDB_LOGF(log,
"Garbled PacketSize spec in qSupported response");
441 const char *response_cstr = response.
GetStringRef().data();
442 if (::strstr(response_cstr,
";c"))
445 if (::strstr(response_cstr,
";C"))
448 if (::strstr(response_cstr,
";s"))
451 if (::strstr(response_cstr,
";S"))
497 "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex "
499 __FUNCTION__, payload.GetData());
504 payload.Printf(
";thread:%4.4" PRIx64
";", tid);
551 }
else if (!response.
Empty()) {
641 packet.
Printf(
"qMemTags:%" PRIx64
",%zx:%" PRIx32, addr, len, type);
649 LLDB_LOGF(log,
"GDBRemoteCommunicationClient::%s: qMemTags packet failed",
657 if (response.
GetChar() !=
'm') {
659 "GDBRemoteCommunicationClient::%s: qMemTags response did not "
666 WritableDataBufferSP buffer_sp(
new DataBufferHeap(expected_bytes, 0));
670 if (response.
GetBytesLeft() || (expected_bytes != got_bytes)) {
673 "GDBRemoteCommunicationClient::%s: Invalid data in qMemTags response",
683 const std::vector<uint8_t> &tags) {
686 packet.
Printf(
"QMemTags:%" PRIx64
",%zx:%" PRIx32
":", addr, len, type);
704 snprintf(packet,
sizeof(packet),
"x0,0");
731 if (response.
GetChar() ==
'Q') {
732 if (response.
GetChar() ==
'C') {
746 bool sequence_mutex_unavailable;
748 if (!ids.empty() && !sequence_mutex_unavailable) {
765 return llvm::createStringError(llvm::inconvertibleErrorCode(),
766 "Nothing to launch");
779 return llvm::createStringError(llvm::inconvertibleErrorCode(),
780 "Sending vRun packet failed");
789 return llvm::Error::success();
797 llvm::ListSeparator LS(
",");
798 for (
const auto &arg : llvm::enumerate(args)) {
800 packet.
Format(
"{0},{1},", arg.value().ref().size() * 2, arg.index());
807 return llvm::createStringError(llvm::inconvertibleErrorCode(),
808 "Sending A packet failed");
815 return llvm::createStringError(llvm::inconvertibleErrorCode(),
816 "Sending qLaunchSuccess packet failed");
819 return llvm::Error::success();
820 if (response.
GetChar() ==
'E') {
821 return llvm::createStringError(llvm::inconvertibleErrorCode(),
824 return llvm::createStringError(llvm::inconvertibleErrorCode(),
825 "unknown error occurred launching process");
829 for (
const auto &KV : env) {
838 char const *name_equal_value) {
839 if (name_equal_value && name_equal_value[0]) {
840 bool send_hex_encoding =
false;
841 for (
const char *p = name_equal_value; *p !=
'\0' && !send_hex_encoding;
843 if (llvm::isPrint(*p)) {
849 send_hex_encoding =
true;
856 send_hex_encoding =
true;
864 packet.
Printf(
"QEnvironment:%s", name_equal_value);
905 if (arch && arch[0]) {
907 packet.
Printf(
"QLaunchArch:%s", arch);
922 char const *data,
bool *was_supported) {
923 if (data && *data !=
'\0') {
925 packet.
Printf(
"QSetProcessEvent:%s", data);
931 *was_supported =
true;
935 *was_supported =
false;
940 *was_supported =
true;
967std::optional<std::string>
1001 UUID &uuid,
addr_t &value,
bool &value_is_offset) {
1034 llvm::StringRef name, value;
1035 bool success =
false;
1037 if (name.equals(
"name")) {
1040 }
else if (name.equals(
"version")) {
1041 llvm::StringRef major, minor;
1042 std::tie(major, minor) = value.split(
'.');
1056 llvm::ArrayRef<llvm::StringRef> supported_compressions) {
1058 llvm::StringRef avail_name;
1060#if defined(HAVE_LIBCOMPRESSION)
1062 for (
auto compression : supported_compressions) {
1063 if (compression ==
"lzfse") {
1065 avail_name = compression;
1072#if defined(HAVE_LIBCOMPRESSION)
1074 for (
auto compression : supported_compressions) {
1075 if (compression ==
"zlib-deflate") {
1077 avail_name = compression;
1086 for (
auto compression : supported_compressions) {
1087 if (compression ==
"zlib-deflate") {
1089 avail_name = compression;
1096#if defined(HAVE_LIBCOMPRESSION)
1098 for (
auto compression : supported_compressions) {
1099 if (compression ==
"lz4") {
1101 avail_name = compression;
1108#if defined(HAVE_LIBCOMPRESSION)
1110 for (
auto compression : supported_compressions) {
1111 if (compression ==
"lzma") {
1113 avail_name = compression;
1122 std::string packet =
"QEnableCompression:type:" + avail_name.str() +
";";
1169 tid = pid_tid->second;
1176 std::string &environment) {
1177 if (value.equals(
"iossimulator") || value.equals(
"tvossimulator") ||
1178 value.equals(
"watchossimulator")) {
1179 environment =
"simulator";
1180 os_name = value.drop_back(environment.size()).str();
1181 }
else if (value.equals(
"maccatalyst")) {
1183 environment =
"macabi";
1185 os_name = value.str();
1201 llvm::StringRef name;
1202 llvm::StringRef value;
1205 std::string arch_name;
1206 std::string os_name;
1207 std::string environment;
1208 std::string vendor_name;
1210 std::string distribution_id;
1215 if (name.equals(
"cputype")) {
1217 if (!value.getAsInteger(0, cpu))
1219 }
else if (name.equals(
"cpusubtype")) {
1221 if (!value.getAsInteger(0, sub))
1223 }
else if (name.equals(
"arch")) {
1224 arch_name = std::string(value);
1226 }
else if (name.equals(
"triple")) {
1230 }
else if (name.equals(
"distribution_id")) {
1234 }
else if (name.equals(
"os_build")) {
1238 }
else if (name.equals(
"hostname")) {
1242 }
else if (name.equals(
"os_kernel")) {
1246 }
else if (name.equals(
"ostype")) {
1249 }
else if (name.equals(
"vendor")) {
1250 vendor_name = std::string(value);
1252 }
else if (name.equals(
"endian")) {
1253 byte_order = llvm::StringSwitch<lldb::ByteOrder>(value)
1260 }
else if (name.equals(
"ptrsize")) {
1261 if (!value.getAsInteger(0, pointer_byte_size))
1263 }
else if (name.equals(
"addressing_bits")) {
1266 }
else if (name.equals(
"os_version") ||
1267 name.equals(
"version"))
1273 }
else if (name.equals(
"maccatalyst_version")) {
1276 }
else if (name.equals(
"watchpoint_exceptions_received")) {
1278 llvm::StringSwitch<LazyBool>(value)
1284 }
else if (name.equals(
"default_packet_timeout")) {
1286 if (!value.getAsInteger(0, timeout_seconds)) {
1291 }
else if (name.equals(
"vm-page-size")) {
1293 if (!value.getAsInteger(0, page_size)) {
1300 if (num_keys_decoded > 0)
1303 if (triple.empty()) {
1304 if (arch_name.empty()) {
1307 if (pointer_byte_size) {
1314 if (!vendor_name.empty())
1316 llvm::StringRef(vendor_name));
1317 if (!os_name.empty())
1319 if (!environment.empty())
1324 triple += arch_name;
1325 if (!vendor_name.empty() || !os_name.empty()) {
1327 if (vendor_name.empty())
1328 triple +=
"unknown";
1330 triple += vendor_name;
1332 if (os_name.empty())
1333 triple +=
"unknown";
1340 if (host_triple.getVendor() == llvm::Triple::Apple &&
1341 host_triple.getOS() == llvm::Triple::Darwin) {
1343 case llvm::Triple::aarch64:
1344 case llvm::Triple::aarch64_32:
1345 case llvm::Triple::arm:
1346 case llvm::Triple::thumb:
1347 host_triple.setOS(llvm::Triple::IOS);
1350 host_triple.setOS(llvm::Triple::MacOSX);
1354 if (pointer_byte_size) {
1363 if (pointer_byte_size) {
1371 "GDBRemoteCommunicationClient::%s parsed host "
1372 "architecture as %s, triple as %s from triple text %s",
1376 :
"<null-arch-name>",
1380 if (!distribution_id.empty())
1424 const int packet_len = ::snprintf(
1425 packet,
sizeof(packet),
"_M%" PRIx64
",%s%s%s", (uint64_t)size,
1426 permissions & lldb::ePermissionsReadable ?
"r" :
"",
1427 permissions & lldb::ePermissionsWritable ?
"w" :
"",
1428 permissions & lldb::ePermissionsExecutable ?
"x" :
"");
1429 assert(packet_len < (
int)
sizeof(packet));
1449 const int packet_len =
1450 ::snprintf(packet,
sizeof(packet),
"_m%" PRIx64, (uint64_t)addr);
1451 assert(packet_len < (
int)
sizeof(packet));
1476 const int packet_len =
1477 ::snprintf(packet,
sizeof(packet),
"qSupportsDetachAndStayStopped:");
1478 assert(packet_len < (
int)
sizeof(packet));
1491 error.SetErrorString(
"Stays stopped not supported by this target.");
1506 error.SetErrorString(
"Multiprocess extension not supported by the server.");
1514 error.SetErrorString(
"Sending isconnect packet failed.");
1521 region_info.
Clear();
1526 const int packet_len = ::snprintf(
1527 packet,
sizeof(packet),
"qMemoryRegionInfo:%" PRIx64, (uint64_t)addr);
1528 assert(packet_len < (
int)
sizeof(packet));
1534 llvm::StringRef name;
1535 llvm::StringRef value;
1537 bool success =
true;
1538 bool saw_permissions =
false;
1540 if (name.equals(
"start")) {
1541 if (!value.getAsInteger(16, addr_value))
1543 }
else if (name.equals(
"size")) {
1544 if (!value.getAsInteger(16, addr_value)) {
1552 }
else if (name.equals(
"permissions") &&
1554 saw_permissions =
true;
1556 if (value.contains(
'r'))
1561 if (value.contains(
'w'))
1566 if (value.contains(
'x'))
1580 }
else if (name.equals(
"name")) {
1584 region_info.
SetName(name.c_str());
1585 }
else if (name.equals(
"flags")) {
1588 llvm::StringRef flags = value;
1589 llvm::StringRef flag;
1590 while (flags.size()) {
1591 flags = flags.ltrim();
1592 std::tie(flag, flags) = flags.split(
' ');
1601 }
else if (name.equals(
"type")) {
1602 std::string comma_sep_str = value.str();
1604 while ((comma_pos = comma_sep_str.find(
',')) != std::string::npos) {
1605 comma_sep_str[comma_pos] =
'\0';
1606 if (comma_sep_str ==
"stack") {
1611 if (comma_sep_str ==
"stack") {
1614 }
else if (name.equals(
"error")) {
1616 std::string error_string;
1619 error.SetErrorString(error_string.c_str());
1620 }
else if (name.equals(
"dirty-pages")) {
1621 std::vector<addr_t> dirty_page_list;
1622 for (llvm::StringRef x : llvm::split(value,
',')) {
1624 x.consume_front(
"0x");
1625 if (llvm::to_integer(x, page, 16))
1626 dirty_page_list.push_back(page);
1638 if (!saw_permissions) {
1646 error.SetErrorString(
"Server returned invalid range");
1654 error.SetErrorString(
"qMemoryRegionInfo is not supported");
1666 region_info = qXfer_region_info;
1669 region_info.
Clear();
1671 }
else if (qXfer_error.
Success()) {
1686 if (!
error.Success())
1689 if (map_region.GetRange().Contains(addr)) {
1690 region = map_region;
1694 error.SetErrorString(
"Region not found");
1707 error.SetErrorString(
"XML is not supported");
1712 error.SetErrorString(
"Memory map is not supported");
1716 llvm::Expected<std::string> xml =
ReadExtFeature(
"memory-map",
"");
1718 return Status(xml.takeError());
1722 if (!xml_document.
ParseMemory(xml->c_str(), xml->size())) {
1723 error.SetErrorString(
"Failed to parse memory map xml");
1729 error.SetErrorString(
"Invalid root node in memory map xml");
1738 if (memory_node.
GetName() !=
"memory")
1749 region.GetRange().SetByteSize(length);
1750 if (type ==
"rom") {
1753 }
else if (type ==
"ram") {
1757 }
else if (type ==
"flash") {
1760 [®ion](
const XMLNode &prop_node) ->
bool {
1763 if (prop_node.
GetName() !=
"property")
1766 if (propname ==
"blocksize") {
1769 region.SetBlocksize(blocksize);
1788 std::optional<uint32_t> num;
1794 llvm::StringRef name;
1795 llvm::StringRef value;
1797 if (name.equals(
"num")) {
1827 return std::nullopt;
1832 std::string path{file_spec.
GetPath(
false)};
1852 std::string path{file_spec.
GetPath(
false)};
1872 std::string path{file_spec.
GetPath(
false)};
1901 return !cwd.empty();
1908 std::string path{working_dir.
GetPath(
false)};
1928 const int packet_len =
1929 ::snprintf(packet,
sizeof(packet),
"QSetDisableASLR:%i", enable ? 1 : 0);
1930 assert(packet_len < (
int)
sizeof(packet));
1945 const int packet_len = ::snprintf(packet,
sizeof(packet),
1946 "QSetDetachOnError:%i", enable ? 1 : 0);
1947 assert(packet_len < (
int)
sizeof(packet));
1963 llvm::StringRef name;
1964 llvm::StringRef value;
1970 std::string os_type;
1973 if (name.equals(
"pid")) {
1975 value.getAsInteger(0, pid);
1977 }
else if (name.equals(
"ppid")) {
1979 value.getAsInteger(0, pid);
1981 }
else if (name.equals(
"uid")) {
1983 value.getAsInteger(0, uid);
1985 }
else if (name.equals(
"euid")) {
1987 value.getAsInteger(0, uid);
1989 }
else if (name.equals(
"gid")) {
1991 value.getAsInteger(0, gid);
1993 }
else if (name.equals(
"egid")) {
1995 value.getAsInteger(0, gid);
1997 }
else if (name.equals(
"triple")) {
2002 }
else if (name.equals(
"name")) {
2009 }
else if (name.equals(
"args")) {
2010 llvm::StringRef encoded_args(value), hex_arg;
2012 bool is_arg0 =
true;
2013 while (!encoded_args.empty()) {
2014 std::tie(hex_arg, encoded_args) = encoded_args.split(
'-');
2029 }
else if (name.equals(
"cputype")) {
2030 value.getAsInteger(0, cpu);
2031 }
else if (name.equals(
"cpusubtype")) {
2032 value.getAsInteger(0, sub);
2033 }
else if (name.equals(
"vendor")) {
2034 vendor = std::string(value);
2035 }
else if (name.equals(
"ostype")) {
2036 os_type = std::string(value);
2041 if (vendor ==
"apple") {
2045 llvm::StringRef(vendor));
2047 llvm::StringRef(os_type));
2059 process_info.
Clear();
2063 const int packet_len =
2064 ::snprintf(packet,
sizeof(packet),
"qProcessInfoPID:%" PRIu64, pid);
2065 assert(packet_len < (
int)
sizeof(packet));
2095 llvm::StringRef name;
2096 llvm::StringRef value;
2099 std::string arch_name;
2100 std::string os_name;
2101 std::string environment;
2102 std::string vendor_name;
2104 std::string elf_abi;
2111 if (name.equals(
"cputype")) {
2112 if (!value.getAsInteger(16, cpu))
2114 }
else if (name.equals(
"cpusubtype")) {
2115 if (!value.getAsInteger(16, sub))
2117 }
else if (name.equals(
"triple")) {
2121 }
else if (name.equals(
"ostype")) {
2124 }
else if (name.equals(
"vendor")) {
2125 vendor_name = std::string(value);
2127 }
else if (name.equals(
"endian")) {
2128 byte_order = llvm::StringSwitch<lldb::ByteOrder>(value)
2135 }
else if (name.equals(
"ptrsize")) {
2136 if (!value.getAsInteger(16, pointer_byte_size))
2138 }
else if (name.equals(
"pid")) {
2139 if (!value.getAsInteger(16, pid))
2141 }
else if (name.equals(
"elf_abi")) {
2142 elf_abi = std::string(value);
2144 }
else if (name.equals(
"main-binary-uuid")) {
2147 }
else if (name.equals(
"main-binary-slide")) {
2155 }
else if (name.equals(
"main-binary-address")) {
2163 }
else if (name.equals(
"binary-addresses")) {
2166 for (llvm::StringRef x : llvm::split(value,
',')) {
2168 x.consume_front(
"0x");
2169 if (llvm::to_integer(x, vmaddr, 16))
2174 if (num_keys_decoded > 0)
2182 if (!triple.empty()) {
2185 if (pointer_byte_size) {
2189 !vendor_name.empty()) {
2190 llvm::Triple triple(llvm::Twine(
"-") + vendor_name +
"-" + os_name);
2191 if (!environment.empty())
2192 triple.setEnvironmentName(environment);
2194 assert(triple.getObjectFormat() != llvm::Triple::UnknownObjectFormat);
2195 assert(triple.getObjectFormat() != llvm::Triple::Wasm);
2196 assert(triple.getObjectFormat() != llvm::Triple::XCOFF);
2197 switch (triple.getObjectFormat()) {
2198 case llvm::Triple::MachO:
2201 case llvm::Triple::ELF:
2204 case llvm::Triple::COFF:
2207 case llvm::Triple::GOFF:
2208 case llvm::Triple::SPIRV:
2209 case llvm::Triple::Wasm:
2210 case llvm::Triple::XCOFF:
2211 case llvm::Triple::DXContainer:
2212 LLDB_LOGF(log,
"error: not supported target architecture");
2214 case llvm::Triple::UnknownObjectFormat:
2215 LLDB_LOGF(log,
"error: failed to determine target architecture");
2219 if (pointer_byte_size) {
2241 process_infos.clear();
2249 bool has_name_match =
false;
2250 if (name && name[0]) {
2251 has_name_match =
true;
2253 switch (name_match_type) {
2255 has_name_match =
false;
2267 packet.
PutCString(
"name_match:starts_with;");
2278 if (has_name_match) {
2286 packet.
Printf(
"pid:%" PRIu64
";",
2289 packet.
Printf(
"parent_pid:%" PRIu64
";",
2296 packet.
Printf(
"euid:%u;",
2299 packet.
Printf(
"egid:%u;",
2305 const llvm::Triple &triple = match_arch.
GetTriple();
2321 process_infos.push_back(process_info);
2330 return process_infos.size();
2334 std::string &name) {
2337 const int packet_len =
2338 ::snprintf(packet,
sizeof(packet),
"qUserName:%i", uid);
2339 assert(packet_len < (
int)
sizeof(packet));
2361 std::string &name) {
2364 const int packet_len =
2365 ::snprintf(packet,
sizeof(packet),
"qGroupName:%i", gid);
2366 assert(packet_len < (
int)
sizeof(packet));
2390 packet.
Printf(
"qSpeedTest:response_size:%i;data:", recv_size);
2392 while (bytes_left > 0) {
2393 if (bytes_left >= 26) {
2394 packet.
PutCString(
"abcdefghijklmnopqrstuvwxyz");
2397 packet.
Printf(
"%*.*s;", bytes_left, bytes_left,
2398 "abcdefghijklmnopqrstuvwxyz");
2407 return duration<float>::zero();
2408 using Dur = duration<float>;
2409 Dur sum = std::accumulate(std::begin(v), std::end(v), Dur());
2410 Dur mean = sum / v.size();
2413 float delta = (d - mean).count();
2414 accum += delta * delta;
2417 return Dur(sqrtf(accum / (v.size() - 1)));
2423 uint64_t recv_amount,
2424 bool json,
Stream &strm) {
2429 strm.
Printf(
"{ \"packet_speeds\" : {\n \"num_packets\" : %u,\n "
2433 strm.
Printf(
"Testing sending %u packets of various sizes:\n",
2439 std::vector<duration<float>> packet_times;
2441 for (send_size = 0; send_size <= max_send;
2442 send_size ? send_size *= 2 : send_size = 4) {
2443 for (
uint32_t recv_size = 0; recv_size <= max_recv;
2444 recv_size ? recv_size *= 2 : recv_size = 4) {
2447 packet_times.clear();
2449 const auto start_time = steady_clock::now();
2450 for (
uint32_t i = 0; i < num_packets; ++i) {
2451 const auto packet_start_time = steady_clock::now();
2454 const auto packet_end_time = steady_clock::now();
2455 packet_times.push_back(packet_end_time - packet_start_time);
2457 const auto end_time = steady_clock::now();
2458 const auto total_time = end_time - start_time;
2460 float packets_per_second =
2461 ((float)num_packets) / duration<float>(total_time).count();
2462 auto average_per_packet = num_packets > 0 ? total_time / num_packets
2463 : duration<float>::zero();
2464 const duration<float> standard_deviation =
2467 strm.
Format(
"{0}\n {{\"send_size\" : {1,6}, \"recv_size\" : "
2468 "{2,6}, \"total_time_nsec\" : {3,12:ns-}, "
2469 "\"standard_deviation_nsec\" : {4,9:ns-f0}}",
2470 result_idx > 0 ?
"," :
"", send_size, recv_size,
2471 total_time, standard_deviation);
2474 strm.
Format(
"qSpeedTest(send={0,7}, recv={1,7}) in {2:s+f9} for "
2475 "{3,9:f2} packets/s ({4,10:ms+f6} per packet) with "
2476 "standard deviation of {5,10:ms+f6}\n",
2477 send_size, recv_size, duration<float>(total_time),
2478 packets_per_second, duration<float>(average_per_packet),
2479 standard_deviation);
2485 const float k_recv_amount_mb = (float)recv_amount / (1024.0f * 1024.0f);
2487 strm.
Printf(
"\n ]\n },\n \"download_speed\" : {\n \"byte_size\" "
2488 ": %" PRIu64
",\n \"results\" : [",
2491 strm.
Printf(
"Testing receiving %2.1fMB of data using varying receive "
2497 for (
uint32_t recv_size = 32; recv_size <= max_recv; recv_size *= 2) {
2502 if (recv_size > 0) {
2503 const auto start_time = steady_clock::now();
2506 while (bytes_read < recv_amount) {
2509 bytes_read += recv_size;
2512 const auto end_time = steady_clock::now();
2513 const auto total_time = end_time - start_time;
2514 float mb_second = ((float)recv_amount) /
2515 duration<float>(total_time).count() /
2517 float packets_per_second =
2518 ((float)packet_count) / duration<float>(total_time).count();
2519 const auto average_per_packet = packet_count > 0
2520 ? total_time / packet_count
2521 : duration<float>::zero();
2524 strm.
Format(
"{0}\n {{\"send_size\" : {1,6}, \"recv_size\" : "
2525 "{2,6}, \"total_time_nsec\" : {3,12:ns-}}",
2526 result_idx > 0 ?
"," :
"", send_size, recv_size,
2530 strm.
Format(
"qSpeedTest(send={0,7}, recv={1,7}) {2,6} packets needed "
2531 "to receive {3:f1}MB in {4:s+f9} for {5} MB/sec for "
2532 "{6,9:f2} packets/sec ({7,10:ms+f6} per packet)\n",
2533 send_size, recv_size, packet_count, k_recv_amount_mb,
2534 duration<float>(total_time), mb_second,
2535 packets_per_second, duration<float>(average_per_packet));
2541 strm.
Printf(
"\n ]\n }\n}\n");
2550 packet.
Printf(
"qSpeedTest:response_size:%i;data:", recv_size);
2552 while (bytes_left > 0) {
2553 if (bytes_left >= 26) {
2554 packet.
PutCString(
"abcdefghijklmnopqrstuvwxyz");
2557 packet.
Printf(
"%*.*s;", bytes_left, bytes_left,
2558 "abcdefghijklmnopqrstuvwxyz");
2570 std::string &socket_name) {
2573 socket_name.clear();
2578 std::string hostname;
2579 if (remote_accept_hostname && remote_accept_hostname[0])
2580 hostname = remote_accept_hostname;
2582 if (HostInfo::GetHostname(hostname)) {
2584 stream.
Printf(
"host:%s;", hostname.c_str());
2588 stream.
Printf(
"host:*;");
2596 llvm::StringRef name;
2597 llvm::StringRef value;
2599 if (name.equals(
"port"))
2600 value.getAsInteger(0, port);
2601 else if (name.equals(
"pid"))
2602 value.getAsInteger(0, pid);
2603 else if (name.compare(
"socket_name") == 0) {
2614 std::vector<std::pair<uint16_t, std::string>> &connection_urls) {
2615 connection_urls.clear();
2631 for (
size_t i = 0, count = array->
GetSize(); i < count; ++i) {
2639 port = port_osp->GetIntegerValue(0);
2641 std::string socket_name;
2644 socket_name = std::string(socket_name_osp->GetStringValue());
2646 if (port != 0 || !socket_name.empty())
2647 connection_urls.emplace_back(port, socket_name);
2649 return connection_urls.size();
2654 stream.
Printf(
"qKillSpawnedProcess:%" PRId64, pid);
2666 uint64_t tid, uint64_t pid,
char op) {
2672 packet.
Printf(
"p%" PRIx64
".", pid);
2677 packet.
Printf(
"%" PRIx64, tid);
2683 return {{pid, tid}};
2695 return std::nullopt;
2710 return ret.has_value();
2725 return ret.has_value();
2740 ::snprintf(packet,
sizeof(packet),
"qThreadStopInfo%" PRIx64, tid);
2741 assert(packet_len < (
int)
sizeof(packet));
2760 std::chrono::seconds timeout) {
2762 LLDB_LOGF(log,
"GDBRemoteCommunicationClient::%s() %s at addr = 0x%" PRIx64,
2763 __FUNCTION__, insert ?
"add" :
"remove", addr);
2770 const int packet_len =
2771 ::snprintf(packet,
sizeof(packet),
"%c%i,%" PRIx64
",%x",
2772 insert ?
'Z' :
'z', type, addr, length);
2774 assert(packet_len + 1 < (
int)
sizeof(packet));
2819std::vector<std::pair<lldb::pid_t, lldb::tid_t>>
2821 bool &sequence_mutex_unavailable) {
2822 std::vector<std::pair<lldb::pid_t, lldb::tid_t>> ids;
2826 sequence_mutex_unavailable =
false;
2830 for (packet_result =
2848 ids.push_back(*pid_tid);
2850 }
while (ch ==
',');
2864 ids.emplace_back(1, 1);
2868 LLDB_LOG(log,
"error: failed to get packet sequence mutex, not sending "
2869 "packet 'qfThreadInfo'");
2870 sequence_mutex_unavailable =
true;
2877 std::vector<lldb::tid_t> &thread_ids,
bool &sequence_mutex_unavailable) {
2882 if (ids.empty() || sequence_mutex_unavailable)
2885 for (
auto id : ids) {
2891 thread_ids.push_back(
id.second);
2894 return thread_ids.size();
2907 llvm::StringRef command,
2923 timeout_sec = std::ceil(std::chrono::duration<double>(*timeout).count());
2927 std::string path{working_dir.
GetPath(
false)};
2934 if (response.
GetChar() !=
'F')
2935 return Status(
"malformed reply");
2936 if (response.
GetChar() !=
',')
2937 return Status(
"malformed reply");
2940 return Status(
"unable to run remote process");
2941 else if (status_ptr)
2942 *status_ptr = exitcode;
2943 if (response.
GetChar() !=
',')
2944 return Status(
"malformed reply");
2948 if (response.
GetChar() !=
',')
2949 return Status(
"malformed reply");
2953 command_output->assign(output);
2956 return Status(
"unable to send packet");
2961 std::string path{file_spec.
GetPath(
false)};
2967 llvm::StringRef packet = stream.
GetString();
2971 return Status(
"failed to send '%s' packet", packet.str().c_str());
2973 if (response.
GetChar() !=
'F')
2974 return Status(
"invalid response to '%s' packet", packet.str().c_str());
2982 std::string path{file_spec.
GetPath(
false)};
2988 llvm::StringRef packet = stream.
GetString();
2992 return Status(
"failed to send '%s' packet", stream.
GetData());
2994 if (response.
GetChar() !=
'F')
2995 return Status(
"invalid response to '%s' packet", stream.
GetData());
3002#define HANDLE_ERRNO(name, value) \
3005#include "Plugins/Process/gdb-remote/GDBRemoteErrno.def"
3014 if (response.
GetChar() !=
'F')
3016 int32_t result = response.
GetS32(-2, 16);
3019 if (response.
GetChar() ==
',') {
3021 if (result_errno != -1)
3033 std::string path(file_spec.
GetPath(
false));
3054 stream.
Printf(
"vFile:close:%x", (
int)fd);
3063std::optional<GDBRemoteFStatData>
3066 stream.
Printf(
"vFile:fstat:%" PRIx64, fd);
3070 if (response.
GetChar() !=
'F')
3071 return std::nullopt;
3072 int64_t size = response.
GetS64(-1, 16);
3073 if (size > 0 && response.
GetChar() ==
';') {
3077 if (buffer.size() !=
sizeof(out))
3078 return std::nullopt;
3079 memcpy(&out, buffer.data(),
sizeof(out));
3084 return std::nullopt;
3087std::optional<GDBRemoteFStatData>
3092 return std::nullopt;
3093 std::optional<GDBRemoteFStatData> st =
FStat(fd);
3102 std::string path(file_spec.
GetPath(
false));
3112 if (response.
GetChar() !=
'F')
3121 std::optional<GDBRemoteFStatData> st =
Stat(file_spec);
3139 while (response.
Peek()) {
3141 while ((ch = response.
GetHexU8(0,
false)) !=
'\0')
3144 if (response.
GetChar() !=
',')
3154 std::string path{file_spec.
GetPath(
false)};
3162 error.SetErrorStringWithFormat(
"failed to send '%s' packet",
3167 if (response.
GetChar() !=
'F') {
3168 error.SetErrorStringWithFormat(
"invalid response to '%s' packet",
3172 if (
static_cast<int32_t
>(mode) == -1) {
3173 if (response.
GetChar() ==
',') {
3175 if (response_errno > 0)
3178 error.SetErrorToGenericError();
3180 error.SetErrorToGenericError();
3192 if (std::optional<GDBRemoteFStatData> st =
Stat(file_spec)) {
3196 return Status(
"fstat failed");
3200 uint64_t offset,
void *dst,
3204 stream.
Printf(
"vFile:pread:%x,%" PRIx64
",%" PRIx64, (
int)fd, dst_len,
3209 if (response.
GetChar() !=
'F')
3211 int64_t retcode = response.
GetS64(-1, 16);
3212 if (retcode == -1) {
3213 error.SetErrorToGenericError();
3214 if (response.
GetChar() ==
',') {
3216 if (response_errno > 0)
3221 const char next = (response.
Peek() ? *response.
Peek() : 0);
3228 const uint64_t data_to_write =
3229 std::min<uint64_t>(dst_len, buffer.size());
3230 if (data_to_write > 0)
3231 memcpy(dst, &buffer[0], data_to_write);
3232 return data_to_write;
3245 stream.
Printf(
"vFile:pwrite:%x,%" PRIx64
",", (
int)fd, offset);
3250 if (response.
GetChar() !=
'F') {
3251 error.SetErrorStringWithFormat(
"write file failed");
3254 int64_t bytes_written = response.
GetS64(-1, 16);
3255 if (bytes_written == -1) {
3256 error.SetErrorToGenericError();
3257 if (response.
GetChar() ==
',') {
3259 if (response_errno > 0)
3264 return bytes_written;
3266 error.SetErrorString(
"failed to send vFile:pwrite packet");
3273 std::string src_path{src.
GetPath(
false)}, dst_path{dst.
GetPath(
false)};
3285 if (response.
GetChar() ==
'F') {
3288 error.SetErrorToGenericError();
3289 if (response.
GetChar() ==
',') {
3291 if (response_errno > 0)
3297 error.SetErrorStringWithFormat(
"symlink failed");
3300 error.SetErrorString(
"failed to send vFile:symlink packet");
3306 std::string path{file_spec.
GetPath(
false)};
3316 if (response.
GetChar() ==
'F') {
3319 error.SetErrorToGenericError();
3320 if (response.
GetChar() ==
',') {
3322 if (response_errno > 0)
3328 error.SetErrorStringWithFormat(
"unlink failed");
3331 error.SetErrorString(
"failed to send vFile:unlink packet");
3340 std::string path(file_spec.
GetPath(
false));
3349 if (response.
GetChar() !=
'F')
3351 if (response.
GetChar() !=
',')
3353 bool retcode = (response.
GetChar() !=
'0');
3370 std::string path(file_spec.
GetPath(
false));
3377 if (response.
GetChar() !=
'F')
3379 if (response.
GetChar() !=
',')
3381 if (response.
Peek() && *response.
Peek() ==
'x')
3397 arch.
GetTriple().getVendor() == llvm::Triple::Apple &&
3398 arch.
GetTriple().getOS() == llvm::Triple::IOS &&
3399 (arch.
GetTriple().getArch() == llvm::Triple::aarch64 ||
3400 arch.
GetTriple().getArch() == llvm::Triple::aarch64_32)) {
3403 if (gdb_server_version != 0) {
3405 if (gdb_server_name && strcmp(gdb_server_name,
"debugserver") == 0) {
3406 if (gdb_server_version >= 310)
3419 payload.
Printf(
"p%x", reg);
3426 WritableDataBufferSP buffer_sp(
3428 response.
GetHexBytes(buffer_sp->GetData(),
'\xcc');
3441 WritableDataBufferSP buffer_sp(
3443 response.
GetHexBytes(buffer_sp->GetData(),
'\xcc');
3449 llvm::ArrayRef<uint8_t> data) {
3451 payload.
Printf(
"P%x=", reg_num);
3492 if (response_save_id == 0)
3495 save_id = response_save_id;
3508 payload.
Printf(
"QRestoreRegisterState:%u", save_id);
3528 packet.
Printf(
"QSyncThreadState:%4.4" PRIx64
";", tid);
3534llvm::Expected<TraceSupportedResponse>
3539 escaped_packet.
PutCString(
"jLLDBTraceSupported");
3548 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3549 "jLLDBTraceSupported is unsupported");
3551 return llvm::json::parse<TraceSupportedResponse>(response.
Peek(),
3552 "TraceSupportedResponse");
3554 LLDB_LOG(log,
"failed to send packet: jLLDBTraceSupported");
3555 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3556 "failed to send packet: jLLDBTraceSupported");
3561 std::chrono::seconds timeout) {
3565 escaped_packet.
PutCString(
"jLLDBTraceStop:");
3567 std::string json_string;
3568 llvm::raw_string_ostream os(json_string);
3572 escaped_packet.
PutEscapedBytes(json_string.c_str(), json_string.size());
3581 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3582 "jLLDBTraceStop is unsupported");
3584 return llvm::Error::success();
3585 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3586 "Invalid jLLDBTraceStart response");
3588 LLDB_LOG(log,
"failed to send packet: jLLDBTraceStop");
3589 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3590 "failed to send packet: jLLDBTraceStop '%s'",
3596 std::chrono::seconds timeout) {
3600 escaped_packet.
PutCString(
"jLLDBTraceStart:");
3602 std::string json_string;
3603 llvm::raw_string_ostream os(json_string);
3607 escaped_packet.
PutEscapedBytes(json_string.c_str(), json_string.size());
3616 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3617 "jLLDBTraceStart is unsupported");
3619 return llvm::Error::success();
3620 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3621 "Invalid jLLDBTraceStart response");
3623 LLDB_LOG(log,
"failed to send packet: jLLDBTraceStart");
3624 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3625 "failed to send packet: jLLDBTraceStart '%s'",
3629llvm::Expected<std::string>
3631 std::chrono::seconds timeout) {
3635 escaped_packet.
PutCString(
"jLLDBTraceGetState:");
3637 std::string json_string;
3638 llvm::raw_string_ostream os(json_string);
3642 escaped_packet.
PutEscapedBytes(json_string.c_str(), json_string.size());
3651 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3652 "jLLDBTraceGetState is unsupported");
3653 return std::string(response.
Peek());
3656 LLDB_LOG(log,
"failed to send packet: jLLDBTraceGetState");
3657 return llvm::createStringError(
3658 llvm::inconvertibleErrorCode(),
3659 "failed to send packet: jLLDBTraceGetState '%s'",
3663llvm::Expected<std::vector<uint8_t>>
3669 escaped_packet.
PutCString(
"jLLDBTraceGetBinaryData:");
3671 std::string json_string;
3672 llvm::raw_string_ostream os(json_string);
3676 escaped_packet.
PutEscapedBytes(json_string.c_str(), json_string.size());
3686 return std::vector<uint8_t>(data.begin(), data.end());
3688 LLDB_LOG(log,
"failed to send packet: jLLDBTraceGetBinaryData");
3689 return llvm::createStringError(
3690 llvm::inconvertibleErrorCode(),
3691 "failed to send packet: jLLDBTraceGetBinaryData '%s'",
3699 return std::nullopt;
3701 return std::nullopt;
3705 const auto &GetOffset = [&] {
3707 if (ref.consumeInteger(16, offset))
3709 result.
offsets.push_back(offset);
3713 if (ref.consume_front(
"Text=")) {
3716 return std::nullopt;
3717 if (!ref.consume_front(
";Data=") || !GetOffset())
3718 return std::nullopt;
3721 if (ref.consume_front(
";Bss=") && GetOffset() && ref.empty())
3723 }
else if (ref.consume_front(
"TextSeg=")) {
3726 return std::nullopt;
3729 if (ref.consume_front(
";DataSeg=") && GetOffset() && ref.empty())
3732 return std::nullopt;
3741 std::string module_path = module_file_spec.
GetPath(
false);
3742 if (module_path.empty())
3749 const auto &triple = arch_spec.
GetTriple().getTriple();
3765 llvm::StringRef name;
3766 llvm::StringRef value;
3768 module_spec.
Clear();
3772 if (name ==
"uuid" || name ==
"md5") {
3777 }
else if (name ==
"triple") {
3782 }
else if (name ==
"file_offset") {
3784 if (!value.getAsInteger(16, ival))
3786 }
else if (name ==
"file_size") {
3788 if (!value.getAsInteger(16, ival))
3790 }
else if (name ==
"file_path") {
3801static std::optional<ModuleSpec>
3805 return std::nullopt;
3807 llvm::StringRef string;
3811 return std::nullopt;
3813 return std::nullopt;
3816 return std::nullopt;
3820 return std::nullopt;
3824 return std::nullopt;
3828 return std::nullopt;
3834std::optional<std::vector<ModuleSpec>>
3836 llvm::ArrayRef<FileSpec> module_file_specs,
const llvm::Triple &triple) {
3840 return std::nullopt;
3842 json::Array module_array;
3843 for (
const FileSpec &module_file_spec : module_file_specs) {
3844 module_array.push_back(
3845 json::Object{{
"file", module_file_spec.GetPath(
false)},
3846 {
"triple", triple.getTriple()}});
3849 unescaped_payload.
PutCString(
"jModulesInfo:");
3850 unescaped_payload.
AsRawOstream() << std::move(module_array);
3863 return std::nullopt;
3867 return std::nullopt;
3872 if (!response_object_sp)
3873 return std::nullopt;
3876 if (!response_array)
3877 return std::nullopt;
3879 std::vector<ModuleSpec> result;
3880 for (
size_t i = 0; i < response_array->
GetSize(); ++i) {
3883 result.push_back(*module_spec);
3893llvm::Expected<std::string>
3895 llvm::StringRef annex) {
3898 llvm::raw_string_ostream output_stream(output);
3912 std::string packet =
3913 (
"qXfer:" +
object +
":read:" + annex +
":" +
3914 llvm::Twine::utohexstr(offset) +
"," + llvm::Twine::utohexstr(size))
3922 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3923 "Error sending $qXfer packet");
3941 return llvm::createStringError(
3942 llvm::inconvertibleErrorCode(),
3943 "Invalid continuation code from $qXfer packet");
3947 return output_stream.str();
3993 bool symbol_response_provided =
false;
3996 bool first_qsymbol_query =
true;
4007 if (symbol_response_provided || first_qsymbol_query) {
4014 first_qsymbol_query =
false;
4023 if (response_str.startswith(
"qSymbol:")) {
4025 std::string symbol_name;
4027 if (symbol_name.empty())
4035 const size_t num_scs = sc_list.
GetSize();
4036 for (
size_t sc_idx = 0;
4091 packet.
Printf(
"%" PRIx64, symbol_load_addr);
4092 symbol_response_provided =
true;
4094 symbol_response_provided =
false;
4110 "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex.",
4135 "GDBRemoteCommunicationClient::%s(): "
4136 "QSupportedAsyncJSONPackets returned invalid "
4143 "GDBRemoteCommunicationClient::%s(): "
4144 "QSupportedAsyncJSONPackets unsupported",
4152 "GDBRemoteCommunicationClient::%s(): supported async "
4154 __FUNCTION__, stream.
GetData());
4164 llvm::ArrayRef<int32_t> signals) {
4167 auto range = llvm::make_range(signals.begin(), signals.end());
4168 std::string packet = formatv(
"QPassSignals:{0:$[;]@(x-2)}", range).str();
4174 return Status(
"Sending QPassSignals packet failed");
4179 return Status(
"Unknown error happened during sending QPassSignals packet.");
4188 error.SetErrorString(
"invalid type_name argument");
4200 config_sp->Dump(unescaped_stream);
4201 unescaped_stream.
Flush();
4214 if (strcmp(response.
GetStringRef().data(),
"OK") == 0) {
4218 error.SetErrorStringWithFormat(
"configuring StructuredData feature "
4219 "%s failed with error %s",
4225 error.SetErrorStringWithFormat(
"configuring StructuredData feature %s "
4226 "failed when sending packet: "
4255 return llvm::createStringError(llvm::inconvertibleErrorCode(),
4256 "failed to send k packet");
4258 char packet_cmd = response.
GetChar(0);
4259 if (packet_cmd ==
'W' || packet_cmd ==
'X')
4262 return llvm::createStringError(llvm::inconvertibleErrorCode(),
4263 "unexpected response to k packet: %s",
static llvm::raw_ostream & error(Stream &strm)
duration< float > calculate_standard_deviation(const std::vector< duration< float > > &v)
static std::optional< ModuleSpec > ParseModuleSpec(StructuredData::Dictionary *dict)
static int gdb_errno_to_system(int err)
static void ParseOSType(llvm::StringRef value, std::string &os_name, std::string &environment)
static void MakeSpeedTestPacket(StreamString &packet, uint32_t send_size, uint32_t recv_size)
static uint64_t ParseHostIOPacketResponse(StringExtractorGDBRemote &response, uint64_t fail_result, Status &error)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
bool IsValid() const
Tests if this ArchSpec is valid.
void Clear()
Clears the object state.
llvm::Triple & GetTriple()
Architecture triple accessor.
void SetFlags(uint32_t flags)
void SetDistributionId(const char *distribution_id)
Set the distribution id of the architecture.
bool SetTriple(const llvm::Triple &triple)
Architecture triple setter.
bool SetArchitecture(ArchitectureType arch_type, uint32_t cpu, uint32_t sub, uint32_t os=0)
Change the architecture object type, CPU type and OS type.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
A command line argument class.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
void Clear()
Clear the arguments.
bool IsConnected() const
Check if the connection is valid.
virtual lldb::ConnectionStatus Disconnect(Status *error_ptr=nullptr)
Disconnect the communications connection if one is currently connected.
"lldb/Utility/ArgCompletionRequest.h"
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
llvm::StringRef GetCursorArgumentPrefix() const
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
size_t GetLength() const
Get the length in bytes of string value.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
A subclass of DataBuffer that stores a data buffer on the heap.
static std::string compose(const value_type &KeyValue)
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 SetFlash(OptionalBool val)
void SetMapped(OptionalBool val)
void SetBlocksize(lldb::offset_t blocksize)
void SetMemoryTagged(OptionalBool val)
void SetReadable(OptionalBool val)
void SetExecutable(OptionalBool val)
void SetIsStackMemory(OptionalBool val)
void SetPageSize(int pagesize)
void SetName(const char *name)
void SetWritable(OptionalBool val)
lldb::offset_t GetBlocksize() const
void SetDirtyPageList(std::vector< lldb::addr_t > pagelist)
OptionalBool GetFlash() const
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
void SetObjectSize(uint64_t object_size)
ArchSpec & GetArchitecture()
void SetObjectOffset(uint64_t object_offset)
void SetGroupID(uint32_t gid)
bool ProcessIDIsValid() const
void SetArg0(llvm::StringRef arg)
const char * GetName() const
lldb::pid_t GetProcessID() const
void SetProcessID(lldb::pid_t pid)
FileSpec & GetExecutableFile()
bool UserIDIsValid() const
uint32_t GetUserID() const
uint32_t GetGroupID() const
void SetUserID(uint32_t uid)
bool GroupIDIsValid() const
ArchSpec & GetArchitecture()
bool MatchAllProcesses() const
NameMatch GetNameMatchType() const
bool GetMatchAllUsers() const
ProcessInstanceInfo & GetProcessInfo()
uint32_t GetEffectiveUserID() const
void SetEffectiveGroupID(uint32_t gid)
lldb::pid_t GetParentProcessID() const
bool ParentProcessIDIsValid() const
uint32_t GetEffectiveGroupID() const
bool EffectiveUserIDIsValid() const
bool EffectiveGroupIDIsValid() const
void SetParentProcessID(lldb::pid_t pid)
void SetEffectiveUserID(uint32_t uid)
A plug-in interface definition class for debugging a process.
Target & GetTarget()
Get the target object pointer for this module.
llvm::Error ToError() const
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
bool Success() const
Test for success condition.
int PutEscapedBytes(const void *s, size_t src_len)
Output a block of data to the stream performing GDB-remote escaping.
const char * GetData() const
void Flush() override
Flush the stream.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t PutStringAsRawHex8(llvm::StringRef s)
size_t PutHex64(uint64_t uvalue, lldb::ByteOrder byte_order=lldb::eByteOrderInvalid)
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t PutHex32(uint32_t uvalue, lldb::ByteOrder byte_order=lldb::eByteOrderInvalid)
virtual void Flush()=0
Flush the stream.
size_t EOL()
Output and End of Line character to the stream.
size_t PutBytesAsRawHex8(const void *src, size_t src_len, lldb::ByteOrder src_byte_order=lldb::eByteOrderInvalid, lldb::ByteOrder dst_byte_order=lldb::eByteOrderInvalid)
ObjectSP GetItemAtIndex(size_t idx) const
bool GetItemAtIndexAsDictionary(size_t idx, Dictionary *&result) const
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const
bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result) const
ObjectSP GetValueForKey(llvm::StringRef key) const
std::shared_ptr< Object > ObjectSP
static ObjectSP ParseJSON(const std::string &json_text)
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
uint32_t GetSize() const
Get accessor for a symbol context list size.
Defines a symbol context baton that can be handed other debug core functions.
Symbol * symbol
The Symbol for a given query.
lldb::addr_t GetLoadAddress(Target *target) const
lldb::SymbolType GetType() const
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
bool SetFromStringRef(llvm::StringRef str)
XMLNode GetRootElement(const char *required_name=nullptr)
bool ParseMemory(const char *xml, size_t xml_length, const char *url="untitled.xml")
void ForEachChildElement(NodeCallback const &callback) const
llvm::StringRef GetName() const
std::string GetAttributeValue(con