summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/Linux/ProcessMonitor.h
AgeCommit message (Collapse)Author
2015-06-24Remove old local-only linux debugging codePavel Labath
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 Lin
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-15This patch adds support for setting/clearing hardware watchpoints and ↵Omair Javaid
breakpoints on AArch64 (Arm v8) 64-bit hardware. http://reviews.llvm.org/D9706 llvm-svn: 237419
2015-03-31Move several plugin to its own namespaceTamas Berghammer
Affected paths: * Plugins/Platform/Android/* * Plugins/Platform/Linux/* * Plugins/Platform/gdb-server/* * Plugins/Process/Linux/* * Plugins/Process/gdb-remote/* Differential revision: http://reviews.llvm.org/D8654 llvm-svn: 233679
2015-02-06Fix TestProcesslaunch regression caused by D7372Pavel Labath
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
2015-02-03Share crash information between LLGS and local POSIX debugging withChaoren Lin
CrashReason class. Deliver crash information from LLGS to lldb via description field of thread stop packet. llvm-svn: 227926
2014-09-09Create a HostThread abstraction.Zachary Turner
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
2014-08-17Fix Linux to respect ASLR settings when launching processes to debug locally ↵Todd Fiala
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-04-01Implement ProcessMonitor::Kill for LinuxEd Maste
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
2013-10-17Added support for reading thread-local storage variables, as defined using ↵Richard Mitton
the __thread modifier. To make this work this patch extends LLDB to: - Explicitly track the link_map address for each module. This is effectively the module handle, not sure why it wasn't already being stored off anywhere. As an extension later, it would be nice if someone were to add support for printing this as part of the modules list. - Allow reading the per-thread data pointer via ptrace. I have added support for Linux here. I'll be happy to add support for FreeBSD once this is reviewed. OS X does not appear to have __thread variables, so maybe we don't need it there. Windows support should eventually be workable along the same lines. - Make DWARF expressions track which module they originated from. - Add support for the DW_OP_GNU_push_tls_address DWARF opcode, as generated by gcc and recent versions of clang. Earlier versions of clang (such as 3.2, which is default on Ubuntu right now) do not generate TLS debug info correctly so can not be supported here. - Understand the format of the pthread DTV block. This is where it gets tricky. We have three basic options here: 1) Call "dlinfo" or "__tls_get_addr" on the inferior and ask it directly. However this won't work on core dumps, and generally speaking it's not a good idea for the debugger to call functions itself, as it has the potential to not work depending on the state of the target. 2) Use libthread_db. This is what GDB does. However this option requires having a version of libthread_db on the host cross-compiled for each potential target. This places a large burden on the user, and would make it very hard to cross-debug from Windows to Linux, for example. Trying to build a library intended exclusively for one OS on a different one is not pleasant. GDB sidesteps the problem and asks the user to figure it out. 3) Parse the DTV structure ourselves. On initial inspection this seems to be a bad option, as the DTV structure (the format used by the runtime to manage TLS data) is not in fact a kernel data structure, it is implemented entirely in useerland in libc. Therefore the layout of it's fields are version and OS dependent, and are not standardized. However, it turns out not to be such a problem. All OSes use basically the same algorithm (a per-module lookup table) as detailed in Ulrich Drepper's TLS ELF ABI document, so we can easily write code to decode it ourselves. The only question therefore is the exact field layouts required. Happily, the implementors of libpthread expose the structure of the DTV via metadata exported as symbols from the .so itself, designed exactly for this kind of thing. So this patch simply reads that metadata in, and re-implements libthread_db's algorithm itself. We thereby get cross-platform TLS lookup without either requiring third-party libraries, while still being independent of the version of libpthread being used. Test case included. llvm-svn: 192922
2013-09-17Fixing a problem with thread creation signal order dependencyAndrew Kaylor
llvm-svn: 190831
2013-09-16Improve stability of Linux ProcessMonitor by not using fds for synchronization:Daniel Malea
- ProcessMonitor::[Do|Serve]Operation no longer depend on file descriptors! - removed unused member functions CloseFD and EnableIPC - add semaphores to signal when an Operation is ready to be processed/complete. This commit fixes a bug that was identified under stress-testing (i.e. build LLVM while running tests) that led to LLDB becoming unresponsive because the read/write operations on file descriptors in ProcessMonitor were not checked. Other test runner improvement/convenience: - pickup environment variables LLDB_LINUX_LOG and LLDB_LINUX_LOG_OPTIONS to enable (Linux) logging when running the test suite. Example usage: $ LLDB_LINUX_LOG="mylog.txt" LLDB_LINUX_LOG_OPTIONS="process thread" python dotest.py llvm-svn: 190820
2013-07-10Stop process monitor from ProcessPOSIX::FinalizeAndrew Kaylor
llvm-svn: 186039
2013-07-09Reverting ProcessMonitor shared pointer changesAndrew Kaylor
llvm-svn: 185981
2013-07-09Use shared pointers to hold the process in ProcessMonitorAndrew Kaylor
llvm-svn: 185946
2013-05-31Add ability to attach/detach to multi-threaded inferiors on Linux.Matt Kopec
All running threads will be detected and stopped on attach and all threads get resumed on detach. llvm-svn: 183049
2013-05-28Adding support for stopping all threads of multithreaded inferiors on Linux. ↵Andrew Kaylor
Also adding multithreaded test cases. llvm-svn: 182809
2013-05-09Fixed "log enable linux registers" and added a test.Ashok Thirumurthi
- Eliminated the use of static for methods that read m_register_infos, so that these routines can be implemented in the base class. - Eliminated m_register_infos in the base class because this is not used when derived classes call UpdateRegisterInfo. - Also moved the namespace using declarations from headers to source files. Thanks to Daniel and Samuel for their review feedback. llvm-svn: 181538
2013-03-20Add Linux support for reading/writing extended register sets.Matt Kopec
Patch by Ashok Thirumurthi. llvm-svn: 177568
2013-03-15Rollback r177173. Some OSs may not have ptrace extensions which lldb expects ↵Matt Kopec
when building. This needs to be accounted for. llvm-svn: 177176
2013-03-15Add ptrace extensions to query a register set.Matt Kopec
Patch by Ashok Thirumurthi. llvm-svn: 177173
2013-03-06Improve/Cleanup ptrace wrapper and remove dependency on user.hMatt Kopec
Patch by Ashok Thirumurthi. llvm-svn: 176558
2013-01-08Implement -w flag to process launch (allow launching inferior process in ↵Daniel Malea
different working directory) on Linux/FreeBSD - fixes test case TestProcessLaunch llvm-svn: 171854
2012-12-18Allow reading registers by thread ID in ProcessMonitor (Linux implementation)Daniel Malea
- make FreeBSD ProcessMonitor API thread-ready Patch by Matt Kopec! llvm-svn: 170445
2012-11-23Fix Linux bug that leaves lldb in invalid state after expression evaluation ↵Daniel Malea
times out. - Handle EINVAL return code from ptrace(GETSIGINFO, ...): not an error, but 'group-stop' state on Linux - propagate SIGSTOP to inferior in above case - this commit resolves the failure in expression_command/timeout testcase Thanks to Sean Callanan & Matt Kopec for helping debug this problem llvm-svn: 168523
2012-10-16Patch from Matt Kopec:Greg Clayton
This patch fixes an issue where if lldb fails to attach to a process (ie. invalid pid) on Linux, the process monitor thread gets stuck waiting for a signal from the attach thread, which never comes due to not being signaled. It also implements StopOpThread which is used for both attach/launch cases as I'm not aware of any special handling needed for the attach case. Also, propagate 'Error' from the Detach function instead of using a bool. llvm-svn: 166055
2012-01-05This patch combines common code from Linux and FreeBSD intoJohnny Chen
a new POSIX platform. It also contains fixes for 64bit FreeBSD. The patch is based on changes by Mark Peek <mp@FreeBSD.org> and "K. Macy" <kmacy@freebsd.org> in their github repo located at https://github.com/fbsd/lldb. llvm-svn: 147609
2011-11-29Patch from Dawn that fixes up linux debugging and a first passs at an Greg Clayton
implementation of the linux platform. llvm-svn: 145433
2011-11-21Update ProcessMonitor::MonitorCallback signature.Peter Collingbourne
llvm-svn: 145021
2011-06-20Remove duplicate m_monitor field from LaunchArgsPeter Collingbourne
Fixes segfault when launching process on Linux. llvm-svn: 133484
2011-06-14Primitive attach support for linuxJohnny Chen
This patch is a starting point for the attach functionality. Signed-off-by: Johnny Chen <johnny.chen@apple.com> llvm-svn: 133006
2011-06-03Implement RegisterContextLinux_x86_64::{Read,Write}AllRegisterValuesPeter Collingbourne
llvm-svn: 132587
2011-05-13This patch add a "fake" attach waiting for a real implementation andJohnny Chen
solve the build break due to the lack of this method. It also propose a solution to the API changes in RegisterContext. I upgraded also the the python version in the makefile. My linux installation has python2.7 and AFAIK also the latest ubuntu has this version of python so maybe is worth upgrading. Patch by Marco Minutoli <mminutoli@gmail.com> [Note: I had to hand merge in the diffs since patch thinks it is a corrupt patch.] llvm-svn: 131313
2011-03-30linux: initial support for 'real' signal handlingStephen Wilson
This patch upgrades the Linux process plugin to handle a larger range of signal events. For example, we can detect when the inferior has "crashed" and why, interrupt a running process, deliver an arbitrary signal, and so on. llvm-svn: 128547
2011-01-19Delay sync with the parent thread in ProcessLinux/ProcessMonitor.Stephen Wilson
This patch removes a potential race condition between a process monitor thread and its parent waiting to interrogate the success/failure of the launch. llvm-svn: 123803
2011-01-19Support the reading of registers en masse via the linux ProcessMonitor.Stephen Wilson
llvm-svn: 123797
2011-01-15Use the correct type for thread handle.Stephen Wilson
llvm-svn: 123500
2011-01-08Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener.Greg Clayton
Thanks Bruce! llvm-svn: 123083
2011-01-04Host::StopMonitoringChildProcess has been removed. Provide a substitute.Stephen Wilson
llvm-svn: 122835
2010-07-24Add a new Process plugin for Linux.Stephen Wilson
This component is still at an early stage, but allows for simple breakpoint/step-over operations and basic process control. The makefiles are set up to build the plugin under Linux only. llvm-svn: 109318