summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move several plugin to its own namespaceTamas Berghammer2015-03-311-0/+1
| | | | | | | | | | | | | Affected paths: * Plugins/Platform/Android/* * Plugins/Platform/Linux/* * Plugins/Platform/gdb-server/* * Plugins/Process/Linux/* * Plugins/Process/gdb-remote/* Differential revision: http://reviews.llvm.org/D8654 llvm-svn: 233679
* Fetch module specification from remote process alsoTamas Berghammer2015-03-241-6/+59
| | | | | | | | | | | | | Previously the remote module sepcification was fetched only from the remote platform. With this CL if we have a remote process then we ask it if it have any information from a given module. It is required because on android the dynamic linker only reports the name of the SO file and the platform can't always find it without a full path (the process can do it based on /proc/<pid>/maps). Differential revision: http://reviews.llvm.org/D8547 llvm-svn: 233061
* Convert open options for POSIX open on target platform.Robert Flack2015-03-181-2/+1
| | | | | | | | | | | | | | | | | | | | This moves the conversion of the open options to the target platform. On mac fcntl.h has different values for O_CREAT and O_TRUNC than on linux so by transmitting the standardized lldb open options we can correctly convert them on the target platform. Test Plan: On linux: lldb-server p --listen *:1234 On mac: lldb platform select remote-linux platform connect connect://ip-of-linux-box:1234 target create ~/path/to/linux/binary b main process launch Binary is successfully pushed to linux remote, process successfully launches and break in the main method. Differential Revision: http://reviews.llvm.org/D8395 llvm-svn: 232634
* Add Utility/ModuleCache class and integrate it with PlatformGDBRemoteServer ↵Oleksiy Vyalov2015-03-101-1/+2
| | | | | | | | - in order to allow modules caching from remote targets. http://reviews.llvm.org/D8037 llvm-svn: 231734
* Further reduce the header footprint of Process.hZachary Turner2015-03-031-0/+1
| | | | | | | No functional change here, only deletes unnecessary headers and moves one function's body from the .h file to the .cpp. llvm-svn: 231145
* Fix FileSpec::GetPath to return null-terminated stringsIlia K2015-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this fix the FileSpec::GetPath() returned string which might be without '\0' at the end. It could have happened if the size of buffer for path was less than actual path. Test case: ``` FileSpec test("/path/to/file", false); char buf[]="!!!!!!"; test.GetPath(buf, 3); ``` Before fix: ``` 233 FileSpec test("/path/to/file", false); 234 char buf[]="!!!!!!"; 235 test.GetPath(buf, 3); 236 -> 237 if (core_file) 238 { 239 if (!core_file.Exists()) 240 { (lldb) print buf (char [7]) $0 = "/pa!!!" ``` After fix: ``` 233 FileSpec test("/path/to/file", false); 234 char buf[]="!!!!!!"; 235 test.GetPath(buf, 3); 236 -> 237 if (core_file) 238 { 239 if (!core_file.Exists()) 240 { (lldb) print buf (char [7]) $0 = "/p" ``` Reviewers: zturner, abidh, clayborg Reviewed By: abidh, clayborg Subscribers: tberghammer, vharron, lldb-commits, clayborg, zturner, abidh Differential Revision: http://reviews.llvm.org/D7553 llvm-svn: 230787
* Add qModuleInfo request in order to get module information (uuid, triple,..) ↵Oleksiy Vyalov2015-02-251-0/+18
| | | | | | | | by module path from remote platform. http://reviews.llvm.org/D7709 llvm-svn: 230556
* Create ScopedTimeout class for GDBRemoteCommunicationTamas Berghammer2015-02-241-9/+5
| | | | | | | | | | This new class makes it easier to change the timeout of a GDBRemoteCommunication instance for a short time and then restore it to its original value. Differential revision: http://reviews.llvm.org/D7826 llvm-svn: 230319
* Fix the communication in qPlatform_[mkdir,chmod]Tamas Berghammer2015-02-231-11/+15
| | | | | | | | | | | | With the previous implementation the protocol used by the client and the server for the response was different and worked only by an accident. With this change the communication is fixed and the return code from mkdir and chmod correctly captured by lldb. The change also add documentation for the qPlatform__[mkdir,chmod] packages. Differential revision: http://reviews.llvm.org/D7786 llvm-svn: 230213
* Separate monolithic GDBRemoteCommunicationServer class into 4 partTamas Berghammer2015-02-111-2/+2
| | | | | | | | | | | GDBRemoteCommunicationServer: Basic packet handling, handler registration LLDBCommonPacketHandler: Common packet handling for lldb-platform and lldb-gdbserver LLDBPlatformPacketHandler: lldb-platform specific packet handling LLGSPacketHandler: lldb-gdbserver specific packet handling Differential Revision: http://reviews.llvm.org/D7538 llvm-svn: 228823
* Add support for SBProcess::PutSTDIN to remote processesVince Harron2015-02-061-0/+15
| | | | | | | | | | | | | | Processes running on a remote target can already send $O messages to send stdout but there is no way to send stdin to a remote inferior. This allows processes using the API to pump stdin into a remote inferior process. It fixes a hang in TestProcessIO.py when running against a remote target. llvm-svn: 228419
* Extend SBPlatform with capability to launch/terminate a process remotely. ↵Oleksiy Vyalov2015-02-041-8/+11
| | | | | | | | Integrate this change into test framework in order to spawn processes on a remote target. http://reviews.llvm.org/D7263 llvm-svn: 228230
* Add missing switch cases to silence warnings.Chaoren Lin2015-02-031-0/+1
| | | | llvm-svn: 227931
* This patch gets remote-linux platform able to run processesVince Harron2015-01-211-1/+5
| | | | | | | | | | | | | | | | Make sure the selected platform is always used Make sure that the host uses the connect://hostname to connect to both the lldb-platform and the lldb-gdbserver rather than what the platform reports as the hostname of the lldb-gdbserver Make sure that lldb-platform uses the IP address on it's connection back to the host instead of the hostname that the host sends to it when launching lldb-gdbserver with the remote host information Tested on OSX and Linux llvm-svn: 226712
* Moved Args::StringToXIntYZ to StringConvert::ToXIntYZVince Harron2015-01-151-22/+23
| | | | | | | | | | The refactor was motivated by some comments that Greg made http://reviews.llvm.org/D6918 and also to break a dependency cascade that caused functions linking in string->int conversion functions to pull in most of lldb llvm-svn: 226199
* Added a bit of logging around ↵Todd Fiala2014-10-091-0/+5
| | | | | | GDBRemoteCommunicationClient::SendGDBStoppointTypePacket. llvm-svn: 219374
* Move ConnectionFileDescriptor to platform-specific Host directory.Zachary Turner2014-10-061-1/+1
| | | | | | | | | | | | As part of getting ConnectionFileDescriptor working on Windows, there is going to be alot of platform specific work to be done. As a result, the implementation is moving into Host. This patch performs the code move and fixes up call-sites appropriately. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5548 llvm-svn: 219143
* Hex encode the triple values in case they contain special characters.Greg Clayton2014-09-181-2/+11
| | | | llvm-svn: 218001
* Properly decode architecture type in ↵Todd Fiala2014-09-151-1/+21
| | | | | | | | | | | | | | | | | | | GDBRemoteCommunicationClient::GetCurrentProcessInfo. Instead of forcing the remote arch type to MachO all the time, we inspect the OS/vendor that the remote debug server reports and use it to set the arch type to MachO, ELF or COFF accordingly. See thread here for more context: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140915/012968.html Change by Stephane Sezer. Tested: MacOSX 10.9.4 x86_64 Ubuntu 14.04 x86_64 llvm-svn: 217779
* Check for byte order correctness in ↵Todd Fiala2014-09-151-4/+14
| | | | | | | | | | | | | | GDBRemoteCommunicationClient::GetCurrentProcessInfo. This is useful for checking inconsistencies between what the remote debug server thinks we are debugging and we think we are debugging. This follows the check for pointer byte size done just above. Change by Stephane Sezer. Tested: Ubuntu 14.04 x86_64, llvm-3.5-built lldb MacOSX 10.9.4, Xcode-Beta(2014-09-09)-built lldb. llvm-svn: 217773
* Set the process vendor in GDBRemoteCommunicationClient::GetCurrentProcessInfo.Todd Fiala2014-09-051-0/+1
| | | | | | Change by Stephane Sezer. llvm-svn: 217252
* Fix llgs to send triple for non-Apple platforms and lldb to interpret correctly.Todd Fiala2014-08-261-1/+16
| | | | | | | | | | | | | This change addresses this bug: http://llvm.org/bugs/show_bug.cgi?id=20755 This change: * Modifies llgs to send triple instead of cputype and cpusubtype when not on Apple platforms in qProcessInfo. * Modifies lldb's GDBRemoteCommunicationClient to handle the triple returned from qProcessInfo if given. When given, it will prefer to use triple over cputype and cpusubtype. * Adds gdb-remote protocol tests to verify that cputype and cpusubtype are specified on darwin, and that triple is specified on Linux. llvm-svn: 216470
* Move some Host logic into HostInfo class.Zachary Turner2014-08-191-1/+2
| | | | | | | | | | | | | | | | | | This patch creates a HostInfo class, a static class used to answer basic queries about the host platform. As part of this change, some functionality is moved from Host to HostInfo, and relevant fixups are performed in the rest of the codebase. This is part of a larger effort to isolate more code in the Host layer into platform-specific groups, to make it easier to make platform specific changes for a particular Host without breaking other hosts. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4963 llvm-svn: 215992
* Change the encoding of the Triple string exchanged across GDB-RSPMatthew Gardiner2014-08-011-9/+2
| | | | | | | | | | | and update documentation to suit, as suggested by Jason Molenda and discussed in: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140721/011978.html Differential Revision: http://reviews.llvm.org/D4704 llvm-svn: 214480
* Increase the gdb-remote packet timeout for the first packet we sendJason Molenda2014-07-241-1/+11
| | | | | | | | | | | | | to the remote side (QStartNoAckMode) - it may take a little longer than normal to get a reply. In debugserver, hardcode the priority for several threads so they aren't de-prioritized when a user app is using system resources. Also, set the names of the threads. <rdar://problem/17509866> llvm-svn: 213828
* Update lldb to track recent Triple arm64 enum removal and collapse into aarch64.Todd Fiala2014-07-231-3/+3
| | | | | | | | | | | See the following llvm change for details: r213743 | tnorthover | 2014-07-23 05:32:47 -0700 (Wed, 23 Jul 2014) | 9 lines AArch64: remove arm64 triple enumerator. This change fixes build breaks on Linux and MacOSX lldb. llvm-svn: 213755
* Fix typos.Bruce Mitchener2014-07-011-5/+5
| | | | llvm-svn: 212132
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-301-0/+5
| | | | | | | | | | | | | | | | | | | | | This change brings in lldb-gdbserver (llgs) specifically for Linux x86_64. (More architectures coming soon). Not every debugserver option is covered yet. Currently the lldb-gdbserver command line can start unattached, start attached to a pid (process-name attach not supported yet), or accept lldb attaching and launching a process or connecting by process id. The history of this large change can be found here: https://github.com/tfiala/lldb/tree/dev-tfiala-native-protocol-linux-x86_64 Until mid/late April, I was not sharing the work and continued to rebase it off of head (developed via id tfiala@google.com). I switched over to user todd.fiala@gmail.com in the middle, and once I went to github, I did merges rather than rebasing so I could share with others. llvm-svn: 212069
* lldb: remove adhoc implementation of array_sizeofSaleem Abdulrasool2014-06-271-2/+3
| | | | | | | | Replace adhoc inline implementation of llvm::array_lengthof in favour of the implementation in LLVM. This is simply a cleanup change, no functional change intended. llvm-svn: 211868
* Added an option to turn OFF the "detach on error" behavior that was addedJim Ingham2014-06-251-0/+19
| | | | | | | | to debugserver when launching processes. <rdar://problem/16216199> llvm-svn: 211658
* Fix a gdbremote bug in _M/_m stub support detection.Todd Fiala2014-06-211-2/+6
| | | | | | | | | | | | When a stub reported $#00 (unsupported) for _M and _m packets, the unsupported response was not handled and the client then marked the _M/_m commands as definitely supported. However, they would always fail, preventing lldb's fallback InferiorCallMmap-based allocation strategy from being used to attempt to allocate memory in the inferior process space. llvm-svn: 211425
* Remove unused variablesSaleem Abdulrasool2014-06-131-10/+4
| | | | | | | | Address the 'variable set but not used' warning from GCC. In some cases a few additional calls were removed where there should be no visible side effects of the calls (i.e. should not effect any cached state). llvm-svn: 210879
* Initial merge of some of the iOS 8 / Mac OS X Yosemite specificJason Molenda2014-06-131-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lldb support. I'll be doing more testing & cleanup but I wanted to get the initial checkin done. This adds a new SBExpressionOptions::SetLanguage API for selecting a language of an expression. I added adds a new SBThread::GetInfoItemByPathString for retriving information about a thread from that thread's StructuredData. I added a new StructuredData class for representing key-value/array/dictionary information (e.g. JSON formatted data). Helper functions to read JSON and create a StructuredData object, and to print a StructuredData object in JSON format are included. A few Cocoa / Cocoa Touch data formatters were updated by Enrico to track changes in iOS 8 / Yosemite. Before we query a thread's extended information, the system runtime may provide hints to the remote debug stub that it will use to retrieve values out of runtime structures. I added a new SystemRuntime method AddThreadExtendedInfoPacketHints which allows the SystemRuntime to add key-value type data to the initial request that we send to the remote stub. The thread-format formatter string can now retrieve values out of a thread's extended info structured data. The default thread-format string picks up two of these - thread.info.activity.name and thread.info.trace_messages. I added a new "jThreadExtendedInfo" packet in debugserver; I will add documentation to the lldb-gdb-remote.txt doc soon. It accepts JSON formatted arguments (most importantly, "thread":threadnum) and it returns a variety of information regarding the thread to lldb in JSON format. This JSON return is scanned into a StructuredData object that is associated with the thread; UI layers can query the thread's StructuredData to see if key-values are present, and if so, show them to the user. These key-values are likely to be specific to different targets with some commonality among many targets. For instance, many targets will be able to advertise the pthread_t value for a thread. I added an initial rough cut of "thread info" command which will print the information about a thread from the jThreadExtendedInfo result. I need to do more work to make this format reasonably. Han Ming added calls into the pmenergy and pmsample libraries if debugserver is run on Mac OS X Yosemite to get information about the inferior's power use. I added support to debugserver for gathering the Genealogy information about threads, if it exists, and returning it in the jThreadExtendedInfo JSON result. llvm-svn: 210874
* iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator ↵Greg Clayton2014-05-291-1/+2
| | | | | | | | | | | | | | | | | | apps and binaries. Changes include: - ObjectFileMachO can now determine if a binary is "*-apple-ios" or "*-apple-macosx" by checking the min OS and SDK load commands - ArchSpec now says "<arch>-apple-macosx" is equivalent to "<arch>-apple-ios" since the simulator mixes and matches binaries (some from the system and most from the iOS SDK). - Getting process inforamtion on MacOSX now correctly classifies iOS simulator processes so they have "*-apple-ios" architectures in the ProcessInstanceInfo - PlatformiOSSimulator can now list iOS simulator processes correctly instead of showing nothing by using: (lldb) platform select ios-simulator (lldb) platform process list - debugserver can now properly return "*-apple-ios" for the triple in the process info packets for iOS simulator executables - GDBRemoteCommunicationClient now correctly passes along the triples it gets for process info by setting the OS in the llvm::Triple correctly <rdar://problem/17060217> llvm-svn: 209852
* Fix Windows warnings.Todd Fiala2014-05-281-1/+1
| | | | | | | | | | This fixes a number of trivial warnings in the Windows build. This is part of a larger effort to make the Windows build warning-free. See http://reviews.llvm.org/D3914 for more details. Change by Zachary Turner llvm-svn: 209749
* lldb: gdb remote support always falls back to $qC when no $qProcessInfo.Todd Fiala2014-05-141-15/+12
| | | | | | | | | | | | See thread here: http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-May/003992.html This is meant to address case 3 that I recently broke with an earlier change to rectify usage of the $qC message for thread ids, specifically: 3. TOT lldb <=> gdbserver (without $qProcessInfo support and not Apple/iOS). llvm-svn: 208741
* Modify debugserver to follow gdb remote $qC protocol definition.Todd Fiala2014-05-071-5/+50
| | | | | | | | | | $qC from debugserver now returns the current thread's thread-id (and, like $?, will set a current thread if one is not already selected). Previously it was returning the current process id. lldb will now query $qProcessInfo to retrieve the process id. The process id is now cached lazily and reset like other cached values. Retrieval of the process id will fall back to the old $qC method for vendor==Apple and os==iOS if the qProcessInfo retrieval fails. Added a gdb remote protocol-level test to verify that $qProcessInfo reports a valid process id after launching a process, while the process is in the initial stopped state. Verifies the given process id is a currently valid process on host OSes for which we know how to check (MacOSX, Linux, {Free/Net}BSD). Ignores the live process check for OSes where we don't know how to do this. (I saw no portable way to do this in stock Python without pulling in other libs). llvm-svn: 208241
* Add GetxPacketSupported to test if the 'x' packet is supported.Jason Molenda2014-05-061-0/+20
| | | | | | <rdar://problem/16032150> llvm-svn: 208052
* m_interrupt_sent wasn't being initialized, and wasn't being reset after anJim Ingham2014-04-161-0/+3
| | | | | | interrupt. Do both of those. llvm-svn: 206350
* sanitise sign comparisonsSaleem Abdulrasool2014-04-021-1/+1
| | | | | | | | This is a mechanical change addressing the various sign comparison warnings that are identified by both clang and gcc. This helps cleanup some of the warning spew that occurs during builds. llvm-svn: 205390
* lldb arm64 import.Jason Molenda2014-03-291-0/+149
| | | | | | | | | | | | | | | | These changes were written by Greg Clayton, Jim Ingham, Jason Molenda. It builds cleanly against TOT llvm with xcodebuild. I updated the cmake files by visual inspection but did not try a build. I haven't built these sources on any non-Mac platforms - I don't think this patch adds any code that requires darwin, but please let me know if I missed something. In debugserver, MachProcess.cpp and MachTask.cpp were renamed to MachProcess.mm and MachTask.mm as they picked up some new Objective-C code needed to launch processes when running on iOS. llvm-svn: 205113
* Wait for the reply from the 'D' detach packet before tearing down the ↵Jim Ingham2014-03-281-2/+4
| | | | | | | | | | | | debugger. Avoids a race condition where we could end up killing debugserver (and thus the target) before it had a chance to detach. Also fix debugserver to send the OK AFTER it detaches to avoid the same race condition. <rdar://problem/16202713> llvm-svn: 205043
* Add ProcessGDBRemote::GetAuxvData() and fix multiple-packet concatenation ↵Steve Pucci2014-03-041-6/+18
| | | | | | | | | | for binary data. ProcessGDBRemote::GetAuxvData obtains the auxv from a remote gdbserver (via a binary-data packet), and returns the data as a DataBufferSP. The patch includes a small fix to GDBRemoteCommunicationClient::SendPacketsAndConcatenateResponses() to support binary file format packet returns (by not assuming each binary packet is a null-terminated string when concatenating them). llvm-svn: 202907
* remove useless declarationSylvestre Ledru2014-02-261-2/+0
| | | | llvm-svn: 202281
* Patch for fixing the handling of hardware breakpoints.Deepak Panickal2014-02-241-16/+18
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2826 llvm-svn: 202028
* Improved the GDBRemoteCommunicationClient::TestPacketSpeed() function so it ↵Greg Clayton2014-02-211-32/+68
| | | | | | tests how long it takes to send a 4MB buffer from the REMOTE GDB server to LLDB. llvm-svn: 201875
* Change DecodeProcessInfoResponse to set the ProcessInfo's architecture Jason Molenda2014-01-271-0/+31
| | | | | | | | | if the remote stub provided enough information to identify it in the qProcessInfo packet response. (e.g. for an Apple device where we know it is Mach-O, the cpu type & cpu sub type). <rdar://problem/15847901> llvm-svn: 200253
* Support for debugging against a remote stock gdbserver.Steve Pucci2014-01-251-1/+146
| | | | | | | | | | There are a couple of pieces: * some lazy-evaluation members that store info listed in a qSupported response * new method SendPacketsAndConcatenateResponses which is used for fetching fixed-size objects from the remote gdbserver by using multiple packets if necessary (first use will be to fetch shared-library XML files). llvm-svn: 200072
* Added distribution info to ArchSpec and qHostInfo message.Todd Fiala2014-01-181-1/+11
| | | | | | | | | | | | | | | | | | | ArchSpec now contains an optional distribution_id, with getters and setters. Host::GetArchitecture () sets it on non-Apple platforms using Host::GetDistributionId (). The distribution_id is ignored during ArchSpec comparisons. The gdb remote qHostInfo message transmits it, if set, via the distribution_id={id-value} key/value pair. Updated gdb remote docs to reflect this change. As before, GetDistributionId () returns nothing on non-Linux platforms at this time. On Linux, it is returned only if the lsb_platform command is installed (in /bin or /usr/bin), and only if the distributor id key is returned by 'lsb_platform -i'. This id is lowercased, and whitespace is replaced with underscores. llvm-svn: 199539
* Workaround QEMU GDB server issue. Ed Maste2013-12-181-0/+8
| | | | | | | | | During testing I observed QEMU send "$T02thread:01;#04" upon connection, before any command from LLDB. This change from gclayton accepts (and discards) a packet immediately after sending the initial ack, to flush the GDB remote pipeline. llvm-svn: 197579
OpenPOWER on IntegriCloud