Commit Graph

697 Commits

Author SHA1 Message Date
Sean Callanan 2683aca12e Fixed our install-headers script to set version
numbers correctly.

<rdar://problem/17708687>

llvm-svn: 213284
2014-07-17 17:26:38 +00:00
Ed Maste c25d5cc777 Fix lldb-gdbserver build
s_listen_thread had the wrong type.

llvm-svn: 212884
2014-07-12 21:46:39 +00:00
Todd Fiala a6a362a086 llgs: modify to accept --native-regs flag.
This is the last flag sent by lldb-platform that was not accepted
by llgs and is accepted by debugserver.

Conditionalized out a bit more code in prep for Windows
support one day based on _WIN32 define.

Updated the lldb-gdbserver usage string to represent
recent updates to command line arguments (and some older
ones like --attach pid).

Implements https://github.com/tfiala/lldb/issues/37

llvm-svn: 212879
2014-07-12 17:34:24 +00:00
Todd Fiala 289ca249f0 llgs: implement --setsid.
The --setsid (-S) option changes the session id for the lldb-gdbserver process.
This is used by tools such as lldb-platform and allows the user to prevent
llgs from being in the same session as a calling terminal session.
This will prevents terminal group control signals from affecting
lldb-gdbserver.

See also:
https://github.com/tfiala/lldb/issues/38

llvm-svn: 212873
2014-07-12 01:12:44 +00:00
Todd Fiala 67041194b9 Added llgs --named-pipe support and program_name-version_number printout support.
Added a unit test to test debugserver and llgs compliance on --named-pipe support.

Modified llgs to implement --named-pipe support.  (Note: need to revisit with
new generic pipe support).

llvm-svn: 212854
2014-07-11 22:50:13 +00:00
Todd Fiala 013434e547 __arm64__ and __aarch64__ #ifdef adjustments
Change by Paul Osmialowski

See http://reviews.llvm.org/D4379 for details.

llvm-svn: 212583
2014-07-09 01:29:05 +00:00
Greg Clayton 389be9558f Make sure that qProcessInfo packet returns correct cpu type/subtype for processes on Haswell machines with a Haswell enabled kernel.
<rdar://problem/17332107>

llvm-svn: 212567
2014-07-08 21:45:21 +00:00
Bruce Mitchener aaa0ba31a9 Fix typos.
llvm-svn: 212553
2014-07-08 18:05:41 +00:00
Bruce Mitchener d93c4a3339 Fix typos.
llvm-svn: 212132
2014-07-01 21:22:11 +00:00
Todd Fiala af245d115b Add lldb-gdbserver support for Linux x86_64.
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
2014-06-30 21:05:18 +00:00
Todd Fiala 6d6b55d153 Pull ProcessInfo and ProcessLaunchInfo out of Target/Process.
Elevate ProcessInfo and ProcessLaunchInfo into their own headers.
llgs will be using ProcessLaunchInfo but doesn't need to pull in
the rest of Process.h.

This also moves a bunch of implementation details from the header
declarations into ProcessInfo.cpp and ProcessLaunchInfo.cpp.

Tested on Ubuntu 14.04 Cmake and MacOSX Xcode.

Related to https://github.com/tfiala/lldb/issues/26.

llvm-svn: 212005
2014-06-30 00:30:53 +00:00
Jim Ingham c1fdb889a9 Revert the debugserver part of r211868. While formally a fine change, debugserver
doesn't depend on llvm (it really doesn't even depend on anything in lldb) and this
nicety isn't worth adding that dependence.

llvm-svn: 211903
2014-06-27 16:02:55 +00:00
Saleem Abdulrasool 28606954bf lldb: remove adhoc implementation of array_sizeof
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
2014-06-27 05:17:41 +00:00
Bruce Mitchener 6a7f33387d Fix a few typos.
llvm-svn: 211851
2014-06-27 02:42:12 +00:00
Jim Ingham 106d02866d Added an option to turn OFF the "detach on error" behavior that was added
to debugserver when launching processes.

<rdar://problem/16216199>

llvm-svn: 211658
2014-06-25 02:32:56 +00:00
Jim Ingham 6008924508 Rework fix in r201744. You really DO need to waitpid twice to get the
process fully reaped.  The race & bad behavior was because we were letting
the reaping thread in LLDB to also set the Process exit status, so debugserver
would sometimes be shut down before it got a chance to report the exit status, 
and then we got confused.

<rdar://problem/16555850>

llvm-svn: 211636
2014-06-24 21:51:42 +00:00
Ed Maste 1adc731a2e Restore r211547: Add newline on last line of a few files.
llvm-svn: 211621
2014-06-24 19:18:28 +00:00
Ed Maste 4cfcca7b6f Restore fixes reverted by r211607:
r209631: Use MIUtilSystemLinux on FreeBSD as well

  We should later rename this file (probably MIUtilSystemPOSIX), but
  more clean-up is still needed here, and we can wait until we better
  understand how this code may be shared between FreeBSD, Linux, and OS X.

r209632: Add stdlib.h for malloc and friends

r209633: Remove include of obsolete stropts.h header

  The header is for POSIX streams functionality, and does not exist on
  FreeBSD, OS X, or contemporary Linux distributions.

Issue reported by John Wolfe.

llvm-svn: 211620
2014-06-24 19:16:18 +00:00
Deepak Panickal 3c4d7ad883 Remove unused files, causing CMake build error.
llvm-svn: 211618
2014-06-24 18:20:51 +00:00
Deepak Panickal 877569c2b8 Added support for new MI commands and bug fixes. More details in MIReadme.txt.
llvm-svn: 211607
2014-06-24 16:35:50 +00:00
Jason Molenda 7567d50f30 Add newline on last line of a few files.
llvm-svn: 211547
2014-06-23 22:26:01 +00:00
Sylvestre Ledru 38c8a7be7b Remove useless declaration
llvm-svn: 211468
2014-06-22 13:18:53 +00:00
Sylvestre Ledru 002c25602c Simplify the code (variable bValid is not really interesting)
llvm-svn: 211452
2014-06-21 23:48:45 +00:00
Sylvestre Ledru 88e68cdc94 Remove useless declaration
llvm-svn: 211451
2014-06-21 23:47:20 +00:00
Greg Clayton ce1843bcd6 Add an option for debugserver to propagate its environment to programs it launches using the --forward-env or -F:
% ./debugserver --forward-env localhost:1234 -- /bin/ls
% ./debugserver -F localhost:1234 -- /bin/ls

Also allow new environment variables to be set using the "--env" or "-e":

% ./debugserver --env FOO=1 --env BAR=2 localhost:1234 -- /bin/ls
% ./debugserver -e FOO=1 -e BAR=2 localhost:1234 -- /bin/ls

<rdar://problem/17350654> 

llvm-svn: 211200
2014-06-18 18:26:50 +00:00
Jim Ingham 0c7ebe9609 Those were not the right defines for memory errors, and the right defines aren't
available.  So going back to a generic error instead.

<rdar://problem/17058708>

llvm-svn: 211124
2014-06-17 21:02:44 +00:00
Kuba Brecka 58bd5cfecd Don't hardcode path to codesign_allocate.
Building OS X debugserver assumes you have an Xcode installation at /Application/Xcode.app. Let's instead detect where Xcode is using xcrun.

See http://reviews.llvm.org/D4152

llvm-svn: 211074
2014-06-16 22:55:16 +00:00
Jason Molenda 567b1546ac whitespace cleanup
llvm-svn: 210875
2014-06-13 02:44:21 +00:00
Jason Molenda 705b180964 Initial merge of some of the iOS 8 / Mac OS X Yosemite specific
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
2014-06-13 02:37:02 +00:00
Greg Clayton a2715cf108 Added the ability to save core files:
(lldb) file /bin/ls
(lldb) b malloc
(lldb) run
(lldb) process save-core /tmp/ls.core

Each ObjectFile plug-in now has the option to save core files by registering a new static callback.

llvm-svn: 210864
2014-06-13 00:54:12 +00:00
Todd Fiala 7f02cff20d Remove unused defines from lldb driver.
See http://reviews.llvm.org/D3965 for details.

Change by Thiago Farina.

llvm-svn: 210268
2014-06-05 14:46:04 +00:00
Greg Clayton 7ab7f89ae0 iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator 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
2014-05-29 21:33:45 +00:00
Ed Maste 1ae28dd793 Add stdlib.h for malloc and friends
llvm-svn: 209633
2014-05-26 14:07:26 +00:00
Ed Maste 8c43ed45ef Remove include of obsolete stropts.h header
The header is for POSIX streams functionality, and does not exist on
FreeBSD, OS X, or contemporary Linux distributions.

llvm-svn: 209632
2014-05-26 14:04:29 +00:00
Ed Maste 4c433e5206 Use MIUtilSystemLinux on FreeBSD as well
We should later rename this file (probably MIUtilSystemPOSIX), but
more clean-up is still needed here, and we can wait until we better
understand how this code may be shared between FreeBSD, Linux, and OS X.

llvm-svn: 209631
2014-05-26 13:57:15 +00:00
Ed Maste d60480f7b6 Add missing header
Presumably included by header leakage on other platforms.

llvm-svn: 209630
2014-05-26 13:48:38 +00:00
Todd Fiala 76e1bf53b4 Revert r209142.
Need to spend a little more time with suppressing the debugserver 64-to-32 bit warnings.
Will re-submit after I get the warnings properly suppressed.

llvm-svn: 209151
2014-05-19 18:30:48 +00:00
Todd Fiala 37ba9f5d8a Update Xcode settings for Xcode 5.1 (5B130a) to remove workspace warning.
llvm-svn: 209142
2014-05-19 16:58:52 +00:00
Hafiz Abid Qadeer 31f56816af Build lldb-mi with autotools on Linux.
THe lldb-mi stuff was not being built on Linux with autotools.
I only added Linux now as I have tested that it build fine on Linux.

llvm-svn: 209117
2014-05-19 09:12:15 +00:00
Todd Fiala ff6131a958 Add support for gdb remote $X stop notification.
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
2014-05-19 04:57:23 +00:00
Deepak Panickal 95442c445f Do not require the triple to be hard-coded
llvm-svn: 208982
2014-05-16 13:26:45 +00:00
Deepak Panickal 6f9c468102 Initial commit of LLDB Machine Interface Frontend.
- Tested with Eclipse, likely to work with other GDB/MI compatible GUIs.
- Some but not all MI commands have been implemented. See MIReadme.txt for more info.
- Written from scratch, no GPL code, based on LLDB Public API.
- Built for Linux, Windows and OSX. Tested on Linux and Windows.
- GDB/MI Command Reference, https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html

llvm-svn: 208972
2014-05-16 10:51:01 +00:00
Todd Fiala 9f72b3a1ce Modify debugserver to follow gdb remote $qC protocol definition.
$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
2014-05-07 19:28:21 +00:00
Jason Molenda 018ff31462 Add a simple qSupported packet, fix a bug in decode_binary_data(),
add a new 'x' packet for reading data in binary format.  Document
the 'x' packet.  
<rdar://problem/16032150> 

llvm-svn: 208051
2014-05-06 02:53:43 +00:00
Joerg Sonnenberger 2cd8f5245f Use correct readline header on NetBSD.
llvm-svn: 207861
2014-05-02 18:59:49 +00:00
Greg Clayton bb49289023 Allow for a task port to change when we exec.
llvm-svn: 207699
2014-04-30 20:27:01 +00:00
Greg Clayton 040c560f2c Report the result of waitpid() a little more clearly as well as clearly logging the process status.
llvm-svn: 207698
2014-04-30 20:24:10 +00:00
Jason Molenda f0d5b54030 Correct offsets in the debugserver arm back end for the s and d registers so we get the offsets
of these correct after the changes of r194302.
<rdar://problem/16176270> 

llvm-svn: 207600
2014-04-30 00:30:07 +00:00
Todd Fiala 71afe0b1d5 Make lldb-gdbserver configure/(g)make build parity with cmake.
This now builds lldb-gdbserver on all Linux and FreeBSD architectures
rather than being locked to x86_64 architectures only.

Please note lldb-gdbserver is not yet functional, this just enables
the non-x86_64 Linux/FreeBSD build using the configure/make build
system.

 --This line, and
those below, will be ignored--

M    tools/Makefile

llvm-svn: 207556
2014-04-29 16:57:45 +00:00
Todd Fiala 9164d9b304 Fixed up lldb-gdbserver to match slightly different debugserver listener host:port message.
Fixed up typo in lldb-gdbserver name missed when working on the OS X side earlier today for debugserver support.

llvm-svn: 207398
2014-04-28 06:04:46 +00:00