Lines Matching defs:packet

228                         [this](StringExtractorGDBRemote packet, Status &error,
231 return this->Handle_k(packet);
803 LLDB_LOG(log, "preparing packet for pid {0} tid {1}", process.GetID(),
819 // Output the T packet with the thread
858 // reply packet, so it must be enabled only on systems where there are no
859 // limits on packet lengths.
876 // thread otherwise this packet has all the info it needs.
1169 "GDBRemoteCommunicationServerLLGS::%s processing a packet "
1287 StringExtractorGDBRemote &packet) {
1299 StringExtractorGDBRemote &packet) {
1305 packet.ConsumeFront("jLLDBTraceStop:");
1307 json::parse<TraceStopRequest>(packet.Peek(), "TraceStopRequest");
1319 StringExtractorGDBRemote &packet) {
1326 packet.ConsumeFront("jLLDBTraceStart:");
1328 json::parse<TraceStartRequest>(packet.Peek(), "TraceStartRequest");
1332 if (Error err = m_current_process->TraceStart(packet.Peek(), request->type))
1340 StringExtractorGDBRemote &packet) {
1347 packet.ConsumeFront("jLLDBTraceGetState:");
1349 json::parse<TraceGetStateRequest>(packet.Peek(), "TraceGetStateRequest");
1358 StringExtractorGDBRemote &packet) {
1365 packet.ConsumeFront("jLLDBTraceGetBinaryData:");
1367 llvm::json::parse<TraceGetBinaryDataRequest>(packet.Peek(),
1383 StringExtractorGDBRemote &packet) {
1404 GDBRemoteCommunicationServerLLGS::Handle_qC(StringExtractorGDBRemote &packet) {
1428 GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote &packet) {
1448 // The response to kill packet is undefined per the spec. LLDB
1457 StringExtractorGDBRemote &packet) {
1461 packet.SetFilePos(6); // vKill;
1462 uint32_t pid = packet.GetU32(LLDB_INVALID_PROCESS_ID, 16);
1464 return SendIllFormedResponse(packet,
1482 StringExtractorGDBRemote &packet) {
1483 packet.SetFilePos(::strlen("QSetDisableASLR:"));
1484 if (packet.GetU32(0))
1493 StringExtractorGDBRemote &packet) {
1494 packet.SetFilePos(::strlen("QSetWorkingDir:"));
1496 packet.GetHexByteString(path);
1503 StringExtractorGDBRemote &packet) {
1516 StringExtractorGDBRemote &packet) {
1523 StringExtractorGDBRemote &packet) {
1553 GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) {
1567 packet.SetFilePos(::strlen("C"));
1568 if (packet.GetBytesLeft() < 1) {
1570 return SendIllFormedResponse(packet, "C packet specified without signal.");
1573 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
1575 return SendIllFormedResponse(packet, "failed to parse signal number");
1578 if (packet.GetBytesLeft() > 0) {
1580 if (*packet.Peek() == ';')
1581 return SendUnimplementedResponse(packet.GetStringRef().data());
1584 packet, "unexpected content after $C{signal-number}");
1634 // Don't send an "OK" packet, except in non-stop mode;
1640 GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) {
1644 packet.SetFilePos(packet.GetFilePos() + ::strlen("c"));
1647 const bool has_continue_address = (packet.GetBytesLeft() > 0);
1650 packet.Peek());
1651 return SendUnimplementedResponse(packet.GetStringRef().data());
1676 StringExtractorGDBRemote &packet) {
1697 StringExtractorGDBRemote &packet) {
1699 LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s handling vCont packet",
1702 packet.SetFilePos(::strlen("vCont"));
1704 if (packet.GetBytesLeft() == 0) {
1709 return SendIllFormedResponse(packet, "Missing action from vCont package");
1712 if (::strcmp(packet.Peek(), ";s") == 0) {
1714 packet.SetFilePos(packet.GetFilePos() + 1);
1715 return Handle_s(packet);
1720 while (packet.GetBytesLeft() && *packet.Peek() == ';') {
1722 packet.GetChar();
1730 const char action = packet.GetChar();
1733 thread_action.signal = packet.GetHexMaxU32(false, 0);
1736 packet, "Could not parse signal in vCont packet C action");
1745 thread_action.signal = packet.GetHexMaxU32(false, 0);
1748 packet, "Could not parse signal in vCont packet S action");
1762 return SendIllFormedResponse(packet, "Unsupported vCont action");
1771 if (packet.GetBytesLeft() && (*packet.Peek() == ':')) {
1773 packet.GetChar();
1775 auto pid_tid = packet.GetPidTid(LLDB_INVALID_PROCESS_ID);
1777 return SendIllFormedResponse(packet, "Malformed thread-id");
1786 packet, "'t' action not supported for individual threads");
1806 packet, "vCont: p-1 is not valid with a specific tid");
1816 packet,
1887 StringExtractorGDBRemote &packet) {
1984 StringExtractorGDBRemote &packet) {
1999 packet.SetFilePos(strlen("qRegisterInfo"));
2001 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
2092 StringExtractorGDBRemote &packet) {
2110 StringExtractorGDBRemote &packet) {
2111 // FIXME for now we return the full thread list in the initial packet and
2117 GDBRemoteCommunicationServerLLGS::Handle_g(StringExtractorGDBRemote &packet) {
2120 // Move past packet name.
2121 packet.SetFilePos(strlen("g"));
2124 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
2172 GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) {
2176 packet.SetFilePos(strlen("p"));
2178 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
2183 __FUNCTION__, packet.GetStringRef().data());
2188 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
2248 GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
2252 if (packet.GetBytesLeft() < 1)
2253 return SendIllFormedResponse(packet, "Empty P packet");
2256 packet.SetFilePos(strlen("P"));
2258 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
2263 __FUNCTION__, packet.GetStringRef().data());
2268 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != '='))
2270 packet, "P packet missing '=' char after register number");
2273 size_t reg_size = packet.GetHexBytesAvail(m_reg_bytes);
2276 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
2307 return SendIllFormedResponse(packet, "P packet register size is incorrect");
2327 GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) {
2331 packet.SetFilePos(strlen("H"));
2332 if (packet.GetBytesLeft() < 1) {
2337 return SendIllFormedResponse(packet, "H command missing {g,c} variant");
2340 const char h_variant = packet.GetChar();
2356 return SendIllFormedResponse(packet,
2361 auto pid_tid = packet.GetPidTid(default_process ? default_process->GetID()
2411 return SendIllFormedResponse(packet,
2419 GDBRemoteCommunicationServerLLGS::Handle_I(StringExtractorGDBRemote &packet) {
2432 packet.SetFilePos(::strlen("I"));
2435 size_t read = packet.GetHexBytesAvail(tmp);
2455 StringExtractorGDBRemote &packet) {
2481 StringExtractorGDBRemote &packet) {
2494 packet.SetFilePos(strlen("m"));
2495 if (packet.GetBytesLeft() < 1)
2496 return SendIllFormedResponse(packet, "Too short m packet");
2501 const lldb::addr_t read_addr = packet.GetHexMaxU64(false, 0);
2504 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != ','))
2505 return SendIllFormedResponse(packet, "Comma sep missing in m packet");
2508 if (packet.GetBytesLeft() < 1)
2509 return SendIllFormedResponse(packet, "Length missing in m packet");
2511 const uint64_t byte_count = packet.GetHexMaxU64(false, 0);
2515 "zero-length packet",
2537 packet.SetFilePos(0);
2538 char kind = packet.GetChar('?');
2551 GDBRemoteCommunicationServerLLGS::Handle__M(StringExtractorGDBRemote &packet) {
2564 packet.SetFilePos(strlen("_M"));
2565 if (packet.GetBytesLeft() < 1)
2566 return SendIllFormedResponse(packet, "Too short _M packet");
2568 const lldb::addr_t size = packet.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
2570 return SendIllFormedResponse(packet, "Address not valid");
2571 if (packet.GetChar() != ',')
2572 return SendIllFormedResponse(packet, "Bad packet");
2574 while (packet.GetBytesLeft() > 0) {
2575 switch (packet.GetChar()) {
2586 return SendIllFormedResponse(packet, "Bad permissions");
2600 GDBRemoteCommunicationServerLLGS::Handle__m(StringExtractorGDBRemote &packet) {
2613 packet.SetFilePos(strlen("_m"));
2614 if (packet.GetBytesLeft() < 1)
2615 return SendIllFormedResponse(packet, "Too short m packet");
2617 const lldb::addr_t addr = packet.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
2619 return SendIllFormedResponse(packet, "Address not valid");
2628 GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) {
2641 packet.SetFilePos(strlen("M"));
2642 if (packet.GetBytesLeft() < 1)
2643 return SendIllFormedResponse(packet, "Too short M packet");
2648 const lldb::addr_t write_addr = packet.GetHexMaxU64(false, 0);
2651 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != ','))
2652 return SendIllFormedResponse(packet, "Comma sep missing in M packet");
2655 if (packet.GetBytesLeft() < 1)
2656 return SendIllFormedResponse(packet, "Length missing in M packet");
2658 const uint64_t byte_count = packet.GetHexMaxU64(false, 0);
2660 LLDB_LOG(log, "nothing to write: zero-length packet");
2665 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != ':'))
2667 packet, "Comma sep missing in M packet after byte length");
2676 const uint64_t convert_count = packet.GetHexBytes(buf, 0);
2682 return SendIllFormedResponse(packet, "M content byte length specified did "
2708 StringExtractorGDBRemote &packet) {
2741 StringExtractorGDBRemote &packet) {
2755 packet.SetFilePos(strlen("qMemoryRegionInfo:"));
2756 if (packet.GetBytesLeft() < 1)
2757 return SendIllFormedResponse(packet, "Too short qMemoryRegionInfo: packet");
2760 const lldb::addr_t read_addr = packet.GetHexMaxU64(false, 0);
2827 GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) {
2837 packet.SetFilePos(strlen("Z"));
2838 if (packet.GetBytesLeft() < 1)
2840 packet, "Too short Z packet, missing software/hardware specifier");
2847 GDBStoppointType(packet.GetS32(eStoppointInvalid));
2874 packet, "Z packet had invalid software/hardware specifier");
2877 if ((packet.GetBytesLeft() < 1) || packet.GetChar() != ',')
2879 packet, "Malformed Z packet, expecting comma after stoppoint type");
2882 if (packet.GetBytesLeft() < 1)
2883 return SendIllFormedResponse(packet, "Too short Z packet, missing address");
2884 const lldb::addr_t addr = packet.GetHexMaxU64(false, 0);
2886 if ((packet.GetBytesLeft() < 1) || packet.GetChar() != ',')
2888 packet, "Malformed Z packet, expecting comma after address");
2892 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
2895 packet, "Malformed Z packet, failed to parse size argument");
2921 GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) {
2931 packet.SetFilePos(strlen("z"));
2932 if (packet.GetBytesLeft() < 1)
2934 packet, "Too short z packet, missing software/hardware specifier");
2940 GDBStoppointType(packet.GetS32(eStoppointInvalid));
2960 packet, "z packet had invalid software/hardware specifier");
2963 if ((packet.GetBytesLeft() < 1) || packet.GetChar() != ',')
2965 packet, "Malformed z packet, expecting comma after stoppoint type");
2968 if (packet.GetBytesLeft() < 1)
2969 return SendIllFormedResponse(packet, "Too short z packet, missing address");
2970 const lldb::addr_t addr = packet.GetHexMaxU64(false, 0);
2972 if ((packet.GetBytesLeft() < 1) || packet.GetChar() != ',')
2974 packet, "Malformed z packet, expecting comma after address");
2978 const uint32_t size = packet.GetHexMaxU32 (false,
2981 return SendIllFormedResponse(packet, "Malformed z packet, failed to parse
3008 GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) {
3227 StringExtractorGDBRemote &packet) {
3229 // The packet format is "qXfer:<object>:<action>:<annex>:offset,length"
3230 StringRef(packet.GetStringRef()).split(fields, ':', 4);
3232 return SendIllFormedResponse(packet, "malformed qXfer packet");
3243 return SendIllFormedResponse(packet, "qXfer packet missing offset");
3246 return SendIllFormedResponse(packet,
3247 "qXfer packet missing comma after offset");
3252 return SendIllFormedResponse(packet, "qXfer packet missing length");
3300 StringExtractorGDBRemote &packet) {
3303 // Move past packet name.
3304 packet.SetFilePos(strlen("QSaveRegisterState"));
3307 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
3311 packet, "No thread specified in QSaveRegisterState packet");
3313 return SendIllFormedResponse(packet,
3314 "No thread was is set with the Hg packet");
3348 StringExtractorGDBRemote &packet) {
3352 packet.SetFilePos(strlen("QRestoreRegisterState:"));
3353 if (packet.GetBytesLeft() < 1)
3355 packet, "QRestoreRegisterState packet missing register save id");
3357 const uint32_t save_id = packet.GetU32(0);
3359 LLDB_LOG(log, "QRestoreRegisterState packet has malformed save id, "
3365 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
3369 packet, "No thread specified in QRestoreRegisterState packet");
3371 return SendIllFormedResponse(packet,
3372 "No thread was is set with the Hg packet");
3409 StringExtractorGDBRemote &packet) {
3413 packet.SetFilePos(strlen("vAttach"));
3414 if (!packet.GetBytesLeft() || packet.GetChar() != ';')
3415 return SendIllFormedResponse(packet, "vAttach missing expected ';'");
3418 lldb::pid_t pid = packet.GetU32(LLDB_INVALID_PROCESS_ID, 16);
3420 return SendIllFormedResponse(packet,
3439 // Notify we attached by sending a stop packet.
3448 StringExtractorGDBRemote &packet) {
3452 packet.SetFilePos(strlen("vAttachWait"));
3454 if (!packet.GetBytesLeft() || packet.GetChar() != ';')
3455 return SendIllFormedResponse(packet, "vAttachWait missing expected ';'");
3459 if (!packet.GetHexByteString(process_name))
3460 return SendIllFormedResponse(packet,
3472 // Notify we attached by sending a stop packet.
3481 StringExtractorGDBRemote &packet) {
3487 StringExtractorGDBRemote &packet) {
3491 packet.SetFilePos(strlen("vAttachOrWait"));
3493 if (!packet.GetBytesLeft() || packet.GetChar() != ';')
3494 return SendIllFormedResponse(packet, "vAttachOrWait missing expected ';'");
3498 if (!packet.GetHexByteString(process_name))
3499 return SendIllFormedResponse(packet,
3511 // Notify we attached by sending a stop packet.
3520 StringExtractorGDBRemote &packet) {
3523 llvm::StringRef s = packet.GetStringRef();
3553 GDBRemoteCommunicationServerLLGS::Handle_D(StringExtractorGDBRemote &packet) {
3561 packet.SetFilePos(1);
3562 if (packet.GetBytesLeft()) {
3563 if (packet.GetChar() != ';')
3564 return SendIllFormedResponse(packet, "D missing expected ';'");
3567 pid = packet.GetU32(LLDB_INVALID_PROCESS_ID, 16);
3569 return SendIllFormedResponse(packet, "D failed to parse the process id");
3573 // (i.e. detach-all packet).
3607 StringExtractorGDBRemote &packet) {
3614 packet.SetFilePos(strlen("qThreadStopInfo"));
3615 const lldb::tid_t tid = packet.GetHexMaxU64(false, LLDB_INVALID_THREAD_ID);
3620 __FUNCTION__, packet.GetStringRef().data());
3636 LLDB_LOG(log, "preparing packet for pid {0}", m_current_process->GetID());
3644 "failed to prepare a packet for pid {1}: {0}",
3657 StringExtractorGDBRemote &packet) {
3663 packet.SetFilePos(strlen("qWatchpointSupportInfo"));
3664 if (packet.GetBytesLeft() == 0)
3666 if (packet.GetChar() != ':')
3682 StringExtractorGDBRemote &packet) {
3688 packet.SetFilePos(strlen("qFileLoadAddress:"));
3689 if (packet.GetBytesLeft() == 0)
3693 packet.GetHexByteString(file_name);
3711 StringExtractorGDBRemote &packet) {
3713 packet.SetFilePos(strlen("QPassSignals:"));
3717 while (packet.GetBytesLeft() > 0) {
3718 int signal = packet.GetS32(-1, 16);
3720 return SendIllFormedResponse(packet, "Failed to parse signal number.");
3723 packet.SkipSpaces();
3724 char separator = packet.GetChar();
3728 return SendIllFormedResponse(packet, "Invalid separator,"
3745 StringExtractorGDBRemote &packet) {
3762 packet.SetFilePos(strlen("qMemTags:"));
3763 const char *current_char = packet.Peek();
3765 return SendIllFormedResponse(packet, "Missing address in qMemTags packet");
3766 const lldb::addr_t addr = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3769 char previous_char = packet.GetChar();
3770 current_char = packet.Peek();
3773 return SendIllFormedResponse(packet,
3774 "Invalid addr,length pair in qMemTags packet");
3776 if (packet.GetBytesLeft() < 1)
3778 packet, "Too short qMemtags: packet (looking for length)");
3779 const size_t length = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3782 const char *invalid_type_err = "Invalid type field in qMemTags: packet";
3783 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')
3784 return SendIllFormedResponse(packet, invalid_type_err);
3786 // Type is a signed integer but packed into the packet as its raw bytes.
3788 const char *first_type_char = packet.Peek();
3790 return SendIllFormedResponse(packet, invalid_type_err);
3796 packet.GetU64(std::numeric_limits<uint64_t>::max(), /*base=*/16);
3802 packet.GetBytesLeft()) {
3803 return SendIllFormedResponse(packet, invalid_type_err);
3826 StringExtractorGDBRemote &packet) {
3843 packet.SetFilePos(strlen("QMemTags:"));
3844 const char *current_char = packet.Peek();
3846 return SendIllFormedResponse(packet, "Missing address in QMemTags packet");
3847 const lldb::addr_t addr = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3850 char previous_char = packet.GetChar();
3851 current_char = packet.Peek();
3854 return SendIllFormedResponse(packet,
3855 "Invalid addr,length pair in QMemTags packet");
3857 if (packet.GetBytesLeft() < 1)
3859 packet, "Too short QMemtags: packet (looking for length)");
3860 const size_t length = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3863 const char *invalid_type_err = "Invalid type field in QMemTags: packet";
3864 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')
3865 return SendIllFormedResponse(packet, invalid_type_err);
3868 const char *first_type_char = packet.Peek();
3870 return SendIllFormedResponse(packet, invalid_type_err);
3872 // The type is a signed integer but is in the packet as its raw bytes.
3877 packet.GetU64(std::numeric_limits<uint64_t>::max(), /*base=*/16);
3879 return SendIllFormedResponse(packet, invalid_type_err);
3887 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')
3888 return SendIllFormedResponse(packet,
3889 "Missing tag data in QMemTags: packet");
3892 const char *invalid_data_err = "Invalid tag data in QMemTags: packet";
3893 if (packet.GetBytesLeft() % 2)
3894 return SendIllFormedResponse(packet, invalid_data_err);
3902 if (packet.GetBytesLeft()) {
3903 size_t byte_count = packet.GetBytesLeft() / 2;
3905 size_t converted_bytes = packet.GetHexBytes(tag_data, 0);
3907 return SendIllFormedResponse(packet, invalid_data_err);
3918 StringExtractorGDBRemote &packet) {
3926 StringRef packet_str{packet.GetStringRef()};
3950 StringExtractorGDBRemote &packet) {
3953 StringRef packet_str{packet.GetStringRef()};
3986 Status::FromErrorString("Invalid QNonStop packet"));
3996 // the last message in the queue is ACK-ed, in which case the packet sends
4009 StringExtractorGDBRemote &packet) {
4015 StringExtractorGDBRemote &packet) {
4028 StringExtractorGDBRemote &packet) {
4033 PacketResult interrupt_res = Handle_interrupt(packet);
4042 GDBRemoteCommunicationServerLLGS::Handle_T(StringExtractorGDBRemote &packet) {
4043 packet.SetFilePos(strlen("T"));
4044 auto pid_tid = packet.GetPidTid(m_current_process ? m_current_process->GetID()
4097 StringExtractorGDBRemote &packet) {
4119 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ';') {
4122 "error: expected ';' prior to start of thread suffix: packet "
4124 __FUNCTION__, packet.GetStringRef().data());
4128 if (!packet.GetBytesLeft())
4132 if (strncmp(packet.Peek(), "thread:", strlen("thread:")) != 0) {
4135 "error: expected 'thread:' but not found, packet contents = "
4137 __FUNCTION__, packet.GetStringRef().data());
4140 packet.SetFilePos(packet.GetFilePos() + strlen("thread:"));
4141 const lldb::tid_t tid = packet.GetHexMaxU64(false, 0);