Lines Matching full:packet
228 [this](StringExtractorGDBRemote packet, Status &error,
231 return this->Handle_k(packet);
801 LLDB_LOG(log, "preparing packet for pid {0} tid {1}", process.GetID(),
817 // Output the T packet with the thread
856 // reply packet, so it must be enabled only on systems where there are no
857 // limits on packet lengths.
874 // thread otherwise this packet has all the info it needs.
1167 "GDBRemoteCommunicationServerLLGS::%s processing a packet "
1284 StringExtractorGDBRemote &packet) {
1296 StringExtractorGDBRemote &packet) {
1302 packet.ConsumeFront("jLLDBTraceStop:");
1304 json::parse<TraceStopRequest>(packet.Peek(), "TraceStopRequest");
1316 StringExtractorGDBRemote &packet) {
1323 packet.ConsumeFront("jLLDBTraceStart:");
1325 json::parse<TraceStartRequest>(packet.Peek(), "TraceStartRequest");
1329 if (Error err = m_current_process->TraceStart(packet.Peek(), request->type))
1337 StringExtractorGDBRemote &packet) {
1344 packet.ConsumeFront("jLLDBTraceGetState:");
1346 json::parse<TraceGetStateRequest>(packet.Peek(), "TraceGetStateRequest");
1355 StringExtractorGDBRemote &packet) {
1362 packet.ConsumeFront("jLLDBTraceGetBinaryData:");
1364 llvm::json::parse<TraceGetBinaryDataRequest>(packet.Peek(),
1380 StringExtractorGDBRemote &packet) {
1401 GDBRemoteCommunicationServerLLGS::Handle_qC(StringExtractorGDBRemote &packet) {
1425 GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote &packet) {
1445 // The response to kill packet is undefined per the spec. LLDB
1454 StringExtractorGDBRemote &packet) {
1458 packet.SetFilePos(6); // vKill;
1459 uint32_t pid = packet.GetU32(LLDB_INVALID_PROCESS_ID, 16);
1461 return SendIllFormedResponse(packet,
1479 StringExtractorGDBRemote &packet) {
1480 packet.SetFilePos(::strlen("QSetDisableASLR:"));
1481 if (packet.GetU32(0))
1490 StringExtractorGDBRemote &packet) {
1491 packet.SetFilePos(::strlen("QSetWorkingDir:"));
1493 packet.GetHexByteString(path);
1500 StringExtractorGDBRemote &packet) {
1513 StringExtractorGDBRemote &packet) {
1520 StringExtractorGDBRemote &packet) {
1550 GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) {
1564 packet.SetFilePos(::strlen("C"));
1565 if (packet.GetBytesLeft() < 1) {
1567 return SendIllFormedResponse(packet, "C packet specified without signal.");
1570 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
1572 return SendIllFormedResponse(packet, "failed to parse signal number");
1575 if (packet.GetBytesLeft() > 0) {
1577 if (*packet.Peek() == ';')
1578 return SendUnimplementedResponse(packet.GetStringRef().data());
1581 packet, "unexpected content after $C{signal-number}");
1631 // Don't send an "OK" packet, except in non-stop mode;
1637 GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) {
1641 packet.SetFilePos(packet.GetFilePos() + ::strlen("c"));
1644 const bool has_continue_address = (packet.GetBytesLeft() > 0);
1647 packet.Peek());
1648 return SendUnimplementedResponse(packet.GetStringRef().data());
1673 StringExtractorGDBRemote &packet) {
1694 StringExtractorGDBRemote &packet) {
1696 LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s handling vCont packet",
1699 packet.SetFilePos(::strlen("vCont"));
1701 if (packet.GetBytesLeft() == 0) {
1706 return SendIllFormedResponse(packet, "Missing action from vCont package");
1709 if (::strcmp(packet.Peek(), ";s") == 0) {
1711 packet.SetFilePos(packet.GetFilePos() + 1);
1712 return Handle_s(packet);
1717 while (packet.GetBytesLeft() && *packet.Peek() == ';') {
1719 packet.GetChar();
1727 const char action = packet.GetChar();
1730 thread_action.signal = packet.GetHexMaxU32(false, 0);
1733 packet, "Could not parse signal in vCont packet C action");
1742 thread_action.signal = packet.GetHexMaxU32(false, 0);
1745 packet, "Could not parse signal in vCont packet S action");
1759 return SendIllFormedResponse(packet, "Unsupported vCont action");
1768 if (packet.GetBytesLeft() && (*packet.Peek() == ':')) {
1770 packet.GetChar();
1772 auto pid_tid = packet.GetPidTid(LLDB_INVALID_PROCESS_ID);
1774 return SendIllFormedResponse(packet, "Malformed thread-id");
1783 packet, "'t' action not supported for individual threads");
1803 packet, "vCont: p-1 is not valid with a specific tid");
1813 packet,
1884 StringExtractorGDBRemote &packet) {
1981 StringExtractorGDBRemote &packet) {
1996 packet.SetFilePos(strlen("qRegisterInfo"));
1998 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
2089 StringExtractorGDBRemote &packet) {
2107 StringExtractorGDBRemote &packet) {
2108 // FIXME for now we return the full thread list in the initial packet and
2114 GDBRemoteCommunicationServerLLGS::Handle_g(StringExtractorGDBRemote &packet) {
2117 // Move past packet name.
2118 packet.SetFilePos(strlen("g"));
2121 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
2169 GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) {
2173 packet.SetFilePos(strlen("p"));
2175 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
2180 __FUNCTION__, packet.GetStringRef().data());
2185 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
2245 GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
2249 if (packet.GetBytesLeft() < 1)
2250 return SendIllFormedResponse(packet, "Empty P packet");
2253 packet.SetFilePos(strlen("P"));
2255 packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
2260 __FUNCTION__, packet.GetStringRef().data());
2265 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != '='))
2267 packet, "P packet missing '=' char after register number");
2270 size_t reg_size = packet.GetHexBytesAvail(m_reg_bytes);
2273 NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
2304 return SendIllFormedResponse(packet, "P packet register size is incorrect");
2324 GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) {
2328 packet.SetFilePos(strlen("H"));
2329 if (packet.GetBytesLeft() < 1) {
2334 return SendIllFormedResponse(packet, "H command missing {g,c} variant");
2337 const char h_variant = packet.GetChar();
2353 return SendIllFormedResponse(packet,
2358 auto pid_tid = packet.GetPidTid(default_process ? default_process->GetID()
2408 return SendIllFormedResponse(packet,
2416 GDBRemoteCommunicationServerLLGS::Handle_I(StringExtractorGDBRemote &packet) {
2429 packet.SetFilePos(::strlen("I"));
2432 size_t read = packet.GetHexBytesAvail(tmp);
2452 StringExtractorGDBRemote &packet) {
2478 StringExtractorGDBRemote &packet) {
2491 packet.SetFilePos(strlen("m"));
2492 if (packet.GetBytesLeft() < 1)
2493 return SendIllFormedResponse(packet, "Too short m packet");
2498 const lldb::addr_t read_addr = packet.GetHexMaxU64(false, 0);
2501 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != ','))
2502 return SendIllFormedResponse(packet, "Comma sep missing in m packet");
2505 if (packet.GetBytesLeft() < 1)
2506 return SendIllFormedResponse(packet, "Length missing in m packet");
2508 const uint64_t byte_count = packet.GetHexMaxU64(false, 0);
2512 "zero-length packet",
2544 packet.SetFilePos(0);
2545 char kind = packet.GetChar('?');
2558 GDBRemoteCommunicationServerLLGS::Handle__M(StringExtractorGDBRemote &packet) {
2571 packet.SetFilePos(strlen("_M"));
2572 if (packet.GetBytesLeft() < 1)
2573 return SendIllFormedResponse(packet, "Too short _M packet");
2575 const lldb::addr_t size = packet.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
2577 return SendIllFormedResponse(packet, "Address not valid");
2578 if (packet.GetChar() != ',')
2579 return SendIllFormedResponse(packet, "Bad packet");
2581 while (packet.GetBytesLeft() > 0) {
2582 switch (packet.GetChar()) {
2593 return SendIllFormedResponse(packet, "Bad permissions");
2607 GDBRemoteCommunicationServerLLGS::Handle__m(StringExtractorGDBRemote &packet) {
2620 packet.SetFilePos(strlen("_m"));
2621 if (packet.GetBytesLeft() < 1)
2622 return SendIllFormedResponse(packet, "Too short m packet");
2624 const lldb::addr_t addr = packet.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
2626 return SendIllFormedResponse(packet, "Address not valid");
2635 GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) {
2648 packet.SetFilePos(strlen("M"));
2649 if (packet.GetBytesLeft() < 1)
2650 return SendIllFormedResponse(packet, "Too short M packet");
2655 const lldb::addr_t write_addr = packet.GetHexMaxU64(false, 0);
2658 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != ','))
2659 return SendIllFormedResponse(packet, "Comma sep missing in M packet");
2662 if (packet.GetBytesLeft() < 1)
2663 return SendIllFormedResponse(packet, "Length missing in M packet");
2665 const uint64_t byte_count = packet.GetHexMaxU64(false, 0);
2667 LLDB_LOG(log, "nothing to write: zero-length packet");
2672 if ((packet.GetBytesLeft() < 1) || (packet.GetChar() != ':'))
2674 packet, "Comma sep missing in M packet after byte length");
2683 const uint64_t convert_count = packet.GetHexBytes(buf, 0);
2689 return SendIllFormedResponse(packet, "M content byte length specified did "
2715 StringExtractorGDBRemote &packet) {
2748 StringExtractorGDBRemote &packet) {
2762 packet.SetFilePos(strlen("qMemoryRegionInfo:"));
2763 if (packet.GetBytesLeft() < 1)
2764 return SendIllFormedResponse(packet, "Too short qMemoryRegionInfo: packet");
2767 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).
3606 StringExtractorGDBRemote &packet) {
3613 packet.SetFilePos(strlen("qThreadStopInfo"));
3614 const lldb::tid_t tid = packet.GetHexMaxU64(false, LLDB_INVALID_THREAD_ID);
3619 __FUNCTION__, packet.GetStringRef().data());
3635 LLDB_LOG(log, "preparing packet for pid {0}", m_current_process->GetID());
3643 "failed to prepare a packet for pid {1}: {0}",
3656 StringExtractorGDBRemote &packet) {
3662 packet.SetFilePos(strlen("qWatchpointSupportInfo"));
3663 if (packet.GetBytesLeft() == 0)
3665 if (packet.GetChar() != ':')
3681 StringExtractorGDBRemote &packet) {
3687 packet.SetFilePos(strlen("qFileLoadAddress:"));
3688 if (packet.GetBytesLeft() == 0)
3692 packet.GetHexByteString(file_name);
3710 StringExtractorGDBRemote &packet) {
3712 packet.SetFilePos(strlen("QPassSignals:"));
3716 while (packet.GetBytesLeft() > 0) {
3717 int signal = packet.GetS32(-1, 16);
3719 return SendIllFormedResponse(packet, "Failed to parse signal number.");
3722 packet.SkipSpaces();
3723 char separator = packet.GetChar();
3727 return SendIllFormedResponse(packet, "Invalid separator,"
3744 StringExtractorGDBRemote &packet) {
3761 packet.SetFilePos(strlen("qMemTags:"));
3762 const char *current_char = packet.Peek();
3764 return SendIllFormedResponse(packet, "Missing address in qMemTags packet");
3765 const lldb::addr_t addr = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3768 char previous_char = packet.GetChar();
3769 current_char = packet.Peek();
3772 return SendIllFormedResponse(packet,
3773 "Invalid addr,length pair in qMemTags packet");
3775 if (packet.GetBytesLeft() < 1)
3777 packet, "Too short qMemtags: packet (looking for length)");
3778 const size_t length = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3781 const char *invalid_type_err = "Invalid type field in qMemTags: packet";
3782 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')
3783 return SendIllFormedResponse(packet, invalid_type_err);
3785 // Type is a signed integer but packed into the packet as its raw bytes.
3787 const char *first_type_char = packet.Peek();
3789 return SendIllFormedResponse(packet, invalid_type_err);
3795 packet.GetU64(std::numeric_limits<uint64_t>::max(), /*base=*/16);
3801 packet.GetBytesLeft()) {
3802 return SendIllFormedResponse(packet, invalid_type_err);
3825 StringExtractorGDBRemote &packet) {
3842 packet.SetFilePos(strlen("QMemTags:"));
3843 const char *current_char = packet.Peek();
3845 return SendIllFormedResponse(packet, "Missing address in QMemTags packet");
3846 const lldb::addr_t addr = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3849 char previous_char = packet.GetChar();
3850 current_char = packet.Peek();
3853 return SendIllFormedResponse(packet,
3854 "Invalid addr,length pair in QMemTags packet");
3856 if (packet.GetBytesLeft() < 1)
3858 packet, "Too short QMemtags: packet (looking for length)");
3859 const size_t length = packet.GetHexMaxU64(/*little_endian=*/false, 0);
3862 const char *invalid_type_err = "Invalid type field in QMemTags: packet";
3863 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')
3864 return SendIllFormedResponse(packet, invalid_type_err);
3867 const char *first_type_char = packet.Peek();
3869 return SendIllFormedResponse(packet, invalid_type_err);
3871 // The type is a signed integer but is in the packet as its raw bytes.
3876 packet.GetU64(std::numeric_limits<uint64_t>::max(), /*base=*/16);
3878 return SendIllFormedResponse(packet, invalid_type_err);
3886 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ':')
3887 return SendIllFormedResponse(packet,
3888 "Missing tag data in QMemTags: packet");
3891 const char *invalid_data_err = "Invalid tag data in QMemTags: packet";
3892 if (packet.GetBytesLeft() % 2)
3893 return SendIllFormedResponse(packet, invalid_data_err);
3901 if (packet.GetBytesLeft()) {
3902 size_t byte_count = packet.GetBytesLeft() / 2;
3904 size_t converted_bytes = packet.GetHexBytes(tag_data, 0);
3906 return SendIllFormedResponse(packet, invalid_data_err);
3917 StringExtractorGDBRemote &packet) {
3925 StringRef packet_str{packet.GetStringRef()};
3948 StringExtractorGDBRemote &packet) {
3951 StringRef packet_str{packet.GetStringRef()};
3983 return SendErrorResponse(Status("Invalid QNonStop packet"));
3993 // the last message in the queue is ACK-ed, in which case the packet sends
4005 StringExtractorGDBRemote &packet) {
4011 StringExtractorGDBRemote &packet) {
4024 StringExtractorGDBRemote &packet) {
4028 PacketResult interrupt_res = Handle_interrupt(packet);
4037 GDBRemoteCommunicationServerLLGS::Handle_T(StringExtractorGDBRemote &packet) {
4038 packet.SetFilePos(strlen("T"));
4039 auto pid_tid = packet.GetPidTid(m_current_process ? m_current_process->GetID()
4092 StringExtractorGDBRemote &packet) {
4114 if (packet.GetBytesLeft() < 1 || packet.GetChar() != ';') {
4117 "error: expected ';' prior to start of thread suffix: packet "
4119 __FUNCTION__, packet.GetStringRef().data());
4123 if (!packet.GetBytesLeft())
4127 if (strncmp(packet.Peek(), "thread:", strlen("thread:")) != 0) {
4130 "error: expected 'thread:' but not found, packet contents = "
4132 __FUNCTION__, packet.GetStringRef().data());
4135 packet.SetFilePos(packet.GetFilePos() + strlen("thread:"));
4136 const lldb::tid_t tid = packet.GetHexMaxU64(false, 0);