aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-06-24Remove old local-only linux debugging codePavel Labath1-950/+0
Summary: Currently, the local-only path fails about 50% of the tests, which means that: a) nobody is using it; and b) the remote debugging path is much more stable. This commit removes the local-only linux debugging code (ProcessLinux) and makes remote-loopback the only way to debug local applications (the same architecture as OSX). The ProcessPOSIX code is moved to the FreeBSD directory, which is now the only user of this class. Hopefully, FreeBSD will soon move to the new architecture as well and then this code can be removed completely. Test Plan: Test suite passes via remote stub. Reviewers: emaste, vharron, ovyalov, clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D10661 llvm-svn: 240543
2015-05-29Refactor many file functions to use FileSpec over strings.Chaoren Lin1-47/+44
Summary: This should solve the issue of sending denormalized paths over gdb-remote if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the server handle any denormalization. Reviewers: ovyalov, zturner, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D9728 llvm-svn: 238604
2015-05-29Don't #include "lldb-python.h" from anywhere.Zachary Turner1-2/+0
Since interaction with the python interpreter is moving towards being more isolated, we won't be able to include this header from normal files anymore, all includes of it should be localized to the python library which will live under source/bindings/API/Python after a future patch. None of the files that were including this header actually depended on it anyway, so it was just a dead include in every single instance. llvm-svn: 238581
2015-05-13Remove DoAttachToProcessWithId(lldb::pid_t).Zachary Turner1-7/+1
There were two versions of DoAttachToprocessWithId. One that takes a pid_t, and the other which takes a pid_t and a ProcessAttachInfo. There were no callers of the former version, and all of the implementations of this version were simply forwarding calls to one version or the other. llvm-svn: 237281
2015-05-12Get lldb-server building on android-9Vince Harron1-0/+2
Build lldb-server with an android-9 sysroot. llvm-svn: 237078
2015-04-14Adds Register Context Linux/POSIX for ARM Architecture Omair Javaid1-0/+28
This patch is major step towards supporting lldb on ARM. This adds all the required bits to support register manipulation on Linux Arm. Also adds utility enumerations, definitions and register context classes for arm. llvm-svn: 234870
2015-04-01Remove dead code in ProcessPOSIX.Davide Italiano1-33/+0
Differential Revision: http://reviews.llvm.org/D8761 llvm-svn: 233831
2015-02-06Fix TestProcesslaunch regression caused by D7372Pavel Labath1-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
2014-11-19Add test for denied process attach by pid and fix found bugs in ↵Oleksiy Vyalov1-0/+5
Process/ProcessPOSIX.cpp and FreeBSD/ProcessMonitor. http://reviews.llvm.org/D6240 llvm-svn: 222372
2014-11-17Fix broken Linux build after signature change of ResolveExecutable.Oleksiy Vyalov1-6/+7
llvm-svn: 222182
2014-09-27Enable llgs to build against experimental Android AOSP ↵Todd Fiala1-1/+1
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
2014-09-15use std::atomic<> to protect variables being accessed by multiple threadsTodd Fiala1-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
2014-09-08Linux/FreeBSD local debugging: allow redirection to pts for POSIX process.Todd Fiala1-7/+9
See http://reviews.llvm.org/D5135 for more details. Change by Zephyr Zhao. llvm-svn: 217382
2014-08-29Consolidate UnixSignals setting/getting in Process.Todd Fiala1-8/+2
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
2014-08-27lldb Missing ARM64 breakpoint opcode for ProcessPOSIX added.Todd Fiala1-0/+6
See http://reviews.llvm.org/D5078. Change by Paul Osmialowski. llvm-svn: 216559
2014-08-17Fix Linux to respect ASLR settings when launching processes to debug locally ↵Todd Fiala1-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
2014-08-15Move FileSystem functions out of Host and into their own classes.Zachary Turner1-4/+2
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
2014-08-14Refactor FileAction out of ProcessLaunchInfo.Zachary Turner1-3/+3
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
2014-06-30Add lldb-gdbserver support for Linux x86_64.Todd Fiala1-0/+13
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-04-02Use getpgid() with waitpid() in case the process pgid is not equal to its ↵Andrew MacPherson1-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
2014-04-01Implement ProcessMonitor::Kill for LinuxEd Maste1-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
2014-04-01Implement ProcessMonitor::Kill for FreeBSDEd Maste1-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
2014-03-20Switch over to use the ArchSpec::GetMachine() instead of ArchSpec::GetCore() ↵Greg Clayton1-3/+3
to keep the code more portable as we add new core types to ArchSpec. llvm-svn: 204400
2014-03-08POSIX: fix possible invalid API usageSaleem Abdulrasool1-1/+1
strcmp cannot be passed a NULL. Add a short-circuiting check to avoid the possible API misuse. llvm-svn: 203358
2014-03-08POSIX: add missing curly bracesSaleem Abdulrasool1-0/+2
It seems that the original commit missed the curly braces for the scope, always doing the string comparision. llvm-svn: 203357
2014-01-10Get the breakpoint setting, and the Mac OS X DYLD trampolines and expression ↵Jim Ingham1-14/+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
2013-12-11Fix Linux by partially reverting 196787Ed Maste1-0/+126
llvm-svn: 197065
2013-12-09Remove 'const' constraint on ProcessLaunchInfo parameter in Process::DoLaunch().Jean-Daniel Dupas1-1/+1
This 'const' is not required and prevent us to defer the launch to the Host layer. llvm-svn: 196837
2013-12-09Threaded inferior support for FreeBSDEd Maste1-126/+0
Modelled in part on GDBRemoteCommunicationClient. Review: http://llvm-reviews.chandlerc.com/D2267 llvm-svn: 196787
2013-10-11Simplify indirect rld_map for mips (rework r192408).Ed Maste1-15/+2
Just pass a Target* into ObjectFileELF::GetImageInfoAddress so that it can do the extra dereference necessary on MIPS, instead of passing a flag back to the caller. Review: http://llvm-reviews.chandlerc.com/D1899 llvm-svn: 192469
2013-10-11Support mips shared object debug infoEd Maste1-5/+17
MIPS's .dyanamic section is read-only. Instead of using DT_DEBUG for the pointer to dyld information it uses a separate tag DT_MIPS_RLD_MAP which points to storage in the read-write .rld_map section, which in turn points to the dyld information. Review: http://llvm-reviews.chandlerc.com/D1890 llvm-svn: 192408
2013-10-09Add exec support for Linux including common support for POSIX.Matt Kopec1-2/+37
llvm-svn: 192319
2013-09-17Fixing a problem with thread creation signal order dependencyAndrew Kaylor1-1/+20
llvm-svn: 190831
2013-09-03Clean up handling of FreeBSD thread list on Launch / AttachEd Maste1-0/+4
Instead of directly manipulating the thread list in Launch and Attach, just rely on RefreshStateAfterStop to populate the initial list. Review: http://llvm-reviews.chandlerc.com/D1565 llvm-svn: 189889
2013-08-30Move detach to FreeBSD- and Linux-specific classes.Ed Maste1-28/+0
On Linux there is no separate notion of a process (vs. a thread) for ptrace(); each thread needs to be individually detached. On FreeBSD we have a separate process context, and we detach just it. Review: http://llvm-reviews.chandlerc.com/D1418 llvm-svn: 189666
2013-08-29Perform thread lookup after RefreshStateAfterStop()Ed Maste1-2/+2
This fixes a crash on FreeBSD llvm-svn: 189607
2013-08-26merge lldb-platform-work branch (and assorted fixes) into trunkDaniel Malea1-1/+3
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
2013-08-08Remove unreachable code when thread exits on Linux.Matt Kopec1-6/+0
llvm-svn: 187995
2013-07-31Fix thread name updating in Linux. "thread list" should report correct names ↵Michael Sartain1-5/+8
always now. Created new LinuxThread class inherited from POSIXThread and removed linux / freebsd ifdefs Removed several un-needed set thread name calls CR (and multiple suggestions): mkopec llvm-svn: 187545
2013-07-24Modify ProcessPOSIX to use the thread list mutex as neededDaniel Malea1-0/+17
- should resolve (at least some) of the spurious crashes we are seeing in multithreaded tests on Linux (and likely FreeBSD) llvm-svn: 187081
2013-07-10Stop process monitor from ProcessPOSIX::FinalizeAndrew Kaylor1-0/+8
llvm-svn: 186039
2013-07-10Add support for listing inferior thread names on Linux.Matt Kopec1-1/+6
llvm-svn: 186033
2013-07-09Reverting ProcessMonitor shared pointer changesAndrew Kaylor1-4/+2
llvm-svn: 185981
2013-07-09Use shared pointers to hold the process in ProcessMonitorAndrew Kaylor1-2/+4
llvm-svn: 185946
2013-07-09Fix signal handling for POSIX (only tested on Linux) processes in ↵Matt Kopec1-19/+50
multi-threaded programs. Also fix a related issue where if a thread exits after a thread continue, lldb would hang. llvm-svn: 185944
2013-07-04Avoid crash if we fail to resolve process in attachEd Maste1-3/+2
llvm-svn: 185661
2013-07-03Update error message; detach-keeps-stopped is also not on FreeBSDEd Maste1-2/+2
llvm-svn: 185549
2013-07-01Split symbol support for ELF and Linux.Michael Sartain1-1/+1
llvm-svn: 185366
2013-06-26Remove unneeded limbo state flag.Matt Kopec1-13/+2
llvm-svn: 185010
2013-06-03Fix setting of watchpoints on inferior thread creation for Linux.Matt Kopec1-21/+35
llvm-svn: 183139