summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Moving header files from source/Host/common to proper location.Chaoren Lin2015-02-031-2/+2
| | | | llvm-svn: 227929
* Make ThreadStateCoordinator to handle properly failed stop/resume operations.Chaoren Lin2015-02-031-11/+12
| | | | llvm-svn: 227928
* Share crash information between LLGS and local POSIX debugging withChaoren Lin2015-02-031-4/+3
| | | | | | | CrashReason class. Deliver crash information from LLGS to lldb via description field of thread stop packet. llvm-svn: 227926
* Modify ThreadStateCoodrinator in order to resume threads if stop wasn't ↵Chaoren Lin2015-02-031-94/+85
| | | | | | requested. llvm-svn: 227924
* Refactor ptrace commands in NativeProcessLinux to use Error as result return ↵Chaoren Lin2015-02-031-260/+174
| | | | | | type. llvm-svn: 227923
* LLGS local - signal stops inferior in debuggerChaoren Lin2015-02-031-20/+1
| | | | | | | | | | | | | NativeProcessLinux::MonitorSignal was automatically resuming threads that stopped due to a signal.  This is inconsistent with the behavior of lldb and gdb.  This change removes the automatic resume. Fixes TestSendSignal.py TestSignalsAPI.py if PLATFORM_LINUX_FORCE_LLGS_LOCAL is in the environment vars. llvm-svn: 227918
* Fix up NativeProcessLinux::Interrupt() to use thread state coordinator ↵Chaoren Lin2015-02-031-0/+73
| | | | | | mechanism. llvm-svn: 227917
* Added code to prevent "administrative stop" from overwriting a real stop reason.Chaoren Lin2015-02-031-5/+38
| | | | | | | | | | | | Note this code path should not happen - it implies a bug in another part of the code. For the thread to receive the stop signal as it is handled, the and for it to already have a stop reason, it implies the kernel was able to tell the thread that it stopped while it was stopped. More likely this seems to indicate a bug where an actual thread start was not getting correctly logged. If it does get hit, we'll want to understand the sequence to figure out if it is truly legitimate or if it implies another bug. llvm-svn: 227916
* Fix step commands that mix running threads and stepping threads.Chaoren Lin2015-02-031-5/+0
| | | | | | This fixes https://github.com/tfiala/lldb/issues/62. llvm-svn: 227915
* Disabled local-llgs hijacking of state on startup; passed along signo to ↵Chaoren Lin2015-02-031-13/+2
| | | | | | | | | | | killed process. It looks like Shawn's fix addresses what the initial hijacking was trying to accomplish per conversations with Greg and Jim. The hijacking was causing several tests to hang (#61, #62, #63, #64, #67, possibly more). These tests now just fail rather than hang with this modification. llvm-svn: 227914
* Fix some bugs in llgs thread state handling.Chaoren Lin2015-02-031-9/+9
| | | | | | | | | | | | | | | | | | | | | | * When the thread state coordinator is told to skip sending a stop request for a running thread that is ignored (e.g. the thread that steps in a step operation is technically running and should not have a stop sent to it, since it will stop of its own accord per the kernel step operation), ensure the deferred signal notification logic still waits for the skipped thread. (i.e. we want to defer the notification until the stepping thread is indeed stopped, we just don't want to send it a tgkill). * Add ThreadStateCoordinator::RequestResumeAsNeeded(). This variant of the RequestResume() method does not call the error function when the thread is already running. Instead, it just logs that the thread is already running and skips the resume operation. This is useful for the case of vCont;c handling, where we tell all threads that they should be running. At the place we're calling, all we know is "we want this thread running if it isn't already," and that's exactly what this command does. * Formatting change (minor) in NativeThreadLinux logging. llvm-svn: 227913
* llgs: more work on thread stepping.Chaoren Lin2015-02-031-6/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/tfiala/lldb/issues/75. Not fixed yet but continuing to push this further. Fixes: * Resume() now skips doing deferred notifications if we're doing a vCont;{c,C}. In this case, we're trying to start something up, not defer a stop notification. The default thread action stop mode pickup was triggering a stop because it had at least one stop, which was wrong in the case of a continue. (Bug introduced by previous change.) * Added a variant to ThreadStateCoordinator to specify a set of thread ids to be skipped when triggering stop notifications to non-stopped threads on a deferred signal call. For the case of a stepping thread, it is actually told to step (and is running) for a brief moment, but the thread state coordinator would think it needed to send the stepping thread a stop, which id doesn't need to do. This facility allows me to get around that cleanly. With this change, behavior is now reduced to something I think is essentially a different bug: * Doing a step into libc code from my code crashes llgs. * Doing a next out of a function in my own code crashes llgs. llvm-svn: 227912
* llgs: fix up some handling of stepping.Chaoren Lin2015-02-031-39/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Tracked down while working on https://github.com/tfiala/lldb/issues/75. This is not a complete fix for that issue, but moves us farther along. Fixes: * When a thread step is requested via vCont:{s,S}, Resume() now marks the stepping thread as (1) currently stepping and (2) does trigger the deferred signal for the stepped thread. This fixes a bug where we were actually triggering a deferred stop cycle here for the non-stepping thread since the single step thread was not part of the Resume() deferred signal mechanism. The stepping thread is also marked in the thread state coordinator as running (via a resume callback). * When we get the SIGTRAP signal for the step completion, we don't do a deferred signal call - that happened during the vCont:{s,S} processing in Resume() already. Now we just need to mark that the stepping thread is now stopped. If this is the last thread in the set that needs to stop, it will trigger the process/delegate stop call that will notify lldb. Otherwise, that'll happen when the final thead we're waiting for stops. Misc: * Fixed up thread stop logging to use a leading 0 (0x%PRIx32) so we don't get log lines like 0x5 for 0x05 SIGTRAP. llvm-svn: 227911
* llgs: fixed a bug in deferred signal thread id; added coordinator enqueue ↵Chaoren Lin2015-02-031-1/+1
| | | | | | | | | logging. The deferred signal thread id was being set with the process id unintentionally in NativeProcessLinux::CallAfterRunningThreadsStop(). llvm-svn: 227910
* Get initial thread state coordinator integration working.Chaoren Lin2015-02-031-401/+435
| | | | | | | | | | | | | | | | | | | | * Fixed bug in run loop where run loop return enum was being treated erroneously like an int, causing the TSC event loop to terminate prematurely. * Added an explicit scope in NativeProcessLinux::Resume() for the threads lock lifetime. (This was likely unnecessary but is more explicit.) * Fixed a bug in ThreadStateCoordinator where resume execution was not updating the internal state about the thread assumed to be running now. I'll add a test and upstream this in a moment. * Added a verbose logging mechanism to event processing within ThreadStateCoordinator. It is currently enabled when the 'log enable lldb thread' is true upon inferior launch/attach. llvm-svn: 227909
* Fix broken NativeProcessLinux.cpp after signature change of ResolveExecutable.Oleksiy Vyalov2014-11-171-1/+1
| | | | llvm-svn: 222184
* Fix broken Linux build after signature change of ResolveExecutable.Oleksiy Vyalov2014-11-171-3/+4
| | | | llvm-svn: 222182
* Refactor NativeProcessLinux::AttachToProcess in order to avoid ↵Oleksiy Vyalov2014-11-131-7/+4
| | | | | | reinterpret_cast from NativeProcessProtocol* to NativeProcessLinux*. llvm-svn: 221906
* Fix error handling in NativeProcessLinux::AttachToInferior: ↵Shawn Best2014-11-111-1/+8
| | | | | | http://reviews.llvm.org/D6158 llvm-svn: 221647
* LLGS Android target support - for Andy Chien : http://reviews.llvm.org/D6166Shawn Best2014-11-081-1/+6
| | | | llvm-svn: 221570
* llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.Todd Fiala2014-10-111-102/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, both local-process llgs and remote-target llgs stdout/stderr handling from inferior work correctly. Several log lines have been added around PTY and stdout/stderr redirection logic on the lldb client side. Regarding remote llgs execution, see the following: With these changes, remote llgs with $O now works properly: $ lldb (lldb) platform select remote-linux (lldb) target create ~/some/inferior/exe (lldb) gdb-remote {some-target}:{port} (lldb) run The sequence above will correctly redirect stdout/stderr over gdb-remote $O, as is needed for remote debugging. That sequence assumes there is a lldb-gdbserver exe running on the target with {some-host}:{port}. You can replace the gdb-remote command with a '(lldb) platform connect connect://{target-ip}:{target-port}'. If you do this and have a lldb-platform running on the remote end, it will go ahead and launch llgs for lldb for each target instance that is run/attached. For local debugging with llgs, the following sequence also works, and uses local PTYs instead to avoid $O and extra gdb-remote messages: $ lldb (lldb) settings set platform.plugin.linux.use-llgs true (lldb) target create ~/some/inferior/exe (lldb) run The above will run the inferior using llgs on the local host, and will use PTYs rather than $O redirection. This change also removes the logging that happened after the fork but before the exec when llgs is launching a new inferior process. Some aspect of the file handling during that portion of code would not do the right thing with log handling. We might want to go back later and have that communicate over a pipe from the child to parent to pass along any messages that previously were logged in that section of code. llvm-svn: 219578
* Enable llgs to build against experimental Android AOSP ↵Todd Fiala2014-09-271-1/+8
| | | | | | | | | | | | 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
* Fix up the HostThread interface, making the interface simpler.Zachary Turner2014-09-231-8/+6
| | | | | | | Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5417 llvm-svn: 218325
* Test suite runs better again after recent fixes that would select a platform ↵Greg Clayton2014-09-191-2/+2
| | | | | | | | | | | | | if a "file a.out" auto selected a different platform than the selected one. Changes include: - fix it so you can select the "host" platform using "platform select host" - change all callbacks that create platforms to returns shared pointers - fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host" - Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform - cache platforms that are created and re-use them instead of always creating a new one llvm-svn: 218145
* Fix typo in Linux ASLR logging.Todd Fiala2014-09-191-1/+1
| | | | llvm-svn: 218133
* lldb fix ARM64 register access - llgs sideTodd Fiala2014-09-151-0/+104
| | | | | | | | See http://reviews.llvm.org/D5341 for more details. Change by Paul Osmialowski. llvm-svn: 217788
* llgs: fix Ctrl-C inferior interrupt handling to do the right thing.Todd Fiala2014-09-111-38/+186
| | | | | | | | | | | | | | | | * Sends a SIGSTOP to the process. * Fixes busted SIGSTOP handling. Now builds a list of non-stopped that we wait for the PTRACE group-stop for. When the final must-stop tid gets its group stop, we propagate the process state change. Only the signal receiving the notification of the pending SIGSTOP is marked with the SIGSTOP signal. All the rest, if they weren't already stopped, are marked as stopped with signal 0. * Fixes a few broken tests. * Marks the Linux test I added earlier as expect-pass (no longer XFAIL). Implements fix for http://llvm.org/bugs/show_bug.cgi?id=20908. llvm-svn: 217647
* Create a HostThread abstraction.Zachary Turner2014-09-091-22/+15
| | | | | | | | | | | | | 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
* llgs: add proper exec support for Linux.Todd Fiala2014-08-281-5/+70
| | | | | | | | | | | | | | | This change: * properly captures execs in NativeProcessLinux. * clears out all non-main-thread thread metadata in NativeProcessLinux on exec. * adds a DidExec() method to the NativeProcessProtocol delegate. * clears out the auxv data cache when we exec (on Linux). This is a small part of the llgs for local Linux debugging work going on here: https://github.com/tfiala/lldb/tree/dev-llgs-local I'm breaking it into small patches. llvm-svn: 216670
* Add software breakpoint support for Linux aarch64.Todd Fiala2014-08-211-0/+11
| | | | | | | | See http://reviews.llvm.org/D4969 for details. Change by Paul Osmialowski. llvm-svn: 216188
* Enable more Linux aarch64 PTRACE support for local and remote debugging.Todd Fiala2014-08-211-0/+54
| | | | | | | | See http://reviews.llvm.org/D4803 for more details. Change by Paul Osmialowski. llvm-svn: 216185
* Move Host::GetArchitecture to HostInfo::GetArchitecture.Zachary Turner2014-08-201-4/+3
| | | | | | | | 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-3/+42
| | | | | | | | | | 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-151-2/+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
* Refactor FileAction out of ProcessLaunchInfo.Zachary Turner2014-08-141-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
* llgs: corrected Linux signal reception notification for SIGABRT, SIGSEGV and ↵Todd Fiala2014-08-121-81/+84
| | | | | | | | | their ilk. Added llgs/debugserver gdb-remote tests around SIGABRT and SIGSEGV signal reception notification. Found a few bugs in exception signal handling in Linux llgs. Fixed those. llvm-svn: 215458
* 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
* 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
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-301-0/+3465
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
OpenPOWER on IntegriCloud