summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Don’t process the stop reply packet as a generic signal if we already ↵Jim Ingham2014-02-241-1/+1
| | | | | | figured out what it was from other data in the packet. llvm-svn: 202066
* Patch for fixing the handling of hardware breakpoints.Deepak Panickal2014-02-241-43/+79
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2826 llvm-svn: 202028
* Oops, probably ought to turn on that fix...Jim Ingham2014-02-211-1/+1
| | | | llvm-svn: 201897
* We have to call waitpid on the lldb side for Mac OS X (even though we've ↵Jim Ingham2014-02-211-0/+18
| | | | | | | | successfully called it on the debugserver side) when we kill a process or it leaves a zombie around. llvm-svn: 201896
* Improve the handling of stop-reply packet when it does not containHafiz Abid Qadeer2014-02-201-0/+15
| | | | | | thread information. llvm-svn: 201773
* Fixed deadlocks that could occur when using python for breakpoints, ↵Greg Clayton2014-02-131-1/+5
| | | | | | | | | operating system plugins, and other async python usage. <rdar://problem/16054348> <rdar://problem/16040833> llvm-svn: 201372
* Merging the iohandler branch back into main. Greg Clayton2014-01-271-22/+0
| | | | | | | | | | | | The many many benefits include: 1 - Input/Output/Error streams are now handled as real streams not a push style input 2 - auto completion in python embedded interpreter 3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use 4 - it is now possible to use curses to drive LLDB (please try the "gui" command) We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases. llvm-svn: 200263
* Test new committer permission with one-line trailing whitespace removal.Steve Pucci2014-01-161-1/+1
| | | | llvm-svn: 199432
* Revert to getting a random port and sending that down to debugserver for ↵Greg Clayton2014-01-101-5/+45
| | | | | | | | iOS. The sandboxing is not letting debugserver reverse connect back to lldb. <rdar://problem/15789865> llvm-svn: 198963
* Fixes a bug preventing reading of the python register file.Todd Fiala2014-01-081-0/+4
| | | | | | | | | | This change fixes a bug recently introduced in ProcessGDBRemote that prevented the Python register definition file from getting loaded when the qRegisterInfo0 response returned $00#. Patch by Steve Pucci. llvm-svn: 198742
* Remove wait_for_launch parameter from DoAttachToProcessWithName(). This ↵Jean-Daniel Dupas2013-12-231-2/+2
| | | | | | | | | | parameter is redundant as this information is already provided by the ProcessAttachInfo parameter. CC: lldb-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2463 llvm-svn: 197923
* Any time ProcessGDBRemote tries to get the remote's ProcessArchitecture,Jason Molenda2013-12-211-5/+20
| | | | | | | | | | it needs to fall back to using the HostArchitecture if a valid one is not returned. When doing low-level system debugging we may not have a process (or the remote stub may not support the qProcessInfo packet) in which case we should fall back to the architecture we determined via qHostInfo. <rdar://problem/15713180> llvm-svn: 197857
* Remove 'const' constraint on ProcessLaunchInfo parameter in Process::DoLaunch().Jean-Daniel Dupas2013-12-091-1/+1
| | | | | | This 'const' is not required and prevent us to defer the launch to the Host layer. llvm-svn: 196837
* Fixed the GDBRemoteCommuncation to return a new ↵Greg Clayton2013-12-061-6/+6
| | | | | | | | | | | | | | GDBRemoteCommuncation::PacketResult enum for all packet sends/receives. <rdar://problem/15600045> Due to other recent changes, all connections to GDB servers that didn't support the "QStartNoAckMode" packet would cause us to fail to attach to the remote GDB server. The problem was that SendPacket* and WaitForResponse* packets would return a size_t indicating the number of bytes sent/received. The other issue was WaitForResponse* packets would strip the leading '$' and the trailing "#CC" (checksum) bytes, so the unimplemented response packet of "$#00" would get stripped and the WaitForResponse* packets would return 0. These new error codes give us flexibility to to more intelligent things in response to what is returned. llvm-svn: 196610
* Modified local spawning in debugserver processes to use a new ↵Greg Clayton2013-12-051-28/+39
| | | | | | | | | | | | | | | | | | --reverse-connect option so that debugserver actually connects back to LLDB instead of LLDB connecting to debugserver. This gets rid of our hacky "get_random_port()" which would grab a random port and tell debugserver to open that port. Now LLDB creates, binds, listens and accepts a connection by binding to port zero and sending the correctly bound port down as the host:port to connect back to. Fixed the "ConnectionFileDescriptor" to be able to correctly listen for connections from a specified host, localhost, or any host. Prior to this fix "listen://" only accepted the following format: listen://<port> But now it can accept: listen://<port> // Listen for connection from localhost on port <port> listen://<host>:<port> // Listen for connection from <host> and <port> listen://*:<port> // Listen for connection from any host on port <port> llvm-svn: 196547
* Switch local launching of debugserver over to always use a FIFO in order to ↵Greg Clayton2013-12-041-196/+26
| | | | | | | | | | handshake with the launched debugserver. This helps ensure that the launched debugserver is ready and listening for a connection. Prior to this we had a race condition. Consolidate the launching of debugserver into a single place: a static function in GDBRemoteCommunication. llvm-svn: 196401
* Improved platform support.Greg Clayton2013-11-231-3/+1
| | | | | | | | | | | | Improved the detection of a valid GDB server where we actually can connect to a socket, but then it doesn't read or write anything (which happens with some USB mux software). Host::MakeDirectory() now can make as many intermediate directories as needed. The testsuite now has very initial support for remote test suite running. When running on a remote platform, the setUp function for the test will make a new directory and select it as the working directory on the remote host. Added a common function that can be used to create the short option string for getopt_long calls. llvm-svn: 195541
* Expose SBPlatform through the public API.Greg Clayton2013-11-201-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example code: remote_platform = lldb.SBPlatform("remote-macosx"); remote_platform.SetWorkingDirectory("/private/tmp") debugger.SetSelectedPlatform(remote_platform) connect_options = lldb.SBPlatformConnectOptions("connect://localhost:1111"); err = remote_platform.ConnectRemote(connect_options) if err.Success(): print >> result, 'Connected to remote platform:' print >> result, 'hostname: %s' % (remote_platform.GetHostname()) src = lldb.SBFileSpec("/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework", False) dst = lldb.SBFileSpec() # copy src to platform working directory since "dst" is empty err = remote_platform.Install(src, dst); if err.Success(): print >> result, '%s installed successfully' % (src) else: print >> result, 'error: failed to install "%s": %s' % (src, err) Implemented many calls needed in lldb-platform to be able to install a directory that contains symlinks, file and directories. The remote lldb-platform can now launch GDB servers on the remote system so that remote debugging can be spawned through the remote platform when connected to a remote platform. The API in SBPlatform is subject to change and will be getting many new functions. llvm-svn: 195273
* <rdar://problem/15263540>Greg Clayton2013-10-251-0/+18
| | | | | | | | Added a new key that we understand for the "qHostInfo" packet: "default_packet_timeout:T;" where T is a default packet timeout in seconds. This allows GDB servers with known slow packet response times to increase the default timeout to a value that makes sense for the connection. llvm-svn: 193425
* Fix python-free build.Joerg Sonnenberger2013-10-201-0/+4
| | | | llvm-svn: 193053
* Adjust PC after hitting breakpoint on remote target.Hafiz Abid Qadeer2013-10-181-2/+7
| | | | | | | | This commit adds an example python file that can be used with 'target-definition-file' setting for Linux gdbserver. This file has an extra key 'breakpoint-pc-offset' that LLDB uses to determine how much to change the PC after hitting the breakpoint. llvm-svn: 192962
* Move the code which translates a dispatch_qaddr into aJason Molenda2013-10-181-94/+0
| | | | | | | | | | | | queue name out of ProcessGDBRemote and in to the Platform plugin, specifically PlatformDarwin. Also add a Platform method to translate a dispatch_quaddr to a QueueID, and a Thread::GetQueueID(). I'll add an SBThread::GetQueueID() next. llvm-svn: 192949
* <rdar://problem/14972424>Greg Clayton2013-10-171-6/+17
| | | | | | | | | | | | | | | - Made the dynamic register context for the GDB remote plug-in inherit from the generic DynamicRegisterInfo to avoid code duplication - Finished up the target definition python setting stuff. - Added a new "slice" key/value pair that can specify that a register is part of another register: { 'name':'eax', 'set':0, 'bitsize':32, 'encoding':eEncodingUint, 'format':eFormatHex, 'slice': 'rax[31:0]' }, - Added a new "composite" key/value pair that can specify that a register is made up of two or more registers: { 'name':'d0', 'set':0, 'bitsize':64 , 'encoding':eEncodingIEEE754, 'format':eFormatFloat, 'composite': ['s1', 's0'] }, - Added a new "invalidate-regs" key/value pair for when a register is modified, it can invalidate other registers: { 'name':'cpsr', 'set':0, 'bitsize':32 , 'encoding':eEncodingUint, 'format':eFormatHex, 'invalidate-regs': ['r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15']}, This now completes the feature that allows a GDB remote target to completely describe itself. llvm-svn: 192858
* <rdar://problem/14972424>Greg Clayton2013-10-151-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging with the GDB remote in LLDB, LLDB uses special packets to discover the registers on the remote server. When those packets aren't supported, LLDB doesn't know what the registers look like. This checkin implements a setting that can be used to specify a python file that contains the registers definitions. The setting is: (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/module.py Inside module there should be a function: def get_dynamic_setting(target, setting_name): This dynamic setting function is handed the "target" which is a SBTarget, and the "setting_name", which is the name of the dynamic setting to retrieve. For the GDB remote target definition the setting name is 'gdb-server-target-definition'. The return value is a dictionary that follows the same format as the OperatingSystem plugins follow. I have checked in an example file that implements the x86_64 GDB register set for people to see: examples/python/x86_64_target_definition.py This allows LLDB to debug to any archticture that is support and allows users to define the registers contexts when the discovery packets (qRegisterInfo, qHostInfo) are not supported by the remote GDB server. A few benefits of doing this in Python: 1 - The dynamic register context was already supported in the OperatingSystem plug-in 2 - Register contexts can use all of the LLDB enumerations and definitions for things like lldb::Format, lldb::Encoding, generic register numbers, invalid registers numbers, etc. 3 - The code that generates the register context can use the program to calculate the register context contents (like offsets, register numbers, and more) 4 - True dynamic detection could be used where variables and types could be read from the target program itself in order to determine which registers are available since the target is passed into the python function. This is designed to be used instead of XML since it is more dynamic and code flow and functions can be used to make the dictionary. llvm-svn: 192646
* Set the architecture from the remote executable when it's not set so the ↵Carlo Kok2013-10-141-0/+9
| | | | | | register info can be loaded properly (and thus the callstacks work) llvm-svn: 192571
* <rdar://problem/13635174>Greg Clayton2013-10-111-4/+11
| | | | | | | | Added a way to set hardware breakpoints from the "breakpoint set" command with the new "--hardware" option. Hardware breakpoints are not a request, they currently are a requirement. So when breakpoints are specified as hardware breakpoints, they might fail to be set when they are able to be resolved and should be used sparingly. This is currently hooked up for GDB remote debugging. Linux and FreeBSD should quickly enable this feature if possible, or return an error for any breakpoints that are hardware breakpoint sites in the "virtual Error Process::EnableBreakpointSite (BreakpointSite *bp_site);" function. llvm-svn: 192491
* MingW compilation (windows). Includes various refactoring to improve ↵Virgile Bello2013-08-231-3/+6
| | | | | | portability. llvm-svn: 189107
* <rdar://problem/13793059>Greg Clayton2013-07-151-2/+76
| | | | | | | | | | | Added a setting to control timeout for kdp response packets. While I was at it, I also added a way to control the response timeout for gdb-remote packets. KDP defaults to 5 seconds, and GDB defaults to 1 second. These were the default values that were in the code prior to adding these settings. (lldb) settings set plugin.process.gdb-remote.packet-timeout 10 (lldb) settings set plugin.process.kdp-remote.packet-timeout 10 llvm-svn: 186360
* Add some useful logging for tracking thread matching problems.Jim Ingham2013-06-221-0/+24
| | | | llvm-svn: 184619
* <rdar://problem/13980489>Han Ming Ong2013-06-211-1/+1
| | | | | | I added scan type to ‘qGetProfileData’ previously but forgot to update the check to be a substring search. llvm-svn: 184588
* Sort out a number of mismatched integer types in order to cut down the ↵Andy Gibbs2013-06-191-2/+2
| | | | | | number of compiler warnings. llvm-svn: 184333
* Don't retry the Connect when starting up debugserver if the reason for the ↵Jim Ingham2013-06-071-1/+7
| | | | | | | | | | previous failure was EINTR. That means the user was trying to interrupt us, and we should just stop instead. <rdar://problem/13184758> llvm-svn: 183577
* Fix a couple of error message typos.Jim Ingham2013-06-031-2/+2
| | | | llvm-svn: 183145
* Added a test case that verifies that LLDB can debug across a process ↵Greg Clayton2013-05-211-18/+24
| | | | | | | | exec'ing itself into a new program. This currently is only enabled for Darwin since we exec from 64 bit to 32 bit and vice versa for 'x86_64' targets. This can easily be adapted for linux and other platforms, but I didn't want to break any buildbots by assuming it will work. llvm-svn: 182428
* <rdar://problem/13892516>Greg Clayton2013-05-211-3/+20
| | | | | | LLDB can now debug across calls to exec when the architecture changes from say i386 to x86_64 (on darwin). llvm-svn: 182345
* Update ProcessKDP and ProcessMachCore to use ConstString pluginJason Molenda2013-05-111-2/+1
| | | | | | | | | | names when specifying the DynamicLoaderDarwinKernel. ProcessGDBRemote wasn't setting the dyld string any more; remove the remaining code tracking the dyld plugin name altogether from that process plugin. llvm-svn: 181658
* <rdar://problem/13854277>Greg Clayton2013-05-101-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. llvm-svn: 181631
* Changed the formerly pure virtual function:Greg Clayton2013-05-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | namespace lldb_private { class Thread { virtual lldb::StopInfoSP GetPrivateStopReason() = 0; }; } To not be virtual. The lldb_private::Thread now handles the correct caching and will call a new pure virtual function: namespace lldb_private { class Thread { virtual bool CalculateStopInfo() = 0; } } This function must be overridden by thead lldb_private::Thread subclass and the only thing it needs to do is to set the Thread::StopInfo() with the current stop reason and return true, or return false if there is no stop reason. The lldb_private::Thread class will take care of calling this function only when it is required. This allows lldb_private::Thread subclasses to be a bit simpler and not all need to duplicate the cache and invalidation settings. Also renamed: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopReason(); To: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopInfo(); Also cleaned up a case where the ThreadPlanStepOverBreakpoint might not re-set its breakpoint if the thread disappears (which was happening due to a bug when using the OperatingSystem plug-ins with memory threads and real threads). llvm-svn: 181501
* Reinstating r181091 and r181106 with fix for Linux regressions.Andrew Kaylor2013-05-071-33/+18
| | | | llvm-svn: 181340
* Temporarily reverting r181091 and r181106 due to the vast test breakage on ↵Ashok Thirumurthi2013-05-071-18/+33
| | | | | | | | | | the Linux buildbots while we develop a better understanding of how to manage the thread lists in a platform-independant fashion. Reviewed by: Daniel Malea llvm-svn: 181323
* After recent OperatingsSystem plug-in changes, the lldb_private::Process and ↵Greg Clayton2013-05-041-33/+18
| | | | | | | | | | lldb_private::Thread subclasses were changed and the API was not respected properly. This checkin aims to fix this. The process now has two thread lists: a real thread list for threads that are created by the lldb_private::Process subclass, and the user visible threads. The user visible threads are the same as the real threas when no OS plug-in in used. But when an OS plug-in is used, the user thread can be a combination of real and "memory" threads. Real threads can be placed inside of memory threads so that a thread appears to be different, but is still controlled by the actual real thread. When the thread list needs updating, the lldb_private::Process class will call the: lldb_private::Process::UpdateThreadList() function with the old real thread list, and the function is expected to fill in the new real thread list with the current state of the process. After this function, the process will check if there is an OS plug-in being used, and if so, it will give the old user thread list, the new real thread list and the OS plug-in will create the new user thread list from both of these lists. If there is no OS plug-in, the real thread list is the user thread list. These changes keep the lldb_private::Process subclasses clean and no changes are required. llvm-svn: 181091
* Recommitting r180831 with trivial fix - remember to return errors if you ↵Jim Ingham2013-05-021-6/+10
| | | | | | compute. llvm-svn: 180898
OpenPOWER on IntegriCloud