summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
Commit message (Collapse)AuthorAgeFilesLines
* Teach LLDB about Windows processes.Zachary Turner2014-07-284-0/+322
| | | | | | | | | This patch creates a simple ProcessWindows process plugin. The only thing it knows how to do currently is create processes. Differential Revision: http://reviews.llvm.org/D4681 llvm-svn: 214094
* 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-234-6/+6
| | | | | | | | | | | 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
* linux process: silence GCC switch coverage warningSaleem Abdulrasool2014-07-201-0/+2
| | | | | | | Add missing entry for eExecMessage message type to silence GCC switch coverage warning. llvm-svn: 213470
* Modify the EFI KDP debugging to not use any dynamic loader since it does ↵Greg Clayton2014-07-161-1/+35
| | | | | | | | | | manual dynamic loading itself via python modules. Also track down the required binary by trying to locate the main executable module through LLDB's symbol and executable file locating code. <rdar://problem/16570258> llvm-svn: 213199
* 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
* lldb needs to support DW_op_piece masks for values in subregister and also ↵Greg Clayton2014-07-121-0/+2
| | | | | | | | | | to be able to piece together a value that is spread across multiple registers. Patch from Adrian Prantl. <rdar://problem/16040521> llvm-svn: 212867
* Fix a type mismatch in NativeProcessLinux that shows up in 32-bit builds.Todd Fiala2014-07-101-1/+1
| | | | | | http://llvm.org/bugs/show_bug.cgi?id=20255 llvm-svn: 212685
* Fixes for broken Debian build - g++ 4.7 support.Todd Fiala2014-07-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | These fix the broken debian lldb build, which is using g++ 4.7.2. TypeFormat changes: 1. stopped using the C++11 "dtor = default;" construct. The generated default destructor in the two derived classes wanted them to have a different throws() semantic that was causing 4.7 to fail to generate it. I switched these to empty destructors defined in the .cpp file. 2. Switched the m_types map from an ordered map to an unordered_map. g++ 4.7's c++ library supports the C++11 emplace() used by TypeFormat but the same c++ library's map impl does not. Since TypeFormat didn't look like it depended on ordering in the map, I just switched it to a std::unordered_map. NativeProcessLinux - g++ 4.7 chokes on lexing the "<::" in static_cast<::pid_t>(wpid). g++ 4.8+ and clang are fine with it. I just put a space in between the "<" and the "::" and that cleared it up. llvm-svn: 212681
* __arm64__ and __aarch64__ #ifdef adjustmentsTodd Fiala2014-07-094-7/+7
| | | | | | | | Change by Paul Osmialowski See http://reviews.llvm.org/D4379 for details. llvm-svn: 212583
* Fix typos.Bruce Mitchener2014-07-084-4/+4
| | | | llvm-svn: 212553
* lldb - problem with some PTRACE_* constants in NativeProcessLinux.cpp fileTodd Fiala2014-07-021-1/+15
| | | | | | | | | | | | | | | | See http://reviews.llvm.org/D4366 for details. Change by Paul Paul Osmialowski Today this is the only problem that I'm facing trying to cross-compile lldb for AArch64 using Linaro's toolchain. PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS are not defined for AArch64 These things can be defined different ways for other architectures, e.g. for x86_64 Linux, asm/ptrace-abi.h defines them as preprocessor constants while sys/ptrace.h defines them in enum along with corresponding PT_* preprocessor constants NativeProcessLinux.cpp includes sys/ptrace.h To avoid accidental redefinition of enums with preprocessor constants, I'm proposing this patch which first checks for PT_* preprocessor constants then checks for PTRACE_* constants then when it still can not find them, it defines preprocessor constants. Similar approach was already used for PTRACE_GETREGSET and PTRACE_SETREGSET constants; in this case however it was easier, since enum values in sys/ptrace.h and preprocessor constants shared all exactly the same names (e.g. there's no additional PT_GETREGSET name defined). llvm-svn: 212225
* 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-0226-32/+32
| | | | llvm-svn: 212172
* Fix typos.Bruce Mitchener2014-07-015-16/+16
| | | | llvm-svn: 212132
* This creates a valid Python API for Windows, pending some issues. The ↵Deepak Panickal2014-07-011-1/+1
| | | | | | | | | | | | | changes included are - - Ported the SWIG wrapper shell scripts to Python so that they would work on Windows too along with other platforms - Updated CMake handling to fix SWIG errors and manage sym-linking on Windows to liblldb.dll - More build fixes for Windows The pending issues are that two Python modules, termios and pexpect are not available on Windows. These are currently required for the Python command interpreter to be used from within LLDB. llvm-svn: 212111
* Use native ::pid_t in Linux ProcessMonitor (local debugging).Todd Fiala2014-07-011-14/+19
| | | | | | | | | | There were a few places where we were not catching the possibility of negative error codes in waitpid() calls. This change fixes those remaining after the llgs branch fixes to ProcessMonitor. Change by Shawn Best. llvm-svn: 212107
* 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-307-55/+41
| | | | | | | | 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-3032-159/+8926
| | | | | | | | | | | | | | | | | | | | | 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
* Factored out Linux proc file reading into separate class.Todd Fiala2014-06-303-0/+140
| | | | | | | | | | | | | Both NativeProcessLinux (in llgs branch) and Linux Host.cpp had similar code to handle /proc file reading. I factored that out into a new Linux-specific ProcFileReader class and added a method that the llgs branch will use for line-by-line parsing. This change also adds numerous Linux-specific files to Xcode that were missing from the Xcode project files. Related to https://github.com/tfiala/lldb/issues/27 llvm-svn: 212015
* lldb: remove adhoc implementation of array_sizeofSaleem Abdulrasool2014-06-275-22/+28
| | | | | | | | 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
* Temporarily roll back the parts of r211241 where I fixed aJason Molenda2014-06-232-2/+2
| | | | | | | | | | mistake in the lock acquistion in HistoryUnwind and HistoryThread. We've got a deadlock with one use case of HistoryUnwind; I need to figure out what lock ordering is causing this and fix it for real. <rdar://problem/17411904> llvm-svn: 211541
* lldb: deal with non-portable PTRACE-related constantsTodd Fiala2014-06-231-0/+20
| | | | | | | | See http://reviews.llvm.org/D4091 for details. Change by Paul Osmialowski. llvm-svn: 211503
* Remove useless callSylvestre Ledru2014-06-211-1/+0
| | | | llvm-svn: 211454
* 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
* Add a lock in the UnwindTable class so two Targets won't tryJason Molenda2014-06-182-2/+2
| | | | | | | | | | to modify the same UnwindTable object simultaneously. Fix HistoryThread and HistoryUnwind's mutex lock acqusition to retain the lock for the duration of the operation instead of releasing the temporary immediately. <rdar://problem/17055023> llvm-svn: 211241
* Avoid crashing on invalid or unreadable ELF coreEd Maste2014-06-171-1/+2
| | | | | | | | | | Issue discovered during the GSoC 2014 project implementing FreeBSD kernel support. The existing elf-core Process plugin crashed trying to read from /dev/mem (the kernel memory device). Patch by Mike Ma. llvm-svn: 211102
* Move x86-specific struct user code for Linux ProcessMonitor behind #define ↵Todd Fiala2014-06-161-0/+4
| | | | | | | | | | guards. See http://reviews.llvm.org/D4092 for details. Change by Paul Osmialowski. (Minor tweaks to the comment by Todd.) llvm-svn: 211026
* Properly terminated POSIX register sets with LLDB_INVALID_REGNUM.Todd Fiala2014-06-141-11/+17
| | | | | | | | | | RegisterSets are assumed to be terminated by this value. Loops over register set values would fail without LLDB_INVALID_REGNUM terminating the list. This change adjusts the static check to account for the size of the register set regnum list being one larger than the expected valid register set count. llvm-svn: 210964
* Add a check that we found an ABI plugin before calling a method on it.Jason Molenda2014-06-131-1/+1
| | | | llvm-svn: 210942
* 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
* Initial merge of some of the iOS 8 / Mac OS X Yosemite specificJason Molenda2014-06-136-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator ↵Greg Clayton2014-05-291-1/+2
| | | | | | | | | | | | | | | | | | 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
* Fix Windows warnings.Todd Fiala2014-05-281-1/+1
| | | | | | | | | | This fixes a number of trivial warnings in the Windows build. This is part of a larger effort to make the Windows build warning-free. See http://reviews.llvm.org/D3914 for more details. Change by Zachary Turner llvm-svn: 209749
* Avoid passing null signal name for Log %s argumentEd Maste2014-05-281-3/+7
| | | | llvm-svn: 209739
* Change ProcessKDP::DoReadMemory() to break up large memoryJason Molenda2014-05-211-1/+25
| | | | | | | | | read requests into smaller chunks; some remote kdp stubs cannot handle memory reads larger than a KB or two & will error out. <rdar://problem/16983125> llvm-svn: 209341
* 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
* Refactored RegisterInfoInterface into its own header.Todd Fiala2014-05-1617-37/+57
| | | | | | | | | Also moved it into the lldb_private namespace. The llgs branch is making use of this interface and its use is not strictly limited to POSIX. llvm-svn: 209016
* lldb: gdb remote support always falls back to $qC when no $qProcessInfo.Todd Fiala2014-05-141-15/+12
| | | | | | | | | | | | See thread here: http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-May/003992.html This is meant to address case 3 that I recently broke with an earlier change to rectify usage of the $qC message for thread ids, specifically: 3. TOT lldb <=> gdbserver (without $qProcessInfo support and not Apple/iOS). llvm-svn: 208741
* Change ProcessElfCore::CreateInstance() to check if the ELF magic bytesJason Molenda2014-05-071-1/+1
| | | | | | | | appear in the file before it assumes the file is ELF. It was incorrectly activating for Mach-O core files. <rdar://problem/16836816> llvm-svn: 208265
* Modify debugserver to follow gdb remote $qC protocol definition.Todd Fiala2014-05-072-6/+52
| | | | | | | | | | $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
* Change ProcessGDBRemote::DoReadMemory to use the x packet to readJason Molenda2014-05-062-4/+154
| | | | | | | | | | | | | | | | 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
* Add GetxPacketSupported to test if the 'x' packet is supported.Jason Molenda2014-05-062-0/+24
| | | | | | <rdar://problem/16032150> llvm-svn: 208052
* Rename eExecution*** to eExpression*** to be consistent with the result type.Jim Ingham2014-05-051-3/+3
| | | | llvm-svn: 207945
OpenPOWER on IntegriCloud