summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/ProcessMonitor.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove old local-only linux debugging codePavel Labath2015-06-241-334/+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
* Refactor many file functions to use FileSpec over strings.Chaoren Lin2015-05-291-16/+17
| | | | | | | | | | | | | | | | | 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
* This patch adds support for setting/clearing hardware watchpoints and ↵Omair Javaid2015-05-151-0/+12
| | | | | | | | breakpoints on AArch64 (Arm v8) 64-bit hardware. http://reviews.llvm.org/D9706 llvm-svn: 237419
* Move several plugin to its own namespaceTamas Berghammer2015-03-311-5/+11
| | | | | | | | | | | | | 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
* Fix TestProcesslaunch regression caused by D7372Pavel Labath2015-02-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | 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
* Share crash information between LLGS and local POSIX debugging withChaoren Lin2015-02-031-12/+0
| | | | | | | CrashReason class. Deliver crash information from LLGS to lldb via description field of thread stop packet. llvm-svn: 227926
* Create a HostThread abstraction.Zachary Turner2014-09-091-2/+3
| | | | | | | | | | | | | 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 Linux to respect ASLR settings when launching processes to debug locally ↵Todd Fiala2014-08-171-1/+4
| | | | | | | | | | 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
* Implement ProcessMonitor::Kill for LinuxEd Maste2014-04-011-4/+2
| | | | | | | | | | | | | | | | | | | | | 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
* Added support for reading thread-local storage variables, as defined using ↵Richard Mitton2013-10-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixing a problem with thread creation signal order dependencyAndrew Kaylor2013-09-171-0/+4
| | | | llvm-svn: 190831
* Improve stability of Linux ProcessMonitor by not using fds for synchronization:Daniel Malea2013-09-161-9/+8
| | | | | | | | | | | | | | | | | | - 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
* Stop process monitor from ProcessPOSIX::FinalizeAndrew Kaylor2013-07-101-3/+4
| | | | llvm-svn: 186039
* Reverting ProcessMonitor shared pointer changesAndrew Kaylor2013-07-091-3/+3
| | | | llvm-svn: 185981
* Use shared pointers to hold the process in ProcessMonitorAndrew Kaylor2013-07-091-3/+3
| | | | llvm-svn: 185946
* Add ability to attach/detach to multi-threaded inferiors on Linux.Matt Kopec2013-05-311-1/+4
| | | | | | All running threads will be detected and stopped on attach and all threads get resumed on detach. llvm-svn: 183049
* Adding support for stopping all threads of multithreaded inferiors on Linux. ↵Andrew Kaylor2013-05-281-0/+8
| | | | | | Also adding multithreaded test cases. llvm-svn: 182809
* Fixed "log enable linux registers" and added a test.Ashok Thirumurthi2013-05-091-4/+2
| | | | | | | | | | - 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
* Add Linux support for reading/writing extended register sets.Matt Kopec2013-03-201-2/+12
| | | | | | Patch by Ashok Thirumurthi. llvm-svn: 177568
* Rollback r177173. Some OSs may not have ptrace extensions which lldb expects ↵Matt Kopec2013-03-151-12/+2
| | | | | | when building. This needs to be accounted for. llvm-svn: 177176
* Add ptrace extensions to query a register set.Matt Kopec2013-03-151-2/+12
| | | | | | Patch by Ashok Thirumurthi. llvm-svn: 177173
* Improve/Cleanup ptrace wrapper and remove dependency on user.hMatt Kopec2013-03-061-5/+5
| | | | | | Patch by Ashok Thirumurthi. llvm-svn: 176558
* Implement -w flag to process launch (allow launching inferior process in ↵Daniel Malea2013-01-081-1/+4
| | | | | | | | different working directory) on Linux/FreeBSD - fixes test case TestProcessLaunch llvm-svn: 171854
* Allow reading registers by thread ID in ProcessMonitor (Linux implementation)Daniel Malea2012-12-181-6/+8
| | | | | | | | - make FreeBSD ProcessMonitor API thread-ready Patch by Matt Kopec! llvm-svn: 170445
* Fix Linux bug that leaves lldb in invalid state after expression evaluation ↵Daniel Malea2012-11-231-1/+1
| | | | | | | | | | | | 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
* Patch from Matt Kopec:Greg Clayton2012-10-161-7/+5
| | | | | | 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
* This patch combines common code from Linux and FreeBSD intoJohnny Chen2012-01-051-3/+5
| | | | | | | | | | 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
* Patch from Dawn that fixes up linux debugging and a first passs at an Greg Clayton2011-11-291-6/+6
| | | | | | implementation of the linux platform. llvm-svn: 145433
* Update ProcessMonitor::MonitorCallback signature.Peter Collingbourne2011-11-211-1/+1
| | | | llvm-svn: 145021
* Remove duplicate m_monitor field from LaunchArgsPeter Collingbourne2011-06-201-1/+0
| | | | | | Fixes segfault when launching process on Linux. llvm-svn: 133484
* Primitive attach support for linuxJohnny Chen2011-06-141-7/+42
| | | | | | | This patch is a starting point for the attach functionality. Signed-off-by: Johnny Chen <johnny.chen@apple.com> llvm-svn: 133006
* Implement RegisterContextLinux_x86_64::{Read,Write}AllRegisterValuesPeter Collingbourne2011-06-031-0/+8
| | | | llvm-svn: 132587
* This patch add a "fake" attach waiting for a real implementation andJohnny Chen2011-05-131-2/+2
| | | | | | | | | | | | | | | | 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
* linux: initial support for 'real' signal handlingStephen Wilson2011-03-301-6/+37
| | | | | | | | 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
* Delay sync with the parent thread in ProcessLinux/ProcessMonitor.Stephen Wilson2011-01-191-1/+1
| | | | | | | 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
* Support the reading of registers en masse via the linux ProcessMonitor.Stephen Wilson2011-01-191-0/+8
| | | | llvm-svn: 123797
* Use the correct type for thread handle.Stephen Wilson2011-01-151-1/+1
| | | | llvm-svn: 123500
* Spelling changes applied from lldb_spelling.diffs from Bruce Mitchener.Greg Clayton2011-01-081-2/+2
| | | | | | Thanks Bruce! llvm-svn: 123083
* Host::StopMonitoringChildProcess has been removed. Provide a substitute.Stephen Wilson2011-01-041-1/+4
| | | | llvm-svn: 122835
* Add a new Process plugin for Linux.Stephen Wilson2010-07-241-0/+208
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
OpenPOWER on IntegriCloud