summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix read only watchpoints on x86_64Tamas Berghammer2015-08-121-1/+3
| | | | | | | | | | On x86/x86_64 read only watchpoints aren't supported. Fall back to read/write watchpoints in that case. Note: Logic should be added to ignore the watchpoint hit when occurred because of a write. llvm-svn: 244742
* Fix LLGS to enable read type watchpointsOmair Javaid2015-08-121-0/+3
| | | | | | http://reviews.llvm.org/D11902 llvm-svn: 244741
* Revert r244308 since it's introducing test regressions on Linux:Oleksiy Vyalov2015-08-103-337/+64
| | | | | | | | - TestLldbGdbServer.py both clang & gcc, i386 and x86_64 - TestConstVariables.py gcc, i386 and x86_64 - 112 failures clang, i386 llvm-svn: 244514
* Fix for build errors on arm-linux-gnueabi-gccOmair Javaid2015-08-092-2/+2
| | | | | | http://reviews.llvm.org/D11256 llvm-svn: 244419
* [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 ↵Sagar Thakur2015-08-073-64/+337
| | | | | | | | | | | | | | | | | | mode support This change : - Fixes offsets of all register sets for Mips. - Adds MSA register set and FRE=1 mode support for FP register set. - Separates lldb register numbers and register infos of freebsd/mips64 from linux/mips64. - Re-orders the register numbers of all kinds for mips to be consistent with freebsd order of register numbers. - Eliminates ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and uses llvm::APInt and llvm::APFloat for all integer and floating point types. Reviewers : emaste, jaydeep, clayborg Subscribers : emaste, mohit.bhakkad, nitesh.jain, bhushan Differential : http://reviews.llvm.org/D10919 llvm-svn: 244308
* [LLDB][MIPS] To handle SI_KERNEL generated for invalid 64 bit addressMohit K. Bhakkad2015-07-301-10/+13
| | | | | | | | | | Patch by Nitesh Jain Reviewers: clayborg, ovyalov. Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar, emaste, lldb-commits. Differential Revision: http://reviews.llvm.org/D11176 llvm-svn: 243620
* Speed up NativeProcessLinux::GetLoadedModuleFileSpecPavel Labath2015-07-231-28/+20
| | | | | | | | | | | | | | | Summary: GetLoadedModuleFileSpec was reading /proc/pid/maps character by character, which was very slow, since we do that for every shared library, which android tends to have a lot. Switching to ProcFileReader saves us about 0.4 seconds in attach time. Reviewers: tberghammer Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: http://reviews.llvm.org/D11460 llvm-svn: 243019
* [NativeProcessLinux] Fix a couple of warningsPavel Labath2015-07-231-3/+3
| | | | llvm-svn: 243013
* Add jstopinfo support to llgsPavel Labath2015-07-233-8/+5
| | | | | | | | | | | | | | Summary: This adds support for jstopinfo field of stop-reply packets. This field enables us to avoid querying full thread stop data on most stops (see r242593 for more details). Reviewers: ovyalov, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11415 llvm-svn: 242997
* Fix warnings found by -Wextra-semiPavel Labath2015-07-221-2/+1
| | | | | | patch by Eugene Zelenko. llvm-svn: 242875
* [NativeProcessLinux] Integrate MainLoopPavel Labath2015-07-215-786/+259
| | | | | | | | | | | | | | | | | | | Summary: This commit integrates MainLoop into NativeProcessLinux. By registering a SIGCHLD handler with the llgs main loop, we can get rid of the special monitor thread in NPL, which saves as a lot of thread ping-pong when responding to client requests (e.g. qThreadInfo processing time has been reduced by about 40%). It also makes the code simpler, IMHO. Reviewers: ovyalov, clayborg, tberghammer, chaoren Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11150 This is a resubmission of r242305 after it was reverted due to bad interactions with the stdio thread. llvm-svn: 242783
* [NativeProcessLinux] Bugfix in the monitor threadPavel Labath2015-07-201-0/+3
| | | | | | | | Make sure we dont treat EINTR as a fatal error. I was getting this when trying to profile the debugger. I'm not sure why this wasn't surfacing before, it could be that the profiler is using some signals internally. llvm-svn: 242681
* Revert "[NativeProcessLinux] Integrate MainLoop"Pavel Labath2015-07-165-259/+783
| | | | | | This seems to be causing major slowdows on the android buildbot. Reverting while I investigate. llvm-svn: 242391
* [NativeProcessLinux] Integrate MainLoopPavel Labath2015-07-155-783/+259
| | | | | | | | | | | | | | | | Summary: This commit integrates MainLoop into NativeProcessLinux. By registering a SIGCHLD handler with the llgs main loop, we can get rid of the special monitor thread in NPL, which saves as a lot of thread ping-pong when responding to client requests (e.g. qThreadInfo processing time has been reduced by about 40%). It also makes the code simpler, IMHO. Reviewers: ovyalov, clayborg, tberghammer, chaoren Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11150 llvm-svn: 242305
* Refactor Unix signals.Chaoren Lin2015-07-141-14/+6
| | | | | | | | | | | | | | | | | | Summary: - Consolidate Unix signals selection in UnixSignals. - Make Unix signals available from platform. - Add jSignalsInfo packet to retrieve Unix signals from remote platform. - Get a copy of the platform signal for each remote process. - Update SB API for signals. - Update signal utility in test suite. Reviewers: ovyalov, clayborg Subscribers: chaoren, jingham, labath, emaste, tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D11094 llvm-svn: 242101
* Fix 32-bit Linux watchpoint failures.Chaoren Lin2015-07-091-14/+15
| | | | | | | | | | | | | | | | Summary: 32-bit signed return value from ptrace got sign extended when being converted to 64-bit unsigned. Also, replaced tabs with spaces in the source. Reviewers: labath, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11047 llvm-svn: 241837
* Avoid going through Platform when creating a NativeProcessProtocol instancePavel Labath2015-07-092-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit avoids the Platform instance when spawning or attaching to a process in lldb-server. Instead, I have the server call a (static) method of NativeProcessProtocol directly. The reason for this is that I believe that NativeProcessProtocol should be decoupled from the Platform (after all, it always knows which platform it is running on, unlike the rest of lldb). Additionally, the kind of platform actions a NativeProcessProtocol instance is likely to differ greatly from the platform actions of the lldb client, so I think the separation makes sense. After this, the only dependency NativeProcessLinux has on PlatformLinux is the ResolveExecutable method, which needs additional refactoring. This is a resubmit of r241672, after it was reverted due to build failueres on non-linux platforms. Reviewers: ovyalov, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10996 llvm-svn: 241796
* Revert r241672, which breaks the OS X build by introducing a dependency onSean Callanan2015-07-082-19/+16
| | | | | | | | | | | | | | | | platform-specific symbols that are not implemented on OS X. The build error that caused this is Undefined symbols for architecture x86_64: "lldb_private::NativeProcessProtocol::Attach(unsigned long long, lldb_private::NativeProcessProtocol::NativeDelegate&, std::__1::shared_ptr<lldb_private::NativeProcessProtocol>&)", referenced from: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::AttachToProcess(unsigned long long) in liblldb-core.a(GDBRemoteCommunicationServerLLGS.o) "lldb_private::NativeProcessProtocol::Launch(lldb_private::ProcessLaunchInfo&, lldb_private::NativeProcessProtocol::NativeDelegate&, std::__1::shared_ptr<lldb_private::NativeProcessProtocol>&)", referenced from: lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::LaunchProcess() in liblldb-core.a(GDBRemoteCommunicationServerLLGS.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) llvm-svn: 241688
* Avoid going through Platform when creating a NativeProcessProtocol instancePavel Labath2015-07-082-16/+19
| | | | | | | | | | | | | | | | | | | | | Summary: This commit avoids the Platform instance when spawning or attaching to a process in lldb-server. Instead, I have the server call a (static) method of NativeProcessProtocol directly. The reason for this is that I believe that NativeProcessProtocol should be decoupled from the Platform (after all, it always knows which platform it is running on, unlike the rest of lldb). Additionally, the kind of platform actions a NativeProcessProtocol instance is likely to differ greatly from the platform actions of the lldb client, so I think the separation makes sense. After this, the only dependency NativeProcessLinux has on PlatformLinux is the ResolveExecutable method, which needs additional refactoring. Reviewers: ovyalov, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10996 llvm-svn: 241672
* Fix cmake build after recent JSON changesPavel Labath2015-07-071-1/+1
| | | | | | | I have moved StringExtractor.h into the include/ folder so that it can be properly included by everyone. llvm-svn: 241572
* Fix aarch64 breakpoint PC offsetTamas Berghammer2015-07-031-9/+3
| | | | llvm-svn: 241347
* Fix 128bit register read and user register count on aarch64Tamas Berghammer2015-07-032-16/+13
| | | | llvm-svn: 241340
* Fix qMemoryRegionInfo packet to return current value for address after the ↵Tamas Berghammer2015-07-031-6/+19
| | | | | | | | last memory region Differential revision: http://reviews.llvm.org/D10899 llvm-svn: 241333
* [NativeProcessLinux] Refactor PtraceWrapperPavel Labath2015-06-305-106/+64
| | | | | | | | | | | | | | | | | Summary: This changes PtraceWrapper to return an Error, while the actual result is in an pointer parameter (instead of the other way around). Also made a couple of PtraceWrapper arguments default to zero. This arrangement makes a lot of the code much simpler. Test Plan: Tests pass on linux. It compiles on android arm64/mips64. Reviewers: chaoren, mohit.bhakkad Subscribers: tberghammer, aemerson, lldb-commits Differential Revision: http://reviews.llvm.org/D10808 llvm-svn: 241079
* [NativeProcessLinux] Use lambdas in DoOperation callsPavel Labath2015-06-268-1055/+454
| | | | | | | | | | | | | | | | | | | Summary: This removes a lot of boilerplate, which was needed to execute monitor operations. Previously one needed do declare a separate class for each operation which would manually capture all needed arguments, which was very verbose. In addition to less code, I believe this also makes the code more readable, since now the implementation of the operation can be physically closer to the code that invokes it. Test Plan: Code compiles on x86, arm and mips, tests pass on x86 linux. Reviewers: tberghammer, chaoren Subscribers: aemerson, lldb-commits Differential Revision: http://reviews.llvm.org/D10694 llvm-svn: 240772
* Remove old local-only linux debugging codePavel Labath2015-06-247-3218/+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
* [LLDB][MIPS] MIPS32 branch emulation and single-steppingJaydeep Patil2015-06-233-6/+63
| | | | | | | | | | | | | | | SUMMARY: This patch implements 1. Emulation of MIPS32 branch instructions 2. Enable single-stepping for MIPS32 instructions 3. Correction in emulation of MIPS64 branch instructions with delay slot 4. Adjust breakpoint address when breakpoint is hit in a forbidden slot of compact branch instruction Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, bhushan, lldb-commits, emaste, nitesh.jain Differential Revision: http://reviews.llvm.org/D10596 llvm-svn: 240373
* Fetch object file load address if it isn't specified by the linkerTamas Berghammer2015-06-182-0/+36
| | | | | | Differential revision: http://reviews.llvm.org/D10490 llvm-svn: 240052
* [LLDB][MIPS] Addressing some errors and warnings due to rL239991Mohit K. Bhakkad2015-06-182-11/+17
| | | | llvm-svn: 240016
* [LLDB][MIPS] Hardware Watchpoints for MIPSMohit K. Bhakkad2015-06-183-8/+444
| | | | | | | | Reviewers: clayborg, jingham. Subscribers: jaydeep, bhushan, dsanders, sagar, lldb-commits. Differential Revision: http://reviews.llvm.org/D9142 llvm-svn: 239991
* [NativeProcessLinux] Use fast memory reads, if the system supports itPavel Labath2015-06-171-2/+63
| | | | | | | | | | | | | | | | | | | | | | | Summary: Memory reads using the ptrace API need to be executed on a designated thread and in 4-byte increments. The process_vm_read syscall has no such requirements and it is about 50 times faster. This patch makes lldb-server use the faster API if the target kernel supports it. Kernel support for this feature is determined at runtime. Using process_vm_writev in the same manner is more complicated since this syscall (unlike ptrace) respects page protection settings and so it cannot be used to set a breakpoint, since code pages are typically read-only. However, memory writes are not currently a performance bottleneck as they happen much more rarely. Test Plan: all tests continue to pass Reviewers: ovyalov, vharron Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D10488 llvm-svn: 239924
* [lldb-server][MIPS] Read/Write FP registers in FR0 modeSagar Thakur2015-06-052-0/+66
| | | | | | | | | | Adding support for read/write FP registers in FR0 mode of mips. Reviewers: clayborg, tberghammer, jaydeep Subscribers: emaste, nitesh.jain, bhushan, mohit.bhakkad, lldb-commits Differential Revision: http://reviews.llvm.org/D10242 llvm-svn: 239132
* [MIPS][lldb-server] Add 32-bit register context and read/write FP registers ↵Sagar Thakur2015-06-033-101/+422
| | | | | | | | | | | | | on mips64 - Added support for read/write FP registers in FR1 mode. - Added 32 bit register context for mips32. Reviewers: clayborg, tberghammer, jaydeep Subscribers: emaste, nitesh.jain, bhushan, mohit.bhakkad, lldb-commits Differential Revision: http://reviews.llvm.org/D10029 llvm-svn: 238914
* Refactor many file functions to use FileSpec over strings.Chaoren Lin2015-05-294-110/+117
| | | | | | | | | | | | | | | | | 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
* Don't #include "lldb-python.h" from anywhere.Zachary Turner2015-05-292-4/+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
* [NativeProcessLinux] clean up #includesPavel Labath2015-05-292-12/+4
| | | | llvm-svn: 238551
* Report inferior SIGSEGV as a signal instead of an exception on linuxPavel Labath2015-05-293-42/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, we reported inferior receiving SIGSEGV (or SIGILL, SIGFPE, SIGBUS) as an "exception" to LLDB, presumably to match OSX behaviour. Beside the fact that we were basically lying to the user, this was also causing problems with inferiors which handle SIGSEGV by themselves, since LLDB was unable to reinject this signal back into the inferior. This commit changes LLGS to report SIGSEGV as a signal. This has necessitated some changes in the test-suite, which had previously used eStopReasonException to locate threads that crashed. Now it uses platform-specific logic, which in the case of linux searches for eStopReasonSignaled with signal=SIGSEGV. I have also added the ability to set the description of StopInfoUnixSignal using the description field of the gdb-remote packet. The linux stub uses this to display additional information about the segfault (invalid address, address access protected, etc.). Test Plan: All tests pass on linux and osx. Reviewers: ovyalov, clayborg, emaste Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D10057 llvm-svn: 238549
* [NativeProcessLinux] Support inferiors which change their process groupPavel Labath2015-05-281-7/+7
| | | | | | | | | | | | | | | | | | | | Summary: Previously, we wait()ed for events from the inferiors process group. This is resulted in a failure if the inferior changed its process group in the middle of execution. To avoid this, I pass -1 to the wait() call. The flag __WNOTHREAD makes sure we don't actually wait for events from any process, but only the processes(threads) which are our children (or traced by us). Since this happens on the monitor thread, which is dedicated to monitoring a single inferior, we will be getting events only from this inferior. Test Plan: All tests pass on linux. I have added a test to check the new functionality. Reviewers: chaoren, ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10061 llvm-svn: 238405
* Move register reading form NativeProcessLinux to NativeRegisterContextLinux*Tamas Berghammer2015-05-2615-1592/+1454
| | | | | | | | | | | | | | | | | This change reorganize the register read/write code inside lldb-server on Linux with moving the architecture independent code into a new class called NativeRegisterContextLinux and all of the architecture dependent code into the appropriate NativeRegisterContextLinux_* class. As part of it the compilation of the architecture specific register contexts are only compiled on the specific architecture because they can't be used in other cases. The purpose of this change is to remove a lot of duplicated code from the different register contexts and to remove the architecture dependent codes from the global NativeProcessLinux class. Differential revision: http://reviews.llvm.org/D9935 llvm-svn: 238196
* [NativeProcessLinux] Fix handling of SIGSTOPPavel Labath2015-05-211-25/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, NPL tried to reinject SIGSTOP into the inferior in an attempt to get the process to start in the group-stop state. This was: a) wrong (reinjection should be controlled by "process handle" lldb setting) b) racy (it should use Resume for transparent resuming instead of RequestResume) c) broken (llgs crashed on inferior SIGSTOP) With this change, SIGSTOP is handled just like any other signal delivered to the inferior: we stop all threads and report signal reception to lldb. SIGSTOP reinjection does not behave the same way as it would outside the debugger, but simulating this is a hard problem and is not normally necessary. Test Plan: I have added a test which verifies we get SIGSTOP reports and we do not crash. Reviewers: ovyalov, chaoren Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9852 llvm-svn: 237880
* Fixed arm64 build errorVince Harron2015-05-162-4/+4
| | | | llvm-svn: 237493
* [NativeProcessLinux] Fix removal of temporary breakpointsPavel Labath2015-05-152-19/+21
| | | | | | | | | | | | | | | | | | | | | | Summary: There was an issue in NPL, where we attempted removal of temporary breakpoints (used to implement software single stepping), while some threads of the process were running. This is a problem since we currently always use the main thread's ID in the removal ptrace call. Therefore, if the main thread was still running, the ptrace call would fail, and the software breakpoint would remain, causing all kinds of problems. This change removes the breakpoints after all threads have stopped. This fixes TestExitDuringStep on Android arm and can also potentially help in other situations, as previously the breakpoint would not get removed if the thread stopped for another reason. Test Plan: TestExitDuringStep passes, other tests remain unchanged. Reviewers: tberghammer Subscribers: tberghammer, aemerson, lldb-commits Differential Revision: http://reviews.llvm.org/D9792 llvm-svn: 237448
* [NativeProcessLinux] Fix potential race during thread exitPavel Labath2015-05-151-31/+7
| | | | | | | | | | | | | | | | | | | Summary: This is the same issue as we had in D9145 for thread creation. Going through the full ThreadDidStop/RequestResume cycle can cause a deferred notification to fire, which is not correct when we are ignoring an event and resuming the thread. In this case it doesn't matter much since the thread will die after that anyway, but for correctness, we should do the same thing here. Also treating the SIGTRAP case the same way. Test Plan: Tests continue to pass. Reviewers: chaoren, ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9696 llvm-svn: 237445
* LLDB build broke after applying patch http://reviews.llvm.org/D9706Omair Javaid2015-05-152-12/+9
| | | | | | This patch fixes the issue. llvm-svn: 237421
* This patch adds support for setting/clearing hardware watchpoints and ↵Omair Javaid2015-05-158-4/+662
| | | | | | | | breakpoints on AArch64 (Arm v8) 64-bit hardware. http://reviews.llvm.org/D9706 llvm-svn: 237419
* Fixed a ton of gcc compile warningsVince Harron2015-05-133-5/+5
| | | | | | | | | | Removed some unused variables, added some consts, changed some casts to const_cast. I don't think any of these changes are very controversial. Differential Revision: http://reviews.llvm.org/D9674 llvm-svn: 237218
* Return the correct user register count for arm from NativeRegisterContextTamas Berghammer2015-05-122-0/+12
| | | | | | | | The defult implementation falls back to GetRegisterCount what includes the debug registers also what shouldn't be displayed to the user. llvm-svn: 237111
* Remove handling of eStateStopped from NativeProcessLinux::ResumePavel Labath2015-05-122-135/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: NPL::Resume attempted to handle eStateStopped as a resume action. However: - GDBRemoteCommunicationServerLLGS (the only user of NPL) never sets this action - it could set this action in response to a vCont:t packet, but LLDB never produces this packet - gdb-remote protocol documentation says vCont:t packet is used only in non-stop mode, but LLDB does not support non-stop mode - even if LLDB supported non-stop mode, this implementation of eStateStopped does something different from what the spec says it should (according to spec, it should stop the specified thread, but this seems to want to stop all threads). Given the facts above, I believe we should remove this unused and untested code, as it probably doesn't even work and removing it makes the rest of the code noticably simpler. Reviewers: ovyalov, chaoren Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9657 llvm-svn: 237103
* [NativeProcessLinux] Remove event mutex and clean functions using itPavel Labath2015-05-122-242/+72
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Since the former-TSC events are now processed synchronously, there is no need for to protect them with a separate mutex - all the actions are now guarded by the big m_threads_mutex. With the mutex gone, the following functions, no longer have any purpose and were removed: NotifyThreadCreate: replaced by direct calls to ThreadWasCreated NotifyThreadStop: replaced by direct calls to ThreadDidStop NotifyThreadDeath: folded into StopTrackingThread ResetForExec: inlined as it consisted of a single line of code RequestThreadResume(AsNeeded): replaced by direct calls to ResumeThread StopThreads: removed, as it was never called Test Plan: tests continue to pass Reviewers: ovyalov, chaoren Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9603 llvm-svn: 237101
* Get lldb-server building on android-9Vince Harron2015-05-122-80/+11
| | | | | | Build lldb-server with an android-9 sysroot. llvm-svn: 237078
OpenPOWER on IntegriCloud