summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
Commit message (Collapse)AuthorAgeFilesLines
* thread state coordinator: add tests and impl to error on creation/death issues.Todd Fiala2014-10-022-7/+29
| | | | | | | | Added tests and impl to make sure the following errors are reported: * Notifying a created thread that we are already tracking. * Notifying a thread death for a thread we don't know about. llvm-svn: 218900
* thread state coordinator: added simpler deferred stop notification method.Todd Fiala2014-10-022-33/+114
| | | | | | | | | | | | | | | Now that ThreadStateCoordinator errors out on threads in unexpected states, it has enough information to know which threads need stop requests fired when we want to do a deferred callback on a thread's behalf. This change adds a new method, CallAfterRunningThreadsStop(...), which no longer takes a set of thread ids that require stop requests. It's much harder to misuse this method and (with newer error logic) it's harder to correctly use the original method. Expect the original method that takes the set of thread ids to stop to disappear in the near future. Adds several tests for CallAfterRunningThreadsStop(). llvm-svn: 218897
* thread state coordinator: requesting resume now signals error appropriately.Todd Fiala2014-10-021-5/+12
| | | | | | | | | | Added tests to verify that the coordinator signals an error if the given thread to resume is unknown, and if the thread is through to be running already. Modified resume handling code to match tests. llvm-svn: 218872
* Remove unused variable.Eric Christopher2014-10-021-1/+1
| | | | llvm-svn: 218844
* thread state coordinator: added error callbacks, cleaned up tests.Todd Fiala2014-10-012-66/+156
| | | | | | | | | | | | | | | | | | | | | | | | | ThreadStateCoordinator changes: * Most commands that run in the queue now take an error handler that will be called with an error string if an error occurs during processing. Errors generally stop the operation in progress. The errors are checked at time of execution. This is intended to help flush out ptrace/waitpid/state management issues as quickly as possible. * Threads now must be known to the coordinator before stops can be reported, resumes can be requested, thread deaths can be reported, or deferred stop notifications can be made. Failure to know the thread will cause the coordinator to call the error callback for the event being processed. Threads are introduced to the system by the NotifyThreadCreate method. * The NotifyThreadCreate method now takes the initial state of the thread being introduces to the system. We no longer just assume the thread is running. The test cases were cleaned up, too: * A gtest test fixture is now used, which allows creating less verbose helper methods that setup common pieces of callback code for some method invocations. Net result: the tests are simpler to read and shorter to write. llvm-svn: 218833
* thread state coordinator: replaced shortened type name Func suffix with ↵Todd Fiala2014-10-012-30/+30
| | | | | | | | | | | | Function. ThreadIDFunc => ThreadIDFunction LogFunc => LogIDFunction We try to avoid abbreviations/shortened names. Adjusted function parameter names as well to replace _func with _function. llvm-svn: 218773
* Minor tweak to Ed's FreeBSD fix.Todd Fiala2014-10-011-1/+1
| | | | | | | Fall back to including the Linux version if not on __FreeBSD__. Also covers __ANDROID__ case. llvm-svn: 218770
* Add a bandaid to fix the FreeBSD buildEd Maste2014-10-011-0/+4
| | | | | | | | | | | | r218568 added an explicit #include of the Linux ProcessMonitor.h to POSIXThread.cpp, rather than including just "ProcessMonitor.h" and relying on the build infrastructure for the appropriate paths. For now add #ifdefs in the source to use the FreeBSD or Linux header as appropriate; a cleaner fix (and perhaps some refactoring of the POSIX classes) should still be done later. llvm-svn: 218762
* Fix FreeBSD build.Zachary Turner2014-09-301-6/+6
| | | | llvm-svn: 218685
* thread state coordinator: add test to be explicit about resume behavior in ↵Todd Fiala2014-09-302-9/+59
| | | | | | | | | | | | | | | | | | | | presence of deferred stop notification still pending. There is a state transition that seems potentially buggy that I am capturing and logging here, and including an explicit test to demonstrate expected behavior. See new test for detailed description. Added logging around this area since, if we hit it, we may have a usage bug, or a new state transition we really need to investigate. This is around this scenario: Thread C deferred stop notification awaiting thread A and thread B to stop. Thread A stops. Thread A requests resume. Thread B stops. Here we will explicitly signal the deferred stop notification after thread B stops even though thread A is now resumed. Copious logging happens here. llvm-svn: 218683
* This checkin is the first step in making the lldb thread stepping mechanism ↵Jim Ingham2014-09-291-14/+10
| | | | | | | | | | | | more accessible from the user level. It adds the ability to invent new stepping modes implemented by python classes, and to view the current thread plan stack and to some extent alter it. I haven't gotten to documentation or tests yet. But this should not cause any behavior changes if you don't use it, so its safe to check it in now and work on it incrementally. llvm-svn: 218642
* thread state coordinator: added a thread resume request and related tests.Todd Fiala2014-09-292-1/+50
| | | | | | | | | The thread resume block is executed in the normal flow of thread state queued event processing. The tests verify that it is executed when we track the thread to be stopped and skipped when we track it to already be running. llvm-svn: 218638
* thread state coordinator: add exec reset support, remove empty virtual ↵Todd Fiala2014-09-292-22/+66
| | | | | | | | | | | destructors. Also added a test for the reset handling. The reset/state clearing happens as a processed queue event. The only diff vs. standard processing is that the exec clears the queue before queueing the activity to clear internal state. i.e. once we get an exec, we really stop doing any other queue-based activity. llvm-svn: 218629
* Included cstdarg for compilation of va_start and va_end.Matthew Gardiner2014-09-291-0/+1
| | | | llvm-svn: 218594
* thread state coordinator: added new thread support.Todd Fiala2014-09-282-0/+64
| | | | | | | | | | A new thread arriving while a pending signal notification is outstanding will (1) add the new thread to the list of stops expected before the deferred signal notification is fired, (2) send a stop request for the new thread, and (3) track the new thread as currently running. llvm-svn: 218578
* Enable llgs to build against experimental Android AOSP ↵Todd Fiala2014-09-2717-35/+48
| | | | | | | | | | | | 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
* thread state coordinator: added thread death support and more tests.Todd Fiala2014-09-272-10/+81
| | | | | | | | | | Tested two pending stops before notification, where one of the pending stop requirements was already known to be stopped. Tested pending thread stop before notification, then reporting thread with pending stop died and verifies pending notification is made. llvm-svn: 218559
* thread state coordinator: added test for notify after two pending thread stops.Todd Fiala2014-09-271-1/+1
| | | | | | | Glad I did - caught a bug where the auto variable was not a reference to a set and instead was a copy. I need to review rules on that! llvm-svn: 218558
* thread state coordinator: handle when prerequisite pending stop is already ↵Todd Fiala2014-09-261-5/+20
| | | | | | | | stopped. Change includes new gtest and functionality. llvm-svn: 218555
* gtest: tweaked test runner to fix an extra comma, added more tdd-based ↵Todd Fiala2014-09-262-16/+302
| | | | | | | | | thread coordinator behavior. Starting to flesh out the thread state coordinator class that will be used by Linux/llgs. llvm-svn: 218537
* Fixup gtest layout, add Linux ThreadStateCoordinator.cpp.Todd Fiala2014-09-253-1/+125
| | | | | | | | | | | | | | | | | | | | | | | | | This change does the following: * Remove test/c++/... * Add gtest. * Add gtest/unittest directory for unittesting individual classes. * Add an initial Plugins/Process?linux/ThreadStateCoordinatorTest.cpp. - currently failing a test (intentional). - added a bare-bones ThreadStateCoordinator.cpp to Plugins/Process/Linux, more soon. Just enough to prove out running gtest on Ubuntu and MacOSX. * Added recursive make machinery so that doing a 'make' in gtest/ is sufficient to kick off the existing test several directories down. - Caveat - I currently short circuit from gtest/unittest/Makefile directly to the one and only gtest/unittest/Plugins/Process/Linux directory. We'll need to add the intervening layers. I haven't done this yet since to fix the Xcode test failure correspondence, I may need to add a python layer which might just handle the directory crawling. * Added an Xcode project to the lldb workspace for gtest. - Runs the recursive make system in gtest/Makefile. - Default target is 'test'. test and clean are supported. - Currently does not support test failure file/line correspondence. Requires a bit of text transformation to hook that up. llvm-svn: 218460
* Fix up the HostThread interface, making the interface simpler.Zachary Turner2014-09-235-44/+26
| | | | | | | 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-192-3/+3
| | | | | | | | | | | | | 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-192-2/+2
| | | | llvm-svn: 218133
* llgs: removed some wait-for-stop code in inferior process launch pipeline.Todd Fiala2014-09-182-31/+8
| | | | | | | | | | | | | The $A handler was unnecessarily waiting for the launched app to hit a stop before returning. Removed this code. Renamed the llgs inferior launching code to LaunchProcessForDebugging () to prevent it from possibly being mistaken as code that lldb-platform uses to launch a debugserver process. We probably want to look at breaking out llgs-specific and lldb-platform-specific code into separate derived classes, with common code in a shared base class. llvm-svn: 218075
* Hex encode the triple values in case they contain special characters.Greg Clayton2014-09-182-5/+17
| | | | llvm-svn: 218001
* Add better logging for the "$vFile:pwrite:" packet so we can show binary ↵Greg Clayton2014-09-181-5/+33
| | | | | | data instead of nothing or unprintable characters. This can easily be extended for other packets that have binary data. llvm-svn: 218000
* Clean-up warnings on Linux/GCCDavid Majnemer2014-09-161-0/+1
| | | | llvm-svn: 217862
* use std::atomic<> to protect variables being accessed by multiple threadsTodd Fiala2014-09-153-5/+3
| | | | | | | | | | 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
* 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
* Properly decode architecture type in ↵Todd Fiala2014-09-151-1/+21
| | | | | | | | | | | | | | | | | | | GDBRemoteCommunicationClient::GetCurrentProcessInfo. Instead of forcing the remote arch type to MachO all the time, we inspect the OS/vendor that the remote debug server reports and use it to set the arch type to MachO, ELF or COFF accordingly. See thread here for more context: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140915/012968.html Change by Stephane Sezer. Tested: MacOSX 10.9.4 x86_64 Ubuntu 14.04 x86_64 llvm-svn: 217779
* Check for byte order correctness in ↵Todd Fiala2014-09-151-4/+14
| | | | | | | | | | | | | | GDBRemoteCommunicationClient::GetCurrentProcessInfo. This is useful for checking inconsistencies between what the remote debug server thinks we are debugging and we think we are debugging. This follows the check for pointer byte size done just above. Change by Stephane Sezer. Tested: Ubuntu 14.04 x86_64, llvm-3.5-built lldb MacOSX 10.9.4, Xcode-Beta(2014-09-09)-built lldb. llvm-svn: 217773
* llgs: fix thread names broken by recent native thread changes.Todd Fiala2014-09-123-8/+8
| | | | | | | | * Fixes the local stack variable return pointer usage in NativeThreadLinux::GetName(). * Changes NativeThreadProtocol::GetName() to return a std::string. * Adds a unit test to verify thread names don't regress in the future. Currently only run on Linux since I know default thread names there. llvm-svn: 217717
* lldb fix ARM64 register accessTodd Fiala2014-09-121-0/+93
| | | | | | | | | | Apparently, PEEKUSER/POKEUSER is something x86 specific, so I had to rework it for AArch64. This fixes assertion that occurs whenever lldb started on AArch64 device tried to read PC register (or any other register) See http://reviews.llvm.org/D5232 for more details. Change by Paul Osmialowski. llvm-svn: 217691
* llgs: fix Ctrl-C inferior interrupt handling to do the right thing.Todd Fiala2014-09-115-42/+229
| | | | | | | | | | | | | | | | * 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
* llgs: implement qThreadStopInfo.Todd Fiala2014-09-102-2/+27
| | | | | | | | | | | This change implements this ticket: http://llvm.org/bugs/show_bug.cgi?id=20899 Adds the qThreadStopInfo RSP command for llgs and includes a test that verifies both debugserver and llgs respond with something reasonable on a multithreaded app. llvm-svn: 217549
* Fix FreeBSD build after thread changesEd Maste2014-09-101-2/+2
| | | | | | | More work on the GetName/SetName arguments (thread_t vs tid_t) is needed but this change should restore the build and basic operation. llvm-svn: 217502
* Create a HostThread abstraction.Zachary Turner2014-09-0915-130/+104
| | | | | | | | | | | | | 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
* Remove unused class variable and update all callers/users.Eric Christopher2014-09-093-5/+2
| | | | llvm-svn: 217419
* Fix configure & make build with python disabledKeno Fischer2014-09-093-6/+6
| | | | | | | | | | | | | This makes sure that nothing that requires Python is being built when the LLDB_DISABLE_PYTHON flag is being passed in. It also changes a use of CPPFLAGS to CPP.Flags since the former is overridden when external flags are passed in while the later is not. I'm not sure exactly why LLDB_DISABLE_PYTHON is in CXXFLAGS rather than CPPFLAGS, but cleaning that up is for another commit. Differential Revision: http://reviews.llvm.org/D4918 llvm-svn: 217414
* Linux/FreeBSD local debugging: allow redirection to pts for POSIX process.Todd Fiala2014-09-082-8/+11
| | | | | | | | See http://reviews.llvm.org/D5135 for more details. Change by Zephyr Zhao. llvm-svn: 217382
* remove a couple of default cases from switchesSaleem Abdulrasool2014-09-081-5/+11
| | | | | | | | | This cleans up a couple of warnings [-Wcovered-switch-default] from the build by removing the default case from a couple of switches which are fully covered. This is generally better as it will help identify when a new item is added to the enumeration but the use sites are not updated. llvm-svn: 217376
* Set the process vendor in GDBRemoteCommunicationClient::GetCurrentProcessInfo.Todd Fiala2014-09-051-0/+1
| | | | | | Change by Stephane Sezer. llvm-svn: 217252
* Fix build break on Ubuntu 12.04 with ARM64 changes.Todd Fiala2014-09-041-1/+3
| | | | | | | | | | See http://llvm.org/bugs/show_bug.cgi?id=20824 for more details. Tested: Ubuntu 12.04 x86_64, gcc-4.9.1-built lldb Ubuntu 14.04 x86_64, clang-3.5-build lldb llvm-svn: 217169
* ASan malloc/free history threadsKuba Brecka2014-09-041-0/+12
| | | | | | Reviewed at http://reviews.llvm.org/D4596 llvm-svn: 217116
* RegisterContextLLDB::InitializeNonZerothFrame had a bit of code toJason Molenda2014-09-022-17/+34
| | | | | | | | | | | | | | | | | | | | detct unwind loops but there was a code path through there (using architecture default unwind plans) that didn't do the check, and could end up with an infinite loop unwind. Move that code into a separate method and call it from both places where it is needed. Also remove the use of ABI::FunctionCallsChangeCFA in that check. I thought about it a lot and none of the architecutres that we're supporting today can have a looping CFA. Since the unwinder isn't using ABI::FunctionCallsChangeCFA() and ABI::StackUsesFrames(), and the unwinder was the only reason those methods exists, I removed them from the ABI and all its plugins. <rdar://problem/17364005> llvm-svn: 216992
* Linux ARM64: add ProcessMonitor-related RegisterContext support.Todd Fiala2014-09-027-0/+996
| | | | | | | | See http://reviews.llvm.org/D5089 for more details. Change by Paul Osmialowski. llvm-svn: 216907
* Consolidate UnixSignals setting/getting in Process.Todd Fiala2014-08-2910-80/+48
| | | | | | | | | | | | | | | | 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
* Add arbitrary command line flags to llgs/debugserver startup for local ↵Todd Fiala2014-08-291-1/+19
| | | | | | | | | | | | | | | | | | | | debugging. This patch accepts environment variables of the form: LLDB_DEBUGSERVER_EXTRA_ARG_n where n starts with 1, and may continue nearly indefinitely (up through std::numeric_limits<uint32_t>::max()). The code loops around, starting with 1, until it doesn't find one of the environment variables. For each one it does find defined, it appends the environment variable's contents to the end of the debugserver/llgs startup command line issued when the stub is started for local debugging. I am using this to add arbitrary startup commands to the llgs command line for turning on additional logging. For example: export LLDB_DEBUGSERVER_EXTRA_ARG_1="-c" export LLDB_DEBUGSERVER_EXTRA_ARG_2="log enable -f /tmp/llgs_packets.log gdb-remote packets" export LLDB_DEBUGSERVER_EXTRA_ARG_3="-c" export LLDB_DEBUGSERVER_EXTRA_ARG_4="log enable -f /tmp/llgs_process.log lldb process" llvm-svn: 216745
* lldb - Register Context Linux ARM64Todd Fiala2014-08-297-301/+537
| | | | | | | | | | | | | Yet another step toward ARM64 support. With this commit, lldb-gdbserver started on ARM64 target can be accessed by lldb running on desktop PC and it can process simple commands (like 'continue'). Still ARM64 support lacks NativeRegisterContextLinux_arm64.* code which waits to be implemented. Based on similar files for Linux x86_64 and Darwin ARM64. Due to common code extraction from Darwin related files, lldb should be tested for any unexpected regression on Darwin ARM64 machines too. See the following for more details: http://reviews.llvm.org/D4580 http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140825/012670.html Change by Paul Osmialowski. llvm-svn: 216737
OpenPOWER on IntegriCloud