Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 1 | //===-- GDBRemoteCommunicationClient.h --------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_GDBRemoteCommunicationClient_h_ |
| 11 | #define liblldb_GDBRemoteCommunicationClient_h_ |
| 12 | |
Pavel Labath | b42b48e | 2016-08-19 12:31:49 +0000 | [diff] [blame] | 13 | #include "GDBRemoteClientBase.h" |
| 14 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 15 | // C Includes |
| 16 | // C++ Includes |
Pavel Labath | 8c1b6bd | 2016-08-09 12:04:46 +0000 | [diff] [blame] | 17 | #include <chrono> |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 18 | #include <map> |
Saleem Abdulrasool | 16ff860 | 2016-05-18 01:59:10 +0000 | [diff] [blame] | 19 | #include <mutex> |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 20 | #include <string> |
Greg Clayton | adc00cb | 2011-05-20 23:38:13 +0000 | [diff] [blame] | 21 | #include <vector> |
| 22 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 23 | // Other libraries and framework includes |
| 24 | // Project includes |
| 25 | #include "lldb/Core/ArchSpec.h" |
Greg Clayton | 358cf1e | 2015-06-25 21:46:34 +0000 | [diff] [blame] | 26 | #include "lldb/Core/StructuredData.h" |
Greg Clayton | 46fb558 | 2011-11-18 07:03:08 +0000 | [diff] [blame] | 27 | #include "lldb/Target/Process.h" |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 28 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 29 | namespace lldb_private { |
| 30 | namespace process_gdb_remote { |
| 31 | |
Pavel Labath | 8c1b6bd | 2016-08-09 12:04:46 +0000 | [diff] [blame] | 32 | class GDBRemoteCommunicationClient : public GDBRemoteClientBase |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 33 | { |
| 34 | public: |
Tamas Berghammer | e13c273 | 2015-02-11 10:29:30 +0000 | [diff] [blame] | 35 | GDBRemoteCommunicationClient(); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 36 | |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 37 | ~GDBRemoteCommunicationClient() override; |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 38 | |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 39 | //------------------------------------------------------------------ |
| 40 | // After connecting, send the handshake to the server to make sure |
| 41 | // we are communicating with it. |
| 42 | //------------------------------------------------------------------ |
| 43 | bool |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 44 | HandshakeWithServer (Error *error_ptr); |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 45 | |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 46 | // For packets which specify a range of output to be returned, |
| 47 | // return all of the output via a series of request packets of the form |
| 48 | // <prefix>0,<size> |
| 49 | // <prefix><size>,<size> |
| 50 | // <prefix><size>*2,<size> |
| 51 | // <prefix><size>*3,<size> |
| 52 | // ... |
| 53 | // until a "$l..." packet is received, indicating the end. |
| 54 | // (size is in hex; this format is used by a standard gdbserver to |
| 55 | // return the given portion of the output specified by <prefix>; |
| 56 | // for example, "qXfer:libraries-svr4:read::fff,1000" means |
| 57 | // "return a chunk of the xml description file for shared |
| 58 | // library load addresses, where the chunk starts at offset 0xfff |
| 59 | // and continues for 0x1000 bytes"). |
| 60 | // Concatenate the resulting server response packets together and |
| 61 | // return in response_string. If any packet fails, the return value |
| 62 | // indicates that failure and the returned string value is undefined. |
| 63 | PacketResult |
| 64 | SendPacketsAndConcatenateResponses (const char *send_payload_prefix, |
| 65 | std::string &response_string); |
| 66 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 67 | bool |
Pavel Labath | 5a123c4 | 2016-08-16 09:36:29 +0000 | [diff] [blame] | 68 | GetThreadSuffixSupported(); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 69 | |
Greg Clayton | fb90931 | 2013-11-23 01:58:15 +0000 | [diff] [blame] | 70 | // This packet is usually sent first and the boolean return value |
| 71 | // indicates if the packet was send and any response was received |
| 72 | // even in the response is UNIMPLEMENTED. If the packet failed to |
| 73 | // get a response, then false is returned. This quickly tells us |
Bruce Mitchener | d93c4a3 | 2014-07-01 21:22:11 +0000 | [diff] [blame] | 74 | // if we were able to connect and communicate with the remote GDB |
Greg Clayton | fb90931 | 2013-11-23 01:58:15 +0000 | [diff] [blame] | 75 | // server |
| 76 | bool |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 77 | QueryNoAckModeSupported (); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 78 | |
Greg Clayton | 4463399 | 2012-04-10 03:22:03 +0000 | [diff] [blame] | 79 | void |
| 80 | GetListThreadsInStopReplySupported (); |
| 81 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 82 | lldb::pid_t |
Oleksiy Vyalov | 1ef7b2c | 2015-02-04 23:19:15 +0000 | [diff] [blame] | 83 | GetCurrentProcessID (bool allow_lazy = true); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 84 | |
| 85 | bool |
| 86 | GetLaunchSuccess (std::string &error_str); |
| 87 | |
Oleksiy Vyalov | 9fe526c | 2015-10-21 19:34:26 +0000 | [diff] [blame] | 88 | bool |
| 89 | LaunchGDBServer (const char *remote_accept_hostname, |
| 90 | lldb::pid_t &pid, |
| 91 | uint16_t &port, |
| 92 | std::string &socket_name); |
Tamas Berghammer | ccd6cff | 2015-12-08 14:08:19 +0000 | [diff] [blame] | 93 | |
| 94 | size_t |
| 95 | QueryGDBServer (std::vector<std::pair<uint16_t, std::string>>& connection_urls); |
| 96 | |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 97 | bool |
| 98 | KillSpawnedProcess (lldb::pid_t pid); |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 99 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 100 | //------------------------------------------------------------------ |
| 101 | /// Sends a GDB remote protocol 'A' packet that delivers program |
| 102 | /// arguments to the remote server. |
| 103 | /// |
| 104 | /// @param[in] argv |
| 105 | /// A NULL terminated array of const C strings to use as the |
| 106 | /// arguments. |
| 107 | /// |
| 108 | /// @return |
| 109 | /// Zero if the response was "OK", a positive value if the |
| 110 | /// the response was "Exx" where xx are two hex digits, or |
| 111 | /// -1 if the call is unsupported or any other unexpected |
| 112 | /// response was received. |
| 113 | //------------------------------------------------------------------ |
| 114 | int |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 115 | SendArgumentsPacket (const ProcessLaunchInfo &launch_info); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 116 | |
| 117 | //------------------------------------------------------------------ |
| 118 | /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the |
| 119 | /// environment that will get used when launching an application |
| 120 | /// in conjunction with the 'A' packet. This function can be called |
| 121 | /// multiple times in a row in order to pass on the desired |
| 122 | /// environment that the inferior should be launched with. |
| 123 | /// |
| 124 | /// @param[in] name_equal_value |
| 125 | /// A NULL terminated C string that contains a single environment |
| 126 | /// in the format "NAME=VALUE". |
| 127 | /// |
| 128 | /// @return |
| 129 | /// Zero if the response was "OK", a positive value if the |
| 130 | /// the response was "Exx" where xx are two hex digits, or |
| 131 | /// -1 if the call is unsupported or any other unexpected |
| 132 | /// response was received. |
| 133 | //------------------------------------------------------------------ |
| 134 | int |
| 135 | SendEnvironmentPacket (char const *name_equal_value); |
| 136 | |
Greg Clayton | c4103b3 | 2011-05-08 04:53:50 +0000 | [diff] [blame] | 137 | int |
| 138 | SendLaunchArchPacket (const char *arch); |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 139 | |
| 140 | int |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 141 | SendLaunchEventDataPacket(const char *data, bool *was_supported = nullptr); |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 142 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 143 | //------------------------------------------------------------------ |
| 144 | /// Sends a "vAttach:PID" where PID is in hex. |
| 145 | /// |
| 146 | /// @param[in] pid |
| 147 | /// A process ID for the remote gdb server to attach to. |
| 148 | /// |
| 149 | /// @param[out] response |
| 150 | /// The response received from the gdb server. If the return |
| 151 | /// value is zero, \a response will contain a stop reply |
| 152 | /// packet. |
| 153 | /// |
| 154 | /// @return |
| 155 | /// Zero if the attach was successful, or an error indicating |
| 156 | /// an error code. |
| 157 | //------------------------------------------------------------------ |
| 158 | int |
| 159 | SendAttach (lldb::pid_t pid, |
| 160 | StringExtractorGDBRemote& response); |
| 161 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 162 | //------------------------------------------------------------------ |
Vince Harron | e0be425 | 2015-02-06 18:32:57 +0000 | [diff] [blame] | 163 | /// Sends a GDB remote protocol 'I' packet that delivers stdin |
| 164 | /// data to the remote process. |
| 165 | /// |
| 166 | /// @param[in] data |
| 167 | /// A pointer to stdin data. |
| 168 | /// |
| 169 | /// @param[in] data_len |
| 170 | /// The number of bytes available at \a data. |
| 171 | /// |
| 172 | /// @return |
| 173 | /// Zero if the attach was successful, or an error indicating |
| 174 | /// an error code. |
| 175 | //------------------------------------------------------------------ |
| 176 | int |
| 177 | SendStdinNotification(const char* data, size_t data_len); |
| 178 | |
| 179 | //------------------------------------------------------------------ |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 180 | /// Sets the path to use for stdin/out/err for a process |
| 181 | /// that will be launched with the 'A' packet. |
| 182 | /// |
| 183 | /// @param[in] path |
| 184 | /// The path to use for stdin/out/err |
| 185 | /// |
| 186 | /// @return |
| 187 | /// Zero if the for success, or an error code for failure. |
| 188 | //------------------------------------------------------------------ |
| 189 | int |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 190 | SetSTDIN(const FileSpec &file_spec); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 191 | int |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 192 | SetSTDOUT(const FileSpec &file_spec); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 193 | int |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 194 | SetSTDERR(const FileSpec &file_spec); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 195 | |
| 196 | //------------------------------------------------------------------ |
| 197 | /// Sets the disable ASLR flag to \a enable for a process that will |
| 198 | /// be launched with the 'A' packet. |
| 199 | /// |
| 200 | /// @param[in] enable |
Jim Ingham | 106d028 | 2014-06-25 02:32:56 +0000 | [diff] [blame] | 201 | /// A boolean value indicating whether to disable ASLR or not. |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 202 | /// |
| 203 | /// @return |
| 204 | /// Zero if the for success, or an error code for failure. |
| 205 | //------------------------------------------------------------------ |
| 206 | int |
| 207 | SetDisableASLR (bool enable); |
Jim Ingham | 106d028 | 2014-06-25 02:32:56 +0000 | [diff] [blame] | 208 | |
| 209 | //------------------------------------------------------------------ |
| 210 | /// Sets the DetachOnError flag to \a enable for the process controlled by the stub. |
| 211 | /// |
| 212 | /// @param[in] enable |
| 213 | /// A boolean value indicating whether to detach on error or not. |
| 214 | /// |
| 215 | /// @return |
| 216 | /// Zero if the for success, or an error code for failure. |
| 217 | //------------------------------------------------------------------ |
| 218 | int |
| 219 | SetDetachOnError (bool enable); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 220 | |
| 221 | //------------------------------------------------------------------ |
| 222 | /// Sets the working directory to \a path for a process that will |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 223 | /// be launched with the 'A' packet for non platform based |
| 224 | /// connections. If this packet is sent to a GDB server that |
| 225 | /// implements the platform, it will change the current working |
| 226 | /// directory for the platform process. |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 227 | /// |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 228 | /// @param[in] working_dir |
Bruce Mitchener | d93c4a3 | 2014-07-01 21:22:11 +0000 | [diff] [blame] | 229 | /// The path to a directory to use when launching our process |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 230 | /// |
| 231 | /// @return |
| 232 | /// Zero if the for success, or an error code for failure. |
| 233 | //------------------------------------------------------------------ |
| 234 | int |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 235 | SetWorkingDir(const FileSpec &working_dir); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 236 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 237 | //------------------------------------------------------------------ |
| 238 | /// Gets the current working directory of a remote platform GDB |
| 239 | /// server. |
| 240 | /// |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 241 | /// @param[out] working_dir |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 242 | /// The current working directory on the remote platform. |
| 243 | /// |
| 244 | /// @return |
| 245 | /// Boolean for success |
| 246 | //------------------------------------------------------------------ |
| 247 | bool |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 248 | GetWorkingDir(FileSpec &working_dir); |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 249 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 250 | lldb::addr_t |
| 251 | AllocateMemory (size_t size, uint32_t permissions); |
| 252 | |
| 253 | bool |
| 254 | DeallocateMemory (lldb::addr_t addr); |
| 255 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 256 | Error |
Jim Ingham | acff895 | 2013-05-02 00:27:30 +0000 | [diff] [blame] | 257 | Detach (bool keep_stopped); |
Greg Clayton | 37a0a24 | 2012-04-11 00:24:49 +0000 | [diff] [blame] | 258 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 259 | Error |
| 260 | GetMemoryRegionInfo (lldb::addr_t addr, MemoryRegionInfo &range_info); |
Greg Clayton | 46fb558 | 2011-11-18 07:03:08 +0000 | [diff] [blame] | 261 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 262 | Error |
Johnny Chen | 6463720 | 2012-05-23 21:09:52 +0000 | [diff] [blame] | 263 | GetWatchpointSupportInfo (uint32_t &num); |
| 264 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 265 | Error |
Jaydeep Patil | 725666c | 2015-08-13 03:46:01 +0000 | [diff] [blame] | 266 | GetWatchpointSupportInfo (uint32_t &num, bool& after, const ArchSpec &arch); |
Enrico Granata | f04a219 | 2012-07-13 23:18:48 +0000 | [diff] [blame] | 267 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 268 | Error |
Jaydeep Patil | 725666c | 2015-08-13 03:46:01 +0000 | [diff] [blame] | 269 | GetWatchpointsTriggerAfterInstruction (bool &after, const ArchSpec &arch); |
Enrico Granata | f04a219 | 2012-07-13 23:18:48 +0000 | [diff] [blame] | 270 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 271 | const ArchSpec & |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 272 | GetHostArchitecture (); |
Greg Clayton | 9ac6d2d | 2013-10-25 18:13:17 +0000 | [diff] [blame] | 273 | |
| 274 | uint32_t |
| 275 | GetHostDefaultPacketTimeout(); |
Jason Molenda | f17b5ac | 2012-12-19 02:54:03 +0000 | [diff] [blame] | 276 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 277 | const ArchSpec & |
Jason Molenda | f17b5ac | 2012-12-19 02:54:03 +0000 | [diff] [blame] | 278 | GetProcessArchitecture (); |
| 279 | |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 280 | void |
| 281 | GetRemoteQSupported(); |
| 282 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 283 | bool |
| 284 | GetVContSupported (char flavor); |
| 285 | |
Jim Ingham | cd16df9 | 2012-07-20 21:37:13 +0000 | [diff] [blame] | 286 | bool |
Sean Callanan | b1de114 | 2013-09-04 23:24:15 +0000 | [diff] [blame] | 287 | GetpPacketSupported (lldb::tid_t tid); |
Hafiz Abid Qadeer | 9a78cdf | 2013-08-29 09:09:45 +0000 | [diff] [blame] | 288 | |
| 289 | bool |
Jason Molenda | bdc4f12 | 2014-05-06 02:59:39 +0000 | [diff] [blame] | 290 | GetxPacketSupported (); |
| 291 | |
| 292 | bool |
Jim Ingham | cd16df9 | 2012-07-20 21:37:13 +0000 | [diff] [blame] | 293 | GetVAttachOrWaitSupported (); |
| 294 | |
Jim Ingham | 279ceec | 2012-07-25 21:12:43 +0000 | [diff] [blame] | 295 | bool |
| 296 | GetSyncThreadStateSupported(); |
| 297 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 298 | void |
Greg Clayton | 2e59d4f | 2015-06-29 20:08:51 +0000 | [diff] [blame] | 299 | ResetDiscoverableSettings (bool did_exec); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 300 | |
| 301 | bool |
Greg Clayton | 9b1e1cd | 2011-04-04 18:18:57 +0000 | [diff] [blame] | 302 | GetHostInfo (bool force = false); |
Ewan Crawford | 78baa19 | 2015-05-13 09:18:18 +0000 | [diff] [blame] | 303 | |
| 304 | bool |
| 305 | GetDefaultThreadId (lldb::tid_t &tid); |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 306 | |
| 307 | bool |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 308 | GetOSVersion (uint32_t &major, |
| 309 | uint32_t &minor, |
| 310 | uint32_t &update); |
| 311 | |
| 312 | bool |
| 313 | GetOSBuildString (std::string &s); |
| 314 | |
| 315 | bool |
| 316 | GetOSKernelDescription (std::string &s); |
| 317 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 318 | ArchSpec |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 319 | GetSystemArchitecture (); |
| 320 | |
| 321 | bool |
| 322 | GetHostname (std::string &s); |
| 323 | |
Greg Clayton | 37a0a24 | 2012-04-11 00:24:49 +0000 | [diff] [blame] | 324 | lldb::addr_t |
| 325 | GetShlibInfoAddr(); |
| 326 | |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 327 | bool |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 328 | GetSupportsThreadSuffix (); |
| 329 | |
| 330 | bool |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 331 | GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info); |
Greg Clayton | 32e0a75 | 2011-03-30 18:16:51 +0000 | [diff] [blame] | 332 | |
| 333 | uint32_t |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 334 | FindProcesses (const ProcessInstanceInfoMatch &process_match_info, |
| 335 | ProcessInstanceInfoList &process_infos); |
Greg Clayton | 32e0a75 | 2011-03-30 18:16:51 +0000 | [diff] [blame] | 336 | |
| 337 | bool |
| 338 | GetUserName (uint32_t uid, std::string &name); |
| 339 | |
| 340 | bool |
| 341 | GetGroupName (uint32_t gid, std::string &name); |
| 342 | |
| 343 | bool |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 344 | HasFullVContSupport () |
| 345 | { |
| 346 | return GetVContSupported ('A'); |
| 347 | } |
| 348 | |
| 349 | bool |
| 350 | HasAnyVContSupport () |
| 351 | { |
| 352 | return GetVContSupported ('a'); |
| 353 | } |
| 354 | |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 355 | bool |
| 356 | GetStopReply (StringExtractorGDBRemote &response); |
| 357 | |
| 358 | bool |
Greg Clayton | f402f78 | 2012-10-13 02:11:55 +0000 | [diff] [blame] | 359 | GetThreadStopInfo (lldb::tid_t tid, |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 360 | StringExtractorGDBRemote &response); |
| 361 | |
| 362 | bool |
| 363 | SupportsGDBStoppointPacket (GDBStoppointType type) |
| 364 | { |
| 365 | switch (type) |
| 366 | { |
| 367 | case eBreakpointSoftware: return m_supports_z0; |
| 368 | case eBreakpointHardware: return m_supports_z1; |
| 369 | case eWatchpointWrite: return m_supports_z2; |
| 370 | case eWatchpointRead: return m_supports_z3; |
| 371 | case eWatchpointReadWrite: return m_supports_z4; |
Zachary Turner | 568b0de | 2015-02-18 18:44:03 +0000 | [diff] [blame] | 372 | default: return false; |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 373 | } |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 374 | } |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 375 | |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 376 | uint8_t |
| 377 | SendGDBStoppointTypePacket (GDBStoppointType type, // Type of breakpoint or watchpoint |
| 378 | bool insert, // Insert or remove? |
| 379 | lldb::addr_t addr, // Address of breakpoint or watchpoint |
| 380 | uint32_t length); // Byte Size of breakpoint or watchpoint |
| 381 | |
Ewan Crawford | 78baa19 | 2015-05-13 09:18:18 +0000 | [diff] [blame] | 382 | bool |
| 383 | SetNonStopMode (const bool enable); |
| 384 | |
Greg Clayton | 9b1e1cd | 2011-04-04 18:18:57 +0000 | [diff] [blame] | 385 | void |
Greg Clayton | e034a04 | 2015-05-21 20:52:06 +0000 | [diff] [blame] | 386 | TestPacketSpeed (const uint32_t num_packets, uint32_t max_send, uint32_t max_recv, bool json, Stream &strm); |
Greg Clayton | 9b1e1cd | 2011-04-04 18:18:57 +0000 | [diff] [blame] | 387 | |
| 388 | // This packet is for testing the speed of the interface only. Both |
| 389 | // the client and server need to support it, but this allows us to |
| 390 | // measure the packet speed without any other work being done on the |
| 391 | // other end and avoids any of that work affecting the packet send |
| 392 | // and response times. |
| 393 | bool |
| 394 | SendSpeedTestPacket (uint32_t send_size, |
| 395 | uint32_t recv_size); |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 396 | |
| 397 | bool |
Pavel Labath | 5c95ee4 | 2016-08-30 13:56:11 +0000 | [diff] [blame^] | 398 | SetCurrentThread (uint64_t tid); |
| 399 | |
| 400 | bool |
Jason Molenda | e9ca4af | 2013-02-23 02:04:45 +0000 | [diff] [blame] | 401 | SetCurrentThreadForRun (uint64_t tid); |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 402 | |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 403 | bool |
Steve Pucci | 03904ac | 2014-03-04 23:18:46 +0000 | [diff] [blame] | 404 | GetQXferAuxvReadSupported (); |
| 405 | |
| 406 | bool |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 407 | GetQXferLibrariesReadSupported (); |
| 408 | |
| 409 | bool |
| 410 | GetQXferLibrariesSVR4ReadSupported (); |
| 411 | |
| 412 | uint64_t |
| 413 | GetRemoteMaxPacketSize(); |
| 414 | |
| 415 | bool |
Greg Clayton | b30c50c | 2015-05-29 00:01:55 +0000 | [diff] [blame] | 416 | GetEchoSupported (); |
| 417 | |
| 418 | bool |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 419 | GetAugmentedLibrariesSVR4ReadSupported (); |
| 420 | |
Colin Riley | c3c95b2 | 2015-04-16 15:51:33 +0000 | [diff] [blame] | 421 | bool |
| 422 | GetQXferFeaturesReadSupported (); |
| 423 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 424 | LazyBool |
Jim Ingham | 372787f | 2012-04-07 00:00:41 +0000 | [diff] [blame] | 425 | SupportsAllocDeallocMemory () // const |
Greg Clayton | 2a48f52 | 2011-05-14 01:50:35 +0000 | [diff] [blame] | 426 | { |
Jim Ingham | 372787f | 2012-04-07 00:00:41 +0000 | [diff] [blame] | 427 | // Uncomment this to have lldb pretend the debug server doesn't respond to alloc/dealloc memory packets. |
| 428 | // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo; |
Greg Clayton | 70b5765 | 2011-05-15 01:25:55 +0000 | [diff] [blame] | 429 | return m_supports_alloc_dealloc_memory; |
Greg Clayton | 2a48f52 | 2011-05-14 01:50:35 +0000 | [diff] [blame] | 430 | } |
| 431 | |
Greg Clayton | adc00cb | 2011-05-20 23:38:13 +0000 | [diff] [blame] | 432 | size_t |
| 433 | GetCurrentThreadIDs (std::vector<lldb::tid_t> &thread_ids, |
| 434 | bool &sequence_mutex_unavailable); |
| 435 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 436 | lldb::user_id_t |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 437 | OpenFile (const FileSpec& file_spec, uint32_t flags, mode_t mode, Error &error); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 438 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 439 | bool |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 440 | CloseFile (lldb::user_id_t fd, Error &error); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 441 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 442 | lldb::user_id_t |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 443 | GetFileSize (const FileSpec& file_spec); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 444 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 445 | Error |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 446 | GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 447 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 448 | Error |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 449 | SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions); |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 450 | |
| 451 | uint64_t |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 452 | ReadFile (lldb::user_id_t fd, |
| 453 | uint64_t offset, |
| 454 | void *dst, |
| 455 | uint64_t dst_len, |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 456 | Error &error); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 457 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 458 | uint64_t |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 459 | WriteFile (lldb::user_id_t fd, |
| 460 | uint64_t offset, |
| 461 | const void* src, |
| 462 | uint64_t src_len, |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 463 | Error &error); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 464 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 465 | Error |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 466 | CreateSymlink(const FileSpec &src, |
| 467 | const FileSpec &dst); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 468 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 469 | Error |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 470 | Unlink(const FileSpec &file_spec); |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 471 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 472 | Error |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 473 | MakeDirectory(const FileSpec &file_spec, uint32_t mode); |
| 474 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 475 | bool |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 476 | GetFileExists (const FileSpec& file_spec); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 477 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 478 | Error |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 479 | RunShellCommand(const char *command, // Shouldn't be nullptr |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 480 | const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 481 | int *status_ptr, // Pass nullptr if you don't want the process exit status |
| 482 | int *signo_ptr, // Pass nullptr if you don't want the signal that caused the process to exit |
| 483 | std::string *command_output, // Pass nullptr if you don't want the command output |
Chaoren Lin | d3173f3 | 2015-05-29 19:52:29 +0000 | [diff] [blame] | 484 | uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish |
| 485 | |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 486 | bool |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 487 | CalculateMD5 (const FileSpec& file_spec, uint64_t &high, uint64_t &low); |
Daniel Malea | e0f8f57 | 2013-08-26 23:57:52 +0000 | [diff] [blame] | 488 | |
Pavel Labath | b42b48e | 2016-08-19 12:31:49 +0000 | [diff] [blame] | 489 | lldb::DataBufferSP |
Greg Clayton | f74cf86 | 2013-11-13 23:28:31 +0000 | [diff] [blame] | 490 | ReadRegister(lldb::tid_t tid, |
Pavel Labath | 5c95ee4 | 2016-08-30 13:56:11 +0000 | [diff] [blame^] | 491 | uint32_t reg_num); // Must be the eRegisterKindProcessPlugin register number |
Greg Clayton | f74cf86 | 2013-11-13 23:28:31 +0000 | [diff] [blame] | 492 | |
Pavel Labath | b42b48e | 2016-08-19 12:31:49 +0000 | [diff] [blame] | 493 | lldb::DataBufferSP |
Pavel Labath | 5c95ee4 | 2016-08-30 13:56:11 +0000 | [diff] [blame^] | 494 | ReadAllRegisters(lldb::tid_t tid); |
Greg Clayton | f74cf86 | 2013-11-13 23:28:31 +0000 | [diff] [blame] | 495 | |
| 496 | bool |
Pavel Labath | 56d7262 | 2016-08-17 08:53:31 +0000 | [diff] [blame] | 497 | WriteRegister(lldb::tid_t tid, uint32_t reg_num, // eRegisterKindProcessPlugin register number |
Pavel Labath | 5c95ee4 | 2016-08-30 13:56:11 +0000 | [diff] [blame^] | 498 | llvm::ArrayRef<uint8_t> data); |
Pavel Labath | 56d7262 | 2016-08-17 08:53:31 +0000 | [diff] [blame] | 499 | |
| 500 | bool |
Pavel Labath | 5c95ee4 | 2016-08-30 13:56:11 +0000 | [diff] [blame^] | 501 | WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data); |
Pavel Labath | 56d7262 | 2016-08-17 08:53:31 +0000 | [diff] [blame] | 502 | |
| 503 | bool |
| 504 | SaveRegisterState(lldb::tid_t tid, uint32_t &save_id); |
| 505 | |
Greg Clayton | f74cf86 | 2013-11-13 23:28:31 +0000 | [diff] [blame] | 506 | bool |
| 507 | RestoreRegisterState (lldb::tid_t tid, uint32_t save_id); |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 508 | |
Pavel Labath | 27402d2 | 2016-08-18 12:32:41 +0000 | [diff] [blame] | 509 | bool |
| 510 | SyncThreadState(lldb::tid_t tid); |
| 511 | |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 512 | const char * |
| 513 | GetGDBServerProgramName(); |
Greg Clayton | f74cf86 | 2013-11-13 23:28:31 +0000 | [diff] [blame] | 514 | |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 515 | uint32_t |
| 516 | GetGDBServerProgramVersion(); |
| 517 | |
| 518 | bool |
| 519 | AvoidGPackets(ProcessGDBRemote *process); |
| 520 | |
Greg Clayton | 358cf1e | 2015-06-25 21:46:34 +0000 | [diff] [blame] | 521 | StructuredData::ObjectSP |
| 522 | GetThreadsInfo(); |
| 523 | |
Jason Molenda | 705b180 | 2014-06-13 02:37:02 +0000 | [diff] [blame] | 524 | bool |
| 525 | GetThreadExtendedInfoSupported(); |
| 526 | |
Oleksiy Vyalov | 6801be3 | 2015-02-25 22:15:44 +0000 | [diff] [blame] | 527 | bool |
Jason Molenda | 20ee21b | 2015-07-10 23:15:22 +0000 | [diff] [blame] | 528 | GetLoadedDynamicLibrariesInfosSupported(); |
| 529 | |
| 530 | bool |
Jason Molenda | 3739735 | 2016-07-22 00:17:55 +0000 | [diff] [blame] | 531 | GetSharedCacheInfoSupported(); |
| 532 | |
| 533 | bool |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 534 | GetModuleInfo (const FileSpec& module_file_spec, |
| 535 | const ArchSpec& arch_spec, |
| 536 | ModuleSpec &module_spec); |
Oleksiy Vyalov | 6801be3 | 2015-02-25 22:15:44 +0000 | [diff] [blame] | 537 | |
Colin Riley | c3c95b2 | 2015-04-16 15:51:33 +0000 | [diff] [blame] | 538 | bool |
| 539 | ReadExtFeature (const lldb_private::ConstString object, |
| 540 | const lldb_private::ConstString annex, |
| 541 | std::string & out, |
| 542 | lldb_private::Error & err); |
| 543 | |
Greg Clayton | 0b90be1 | 2015-06-23 21:27:50 +0000 | [diff] [blame] | 544 | void |
| 545 | ServeSymbolLookups(lldb_private::Process *process); |
| 546 | |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 547 | //------------------------------------------------------------------ |
| 548 | /// Return the feature set supported by the gdb-remote server. |
| 549 | /// |
| 550 | /// This method returns the remote side's response to the qSupported |
| 551 | /// packet. The response is the complete string payload returned |
| 552 | /// to the client. |
| 553 | /// |
| 554 | /// @return |
| 555 | /// The string returned by the server to the qSupported query. |
| 556 | //------------------------------------------------------------------ |
| 557 | const std::string& |
| 558 | GetServerSupportedFeatures() const |
| 559 | { |
| 560 | return m_qSupported_response; |
| 561 | } |
| 562 | |
| 563 | //------------------------------------------------------------------ |
| 564 | /// Return the array of async JSON packet types supported by the remote. |
| 565 | /// |
| 566 | /// This method returns the remote side's array of supported JSON |
| 567 | /// packet types as a list of type names. Each of the results are |
| 568 | /// expected to have an Enable{type_name} command to enable and configure |
| 569 | /// the related feature. Each type_name for an enabled feature will |
| 570 | /// possibly send async-style packets that contain a payload of a |
| 571 | /// binhex-encoded JSON dictionary. The dictionary will have a |
| 572 | /// string field named 'type', that contains the type_name of the |
| 573 | /// supported packet type. |
| 574 | /// |
| 575 | /// There is a Plugin category called structured-data plugins. |
| 576 | /// A plugin indicates whether it knows how to handle a type_name. |
| 577 | /// If so, it can be used to process the async JSON packet. |
| 578 | /// |
| 579 | /// @return |
| 580 | /// The string returned by the server to the qSupported query. |
| 581 | //------------------------------------------------------------------ |
| 582 | lldb_private::StructuredData::Array* |
| 583 | GetSupportedStructuredDataPlugins(); |
| 584 | |
| 585 | //------------------------------------------------------------------ |
| 586 | /// Configure a StructuredData feature on the remote end. |
| 587 | /// |
| 588 | /// @see \b Process::ConfigureStructuredData(...) for details. |
| 589 | //------------------------------------------------------------------ |
| 590 | Error |
| 591 | ConfigureRemoteStructuredData(const ConstString &type_name, |
| 592 | const StructuredData::ObjectSP &config_sp); |
| 593 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 594 | protected: |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 595 | LazyBool m_supports_not_sending_acks; |
| 596 | LazyBool m_supports_thread_suffix; |
| 597 | LazyBool m_supports_threads_in_stop_reply; |
| 598 | LazyBool m_supports_vCont_all; |
| 599 | LazyBool m_supports_vCont_any; |
| 600 | LazyBool m_supports_vCont_c; |
| 601 | LazyBool m_supports_vCont_C; |
| 602 | LazyBool m_supports_vCont_s; |
| 603 | LazyBool m_supports_vCont_S; |
| 604 | LazyBool m_qHostInfo_is_valid; |
| 605 | LazyBool m_curr_pid_is_valid; |
| 606 | LazyBool m_qProcessInfo_is_valid; |
| 607 | LazyBool m_qGDBServerVersion_is_valid; |
| 608 | LazyBool m_supports_alloc_dealloc_memory; |
| 609 | LazyBool m_supports_memory_region_info; |
| 610 | LazyBool m_supports_watchpoint_support_info; |
| 611 | LazyBool m_supports_detach_stay_stopped; |
| 612 | LazyBool m_watchpoints_trigger_after_instruction; |
| 613 | LazyBool m_attach_or_wait_reply; |
| 614 | LazyBool m_prepare_for_reg_writing_reply; |
| 615 | LazyBool m_supports_p; |
| 616 | LazyBool m_supports_x; |
| 617 | LazyBool m_avoid_g_packets; |
| 618 | LazyBool m_supports_QSaveRegisterState; |
| 619 | LazyBool m_supports_qXfer_auxv_read; |
| 620 | LazyBool m_supports_qXfer_libraries_read; |
| 621 | LazyBool m_supports_qXfer_libraries_svr4_read; |
Colin Riley | c3c95b2 | 2015-04-16 15:51:33 +0000 | [diff] [blame] | 622 | LazyBool m_supports_qXfer_features_read; |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 623 | LazyBool m_supports_augmented_libraries_svr4_read; |
| 624 | LazyBool m_supports_jThreadExtendedInfo; |
Jason Molenda | 20ee21b | 2015-07-10 23:15:22 +0000 | [diff] [blame] | 625 | LazyBool m_supports_jLoadedDynamicLibrariesInfos; |
Jason Molenda | 3739735 | 2016-07-22 00:17:55 +0000 | [diff] [blame] | 626 | LazyBool m_supports_jGetSharedCacheInfo; |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 627 | |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 628 | bool |
| 629 | m_supports_qProcessInfoPID:1, |
| 630 | m_supports_qfProcessInfo:1, |
| 631 | m_supports_qUserName:1, |
| 632 | m_supports_qGroupName:1, |
| 633 | m_supports_qThreadStopInfo:1, |
| 634 | m_supports_z0:1, |
| 635 | m_supports_z1:1, |
| 636 | m_supports_z2:1, |
| 637 | m_supports_z3:1, |
Greg Clayton | 8960058 | 2013-10-10 17:53:50 +0000 | [diff] [blame] | 638 | m_supports_z4:1, |
| 639 | m_supports_QEnvironment:1, |
Greg Clayton | 0b90be1 | 2015-06-23 21:27:50 +0000 | [diff] [blame] | 640 | m_supports_QEnvironmentHexEncoded:1, |
Greg Clayton | 358cf1e | 2015-06-25 21:46:34 +0000 | [diff] [blame] | 641 | m_supports_qSymbol:1, |
Jason Molenda | 50018d3 | 2016-01-13 04:08:10 +0000 | [diff] [blame] | 642 | m_qSymbol_requests_done:1, |
Stephane Sezer | 6f45529 | 2016-01-08 00:00:17 +0000 | [diff] [blame] | 643 | m_supports_qModuleInfo:1, |
Greg Clayton | 358cf1e | 2015-06-25 21:46:34 +0000 | [diff] [blame] | 644 | m_supports_jThreadsInfo:1; |
Greg Clayton | 2a48f52 | 2011-05-14 01:50:35 +0000 | [diff] [blame] | 645 | |
Todd Fiala | 9f72b3a | 2014-05-07 19:28:21 +0000 | [diff] [blame] | 646 | lldb::pid_t m_curr_pid; |
Greg Clayton | 8b82f08 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 647 | lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all other operations |
| 648 | lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for continue, step, etc |
| 649 | |
Johnny Chen | 6463720 | 2012-05-23 21:09:52 +0000 | [diff] [blame] | 650 | uint32_t m_num_supported_hardware_watchpoints; |
| 651 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 652 | ArchSpec m_host_arch; |
| 653 | ArchSpec m_process_arch; |
Greg Clayton | 1cb6496 | 2011-03-24 04:28:38 +0000 | [diff] [blame] | 654 | uint32_t m_os_version_major; |
| 655 | uint32_t m_os_version_minor; |
| 656 | uint32_t m_os_version_update; |
| 657 | std::string m_os_build; |
| 658 | std::string m_os_kernel; |
| 659 | std::string m_hostname; |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 660 | std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if qGDBServerVersion is not supported |
| 661 | uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if qGDBServerVersion is not supported |
Greg Clayton | 9ac6d2d | 2013-10-25 18:13:17 +0000 | [diff] [blame] | 662 | uint32_t m_default_packet_timeout; |
Steve Pucci | 5ae54ae | 2014-01-25 05:46:51 +0000 | [diff] [blame] | 663 | uint64_t m_max_packet_size; // as returned by qSupported |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 664 | std::string m_qSupported_response; // the complete response to qSupported |
| 665 | |
| 666 | bool m_supported_async_json_packets_is_valid; |
| 667 | lldb_private::StructuredData::ObjectSP m_supported_async_json_packets_sp; |
Jason Molenda | 91ffe0a | 2015-06-18 21:46:06 +0000 | [diff] [blame] | 668 | |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 669 | bool |
| 670 | GetCurrentProcessInfo (bool allow_lazy_pid = true); |
| 671 | |
| 672 | bool |
| 673 | GetGDBServerVersion(); |
| 674 | |
| 675 | // Given the list of compression types that the remote debug stub can support, |
| 676 | // possibly enable compression if we find an encoding we can handle. |
| 677 | void |
| 678 | MaybeEnableCompression (std::vector<std::string> supported_compressions); |
| 679 | |
Greg Clayton | 32e0a75 | 2011-03-30 18:16:51 +0000 | [diff] [blame] | 680 | bool |
| 681 | DecodeProcessInfoResponse (StringExtractorGDBRemote &response, |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 682 | ProcessInstanceInfo &process_info); |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 683 | |
Pavel Labath | 8c1b6bd | 2016-08-09 12:04:46 +0000 | [diff] [blame] | 684 | void |
| 685 | OnRunPacketSent(bool first) override; |
| 686 | |
Pavel Labath | 4b6f959 | 2016-08-18 08:30:03 +0000 | [diff] [blame] | 687 | PacketResult |
| 688 | SendThreadSpecificPacketAndWaitForResponse(lldb::tid_t tid, StreamString &&payload, |
Pavel Labath | 5c95ee4 | 2016-08-30 13:56:11 +0000 | [diff] [blame^] | 689 | StringExtractorGDBRemote &response, bool send_async); |
Pavel Labath | 4b6f959 | 2016-08-18 08:30:03 +0000 | [diff] [blame] | 690 | |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 691 | private: |
Greg Clayton | 576d883 | 2011-03-22 04:00:09 +0000 | [diff] [blame] | 692 | DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient); |
| 693 | }; |
| 694 | |
Tamas Berghammer | db264a6 | 2015-03-31 09:52:22 +0000 | [diff] [blame] | 695 | } // namespace process_gdb_remote |
| 696 | } // namespace lldb_private |
| 697 | |
Eugene Zelenko | edb35d9 | 2015-10-24 01:08:35 +0000 | [diff] [blame] | 698 | #endif // liblldb_GDBRemoteCommunicationClient_h_ |