mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-23 21:45:46 -04:00

To addess this, attach to any GDB server and when stopped type: (lldb) process plugin packet speed-test The default will send a variety of packets with different amounts of data to send/receive and print the performance of each packet type: Testing sending 1000 packets of various sizes: qSpeedTest(send=0 , recv=0 ) in 0.057837000 sec for 17289.97 packets/sec ( 0.057837 ms per packet) with standard deviation of 0.007705 ms qSpeedTest(send=0 , recv=4 ) in 0.056162000 sec for 17805.63 packets/sec ( 0.056162 ms per packet) with standard deviation of 0.004439 ms qSpeedTest(send=0 , recv=8 ) in 0.057687000 sec for 17334.93 packets/sec ( 0.057687 ms per packet) with standard deviation of 0.008135 ms qSpeedTest(send=0 , recv=16 ) in 0.058547000 sec for 17080.29 packets/sec ( 0.058547 ms per packet) with standard deviation of 0.005884 ms qSpeedTest(send=0 , recv=32 ) in 0.058289000 sec for 17155.89 packets/sec ( 0.058289 ms per packet) with standard deviation of 0.004057 ms qSpeedTest(send=0 , recv=64 ) in 0.061324000 sec for 16306.83 packets/sec ( 0.061324 ms per packet) with standard deviation of 0.010838 ms qSpeedTest(send=0 , recv=128 ) in 0.065688000 sec for 15223.48 packets/sec ( 0.065688 ms per packet) with standard deviation of 0.006997 ms qSpeedTest(send=0 , recv=256 ) in 0.070621000 sec for 14160.09 packets/sec ( 0.070621 ms per packet) with standard deviation of 0.006188 ms qSpeedTest(send=0 , recv=512 ) in 0.086738000 sec for 11528.97 packets/sec ( 0.086738 ms per packet) with standard deviation of 0.007867 ms qSpeedTest(send=0 , recv=1024 ) in 0.146375000 sec for 6831.77 packets/sec ( 0.146375 ms per packet) with standard deviation of 0.010313 ms qSpeedTest(send=4 , recv=0 ) in 0.057807000 sec for 17298.94 packets/sec ( 0.057807 ms per packet) with standard deviation of 0.009702 ms .... It will then also use various sizes to receive 4MB of data from the GDB server and print out the stats: Testing receiving 4.0MB of data using varying receive packet sizes: qSpeedTest(send=0 , recv=32 ) 131072 packets needed to receive 4.0MB in 7.721290000 sec for 0.518048 MB/sec for 16975.40 packets/sec ( 0.058909 ms per packet) qSpeedTest(send=0 , recv=64 ) 65536 packets needed to receive 4.0MB in 4.029236000 sec for 0.992744 MB/sec for 16265.12 packets/sec ( 0.061481 ms per packet) qSpeedTest(send=0 , recv=128 ) 32768 packets needed to receive 4.0MB in 2.233854000 sec for 1.790627 MB/sec for 14668.82 packets/sec ( 0.068172 ms per packet) qSpeedTest(send=0 , recv=256 ) 16384 packets needed to receive 4.0MB in 1.160024000 sec for 3.448204 MB/sec for 14123.84 packets/sec ( 0.070802 ms per packet) qSpeedTest(send=0 , recv=512 ) 8192 packets needed to receive 4.0MB in 0.701603000 sec for 5.701230 MB/sec for 11676.12 packets/sec ( 0.085645 ms per packet) qSpeedTest(send=0 , recv=1024 ) 4096 packets needed to receive 4.0MB in 0.596786000 sec for 6.702570 MB/sec for 6863.43 packets/sec ( 0.145700 ms per packet) There is a JSON mode so we can use this in the test suite to track GDB server performance for each platform: (lldb) process plugin packet speed-test --json { "packet_speeds" : { "num_packets" : 1000, "results" : [ {"send_size" : 0, "recv_size" : 0, "total_time_nsec" : 64516000, "standard_deviation_nsec" : 20566 }, {"send_size" : 0, "recv_size" : 4, "total_time_nsec" : 59648000, "standard_deviation_nsec" : 10493 }, {"send_size" : 0, "recv_size" : 8, "total_time_nsec" : 56894000, "standard_deviation_nsec" : 5480 }, {"send_size" : 0, "recv_size" : 16, "total_time_nsec" : 59422000, "standard_deviation_nsec" : 6557 }, {"send_size" : 0, "recv_size" : 32, "total_time_nsec" : 61159000, "standard_deviation_nsec" : 12384 }, {"send_size" : 0, "recv_size" : 64, "total_time_nsec" : 61386000, "standard_deviation_nsec" : 9208 }, {"send_size" : 0, "recv_size" : 128, "total_time_nsec" : 64768000, "standard_deviation_nsec" : 4737 }, {"send_size" : 0, "recv_size" : 256, "total_time_nsec" : 71046000, "standard_deviation_nsec" : 5904 }, {"send_size" : 0, "recv_size" : 512, "total_time_nsec" : 87233000, "standard_deviation_nsec" : 8967 }, {"send_size" : 0, "recv_size" : 1024, "total_time_nsec" : 146629000, "standard_deviation_nsec" : 9526 }, {"send_size" : 4, "recv_size" : 0, "total_time_nsec" : 57131000, "standard_deviation_nsec" : 7884 }, {"send_size" : 4, "recv_size" : 4, "total_time_nsec" : 56772000, "standard_deviation_nsec" : 6064 }, {"send_size" : 4, "recv_size" : 8, "total_time_nsec" : 57450000, "standard_deviation_nsec" : 6341 }, {"send_size" : 4, "recv_size" : 16, "total_time_nsec" : 58279000, "standard_deviation_nsec" : 5998 }, {"send_size" : 4, "recv_size" : 32, "total_time_nsec" : 59995000, "standard_deviation_nsec" : 6294 }, {"send_size" : 4, "recv_size" : 64, "total_time_nsec" : 61632000, "standard_deviation_nsec" : 7838 }, {"send_size" : 4, "recv_size" : 128, "total_time_nsec" : 66535000, "standard_deviation_nsec" : 8026 }, {"send_size" : 4, "recv_size" : 256, "total_time_nsec" : 72754000, "standard_deviation_nsec" : 9519 }, {"send_size" : 4, "recv_size" : 512, "total_time_nsec" : 87072000, "standard_deviation_nsec" : 9268 }, {"send_size" : 4, "recv_size" : 1024, "total_time_nsec" : 147221000, "standard_deviation_nsec" : 9702 }, {"send_size" : 8, "recv_size" : 0, "total_time_nsec" : 57900000, "standard_deviation_nsec" : 7356 }, {"send_size" : 8, "recv_size" : 4, "total_time_nsec" : 58116000, "standard_deviation_nsec" : 7630 }, {"send_size" : 8, "recv_size" : 8, "total_time_nsec" : 57745000, "standard_deviation_nsec" : 8541 }, {"send_size" : 8, "recv_size" : 16, "total_time_nsec" : 59091000, "standard_deviation_nsec" : 7851 }, {"send_size" : 8, "recv_size" : 32, "total_time_nsec" : 59943000, "standard_deviation_nsec" : 6761 }, {"send_size" : 8, "recv_size" : 64, "total_time_nsec" : 62097000, "standard_deviation_nsec" : 8580 }, {"send_size" : 8, "recv_size" : 128, "total_time_nsec" : 69942000, "standard_deviation_nsec" : 16645 }, {"send_size" : 8, "recv_size" : 256, "total_time_nsec" : 72927000, "standard_deviation_nsec" : 11031 }, {"send_size" : 8, "recv_size" : 512, "total_time_nsec" : 87221000, "standard_deviation_nsec" : 8002 }, {"send_size" : 8, "recv_size" : 1024, "total_time_nsec" : 148696000, "standard_deviation_nsec" : 10383 }, {"send_size" : 16, "recv_size" : 0, "total_time_nsec" : 59890000, "standard_deviation_nsec" : 15160 }, {"send_size" : 16, "recv_size" : 4, "total_time_nsec" : 56664000, "standard_deviation_nsec" : 4650 }, {"send_size" : 16, "recv_size" : 8, "total_time_nsec" : 57574000, "standard_deviation_nsec" : 7787 }, {"send_size" : 16, "recv_size" : 16, "total_time_nsec" : 59312000, "standard_deviation_nsec" : 8104 }, {"send_size" : 16, "recv_size" : 32, "total_time_nsec" : 59764000, "standard_deviation_nsec" : 7496 }, {"send_size" : 16, "recv_size" : 64, "total_time_nsec" : 61644000, "standard_deviation_nsec" : 8331 }, {"send_size" : 16, "recv_size" : 128, "total_time_nsec" : 66476000, "standard_deviation_nsec" : 9251 }, {"send_size" : 16, "recv_size" : 256, "total_time_nsec" : 72386000, "standard_deviation_nsec" : 8627 }, {"send_size" : 16, "recv_size" : 512, "total_time_nsec" : 87810000, "standard_deviation_nsec" : 12318 }, {"send_size" : 16, "recv_size" : 1024, "total_time_nsec" : 146918000, "standard_deviation_nsec" : 11595 }, {"send_size" : 32, "recv_size" : 0, "total_time_nsec" : 56493000, "standard_deviation_nsec" : 6577 }, {"send_size" : 32, "recv_size" : 4, "total_time_nsec" : 57069000, "standard_deviation_nsec" : 5931 }, {"send_size" : 32, "recv_size" : 8, "total_time_nsec" : 57563000, "standard_deviation_nsec" : 8157 }, {"send_size" : 32, "recv_size" : 16, "total_time_nsec" : 59694000, "standard_deviation_nsec" : 6932 }, {"send_size" : 32, "recv_size" : 32, "total_time_nsec" : 60852000, "standard_deviation_nsec" : 8010 }, {"send_size" : 32, "recv_size" : 64, "total_time_nsec" : 61926000, "standard_deviation_nsec" : 8372 }, {"send_size" : 32, "recv_size" : 128, "total_time_nsec" : 66734000, "standard_deviation_nsec" : 8047 }, {"send_size" : 32, "recv_size" : 256, "total_time_nsec" : 72000000, "standard_deviation_nsec" : 8103 }, {"send_size" : 32, "recv_size" : 512, "total_time_nsec" : 88268000, "standard_deviation_nsec" : 12289 }, {"send_size" : 32, "recv_size" : 1024, "total_time_nsec" : 147946000, "standard_deviation_nsec" : 12122 }, {"send_size" : 64, "recv_size" : 0, "total_time_nsec" : 58126000, "standard_deviation_nsec" : 5895 }, {"send_size" : 64, "recv_size" : 4, "total_time_nsec" : 58927000, "standard_deviation_nsec" : 8933 }, {"send_size" : 64, "recv_size" : 8, "total_time_nsec" : 58163000, "standard_deviation_nsec" : 6663 }, {"send_size" : 64, "recv_size" : 16, "total_time_nsec" : 59901000, "standard_deviation_nsec" : 8340 }, {"send_size" : 64, "recv_size" : 32, "total_time_nsec" : 60365000, "standard_deviation_nsec" : 6319 }, {"send_size" : 64, "recv_size" : 64, "total_time_nsec" : 61776000, "standard_deviation_nsec" : 7461 }, {"send_size" : 64, "recv_size" : 128, "total_time_nsec" : 66984000, "standard_deviation_nsec" : 6810 }, {"send_size" : 64, "recv_size" : 256, "total_time_nsec" : 73913000, "standard_deviation_nsec" : 8826 }, {"send_size" : 64, "recv_size" : 512, "total_time_nsec" : 88134000, "standard_deviation_nsec" : 8356 }, {"send_size" : 64, "recv_size" : 1024, "total_time_nsec" : 146932000, "standard_deviation_nsec" : 7571 }, {"send_size" : 128, "recv_size" : 0, "total_time_nsec" : 57616000, "standard_deviation_nsec" : 6158 }, {"send_size" : 128, "recv_size" : 4, "total_time_nsec" : 59091000, "standard_deviation_nsec" : 7458 }, {"send_size" : 128, "recv_size" : 8, "total_time_nsec" : 60263000, "standard_deviation_nsec" : 11999 }, {"send_size" : 128, "recv_size" : 16, "total_time_nsec" : 59238000, "standard_deviation_nsec" : 6102 }, {"send_size" : 128, "recv_size" : 32, "total_time_nsec" : 60783000, "standard_deviation_nsec" : 6244 }, {"send_size" : 128, "recv_size" : 64, "total_time_nsec" : 62975000, "standard_deviation_nsec" : 8947 }, {"send_size" : 128, "recv_size" : 128, "total_time_nsec" : 65742000, "standard_deviation_nsec" : 5907 }, {"send_size" : 128, "recv_size" : 256, "total_time_nsec" : 72402000, "standard_deviation_nsec" : 6601 }, {"send_size" : 128, "recv_size" : 512, "total_time_nsec" : 87457000, "standard_deviation_nsec" : 9004 }, {"send_size" : 128, "recv_size" : 1024, "total_time_nsec" : 148412000, "standard_deviation_nsec" : 10532 }, {"send_size" : 256, "recv_size" : 0, "total_time_nsec" : 58705000, "standard_deviation_nsec" : 7274 }, {"send_size" : 256, "recv_size" : 4, "total_time_nsec" : 58818000, "standard_deviation_nsec" : 5453 }, {"send_size" : 256, "recv_size" : 8, "total_time_nsec" : 59451000, "standard_deviation_nsec" : 6926 }, {"send_size" : 256, "recv_size" : 16, "total_time_nsec" : 60237000, "standard_deviation_nsec" : 5781 }, {"send_size" : 256, "recv_size" : 32, "total_time_nsec" : 61456000, "standard_deviation_nsec" : 5591 }, {"send_size" : 256, "recv_size" : 64, "total_time_nsec" : 62615000, "standard_deviation_nsec" : 7588 }, {"send_size" : 256, "recv_size" : 128, "total_time_nsec" : 68554000, "standard_deviation_nsec" : 7766 }, {"send_size" : 256, "recv_size" : 256, "total_time_nsec" : 74557000, "standard_deviation_nsec" : 8748 }, {"send_size" : 256, "recv_size" : 512, "total_time_nsec" : 87929000, "standard_deviation_nsec" : 9510 }, {"send_size" : 256, "recv_size" : 1024, "total_time_nsec" : 148522000, "standard_deviation_nsec" : 11394 }, {"send_size" : 512, "recv_size" : 0, "total_time_nsec" : 59697000, "standard_deviation_nsec" : 7825 }, {"send_size" : 512, "recv_size" : 4, "total_time_nsec" : 59427000, "standard_deviation_nsec" : 5706 }, {"send_size" : 512, "recv_size" : 8, "total_time_nsec" : 59538000, "standard_deviation_nsec" : 6863 }, {"send_size" : 512, "recv_size" : 16, "total_time_nsec" : 61139000, "standard_deviation_nsec" : 7645 }, {"send_size" : 512, "recv_size" : 32, "total_time_nsec" : 62203000, "standard_deviation_nsec" : 7985 }, {"send_size" : 512, "recv_size" : 64, "total_time_nsec" : 62577000, "standard_deviation_nsec" : 8118 }, {"send_size" : 512, "recv_size" : 128, "total_time_nsec" : 68722000, "standard_deviation_nsec" : 10581 }, {"send_size" : 512, "recv_size" : 256, "total_time_nsec" : 74290000, "standard_deviation_nsec" : 8931 }, {"send_size" : 512, "recv_size" : 512, "total_time_nsec" : 88635000, "standard_deviation_nsec" : 7771 }, {"send_size" : 512, "recv_size" : 1024, "total_time_nsec" : 149589000, "standard_deviation_nsec" : 11456 }, {"send_size" : 1024, "recv_size" : 0, "total_time_nsec" : 63243000, "standard_deviation_nsec" : 6331 }, {"send_size" : 1024, "recv_size" : 4, "total_time_nsec" : 64381000, "standard_deviation_nsec" : 8372 }, {"send_size" : 1024, "recv_size" : 8, "total_time_nsec" : 63481000, "standard_deviation_nsec" : 5608 }, {"send_size" : 1024, "recv_size" : 16, "total_time_nsec" : 65549000, "standard_deviation_nsec" : 8826 }, {"send_size" : 1024, "recv_size" : 32, "total_time_nsec" : 65485000, "standard_deviation_nsec" : 6822 }, {"send_size" : 1024, "recv_size" : 64, "total_time_nsec" : 67125000, "standard_deviation_nsec" : 9829 }, {"send_size" : 1024, "recv_size" : 128, "total_time_nsec" : 72680000, "standard_deviation_nsec" : 7641 }, {"send_size" : 1024, "recv_size" : 256, "total_time_nsec" : 79206000, "standard_deviation_nsec" : 9854 }, {"send_size" : 1024, "recv_size" : 512, "total_time_nsec" : 92418000, "standard_deviation_nsec" : 9107 }, {"send_size" : 1024, "recv_size" : 1024, "total_time_nsec" : 152392000, "standard_deviation_nsec" : 11124 } ] }, "download_speed" : { "byte_size" : 4194304, "results" : [ {"send_size" : 0, "recv_size" : 32, "total_time_nsec" : 7735630000 }, {"send_size" : 0, "recv_size" : 64, "total_time_nsec" : 3985169000 }, {"send_size" : 0, "recv_size" : 128, "total_time_nsec" : 2128791000 }, {"send_size" : 0, "recv_size" : 256, "total_time_nsec" : 1172077000 }, {"send_size" : 0, "recv_size" : 512, "total_time_nsec" : 703833000 }, {"send_size" : 0, "recv_size" : 1024, "total_time_nsec" : 594966000 } ] } } llvm-svn: 237953
658 lines
21 KiB
C++
658 lines
21 KiB
C++
//===-- GDBRemoteCommunicationClient.h --------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef liblldb_GDBRemoteCommunicationClient_h_
|
|
#define liblldb_GDBRemoteCommunicationClient_h_
|
|
|
|
// C Includes
|
|
// C++ Includes
|
|
#include <vector>
|
|
|
|
// Other libraries and framework includes
|
|
// Project includes
|
|
#include "lldb/Core/ArchSpec.h"
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "GDBRemoteCommunication.h"
|
|
|
|
namespace lldb_private {
|
|
namespace process_gdb_remote {
|
|
|
|
class GDBRemoteCommunicationClient : public GDBRemoteCommunication
|
|
{
|
|
public:
|
|
//------------------------------------------------------------------
|
|
// Constructors and Destructors
|
|
//------------------------------------------------------------------
|
|
GDBRemoteCommunicationClient();
|
|
|
|
~GDBRemoteCommunicationClient();
|
|
|
|
//------------------------------------------------------------------
|
|
// After connecting, send the handshake to the server to make sure
|
|
// we are communicating with it.
|
|
//------------------------------------------------------------------
|
|
bool
|
|
HandshakeWithServer (Error *error_ptr);
|
|
|
|
PacketResult
|
|
SendPacketAndWaitForResponse (const char *send_payload,
|
|
StringExtractorGDBRemote &response,
|
|
bool send_async);
|
|
|
|
PacketResult
|
|
SendPacketAndWaitForResponse (const char *send_payload,
|
|
size_t send_length,
|
|
StringExtractorGDBRemote &response,
|
|
bool send_async);
|
|
|
|
// For packets which specify a range of output to be returned,
|
|
// return all of the output via a series of request packets of the form
|
|
// <prefix>0,<size>
|
|
// <prefix><size>,<size>
|
|
// <prefix><size>*2,<size>
|
|
// <prefix><size>*3,<size>
|
|
// ...
|
|
// until a "$l..." packet is received, indicating the end.
|
|
// (size is in hex; this format is used by a standard gdbserver to
|
|
// return the given portion of the output specified by <prefix>;
|
|
// for example, "qXfer:libraries-svr4:read::fff,1000" means
|
|
// "return a chunk of the xml description file for shared
|
|
// library load addresses, where the chunk starts at offset 0xfff
|
|
// and continues for 0x1000 bytes").
|
|
// Concatenate the resulting server response packets together and
|
|
// return in response_string. If any packet fails, the return value
|
|
// indicates that failure and the returned string value is undefined.
|
|
PacketResult
|
|
SendPacketsAndConcatenateResponses (const char *send_payload_prefix,
|
|
std::string &response_string);
|
|
|
|
lldb::StateType
|
|
SendContinuePacketAndWaitForResponse (ProcessGDBRemote *process,
|
|
const char *packet_payload,
|
|
size_t packet_length,
|
|
StringExtractorGDBRemote &response);
|
|
|
|
bool
|
|
GetThreadSuffixSupported () override;
|
|
|
|
// This packet is usually sent first and the boolean return value
|
|
// indicates if the packet was send and any response was received
|
|
// even in the response is UNIMPLEMENTED. If the packet failed to
|
|
// get a response, then false is returned. This quickly tells us
|
|
// if we were able to connect and communicate with the remote GDB
|
|
// server
|
|
bool
|
|
QueryNoAckModeSupported ();
|
|
|
|
void
|
|
GetListThreadsInStopReplySupported ();
|
|
|
|
bool
|
|
SendAsyncSignal (int signo);
|
|
|
|
bool
|
|
SendInterrupt (Mutex::Locker &locker,
|
|
uint32_t seconds_to_wait_for_stop,
|
|
bool &timed_out);
|
|
|
|
lldb::pid_t
|
|
GetCurrentProcessID (bool allow_lazy = true);
|
|
|
|
bool
|
|
GetLaunchSuccess (std::string &error_str);
|
|
|
|
uint16_t
|
|
LaunchGDBserverAndGetPort (lldb::pid_t &pid, const char *remote_accept_hostname);
|
|
|
|
bool
|
|
KillSpawnedProcess (lldb::pid_t pid);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sends a GDB remote protocol 'A' packet that delivers program
|
|
/// arguments to the remote server.
|
|
///
|
|
/// @param[in] argv
|
|
/// A NULL terminated array of const C strings to use as the
|
|
/// arguments.
|
|
///
|
|
/// @return
|
|
/// Zero if the response was "OK", a positive value if the
|
|
/// the response was "Exx" where xx are two hex digits, or
|
|
/// -1 if the call is unsupported or any other unexpected
|
|
/// response was received.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SendArgumentsPacket (const ProcessLaunchInfo &launch_info);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
|
|
/// environment that will get used when launching an application
|
|
/// in conjunction with the 'A' packet. This function can be called
|
|
/// multiple times in a row in order to pass on the desired
|
|
/// environment that the inferior should be launched with.
|
|
///
|
|
/// @param[in] name_equal_value
|
|
/// A NULL terminated C string that contains a single environment
|
|
/// in the format "NAME=VALUE".
|
|
///
|
|
/// @return
|
|
/// Zero if the response was "OK", a positive value if the
|
|
/// the response was "Exx" where xx are two hex digits, or
|
|
/// -1 if the call is unsupported or any other unexpected
|
|
/// response was received.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SendEnvironmentPacket (char const *name_equal_value);
|
|
|
|
int
|
|
SendLaunchArchPacket (const char *arch);
|
|
|
|
int
|
|
SendLaunchEventDataPacket (const char *data, bool *was_supported = NULL);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sends a "vAttach:PID" where PID is in hex.
|
|
///
|
|
/// @param[in] pid
|
|
/// A process ID for the remote gdb server to attach to.
|
|
///
|
|
/// @param[out] response
|
|
/// The response received from the gdb server. If the return
|
|
/// value is zero, \a response will contain a stop reply
|
|
/// packet.
|
|
///
|
|
/// @return
|
|
/// Zero if the attach was successful, or an error indicating
|
|
/// an error code.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SendAttach (lldb::pid_t pid,
|
|
StringExtractorGDBRemote& response);
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sends a GDB remote protocol 'I' packet that delivers stdin
|
|
/// data to the remote process.
|
|
///
|
|
/// @param[in] data
|
|
/// A pointer to stdin data.
|
|
///
|
|
/// @param[in] data_len
|
|
/// The number of bytes available at \a data.
|
|
///
|
|
/// @return
|
|
/// Zero if the attach was successful, or an error indicating
|
|
/// an error code.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SendStdinNotification(const char* data, size_t data_len);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sets the path to use for stdin/out/err for a process
|
|
/// that will be launched with the 'A' packet.
|
|
///
|
|
/// @param[in] path
|
|
/// The path to use for stdin/out/err
|
|
///
|
|
/// @return
|
|
/// Zero if the for success, or an error code for failure.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SetSTDIN (char const *path);
|
|
int
|
|
SetSTDOUT (char const *path);
|
|
int
|
|
SetSTDERR (char const *path);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sets the disable ASLR flag to \a enable for a process that will
|
|
/// be launched with the 'A' packet.
|
|
///
|
|
/// @param[in] enable
|
|
/// A boolean value indicating whether to disable ASLR or not.
|
|
///
|
|
/// @return
|
|
/// Zero if the for success, or an error code for failure.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SetDisableASLR (bool enable);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sets the DetachOnError flag to \a enable for the process controlled by the stub.
|
|
///
|
|
/// @param[in] enable
|
|
/// A boolean value indicating whether to detach on error or not.
|
|
///
|
|
/// @return
|
|
/// Zero if the for success, or an error code for failure.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SetDetachOnError (bool enable);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Sets the working directory to \a path for a process that will
|
|
/// be launched with the 'A' packet for non platform based
|
|
/// connections. If this packet is sent to a GDB server that
|
|
/// implements the platform, it will change the current working
|
|
/// directory for the platform process.
|
|
///
|
|
/// @param[in] path
|
|
/// The path to a directory to use when launching our process
|
|
///
|
|
/// @return
|
|
/// Zero if the for success, or an error code for failure.
|
|
//------------------------------------------------------------------
|
|
int
|
|
SetWorkingDir (char const *path);
|
|
|
|
//------------------------------------------------------------------
|
|
/// Gets the current working directory of a remote platform GDB
|
|
/// server.
|
|
///
|
|
/// @param[out] cwd
|
|
/// The current working directory on the remote platform.
|
|
///
|
|
/// @return
|
|
/// Boolean for success
|
|
//------------------------------------------------------------------
|
|
bool
|
|
GetWorkingDir (std::string &cwd);
|
|
|
|
lldb::addr_t
|
|
AllocateMemory (size_t size, uint32_t permissions);
|
|
|
|
bool
|
|
DeallocateMemory (lldb::addr_t addr);
|
|
|
|
Error
|
|
Detach (bool keep_stopped);
|
|
|
|
Error
|
|
GetMemoryRegionInfo (lldb::addr_t addr, MemoryRegionInfo &range_info);
|
|
|
|
Error
|
|
GetWatchpointSupportInfo (uint32_t &num);
|
|
|
|
Error
|
|
GetWatchpointSupportInfo (uint32_t &num, bool& after);
|
|
|
|
Error
|
|
GetWatchpointsTriggerAfterInstruction (bool &after);
|
|
|
|
const ArchSpec &
|
|
GetHostArchitecture ();
|
|
|
|
uint32_t
|
|
GetHostDefaultPacketTimeout();
|
|
|
|
const ArchSpec &
|
|
GetProcessArchitecture ();
|
|
|
|
void
|
|
GetRemoteQSupported();
|
|
|
|
bool
|
|
GetVContSupported (char flavor);
|
|
|
|
bool
|
|
GetpPacketSupported (lldb::tid_t tid);
|
|
|
|
bool
|
|
GetxPacketSupported ();
|
|
|
|
bool
|
|
GetVAttachOrWaitSupported ();
|
|
|
|
bool
|
|
GetSyncThreadStateSupported();
|
|
|
|
void
|
|
ResetDiscoverableSettings();
|
|
|
|
bool
|
|
GetHostInfo (bool force = false);
|
|
|
|
bool
|
|
GetDefaultThreadId (lldb::tid_t &tid);
|
|
|
|
bool
|
|
GetOSVersion (uint32_t &major,
|
|
uint32_t &minor,
|
|
uint32_t &update);
|
|
|
|
bool
|
|
GetOSBuildString (std::string &s);
|
|
|
|
bool
|
|
GetOSKernelDescription (std::string &s);
|
|
|
|
ArchSpec
|
|
GetSystemArchitecture ();
|
|
|
|
bool
|
|
GetHostname (std::string &s);
|
|
|
|
lldb::addr_t
|
|
GetShlibInfoAddr();
|
|
|
|
bool
|
|
GetSupportsThreadSuffix ();
|
|
|
|
bool
|
|
GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info);
|
|
|
|
uint32_t
|
|
FindProcesses (const ProcessInstanceInfoMatch &process_match_info,
|
|
ProcessInstanceInfoList &process_infos);
|
|
|
|
bool
|
|
GetUserName (uint32_t uid, std::string &name);
|
|
|
|
bool
|
|
GetGroupName (uint32_t gid, std::string &name);
|
|
|
|
bool
|
|
HasFullVContSupport ()
|
|
{
|
|
return GetVContSupported ('A');
|
|
}
|
|
|
|
bool
|
|
HasAnyVContSupport ()
|
|
{
|
|
return GetVContSupported ('a');
|
|
}
|
|
|
|
bool
|
|
GetStopReply (StringExtractorGDBRemote &response);
|
|
|
|
bool
|
|
GetThreadStopInfo (lldb::tid_t tid,
|
|
StringExtractorGDBRemote &response);
|
|
|
|
bool
|
|
SupportsGDBStoppointPacket (GDBStoppointType type)
|
|
{
|
|
switch (type)
|
|
{
|
|
case eBreakpointSoftware: return m_supports_z0;
|
|
case eBreakpointHardware: return m_supports_z1;
|
|
case eWatchpointWrite: return m_supports_z2;
|
|
case eWatchpointRead: return m_supports_z3;
|
|
case eWatchpointReadWrite: return m_supports_z4;
|
|
default: return false;
|
|
}
|
|
}
|
|
uint8_t
|
|
SendGDBStoppointTypePacket (GDBStoppointType type, // Type of breakpoint or watchpoint
|
|
bool insert, // Insert or remove?
|
|
lldb::addr_t addr, // Address of breakpoint or watchpoint
|
|
uint32_t length); // Byte Size of breakpoint or watchpoint
|
|
|
|
bool
|
|
SetNonStopMode (const bool enable);
|
|
|
|
void
|
|
TestPacketSpeed (const uint32_t num_packets, uint32_t max_send, uint32_t max_recv, bool json, Stream &strm);
|
|
|
|
// This packet is for testing the speed of the interface only. Both
|
|
// the client and server need to support it, but this allows us to
|
|
// measure the packet speed without any other work being done on the
|
|
// other end and avoids any of that work affecting the packet send
|
|
// and response times.
|
|
bool
|
|
SendSpeedTestPacket (uint32_t send_size,
|
|
uint32_t recv_size);
|
|
|
|
bool
|
|
SetCurrentThread (uint64_t tid);
|
|
|
|
bool
|
|
SetCurrentThreadForRun (uint64_t tid);
|
|
|
|
bool
|
|
GetQXferAuxvReadSupported ();
|
|
|
|
bool
|
|
GetQXferLibrariesReadSupported ();
|
|
|
|
bool
|
|
GetQXferLibrariesSVR4ReadSupported ();
|
|
|
|
uint64_t
|
|
GetRemoteMaxPacketSize();
|
|
|
|
bool
|
|
GetAugmentedLibrariesSVR4ReadSupported ();
|
|
|
|
bool
|
|
GetQXferFeaturesReadSupported ();
|
|
|
|
LazyBool
|
|
SupportsAllocDeallocMemory () // const
|
|
{
|
|
// Uncomment this to have lldb pretend the debug server doesn't respond to alloc/dealloc memory packets.
|
|
// m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
|
|
return m_supports_alloc_dealloc_memory;
|
|
}
|
|
|
|
size_t
|
|
GetCurrentThreadIDs (std::vector<lldb::tid_t> &thread_ids,
|
|
bool &sequence_mutex_unavailable);
|
|
|
|
bool
|
|
GetInterruptWasSent () const
|
|
{
|
|
return m_interrupt_sent;
|
|
}
|
|
|
|
lldb::user_id_t
|
|
OpenFile (const FileSpec& file_spec, uint32_t flags, mode_t mode, Error &error);
|
|
|
|
bool
|
|
CloseFile (lldb::user_id_t fd, Error &error);
|
|
|
|
lldb::user_id_t
|
|
GetFileSize (const FileSpec& file_spec);
|
|
|
|
Error
|
|
GetFilePermissions(const char *path, uint32_t &file_permissions);
|
|
|
|
Error
|
|
SetFilePermissions(const char *path, uint32_t file_permissions);
|
|
|
|
uint64_t
|
|
ReadFile (lldb::user_id_t fd,
|
|
uint64_t offset,
|
|
void *dst,
|
|
uint64_t dst_len,
|
|
Error &error);
|
|
|
|
uint64_t
|
|
WriteFile (lldb::user_id_t fd,
|
|
uint64_t offset,
|
|
const void* src,
|
|
uint64_t src_len,
|
|
Error &error);
|
|
|
|
Error
|
|
CreateSymlink (const char *src,
|
|
const char *dst);
|
|
|
|
Error
|
|
Unlink (const char *path);
|
|
|
|
Error
|
|
MakeDirectory (const char *path, uint32_t mode);
|
|
|
|
bool
|
|
GetFileExists (const FileSpec& file_spec);
|
|
|
|
Error
|
|
RunShellCommand (const char *command, // Shouldn't be NULL
|
|
const char *working_dir, // Pass NULL to use the current working directory
|
|
int *status_ptr, // Pass NULL if you don't want the process exit status
|
|
int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
|
|
std::string *command_output, // Pass NULL if you don't want the command output
|
|
uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
|
|
|
|
bool
|
|
CalculateMD5 (const FileSpec& file_spec, uint64_t &high, uint64_t &low);
|
|
|
|
std::string
|
|
HarmonizeThreadIdsForProfileData (ProcessGDBRemote *process,
|
|
StringExtractorGDBRemote &inputStringExtractor);
|
|
|
|
bool
|
|
ReadRegister(lldb::tid_t tid,
|
|
uint32_t reg_num,
|
|
StringExtractorGDBRemote &response);
|
|
|
|
bool
|
|
ReadAllRegisters (lldb::tid_t tid,
|
|
StringExtractorGDBRemote &response);
|
|
|
|
bool
|
|
SaveRegisterState (lldb::tid_t tid, uint32_t &save_id);
|
|
|
|
bool
|
|
RestoreRegisterState (lldb::tid_t tid, uint32_t save_id);
|
|
|
|
const char *
|
|
GetGDBServerProgramName();
|
|
|
|
uint32_t
|
|
GetGDBServerProgramVersion();
|
|
|
|
bool
|
|
AvoidGPackets(ProcessGDBRemote *process);
|
|
|
|
bool
|
|
GetThreadExtendedInfoSupported();
|
|
|
|
bool
|
|
GetModuleInfo (const FileSpec& module_file_spec,
|
|
const ArchSpec& arch_spec,
|
|
ModuleSpec &module_spec);
|
|
|
|
bool
|
|
ReadExtFeature (const lldb_private::ConstString object,
|
|
const lldb_private::ConstString annex,
|
|
std::string & out,
|
|
lldb_private::Error & err);
|
|
|
|
protected:
|
|
|
|
PacketResult
|
|
SendPacketAndWaitForResponseNoLock (const char *payload,
|
|
size_t payload_length,
|
|
StringExtractorGDBRemote &response);
|
|
|
|
bool
|
|
GetCurrentProcessInfo (bool allow_lazy_pid = true);
|
|
|
|
bool
|
|
GetGDBServerVersion();
|
|
|
|
//------------------------------------------------------------------
|
|
// Classes that inherit from GDBRemoteCommunicationClient can see and modify these
|
|
//------------------------------------------------------------------
|
|
LazyBool m_supports_not_sending_acks;
|
|
LazyBool m_supports_thread_suffix;
|
|
LazyBool m_supports_threads_in_stop_reply;
|
|
LazyBool m_supports_vCont_all;
|
|
LazyBool m_supports_vCont_any;
|
|
LazyBool m_supports_vCont_c;
|
|
LazyBool m_supports_vCont_C;
|
|
LazyBool m_supports_vCont_s;
|
|
LazyBool m_supports_vCont_S;
|
|
LazyBool m_qHostInfo_is_valid;
|
|
LazyBool m_curr_pid_is_valid;
|
|
LazyBool m_qProcessInfo_is_valid;
|
|
LazyBool m_qGDBServerVersion_is_valid;
|
|
LazyBool m_supports_alloc_dealloc_memory;
|
|
LazyBool m_supports_memory_region_info;
|
|
LazyBool m_supports_watchpoint_support_info;
|
|
LazyBool m_supports_detach_stay_stopped;
|
|
LazyBool m_watchpoints_trigger_after_instruction;
|
|
LazyBool m_attach_or_wait_reply;
|
|
LazyBool m_prepare_for_reg_writing_reply;
|
|
LazyBool m_supports_p;
|
|
LazyBool m_supports_x;
|
|
LazyBool m_avoid_g_packets;
|
|
LazyBool m_supports_QSaveRegisterState;
|
|
LazyBool m_supports_qXfer_auxv_read;
|
|
LazyBool m_supports_qXfer_libraries_read;
|
|
LazyBool m_supports_qXfer_libraries_svr4_read;
|
|
LazyBool m_supports_qXfer_features_read;
|
|
LazyBool m_supports_augmented_libraries_svr4_read;
|
|
LazyBool m_supports_jThreadExtendedInfo;
|
|
|
|
bool
|
|
m_supports_qProcessInfoPID:1,
|
|
m_supports_qfProcessInfo:1,
|
|
m_supports_qUserName:1,
|
|
m_supports_qGroupName:1,
|
|
m_supports_qThreadStopInfo:1,
|
|
m_supports_z0:1,
|
|
m_supports_z1:1,
|
|
m_supports_z2:1,
|
|
m_supports_z3:1,
|
|
m_supports_z4:1,
|
|
m_supports_QEnvironment:1,
|
|
m_supports_QEnvironmentHexEncoded:1;
|
|
|
|
lldb::pid_t m_curr_pid;
|
|
lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all other operations
|
|
lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for continue, step, etc
|
|
|
|
|
|
uint32_t m_num_supported_hardware_watchpoints;
|
|
|
|
// If we need to send a packet while the target is running, the m_async_XXX
|
|
// member variables take care of making this happen.
|
|
Mutex m_async_mutex;
|
|
Predicate<bool> m_async_packet_predicate;
|
|
std::string m_async_packet;
|
|
PacketResult m_async_result;
|
|
StringExtractorGDBRemote m_async_response;
|
|
int m_async_signal; // We were asked to deliver a signal to the inferior process.
|
|
bool m_interrupt_sent;
|
|
std::string m_partial_profile_data;
|
|
std::map<uint64_t, uint32_t> m_thread_id_to_used_usec_map;
|
|
|
|
ArchSpec m_host_arch;
|
|
ArchSpec m_process_arch;
|
|
uint32_t m_os_version_major;
|
|
uint32_t m_os_version_minor;
|
|
uint32_t m_os_version_update;
|
|
std::string m_os_build;
|
|
std::string m_os_kernel;
|
|
std::string m_hostname;
|
|
std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if qGDBServerVersion is not supported
|
|
uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if qGDBServerVersion is not supported
|
|
uint32_t m_default_packet_timeout;
|
|
uint64_t m_max_packet_size; // as returned by qSupported
|
|
|
|
bool
|
|
DecodeProcessInfoResponse (StringExtractorGDBRemote &response,
|
|
ProcessInstanceInfo &process_info);
|
|
private:
|
|
//------------------------------------------------------------------
|
|
// For GDBRemoteCommunicationClient only
|
|
//------------------------------------------------------------------
|
|
DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient);
|
|
};
|
|
|
|
} // namespace process_gdb_remote
|
|
} // namespace lldb_private
|
|
|
|
#endif // liblldb_GDBRemoteCommunicationClient_h_
|