History log of /external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
c4353f292a6a586cbf3e6e7df83804185579eda5 22-Jun-2013 Jim Ingham <jingham@apple.com> Add some useful logging for tracking thread matching problems.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4bf8e1e32494f847d73fc90b9c7de44bbe562159 21-Jun-2013 Han Ming Ong <hanming@apple.com> <rdar://problem/13980489>

I added scan type to ‘qGetProfileData’ previously but forgot to update the check to be a substring search.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3e11c7ec050648ba865f1d451f8cb46fd39072a8 19-Jun-2013 Andy Gibbs <andyg1001@hotmail.co.uk> Sort out a number of mismatched integer types in order to cut down the number of compiler warnings.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
13bf1b0961744c0b643a383d6f49f61eb19e165a 08-Jun-2013 Jim Ingham <jingham@apple.com> Don't retry the Connect when starting up debugserver if the reason for the previous failure was
EINTR. That means the user was trying to interrupt us, and we should just stop instead.

<rdar://problem/13184758>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
dae58bb68e864d4318f465b9e97b48d4fc0dd177 03-Jun-2013 Jim Ingham <jingham@apple.com> Fix a couple of error message typos.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
e3f9bfdfe3d09ef089f2aef3fb8701c8721f6f45 21-May-2013 Greg Clayton <gclayton@apple.com> Added a test case that verifies that LLDB can debug across a process exec'ing itself into a new program. This currently is only enabled for Darwin since we exec from 64 bit to 32 bit and vice versa for 'x86_64' targets.

This can easily be adapted for linux and other platforms, but I didn't want to break any buildbots by assuming it will work.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4d4ff9e8f7746ba1b1d597512b7cb711350c0206 21-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13892516>

LLDB can now debug across calls to exec when the architecture changes from say i386 to x86_64 (on darwin).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
a46013bde54626b68cd2013b108f73a205f4b29a 01-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13700260>
<rdar://problem/13723772>

Modified the lldb_private::Thread to work much better with the OperatingSystem plug-ins. Operating system plug-ins can now return have a "core" key/value pair in each thread dictionary for the OperatingSystemPython plug-ins which allows the core threads to be contained with memory threads. It also allows these memory threads to be stepped, resumed, and controlled just as if they were the actual backing threads themselves.

A few things are introduced:
- lldb_private::Thread now has a GetProtocolID() method which returns the thread protocol ID for a given thread. The protocol ID (Thread::GetProtocolID()) is usually the same as the thread id (Thread::GetID()), but it can differ when a memory thread has its own id, but is backed by an actual API thread.
- Cleaned up the Thread::WillResume() code to do the mandatory parts in Thread::ShouldResume(), and let the thread subclasses override the Thread::WillResume() which is now just a notification.
- Cleaned up ClearStackFrames() implementations so that fewer thread subclasses needed to override them
- Changed the POSIXThread class a bit since it overrode Thread::WillResume(). It is doing the wrong thing by calling "Thread::SetResumeState()" on its own, this shouldn't be done by thread subclasses, but the current code might rely on it so I left it in with a TODO comment with an explanation.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
04ba2a8b752348b78aae7ff323ed05d210037628 25-Apr-2013 Jason Molenda <jmolenda@apple.com> Fix one small whitespace alignment mistake.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
5042acfb254338f60ef8bc3a8715e229795d941f 20-Apr-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13697881>

Fixed the GDB remote with the python OS plug-in to not show core threads when they aren't desired and also to have the threads "to the right thing" when continuing.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
e33bb5b0dabf62498715afe3d1cd22cda0af1d24 29-Mar-2013 Jim Ingham <jingham@apple.com> Rationalize how we do Halt-ing before Destroy and Detach.

<rdar://problem/13527167>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
151e3be552fea65cc4f03eaa1c425f793266fe56 14-Feb-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/12693921>

Rename the monitor command from "qCmd" (incorrect) to "qRcmd".



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
2fb13abef75a40453fb2f54b782fe04add6bd519 02-Feb-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/12693921>

Added the ability to send monitor command to the remote GDB server with "process plugin packet monitor".



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
9338dd571e7781a89724d79e1f54385c282d0316 30-Jan-2013 Jason Molenda <jmolenda@apple.com> <rdar://problem/12491235>

Enhance lldb so it can search for a kernel in memory when attaching
to a remote system. Remove some of the code that was doing this
from ProcessMachCore and ProcessGDBRemote and put it in
DynamicLoaderDarwinKernel.

I've added a new setting, plugin.dynamic-loader.darwin-kernel.scan-type
which can be set to

none - for environments where reading random memory can cause a
device crash
basic - look at one fixed location in memory for a kernel load address,
plus the contents of that address
fast-scan - the default, tries "basic" and then looks for the kernel's
mach header near the current pc value when lldb connects
exhaustive-scan - on 32-bit targets, step through the entire range where
the kernel can be loaded, looking for the kernel binary

I don't have the setting set up correctly right now, I'm getting back unexpected
values from the Property system, but I'll figure that out tomorrow and fix.
Besides that, all of the different communication methods / types of kernels
appear to be working correctly with these changes.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173891 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
36da2aa6dc5ad9994b638ed09eb81c44cc05540b 25-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13069948>

Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.

So I defined a new "lldb::offset_t" which should be used for all file offsets.

After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.

Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
679ba16fbf2be2ef93d3c654e2639ab0cb32c598 22-Jan-2013 Greg Clayton <gclayton@apple.com> Changed the register number lists for the qRegisterInfo packet response to be raw hex to match all other register reading and writing APIs.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c290ba49b79c88ace8e5c58917489415e429ef01 21-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13020634>

Fixed the 32, 16, and 8 bit pseudo regs for x86_64 (real reg of "rax" which subvalues "eax", "ax", etc...) to correctly get updated when stepping. Also fixed it so actual registers can specify what other registers must be invalidated when a register is modified. Previously, only pseudo registers could invalidate other registers.

Modified the LLDB qRegisterInfo extension to the GDB remote interface to support specifying the containing registers with the new "container-regs" key whose value is a comma separated list of register numbers. Also added a "invalidate-regs" key whose value is also a comma separated list of register numbers.

Removed the hack GDBRemoteDynamicRegisterInfo::Addx86_64ConvenienceRegisters() function and modified "debugserver" to specify the registers correctly using the new "container-regs" and "invalidate-regs" keys.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173096 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
0df19ccfaa20d43245fea877fcfdfd5b2efb08c9 19-Jan-2013 Han Ming Ong <hanming@apple.com> <rdar://problem/12976277>

Swap in index ids for thread ids in GDBRemoteCommunicationClient. Besides dealing with the async logic, I have to take care of the situation when the inferior paused as well.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
ccd5c4ee85d1592f9ae3da02c85f5647ca02fab2 08-Jan-2013 Han Ming Ong <hanming@apple.com> <rdar://problem/12976225>

Checking in the support for doing index ids reservation when given a thread id.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@171904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
fe555673aebe745e5c35412969639ae348ce50d4 19-Dec-2012 Jason Molenda <jmolenda@apple.com> <rdar://problem/11961650>

Update the debugserver "qProcessInfo" implementation to return the
cpu type, cpu subtype, OS and vendor information just like qHostInfo
does so lldb can create an ArchSpec based on the returned values.

Add a new GetProcessArchitecture to GDBRemoteCommunicationClient akin
to GetHostArchitecture. If the qProcessInfo packet is supported,
GetProcessArchitecture will return the cpu type / subtype of the
process -- e.g. a 32-bit user process running on a 64-bit x86_64 Mac
system.

Have ProcessGDBRemote set the Target's architecture based on the
GetProcessArchitecture when we've completed an attach/launch/connect.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
49d888d8c3e4de1d2f38d541559f533f1c0bcab3 06-Dec-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12820334>

I modified the "Args::StringtoAddress(...)" function to be able to evaluate address expressions. This is now used for any command line arguments or options that takes addresses like:

memory read <addr> [<end-addr>]
memory write <addr>
breakpoint set --address <addr>
disassemble --start-address <addr> --end-address <addr>

It calls the expression parser to evaluate the address expression and will also work around the issue where the compiler doesn't like to add offsets to function pointers (which is what happens when you try to evaluate "main + 12"). So there is a temp fix in the Args::StringtoAddress() to work around this until we can get special compiler support for debug expressions with function pointers.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169556 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
d891f9b872103235cfd2ed452c6f14a4394d9b3a 05-Dec-2012 Daniel Malea <daniel.malea@intel.com> Fix Linux build warnings due to redefinition of macros:
- add new header lldb-python.h to be included before other system headers
- short term fix (eventually python dependencies must be cleaned up)

Patch by Matt Kopec!




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169341 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
0bce9a22354df3f00e68ffd912119a0741753b7f 05-Dec-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12649160>

Added the ability to debug through your process exec'ing itself to the same architecture.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c557e7d3d5e9d2f0859084d9959a4793b556e138 01-Dec-2012 Jason Molenda <jmolenda@apple.com> Read full 64 bits of kernel address when locating a
64-bit kernel in ProcessGDBRemote.
<rdar://problem/12657369>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
ae9cc5505b7a331f9f4fc6aa65d8b1ff633adc77 26-Nov-2012 Han Ming Ong <hanming@apple.com> <rdar://problem/12723044> For 'process plugin packet send…', we just send it async by default

There is no good reason not to use async.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
9704ca2c15a793ffa22a35693ef93d56956c12cd 10-Nov-2012 Jason Molenda <jmolenda@apple.com> Add support for libdispatch version 4 structure layout for finding
GCD queue names of threads to
ProcessGDBRemote::GetDispatchQueueNameForThread()
May need tweaking once this version is rolled out but visual
inspection looks fine.
<rdar://problem/12333100>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
80ce49ce424a3f6824e75561459a472f82a03a88 09-Nov-2012 Greg Clayton <gclayton@apple.com> Remove a debugging printf that was left in the code.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167637 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
892757af588b2b508d8041bcd2d0cb91efa27fec 09-Nov-2012 Filipe Cabecinhas <me@filcab.net> Removed use of non-standard escape character '\%'

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
a948830c995f06bca836a0b104df567bad7dc822 01-Nov-2012 Jim Ingham <jingham@apple.com> There seems to be some odd corner case where we shut down the ProcessGDBRemote, but we haven't managed to shut down the async thread. That causes the ProcessGDBRemote::AsyncThread to crash when it wakes up. So I changed StartAsyncThread and StopAsyncThread to be callable multiple times (only the first one does anything) so that we can just shut it down unequivocally in the ProcessGDBRemote destructor.

<rdar://problem/12602981>

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4fa015bc1c2d81f702f9be28420959cb52f214c3 27-Oct-2012 Jim Ingham <jingham@apple.com> If we got what looks like a single step exception but we weren't single stepping then just report
the raw exception.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
b8596392c4b33fdbc975869756fe86b0dcefb177 16-Oct-2012 Greg Clayton <gclayton@apple.com> Added "process plugin packet send" and "process plugin packet history" for GDB remote. "process plugin packet send" will send a packet and receive a response. "process plugin packet history" will dump the packet history buffer.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
13193d5ae15f194102c14a5ccdc46e8db5c3d95f 13-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12491387>

I added the ability for a process plug-in to implement custom commands. All the lldb_private::Process plug-in has to do is override:

virtual CommandObject *
GetPluginCommandObject();

This object returned should be a multi-word command that vends LLDB commands. There is a sample implementation in ProcessGDBRemote that is hollowed out. It is intended to be used for sending a custom packet, though the body of the command execute function has yet to be implemented!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
d6b8122cee3dd02255bf50a7d019f17dfeba463a 06-Oct-2012 Jason Molenda <jmolenda@apple.com> In DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule(),
if we have a kernel binary, set the target's architecture to match.

Include the target's architecture in the ModuleSpec when we're searching for the
kext binaries on the local system -- otherwise we won't get a specific slice of
a fat file picked out for us and we won't use the returned Module correctly.

Remove the redundant attempt to find a file on the local filesystem from this method.


In ProcessGDBRemote::CheckForKernel(), if we have a kernel binary in memory, mark
the canJIT as false. There is no jitting code in kernel debug sessions.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
2b2ac8cbd956d7cb4ab6c8d87a1104faef778a38 04-Oct-2012 Jim Ingham <jingham@apple.com> Don't turn on the debugserver log by default.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
b0e3c7c4d063da2cc6a2550ad4979d5c342c8306 29-Sep-2012 Jason Molenda <jmolenda@apple.com> Add the RelocateOrLoadKernel and LoadKernel methods to ProcessGDBRemote::DoRemoteConnect().
When attaching to a remote system that does not look like a typical vendor system, and no
executable binary was specified to lldb, check a couple of fixed locations where kernels
running in ASLR mode (slid in memory to a random address) store their load addr when booted
in debug mode, and relocate the symbols or load the kernel wholesale from the host computer
if we can find it.

<rdar://problem/7714201>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
ae7bebc07d8137a792c9735b836292665fb97427 19-Sep-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11752499>

Improve error messages when memory read/write fails.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
851e30ec6a1b1d2c154bb7d69ed0d05b5fd14705 18-Sep-2012 Greg Clayton <gclayton@apple.com> Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. Some platforms don't support this modification.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c2c651472cd82d8ee669e595fb8a4b1ce9292a3e 11-Sep-2012 Jim Ingham <jingham@apple.com> Typed too fast adding lockers. Actually put them in a locker.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
88b980bfd735c4691b7f0771a45a78cb75033564 24-Aug-2012 Greg Clayton <gclayton@apple.com> Added Args::StringForEncoding(), Args::StringToGenericRegister() and centralized the parsing of the string to encoding and string to generic register.

Added code the initialize the register context in the OperatingSystemPython plug-in with the new PythonData classes, and added a test OperatingSystemPython module in lldb/examples/python/operating_system.py that we can use for testing.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
258db3ab3d02fc013f8674f3c20007c1e86b503d 24-Aug-2012 Johnny Chen <johnny.chen@apple.com> Cope with the case where the user-supplied callbacks want the watchpoint itself to be disabled!
Previously we put a WatchpointSentry object within StopInfo.cpp to disable-and-then-enable the watchpoint itself
while we are performing the actions associated with the triggered watchpoint, which can cause the user-initiated
watchpoint disabling action to be negated.

Add a test case to verify that a watchpoint can be disabled during the callbacks.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
ee188ee51195fb9868b7b4a4ee6c8b8e31c83f5e 22-Aug-2012 Filipe Cabecinhas <me@filcab.net> Added a test for the Python part of SBInputReader callbacks.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
5d90ade8e8e0d776fe8e1b9e88fc1c86d02e8e4e 28-Jul-2012 Jim Ingham <jingham@apple.com> Added an lldb_private & equivalent SB API to send an AsyncInterrupt to the event loop.
Convert from calling Halt in the lldb Driver.cpp's input reader's sigint handler to sending this AsyncInterrupt so it can be handled in the
event loop.
If you are attaching and get an async interrupt, abort the attach attempt.
Also remember to destroy the process if get interrupted while attaching.
Getting this to work also required handing the eBroadcastBitInterrupt in a few more places in Process WaitForEvent & friends.

<rdar://problem/10792425>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3aeb2867a88a4605fc97583fa5c7d02825446498 25-Jul-2012 Jason Molenda <jmolenda@apple.com> Provide subdir of StopInfoMachException.h in #include.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3a458eb1e413d39546b664813bba9f9ac292357e 20-Jul-2012 Jim Ingham <jingham@apple.com> Add "vAttachOrWait" to debugserver, so you can implement "attach to the process if it exists OR wait for it" without race conditions. Use that in lldb.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
483d00acf13926888ae9456f2680f0ca6416e9fe 19-Jul-2012 Sean Callanan <scallanan@apple.com> Changed ProcessGDBRemote to avoid the reserved
port range. Also added a comment indicating that
more work is needed.

<rdar://problem/11580051>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4a379b1194f3e6b308cd6e80b45d6ca5dd0aafd7 17-Jul-2012 Greg Clayton <gclayton@apple.com> Ran the static analyzer on the codebase and found a few things.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7de2a3b03f37987c67f142ce328cc2484c831468 14-Jul-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11782789> Changes to the watchpoint implementation on ARM so that we single-step before stopping at the WP. This is necessary because on ARM the WP triggers before the opcode is actually executed, so we would be unable to continue since we would keep hitting the WP. We work around this by disabling the WP, single stepping and then putting the WP back in place.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160199 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c4bbbfc7eed93a8c1e9483ac6524103f9a8e3d81 11-Jul-2012 Jim Ingham <jingham@apple.com> If we hit a breakpoint but there's a thread specifier which doesn't match this thread, return no stop reason.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
06b84494c72ceb559ca07ff5e2ccd2fe645b6363 04-Jul-2012 Jim Ingham <jingham@apple.com> Work around some problems destroying a process with older debugservers.

rdar://problem/11359989


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
86827fbccc9a4d1f9993d74940f724d63d826e45 02-Jul-2012 Jim Ingham <jingham@apple.com> Add an "extra-startup-commands" process setting so we can send some command strings to the actual process plugin to interpret as it wishes.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
088684d31c66df959fa2f3840f00b73b79b07756 09-Jun-2012 Jim Ingham <jingham@apple.com> Change the Mutex::Locker class so that it takes the Mutex object and locks it, rather
than being given the pthread_mutex_t from the Mutex and locks that. That allows us to
track ownership of the Mutex better.

Used this to switch the LLDB_CONFIGURATION_DEBUG enabled assert when we can't get the
gdb-remote sequence mutex to assert when the thread that had the mutex releases it. This
is generally more useful information than saying just who failed to get it (since the
code that had it locked often had released it by the time the assert fired.)



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
be315a6933ab6eb4da20fd4cefb58b1ff1c04518 08-Jun-2012 Johnny Chen <johnny.chen@apple.com> rdar://problem/11487457

Previous fix to add convenience registers for x86_64 did not take the 'process attach' scenario into account.
This patch fixes that.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
8247e62689a3ddf9c53c214b7f73dfab2f69e086 06-Jun-2012 Jim Ingham <jingham@apple.com> Fix a place in GDBRemoteCommunicationClient::SendContinuePacketAndWaitForReply where we weren't taking
m_interrupt_sent into account. Also don't reset m_interrupt_sent in SendInterrupt but do so in SendPacketAndWaitForResponse
when we know we've handled the interrupt.
Fix a code path through ProcessGDBRemote::DoDestroy where we were tearing down the debug session but
not setting the exit status.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7cbdcfb0cefcfd877b507ff2d83e51a1bde3fcc7 23-May-2012 Johnny Chen <johnny.chen@apple.com> Add the capability to display the number of supported hardware watchpoints to the "watchpoint list" command.

Add default Process::GetWatchpointSupportInfo() impl which returns an error of "not supported".
Add "qWatchpointSupportInfo" packet to the gdb communication layer to support this, and modify TestWatchpointCommands.py to test it.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
021086a399a50c4f9bf2c9c7a84369257671390e 23-May-2012 Filipe Cabecinhas <me@filcab.net> extra ';' outside of a function [-pedantic,-Wextra-semi]

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
d2e3066f7e7212adac4ca81d67be0fa706361d16 22-May-2012 Johnny Chen <johnny.chen@apple.com> rdar://problem/11487457

Add convenience registers eax, ebx, ecx, edx, edi, esi, ebp, esp to the 'register read' command for x86_64.
Add a GDBRemoteRegisterContext::Addx86_64ConvenienceRegisters() method called from ProcessGDBRemote::BuildDynamicRegisterInfo().
Servicing of eax, for example, is accomplished by delegating to rax with an adjusted offset into the register context.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157230 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
67b402cfa7dba35f0d1e8df58863b7fee8322d09 16-May-2012 Greg Clayton <gclayton@apple.com> Make sure that our thread list can't get out of date like was happening before Jims fix in revision 156894.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156898 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
bd5c23ddf5bacc78548bbe348c8c5d98c372aedc 15-May-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11240464>

Correctly unique a class' methods when we detect that a class has been uniqued to another.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156795 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
b7cdd6ce21c735292d468510c95f7d2316f54b9c 14-May-2012 Johnny Chen <johnny.chen@apple.com> Fix missing NEON registers for the 'register read' command with the lldb debugserver which supports the 'qRegisterInfo' packet
that dynamically discovers remote register context information.

o GDBRemoteRegisterContext.h:

Change the prototype of HardcodeARMRegisters() to take a boolean flag, which now becomes

void
HardcodeARMRegisters(bool from_scratch);

o GDBRemoteRegisterContext.cpp:

HardcodeARMRegisters() now checks the from_scratch flag and decides whether to add composite registers to the already
existing primordial registers based on a table called g_composites which describes the composite registers.

o ProcessGDBRemote.cpp:

Modify the logic of ProcessGDBRemote::BuildDynamicRegisterInfo() to call m_register_info.HardcodeARMRegisters()
with the newly introduced 'bool from_scrach' flag.

rdar://problem/10652076


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
cb740b3455f39ec690f89b144a2139a728e26c04 04-May-2012 Jason Molenda <jmolenda@apple.com> In ProcessGDBRemote::DoConnectRemote(), if the remote system informed
us of its architecture, use that to set the Target's arch if it
doesn't already have one set.

In Process::CompleteAttach(), if the Target has a valid arch make
sure that the Platform we pick up is compatible with that arch; if
not, find a Platform that is compatible. Don't let the the default
platform override the Target's arch.

<rdar://problem/11185420>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156116 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3355946190428830d0fe7b51a4433b0aefc64362 13-Apr-2012 Greg Clayton <gclayton@apple.com> Added the thread ID (tid) to each packet history item and the packet history now always dumps to a lldb_private::Stream.

Enable logging the packet history when registers fail to read due to not getting the sequence mutex if "--verbose" is enabled on the log channel for the "gdb-remote" log category.

This will help us track down some issues.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
ff3448e744b0ea8545282a81b245bfddcfd1589d 13-Apr-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11241798>

The less locks there are, the better. I removed the thread ID mutex and now just shared the m_thread_list's mutex to make sure we don't deadlock due to lock inversion.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7fa7b2f813120a78818246e2d185643a32fa9391 12-Apr-2012 Jim Ingham <jingham@apple.com> Make sure that DoResume doesn't stall if we shut down the async thread while DoResume is waiting
for packet confirmation.
Also added a bit more logging.
Also, unlock the writer end of the run lock in Process.cpp on our way out of the private state
thread so that the Process can shut down cleanly.

<rdar://problem/11228538>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
516f0849819d094d4eab39a1f27b770259103ff8 11-Apr-2012 Greg Clayton <gclayton@apple.com> No functionality changes, mostly cleanup.

Cleaned up the Mutex::Locker and the ReadWriteLock classes a bit.

Also cleaned up the GDBRemoteCommunication class to not have so many packet functions. Used the "NoLock" versions of send/receive packet functions when possible for a bit of performance.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
a1f645e66c8e52ef287b9ab42f521eb57bcf217d 10-Apr-2012 Greg Clayton <gclayton@apple.com> Added a new packet to our GDB remote protocol:

QListThreadsInStopReply

This GDB remote query command can enable added a "threads" key/value pair to all stop reply packets so that we always get a list of all threads in each stop reply packet. It increases performance if enabled (the reply to the "QListThreadsInStopReply" is "OK") by saving us from sending to command/reply pairs (the "qfThreadInfo" and "qsThreadInfo" packets), and also helps us keep the current process state up to date.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
5a9f85ca5734fec866257ff062a2e3349f330ecf 10-Apr-2012 Greg Clayton <gclayton@apple.com> A general stability fix where we _always_ get the thread list immediately after we get the stop packets. We had some racy conditions where thread 1 might be sending a packet and thread 2 tries to send a packet to get the thread list and it fails and ends up with an empty list. Packets use a sequence mutex to be able to ensure when you send a packet, you get the resonse. This sequence mutex is take when the process is running, and as we exit the running state and notify our process with the stop packet, we now always get the thread ID list before we do anything and before we can run into race conditions.

The next step is to have our stop reply packets send the thread list in the actual stop reply packet to avoid a 2 packet overhead of sending the qfThreadInfo + response and qfThreadInfo + response.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
451fa8288fdf6766407906a3f83f5e11b35faebe 10-Apr-2012 Greg Clayton <gclayton@apple.com> Added a packet history object to the GDBRemoteCommunication class that is always remembering the last 512 packets that were sent/received. These packets get dumped if logging gets enabled, or when the new expr lldb::DumpProcessGDBRemotePacketHistory (void *process, const char *log_file_path) global function is called.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
05e4d977e8ec151b165fc8ab3bdcd09bc0599a2c 29-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11052174>
<rdar://problem/11051056>

Found a race condition when sending async packets in the ProcessGDBRemote.

A little background: GDB remote clients can only send one packet at a time. You must send a packet and wait for a response. So when we continue, we obviously can't hold up the calling thread waiting for the process to stop again, so we have an async thread in the ProcessGDBRemote whose only job is to run packets that control the inferior process. When you send a continue packet, the only packet you can send is an interrupt packet (which consists of sending a CTRL+C (or a '\x03' byte)). This then stops the inferior and we can send the async packet, and then resume the target. There was a race condition that often happened during stepping where we are doing a source level single step which consists of many instruction steps and a few runs here and there when we step into a function. So the flow looks like:

inst single step
inst single step
inst single step
inst single step
inst single step
step BP and run
inst single step
inst single step
inst single step

Now if we got an async packet while the program is running we get something like:

send --> continue
send --> interrupt
recv <-- interrupt stop reply packet
send --> async packet
recv <-- async response
send --> continue again and wait for actual stop

Problems arise when this was happening when single stepping a thread where we would get:

send --> step thread 123
send --> interrupt
send --> stop reply for thread 123 (from the step)

Now we _might_ have an extra stop reply packet from the "interrupt" which we weren't checking for and we could end up with:

send --> async packet (like memory read!)
recv <-- async response (which is the interrupt stop reply packet)

Now we have the read memroy reply sitting in our buffer and waiting to be used as the reply for the next packet...

To further complicate things, the single step should have exited the async thread since the run control is finished, but now it will continue if it was interrupted.

The fixes I checked in to two major things:
- watch for the extra stop reply if we need to
- make sure we exit from the async thread run loop when the previous run control (like the instruction level single step) is finished.

Needless to say this makes very fast stepping in Xcode much more reliable.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
0c31d3d3a4a1d00d53346d8a23b0519f47e55d1f 07-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10997402>

This fix really needed to happen as a previous fix I had submitted for
calculating symbol sizes made many symbols appear to have zero size since
the function that was calculating the symbol size was calling another function
that would cause the calculation to happen again. This resulted in some symbols
having zero size when they shouldn't. This could then cause infinite stack
traces and many other side affects.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
cd3304228fdee558bd19bbd0a032368282bd1ffc 29-Feb-2012 Greg Clayton <gclayton@apple.com> Filled in two missing values when dynamically making register info structs.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
444fe998bf707bd076a70c3a779db8575533695e 26-Feb-2012 Greg Clayton <gclayton@apple.com> Made a ModuleSpec class in Module.h which can specify a module using one or
more of the local path, platform path, associated symbol file, UUID, arch,
object name and object offset. This allows many of the calls that were
GetSharedModule to reduce the number of arguments that were used in a call
to these functions. It also allows a module to be created with a ModuleSpec
which allows many things to be specified prior to any accessors being called
on the Module class itself.

I was running into problems when adding support for "target symbol add"
where you can specify a stand alone debug info file after debugging has started
where I needed to specify the associated symbol file path and if I waited until
after construction, the wrong symbol file had already been located. By using
the ModuleSpec it allows us to construct a module with as little or as much
information as needed and not have to change the parameter list.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
0670900f9501137216a5aa6edce9c4bf94bb74b3 06-Dec-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10487848>

Protect a member variable from being modified by multiple threads.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
d9919d3f46c5069eef065a27f96abc021330d5f3 02-Dec-2011 Greg Clayton <gclayton@apple.com> Process IDs (lldb::pid_t) and thread IDs (lldb::tid_t) are now 64 bit. This
will allow us to represent a process/thread ID using a pointer for the OS
plug-ins where they might want to represent the process or thread ID using
the address of the process or thread structure.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145644 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
489575c164b3b3cfed2f80af6cc58848ad17ab5a 19-Nov-2011 Greg Clayton <gclayton@apple.com> Further performance improvements in the DWARF parser:
1 - the DIE collections no longer have the NULL tags which saves up to 25%
of the memory on typical C++ code
2 - faster parsing by not having to run the SetDIERelations() function anymore
it is done when parsing the DWARF very efficiently.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
a9385537809ef342c843c5ab972e513742652047 18-Nov-2011 Greg Clayton <gclayton@apple.com> Added optional calls to lldb_private::Process for getting memory region info
from a process and hooked it up to the new packet that was recently added
to our GDB remote executable named debugserver. Now Process has the following
new calls:

virtual Error
Process::GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info);

virtual uint32_t
GetLoadAddressPermissions (lldb::addr_t load_addr);

Only the first one needs to be implemented by subclasses that can add this
support.

Cleaned up the way the new packet was implemented in debugserver to be more
useful as an API inside debugserver. Also found an error where finding a region
for an address actually will pick up the next region that follows the address
in the query so we also need ot make sure that the address we requested the
region for falls into the region that gets returned.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
464c6161464694412b7472129e789248f1cf21b9 17-Nov-2011 Greg Clayton <gclayton@apple.com> Use a pseudoterminal for local processes if no STDIO redirection or other
file actions have been specified.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
1c4642c6ab741d85c98d4288cf922c9a2ef77007 16-Nov-2011 Greg Clayton <gclayton@apple.com> Made the darwin host layer properly reap any child processes that it spawns.
After recent changes we weren't reaping child processes resulting in many
zombie processes.

This was fixed by adding more settings to the ProcessLaunchOptions class
that allow clients to specify a callback function and baton to be notified
when their process dies. If one is not supplied a default callback will be
used that "does the right thing".

Cleaned up a race condition in the ProcessGDBRemote class that would attempt
to monitor when debugserver died.

Added an extra boolean to the process monitor callbacks that indicate if a
process exited or not. If your process exited with a zero exit status and no
signal, both items could be zero.

Modified the process monitor functions to not require a callback function
in order to reap the child process.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
bd06ff435614ff4e884c40f3ea13e24f0cef96f7 13-Nov-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10103980>

A long time ago we started to centralized the STDOUT in lldb_private::Process
but we missed a few things still in ProcessGDBRemote.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
8226e94f253d36c445cffcc466cfda656b3c0e5f 28-Oct-2011 Jim Ingham <jingham@apple.com> Fix up how we shut down the communication with debugserver so we don't rely on
debugserver being responsive to shut down.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
9c236733d43e6250c8a5671a438f4a2afeb9c0b2 26-Oct-2011 Greg Clayton <gclayton@apple.com> Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible

Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
6bb7337208d20fe9342ffd13a168a18218732f26 15-Oct-2011 Jim Ingham <jingham@apple.com> Quiet the default "log enable lldb step" output down a little bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
428b5500506428f012e3bc65b8c9aa822dc2739c 06-Oct-2011 Jason Molenda <jmolenda@apple.com> ProcessGDBRemote::BuildDynamicRegisterInfo() - even if we don't have a Target architecture
set up yet, if we're talking to an Apple arm device set the register set based on the
arm device's attributes; this is a safe assumption to make in this particular environment.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
2f57db09a49f2a05a620b8163bbe1e748a46ec73 01-Oct-2011 Greg Clayton <gclayton@apple.com> Cleaned up the the code that figures out the inlined stack frames given a
symbol context that represents an inlined function. This function has been
renamed internally to:

bool
SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc,
SymbolContext &next_frame_sc,
Address &next_frame_pc) const;

And externally to:

SBSymbolContext
SBSymbolContext::GetParentOfInlinedScope (const SBAddress &curr_frame_pc,
SBAddress &parent_frame_addr) const;

The correct blocks are now correctly calculated.

Switched the stack backtracing engine (in StackFrameList) and the address
context printing over to using the internal SymbolContext::GetParentOfInlinedScope(...)
so all inlined callstacks will match exactly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
d6d47976b71187907c1cdeea86fabf7d5534314f 23-Sep-2011 Jim Ingham <jingham@apple.com> Added the ability to restrict breakpoints by function name, function regexp, selector
etc to specific source files.
Added SB API's to specify these source files & also more than one module.
Added an "exact" option to CompileUnit's FindLineEntry API.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7e5fa7fc1f8efd24c078e063b2c4b5e13ba5be20 20-Sep-2011 Jason Molenda <jmolenda@apple.com> Update declarations for all functions/methods that accept printf-style
stdarg formats to use __attribute__ format so the compiler can flag
incorrect uses. Fix all incorrect uses. Most of these are innocuous,
a few were resulting in crashes.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
36889adf3700165ae13e8defb7433f2ba80df697 17-Sep-2011 Johnny Chen <johnny.chen@apple.com> Foe x86_64/i386, piggyback the hardware index of the fired watchpoint in the exception
data sent back to the debugger. On the debugger side, use the opportunity during the
StopInfoMachException::CreateStopReasonWithMachException() method to set the hardware index
for the very watchpoint location.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
48a5e85aab65224260c6e8b6dafd508312119311 09-Sep-2011 Johnny Chen <johnny.chen@apple.com> Fix compiler warnings for GetGDBStoppointType().


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
21900fb7a68d94b7e205599231f4bbf6f5fc65af 07-Sep-2011 Johnny Chen <johnny.chen@apple.com> Fill out implementation of Enable/DisableWatchpoint() for ProcessGDBRemote class (Not Tested Yet).
Also update the signature of WatchpointLocation::SetEnable() to take a bool as input arg.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139198 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
7c4fc6eb2da25c0426519a2664e1d277766bf01b 11-Aug-2011 Greg Clayton <gclayton@apple.com> Include the qLaunchSuccess and qC packets in the
10 second timeout zone. When launching we increase the
timeout to 10 seconds to ensure we have time to launch a
process, and then set it back.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
153ccd72f52a6cc3595d7614558e2954f67833eb 10-Aug-2011 Greg Clayton <gclayton@apple.com> While tracking down memory consumption issue a few things were needed: the
ability to dump more information about modules in "target modules list". We
can now dump the shared pointer reference count for modules, the pointer to
the module itself (in case performance tools can help track down who has
references to said pointer), and the modification time.

Added "target delete [target-idx ...]" to be able to delete targets when they
are no longer needed. This will help track down memory usage issues and help
to resolve when module ref counts keep getting incremented. If the command gets
no arguments, the currently selected target will be deleted. If any arguments
are given, they must all be valid target indexes (use the "target list"
command to get the current target indexes).

Took care of a bunch of "no newline at end of file" warnings.

TimeValue objects can now dump their time to a lldb_private::Stream object.

Modified the "target modules list --global" command to not error out if there
are no targets since it doesn't require a target.

Fixed an issue in the MacOSX DYLD dynamic loader plug-in where if a shared
library was updated on disk, we would keep using the older one, even if it was
updated.

Don't allow the ModuleList::GetSharedModule(...) to return an empty module.
Previously we could specify a valid path on disc to a module, and specify an
architecture that wasn't contained in that module and get a shared pointer to
a module that wouldn't be able to return an object file or a symbol file. We
now make sure an object file can be extracted prior to adding the shared pointer
to the module to get added to the shared list.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c143d62b93b3a35566b894fdd4a098d539a3518b 09-Aug-2011 Johnny Chen <johnny.chen@apple.com> Fix a crash while running the test suite. Need to check the (LogSP)log shared pointer before using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
716cefbded5b438eeb8d310d3965dd1be86bcc46 09-Aug-2011 Greg Clayton <gclayton@apple.com> Added some logging and did some member renaming.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137112 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.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/gdb-remote/ProcessGDBRemote.cpp
b4747822aae5f877e318164b2e02fc73b204e204 25-Jun-2011 Greg Clayton <gclayton@apple.com> Removed an member variable "m_local_debugserver" that is no longer needed.
We now check with the platform to see if we are doing local or remote
debugging and setup the stdio accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
de1dd81e18b0310501f3b76ae41f04a09f4dd474 24-Jun-2011 Greg Clayton <gclayton@apple.com> Fixed SBTarget attach calls to properly deal with being connected to a remotely
connected process connection.

Also added support for more kinds of continue packet when multiple threads
need to continue where some want to continue with signals.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
6561155acc9dee660de73e4aa8215839a06f01a7 04-Jun-2011 Greg Clayton <gclayton@apple.com> Created a std::string in the base StopInfo class for the description and
cleaned up all base classes that had their own copy. Added a SetDescription
accessor to the StopInfo class.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4d623e869516c30d46d6d20d339a0e03116e7ac1 03-Jun-2011 Peter Collingbourne <peter@pcc.me.uk> Move inferior mmap/munmap call code into their own functions in utility lib

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
261a18b0176b0810438b504298df1293ac2f4211 03-Jun-2011 Greg Clayton <gclayton@apple.com> Make sure we don't lose our stop reply packet in the case where the other
GDB server doesn't support the LLDB specific qThreadStopInfo packet.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
5a26910ed231503d2a7a71365a44e379a994f4e6 22-May-2011 Greg Clayton <gclayton@apple.com> Added functions to lldb_private::Address to set an address from a load address
and set the address as an opcode address or as a callable address. This is
needed in various places in the thread plans to make sure that addresses that
might be found in symbols or runtime might already have extra bits set (ARM/Thumb).
The new functions are:

bool
Address::SetCallableLoadAddress (lldb::addr_t load_addr, Target *target);

bool
Address::SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target);

SetCallableLoadAddress will initialize a section offset address if it can,
and if so it might possibly set some bits in the address to make the address
callable (bit zero might get set for ARM for Thumb functions).

SetOpcodeLoadAddress will initialize a section offset address using the
specified target and it will strip any special address bits if needed
depending on the target.

Fixed the ABIMacOSX_arm::GetArgumentValues() function to require arguments
1-4 to be in the needed registers (previously this would incorrectly fallback
to the stack) and return false if unable to get the register values. The
function was also modified to first look for the generic argument registers
and then fall back to finding the registers by name.

Fixed the objective trampoline handler to use the new Address::SetOpcodeLoadAddress
function when needed to avoid address mismatches when trying to complete
steps into objective C methods. Make similar fixes inside the
AppleThreadPlanStepThroughObjCTrampoline::ShouldStop() function.

Modified ProcessGDBRemote::BuildDynamicRegisterInfo(...) to be able to deal with
the new generic argument registers.

Modified RNBRemote::HandlePacket_qRegisterInfo() to handle the new generic
argument registers on the debugserver side.

Modified DNBArchMachARM::NumSupportedHardwareBreakpoints() to be able to
detect how many hardware breakpoint registers there are using a darwin sysctl.
Did the same for hardware watchpoints in
DNBArchMachARM::NumSupportedHardwareWatchpoints().




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4a60f9e0a988fe64acaccccc2a15577a8247a4d3 21-May-2011 Greg Clayton <gclayton@apple.com> Centralize the code that gathers the thread ID list from the remote GDB
server so that it happens in command sequence where no other packets can
sneak between.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131769 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3058197753e56a7ea9f4c5784e460a3b977d7bd0 17-May-2011 Greg Clayton <gclayton@apple.com> Fixed the "mmap" to work on MacOSX/darwin by supplying the correct arguemnts.

Modified ClangUserExpression and ClangUtilityFunction to display the actual
error (if one is available) that made the JIT fail instead of a canned
response.

Fixed the restoring of all register values when the 'G' packet doesn't work
to use the correct data.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
613b8739a4d489b7f1c571288d5786768c024205 17-May-2011 Greg Clayton <gclayton@apple.com> Added an allocated memory cache to avoid having to allocate memory over and
over when running JITed expressions. The allocated memory cache will cache
allocate memory a page at a time for each permission combination and divvy up
the memory and hand it out in 16 byte increments.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c8bc1c318cfed0e3fe22731d808ddac1b32bb26e 16-May-2011 Greg Clayton <gclayton@apple.com> Fixed an issue where large memory writes might not get chunked up into smaller
packets in GDB remote.

Also fixed a compiler warning for an unhandled case for a switch.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
9d2b321309dad0a93e3ce8cda8eb1bcc3902cfef 16-May-2011 Greg Clayton <gclayton@apple.com> Dump JIT memory requirements when "log enable lldb expr" logging is enabled.

Correctly handle invalid 32-bit mmap fail return value in ProcessGDBRemote.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
2f085c6ca2895663687dca704589478ff040b849 15-May-2011 Greg Clayton <gclayton@apple.com> Added the ability to get the return value from a ThreadPlanCallFunction
thread plan. In order to get the return value, you can call:

void
ThreadPlanCallFunction::RequestReturnValue (lldb::ValueSP &return_value_sp);

This registers a shared pointer to a return value that will get filled in if
everything goes well. After the thread plan is run the return value will be
extracted for you.

Added an ifdef to be able to switch between the LLVM MCJIT and the standand JIT.
We currently have the standard JIT selected because we have some work to do to
get the MCJIT fuctioning properly.

Added the ability to call functions with 6 argument in the x86_64 ABI.

Added the ability for GDBRemoteCommunicationClient to detect if the allocate
and deallocate memory packets are supported and to not call allocate memory
("_M") or deallocate ("_m") if we find they aren't supported.

Modified the ProcessGDBRemote::DoAllocateMemory(...) and ProcessGDBRemote::DoDeallocateMemory(...)
to be able to deal with the allocate and deallocate memory packets not being
supported. If they are not supported, ProcessGDBRemote will switch to calling
"mmap" and "munmap" to allocate and deallocate memory instead using our
trivial function call support.

Modified the "void ProcessGDBRemote::DidLaunchOrAttach()" to correctly ignore
the qHostInfo triple information if any was specified in the target. Currently
if the target only specifies an architecture when creating the target:

(lldb) target create --arch i386 a.out

Then the vendor, os and environemnt will be adopted by the target.

If the target was created with any triple that specifies more than the arch:

(lldb) target create --arch i386-unknown-unknown a.out

Then the target will maintain its triple and not adopt any new values. This
can be used to help force bare board debugging where the dynamic loader for
static files will get used and users can then use "target modules load ..."
to set addressses for any files that are desired.

Added back some convenience functions to the lldb_private::RegisterContext class
for writing registers with unsigned values. Also made all RegisterContext
constructors explicit to make sure we know when an integer is being converted
to a RegisterValue.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131370 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
989816b9505219cd67ce044d655c54ac86ecf64b 14-May-2011 Greg Clayton <gclayton@apple.com> Expand the ABI prepare trivial function call to allow 6 simple args.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
a4582404fa50f89485e69a17281673147217d64f 08-May-2011 Greg Clayton <gclayton@apple.com> Fixed not being able to launch the i386 slice of a universal binary by adding
a new "QLaunchArch:<arch-name>" where <arch-name> is the architecture name.
This allows us to remotely launch a debugserver and then set the architecture
for the binary we will launch.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
180546b3feb8c7bcca70a56776a7c4fad99ba09c 30-Apr-2011 Greg Clayton <gclayton@apple.com> Added the ability to set the Platform path for a module through the SBModule
interface.

Added a quick way to set the platform though the SBDebugger interface. I will
actually an a SBPlatform support soon, but for now this will do.

ConnectionFileDescriptor can be passed a url formatted as: "fd://<fd>" where
<fd> is a file descriptor in the current process. This is handy if you have
services, deamons, or other tools that can spawn processes and give you a
file handle.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
b72d0f098e45936fa72e26b1a026c603e17e2d6c 12-Apr-2011 Greg Clayton <gclayton@apple.com> Moved the execution context that was in the Debugger into
the CommandInterpreter where it was always being used.

Make sure that Modules can track their object file offsets correctly to
allow opening of sub object files (like the "__commpage" on darwin).

Modified the Platforms to be able to launch processes. The first part of this
move is the platform soon will become the entity that launches your program
and when it does, it uses a new ProcessLaunchInfo class which encapsulates
all process launching settings. This simplifies the internal APIs needed for
launching. I want to slowly phase out process launching from the process
classes, so for now we can still launch just as we used to, but eventually
the platform is the object that should do the launching.

Modified the Host::LaunchProcess in the MacOSX Host.mm to correctly be able
to launch processes with all of the new eLaunchFlag settings. Modified any
code that was manually launching processes to use the Host::LaunchProcess
functions.

Fixed an issue where lldb_private::Args had implicitly defined copy
constructors that could do the wrong thing. This has now been fixed by adding
an appropriate copy constructor and assignment operator.

Make sure we don't add empty ModuleSP entries to a module list.

Fixed the commpage module creation on MacOSX, but we still need to train
the MacOSX dynamic loader to not get rid of it when it doesn't have an entry
in the all image infos.

Abstracted many more calls from in ProcessGDBRemote down into the
GDBRemoteCommunicationClient subclass to make the classes cleaner and more
efficient.

Fixed the default iOS ARM register context to be correct and also added support
for targets that don't support the qThreadStopInfo packet by selecting the
current thread (only if needed) and then sending a stop reply packet.

Debugserver can now start up with a --unix-socket (-u for short) and can
then bind to port zero and send the port it bound to to a listening process
on the other end. This allows the GDB remote platform to spawn new GDB server
instances (debugserver) to allow platform debugging.







git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
ff39f746ebaa3710c44ba49bd9b0a6cf05f60a3f 01-Apr-2011 Greg Clayton <gclayton@apple.com> Added the ability to get a broadcaster event name for a given broadcaster
event.

Modified the ProcessInfo structure to contain all process arguments. Using the
new function calls on MacOSX allows us to see the full process name, not just
the first 16 characters.

Added a new platform command: "platform process info <pid> [<pid> <pid> ...]"
that can be used to get detailed information for a process including all
arguments, user and group info and more.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
24bc5d9bfad2a1c562c27e7cf37e1c56d85c45e7 30-Mar-2011 Greg Clayton <gclayton@apple.com> Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:

int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff

// Platform subclass specific code...
int result = ...
return result;
}

Added new functions to the platform:

virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);

The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.

Added the parent process ID to the ProcessInfo class.

Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.

This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:

machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver


This of course also works remotely with the lldb-platform:

machine1.foo.com % lldb-platform --listen 1234

machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari

The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.

Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:

% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out

Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.

Modified the disassembly to show the current PC value. Example output:

(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret

This can be handy when dealing with the new --line options that was recently
added:

(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf

Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.

Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:

const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
60f19d51b4e161ac4f4ca2f3edc14867441a0bde 30-Mar-2011 Stephen Wilson <wilsons@start.ca> Unfortunately, sranddev() is not available on all platforms so seed using the
current time instead.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
f960048c4a68326918b4c98cdaf7d4e82c863c33 29-Mar-2011 Jim Ingham <jingham@apple.com> Can't just call "rand" to get a random port, 'cause then you'll get the same sequence in two lldb's. This makes running lldb on lldb not work very well.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
50daf77fa8c95ff3a3928527954be472239e0b17 25-Mar-2011 Stephen Wilson <wilsons@start.ca> Simple fixes for the gdb remote process plugin on Linux.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128291 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
cb8977d726be451df9978a74088435667fa37da2 23-Mar-2011 Greg Clayton <gclayton@apple.com> Added new platform commands:

platform connect <args>
platform disconnect

Each platform can decide the args they want to use for "platform connect". I
will need to add a function that gets the connect options for the current
platform as each one can have different options and argument counts.

Hooked up more functionality in the PlatformMacOSX and PlatformRemoteiOS.
Also started an platform agnostic PlatformRemoteGDBServer.cpp which can end
up being used by one or more actual platforms. It can also be specialized and
allow for platform specific commands.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
61d043bbb1a1a20abf01dc73fa50c1ca0a46d71d 22-Mar-2011 Greg Clayton <gclayton@apple.com> Split the GDBRemoteCommunication class into three classes:
GDBRemoteCommunication - The base GDB remote communication class
GDBRemoteCommunicationClient - designed to be used for clients the connect to
a remote GDB server
GDBRemoteCommunicationServer - designed to be used on the server side of a
GDB server implementation.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
b1888f24fa181489840b9acf193e224d125d0776 19-Mar-2011 Greg Clayton <gclayton@apple.com> Added more platform support. There are now some new commands:

platform status -- gets status information for the selected platform
platform create <platform-name> -- creates a new instance of a remote platform
platform list -- list all available platforms
platform select -- select a platform instance as the current platform (not working yet)

When using "platform create" it will create a remote platform and make it the
selected platform. For instances for iPhone OS debugging on Mac OS X one can
do:

(lldb) platform create remote-ios --sdk-version=4.0
Remote platform: iOS platform
SDK version: 4.0
SDK path: "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0"
Not connected to a remote device.
(lldb) file ~/Documents/a.out
Current executable set to '~/Documents/a.out' (armv6).
(lldb) image list
[ 0] /Volumes/work/gclayton/Documents/devb/attach/a.out
[ 1] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/dyld
[ 2] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libSystem.B.dylib


Note that this is all happening prior to running _or_ connecting to a remote
platform. Once connected to a remote platform the OS version might change which
means we will need to update our dependecies. Also once we run, we will need
to match up the actualy binaries with the actualy UUID's to files in the
SDK, or download and cache them locally.

This is just the start of the remote platforms, but this modification is the
first iteration in getting the platforms really doing something.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127934 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c97bfdb5e9770f59872352197d277f9d7b1a9a49 10-Mar-2011 Greg Clayton <gclayton@apple.com> Centralize the GDB remote timeout value into the GDBRemoteCommunication as a
member variable (m_packet_timeout which is a value in seconds). This value is
then used for all packets sent to/from the remote GDB server.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127392 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
e4b9c1fb338ee1ada72e6a3c198afb342d68c5c1 08-Mar-2011 Greg Clayton <gclayton@apple.com> LLDB now has "Platform" plug-ins. Platform plug-ins are plug-ins that provide
an interface to a local or remote debugging platform. By default each host OS
that supports LLDB should be registering a "default" platform that will be
used unless a new platform is selected. Platforms are responsible for things
such as:
- getting process information by name or by processs ID
- finding platform files. This is useful for remote debugging where there is
an SDK with files that might already or need to be cached for debug access.
- getting a list of platform supported architectures in the exact order they
should be selected. This helps the native x86 platform on MacOSX select the
correct x86_64/i386 slice from universal binaries.
- Connect to remote platforms for remote debugging
- Resolving an executable including finding an executable inside platform
specific bundles (macosx uses .app bundles that contain files) and also
selecting the appropriate slice of universal files for a given platform.

So by default there is always a local platform, but remote platforms can be
connected to. I will soon be adding a new "platform" command that will support
the following commands:
(lldb) platform connect --name machine1 macosx connect://host:port
Connected to "machine1" platform.
(lldb) platform disconnect macosx

This allows LLDB to be well setup to do remote debugging and also once
connected process listing and finding for things like:
(lldb) process attach --name x<TAB>

The currently selected platform plug-in can now auto complete any available
processes that start with "x". The responsibilities for the platform plug-in
will soon grow and expand.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
afb8186acfef6132174ca02d357fafd36b599ca3 02-Mar-2011 Greg Clayton <gclayton@apple.com> Added a missing API call in SBTarget that enables one to get
anything in a SBSymbolContext filled in given an SBAddress:

SBSymbolContext
SBTarget::ResolveSymbolContextForAddress (const SBAddress& addr, uint32_t resolve_scope);

Also did a little cleanup on the ProcessGDBRemote stdio file handle
code.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
a2f7423310044cf76d8d52aa9153b7fd8b226b49 24-Feb-2011 Greg Clayton <gclayton@apple.com> Fixed CommandReturnObject::SetImmediateErrorFile() to set the correct stream.

Modifed lldb_private::Process to be able to handle connecting to a remote
target that isn't running a process. This leaves lldb_private::Process in the
eStateConnected state from which we can then do an attach or launch.

Modified ProcessGDBRemote to be able to set stdin, stdout, stderr, working
dir, disable ASLR and a few other settings down by using new GDB remote
packets. This allows us to keep all of our current launch flags and settings
intact and still be able to communicate them over to the remote GDB server.
Previously these were being sent as arguments to the debugserver binary that
we were spawning. Also modified ProcessGDBRemote to handle losing connection
to the remote GDB server and always exit immediately. We do this by watching
the lldb_private::Communication event bit for the read thread exiting in the
ProcessGDBRemote async thread.

Added support for many of the new 'Q' packets for setting stdin, stdout,
stderr, working dir and disable ASLR to the GDBRemoteCommunication class for
easy accesss.

Modified debugserver for all of the new 'Q' packets and also made it so that
debugserver always exists if it loses connection with the remote debugger.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126444 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
940b103224f3062578c7a7e6e76d8bf4a7956f2a 23-Feb-2011 Greg Clayton <gclayton@apple.com> Abtracted all mach-o and ELF out of ArchSpec. This patch is a modified form
of Stephen Wilson's idea (thanks for the input Stephen!). What I ended up
doing was:
- Got rid of ArchSpec::CPU (which was a generic CPU enumeration that mimics
the contents of llvm::Triple::ArchType). We now rely upon the llvm::Triple
to give us the machine type from llvm::Triple::ArchType.
- There is a new ArchSpec::Core definition which further qualifies the CPU
core we are dealing with into a single enumeration. If you need support for
a new Core and want to debug it in LLDB, it must be added to this list. In
the future we can allow for dynamic core registration, but for now it is
hard coded.
- The ArchSpec can now be initialized with a llvm::Triple or with a C string
that represents the triple (it can just be an arch still like "i386").
- The ArchSpec can still initialize itself with a architecture type -- mach-o
with cpu type and subtype, or ELF with e_machine + e_flags -- and this will
then get translated into the internal llvm::Triple::ArchSpec + ArchSpec::Core.
The mach-o cpu type and subtype can be accessed using the getter functions:

uint32_t
ArchSpec::GetMachOCPUType () const;

uint32_t
ArchSpec::GetMachOCPUSubType () const;

But these functions are just converting out internal llvm::Triple::ArchSpec
+ ArchSpec::Core back into mach-o. Same goes for ELF.

All code has been updated to deal with the changes.

This should abstract us until later when the llvm::TargetSpec stuff gets
finalized and we can then adopt it.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126278 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
75c703dd8b492bad25a987b96853626641ae7246 16-Feb-2011 Greg Clayton <gclayton@apple.com> The DynamicLoader plug-in instance now lives up in lldb_private::Process where
it should live and the lldb_private::Process takes care of managing the
auto pointer to the dynamic loader instance.

Also, now that the ArchSpec contains the target triple, we are able to
correctly set the Target architecture in DidLaunch/DidAttach in the subclasses,
and then the lldb_private::Process will find the dynamic loader plug-in
by letting the dynamic loader plug-ins inspect the arch/triple in the target.

So now the ProcessGDBRemote plug-in is another step closer to be purely
process/platform agnostic.

I updated the ProcessMacOSX and the ProcessLinux plug-ins accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125650 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
395fc33dc4b06c048ed35047ec461bc092ef2df3 15-Feb-2011 Greg Clayton <gclayton@apple.com> Made lldb_private::ArchSpec contain much more than just an architecture. It
now, in addition to cpu type/subtype and architecture flavor, contains:
- byte order (big endian, little endian)
- address size in bytes
- llvm::Triple for true target triple support and for more powerful plug-in
selection.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c3c4661c6a7527580e605dbb69bef7634971fe13 15-Feb-2011 Greg Clayton <gclayton@apple.com> All UnwindPlan objects are now passed around as shared pointers.

ArchDefaultUnwindPlan plug-in interfaces are now cached per architecture
instead of being leaked for every frame.

Split the ArchDefaultUnwindPlan_x86 into ArchDefaultUnwindPlan_x86_64 and
ArchDefaultUnwindPlan_i386 interfaces.

There were sporadic crashes that were due to something leaking or being
destroyed when doing stack crawls. This patch should clear up these issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c1f4587c3cc1b6de2f59d472762e9eb16819feff 12-Feb-2011 Greg Clayton <gclayton@apple.com> Added the ability to detect which vCont packets (using the "vCont?") packet
are supported by the remote GDB target. We can also now deal with the lack of
vCont support and send packets that the remote GDB stub can use. We also error
out of the continue if LLDB tries to do something too complex when vCont isn't
supported.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c62176d3c1783af36abf6b9d3e2f023cee0f7c74 09-Feb-2011 Greg Clayton <gclayton@apple.com> Fix comment text.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
fc7920f91aff5c73c3ab7938a2b03a32463e774e 09-Feb-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/8972204> Test failure: ./dotest.py -v -t -f UniversalTestCase.test_process_launch_for_universal

Fix for bad architecture settings that were being used from the qHostInfo.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
ff276feaca314de031563722a4cc02dd570cb5b3 08-Feb-2011 Jim Ingham <jingham@apple.com> Add _pthread_wqthread to the list of thread stop points, and change the logging a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
5f54ac373b119a4c6693e4875c48aa761fba0c86 08-Feb-2011 Greg Clayton <gclayton@apple.com> Moved FileSpec into the Host layer since it will vary from host to host.
We have a common unix implementation in lldb/source/Host/common/FileSpec.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
09c81efd010d1c9ac8821bad00cdfc9747fcae79 08-Feb-2011 Greg Clayton <gclayton@apple.com> Patch that allows for thread_t to be something more complex than an
integer. Modified patch from Kirk Beitz.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
0bfda0b1371b2381326b441adc93a6db3dc5f74f 05-Feb-2011 Greg Clayton <gclayton@apple.com> Added a quicker lookup in the SectionLoadList when looking things up by
section by using a DenseMap.

Fixed some logging calls to get the log shared pointer.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
e71e258286a1713dbb2d366d8b81ff2f28e0216f 04-Feb-2011 Greg Clayton <gclayton@apple.com> Added support for attaching to a remote debug server with the new command:
(lldb) process connect <remote-url>

Currently when you specify a file with the file command it helps us to find
a process plug-in that is suitable for debugging. If you specify a file you
can rely upon this to find the correct debugger plug-in:

% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) process connect connect://localhost:2345
...

If you don't specify a file, you will need to specify the plug-in name that
you wish to use:

% lldb
(lldb) process connect --plugin process.gdb-remote connect://localhost:2345

Other connection URL examples:

(lldb) process connect connect://localhost:2345
(lldb) process connect tcp://127.0.0.1
(lldb) process connect file:///dev/ttyS1

We are currently treating the "connect://host:port" as a way to do raw socket
connections. If there is a URL for this already, please let me know and we
will adopt it.

So now you can connect to a remote debug server with the ProcessGDBRemote
plug-in. After connection, it will ask for the pid info using the "qC" packet
and if it responds with a valid process ID, it will be equivalent to attaching.
If it response with an error or invalid process ID, the LLDB process will be
in a new state: eStateConnected. This allows us to then download a program or
specify the program to run (using the 'A' packet), or specify a process to
attach to (using the "vAttach" packets), or query info about the processes
that might be available.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124846 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
cd548034fa23113e995b8463d14f910ba2f7298c 01-Feb-2011 Greg Clayton <gclayton@apple.com> Endian patch from Kirk Beitz that allows better cross platform building.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124643 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7e2f91cb958c8670774cb2190db7b858618b5b9b 29-Jan-2011 Greg Clayton <gclayton@apple.com> Finished up the async attach support. This allows us to request to attach
by name or by pid (with or without waiting for a process to launch) and
catch the response asynchronously.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
9082c8a3b804e5b30a30efac7208f09416e531d3 28-Jan-2011 Jim Ingham <jingham@apple.com> Fix a little thinko in sending down the thread name to SetName.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
e4450f0f64e476be7a98360103c2e10538463719 28-Jan-2011 Caroline Tice <ctice@apple.com> If the user specfies one of stdin, stdout or stderr, don't
automatically set the non-specified ones to /dev/null.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
bdcb6abaa287df2c5f312c51d993c1d0b0cb120c 26-Jan-2011 Greg Clayton <gclayton@apple.com> Enabled extra warnings and fixed a bunch of small issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
cc3e640a1fdfb36a6a67eb04913ba18ac4ea8e3f 25-Jan-2011 Greg Clayton <gclayton@apple.com> Reverting recent thread resume changes as it was causing testing issues.
We will need to try again soon, but this change was causing instability.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c72af6b67914810cafc34a83c403235de58d2051 25-Jan-2011 Jim Ingham <jingham@apple.com> When we are stepping a thread, force it to resume ALL the way to 0. And of course, when we stop
if we undid some user provided suspends, we need to re-do the suspends.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124178 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
27a8dd7e0a34cb85cbad03bdc478a1292ef4573d 25-Jan-2011 Greg Clayton <gclayton@apple.com> One more fix to ProcessGDBRemote::DoDestroy(). This one will make sure we
parse the exit status in case we send this packet while stopped.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124177 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
68ca823ad1ab94805bcee03f3ad0b649d94e5a09 25-Jan-2011 Greg Clayton <gclayton@apple.com> Fixed ProcessGDBRemote to kill the process correctly when it is either running
or stopped.

Added support for sections to be able to state if they are encrypted or not.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124171 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
9ed3ebffac46064232226f0c2b4bb38a2621dc32 24-Jan-2011 Jim Ingham <jingham@apple.com> Remember to turn off the debugserver.txt hard-coded emission.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124114 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
ac95966f900e8af29c25b3bd85b3d41cd4568857 24-Jan-2011 Jim Ingham <jingham@apple.com> More useful STEP logging.

Be sure to clear out the base plan's m_report_run and m_report_stop each time we resume so we don't use stale values.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
2860ba9c531076adc93cb6fe7bbf2933b42ade69 23-Jan-2011 Greg Clayton <gclayton@apple.com> Improved process logging for both lldb_private::Process and ProcessGDBRemote.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
de915beb5febe597505ba33fdc2c39eea2abdbd4 23-Jan-2011 Greg Clayton <gclayton@apple.com> Added a new variant of SBTarget::Launch() that deprectates the old one that
takes separate file handles for stdin, stdout, and stder and also allows for
the working directory to be specified.

Added support to "process launch" to a new option: --working-dir=PATH. We
can now set the working directory. If this is not set, it defaults to that
of the process that has LLDB loaded. Added the working directory to the
host LaunchInNewTerminal function to allows the current working directory
to be set in processes that are spawned in their own terminal. Also hooked this
up to the lldb_private::Process and all mac plug-ins. The linux plug-in had its
API changed, but nothing is making use of it yet. Modfied "debugserver" and
"darwin-debug" to also handle the current working directory options and modified
the code in LLDB that spawns these tools to pass the info along.

Fixed ProcessGDBRemote to properly pass along all file handles for stdin, stdout
and stderr.

After clearing the default values for the stdin/out/err file handles for
process to be NULL, we had a crasher in UserSettingsController::UpdateStringVariable
which is now fixed. Also fixed the setting of boolean values to be able to
be set as "true", "yes", "on", "1" for true (case insensitive) and "false", "no",
"off", or "0" for false.

Fixed debugserver to properly handle files for STDIN, STDOUT and STDERR that are not
already opened. Previous to this fix debugserver would only correctly open and dupe
file handles for the slave side of a pseudo terminal. It now correctly handles
getting STDIN for the inferior from a file, and spitting STDOUT and STDERR out to
files. Also made sure the file handles were correctly opened with the NOCTTY flag
for terminals.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
72e1c782ba1e4226da37af4722af608de9f39408 23-Jan-2011 Greg Clayton <gclayton@apple.com> Fixed an issue in "SBError SBProcess::Destroy ()" where it wasn't properly
checking the validity of the shared pointer prior to using it.

Fixed the GDB remote plug-in to once again watch for a reply from the "k"
packet, and fixed the logic to make sure the thread requesting the kill
and the async thread play nice (and very quickly) by synchronizing the
packet sending and reply. I also tweaked some of the shut down packet
("k" kill, "D" detach, and the halt packet) to make sure they do the right
thing.

Fixed "StateType Process::WaitForProcessStopPrivate (...)" to correctly pass
the timeout along to WaitForStateChangedEventsPrivate() and made the function
behave correctly with respect to timing out.

Added separate STDIN, STDOUT, and STDERR support to debugserver. Also added
the start of being able to set the working directory for the inferior process.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
a4881d04b4f367c67e34e8040e1257fc222a8b41 22-Jan-2011 Greg Clayton <gclayton@apple.com> Sped up the shutdown time on MacOSX by quite a bit by making sure any
threads that we spawn let us know when they are going away and that we
don't timeout waiting for a message from threads that have gone away.
We also now don't expect the "k" packet (kill) to send a response. This
greatly speeds up debugger shutdown performance. The test suite now runs
quite a bit faster.

Added a fix to the variable display code that fixes the display of
base classes. We were assuming the virtual or normal base class offsets
were being given in bit sizes, but they were being given as character
sizes, so we needed to multiply the offset by 8. This wasn't affecting
the expression parser, but it was affecting the correct display of C++
class base classes and all of their children.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
55e01d8635032ee10cc06e0114213a76a8677be0 22-Jan-2011 Jim Ingham <jingham@apple.com> Added an interface for noticing new thread creation. At this point, I only turn it on when
we are requesting a single thread to run. May seem like a silly thing to do, but the kernel
on MacOS X will inject new threads into a program willy-nilly, and I would like to keep them
from running if I can.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c71899ef308e6134d1b0ca5f30cbc64414855e1a 18-Jan-2011 Greg Clayton <gclayton@apple.com> Thread safety changes in debugserver and also in the process GDB remote plugin.
I added support for asking if the GDB remote server supports thread suffixes
for packets that should be thread specific (register read/write packets) because
the way the GDB remote protocol does it right now is to have a notion of a
current thread for register and memory reads/writes (set via the "$Hg%x" packet)
and a current thread for running ("$Hc%x"). Now we ask the remote GDB server
if it supports adding the thread ID to the register packets and we enable
that feature in LLDB if supported. This stops us from having to send a bunch
of packets that update the current thread ID to some value which is prone to
error, or extra packets.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
b01000fd063629facd45044f137446fb748ee179 17-Jan-2011 Greg Clayton <gclayton@apple.com> A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.

A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:

class ExternalASTSource {
....

virtual void
CompleteType (clang::TagDecl *Tag);

virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};

This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.

This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).

We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
a875b64ab8d258b28959d05eea37cb5dfdd72730 09-Jan-2011 Greg Clayton <gclayton@apple.com> Put more smarts into the RegisterContext base class. Now the base class has
a method:

void RegisterContext::InvalidateIfNeeded (bool force);

Each time this function is called, when "force" is false, it will only call
the pure virtual "virtual void RegisterContext::InvalideAllRegisters()" if
the register context's stop ID doesn't match that of the process. When the
stop ID doesn't match, or "force" is true, the base class will clear its
cached registers and the RegisterContext will update its stop ID to match
that of the process. This helps make it easier to correctly flush the register
context (possibly from multiple locations depending on when and where new
registers are availabe) without inadvertently clearing the register cache
when it doesn't need to be.

Modified the ProcessGDBRemote plug-in to be much more efficient when it comes
to:
- caching the expedited registers in the stop reply packets (we were ignoring
these before and it was causing us to read at least three registers every
time we stopped that were already supplied in the stop reply packet).
- When a thread has no stop reason, don't keep asking for the thread stopped
info. Prior to this fix we would continually send a qThreadStopInfo packet
over and over when any thread stop info was requested. We now note the stop
ID that the stop info was requested for and avoid multiple requests.

Cleaned up some of the expression code to not look for ClangExpressionVariable
objects up by name since they are now shared pointers and we can just look for
the exact pointer match and avoid possible errors.

Fixed an bug in the ValueObject code that would cause children to not be
displayed.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123127 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4862fa2f3db6967464cd65a2c77b2e55de3da5ff 08-Jan-2011 Greg Clayton <gclayton@apple.com> Modified the stop reply packet to be able to send the thread name using the
new "hexname" key for the "key:value;" duple that is part of the packet. This
allows for thread names to contain special characters such as $ # : ; + -

Debugserver now detects if the thread name contains special characters and
sends the chars in hex format if needed.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
6e889b142d6acbe1c318bc1b690dd9c3722d7095 17-Dec-2010 Greg Clayton <gclayton@apple.com> Removed libunwind sources as we aren't using them anymore.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
ff5cac255d8e23b3e3820a2c0f00040ab24e508f 13-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed a crasher where when a ProcessGDBRemote class was being destroyed, it would eventually destroy the dynamic loader (when the lldb_private::Process::m_dynamic_loader_ap destroys itself in the object member destructor chain). The dynamic loader was calling a pure virtual method in Process which was causing a crash. The quick fix is to reset the auto pointer in the ProcessGDBRemote destructor when ProcessGDBRemote is still a valid object with all its pure virtual functions intact.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
58e844b3561848e73e69d6d98746d4851e78306e 08-Dec-2010 Greg Clayton <gclayton@apple.com> Added the ability to dump sections to a certain depth (for when sections
have children sections).

Modified SectionLoadList to do it's own multi-threaded protected on its map.
The ThreadSafeSTLMap class was difficult to deal with and wasn't providing
much utility, it was only getting in the way.

Make sure when the communication read thread is about to exit, it clears the
thread in the main class.

Fixed the ModuleList to correctly ignore architectures and UUIDs if they aren't
valid when searching for a matching module. If we specified a file with no arch,
and then modified the file and loaded it again, it would not match on subsequent
searches if the arch was invalid since it would compare an invalid architecture
to the one that was found or selected within the shared library or executable.
This was causing stale modules to stay around in the global module list when they
should have been removed.

Removed deprecated functions from the DynamicLoaderMacOSXDYLD class.

Modified "ProcessGDBRemote::IsAlive" to check if we are connected to a gdb
server and also make sure our process hasn't exited.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
bd666017403e102e0ca435d6da585ff979f83598 03-Dec-2010 Caroline Tice <ctice@apple.com> Add '-no-stdio' option to 'process launch' command, which causes the
inferior to be launched without setting up terminal stdin/stdout for it
(leaving the lldb command line accessible while the program is executing).
Also add a user settings variable, 'target.process.disable-stdio' to allow
the user to set this globally rather than having to use the command option
each time the process is launched.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120825 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
b749a265a2b97f9cef71c362dfd6dae26c8f2973 03-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed a race condition that could cause ProcessGDBRemote::DoResume() to return
an error saying the resume timed out. Previously the thread that was trying
to resume the process would eventually call ProcessGDBRemote::DoResume() which
would broadcast an event over to the async GDB remote thread which would sent the
continue packet to the remote gdb server. Right after this was sent, it would
set a predicate boolean value (protected by a mutex and condition) and then the
thread that issued the ProcessGDBRemote::DoResume() would then wait for that
condition variable to be set. If the async gdb thread was too quick though, the
predicate boolean value could have been set to true and back to false by the
time the thread that issued the ProcessGDBRemote::DoResume() checks the boolean
value. So we can't use the predicate value as a handshake. I have changed the code
over to using a Event by having the GDB remote communication object post an
event:

GDBRemoteCommunication::eBroadcastBitRunPacketSent

This allows reliable handshaking between the two threads and avoids the erroneous
ProcessGDBRemote::DoResume() errors.

Added a host backtrace service to allow in process backtraces when trying to track
down tricky issues. I need to see if LLVM has any backtracing abilities abstracted
in it already, and if so, use that, but I needed something ASAP for the current issue
I was working on. The static function is:

void
Host::Backtrace (Stream &strm, uint32_t max_frames);

And it will backtrace at most "max_frames" frames for the current thread and can be
used with any of the Stream subclasses for logging.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c0da61564ce489bb57622b7b7e7e0984ae9af5b8 03-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed DoResume to watch for the correct return value from WaitForIsRunning to avoid spurious errors due to previous fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
20d338fad87eba91de65aa9bec76e01c04472848 18-Nov-2010 Greg Clayton <gclayton@apple.com> Fixed Process::Halt() as it was broken for "process halt" after recent changes
to the DoHalt down in ProcessGDBRemote. I also moved the functionality that
was in ProcessGDBRemote::DoHalt up into Process::Halt so not every class has
to implement a tricky halt/resume on the internal state thread. The
functionality is the same as it was before with two changes:
- when we eat the event we now just reuse the event we consume when the private
state thread is paused and set the interrupted bool on the event if needed
- we also properly update the Process::m_public_state with the state of the
event we consume.

Prior to this, if you issued a "process halt" it would eat the event, not
update the process state, and then produce a new event with the interrupted
bit set and send it. Anyone listening to the event would get the stopped event
with a process that whose state was set to "running".

Fixed debugserver to not have to be spawned with the architecture of the
inferior process. This worked fine for launching processes, but when attaching
to processes by name or pid without a file in lldb, it would fail.

Now debugserver can support multiple architectures for a native debug session
on the current host. This currently means i386 and x86_64 are supported in
the same binary and a x86_64 debugserver can attach to a i386 executable.
This change involved a lot of changes to make sure we dynamically detect the
correct registers for the inferior process.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3ae449a5c3b4f51afc0da22cfeaef00c303c0acc 17-Nov-2010 Jim Ingham <jingham@apple.com> Added an "Interrupted" bit to the ProcessEventData. Halt now generates an event
with the Interrupted bit set. Process::HandlePrivateEvent ignores Interrupted events.
DoHalt is changed to ensure that the stop even is processed, and an event with
the Interrupted event is posted. Finally ClangFunction is rationalized to use this
facility so the that Halt is handled more deterministically.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
861efb3f6e225e45c45511d6da894633b36025a1 16-Nov-2010 Caroline Tice <ctice@apple.com> Make processes use InputReaders for their input. Move the process
ReadThread stuff into the main Process class (out of the Process Plugins).
This has the (intended) side effect of disabling the command line tool
from reading input/commands while the process is running (the input is
directed to the running process rather than to the command interpreter).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119329 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
23cf0c7880761e2546c1a83920d82a46e0ade837 08-Nov-2010 Greg Clayton <gclayton@apple.com> Cleaned up the pseudo terminal code in ProcessGDBRemote as it was spawning
a pseudo terminal even when the process being attached to.

Fixed a possible crasher in the in:

bool
ClangASTContext::IsAggregateType (clang_type_t clang_type);

It seems that if you pass in a record decl, enum decl, or objc class decl
and ask it if it is an aggregate type, clang will crash.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118404 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
e005f2ce03c489ebde9110678a29cbfe8488d5b4 06-Nov-2010 Greg Clayton <gclayton@apple.com> Modified all logging calls to hand out shared pointers to make sure we
don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
91a1dabac7ef4a1c8a60dbbb8340d33b7d25f863 05-Nov-2010 Caroline Tice <ctice@apple.com> If debugserver is running on the local machine, pass it a
pseudoterminal to pass to the inferior for the inferior's I/O
(to allow direct writing, rather than passing all the I/O around
via packets).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118308 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
926060e198137f8a64face70455324a8cd4362a5 29-Oct-2010 Caroline Tice <ctice@apple.com> Add the ability to disable individual log categories, rather
than just the entire log channel.

Add checks, where appropriate, to make sure a log channel/category has
not been disabled before attempting to write to it.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
f3d0b0c8081691128626eb496fdfcbf8ae54c1de 27-Oct-2010 Greg Clayton <gclayton@apple.com> Updated the lldb_private::Flags class to have better method names and made
all of the calls inlined in the header file for better performance.

Fixed the summary for C string types (array of chars (with any combo if
modifiers), and pointers to chars) work in all cases.

Fixed an issue where a forward declaration to a clang type could cause itself
to resolve itself more than once if, during the resolving of the type itself
it caused something to try and resolve itself again. We now remove the clang
type from the forward declaration map in the DWARF parser when we start to
resolve it and avoid this additional call. This should stop any duplicate
members from appearing and throwing all the alignment of structs, unions and
classes.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
537a7a86687683fd403ce652d178fbc89e06ef9f 20-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed an issue where we were resolving paths when we should have been.

So the issue here was that we have lldb_private::FileSpec that by default was
always resolving a path when using the:

FileSpec::FileSpec (const char *path);

and in the:

void FileSpec::SetFile(const char *pathname, bool resolve = true);

This isn't what we want in many many cases. One example is you have "/tmp" on
your file system which is really "/private/tmp". You compile code in that
directory and end up with debug info that mentions "/tmp/file.c". Then you
type:

(lldb) breakpoint set --file file.c --line 5

If your current working directory is "/tmp", then "file.c" would be turned
into "/private/tmp/file.c" which won't match anything in the debug info.
Also, it should have been just a FileSpec with no directory and a filename
of "file.c" which could (and should) potentially match any instances of "file.c"
in the debug info.

So I removed the constructor that just takes a path:

FileSpec::FileSpec (const char *path); // REMOVED

You must now use the other constructor that has a "bool resolve" parameter that you must always supply:

FileSpec::FileSpec (const char *path, bool resolve);

I also removed the default parameter to SetFile():

void FileSpec::SetFile(const char *pathname, bool resolve);

And fixed all of the code to use the right settings.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116944 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3b2c41c9d12bafdad87cc271fadd1f816081b9a8 18-Oct-2010 Greg Clayton <gclayton@apple.com> Still trying to get detach to work with debugserver. Got a bit closer,
but something is still killing our inferior.

Fixed an issue with darwin-debug where it wasn't passing all needed arguments
to the inferior.

Fixed a race condition with the attach to named process code.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c1d3775eb2494c6e88ebee44c7d49beefcb3bb6a 18-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed debugserver to properly attach to a process by name with the
"vAttachName;<PROCNAME>" packet, and wait for a new process by name to launch
with the "vAttachWait;<PROCNAME>".

Fixed a few issues with attaching where if DoAttach() returned no error, yet
there was no valid process ID, we would deadlock waiting for an event that
would never happen.

Added a new "process launch" option "--tty" that will launch the process
in a new terminal if the Host layer supports the "Host::LaunchInNewTerminal(...)"
function. This currently works on MacOSX and will allow the debugging of
terminal applications that do complex operations with the terminal.

Cleaned up the output when the process resumes, stops and halts to be
consistent with the output format.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
24b48ff28b7c60dd4598212c3e77935a0fc1142d 18-Oct-2010 Greg Clayton <gclayton@apple.com> Added a new Host call to find LLDB related paths:

static bool
Host::GetLLDBPath (lldb::PathType path_type, FileSpec &file_spec);

This will fill in "file_spec" with an appropriate path that is appropriate
for the current Host OS. MacOSX will return paths within the LLDB.framework,
and other unixes will return the paths they want. The current PathType
enums are:

typedef enum PathType
{
ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists
ePathTypeSupportExecutableDir, // Find LLDB support executable directory (debugserver, etc)
ePathTypeHeaderDir, // Find LLDB header file directory
ePathTypePythonDir // Find Python modules (PYTHONPATH) directory
} PathType;

All places that were finding executables are and python paths are now updated
to use this Host call.

Added another new host call to launch the inferior in a terminal. This ability
will be very host specific and doesn't need to be supported on all systems.
MacOSX currently will create a new .command file and tell Terminal.app to open
the .command file. It also uses the new "darwin-debug" app which is a small
app that uses posix to exec (no fork) and stop at the entry point of the
program. The GDB remote plug-in is almost able launch a process and attach to
it, it currently will spawn the process, but it won't attach to it just yet.
This will let LLDB not have to share the terminal with another process and a
new terminal window will pop up when you launch. This won't get hooked up
until we work out all of the kinks. The new Host function is:

static lldb::pid_t
Host::LaunchInNewTerminal (
const char **argv, // argv[0] is executable
const char **envp,
const ArchSpec *arch_spec,
bool stop_at_entry,
bool disable_aslr);

Cleaned up FileSpec::GetPath to not use strncpy() as it was always zero
filling the entire path buffer.

Fixed an issue with the dynamic checker function where I missed a '$' prefix
that should have been added.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
af6e9e4417a784f7df6376a92c0f8f6ac823f295 12-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed the dispatch queue name retrieval for threads by looking in an extra
shlib.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
d8c625380b56759fc3fef8b9cf0389ae1a07f44d 07-Oct-2010 Greg Clayton <gclayton@apple.com> Cleaned up the SWIG stuff so all includes happen as they should, no pulling
tricks to get types to resolve. I did this by correctly including the correct
files: stdint.h and all lldb-*.h files first before including the API files.
This allowed me to remove all of the hacks that were in the lldb.swig file
and it also allows all of the #defines in lldb-defines.h and enumerations
in lldb-enumerations.h to appear in the lldb.py module. This will make the
python script code a lot more readable.

Cleaned up the "process launch" command to not execute a "process continue"
command, it now just does what it should have with the internal API calls
instead of executing another command line command.

Made the lldb_private::Process set the state to launching and attaching if
WillLaunch/WillAttach return no error respectively.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4b40711e7950310afb74835820eb669004cd8c44 30-Sep-2010 Greg Clayton <gclayton@apple.com> Cleaned up a unused member variable in Debugger.

Added the start of Host specific launch services, though it currently isn't
hookup up to anything. We want to be able to launch a process and use the
native launch services to launch an app like it would be launched by the
user double clicking on the app. We also eventually want to be able to run
a command line app in a newly spawned terminal to avoid terminal sharing.

Fixed an issue with the new DWARF forward type declaration stuff. A crasher
was found that was happening when trying to properly expand the forward
declarations.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4fb400f4dc762fb92f9dcf1f6a7656ed12b09a75 27-Sep-2010 Greg Clayton <gclayton@apple.com> Hooked up detach for ProcessGDBRemote.

Remove the GetUserData()/SetUserData() from the DWARFDebugInfoEntry
class. We now track everything with dense maps.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
eea264007bc5fb42c8f3239726a9d28ae42e1b7b 15-Sep-2010 Greg Clayton <gclayton@apple.com> Moved the section load list up into the target so we can use the target
to symbolicate things without the need for a valid process subclass.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3a4ea24572fad1e22525f8efb718d49d41e30398 10-Sep-2010 Jason Molenda <jmolenda@apple.com> The first part of an lldb native stack unwinder.

The Unwind and RegisterContext subclasses still need
to be finished; none of this code is used by lldb at
this point (unless you call into it by hand).

The ObjectFile class now has an UnwindTable object.

The UnwindTable object has a series of FuncUnwinders
objects (Function Unwinders) -- one for each function
in that ObjectFile we've backtraced through during this
debug session.

The FuncUnwinders object has a few different UnwindPlans.
UnwindPlans are a generic way of describing how to find
the canonical address of a given function's stack frame
(the CFA idea from DWARF/eh_frame) and how to restore the
caller frame's register values, if they have been saved
by this function.

UnwindPlans are created from different sources. One source is the
eh_frame exception handling information generated by the compiler
for unwinding an exception throw. Another source is an assembly
language inspection class (UnwindAssemblyProfiler, uses the Plugin
architecture) which looks at the instructions in the funciton
prologue and describes the stack movements/register saves that are
done.

Two additional types of UnwindPlans that are worth noting are
the "fast" stack UnwindPlan which is useful for making a first
pass over a thread's stack, determining how many stack frames there
are and retrieving the pc and CFA values for each frame (enough
to create StackFrameIDs). Only a minimal set of registers is
recovered during a fast stack walk.

The final UnwindPlan is an architectural default unwind plan.
These are provided by the ArchDefaultUnwindPlan class (which uses
the plugin architecture). When no symbol/function address range can
be found for a given pc value -- when we have no eh_frame information
and when we don't have a start address so we can't examine the assembly
language instrucitons -- we have to make a best guess about how to
unwind. That's when we use the architectural default UnwindPlan.
On x86_64, this would be to assume that rbp is used as a stack pointer
and we can use that to find the caller's frame pointer and pc value.
It's a last-ditch best guess about how to unwind out of a frame.

There are heuristics about when to use one UnwindPlan versues the other --
this will all happen in the still-begin-written UnwindLLDB subclass of
Unwind which runs the UnwindPlans.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113581 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
0a7f75f9e375911ca91a884968b0efa36f18588d 09-Sep-2010 Greg Clayton <gclayton@apple.com> Got the ARM version of debugserver up to date.

Renamed the "dispatchqaddr" setting that was coming back for stop reply packets
to be named "qaddr" so that gdb doesn't thing it is a register number. gdb
was checking the first character and assuming "di" was a hex register number
because 'd' is a hex digit. It has been shortened so gdb can safely ignore it.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
c5b15db9b9e17233c4dc35c9ff3539a0266465f0 04-Sep-2010 Johnny Chen <johnny.chen@apple.com> Fixed an lldb infrastructure bug, where the debugger should reaaly update its
execution context only when the process is still alive. When running the test
suite, the debugger is launching and killing processes constantly.

This might be the cause of the test hang as reported in rdar://problem/8377854,
where the debugger was looping infinitely trying to update a supposedly stale
thread list.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113022 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
1a67946295ac66ff7a8787be25d8b56f49742345 03-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed a case where we might be able to acquire a mutex with a try lock and
not release it by making sure a mutex locker object is appropriately used.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
2653be9528205c7f0e32bbe8395aa70986e711b7 03-Sep-2010 Benjamin Kramer <benny.kra@googlemail.com> Pacify operator precedence warnings. No functionality change because eLaunchFlagDisableASLR happens to be 1.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
5205f0b6585a127acc6ed210021abb6091220a89 03-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed the StackFrame to correctly resolve the StackID's SymbolContextScope.

Added extra logging for stepping.

Fixed an issue where cached stack frame data could be lost between runs when
the thread plans read a stack frame.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
452bf613496c7290c6b7a1a1eb28efbce63fd3b9 31-Aug-2010 Greg Clayton <gclayton@apple.com> Added the ability to disable ASLR (Address Space Layout Randomization). ASLR
is disabled by default, and can be enabled using:

(lldb) set disable-aslr 0



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
75ccf50c3371d8c8e293af25461705b86fb10a46 21-Aug-2010 Greg Clayton <gclayton@apple.com> Modified the host process monitor callback function Host::StartMonitoringChildProcess
to spawn a thread for each process that is being monitored. Previously
LLDB would spawn a single thread that would wait for any child process which
isn't ok to do as a shared library (LLDB.framework on Mac OSX, or lldb.so on
linux). The old single thread used to call wait4() with a pid of -1 which
could cause it to reap child processes that it shouldn't have.

Re-wrote the way Function blocks are handles. Previously I attempted to keep
all blocks in a single memory allocation (in a std::vector). This made the
code somewhat efficient, but hard to work with. I got rid of the old BlockList
class, and went to a straight parent with children relationship. This new
approach will allow for partial parsing of the blocks within a function.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@111706 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7508e732818c32e1cfeaaf7d1d507fe3834ce9d2 10-Aug-2010 Jim Ingham <jingham@apple.com> Change Target & Process so they can really be initialized with an invalid architecture.
Arrange that this then gets properly set on attach, or when a "file" is set.
Add a completer for "process attach -n".

Caveats: there isn't currently a way to handle multiple processes with the same name. That
will have to wait on a way to pass annotations along with the completion strings.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
643ee7301b5d4b05c321d906bc0d7ff11f571295 04-Aug-2010 Greg Clayton <gclayton@apple.com> Abtracted the old "lldb_private::Thread::StopInfo" into an abtract class.
This will allow debugger plug-ins to make any instance of "lldb_private::StopInfo"
that can completely describe any stop reason. It also provides a framework for
doing intelligent things with the stop info at important times in the lifetime
of the inferior.

Examples include the signal stop info in StopInfoUnixSignal. It will check with
the process to see that the current action is for the signal. These actions
include wether to stop for the signal, wether the notify that the signal was
hit, and wether to pass the signal along to the inferior process. The
StopInfoUnixSignal class overrides the "ShouldStop()" method of StopInfo and
this allows the stop info to determine if it should stop at the signal or
continue the process.


StopInfo subclasses must override the following functions:

virtual lldb::StopReason
GetStopReason () const = 0;

virtual const char *
GetDescription () = 0;


StopInfo subclasses can override the following functions:


// If the subclass returns "false", the inferior will resume. The default
// version of this function returns "true" which means the default stop
// info will stop the process. The breakpoint subclass will check if
// the breakpoint wants us to stop by calling any installed callback on
// the breakpoint, and also checking if the breakpoint is for the current
// thread. Signals will check if they should stop based off of the
// UnixSignal settings in the process.
virtual bool
ShouldStop (Event *event_ptr);

// Sublasses can state if they want to notify the debugger when "ShouldStop"
// returns false. This would be handy for breakpoints where you want to
// log information and continue and is also used by the signal stop info
// to notify that a signal was received (after it checks with the process
// signal settings).
virtual bool
ShouldNotify (Event *event_ptr)
{
return false;
}

// Allow subclasses to do something intelligent right before we resume.
// The signal class will figure out if the signal should be propagated
// to the inferior process and pass that along to the debugger plug-ins.
virtual void
WillResume (lldb::StateType resume_state)
{
// By default, don't do anything
}


The support the Mach exceptions was moved into the lldb/source/Plugins/Process/Utility
folder and now doesn't polute the lldb_private::Thread class with platform
specific code.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110184 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
960d6a40711f05effe6fcc5b66f0952450f79ea2 03-Aug-2010 Greg Clayton <gclayton@apple.com> Added support for objective C built-in types: id, Class, and SEL. This
involved watching for the objective C built-in types in DWARF and making sure
when we convert the DWARF types into clang types that we use the appropriate
ASTContext types.

Added a way to find and dump types in lldb (something equivalent to gdb's
"ptype" command):

image lookup --type <TYPENAME>

This only works for looking up types by name and won't work with variables.
It also currently dumps out verbose internal information. I will modify it
to dump more appropriate user level info in my next submission.

Hookup up the "FindTypes()" functions in the SymbolFile and SymbolVendor so
we can lookup types by name in one or more images.

Fixed "image lookup --address <ADDRESS>" to be able to correctly show all
symbol context information, but it will only show this extra information when
the new "--verbose" flag is used.

Updated to latest LLVM to get a few needed fixes.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7661a98ba99c585034bc60dbe43ad80599cc6dd3 23-Jul-2010 Greg Clayton <gclayton@apple.com> Centralized the Mach exception stop info code by adding it as a first
class citizen on the StopInfo class.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
7cebe131c19e5cff92a5728144dcbdb1e73e0343 23-Jul-2010 Greg Clayton <gclayton@apple.com> Added Mach exception stop descriptions. The chunk of code I just added needs to be placed into a utility location so it can be used by ProcessMacOSX and debugserver.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109214 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
1674b12bbc3dae7b9543b8c5f958e90ddc767fa4 22-Jul-2010 Greg Clayton <gclayton@apple.com> Change over to using the definitions for mach-o types and defines to the
defines that are in "llvm/Support/MachO.h". This should allow ObjectFileMachO
and ObjectContainerUniversalMachO to be able to be cross compiled in Linux.

Also did some cleanup on the ASTType by renaming it to ClangASTType and
renaming the header file. Moved a lot of "AST * + opaque clang type *"
functionality from lldb_private::Type over into ClangASTType.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
53d68e749f0715691a95f23e9490d97e484b15da 21-Jul-2010 Greg Clayton <gclayton@apple.com> Remove use of STL collection class use of the "data()" method since it isn't
part of C++'98. Most of these were "std::vector<T>::data()" and
"std::string::data()".



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108957 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
54e7afa84d945f9137f9372ecde432f9e1a702fc 09-Jul-2010 Greg Clayton <gclayton@apple.com> Merged Eli Friedman's linux build changes where he added Makefile files that
enabled LLVM make style building and made this compile LLDB on Mac OS X. We
can now iterate on this to make the build work on both linux and macosx.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
f2a4d2e8412e3943c480c8a534eaea56844a9e56 06-Jul-2010 Greg Clayton <gclayton@apple.com> Applied pid.patch from Jean-Daniel Dupas.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
e9d0df45df0ee87623985d1e59947a2ca50c14ea 02-Jul-2010 Greg Clayton <gclayton@apple.com> More leaks detection:
- fixed 3 posix spawn attributes leaks
- fixed us always leaking CXXBaseSpecifier objects when we create class
base classes. Clang apparently copies the base classes we pass in.

Fixed some code formatting in ClangASTContext.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
63094e0bb161580564954dee512955c1c79d3476 23-Jun-2010 Greg Clayton <gclayton@apple.com> Very large changes that were needed in order to allow multiple connections
to the debugger from GUI windows. Previously there was one global debugger
instance that could be accessed that had its own command interpreter and
current state (current target/process/thread/frame). When a GUI debugger
was attached, if it opened more than one window that each had a console
window, there were issues where the last one to setup the global debugger
object won and got control of the debugger.

To avoid this we now create instances of the lldb_private::Debugger that each
has its own state:
- target list for targets the debugger instance owns
- current process/thread/frame
- its own command interpreter
- its own input, output and error file handles to avoid conflicts
- its own input reader stack

So now clients should call:

SBDebugger::Initialize(); // (static function)

SBDebugger debugger (SBDebugger::Create());
// Use which ever file handles you wish
debugger.SetErrorFileHandle (stderr, false);
debugger.SetOutputFileHandle (stdout, false);
debugger.SetInputFileHandle (stdin, true);

// main loop

SBDebugger::Terminate(); // (static function)

SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to
ensure nothing gets destroyed too early when multiple clients might be
attached.

Cleaned up the command interpreter and the CommandObject and all subclasses
to take more appropriate arguments.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
3c7b5b9f83cae58ca366db2bba37dc09485f7dcc 16-Jun-2010 Jim Ingham <jingham@apple.com> Add a "thread specification" class that specifies thread specific breakpoints by name, index, queue or TID.
Push this through all the breakpoint management code. Allow this to be set when the breakpoint is created.
Fix the Process classes so that a breakpoint hit that is not for a particular thread is not reported as a
breakpoint hit event for that thread.
Added a "breakpoint configure" command to allow you to reset any of the thread
specific options (or the ignore count.)


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
84cdc15005983e5244d665fa779e33c2b6fac95f 15-Jun-2010 Jim Ingham <jingham@apple.com> Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
53d968634a70498b187f8af3742791f1dec53e0d 12-Jun-2010 Jason Molenda <jmolenda@apple.com> Applied PluginManager.cpp patch from Jean-Daniel Dupas.
Fixed problem Jean-Daniel Dupas found in ProcessGDBRemote.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105857 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
cf0150574a0a97049efe2dce2cc0aa433705feb3 11-Jun-2010 Greg Clayton <gclayton@apple.com> Made lldb_private::ArchSpec more generic so that it can take a mach-o cpu
type and sub-type, or an ELF e_machine value. Also added a generic CPU type
to the arch spec class so we can have a single arch definition that the LLDB
core code can use. Previously a lot of places in the code were using the
mach-o definitions from a macosx header file.

Switches over to using "llvm/Support/MachO.h" for the llvm::MachO::XXX for the
CPU types and sub types for mach-o ArchSpecs. Added "llvm/Support/ELF.h" so
we can use the "llvm::ELF::XXX" defines for the ELF ArchSpecs.

Got rid of all CPU_TYPE_ and CPU_SUBTYPE_ defines that were previously being
used in LLDB.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105806 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
dea5ea78ef9bf371a0d19590c6b7c6989cba9a89 09-Jun-2010 Jason Molenda <jmolenda@apple.com> Move source/Utility/PseudoTerminal.h into include/lldb/Utility.
The top of the header file seems to indicate that this was
intended to be over at include/lldb/Core but we should be in line
with the .cpp file's location so it's include/lldb/Utility for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
24943d2ee8bfaa7cf5893e4709143924157a5c1e 08-Jun-2010 Chris Lattner <sabre@nondot.org> Initial checkin of lldb code from internal Apple repo.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp