summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
Commit message (Collapse)AuthorAgeFilesLines
...
* [ProcessWindows] Clean up the register definitions array.Zachary Turner2014-11-222-82/+122
| | | | llvm-svn: 222597
* Rename lldb registers to contain lldb_ prefix.Zachary Turner2014-11-216-795/+796
| | | | | | | | | | | | | | | | | | | | 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
* Remove duplicated enum, use the authoritative one.Zachary Turner2014-11-201-275/+2
| | | | | | | | | Running a diff against lldb-x86-register-enums.h and the file modified in this patch, the two enums were completely identical. Deleting one of them to reduce code noise. llvm-svn: 222478
* [ProcessWindows] Implement a RegisterContextWindows for x86.Zachary Turner2014-11-206-11/+460
| | | | | | | | | | | | | | | This implements the skeleton of a RegisterContext for Windows. In particular, this implements support only for x86 general purpose registers. After this patch, LLDB on Windows can perform basic debugging operations in a single-threaded inferior process (breakpoint, register inspection, frame select, unwinding, etc). Differential Revision: http://reviews.llvm.org/D6322 Reviewed by: Greg Clayton llvm-svn: 222474
* Add test for denied process attach by pid and fix found bugs in ↵Oleksiy Vyalov2014-11-193-10/+11
| | | | | | | | | | Process/ProcessPOSIX.cpp and FreeBSD/ProcessMonitor. http://reviews.llvm.org/D6240 llvm-svn: 222372
* Add additional checks to the SavedLocationForRegister methodJason Molenda2014-11-191-5/+28
| | | | | | | | | | | | | | where it is retrieving the Return Address register contents on a target where that's a thing. If we fail to get a valid RA, we force a switch to the fallback unwind plan. This patch adds a sanity check for that fallback unwind plan -- it must get a valid CFA for this frame in addition to being able to retrieve the caller's PC -- and it correctly marks the unwind rules as failing if the fallback unwind plan fails. <rdar://problem/19010211> llvm-svn: 222301
* Change HostThread::GetNativeThread() to return a derived reference.Zachary Turner2014-11-173-5/+5
| | | | | | | | Previously using HostThread::GetNativeThread() required an ugly cast to most-derived type. This solves the issue by simply returning the derived type directly. llvm-svn: 222185
* 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-172-9/+11
| | | | llvm-svn: 222182
* Move the thread logic around to fit better into LLDB's process model.Zachary Turner2014-11-173-27/+72
| | | | | | | | | | | Previously we were directly updating the thread list and stopping and restarting the process every time threads were created. With this patch, we queue up thread launches and thread exits, resolve these all internally, and only update the threads when we get an UpdateThreadList call. We now only update the private state on an actual stop (i.e. breakpoint). llvm-svn: 222178
* [ProcessWindows] Create a TargetThreadWindows class.Zachary Turner2014-11-175-48/+199
| | | | | | | | | | | This creates a TargetThreadWindows class and updates the thread list of the Process with the main thread. Additionally, we fill out a few more overrides of Process base class methods. We do not yet update the thread list as threads are created and/or destroyed, and we do not yet propagate stop reasons to threads as their states change. llvm-svn: 222148
* [ProcessWindows] Implement read / write process memory.Zachary Turner2014-11-172-3/+30
| | | | llvm-svn: 222147
* Refactor NativeProcessLinux::AttachToProcess in order to avoid ↵Oleksiy Vyalov2014-11-131-7/+4
| | | | | | reinterpret_cast from NativeProcessProtocol* to NativeProcessLinux*. llvm-svn: 221906
* A pretty big overhaul of the TryFallbackUnwindPlan method inJason Molenda2014-11-133-53/+249
| | | | | | | | | | | | RegisterContextLLDB. I have core files of half a dozen tricky unwind situations on x86/arm and they're all working pretty much correctly at this point, but we'll need to keep an eye out for unwinder regressions for a little while; it's tricky to get these heuristics completely correct in all unwind situations. <rdar://problem/18937193> llvm-svn: 221866
* Use PRIx64 when printing addr_t's. Don't need to force full-width 0 paddingJason Molenda2014-11-121-2/+2
| | | | | | with addresses that aren't designed to be column-aligned across multiple lines. llvm-svn: 221810
* [ProcessWindows] Improve support for launching processes.Zachary Turner2014-11-126-63/+167
| | | | | | | | | | | | | This sends notifications for module load / unload to the process plugin, and also manages the state more accurately during the loading sequence. Similar work by Virgile Bello was referenced during the implementation of this patch. Differential Revision: http://reviews.llvm.org/D6224 llvm-svn: 221807
* [ProcessWindows] Simplify the DebugDelegate interface.Zachary Turner2014-11-128-209/+64
| | | | | | | | | | | Due to a previous multi-threaded design involving message passing, we used message classes to pass event information to the delegate. Since the multi-threaded design has gone away, we simplify this by passing event arguments as direct function parameters, which is more clear and easier to understand. llvm-svn: 221806
* Avoid crash in InitializeNonZerothFrame if no module foundEd Maste2014-11-121-1/+2
| | | | | | | | After r221575 TestCallStopAndContinue and TestCallThatRestarts started crashing on FreeBSD with a null temporary_module_sp in RegisterContextLLDB::InitializeNonZerothFrame(). llvm-svn: 221805
* FIx a bug with PC-register handling in a RA register.Justin Hibbits2014-11-121-0/+1
| | | | | | | | | | | The addition of RegisterNumber introduced a bug where if the PC is stored in a return address register, such as on ARM and PowerPC, this register number is retrieved and used, but never checked in the row if it's saved. Correct this by setting the variable that's used to the new register number. Patch by Jason Molenda. llvm-svn: 221790
* Improve PowerPC unwind supportJustin Hibbits2014-11-124-7/+37
| | | | | | | | | | | | | | | | | Summary: Taking advantage of the new 'CFAIsRegisterDereferenced' CFA register type, add full stack unwind support to the PowerPC/PowerPC64 ABI. Also, add a new register set for powerpc32-on-64, so the register sizes are correct. This also requires modifying the ProcessMonitor to add support for non-uintptr_t-sized register values. Reviewers: jasonmolenda, emaste Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D6183 llvm-svn: 221789
* Add an alternative CFA type.Justin Hibbits2014-11-122-25/+46
| | | | | | | | | | | | | | | | | | | Summary: PowerPC handles the stack chain with the current stack pointer being a pointer to the backchain (CFA). LLDB currently has no way of handling this, so this adds a "CFA is dereferenced from a register" type. Discussed with Jason Molenda, who also provided the initial patch for this. Reviewers: jasonmolenda Reviewed By: jasonmolenda Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D6182 llvm-svn: 221788
* Add an operator== to the RegisterNumber class; it simplifiesJason Molenda2014-11-112-7/+43
| | | | | | RegisterContextLLDB a bit more in a few places. llvm-svn: 221677
* Fix error handling in NativeProcessLinux::AttachToInferior: ↵Shawn Best2014-11-111-1/+8
| | | | | | http://reviews.llvm.org/D6158 llvm-svn: 221647
* [ProcessWindows] Implement breakpoint stop / resume on Windows.Zachary Turner2014-11-1110-11/+173
| | | | | | | | | | | | | | This patch implements basic support for stopping at breakpoints and resuming later. While a breakpoint is stopped at, LLDB will cease to process events in the debug loop, effectively suspending the process, and then resume later when ProcessWindows::DoResume is called. As a side effect, this also correctly handles the loader breakpoint (i.e. the initial stop) so that LLDB goes through the correct state sequence during the initial process launch. llvm-svn: 221642
* [ProcessWindows] Notify process plugin when the launch succeeds.Zachary Turner2014-11-109-53/+89
| | | | llvm-svn: 221637
* Add a RegisterNumber class to RegisterContextLLDB.h and start usingJason Molenda2014-11-082-73/+207
| | | | | | | | | | | | | | | | | | | | | | | it in RegisterContext.cpp. There's a lot of bookkeeping code in RegisterContextLLDB where it has to convert between different register numbering schemes and it makes some methods like SavedLocationForRegister very hard to read or maintain. Abstract all of the details about different register numbering systems for a given register into this new class to make it easier to understand what the method is doing. Also add register name printing to all of the logging -- that's easy to get now that I've got an object to represent the register numbers. There were some gnarly corner cases of this method that I believe I've translated correctly - initial testing looks good but it's possible I missed a corner case, especially with architectures which uses a link-register aka return address register like arm32/arm64. Basic behavior is correct but there are a lot of corner casese that are handled in this method ... llvm-svn: 221577
* Fix a corner case with the handling of noreturn functions.Jason Molenda2014-11-081-9/+45
| | | | | | | | | | | | | | | | | | If a noreturn function was the last function in a section, we wouldn't correctly back up the saved-pc value into the correct section leading to us showing the wrong function in the backtrace. Also add a backtrace test with an attempt to elicit this particular layout. It happens to work out with clang -Os but other compilers may not quite get the same layout I'm getting at that opt setting. We'll still be exercising the basic noreturn handling in the unwinder even if we don't get one function at the very end of a section. <rdar://problem/16051613> llvm-svn: 221575
* LLGS Android target support - for Andy Chien : http://reviews.llvm.org/D6166Shawn Best2014-11-083-3/+13
| | | | llvm-svn: 221570
* Remove the top-level DebugDriverThread in ProcessWindows.Zachary Turner2014-11-0714-860/+74
| | | | | | | | | | Originally the idea was that we would queue requests to a master thread that would dispatch them to other slave threads each responsible for debugging an individual process. This might make some scenarios more scalable and responsive, but for now it seems to be unwarranted complexity for no observable benefit. llvm-svn: 221561
* Decouple ProcessWindows from the Windows debug driver thread.Zachary Turner2014-11-0516-80/+381
| | | | | | | | | In the llgs world, ProcessWindows will eventually go away and we'll implement a different protocol. This patch decouples ProcessWindows from the core debug loop so that this transition will not be more difficult than it needs to be. llvm-svn: 221405
* for Oleksiy Vyalov - Redirect stdin, stdout and stderr to /dev/null when ↵Shawn Best2014-11-051-2/+6
| | | | | | launching LLGS process. Differential Revision: http://reviews.llvm.org/D6105 llvm-svn: 221324
* Rename some classes in ProcessWindows.Zachary Turner2014-11-0513-206/+308
| | | | | | | | | | | | Renamed monitor -> driver, to make clear that the implementation here is in no way related to that of other process plugins which have also implemented classes with similar names such as DebugMonitor. Also created a DebugEventHandler interface, which will be used by implementors to get notified when debugging events happen in the inferiors. llvm-svn: 221322
* Add one extra sanity check to RegisterContextLLDB::TryFallbackUnwindPlanJason Molenda2014-11-041-0/+8
| | | | | | | so it doesn't try the arch default if a comiler-generated (eh_frame, compact unwind info) based unwind plan has failed. llvm-svn: 221239
* Back out r221229 -- instead of trying to identify the end of the unwind,Jason Molenda2014-11-043-36/+9
| | | | | | | | | | | | | | | | | let's let lldb try the arch default unwind every time but not destructively -- it doesn't permanently replace the main unwind method for that function from now on. This fix is for <rdar://problem/18683658>. I tested it against Ryan Brown's go program test case and also a collection of core files of tricky unwind scenarios <rdar://problem/15664282> <rdar://problem/15835846> <rdar://problem/15982682> <rdar://problem/16099440> <rdar://problem/17364005> <rdar://problem/18556719> that I've fixed over the last 6-9 months. llvm-svn: 221238
* Fix one more [-Werror,-Winconsistent-missing-override] error.Eric Christopher2014-11-041-1/+1
| | | | llvm-svn: 221232
* Fix a bunch of [-Werror,-Winconsistent-missing-override] errors.Eric Christopher2014-11-043-82/+82
| | | | llvm-svn: 221231
* After we've completed a full backtrace, we'll have one frame whichJason Molenda2014-11-043-2/+26
| | | | | | | | | | | | | | | | is "invalid" -- it is past the end of the stack trace. Add a new method IsCompletedStackWalk() so we can tell if an invalid stack frame is from a complete backtrace or if it might be worth re-trying the last unwind with a different method. This fixes the unwinder problems Ryan Brown was having with go programs. The unwinder can (under the right circumstances) still destructively replace unwind plans permanently - I'll work on that in a different patch. <rdar://problem/18683658> llvm-svn: 221229
* Implement a framework for live debugging on Windows.Zachary Turner2014-11-0414-7/+1100
| | | | | | | | | | | | | | | | | When processes are launched for debugging on Windows now, LLDB will detect changes such as DLL loads and unloads, breakpoints, thread creation and deletion, etc. These notifications are not yet propagated to LLDB in a way that LLDB understands what is happening with the process. This only picks up the notifications from the OS in a way that they can be sent to LLDB with subsequent patches. Reviewed by: Scott Graham Differential Revision: http://reviews.llvm.org/D6037 llvm-svn: 221207
* The change previously committed as 220983 broke large binary memory reads. I ↵Greg Clayton2014-11-031-58/+55
| | | | | | | | | | kept the "idx - 1" fix from 220983, but reverted the while loop that was incorrectly added. The details are: large packets (like large memory reads (m packets) or large binary memory reads (x packet)) can get responses that come in across multiple read() calls. The while loop that was added meant that if only a partial packet came in (like only "$abc" coming for a response) GDBRemoteCommunication::CheckForPacket() was called, it would deadlock in the while loop because no more data is going to come in as this function needs to be called again with more data from another read. So the original fix will need to be corrected and resubmitted. <rdar://problem/18853744> llvm-svn: 221181
* Always transmit SIGPROF back to the inferior.Stephane Sezer2014-10-311-1/+1
| | | | | | | | | | | | | | | | | | | Summary: SIGPROF is used for profiling processes (with google-perftools for instance), which results in the inferior receiving a SIGPROF from the kernel every few milliseconds. Instead of stopping the debugging session and notifying the user of this, we should just pass the signal and keep running. This follows the behavior we have in UnixSignals.cpp. Test Plan: Run LLDB on linux with a binary using google-perftools, see that execution gets interrupted all the time because we receive SIGPROF. Apply the patch, everything works fine. Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D5953 llvm-svn: 221011
* commit on behalf of Oleksiy Vyalov Fix junk content handling within ↵Shawn Best2014-10-311-55/+58
| | | | | | GDBRemoteCOmmunication::CheckForPacket 1. Avoid removing of an extra symbol from m_bytes. 2. iterate over m_bytes until useful content is found. Differential Revision: http://reviews.llvm.org/D6042 llvm-svn: 220983
* First cut of PowerPC(64) support in LLDB.Justin Hibbits2014-10-3118-1/+1654
| | | | | | | | | | | | | | | | | | | | | | | Summary: This adds preliminary support for PowerPC/PowerPC64, for FreeBSD. There are some issues still: * Breakpoints don't work well on powerpc64. * Shared libraries don't yet get loaded for a 32-bit process on powerpc64 host. * Backtraces don't work. This is due to PowerPC ABI using a backchain pointer in memory, instead of a dedicated frame pointer register for the backchain. * Breakpoints on functions without debug info may not work correctly for 32-bit powerpc. Reviewers: emaste, tfiala, jingham, clayborg Reviewed By: clayborg Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D5988 llvm-svn: 220944
* Get the correct process architecture in ProcessKDP::DidAttach().Greg Clayton2014-10-311-1/+6
| | | | | | <rdar://problem/18806212> llvm-svn: 220938
* Make ProcessWindows just use Host::LaunchProcess.Zachary Turner2014-10-241-5/+1
| | | | llvm-svn: 220574
* A << operation would be undefined for a bit-selectingJason Molenda2014-10-171-1/+1
| | | | | | | | | function because of a '1u' making it a 32-bit value when it really needed to be a 64-bit value. Trivial to fix once I figured out what was going on. clang static analzyer fixit. llvm-svn: 220022
* Be more consistent about null checks for the Process and ABIJason Molenda2014-10-151-7/+14
| | | | | | | | in GetFullUnwindPlanForFrame() - the code was mostly checking that we had an active Process and ABI but not always. clang static analyzer fixit. llvm-svn: 219772
* Create a process launcher abstraction.Zachary Turner2014-10-141-71/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements Host::LaunchProcess for windows, and in doing so does some minor refactor to move towards a more modular process launching design. The original motivation for this is that launching processes on windows needs some very windows specific code, which would live most appropriately in source/Host/windows somewhere. However, there is already some common code that all platforms use when launching a process before delegating to the platform specific stuff, which lives in source/Host/common/Host.cpp which would be nice to reuse without duplicating. This commonality has been abstracted into MonitoringProcessLauncher, a class which abstracts out the notion of launching a process using an arbitrary algorithm, and then monitoring it for state changes. The windows specific launching code lives in ProcessLauncherWindows, and the posix specific launching code lives in ProcessLauncherPosix. When launching a process MonitoringProcessLauncher is created, and then an appropriate delegate launcher is created and given to the MonitoringProcessLauncher. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5781 llvm-svn: 219731
* llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.Todd Fiala2014-10-115-132/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud