summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixed the Visual Studio Windows buildDeepak Panickal2014-01-131-0/+4
| | | | llvm-svn: 199111
* Revert to getting a random port and sending that down to debugserver for ↵Greg Clayton2014-01-104-37/+100
| | | | | | | | 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-232-3/+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
* 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
* Fix a bug introduced in asynchronous packet sends. We were not setting the ↵Jim Ingham2013-12-182-6/+10
| | | | | | | | | | packet result, and so it looked like the async packet send always failed. <rdar://problem/15657157> llvm-svn: 197543
* Centralized the launching of a process into Target::Launch()Greg Clayton2013-12-131-1/+1
| | | | | | | | | | | | | While investigating test suite failures when running the test suite remotely, I noticed we had 3 copies of code that launched a process: 1 - in "process launch" command 2 - SBTarget::Launch() with args 3 - SBTarget::Launch() with SBLaunchInfo "process launch" was launching through the platform if it was supported (this is needed for remote debugging) and the 2 and 3 were not. Now all code is in one place. llvm-svn: 197247
* <rdar://problem/15639995>Han Ming Ong2013-12-121-4/+0
| | | | | | debugserver's launch info was cleared unnecessarily. It has important user ID set. Reviewed by Greg Clayton. llvm-svn: 197182
* Remove 'const' constraint on ProcessLaunchInfo parameter in Process::DoLaunch().Jean-Daniel Dupas2013-12-092-2/+2
| | | | | | 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-068-327/+382
| | | | | | | | | | | | | | 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
* Replace all in_port_t with uint16_t to avoid compilation issues on different ↵Greg Clayton2013-12-062-2/+2
| | | | | | systems. llvm-svn: 196586
* Modified local spawning in debugserver processes to use a new ↵Greg Clayton2013-12-054-57/+163
| | | | | | | | | | | | | | | | | | --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
* Extends StringExtractorGDBRemote to support debugger packets.Jean-Daniel Dupas2013-12-051-0/+1
| | | | | | | | CC: lldb-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2337 llvm-svn: 196525
* Allow the hostname to be specified when asking a platform to launch another ↵Greg Clayton2013-12-042-9/+14
| | | | | | | | debugserver in case you want to change it. The GDB server remote platform how has the debugserver that are launched on iOS devices to use localhost due to the use of a USB mux. llvm-svn: 196405
* Switch local launching of debugserver over to always use a FIFO in order to ↵Greg Clayton2013-12-045-297/+90
| | | | | | | | | | 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
* Fix MSVC buildColin Riley2013-11-261-0/+5
| | | | | | Added _WIN32 guards to new platform features. Using correct SetErrorStringWithFormat within Host when LLDB_DISABLE_POSIX is defined. Also fixed an if defined block. llvm-svn: 195766
* Improved platform support.Greg Clayton2013-11-233-9/+33
| | | | | | | | | | | | 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
* Fixed functions to always reply to packets and added a port offset.Greg Clayton2013-11-222-182/+224
| | | | | | | | | | Fixed a bunch of issues with many functions that were added for the platform host IO calls where they might not reply to the packet if the packet was malformed. Cleaned up error codes. Added a port offset to allow for connections across a USB mux. llvm-svn: 195485
* Added new options to lldb-platform:Greg Clayton2013-11-213-120/+162
| | | | | | | | | | | | | | | --gdbserver-port PORT --min-gdbserver-port PORT --max-gdbserver-port PORT The --gdbserver-port option can be specified multiple times to tell lldb-platform which ports it can use when launching child GDB server processes. The --min-gdbserver-port and --max-gdbserver-port options allow a range of ports to be specified for use when launching child GDB server processes. Fixed the code to manage these ports correctly in GDBRemoteCommunicationServer. Also changed GDBRemoteCommunicationClient to not set a port when sending the "qLaunchGDBServer" packet so that the remote lldb-platform can decide which ports to use. If the lldb-platform was launched with no --gdbserver-port or --min-gdbserver-port/--max-gdbserver-port options, then port 0 is always used and a unix socket is used between the lldb-platform and child GDB server process to coordinate the use of valid port. llvm-svn: 195300
* Expose SBPlatform through the public API.Greg Clayton2013-11-206-79/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/15172417>Greg Clayton2013-11-134-88/+242
| | | | | | | | | | | | | | | Added two new GDB server packets to debugserver: "QSaveRegisterState" and "QRestoreRegiterState". "QSaveRegisterState" makes the remote GDB server save all register values and it returns a save identifier as an unsigned integer. This packet can be used prior to running expressions to save all registers. All registers can them we later restored with "QRestoreRegiterState:SAVEID" what SAVEID is the integer identifier that was returned from the call to QSaveRegisterState. Cleaned up redundant code in lldb_private::Thread, lldb_private::ThreadPlanCallFunction. Moved the lldb_private::Thread::RegisterCheckpoint into its own header file and it is now in the lldb_private namespace. Trimmed down the RegisterCheckpoint class to omit stuff that wasn't used (the stack ID). Added a few new virtual methods to lldb_private::RegisterContext that allow subclasses to efficiently save/restore register states and changed the RegisterContextGDBRemote to take advantage of these new calls. llvm-svn: 194621
* Roll back the changes I made in r193907 which created a new FrameJason Molenda2013-11-042-2/+2
| | | | | | | | | | pure virtual base class and made StackFrame a subclass of that. As I started to build on top of that arrangement today, I found that it wasn't working out like I intended. Instead I'll try sticking with the single StackFrame class -- there's too much code duplication to make a more complicated class hierarchy sensible I think. llvm-svn: 193983
* Add a new base class, Frame. It is a pure virtual function whichJason Molenda2013-11-022-2/+2
| | | | | | | | | | | | | | | | | | | | | defines a protocol that all subclasses will implement. StackFrame is currently the only subclass and the methods that Frame vends are nearly identical to StackFrame's old methods. Update all callers to use Frame*/Frame& instead of pointers to StackFrames. This is almost entirely a mechanical change that touches a lot of the code base so I'm committing it alone. No new functionality is added with this patch, no new subclasses of Frame exist yet. I'll probably need to tweak some of the separation, possibly moving some of StackFrame's methods up in to Frame, but this is a good starting point. <rdar://problem/15314068> llvm-svn: 193907
* <rdar://problem/15263540>Greg Clayton2013-10-253-1/+44
| | | | | | | | 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
* Fixed format strings as they still must specicy a '%' prior to using PRI*64 ↵Greg Clayton2013-10-231-4/+4
| | | | | | macros. llvm-svn: 193260
* Fixes to get LLDB building on Windows again.Deepak Panickal2013-10-222-5/+5
| | | | llvm-svn: 193159
* Fix python-free build.Joerg Sonnenberger2013-10-202-0/+6
| | | | llvm-svn: 193053
* Adjust PC after hitting breakpoint on remote target.Hafiz Abid Qadeer2013-10-182-2/+8
| | | | | | | | 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-184-99/+33
| | | | | | | | | | | | 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-173-290/+22
| | | | | | | | | | | | | | | - 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-155-4/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* <rdar://problem/14146606>Greg Clayton2013-10-102-8/+60
| | | | | | Fixed an issue where environment variables that contained special characters '$' and '#' would hose up the GDB server packet. We now use the QEnvironmentHexEncoded packet that has existed for a long time when we need to. Also added code that will stop sending the QEnvironmentHexEncoded and QEnvironment packets if they aren't supported. llvm-svn: 192373
* Value stored to 'pid' was never read. Found by scan-build ↵Sylvestre Ledru2013-10-061-1/+1
| | | | | | http://buildd-clang.debian.net/scan-build/ llvm-svn: 192060
* * Improve the wording (thanks to Ed Maste for the suggestion)Sylvestre Ledru2013-09-281-1/+3
| | | | | | * Add a TODO item llvm-svn: 191620
* * mktemp is insecure as it always creates or uses insecure temporary file.Sylvestre Ledru2013-09-281-2/+3
| | | | | | | | Switch to mkstemp. * Get and display the error message when an error occurs while creating the temporary file llvm-svn: 191616
* Remove trailing spacesSylvestre Ledru2013-09-281-65/+65
| | | | llvm-svn: 191613
* Fixed detection of 'p' packet support in debugserver,Sean Callanan2013-09-043-4/+12
| | | | | | | | | | by appending the thread ID to the test packet when debugserver requires it. This allows register writing (and, by extension, expressions) to work on Mac OS X. llvm-svn: 190007
* Set the byte order for data in the GDB remote register context.Greg Clayton2013-09-031-1/+1
| | | | llvm-svn: 189827
* Fix a bunch of compile time warnings and a build failure on ubuntu.Eric Christopher2013-08-301-1/+1
| | | | llvm-svn: 189683
* Discover support of 'p' packet.Hafiz Abid Qadeer2013-08-293-1/+26
| | | | | | | Some stubs only support g/G packets for registers. This change makes sure that we check if remote stub supports 'p' packet before using it. llvm-svn: 189576
* Add missing "sys/stat.h" includeDaniel Malea2013-08-281-0/+2
| | | | | | - should help with FreeBSD buildbot llvm-svn: 189487
* Clear 'packet_str' before putting new packet.Hafiz Abid Qadeer2013-08-281-0/+2
| | | | llvm-svn: 189484
* Handle run-length-encoding.Hafiz Abid Qadeer2013-08-281-2/+25
| | | | | | The change was taken from a patch by Virgile Bello. llvm-svn: 189470
* Fix 'platform shell' command for Linux host and remote lldb-platform connectionsDaniel Malea2013-08-271-1/+3
| | | | | | | - add default timeout of 10s (unil qPlatform_RunCommand supports timeout packets and CommandObjectPlatform is updated to read a timeout flag/setting) - add a few tests for platform shell llvm-svn: 189405
* warning cleanup (use LLDB_INVALID_HOST_THREAD instead of NULL)Michael Sartain2013-08-271-1/+1
| | | | llvm-svn: 189393
* Fix MinGW build after lldb-platform-work merge:Virgile Bello2013-08-271-2/+12
| | | | | | | | | - mode_t is defined in <sys/types.h> - reorganized S_* user rights into win32.h - Use Host::Kill instead of kill - Currently #ifdef functions using pread/pwrite. llvm-svn: 189364
* merge lldb-platform-work branch (and assorted fixes) into trunkDaniel Malea2013-08-265-32/+977
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This merge brings in the improved 'platform' command that knows how to interface with remote machines; that is, query OS/kernel information, push and pull files, run shell commands, etc... and implementation for the new communication packets that back that interface, at least on Darwin based operating systems via the POSIXPlatform class. Linux support is coming soon. Verified the test suite runs cleanly on Linux (x86_64), build OK on Mac OS X Mountain Lion. Additional improvements (not in the source SVN branch 'lldb-platform-work'): - cmake build scripts for lldb-platform - cleanup test suite - documentation stub for qPlatform_RunCommand - use log class instead of printf() directly - reverted work-in-progress-looking changes from test/types/TestAbstract.py that work towards running the test suite remotely. - add new logging category 'platform' Reviewers: Matt Kopec, Greg Clayton Review: http://llvm-reviews.chandlerc.com/D1493 llvm-svn: 189295
OpenPOWER on IntegriCloud