summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change over the broadcaster/listener process to hold shared or weak pointersJim Ingham2016-03-071-8/+8
| | | | | | | | | | | | | | to each other. This should remove some infrequent teardown crashes when the listener is not the debugger's listener. Processes now need to take a ListenerSP, not a Listener&. This required changing over the Process plugin class constructors to take a ListenerSP, instead of a Listener&. Other than that there should be no functional change. <rdar://problem/24580184> CrashTracer: [USER] Xcode at …ework: lldb_private::Listener::BroadcasterWillDestruct + 39 llvm-svn: 262863
* Make lldb::endian::InlHostByteOrder() private.Bruce Mitchener2015-11-071-2/+2
| | | | | | | | | | | | | | | | | | Summary: Since this is within the lldb namespace, the compiler tries to export a symbol for it. Unfortunately, since it is inlined, the symbol is hidden and this results in a mess of warnings when building on OS X with cmake. Moving it to the lldb_private namespace eliminates that problem. Reviewers: clayborg Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D14417 llvm-svn: 252396
* Add support for the new (added last week) llvm::Triple::WatchOS and ::TvOSJason Molenda2015-11-051-1/+3
| | | | | | | | | | in places where we check for Triple::IOS. They're mostly the same as far as lldb is conerned. . Also add a base cass implementation for Process::IsAlive - Greg added this last year but it didn't get upstreamed. llvm-svn: 252227
* Make sure we don't over specify an architecture when we connect to KDP and ↵Greg Clayton2015-10-281-14/+29
| | | | | | | | use the CPU type and subtype to fill out an architecture. We do this by letting the vendor be an unspecified unknown, or any. We also grab the target architecture, get the KDP host arch, and then merge the two before putting it back into the target. Also change MH_PRELOAD to be use "unspecified unknown" (any) for the OS and vendor since these mach files can really be anything. llvm-svn: 251579
* Split Socket class into Tcp/Udp/DomainSocket subclasses.Oleksiy Vyalov2015-10-151-2/+2
| | | | | | http://reviews.llvm.org/D13754 llvm-svn: 250474
* Re-commit the (fixed) changes from r248985 which were reverted by PavelJason Molenda2015-10-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when they introduced android testsuite regressions. Pavel has run the testsuite against the updated patch and it completes cleanly now. The original commit message: Fixing a subtle issue on Mac OS X systems with dSYMs (possibly introduced by r235737 but I didn't look into it too closely). A dSYM can have a per-UUID plist in it which tells lldb where to find an executable binary for the dSYM (DBGSymbolRichExecutable) - other information can be included in this plist, like how to remap the source file paths from their build pathnames to their long-term storage pathnames. This per-UUID plist is a unusual; it is used probably exclusively inside apple with our build system. It is not created by default in normal dSYMs. The problem was like this: 1. lldb wants to find an executable, given only a UUID (this happens when lldb is doing cross-host debugging and doesn't have a copy of the target system's binaries) 2. It eventually calls LocateMacOSXFilesUsingDebugSymbols which does a spotlight search for the dSYM on the local system, and failing that, tries the DBGShellCommands command to find the dSYM. 3. It gets a dSYM. It reads the per-UUID plist in the dSYM. The dSYM has a DBGSymbolRichExecutable kv pair pointing to the binary on a network filesystem. 4. Using the binary on the network filesystem, lldb now goes to find the dSYM. 5. It starts by looking for a dSYM next to the binary it found. 6. lldb is now reading the dSYM over a network filesystem, ignoring the one it found on its local filesystem earlier. Everything still *works* but it's much slower. This would be a tricky one to write up in a testsuite case; you really need the binary to not exist on the local system. And LocateMacOSXFilesUsingDebugSymbols will only compile on Mac OS X - even if I found a way to write up a test case, it would not run anywhere but on a mac. One change Greg wanted while I was touching this code was to have LocateMacOSXFilesUsingDebugSymbols (which could be asked to find a binary OR find a dSYM) to instead return a ModuleSpec with the sum total of everything it could find. This change of passing around a ModuleSpec instead of a FileSpec was percolated up into ModuleList::GetSharedModule. The changes to LocateMacOSXFilesUsingDebugSymbols look larger than they really are - there's a lot of simple whitespace changes in there. I ran the testsuites on mac, no new regressions introduced <rdar://problem/21993813> llvm-svn: 249755
* Revert "Fixing a subtle issue on Mac OS X systems with dSYMs..."Pavel Labath2015-10-011-7/+1
| | | | | | | This reverts commit r248985, as it was breaking all remote expression-evaluating tests (on android at least). llvm-svn: 248995
* Fixing a subtle issue on Mac OS X systems with dSYMs (possiblyJason Molenda2015-10-011-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduced by r235737 but I didn't look into it too closely). A dSYM can have a per-UUID plist in it which tells lldb where to find an executable binary for the dSYM (DBGSymbolRichExecutable) - other information can be included in this plist, like how to remap the source file paths from their build pathnames to their long-term storage pathnames. This per-UUID plist is a unusual; it is used probably exclusively inside apple with our build system. It is not created by default in normal dSYMs. The problem was like this: 1. lldb wants to find an executable, given only a UUID (this happens when lldb is doing cross-host debugging and doesn't have a copy of the target system's binaries) 2. It eventually calls LocateMacOSXFilesUsingDebugSymbols which does a spotlight search for the dSYM on the local system, and failing that, tries the DBGShellCommands command to find the dSYM. 3. It gets a dSYM. It reads the per-UUID plist in the dSYM. The dSYM has a DBGSymbolRichExecutable kv pair pointing to the binary on a network filesystem. 4. Using the binary on the network filesystem, lldb now goes to find the dSYM. 5. It starts by looking for a dSYM next to the binary it found. 6. lldb is now reading the dSYM over a network filesystem, ignoring the one it found on its local filesystem earlier. Everything still *works* but it's much slower. This would be a tricky one to write up in a testsuite case; you really need the binary to not exist on the local system. And LocateMacOSXFilesUsingDebugSymbols will only compile on Mac OS X - even if I found a way to write up a test case, it would not run anywhere but on a mac. One change Greg wanted while I was touching this code was to have LocateMacOSXFilesUsingDebugSymbols (which could be asked to find a binary OR find a dSYM) to instead return a ModuleSpec with the sum total of everything it could find. This change of passing around a ModuleSpec instead of a FileSpec was percolated up into ModuleList::GetSharedModule. The changes to LocateMacOSXFilesUsingDebugSymbols look larger than they really are - there's a lot of simple whitespace changes in there. I ran the testsuites on mac, no new regressions introduced <rdar://problem/21993813> llvm-svn: 248985
* Fix ProcessKDP.cpp for the change in r246578.Jim Ingham2015-09-011-13/+15
| | | | llvm-svn: 246601
* Move ProcessKDP's StringExtractor include.Bruce Mitchener2015-07-071-0/+1
| | | | | | | | | | | | | | | This can be in the cpp file rather than the header file, so moving it there. Summary: Move ProcessKDP's StringExtractor include. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11018 llvm-svn: 241649
* Fix StringExtractor.h issues.Bruce Mitchener2015-07-071-1/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Fix StringExtractor.h issues. * source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (#include "Utility/StringExtractor.h): Not needed, this is already included by ProcessKDP.h * unittests/Utility/StringExtractorTest.cpp (#include "Utility/StringExtractor.h): Update include path to the new location. Reviewers: labath, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10995 llvm-svn: 241596
* Fix typosBruce Mitchener2015-07-021-1/+1
| | | | | | | | | | | | Summary: Fixes more typos. Reviewers: clayborg Subscribers: lldb-commits-list Differential Revision: http://reviews.llvm.org/D10898 llvm-svn: 241289
* Remove DoAttachToProcessWithId(lldb::pid_t).Zachary Turner2015-05-131-9/+0
| | | | | | | | | | There were two versions of DoAttachToprocessWithId. One that takes a pid_t, and the other which takes a pid_t and a ProcessAttachInfo. There were no callers of the former version, and all of the implementations of this version were simply forwarding calls to one version or the other. llvm-svn: 237281
* Sprinkle some #include <mutex> in files that use std::call_once.Benjamin Kramer2015-04-031-0/+2
| | | | llvm-svn: 234005
* Fix typo, fix build.Bruce Mitchener2015-04-031-1/+1
| | | | | | This typo was introduced as part of http://reviews.llvm.org/D8760 llvm-svn: 234003
* [Plugin/Process] Use std::call_once() to initialize.Davide Italiano2015-04-031-8/+7
| | | | | | | | This replaces the home-grown initialization mechanism used before. Differential Revision: http://reviews.llvm.org/D8760 llvm-svn: 233999
* Fix build on OS X after r231202Ilia K2015-03-041-0/+1
| | | | llvm-svn: 231235
* Add Socket::Get[Remote/Local]IpAddress and unit testsVince Harron2015-01-161-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D6917 llvm-svn: 226234
* Get the correct process architecture in ProcessKDP::DidAttach().Greg Clayton2014-10-311-1/+6
| | | | | | <rdar://problem/18806212> llvm-svn: 220938
* Move ConnectionFileDescriptor to platform-specific Host directory.Zachary Turner2014-10-061-1/+1
| | | | | | | | | | | | As part of getting ConnectionFileDescriptor working on Windows, there is going to be alot of platform specific work to be done. As a result, the implementation is moving into Host. This patch performs the code move and fixes up call-sites appropriately. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5548 llvm-svn: 219143
* Fix up the HostThread interface, making the interface simpler.Zachary Turner2014-09-231-7/+4
| | | | | | | Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5417 llvm-svn: 218325
* Create a HostThread abstraction.Zachary Turner2014-09-091-12/+12
| | | | | | | | | | | | | 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 ProcessKDP after Host/Socket additionKeno Fischer2014-08-061-2/+3
| | | | | | | | | | Reviewers: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D4815 llvm-svn: 214996
* Creates a socket host object.Zachary Turner2014-08-061-1/+2
| | | | | | | | | | | | | | | | | | This patch moves the logic of many common socket operations into its own class lldb_private::Socket. It then modifies the ConnectionFileDescriptor class, and a few users of that class, to use this new Socket class instead of hardcoding socket logic directly. Finally, this patch creates a common interface called IOObject for any objects that support reading and writing, so that endpoints such as sockets and files can be treated the same. Differential Revision: http://reviews.llvm.org/D4641 Reviewed by: Todd Fiala, Greg Clayton llvm-svn: 214984
* After you attach, give the process plugin a chance to report back (throughJim Ingham2014-08-021-1/+3
| | | | | | | | DidAttach) the architecture of the binary you attached to. <rdar://problem/17891396> llvm-svn: 214603
* Modify the EFI KDP debugging to not use any dynamic loader since it does ↵Greg Clayton2014-07-161-1/+35
| | | | | | | | | | manual dynamic loading itself via python modules. Also track down the required binary by trying to locate the main executable module through LLDB's symbol and executable file locating code. <rdar://problem/16570258> llvm-svn: 213199
* Change ProcessKDP::DoReadMemory() to break up large memoryJason Molenda2014-05-211-1/+25
| | | | | | | | | read requests into smaller chunks; some remote kdp stubs cannot handle memory reads larger than a KB or two & will error out. <rdar://problem/16983125> llvm-svn: 209341
* Move calls to DisableAllBreakpointSites() and ↵Andrew MacPherson2014-03-251-4/+0
| | | | | | m_thread_list.DiscardThreadPlans() into base Process::Destroy() instead of in subclass DoDestroy() methods. llvm-svn: 204752
* Remove wait_for_launch parameter from DoAttachToProcessWithName(). This ↵Jean-Daniel Dupas2013-12-231-1/+1
| | | | | | | | | | parameter is redundant as this information is already provided by the ProcessAttachInfo parameter. CC: lldb-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2463 llvm-svn: 197923
* Remove 'const' constraint on ProcessLaunchInfo parameter in Process::DoLaunch().Jean-Daniel Dupas2013-12-091-1/+1
| | | | | | This 'const' is not required and prevent us to defer the launch to the Host layer. llvm-svn: 196837
* Fix some names in the wake of my Mach-O changes to LLVM.Charles Davis2013-08-271-0/+2
| | | | llvm-svn: 189317
* <rdar://problem/13793059>Greg Clayton2013-07-151-1/+75
| | | | | | | | | | | Added a setting to control timeout for kdp response packets. While I was at it, I also added a way to control the response timeout for gdb-remote packets. KDP defaults to 5 seconds, and GDB defaults to 1 second. These were the default values that were in the code prior to adding these settings. (lldb) settings set plugin.process.gdb-remote.packet-timeout 10 (lldb) settings set plugin.process.kdp-remote.packet-timeout 10 llvm-svn: 186360
* Update ProcessKDP and ProcessMachCore to use ConstString pluginJason Molenda2013-05-111-1/+1
| | | | | | | | | | names when specifying the DynamicLoaderDarwinKernel. ProcessGDBRemote wasn't setting the dyld string any more; remove the remaining code tracking the dyld plugin name altogether from that process plugin. llvm-svn: 181658
* <rdar://problem/13854277>Greg Clayton2013-05-101-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. llvm-svn: 181631
* Add an explicit check for a darwin kernel KDP_VERSIONSTRING whenJason Molenda2013-05-091-2/+2
| | | | | | | | starting a kdp communication session, instead of assuming darwin kernel for any "non-EFI" kdp session. <rdar://problem/13854098> llvm-svn: 181566
* Changed the formerly pure virtual function:Greg Clayton2013-05-091-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | namespace lldb_private { class Thread { virtual lldb::StopInfoSP GetPrivateStopReason() = 0; }; } To not be virtual. The lldb_private::Thread now handles the correct caching and will call a new pure virtual function: namespace lldb_private { class Thread { virtual bool CalculateStopInfo() = 0; } } This function must be overridden by thead lldb_private::Thread subclass and the only thing it needs to do is to set the Thread::StopInfo() with the current stop reason and return true, or return false if there is no stop reason. The lldb_private::Thread class will take care of calling this function only when it is required. This allows lldb_private::Thread subclasses to be a bit simpler and not all need to duplicate the cache and invalidation settings. Also renamed: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopReason(); To: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopInfo(); Also cleaned up a case where the ThreadPlanStepOverBreakpoint might not re-set its breakpoint if the thread disappears (which was happening due to a bug when using the OperatingSystem plug-ins with memory threads and real threads). llvm-svn: 181501
* Fix the error reporting for ProcessKDP::DoDetach.Jim Ingham2013-05-091-5/+10
| | | | llvm-svn: 181493
* Reinstating r181091 and r181106 with fix for Linux regressions.Andrew Kaylor2013-05-071-9/+18
| | | | llvm-svn: 181340
* Temporarily reverting r181091 and r181106 due to the vast test breakage on ↵Ashok Thirumurthi2013-05-071-18/+9
| | | | | | | | | | the Linux buildbots while we develop a better understanding of how to manage the thread lists in a platform-independant fashion. Reviewed by: Daniel Malea llvm-svn: 181323
* In ProcessKDP, if the remote connection is not EFI,Jason Molenda2013-05-061-2/+5
| | | | | | | | force this to be a DynamicLoaderDarwinKernel debug session even if we didn't get back a load address for the kernel. llvm-svn: 181264
* Change ProcessKDP::UpdateThreadList's call to FindThreadByProtocolIDJason Molenda2013-05-041-1/+1
| | | | | | | to not let it update the thread list or else we'll infinite recurse call back to UpdateThreadList. llvm-svn: 181106
* After recent OperatingsSystem plug-in changes, the lldb_private::Process and ↵Greg Clayton2013-05-041-9/+18
| | | | | | | | | | lldb_private::Thread subclasses were changed and the API was not respected properly. This checkin aims to fix this. The process now has two thread lists: a real thread list for threads that are created by the lldb_private::Process subclass, and the user visible threads. The user visible threads are the same as the real threas when no OS plug-in in used. But when an OS plug-in is used, the user thread can be a combination of real and "memory" threads. Real threads can be placed inside of memory threads so that a thread appears to be different, but is still controlled by the actual real thread. When the thread list needs updating, the lldb_private::Process class will call the: lldb_private::Process::UpdateThreadList() function with the old real thread list, and the function is expected to fill in the new real thread list with the current state of the process. After this function, the process will check if there is an OS plug-in being used, and if so, it will give the old user thread list, the new real thread list and the OS plug-in will create the new user thread list from both of these lists. If there is no OS plug-in, the real thread list is the user thread list. These changes keep the lldb_private::Process subclasses clean and no changes are required. llvm-svn: 181091
* Recommitting r180831 with trivial fix - remember to return errors if you ↵Jim Ingham2013-05-021-4/+6
| | | | | | compute. llvm-svn: 180898
* Reverting 180831 as it crashes TestDefaultConstructorForAPIObjects.pyDaniel Malea2013-05-011-6/+4
| | | | llvm-svn: 180868
* Added an option to "process detach" to keep the process stopped, if the ↵Jim Ingham2013-04-301-4/+6
| | | | | | | | | | process plugin (or in the case of ProcessGDBRemote the stub we are talking to) know how to do that. rdar://problem/13680832 llvm-svn: 180831
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-181-1/+1
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-181-1/+1
| | | | | | | | C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
* Fixed the thread list so it correctly updates after the first core thread ↵Greg Clayton2013-04-111-4/+2
| | | | | | exists. llvm-svn: 179326
* <rdar://problem/13516463>Greg Clayton2013-04-021-6/+33
| | | | | | Don't crash when there is no register context for a thread with kernel debugging. The kernel debugging uses the OperatingSystemPlugin that may behave badly when trying to get thread state, so be prepared to have invalid register contexts in threads. llvm-svn: 178574
* <rdar://problem/13521159>Greg Clayton2013-03-271-7/+7
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
OpenPOWER on IntegriCloud