summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
Commit message (Collapse)AuthorAgeFilesLines
* Enable llgs to build against experimental Android AOSP ↵Todd Fiala2014-09-271-1/+0
| | | | | | | | | | | | lldb/llvm/clang/compiler-rt repos. See http://reviews.llvm.org/D5495 for more details. These are changes that are part of an effort to support building llgs, within the AOSP source tree, using the Android.mk build system, when using the llvm/clang/lldb git repos from AOSP replaced with the experimental ones currently in github.com/tfiala/aosp-{llvm,clang,lldb,compiler-rt}. llvm-svn: 218568
* Fix up the HostThread interface, making the interface simpler.Zachary Turner2014-09-232-21/+10
| | | | | | | Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5417 llvm-svn: 218325
* Test suite runs better again after recent fixes that would select a platform ↵Greg Clayton2014-09-191-1/+1
| | | | | | | | | | | | | if a "file a.out" auto selected a different platform than the selected one. Changes include: - fix it so you can select the "host" platform using "platform select host" - change all callbacks that create platforms to returns shared pointers - fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host" - Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform - cache platforms that are created and re-use them instead of always creating a new one llvm-svn: 218145
* llgs: removed some wait-for-stop code in inferior process launch pipeline.Todd Fiala2014-09-182-31/+8
| | | | | | | | | | | | | The $A handler was unnecessarily waiting for the launched app to hit a stop before returning. Removed this code. Renamed the llgs inferior launching code to LaunchProcessForDebugging () to prevent it from possibly being mistaken as code that lldb-platform uses to launch a debugserver process. We probably want to look at breaking out llgs-specific and lldb-platform-specific code into separate derived classes, with common code in a shared base class. llvm-svn: 218075
* Hex encode the triple values in case they contain special characters.Greg Clayton2014-09-182-5/+17
| | | | llvm-svn: 218001
* Add better logging for the "$vFile:pwrite:" packet so we can show binary ↵Greg Clayton2014-09-181-5/+33
| | | | | | data instead of nothing or unprintable characters. This can easily be extended for other packets that have binary data. llvm-svn: 218000
* use std::atomic<> to protect variables being accessed by multiple threadsTodd Fiala2014-09-151-1/+1
| | | | | | | | | | There are several places where multiple threads are accessing the same variables simultaneously without any kind of protection. I propose using std::atomic<> to make it safer. I did a special build of lldb, using the google tool 'thread sanitizer' which identified many cases of multiple threads accessing the same memory. std::atomic is low overhead and does not use any locks for simple types such as int/bool. See http://reviews.llvm.org/D5302 for more details. Change by Shawn Best. llvm-svn: 217818
* 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
* llgs: fix thread names broken by recent native thread changes.Todd Fiala2014-09-121-6/+6
| | | | | | | | * Fixes the local stack variable return pointer usage in NativeThreadLinux::GetName(). * Changes NativeThreadProtocol::GetName() to return a std::string. * Adds a unit test to verify thread names don't regress in the future. Currently only run on Linux since I know default thread names there. llvm-svn: 217717
* llgs: fix Ctrl-C inferior interrupt handling to do the right thing.Todd Fiala2014-09-111-4/+2
| | | | | | | | | | | | | | | | * Sends a SIGSTOP to the process. * Fixes busted SIGSTOP handling. Now builds a list of non-stopped that we wait for the PTRACE group-stop for. When the final must-stop tid gets its group stop, we propagate the process state change. Only the signal receiving the notification of the pending SIGSTOP is marked with the SIGSTOP signal. All the rest, if they weren't already stopped, are marked as stopped with signal 0. * Fixes a few broken tests. * Marks the Linux test I added earlier as expect-pass (no longer XFAIL). Implements fix for http://llvm.org/bugs/show_bug.cgi?id=20908. llvm-svn: 217647
* llgs: implement qThreadStopInfo.Todd Fiala2014-09-102-2/+27
| | | | | | | | | | | This change implements this ticket: http://llvm.org/bugs/show_bug.cgi?id=20899 Adds the qThreadStopInfo RSP command for llgs and includes a test that verifies both debugserver and llgs respond with something reasonable on a multithreaded app. llvm-svn: 217549
* Create a HostThread abstraction.Zachary Turner2014-09-094-42/+23
| | | | | | | | | | | | | This patch moves creates a thread abstraction that represents a thread running inside the LLDB process. This is a replacement for otherwise using lldb::thread_t, and provides a platform agnostic interface to managing these threads. Differential Revision: http://reviews.llvm.org/D5198 Reviewed by: Jim Ingham llvm-svn: 217460
* remove a couple of default cases from switchesSaleem Abdulrasool2014-09-081-5/+11
| | | | | | | | | This cleans up a couple of warnings [-Wcovered-switch-default] from the build by removing the default case from a couple of switches which are fully covered. This is generally better as it will help identify when a new item is added to the enumeration but the use sites are not updated. llvm-svn: 217376
* Set the process vendor in GDBRemoteCommunicationClient::GetCurrentProcessInfo.Todd Fiala2014-09-051-0/+1
| | | | | | Change by Stephane Sezer. llvm-svn: 217252
* Consolidate UnixSignals setting/getting in Process.Todd Fiala2014-08-292-17/+5
| | | | | | | | | | | | | | | | See http://reviews.llvm.org/D5108 for details. This change does the following: * eliminates the Process::GetUnixSignals() virtual method and replaces with a fixed getter. * replaces the Process UnixSignals storage with a shared pointer. * adds a Process constructor variant that can be passed the UnixSignalsSP. When the constructor without the UnixSignalsSP is specified, the Host's default UnixSignals is used. * adds a host-specific version of GetUnixSignals() that is used when we need the host's appropriate UnixSignals variant. * replaces GetUnixSignals() overrides in PlatformElfCore, ProcessGDBRemote, ProcessFreeBSD and ProcessLinux with code that appropriately sets the Process::UnixSignals for the process. This change also enables some future patches that will enable llgs to be used for local Linux debugging. llvm-svn: 216748
* Add arbitrary command line flags to llgs/debugserver startup for local ↵Todd Fiala2014-08-291-1/+19
| | | | | | | | | | | | | | | | | | | | debugging. This patch accepts environment variables of the form: LLDB_DEBUGSERVER_EXTRA_ARG_n where n starts with 1, and may continue nearly indefinitely (up through std::numeric_limits<uint32_t>::max()). The code loops around, starting with 1, until it doesn't find one of the environment variables. For each one it does find defined, it appends the environment variable's contents to the end of the debugserver/llgs startup command line issued when the stub is started for local debugging. I am using this to add arbitrary startup commands to the llgs command line for turning on additional logging. For example: export LLDB_DEBUGSERVER_EXTRA_ARG_1="-c" export LLDB_DEBUGSERVER_EXTRA_ARG_2="log enable -f /tmp/llgs_packets.log gdb-remote packets" export LLDB_DEBUGSERVER_EXTRA_ARG_3="-c" export LLDB_DEBUGSERVER_EXTRA_ARG_4="log enable -f /tmp/llgs_process.log lldb process" llvm-svn: 216745
* llgs: add proper exec support for Linux.Todd Fiala2014-08-282-0/+29
| | | | | | | | | | | | | | | This change: * properly captures execs in NativeProcessLinux. * clears out all non-main-thread thread metadata in NativeProcessLinux on exec. * adds a DidExec() method to the NativeProcessProtocol delegate. * clears out the auxv data cache when we exec (on Linux). This is a small part of the llgs for local Linux debugging work going on here: https://github.com/tfiala/lldb/tree/dev-llgs-local I'm breaking it into small patches. llvm-svn: 216670
* Fix llgs to send triple for non-Apple platforms and lldb to interpret correctly.Todd Fiala2014-08-262-3/+24
| | | | | | | | | | | | | 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
* Fixes a few more places where we were manually setting the filename.Zachary Turner2014-08-211-1/+1
| | | | llvm-svn: 216247
* Two small fixes to get Mac native + debugserver working after theJason Molenda2014-08-211-1/+1
| | | | | | | HostInfo et al changes from Zachary. Changes suggested by Zachary - fixes the problems I was seeing. llvm-svn: 216243
* Move GetUsername and GetGroupname to HostInfoPosixZachary Turner2014-08-211-2/+6
| | | | llvm-svn: 216210
* Move Host::GetLLDBPath to HostInfo.Zachary Turner2014-08-211-3/+4
| | | | | | | | This continues the effort to get Host code moved over to HostInfo, and removes many more instances of preprocessor defines along the way. llvm-svn: 216195
* Move Host::GetArchitecture to HostInfo::GetArchitecture.Zachary Turner2014-08-201-1/+1
| | | | | | | | As a side effect, this patch also eliminates all of the preprocessor conditionals previously used to implement GetArchitecture(). llvm-svn: 216074
* Move some Host logic into HostInfo class.Zachary Turner2014-08-192-6/+11
| | | | | | | | | | | | | | | | | | 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
* Move FileSystem functions out of Host and into their own classes.Zachary Turner2014-08-153-11/+13
| | | | | | | | | | | | | | | | More specifically, this change can be summarized as follows: 1) Makes an lldbHostPosix library which contains code common to all posix platforms. 2) Creates Host/FileSystem.h which defines a common FileSystem interface. 3) Implements FileSystem.h in Host/windows and Host/posix. 4) Creates Host/FileCache.h, implemented in Host/common, which defines a class useful for storing handles to open files needed by the debugger. Differential Revision: http://reviews.llvm.org/D4889 llvm-svn: 215775
* Refactor FileAction out of ProcessLaunchInfo.Zachary Turner2014-08-142-7/+8
| | | | | | | | | | | | | FileAction was previously a nested class in ProcessLaunchInfo. This led to some unfortunate style consequences, such as requiring the AddPosixSpawnFileAction() funciton to be defined in the Target layer, instead of the more appropriate Host layer. This patch makes FileAction its own independent class in the Target layer, and then moves AddPosixSpawnFileAction() into Host as a result. Differential Revision: http://reviews.llvm.org/D4877 llvm-svn: 215649
* Creates a socket host object.Zachary Turner2014-08-061-2/+2
| | | | | | | | | | | | | | | | | | This patch moves the logic of many common socket operations into its own class lldb_private::Socket. It then modifies the ConnectionFileDescriptor class, and a few users of that class, to use this new Socket class instead of hardcoding socket logic directly. Finally, this patch creates a common interface called IOObject for any objects that support reading and writing, so that endpoints such as sockets and files can be treated the same. Differential Revision: http://reviews.llvm.org/D4641 Reviewed by: Todd Fiala, Greg Clayton llvm-svn: 214984
* Change ProcessGDBRemote::DidLaunchOrAttach to Jason Molenda2014-08-031-2/+2
| | | | | | | | call Target::SetArchitecture instead of modifying a reference to the target's architecture so that the target logging can show that the arch has been changed. llvm-svn: 214667
* After you attach, give the process plugin a chance to report back (throughJim Ingham2014-08-022-14/+18
| | | | | | | | DidAttach) the architecture of the binary you attached to. <rdar://problem/17891396> llvm-svn: 214603
* Change the encoding of the Triple string exchanged across GDB-RSPMatthew Gardiner2014-08-012-11/+4
| | | | | | | | | | | 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
* Add $vAttach support to llgs.Todd Fiala2014-07-292-0/+45
| | | | | | Also adds a new test case for vAttach;{pid} for llgs and debugserver. llvm-svn: 214236
* Add debug asserts / sanity checks toJason Molenda2014-07-241-0/+19
| | | | | | | | | | | | | | GDBRemoteRegisterContext::ReadRegisterBytes and GDBRemoteRegisterContext::WriteRegisterBytes to ensure we don't try to read/write off the end of the register buffer. This should never happen but we've had some target confusion in the past where it did; adding the checks is prudent to avoid crashing here if it happens again. <rdar://problem/16450971> <rdar://problem/16458182> llvm-svn: 213829
* 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-233-5/+5
| | | | | | | | | | | 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
* Enable lldb-platform exe support for Linux.Todd Fiala2014-07-222-42/+68
| | | | | | | | | | | | | | This change enables lldb-platform for Linux. In addition, it does the following: * fixes Host::GetLLDBPath() to work on Linux/*BSD for ePathTypeSupportExecutableDir-relative paths. * adds more logging and comments around lldb-platform startup and remote lldb-platform usage. * refactors lldb-platform remote-* support for Darwin and Linux into PlatformPOSIX. This, in theory, is the bulk of what is needed for *BSD to make remote connections to lldb-platform as well (although I haven't tested that yet). FreeBSD can make similar changes to their Platform* as was made here for PlatformLinux to pick up the rest of the bits. * teaches GDBRemoteCommunication to use lldb-gdbserver for non-Apple hosts. llvm-svn: 213707
* Modified gdb-remote tests to run with automatically-chosen ports.Todd Fiala2014-07-141-3/+17
| | | | | | | | | | | | Now that llgs supports communicating the 0-port choose-a-port mechanism and can communicate that back to a caller via the --named-pipe option (at parity with debugserver), we use this mechanism to always start llgs and debugserver gdb-remote protocol tests without needing to use some port arbitration mechanism. This eliminates some potential intermittent failures vs. the previous random port and collision-avoidance strategy used. llvm-svn: 212923
* __arm64__ and __aarch64__ #ifdef adjustmentsTodd Fiala2014-07-092-5/+5
| | | | | | | | Change by Paul Osmialowski See http://reviews.llvm.org/D4379 for details. llvm-svn: 212583
* Start converting usages of off_t to other types.Zachary Turner2014-07-021-7/+7
| | | | | | | | | | | | | | | | | | | | | | | off_t is a type which is used for file offsets. Even more specifically, it is only used by a limited number of C APIs that deal with files. Any usage of off_t where the variable is not intended to be used with one of these APIs is a bug, by definition. This patch corrects some easy mis-uses of off_t, generally by converting them to lldb::offset_t, but sometimes by using other types such as size_t, when appropriate. The use of off_t to represent these offsets has worked fine in practice on linux-y platforms, since we used _FILE_OFFSET_64 to guarantee that off_t was a uint64. On Windows, however, _FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit. So the usage of off_t on Windows actually leads to legitimate bugs. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4358 llvm-svn: 212192
* Replace uint32_t by lldb::RegisterKing in register context API.Jean-Daniel Dupas2014-07-022-2/+2
| | | | llvm-svn: 212172
* Fix typos.Bruce Mitchener2014-07-014-15/+15
| | | | llvm-svn: 212132
* Fix Windows build after llgs upstream.Zachary Turner2014-07-011-0/+2
| | | | | | | | | With _HAS_EXCEPTIONS=0, Windows' version of <thread> will fail to compile because it calls __uncaught_exception(), which is compiled out due to _HAS_EXCEPTIONS=0. This just creates a stub version of __uncaught_exception() which always fails. llvm-svn: 212076
* Fixup Windows build breaks for the llgs upstream.Todd Fiala2014-06-301-2/+4
| | | | | | | | Also moves NativeRegisterContextLinux* files into the Linux directory. These, like NativeProcessLinux, should only be built on Linux or a cross compiler with proper headers. llvm-svn: 212074
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-305-78/+2931
| | | | | | | | | | | | | | | | | | | | | 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
* Fix a few typos.Bruce Mitchener2014-06-271-4/+4
| | | | llvm-svn: 211851
* Added an option to turn OFF the "detach on error" behavior that was addedJim Ingham2014-06-255-1/+55
| | | | | | | | 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
* Fixed the "log enable gdb-remote packets" to support dumping the binary ↵Greg Clayton2014-06-201-3/+42
| | | | | | memory read packet ('x') by printing out the binary data correctly using only printable characters and removing the 0x7d escapes so the memory is readable in the packet output. llvm-svn: 211400
* 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
OpenPOWER on IntegriCloud