summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [LLDB][MIPS] Add LinuxSignals for mips64 and change trap opcode for mips64el.Mohit K. Bhakkad2015-04-091-1/+5
| | | | | | | | | | | | | | | Patch by Sagar Thakur - Added LinuxSignals for MIPS64. - Changed software trap opcode for mips64el. Reviewers: clayborg, tberghammer. Subscribers: emaste, jaydeep, bhushan, mohit.bhakkad, llvm-commits. Differential Revision: http://reviews.llvm.org/D8856 llvm-svn: 234469
* Sprinkle some #include <mutex> in files that use std::call_once.Benjamin Kramer2015-04-031-0/+1
| | | | llvm-svn: 234005
* [Plugin/Process] Use std::call_once() to initialize.Davide Italiano2015-04-031-4/+3
| | | | | | | | This replaces the home-grown initialization mechanism used before. Differential Revision: http://reviews.llvm.org/D8760 llvm-svn: 233999
* Move several plugin to its own namespaceTamas Berghammer2015-03-311-16/+15
| | | | | | | | | | | | | 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-0/+28
| | | | | | | | | | | | | 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
* Remove virtual and add override to all virtual functions in Process/gdb-remote.Tamas Berghammer2015-03-231-4/+4
| | | | llvm-svn: 232952
* Remove ScriptInterpreterObject.Zachary Turner2015-03-171-22/+25
| | | | | | | | | | | | | | | | | | | | | | | | | This removes ScriptInterpreterObject from the codebase completely. Places that used to rely on ScriptInterpreterObject now use StructuredData::Object and its derived classes. To support this, a new type of StructuredData object is introduced, called StructuredData::Generic, which stores a void*. Internally within the python library, StructuredPythonObject subclasses this StructuredData::Generic class so that it can addref and decref the python object on construction and destruction. Additionally, all of the classes in PythonDataObjects.h such as PythonList, PythonDictionary, etc now provide a method to create an instance of the corresponding StructuredData type. For example, there is PythonDictionary::CreateStructuredDictionary. To eliminate dependencies on PythonDataObjects for external callers, all ScriptInterpreter methods now return only StructuredData classes The rest of the changes in this CL are focused on fixing up users of PythonDataObjects classes to use the new StructuredData classes. llvm-svn: 232534
* Fix fetching the architecture of the target on process launchTamas Berghammer2015-03-131-9/+10
| | | | | | | | | | Previously it was fetched only if the architecture isn't valid, but the architecture can be valid without containing all information about the current target (e.g. missing os). Differential revision: http://reviews.llvm.org/D8057 llvm-svn: 232153
* Remove non const version of GetArchitecture from Target.hTamas Berghammer2015-03-131-9/+12
| | | | | | | The architecture of a target should be updated only by the SetArchitecture method so the target can correctly manage its modules. llvm-svn: 232152
* Initialize ProcessGDBRemoteLog for LLGS to fix remote platform loggingRobert Flack2015-03-111-8/+0
| | | | | | | | This was previously initialized by ProcessGDBRemote::Initialize but lldb-server does not contain ProcessGDBRemote anymore so this needs to be initialized directly. Differential Revision: http://reviews.llvm.org/D8186 llvm-svn: 231966
* Fix bug in ProcessGDBRemotePavel Labath2015-03-111-1/+1
| | | | | | | | | | | | | | | Summary: ProcessGDBRemote::AsyncThread nuked its own thread handle upon exiting. This prevented the main thread from joining it correctly in StopAsyncThread. I address this by moving the Reset() call to StopAsyncThread, after the join. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8218 llvm-svn: 231915
* Set the signals based on the OS in the qHostInfo packetTamas Berghammer2015-03-041-1/+1
| | | | | | | | | | Setting it from the Target architecture cause problems when the target archiutecture is filled just by examining the executable because in that case the OS isn't set. Differential revision: http://reviews.llvm.org/D8035 llvm-svn: 231234
* Further reduce header footprint of Debugger.h.Zachary Turner2015-03-041-0/+2
| | | | llvm-svn: 231202
* Create ScopedTimeout class for GDBRemoteCommunicationTamas Berghammer2015-02-241-18/+17
| | | | | | | | | | 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 TestProcessIO.py when run against a remote targetVince Harron2015-02-131-3/+3
| | | | | | | | | | | | | Fixed test case to copy redirected stdout/stderr files from remote target to host llgs wasn't bothering to put the pty master file handle in the right place if stdout/stderr were redirected to a file. It is still needed for stdin. Corrected some log message text llvm-svn: 229141
* Separate monolithic GDBRemoteCommunicationServer class into 4 partTamas Berghammer2015-02-111-1/+1
| | | | | | | | | | | 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
* Fix 'process launch -i' for remote processesVince Harron2015-02-101-22/+28
| | | | | | | | | | | | | | | | | | We want to forward stdin when stdio is not disabled and when we're not redirecting stdin from a file. renamed m_stdio_disable to m_stdin_forward and inverted value because that's what we want to remember. There was previously a bug that if you redirected stdin from a file, stdout and stderr would also be redirected to /dev/null Adds support for remote target to TestProcessIO.py Fixes ProcessIOTestCase.test_stdin_redirection_with_dwarf for remote Linux targets llvm-svn: 228744
* Add support for SBProcess::PutSTDIN to remote processesVince Harron2015-02-061-0/+5
| | | | | | | | | | | | | | 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
* Implement setting and clearing watchpoints.Chaoren Lin2015-02-031-2/+18
| | | | llvm-svn: 227930
* Share crash information between LLGS and local POSIX debugging withChaoren Lin2015-02-031-1/+2
| | | | | | | CrashReason class. Deliver crash information from LLGS to lldb via description field of thread stop packet. llvm-svn: 227926
* Launch lldb-gdbserver in same process group when launched remotely using ↵Oleksiy Vyalov2015-01-281-0/+4
| | | | | | | | lldb-platform - commit on behalf of flackr. http://reviews.llvm.org/D7211 llvm-svn: 227329
* This patch gets remote-linux platform able to run processesVince Harron2015-01-211-0/+3
| | | | | | | | | | | | | | | | 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-13/+14
| | | | | | | | | | 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
* llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.Todd Fiala2014-10-111-7/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, both local-process llgs and remote-target llgs stdout/stderr handling from inferior work correctly. Several log lines have been added around PTY and stdout/stderr redirection logic on the lldb client side. Regarding remote llgs execution, see the following: With these changes, remote llgs with $O now works properly: $ lldb (lldb) platform select remote-linux (lldb) target create ~/some/inferior/exe (lldb) gdb-remote {some-target}:{port} (lldb) run The sequence above will correctly redirect stdout/stderr over gdb-remote $O, as is needed for remote debugging. That sequence assumes there is a lldb-gdbserver exe running on the target with {some-host}:{port}. You can replace the gdb-remote command with a '(lldb) platform connect connect://{target-ip}:{target-port}'. If you do this and have a lldb-platform running on the remote end, it will go ahead and launch llgs for lldb for each target instance that is run/attached. For local debugging with llgs, the following sequence also works, and uses local PTYs instead to avoid $O and extra gdb-remote messages: $ lldb (lldb) settings set platform.plugin.linux.use-llgs true (lldb) target create ~/some/inferior/exe (lldb) run The above will run the inferior using llgs on the local host, and will use PTYs rather than $O redirection. This change also removes the logging that happened after the fork but before the exec when llgs is launching a new inferior process. Some aspect of the file handling during that portion of code would not do the right thing with log handling. We might want to go back later and have that communicate over a pipe from the child to parent to pass along any messages that previously were logged in that section of code. llvm-svn: 219578
* 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
* 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-231-16/+8
| | | | | | | Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5417 llvm-svn: 218325
* Create a HostThread abstraction.Zachary Turner2014-09-091-25/+13
| | | | | | | | | | | | | 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
* Consolidate UnixSignals setting/getting in Process.Todd Fiala2014-08-291-12/+4
| | | | | | | | | | | | | | | | 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
* Move FileSystem functions out of Host and into their own classes.Zachary Turner2014-08-151-3/+3
| | | | | | | | | | | | | | | | 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-141-4/+4
| | | | | | | | | | | | | 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
* 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-021-12/+16
| | | | | | | | DidAttach) the architecture of the binary you attached to. <rdar://problem/17891396> llvm-svn: 214603
* __arm64__ and __aarch64__ #ifdef adjustmentsTodd Fiala2014-07-091-2/+2
| | | | | | | | Change by Paul Osmialowski See http://reviews.llvm.org/D4379 for details. llvm-svn: 212583
* Fix typos.Bruce Mitchener2014-07-011-4/+4
| | | | llvm-svn: 212132
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-301-2/+58
| | | | | | | | | | | | | | | | | | | | | 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
* Added an option to turn OFF the "detach on error" behavior that was addedJim Ingham2014-06-251-0/+5
| | | | | | | | to debugserver when launching processes. <rdar://problem/16216199> llvm-svn: 211658
* Initial merge of some of the iOS 8 / Mac OS X Yosemite specificJason Molenda2014-06-131-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add support for gdb remote $X stop notification.Todd Fiala2014-05-191-0/+1
| | | | | | | | | | | | | | debugserver now returns $X09 as the immediate response to a $k kill process request rather than $W09. ProcessGDBRemote now properly handles X as indication of a process exit state. The @debugserver_test and @lldb_test for $k now properly expects an X notification (signal-caused exit) after killing a just-attached inferior that was still in the stopped state. llvm-svn: 209108
* Change ProcessGDBRemote::DoReadMemory to use the x packet to readJason Molenda2014-05-061-3/+146
| | | | | | | | | | | | | | | | data if it is available. Change ProcessGDBRemote's maximum read/write packet size from a fixed 512 byte value to asking the remote gdb stub what its maximum is, using up to 128kbyte sizes if that's allowed, and falling back to 512 if the remote gdb stub doesn't advertise a max packet size. Add a new "process plugin packet xfer-size" command that can be used to override the maximum packet size (although not exceeding any packet size maximum published by the remote gdb stub). <rdar://problem/16032150> llvm-svn: 208058
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-11/+7
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* Add a missing arm64 idef.Jason Molenda2014-04-021-1/+1
| | | | llvm-svn: 205488
* lldb arm64 import.Jason Molenda2014-03-291-4/+46
| | | | | | | | | | | | | | | | 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
* Move calls to DisableAllBreakpointSites() and ↵Andrew MacPherson2014-03-251-4/+0
| | | | | | m_thread_list.DiscardThreadPlans() into base Process::Destroy() instead of in subclass DoDestroy() methods. llvm-svn: 204752
* JITed functions can now have debug info and be debugged with debug and ↵Greg Clayton2014-03-241-0/+1
| | | | | | | | | | | | | | | | | | | source info: (lldb) b puts (lldb) expr -g -i0 -- (int)puts("hello") First we will stop at the entry point of the expression before it runs, then we can step over a few times and hit the breakpoint in "puts", then we can continue and finishing stepping and fininsh the expression. Main features: - New ObjectFileJIT class that can be easily created for JIT functions - debug info can now be enabled when parsing expressions - source for any function that is run throught the JIT is now saved in LLDB process specific temp directory and cleaned up on exit - "expr -g --" allows you to single step through your expression function with source code <rdar://problem/16382881> llvm-svn: 204682
* cleanup unreferenced functionsSaleem Abdulrasool2014-03-201-4/+5
| | | | | | | | | | | | | This is a mechanical cleanup of unused functions. In the case where the functions are referenced (in comment form), I've simply commented out the functions. A second pass to clean that up is warranted. The functions which are otherwise unused have been removed. Some of these were introduced in the initial commit and not in use prior to that point! NFC llvm-svn: 204310
* Update copy-and-pasted log messageEd Maste2014-03-171-1/+1
| | | | llvm-svn: 204057
* If you are disabling a hardware breakpoint, use z1 not z0.Jim Ingham2014-03-071-1/+9
| | | | | | <rdar://problem/16256532> llvm-svn: 203232
* Add ProcessGDBRemote::GetAuxvData() and fix multiple-packet concatenation ↵Steve Pucci2014-03-041-0/+13
| | | | | | | | | | 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 an assertion that was being hit due to slow DNS name lookups on ↵Greg Clayton2014-02-271-1/+1
| | | | | | | | | | MacOSX for "localhost". Changed all "localhost" to "127.0.0.1" to prevent potentially long name lookups. <rdar://problem/16154630> llvm-svn: 202424
OpenPOWER on IntegriCloud