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