History log of /external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
97abb6ddae805a91ccf28a3a91fa68252dcf1fe2 16-Jul-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13793059>

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@186360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
f0c0882ff3fd98456c1814b495888092da2f13f6 11-May-2013 Jason Molenda <jmolenda@apple.com> Update ProcessKDP and ProcessMachCore to use ConstString plugin
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.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
0e191607adcb0ea8ebd06c278be648a7f5c0097f 10-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13854277>
<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.






git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
6c32437e2255db9089ee00cd70b474676d09ab6e 10-May-2013 Jason Molenda <jmolenda@apple.com> Add an explicit check for a darwin kernel KDP_VERSIONSTRING when
starting a kdp communication session, instead of assuming darwin
kernel for any "non-EFI" kdp session.
<rdar://problem/13854098>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181566 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
863aa28adf536c9c008e1590f25da662431d6f13 09-May-2013 Greg Clayton <gclayton@apple.com> Changed the formerly pure virtual function:

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).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
0c90b2c24f6256f9dd6621bc43f7fbc25c5bc65b 09-May-2013 Jim Ingham <jingham@apple.com> Fix the error reporting for ProcessKDP::DoDetach.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
4e75e3533bddc7cf7264c6c7f7b4d812d4466e96 07-May-2013 Andrew Kaylor <andrew.kaylor@intel.com> Reinstating r181091 and r181106 with fix for Linux regressions.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
95bea1dfb166a1816ee36a3453aa3ebeca248844 07-May-2013 Ashok Thirumurthi <ashok.thirumurthi@intel.com> Temporarily reverting r181091 and r181106 due to the vast test breakage on 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


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
35efff89fca50e6fe9aa1a7844c4a8aca84882bf 07-May-2013 Jason Molenda <jmolenda@apple.com> In ProcessKDP, if the remote connection is not EFI,
force this to be a DynamicLoaderDarwinKernel debug
session even if we didn't get back a load address
for the kernel.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
5b80c932986d2357287650459ec13f6636d5a692 04-May-2013 Jason Molenda <jmolenda@apple.com> Change ProcessKDP::UpdateThreadList's call to FindThreadByProtocolID
to not let it update the thread list or else we'll infinite recurse
call back to UpdateThreadList.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
7bee8abf1678cb4dade06add9036981f7249ba09 04-May-2013 Greg Clayton <gclayton@apple.com> After recent OperatingsSystem plug-in changes, the lldb_private::Process and 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.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181091 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
761afb822b18c46b2ad84be03f372e90ac1e6143 02-May-2013 Jim Ingham <jingham@apple.com> Recommitting r180831 with trivial fix - remember to return errors if you compute.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180898 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
411ab47806a478d932926ef7a309ea37edf1f7e7 01-May-2013 Daniel Malea <daniel.malea@intel.com> Reverting 180831 as it crashes TestDefaultConstructorForAPIObjects.py



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
b4e08abf4972befc8412bc83a0205fbdc547290e 01-May-2013 Jim Ingham <jingham@apple.com> Added an option to "process detach" to keep the process stopped, if the process plugin (or in the
case of ProcessGDBRemote the stub we are talking to) know how to do that.

rdar://problem/13680832


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
102b2c2681c9a830afe25bfea35557421905e42c 19-Apr-2013 Greg Clayton <gclayton@apple.com> After discussing with Chris Lattner, we require C++11, so lets get rid of the macros and just use C++11.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
81a96aa6242f7b559770f5dc62316253cb8cb0d4 18-Apr-2013 Greg Clayton <gclayton@apple.com> Since we use C++11, we should switch over to using std::unique_ptr when 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
a365dc57f99579acc77cf77991380054cf6f4d62 12-Apr-2013 Greg Clayton <gclayton@apple.com> Fixed the thread list so it correctly updates after the first core thread exists.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
4ee040ceb708aa2ed8e94523e1de2c62a2287f81 02-Apr-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13516463>

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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178574 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
952e9dc874944fcdbbb224f3ec4fc2c859376f64 28-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13521159>

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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
eb17530206e3f501476a32c5d28c8dc36bac419a 01-Mar-2013 Jim Ingham <jingham@apple.com> Move m_destroy_in_process to Process (from ProcessKDP) since it is generally useful,
and use it to keep from doing the OS Plugin UpdateThreadList while destroying, since
if that does anything that requires the API lock it may deadlock against whoever is
running the Process::Destroy.

<rdar://problem/13308627>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
efb4aeba2bd8411ac0aee9934f08959094d50711 15-Feb-2013 Jim Ingham <jingham@apple.com> A little cleanup. {Disable/Enable}Breakpoint actually disables/enables BreakpointSites not breakpoints, it is confusing
to have it not named appropriately. Also in StopInfoMachException, we aren't testing for software or not software, just
whether the thing is a breakpoint we set. So don't use "software"...


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
9c970a371511a0e31ba9360aa841d445792c1ab0 18-Dec-2012 Jim Ingham <jingham@apple.com> Adding events when watchpoints are set or changed.

<rdar://problem/11597849>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170400 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
5f35a4be95aed0e5b2cb36f7d785bcbfc67284ae 29-Nov-2012 Daniel Malea <daniel.malea@intel.com> Resolve printf formatting warnings on Linux:
- use macros from inttypes.h for format strings instead of OS-specific types

Patch from Matt Kopec!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
d06bb5007b310b5498f7c47006022561ce1ceb4d 25-Oct-2012 Jason Molenda <jmolenda@apple.com> Identify a kdp session that is connecting to an EFI monitor,
use a DynamicLoaderStatic dynamic loader for the session
instead of a kernel or user dynamic loader.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
307c7fdc58d19f734991a176db972cc61d9ada16 20-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12491387>

Added commands to the KDP plug-in that allow sending raw commands through the KDP protocol. You specify a command byte and a payload as ASCII hex bytes, and the packet is created with a valid header/sequenceID/length and sent. The command responds with a raw ASCII hex string that contains all bytes in the reply including the header.

An example of sending a read register packet for the GPR on x86_64:

(lldb) process plugin packet send --command 0x07 --payload 0100000004000000



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
94a5d0de4433dce556db59758f3d6124eb0e1a2a 10-Oct-2012 Jim Ingham <jingham@apple.com> Change the Thread constructor over to take a Process& rather than a ProcessSP. We can't create Threads with a NULL ProcessSP, so it makes no sense to use the SP.
Then make the Thread a Broadcaster, and get it to broadcast when the selected frame is changed (but only from the Command Line) and when Thread::ReturnFromFrame
changes the stack.
Made the Driver use this notification to print the new thread status rather than doing it in the command.
Fixed a few places where people were setting their broadcaster class by hand rather than using the static broadcaster class call.

<rdar://problem/12383087>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
a117a5e4afdecd6316e4decac101c6b84127ec3c 04-Oct-2012 Jason Molenda <jmolenda@apple.com> Remove a few debug printf's that were left in ProcessKDP.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
b46937c86ca4551b2fc9813d848b1a0a2bf2e636 03-Oct-2012 Jason Molenda <jmolenda@apple.com> The kernel loading code is now isolated in the DynamicLoaderDarwinKernel;
remove the duplicates of this code in ProcessGDBRemote and ProcessKDP.
These two Process plugins will hardcode their DynamicLoader name to be
the DynamicLoaderDarwinKernel so the correct DynamicLoader is picked,
and return the kernel load address as the ImageInfosAddress.
<rdar://problem/12417038>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
fac2e62f08719ba800a440b7ad0d5a55a26dc620 29-Sep-2012 Jason Molenda <jmolenda@apple.com> Add support for debugging KASLR kernels via kdp (the kernel being
loaded at a random offset).

To get the kernel's UUID and load address I need to send a kdp
packet so I had to implement the kernel relocation (and attempt to
find the kernel if none was provided to lldb already) in ProcessKDP
-- but this code really properly belongs in DynamicLoaderDarwinKernel.

I also had to add an optional Stream to ConnectRemote so
ProcessKDP::DoConnectRemote can print feedback about the remote kernel's
UUID, load address, and notify the user if we auto-loaded the kernel via
the UUID.

<rdar://problem/7714201>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
3acaa926c8f0d32da48db61a5fcb95276e6a4006 25-Sep-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/9959501>

More KDP debugging process. We can not set breakpoints, hit them, resume, step and detach while running.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
e76f8c408632e2479cbaa1abdcd10a7958fa4846 21-Sep-2012 Greg Clayton <gclayton@apple.com> Full KDP process control with per CPU resume and step.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
ea63601b1d4a21e46e477563f27d1b1c516136d8 21-Sep-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/9959501>

KDP -- now with rudimentary process control (continue only) and read + write registers (which means we can see stack frames) for x86_64, i386 and ARM.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
49ce8969d3154e1560106cfe530444c09410f217 29-Aug-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11757916>

Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()

Cleaned up header includes a bit as well.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
b170aee2daacc83e3d71c3e3acc9d56c89893a7b 08-May-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11358639>

Switch over to the "*-apple-macosx" for desktop and "*-apple-ios" for iOS triples.

Also make the selection process for auto selecting platforms based off of an arch much better.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
ae932359b80098532f3c3766fa9e6527352fbb67 10-Apr-2012 Greg Clayton <gclayton@apple.com> Trying to solve our disappearing thread issues by making thread list updates safer.

The current ProcessGDBRemote function that updates the threads could end up with an empty list if any other thread had the sequence mutex. We now don't clear the thread list when we can't access it, and we also have changed how lldb_private::Process handles the return code from the:

virtual bool
Process::UpdateThreadList (lldb_private::ThreadList &old_thread_list,
lldb_private::ThreadList &new_thread_list) = 0;

A bool is now returned to indicate if the list was actually updated or not and the lldb_private::Process class will only update the stop ID of the validity of the thread list if "true" is returned.

The ProcessGDBRemote also got an extra assertion that will hopefully assert when running debug builds so we can find the source of this issue.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
d1040dd360c07305a30d33b5d4501cb9dfb03114 25-Feb-2012 Han Ming Ong <hanming@apple.com> <rdar://problem/3535148>

Added ability to debug root processes on OS X. This uses XPC service that is available on Lion and above only.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151419 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
f4124deeb9532044a38c0774ced872f2709347da 21-Feb-2012 Greg Clayton <gclayton@apple.com> Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptr
objects for the backlink to the lldb_private::Process. The issues we were
running into before was someone was holding onto a shared pointer to a
lldb_private::Thread for too long, and the lldb_private::Process parent object
would get destroyed and the lldb_private::Thread had a "Process &m_process"
member which would just treat whatever memory that used to be a Process as a
valid Process. This was mostly happening for lldb_private::StackFrame objects
that had a member like "Thread &m_thread". So this completes the internal
strong/weak changes.

Documented the ExecutionContext and ExecutionContextRef classes so that our
LLDB developers can understand when and where to use ExecutionContext and
ExecutionContextRef objects.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
5a15e6927b5b3234fb3e688717297ba6b5dd6ad7 16-Feb-2012 Jim Ingham <jingham@apple.com> Add a general mechanism to wait on the debugger for Broadcasters of a given class/event bit set.
Use this to allow the lldb Driver to emit notifications for breakpoint modifications.
<rdar://problem/10619974>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
46c9a355af9b39db78c006b2a5cbf97d3c58d947 09-Feb-2012 Greg Clayton <gclayton@apple.com> First pass at mach-o core file support is in. It currently works for x86_64
user space programs. The core file support is implemented by making a process
plug-in that will dress up the threads and stack frames by using the core file
memory.

Added many default implementations for the lldb_private::Process functions so
that plug-ins like the ProcessMachCore don't need to override many many
functions only to have to return an error.

Added new virtual functions to the ObjectFile class for extracting the frozen
thread states that might be stored in object files. The default implementations
return no thread information, but any platforms that support core files that
contain frozen thread states (like mach-o) can make a module using the core
file and then extract the information. The object files can enumerate the
threads and also provide the register state for each thread. Since each object
file knows how the thread registers are stored, they are responsible for
creating a suitable register context that can be used by the core file threads.

Changed the process CreateInstace callbacks to return a shared pointer and
to also take an "const FileSpec *core_file" parameter to allow for core file
support. This will also allow for lldb_private::Process subclasses to be made
that could load crash logs. This should be possible on darwin where the crash
logs contain all of the stack frames for all of the threads, yet the crash
logs only contain the registers for the crashed thrad. It should also allow
some variables to be viewed for the thread that crashed.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
db9d6f47ab38e25c3efcbfa05780bf9a127fd259 31-Jan-2012 Greg Clayton <gclayton@apple.com> Cleaned up the Communication class when it tears down ConnectionFileDescriptor
instances to not pthread_cancel the read threads and wreak havoc on the mutex
in our ConnectionFileDescriptor class.

Also cleaned up some shutdown delays.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
ffa43a6bc42bfcccae46eec9cf7bf73f17c328e9 17-Nov-2011 Greg Clayton <gclayton@apple.com> Fixed the issue that was causing our monitor process threads to crash, it
turned out to be unitialized data in the ProcessLaunchInfo default constructor.
Turning on MallocScribble in the environment helped track this down.

When we launch and attach using the host layer, we now inform the process that
it shouldn't detach when by calling an accessor.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
36bc5ea5a48c19421d44f559e2165c105657b809 03-Nov-2011 Greg Clayton <gclayton@apple.com> Modified all Process::Launch() calls to use a ProcessLaunchInfo structure
on internal only (public API hasn't changed) to simplify the paramter list
to the launch calls down into just one argument. Also all of the argument,
envronment and stdio things are now handled in a much more centralized fashion.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
61ddf56b2526dab3f9485c87db414978cbd9e285 21-Oct-2011 Greg Clayton <gclayton@apple.com> If a process plug-in was specified by name, always let the plug-in get used.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
444e35b5fdf15a25a427285650f06f1390e62c75 19-Oct-2011 Greg Clayton <gclayton@apple.com> Moved lldb::user_id_t values to be 64 bit. This was going to be needed for
process IDs, and thread IDs, but was mainly needed for for the UserID's for
Types so that DWARF with debug map can work flawlessly. With DWARF in .o files
the type ID was the DIE offset in the DWARF for the .o file which is not
unique across all .o files, so now the SymbolFileDWARFDebugMap class will
make the .o file index part (the high 32 bits) of the unique type identifier
so it can uniquely identify the types.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
ecd4feb5111432d2878e95461220c720cb2d24c8 14-Oct-2011 Johnny Chen <johnny.chen@apple.com> SBValue::Watch() and SBValue::WatchPointee() are now the official API for creating
a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee
encapsulated by SBValue (WatchPointee).

Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that.

Modified the watchpoint related test suite to reflect the change.

Plus replacing WatchpointLocation with Watchpoint throughout the code base.

There are still cleanups to be dome. This patch passes the whole test suite.
Check it in so that we aggressively catch regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
01df0574eab3f655e8c835498c383120688e3e0b 11-Oct-2011 Johnny Chen <johnny.chen@apple.com> Fix a typo in ProcessKDP::DidAttach().

Patch by Dawn.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141711 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
37f962e785be99dc4f0c5e9d02416992ff03bbd0 22-Aug-2011 Greg Clayton <gclayton@apple.com> Added a new plug-in type: lldb_private::OperatingSystem. The operating system
plug-ins are add on plug-ins for the lldb_private::Process class that can add
thread contexts that are read from memory. It is common in kernels to have
a lot of threads that are not currently executing on any cores (JTAG debugging
also follows this sort of thing) and are context switched out whose state is
stored in memory data structures. Clients can now subclass the OperatingSystem
plug-ins and then make sure their Create functions correcltly only enable
themselves when the right binary/target triple are being debugged. The
operating system plug-ins get a chance to attach themselves to processes just
after launching or attaching and are given a lldb_private::Process object
pointer which can be inspected to see if the main executable, target triple,
or any shared libraries match a case where the OS plug-in should be used.
Currently the OS plug-ins can create new threads, define the register contexts
for these threads (which can all be different if desired), and populate and
manage the thread info (stop reason, registers in the register context) as
the debug session goes on.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138228 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
5beb99d65c72cd4a4f7529c4ff8cc04a1a40769d 11-Aug-2011 Greg Clayton <gclayton@apple.com> Added the ability to remove orphaned module shared pointers from a ModuleList.
This is helping us track down some extra references to ModuleSP objects that
are causing things to get kept around for too long.

Added a module pointer accessor to target and change a lot of code to use
it where it would be more efficient.

"taret delete" can now specify "--clean=1" which will cleanup the global module
list for any orphaned module in the shared module cache which can save memory
and also help track down module reference leaks like we have now.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
7b13922c3c6b55225fa8403762c0399e9692b730 21-Jul-2011 Greg Clayton <gclayton@apple.com> More KDP fixes and logging cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
234981a4559db084f9c90612660e40f19915b89c 20-Jul-2011 Greg Clayton <gclayton@apple.com> Added KDP resume, suspend, set/remove breakpoint, and kernel version support.
Also we now display a live update of the kexts that we are loading.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
0fa512447e00da09d300fbabd18b5ce94f52fdaa 19-Jul-2011 Greg Clayton <gclayton@apple.com> Modified the LocateMacOSXFilesUsingDebugSymbols(...) function to locate
an executable file if it is right next to a dSYM file that is found using
DebugSymbols. The code also looks into a bundle if the dSYM file is right
next to a bundle.

Modified the MacOSX kernel dynamic loader plug-in to correctly set the load
address for kext sections. This is a tad tricky because of how LLDB chooses
to treat mach-o segments with no name. Also modified the loader to properly
handle the older version 1 kext summary info.

Fixed a crasher in the Mach-o object file parser when it is trying to set
the section size correctly for dSYM sections.

Added packet dumpers to the CommunicationKDP class. We now also properly
detect address byte sizes based on the cpu type and subtype that is provided.
Added a read memory and read register support to CommunicationKDP. Added a
ThreadKDP class that now uses subclasses of the RegisterContextDarwin_XXX for
arm, i386 and x86_64.

Fixed some register numbering issues in the RegisterContextDarwin_arm class
and added ARM GDB numbers to the ARM_GCC_Registers.h file.

Change the RegisterContextMach_XXX classes over to subclassing their
RegisterContextDarwin_XXX counterparts so we can share the mach register
contexts between the user and kernel plug-ins.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
8d2ea2888a4acb7f140f9af64ddd2b16b2dee870 17-Jul-2011 Greg Clayton <gclayton@apple.com> Added a boolean to the pure virtual lldb_private::Process::CanDebug(...)
method so process plug-ins that are requested by name can answer yes when
asked if they can debug a target that might not have any file in the target.

Modified the ConnectionFileDescriptor to have both a read and a write file
descriptor. This allows us to support UDP, and eventually will allow us to
support pipes. The ConnectionFileDescriptor class also has a file descriptor
type for each of the read and write file decriptors so we can use the correct
read/recv/recvfrom call when reading, or write/send/sendto for writing.

Finished up an initial implementation of UDP where you can use the "udp://"
URL to specify a host and port to connect to:

(lldb) process connect --plugin kdp-remote udp://host:41139

This will cause a ConnectionFileDescriptor to be created that can send UDP
packets to "host:41139", and it will also bind to a localhost port that can
be given out to receive the connectionless UDP reply.

Added the ability to get to the IPv4/IPv6 socket port number from a
ConnectionFileDescriptor instance if either file descriptor is a socket.

The ProcessKDP can now successfully connect to a remote kernel and detach
using the above "processs connect" command!!! So far we have the following
packets working:
KDP_CONNECT
KDP_DISCONNECT
KDP_HOSTINFO
KDP_VERSION
KDP_REATTACH

Now that the packets are working, adding new packets will go very quickly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
d52d00f4edb746ba458a3e659699160952dc925e 16-Jul-2011 Greg Clayton <gclayton@apple.com> Completed more work on the KDP darwin kernel debugging Process plug-in.
Implemented connect, disconnect, reattach, version, and hostinfo.

Modified the ConnectionFileDescriptor class to be able to handle UDP.

Added a new Stream subclass called StreamBuffer that is backed by a
llvm::SmallVector for better efficiency.

Modified the DataExtractor class to have a static function that can
dump hex bytes into a stream. This is currently being used to dump incoming
binary packet data in the KDP plug-in.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
269f91e066c5991a4d4aa2945ea2c285f8589b12 15-Jul-2011 Greg Clayton <gclayton@apple.com> Fixed the comment lines in the file comment headers.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135284 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
1e5b02176d6952d0679479926fa557534313472b 15-Jul-2011 Greg Clayton <gclayton@apple.com> Added the ability to connect using "tcp://<host>:<port>" which is the
same as the old "connect://<host>:<port>". Also added the ability to
connect using "udp://<host>:<port>" which will open a connected
datagram socket. I need to find a way to specify a non connected
datagram socket as well.

We might need to start setting some settings in the URL itself,
maybe something like:

udp://<host>:<port>?connected=yes
udp://<host>:<port>?connected=no

I am open to suggestions for URL settings.

Also did more work on the KDP darwin kernel plug-in.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
363be3fc515bea8baf2c5031f3c62f6326d9e1b8 15-Jul-2011 Greg Clayton <gclayton@apple.com> Hollowed out process plug-in to do KDP darwin kernel debugging.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp