summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/POSIX
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't #include ClangPersistentVariables.h from Process.hZachary Turner2015-03-034-4/+8
| | | | | | | Nothing from this header file was even being referenced in Process.h anyway, so it was a completely unnecessary include. llvm-svn: 231131
* Fix TestProcesslaunch regression caused by D7372Pavel Labath2015-02-061-1/+10
| | | | | | | | | | | | | | | | | | | | | | | Summary: After closing all the leaked file descriptors to the inferior tty, the following problem occured: - when stdin, stdout and stderr are redirected, there are no slave descriptors open (which is good) - lldb has a reader thread, which attempts to read from the master end of the tty - this thread receives an EOF - in response, it closes it's master end - as this is the last open file descriptor for the master end, this deletes the tty and sends SIGHUP to the inferior (this is bad) I fix this problem by making sure the master end remains open for the duration of the inferior process by storing a copy of the file descriptor in ProcessMonitor. I create a copy to avoid ownership issues with the reading thread. Reviewers: ovyalov, emaste Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7440 llvm-svn: 228391
* Implement initial Altivec supportJustin Hibbits2015-02-052-0/+23
| | | | | | | | | | | | | | | | | Summary: This adds the register plumbing, as well as register reading in FreeBSD core dumps. Further work on the POSIX/FreeBSD ProcessMonitor is required in order to support ptrace access to these registers. Reviewers: tfiala, emaste Reviewed By: emaste Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D7039 llvm-svn: 228278
* Add PowerPC FPR access to the process monitorJustin Hibbits2015-02-051-21/+22
| | | | | | | | | | | | | | Summary: This adds reading and writing to the POSIX PowerPC ProcessMonitor. Reviewers: emaste Reviewed By: emaste Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D7040 llvm-svn: 228277
* Share crash information between LLGS and local POSIX debugging withChaoren Lin2015-02-037-254/+402
| | | | | | | CrashReason class. Deliver crash information from LLGS to lldb via description field of thread stop packet. llvm-svn: 227926
* Add test for denied process attach by pid and fix found bugs in ↵Oleksiy Vyalov2014-11-191-0/+5
| | | | | | | | | | Process/ProcessPOSIX.cpp and FreeBSD/ProcessMonitor. http://reviews.llvm.org/D6240 llvm-svn: 222372
* Fix broken Linux build after signature change of ResolveExecutable.Oleksiy Vyalov2014-11-171-6/+7
| | | | llvm-svn: 222182
* Improve PowerPC unwind supportJustin Hibbits2014-11-121-1/+6
| | | | | | | | | | | | | | | | | Summary: Taking advantage of the new 'CFAIsRegisterDereferenced' CFA register type, add full stack unwind support to the PowerPC/PowerPC64 ABI. Also, add a new register set for powerpc32-on-64, so the register sizes are correct. This also requires modifying the ProcessMonitor to add support for non-uintptr_t-sized register values. Reviewers: jasonmolenda, emaste Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D6183 llvm-svn: 221789
* Fix a bunch of [-Werror,-Winconsistent-missing-override] errors.Eric Christopher2014-11-041-28/+28
| | | | llvm-svn: 221231
* First cut of PowerPC(64) support in LLDB.Justin Hibbits2014-10-314-0/+434
| | | | | | | | | | | | | | | | | | | | | | | Summary: This adds preliminary support for PowerPC/PowerPC64, for FreeBSD. There are some issues still: * Breakpoints don't work well on powerpc64. * Shared libraries don't yet get loaded for a 32-bit process on powerpc64 host. * Backtraces don't work. This is due to PowerPC ABI using a backchain pointer in memory, instead of a dedicated frame pointer register for the backchain. * Breakpoints on functions without debug info may not work correctly for 32-bit powerpc. Reviewers: emaste, tfiala, jingham, clayborg Reviewed By: clayborg Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D5988 llvm-svn: 220944
* Minor tweak to Ed's FreeBSD fix.Todd Fiala2014-10-011-1/+1
| | | | | | | Fall back to including the Linux version if not on __FreeBSD__. Also covers __ANDROID__ case. llvm-svn: 218770
* Add a bandaid to fix the FreeBSD buildEd Maste2014-10-011-0/+4
| | | | | | | | | | | | r218568 added an explicit #include of the Linux ProcessMonitor.h to POSIXThread.cpp, rather than including just "ProcessMonitor.h" and relying on the build infrastructure for the appropriate paths. For now add #ifdefs in the source to use the FreeBSD or Linux header as appropriate; a cleaner fix (and perhaps some refactoring of the POSIX classes) should still be done later. llvm-svn: 218762
* Enable llgs to build against experimental Android AOSP ↵Todd Fiala2014-09-276-17/+17
| | | | | | | | | | | | 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
* use std::atomic<> to protect variables being accessed by multiple threadsTodd Fiala2014-09-151-2/+1
| | | | | | | | | | There are several places where multiple threads are accessing the same variables simultaneously without any kind of protection. I propose using std::atomic<> to make it safer. I did a special build of lldb, using the google tool 'thread sanitizer' which identified many cases of multiple threads accessing the same memory. std::atomic is low overhead and does not use any locks for simple types such as int/bool. See http://reviews.llvm.org/D5302 for more details. Change by Shawn Best. llvm-svn: 217818
* Create a HostThread abstraction.Zachary Turner2014-09-091-1/+5
| | | | | | | | | | | | | 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
* Fix configure & make build with python disabledKeno Fischer2014-09-091-4/+4
| | | | | | | | | | | | | This makes sure that nothing that requires Python is being built when the LLDB_DISABLE_PYTHON flag is being passed in. It also changes a use of CPPFLAGS to CPP.Flags since the former is overridden when external flags are passed in while the later is not. I'm not sure exactly why LLDB_DISABLE_PYTHON is in CXXFLAGS rather than CPPFLAGS, but cleaning that up is for another commit. Differential Revision: http://reviews.llvm.org/D4918 llvm-svn: 217414
* Linux/FreeBSD local debugging: allow redirection to pts for POSIX process.Todd Fiala2014-09-082-8/+11
| | | | | | | | See http://reviews.llvm.org/D5135 for more details. Change by Zephyr Zhao. llvm-svn: 217382
* Linux ARM64: add ProcessMonitor-related RegisterContext support.Todd Fiala2014-09-024-0/+424
| | | | | | | | See http://reviews.llvm.org/D5089 for more details. Change by Paul Osmialowski. llvm-svn: 216907
* Consolidate UnixSignals setting/getting in Process.Todd Fiala2014-08-292-16/+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
* lldb - Register Context Linux ARM64Todd Fiala2014-08-291-0/+5
| | | | | | | | | | | | | Yet another step toward ARM64 support. With this commit, lldb-gdbserver started on ARM64 target can be accessed by lldb running on desktop PC and it can process simple commands (like 'continue'). Still ARM64 support lacks NativeRegisterContextLinux_arm64.* code which waits to be implemented. Based on similar files for Linux x86_64 and Darwin ARM64. Due to common code extraction from Darwin related files, lldb should be tested for any unexpected regression on Darwin ARM64 machines too. See the following for more details: http://reviews.llvm.org/D4580 http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140825/012670.html Change by Paul Osmialowski. llvm-svn: 216737
* lldb Missing ARM64 breakpoint opcode for ProcessPOSIX added.Todd Fiala2014-08-271-0/+6
| | | | | | | | See http://reviews.llvm.org/D5078. Change by Paul Osmialowski. llvm-svn: 216559
* Move Host::GetArchitecture to HostInfo::GetArchitecture.Zachary Turner2014-08-201-4/+6
| | | | | | | | As a side effect, this patch also eliminates all of the preprocessor conditionals previously used to implement GetArchitecture(). llvm-svn: 216074
* Fix Linux to respect ASLR settings when launching processes to debug locally ↵Todd Fiala2014-08-171-0/+1
| | | | | | | | | | and remotely. See the following links for details: http://llvm.org/bugs/show_bug.cgi?id=20658 See http://reviews.llvm.org/D4941 llvm-svn: 215822
* Move FileSystem functions out of Host and into their own classes.Zachary Turner2014-08-152-7/+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-142-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
* Fix typos.Bruce Mitchener2014-07-011-1/+1
| | | | llvm-svn: 212132
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-302-0/+16
| | | | | | | | | | | | | | | | | | | | | 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
* Remove useless callSylvestre Ledru2014-06-211-1/+0
| | | | llvm-svn: 211454
* Refactored RegisterInfoInterface into its own header.Todd Fiala2014-05-164-4/+4
| | | | | | | | | 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
* Address hung tests in Linux.Todd Fiala2014-04-181-1/+1
| | | | | | Follow-up patch coming to address test failures exposed by this change. llvm-svn: 206618
* Use getpgid() with waitpid() in case the process pgid is not equal to its ↵Andrew MacPherson2014-04-021-2/+10
| | | | | | pid, as is the case with a forked subprocess. Also a couple of fixes for unit test failures from Todd Fiala. llvm-svn: 205405
* Implement ProcessMonitor::Kill for LinuxEd Maste2014-04-011-4/+0
| | | | | | | | | | | | | | | | | | | | | On FreeBSD ptrace(PT_KILL) is used to terminate the traced process (as if PT_CONTINUE had been used with SIGKILL as the signal to be delivered), and is the desired behaviour for ProcessPOSIX::DoDestroy. On Linux, after ptrace(PTRACE_KILL) the traced process still exists and can be interrogated. It is only upon resume that it exits as though it received SIGKILL. As the Linux PTRACE_KILL behaviour is not used by LLDB, rename BringProcessIntoLimbo to Kill, and change the implementation to simply call kill() instead of using ptrace. Thanks to Todd F for testing (Ubuntu 12.04, gcc 4.8.2). Sponsored by: DARPA, AFRL Differential Revision: http://llvm-reviews.chandlerc.com/D3159 llvm-svn: 205337
* Implement ProcessMonitor::Kill for FreeBSDEd Maste2014-04-011-3/+5
| | | | | | | | | | | | | | | | | On FreeBSD ptrace(PT_KILL) is used to terminate the traced process (as if PT_CONTINUE had been used with SIGKILL as the signal to be delivered), and is the desired behaviour for ProcessPOSIX::DoDestroy. On Linux, after ptrace(PTRACE_KILL) the traced process still exists and can be interrogated. It is only upon resume that it exits as though it received SIGKILL. For now I'm committing only the FreeBSD change, until the Linux change (review D3159) is successfully tested. http://llvm.org/pr18894 llvm-svn: 205315
* Suppress SIGSTOP under Linux and don't explicitly call SetResumeSignal() in ↵Andrew MacPherson2014-03-211-5/+0
| | | | | | POSIXThread, instead just let StopInfo handle it. llvm-svn: 204504
* Fixed case typo.Greg Clayton2014-03-201-3/+3
| | | | llvm-svn: 204402
* Switch over to use the ArchSpec::GetMachine() instead of ArchSpec::GetCore() ↵Greg Clayton2014-03-202-32/+22
| | | | | | to keep the code more portable as we add new core types to ArchSpec. llvm-svn: 204400
* Moved various RegisterContext files from Process/POSIX to Process/Utility ↵Virgile Bello2014-03-1223-3600/+2
| | | | | | | | | for easier sharing. Fix Windows build by adding JITLoaderGDB and ProcessElfCore. RegisterContext: fixes for Windows build: sizeof(GPR::register) didn't work, switched to sizeof(((GPR*)NULL)->register). llvm-svn: 203667
* POSIX: fix possible API misuseSaleem Abdulrasool2014-03-081-5/+5
| | | | | | | | | memcpy cannot be passed NULL. Ensuring that the destination pointer is non-NULL requires checking success. Rather than performing the success check at that point, increasing indentation an additional level, fold it into the previous statement. llvm-svn: 203359
* POSIX: fix possible invalid API usageSaleem Abdulrasool2014-03-081-1/+1
| | | | | | | strcmp cannot be passed a NULL. Add a short-circuiting check to avoid the possible API misuse. llvm-svn: 203358
* POSIX: add missing curly bracesSaleem Abdulrasool2014-03-081-0/+2
| | | | | | | It seems that the original commit missed the curly braces for the scope, always doing the string comparision. llvm-svn: 203357
* Get Linux i386 running.Todd Fiala2014-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This change uses a fixed known offset for the Linux i386 DR0 register. This change also undoes the 32-bit wordsize change from r169645 that revolved around being 32-bit/64-bit friendly in WriteRegOperation::Execute within the Linux ProcessMonitor.cpp. I ran all the tests on x86_64 Linux with no failures. I also ran some simple tests with 32-bit Linux exe on x86_64 host and 32-bit linux exe on i686 32-bit host and these worked fine. Note (from Todd): the UserData struct in the Linux i386 register context (only used by Linux i386 host running Linux 32-bit inferior) is out of sync with what shows up in the sys/user.h for an 32-bit Linux build (per an earlier change of mine to make it look more like x86_64 host running x86 exe). I think we should (1) make i386 Linux targets run using the same register context (and correct ones) on i386 and x86_64 linux hosts if that is possible, and (2) we could use some tests around the register handling, particularly to verify things like DR0 registers are in the right spots on host/target combos that we can verify vs. known correct values. Change by Matthew Gardiner. llvm-svn: 202887
* Simplify POSIXThread register context handlingEd Maste2014-02-281-30/+38
| | | | | | | | | | | This seems a little more straightforward and is equivalent to r201457 for ELF core files. A case for FreeBSD i386 is also added (it was incorrectly using the 64-bit register context and corrupting mememory). Better (user-facing) error handling is still needed. Review: http://llvm-reviews.chandlerc.com/D2765 llvm-svn: 202549
* Fix linux x86 debugging on a linux x86 host (32-bit on 32-bit).Todd Fiala2014-02-273-9/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes up issues with specifying the size of the i386 register infos for FPU registers. The bug was that for the i386 register context, the size of the FPU registers were still being computed based on the x86_64 FXSAVE structure. This change permits the FPR_SIZE macro to optionally be defined outside of RegisterInfos_i386.h, which RegisterContextLinux_i386.cpp does properly. It redefines the FPR_i386 structure with all the accessible parts that RegisterInfos_i386.h wants to see, which we had not done before when we made the overall size of the structure properly sized a recently. This change also modifies POSIXThread to create a RegisterContextLinux_i386 only when the host is 32-bit; otherwise, it uses the RegisterContextLinux_x86_64, which works properly for 32-bit and 64-bit inferiors on a 64-bit host. I tested this debugging a Linux x86 exe on an x86 host (Ubuntu 13.10 x86), and debugging a Linux x86 exe and a Linux x86-64 exe on an x86-64 host (Ubuntu 12.04 LTS). Those cases all worked. Thanks to Matthew Gardiner who discoverd may key insights into tracking down the issue. The motivation for this change and some of the code originates from him via this thread: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140224/010554.html llvm-svn: 202428
* Fix x86 32-bit register context definition to build properly on 32 and ↵Todd Fiala2014-02-261-1/+13
| | | | | | | | | | | | | | 64-bit hosts. This fix changes thee x86 32-bit floating point register area to be the proper size independent of the host platform. Note as of this change list, this register context is not yet used since selecting it exposes issues with watchpoint assertions. Change by Matthew Gardiner. llvm-svn: 202285
* FreeBSD hardware watchpoint implementationEd Maste2014-02-195-5/+70
| | | | | | | | | | | | | | | Implement x86_64 debug register read/write in support of hardware watchpoints. Hoist LinuxThread::TraceNotify code back into POSIXThread::TraceNotify() Patch by John Wolfe. We still need to rework this later to avoid the #ifdef FreeBSD. llvm-reviews.chandlerc.com/D2572 llvm.org/pr16706 llvm-svn: 201706
* Avoid undesired variable shadowingEd Maste2014-02-131-2/+0
| | | | | | | | Michael Sartain refactored RegisterContextPOSIX_* in r192332, and I must have missed the now-shadowed variable when I rebased the FreeBSD MIPS64 register context after that. llvm-svn: 201334
* Get the breakpoint setting, and the Mac OS X DYLD trampolines and expression ↵Jim Ingham2014-01-102-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | evaluator to handle Indirect symbols correctly. There were a couple of pieces to this. 1) When a breakpoint location finds itself pointing to an Indirect symbol, when the site for it is created it needs to resolve the symbol and actually set the site at its target. 2) Not all breakpoints want to do this (i.e. a straight address breakpoint should always set itself on the specified address, so somem machinery was needed to specify that. 3) I added some info to the break list output for indirect symbols so you could see what was happening. Also I made it clear when we re-route through re-exported symbols. 4) I moved ResolveIndirectFunction from ProcessPosix to Process since it works the exact same way on Mac OS X and the other posix systems. If we find a platform that doesn't do it this way, they can override the call in Process. 5) Fixed one bug in RunThreadPlan, if you were trying to run a thread plan after a "running" event had been broadcast, the event coalescing would cause you to miss the ThreadPlan running event. So I added a way to override the coalescing. 6) Made DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan handle Indirect & Re-exported symbols. <rdar://problem/15280639> llvm-svn: 198976
* Fix Linux by partially reverting 196787Ed Maste2013-12-114-2/+167
| | | | llvm-svn: 197065
* 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
* Threaded inferior support for FreeBSDEd Maste2013-12-094-167/+5
| | | | | | | Modelled in part on GDBRemoteCommunicationClient. Review: http://llvm-reviews.chandlerc.com/D2267 llvm-svn: 196787
OpenPOWER on IntegriCloud