summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux
Commit message (Collapse)AuthorAgeFilesLines
* Make ThreadStateCoordinator to handle properly failed stop/resume operations.Chaoren Lin2015-02-033-36/+63
| | | | llvm-svn: 227928
* Share crash information between LLGS and local POSIX debugging withChaoren Lin2015-02-035-221/+47
| | | | | | | 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-034-138/+180
| | | | | | requested. llvm-svn: 227924
* Refactor ptrace commands in NativeProcessLinux to use Error as result return ↵Chaoren Lin2015-02-033-295/+203
| | | | | | 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-032-0/+76
| | | | | | 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-034-24/+64
| | | | | | | | | | | | | | | | | | | | | | * 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-034-9/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-032-41/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-032-1/+5
| | | | | | | | | 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-034-421/+556
| | | | | | | | | | | | | | | | | | | | * 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
* Rename lldb registers to contain lldb_ prefix.Zachary Turner2014-11-211-228/+228
| | | | | | | | | | | | | | | | | | | | LLDB supports many different register numbering schemes, and these are typically prefixed with an indicator that lets the user know what numbering scheme is used. The gcc numbering scheme is prefixed with gcc, and there are similar ones for dwarf, gdb, and gcc_dwarf. LLDB also contains its own internal numbering scheme, but the enum for LLDB's numbering scheme was prefixed differently. This patch changes the names of these enums to use the same naming scheme for the enum values as the rest of the register kinds by removing gpr_ and fpu_ prefixes, and instead using lldb_ prefixes for all enum values. Differential Revision: http://reviews.llvm.org/D6351 Reviewed by: Greg Clayton llvm-svn: 222495
* 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-082-2/+12
| | | | llvm-svn: 221570
* llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.Todd Fiala2014-10-112-111/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 local llgs debugging on Linux when the use-llgs-for-local setting is ↵Todd Fiala2014-10-101-0/+6
| | | | | | | | | | | | | | | | | | | enabled. See http://reviews.llvm.org/D5695 for details. This change does the following: Enable lldb-gdbserver (llgs) usage for local-process Linux debugging. To turn on local llgs debugging support, which is disabled by default, enable this setting: (lldb) settings set platform.plugin.linux.use-llgs-for-local true Adds a stream-based Dump() function to FileAction. Pushes some platform methods that Linux (and FreeBSD) will want to share with MacOSX from PlatformDarwin into PlatformPOSIX. Reviewed by Greg Clayton. llvm-svn: 219457
* thread state coordinator: fixed bug in thread running state book-keeping.Todd Fiala2014-10-091-0/+3
| | | | | | | | | | Adds a test to verify that a thread resume request marks the thread as running after doing the resume callback. This test fails without the corresponding ThreadStateCoordinator.cpp change. Fixes the code where that state was not maintained. llvm-svn: 219412
* 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
* 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
* 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-276-9/+23
| | | | | | | | | | | | 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-232-16/+12
| | | | | | | 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-192-2/+2
| | | | llvm-svn: 218133
* Clean-up warnings on Linux/GCCDavid Majnemer2014-09-161-0/+1
| | | | llvm-svn: 217862
* 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 thread names broken by recent native thread changes.Todd Fiala2014-09-122-2/+2
| | | | | | | | * 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-114-38/+227
| | | | | | | | | | | | | | | | * 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-095-47/+44
| | | | | | | | | | | | | 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 configure & make build with python disabledKeno Fischer2014-09-091-1/+1
| | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud