History log of /external/lldb/source/Target/Process.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
666a1f8a7b5caa18abdee9503bc20c49b0542e59 31-Jul-2013 Daniel Malea <daniel.malea@intel.com> Fix lock hierarchy violation in Process (lock ordering of ThreadList mutex and StackFrameList mutex)
- this fix ensures the ThreadList mutex is always locked before the StackFrameList mutex

Situation where deadlock could occur (without this fix):
Thread 1 is in Process::WillResume and locks the ThreadList mutex (on entry), and subsequently calls StackFrameList::Clear() which locks the StackFrameList mutex.
Meanwhile, thread 2 is in Process::RunThreadPlan and calls Thread::SetSelectedFrame() (which locks the StackFrameList mutex) before calling GetSelectedThread (which attempts to lock the ThreadList mutex)

In my testing on both Linux and Mac OS X, I was unable to reproduce any hangs with this patch applied.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
01711aa1b451159a31d6423ee8919a3a426b4984 30-Jul-2013 Sean Callanan <scallanan@apple.com> Send a stop event when an expression stops at a breakpoint
in an expression and doesn't ignore the stop.

Patch by Jim Ingham.

<rdar://problem/14583884>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
cf88b95d435873bd312e716da5701cf3882c5da4 29-Jul-2013 Ed Maste <emaste@freebsd.org> Use flag instead of rwlock state to track process running state

LLDB requires that the inferior process be stopped before, and remain
stopped during, certain accesses to process state.

Previously this was achieved with a POSIX rwlock which had a write lock
taken for the duration that the process was running, and released when
the process was stopped. Any access to process state was performed with
a read lock held.

However, POSIX requires that pthread_rwlock_unlock() be called from the
same thread as pthread_rwlock_wrlock(), and lldb needs to stop and start
the process from different threads. Violating this constraint is
technically undefined behaviour, although as it happens Linux and Darwin
result in the unlock proceeding in this case. FreeBSD follows POSIX
more strictly, and the unlock would fail, resulting in a hang later upon
the next attempt to take the lock.

All read lock consumers use ReadTryLock() and handle failure to obtain
the lock (typically by logging an error "process is running"). Thus,
instead of using the lock state itself to track the running state, this
change adds an explicit m_running flag. ReadTryLock tests the flag, and
if the process is not running it returns with the read lock held.

WriteLock and WriteTryLock are renamed to SetRunning and TrySetRunning,
and (if successful) they set m_running with the lock held. This way,
read consumers can determine if the process is running and act
appropriately, and write consumers are still held off from starting the
process if read consumers are active.

Note that with this change there are still some curious access patterns,
such as calling WriteUnlock / SetStopped twice in a row, and there's no
protection from multiple threads trying to simultaneously start the
process. In practice this does not seem to be a problem, and was
exposing other undefined POSIX behaviour prior to this change.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187377 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
8bf4e92ff9b78a973a3feae2231c972fa156ba9a 02-Jul-2013 Ed Maste <emaste@freebsd.org> Remove obsolete comment



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
e46dd5bb968f0c269ead5cbf3d05511fd2ebcf92 27-Jun-2013 Sean Callanan <scallanan@apple.com> Remove the process's reservation cache and don't
bother checking if a region is safe to use. In
cases where regions need to be synthesized rather
than properly allocated, the memory reads required
to determine whether the area is used are

- insufficient, because intermediate locations
could be in use, and

- unsafe, because on some platforms reading from
memory can trigger events.

All this only makes a difference on platforms
where memory allocation in the target is impossible.
Behavior on platforms where it is possible should
stay the same.

<rdar://problem/14023970>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
a1f156aa2695963058615edeabedfcb0f1ca5fab 24-Jun-2013 Han Ming Ong <hanming@apple.com> <rdar://problem/14182286>

Made sure that temporary object created from HarmonizeThreadIdsForProfileData() doesn’t get passed around without creating an object first.

Reviewed by Greg

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184769 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
29f30d0f5ccbb6c1f95de7199008ac2448097609 22-Jun-2013 Jim Ingham <jingham@apple.com> Remember to update the m_thread_list_real after you do UpdateThreadList.

<rdar://problem/14147303>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9e0d89ef07d6318728d2f76fc943cc7710014c7c 22-Jun-2013 Han Ming Ong <hanming@apple.com> <rdar://problem/14004410>

Remove old GetNextThreadIndexID() from lldb

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184600 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
dddd452347338c4878fd8bc4bbc3832c034ce518 19-Jun-2013 Jim Ingham <jingham@apple.com> Don't actually Halt in the Interrupt handler for the Process, just send an AsyncInterrupt.
That's actually not async-signal-clean, but it is a lot safer than Halt...


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
ac94caa68a4a5fa4bd939d7656a6a12d8fc06a33 12-Jun-2013 Greg Clayton <gclayton@apple.com> Huge performance improvements when one breakpoint contains many locations.

325,000 breakpoints for running "breakpoint set --func-regex ." on lldb itself (after hitting a breakpoint at main so that LLDB.framework is loaded) used to take up to an hour to set, now we are down under a minute. With warm file caches, we are at 40 seconds, and that is with setting 325,000 breakpoint through the GDB remote API. Linux and the native debuggers might be faster. I haven't timed what how much is debug info parsing and how much is the protocol traffic to/from GDB remote.

That there were many performance issues. Most of them were due to storing breakpoints in the wrong data structures, or using the wrong iterators to traverse the lists, traversing the lists in inefficient ways, and not optimizing certain function name lookups/symbol merges correctly.

Debugging after that is also now very efficient. There were issues with replacing the breakpoint opcodes in memory that was read, and those routines were also fixed.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183820 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
3bd2ebd670677dae45010bf53084ff85da7c6a5e 29-May-2013 Andrew Kaylor <andrew.kaylor@intel.com> Adding support for stopping all threads of multithreaded inferiors on Linux. Also adding multithreaded test cases.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182809 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
5acdec75cbdb5078de36d0bcf5b0c9bd97f46336 16-May-2013 Sean Callanan <scallanan@apple.com> Added a per-process cache for reserved memory
regions that aren't actually allocated in the
process. This cache is used by the expression
parser if the underlying process doesn't support
memory allocation, to avoid needless repeated
searches for unused address ranges.

Also fixed a silly bug in IRMemoryMap where it
would continue searching even after it found a
valid region.

<rdar://problem/13866629>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182028 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
a79c53f83949dbc9337fe00247ea476cfc12a7bf 15-May-2013 Jim Ingham <jingham@apple.com> Don’t pop the process input reader for a “stop” event if ShouldBroadcastEvent has restarted the process.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
addad59552c206466dea98c4a645a471a41252b4 11-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13700260>

Avoid a deadlock when using the OperatingSystemPython code and typing "process interrupt". There was a possible lock inversion between the target API lock and the process' thread list lock due to code trying to discard the thread list. This was fixed by adding a boolean to Process::Halt() that indicates if the thread plans should be discarded and doing it in the private state thread when we process the stopped state.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
1f85fa8c8611a175819009dd83e724b6788a6587 10-May-2013 Andrew Kaylor <andrew.kaylor@intel.com> Adding support for setting thread stop state when a process stops.

This re-submission of this patch fixes a problem where the code sometimes caused a deadlock. The Process::SetPrivateState method was locking the Process::m_private_state variable and then later calling ThreadList::DidStop, which locks the ThreadList mutex. Other methods in ThreadList which were being called from other threads lock the ThreadList mutex and then call Process::GetPrivateState which locks the Process::m_private_state mutex. To avoid deadlocks, Process::SetPrivateState now locks the ThreadList mutex before locking the Process::m_private_state mutex.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181609 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
85e3c2f2f7e60a772f9fffa3fc42d46e493d198c 09-May-2013 Daniel Malea <daniel.malea@intel.com> Revert r181482 as it causes occasional hangs in LLDB buildbots

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
52e4391bf4239f770f856392869f652f5417f489 09-May-2013 Andrew Kaylor <andrew.kaylor@intel.com> Adding code to set thread state to stopped when the process stops.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c5bcb907e4a898783640c038b84c9f2ac10ee91d 08-May-2013 Daniel Malea <daniel.malea@intel.com> Remove distinction between Apple/Linux for Process run locks:
- Played with the current dual run lock implementation for a few days, noticed
no regressions, so enabling in trunk so we see if any problems are detected
by buildbots.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
7c79a27b955432dfd3ad9439640f0af2eccf37b8 08-May-2013 Jim Ingham <jingham@apple.com> Figure out the reply to "PlanExplainsStop" once when we stop and then use the cached
value. This fixes problems, for instance, with the StepRange plans, where they know that
they explained the stop because they were at their "run to here" breakpoint, then deleted
that breakpoint, so when they got asked again, doh! I had done this for a couple of plans
in an ad hoc fashion, this just formalizes it.

Also add a "ResumeRequested" in Process so that the code in the completion handlers can
tell the ShouldStop logic they want to resume rather than just directly resuming. That allows
us to handle resuming in a more controlled fashion.

Also, SetPublicState can take a "restarted" flag, so that it doesn't drop the run lock when
the target was immediately restarted.
--This line, and those below , will be ignored--

M test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
M include/lldb/Target/ThreadList.h
M include/lldb/Target/ThreadPlanStepOut.h
M include/lldb/Target/Thread.h
M include/lldb/Target/ThreadPlanBase.h
M include/lldb/Target/ThreadPlanStepThrough.h
M include/lldb/Target/ThreadPlanStepInstruction.h
M include/lldb/Target/ThreadPlanStepInRange.h
M include/lldb/Target/ThreadPlanStepOverBreakpoint.h
M include/lldb/Target/ThreadPlanStepUntil.h
M include/lldb/Target/StopInfo.h
M include/lldb/Target/Process.h
M include/lldb/Target/ThreadPlanRunToAddress.h
M include/lldb/Target/ThreadPlan.h
M include/lldb/Target/ThreadPlanCallFunction.h
M include/lldb/Target/ThreadPlanStepOverRange.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
M source/Target/StopInfo.cpp
M source/Target/Process.cpp
M source/Target/ThreadPlanRunToAddress.cpp
M source/Target/ThreadPlan.cpp
M source/Target/ThreadPlanCallFunction.cpp
M source/Target/ThreadPlanStepOverRange.cpp
M source/Target/ThreadList.cpp
M source/Target/ThreadPlanStepOut.cpp
M source/Target/Thread.cpp
M source/Target/ThreadPlanBase.cpp
M source/Target/ThreadPlanStepThrough.cpp
M source/Target/ThreadPlanStepInstruction.cpp
M source/Target/ThreadPlanStepInRange.cpp
M source/Target/ThreadPlanStepOverBreakpoint.cpp
M source/Target/ThreadPlanStepUntil.cpp
M lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181381 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.cpp
5f0bc2bb48344df5f4028e9f1b6fade8ea4515a7 04-May-2013 Jim Ingham <jingham@apple.com> Don't check the private state in DoOnRemoval, check whether THIS event caused a restart.

rdar://problem/13788593


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
5fbfb910d2aa7b0c011f077390880235ee808685 04-May-2013 Greg Clayton <gclayton@apple.com> Clear up any deadlocks on Apple builds that were due to the lldb_private::Process.m_private_run_lock variable.

If someone on Linux and/or FreeBSD can try to comment out the " #if defined(__APPLE__)" that surrounds access to "m_private_run_lock" and run the test suite, that would be nice. The new location where the locking/unlocking happens is bulletproof on MacOSX, and I want to verify that it is good on linux as well.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
a0fbd4678915fa07d03ad3bede2342acdbdbf8e7 02-May-2013 Greg Clayton <gclayton@apple.com> Return zero when we don't support the byte size. Previously is we were asked to read 3, 5, 6, or 7 byte integers, we would set the error, but still return that we read that number of bytes without populating the scalar.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
f408e9936f76a170a9d32813fd04b85993da1495 02-May-2013 Sean Callanan <scallanan@apple.com> Fixed Process::ReadScalarIntegerFromMemory()
to report proper errors when the size is not
correct.

<rdar://problem/13784456>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
68899dab013af7381cf09f8d82b9e4454277941b 25-Apr-2013 Jim Ingham <jingham@apple.com> In Process::ProcessEventData::DoOnRemoval, we need to handle the case where NO thread has a stop reason
specially, and make sure we stop. This shouldn't happen, but if it does, the user will probably want to
see it.

<rdar://problem/13273125>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
d387b462eecb908af265ecc7006781b4532073ad 19-Apr-2013 Greg Clayton <gclayton@apple.com> Fixed some linux buildbot warnings.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
347d722127cc6a19b077244305c3d350ea4ef80e 19-Apr-2013 Ashok Thirumurthi <ashok.thirumurthi@intel.com> Provided a variant of ReadCStringFromMemory that supports null terminators of any character width.
This prevents unbounded reads (i.e. reads of GetMaximumSizeOfStringSummary() bytes)
from causing test failures (i.e. due to ptrace EIO or EFAULT on Linux).

Note that ReadCStringFromMemory is marked as deprecated because the loop that calls
ReadMemory does not continue until the string has been completely read.
The expected behavior is to read until until max_bytes or a null terminator.

Note: As discussed on lldb-dev, further testing will be performed with ReadStringFromMemory
before further changes are made for users of ReadCStringFromMemory.

Thanks to Enrico, Matt and Andy for their review feedback.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179857 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
061ca65c4b666f8352ba08700ca4e5fa71ebb4a9 18-Apr-2013 Greg Clayton <gclayton@apple.com> Re-enable m_private_run_lock changes from 179329, but only for Apple hosted builds so it doesn't break the buildbots. We will try and work the issues out in the Apple build before enabling this feature for everyone.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6b47bca0e0472439b9c69fb16b9c6a3bcfbe783b 18-Apr-2013 Ashok Thirumurthi <ashok.thirumurthi@intel.com> Revert of r179378 and r179329, which introduce a private thread lock around thread enumeration,
in order to prevent consistent hangs on all 3 LLDB buildbots.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179759 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
b3381b7cd7baf1fe7b1c2c540eaf3653107e2836 18-Apr-2013 Greg Clayton <gclayton@apple.com> Fixed a few m_private_run_lock issues when attaching and also fixed the process to not try to restart the process if the process is exited, crashed or detached. Partial patch from Carlo Kok.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9acf3699d2bea583b45c762f4cd82b2a4af6131b 12-Apr-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13491977>

Made some fixes to the OperatingSystemPython class:
- If any thread dictionary contains any "core=N" key/value pairs then the threads obtained from the lldb_private::Process itself will be placed inside the ThreadMemory threads and will be used to get the information for a thread.
- Cleaned up all the places where a thread inside a thread was causing problems



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179405 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
0e7cff415ada6e6dc45b32b51516bca39eb69e38 12-Apr-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13370286>

Fixed a case there the OperatingSystemPython would try to access and play with SBValue objects when the process' public run lock was taken. Prior to this fix, all attempts to run any SBValue functions would fail if run from the private state thread (like updating the thread list). Now we have two run locks, one for public (all threads except the private state thread) and one for private.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179329 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
700ff7ea54b2808112a521f51dc8ecb5a7f8d5ea 06-Apr-2013 Jim Ingham <jingham@apple.com> Don't call DisableBreakpointSite (i.e. don't try to remove the breakpoint from the target process) if the target
process is no longer alive.

<rdar://problem/13320991>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
698194cf1a87cda520c74f45bb191d9fc7fdc6d9 28-Mar-2013 Jim Ingham <jingham@apple.com> RunThreadPlan should make sure the plan passed in is valid before running it.

<rdar://problem/13485541>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178202 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
1d9c802d12647830b1a9dc037d731d7da0009a13 05-Mar-2013 Jason Molenda <jmolenda@apple.com> Fix ivar ordering for Process ctor to match the order they're
declared in the .h file.


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

<rdar://problem/13308627>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
fe21d4f351f560921e615a6677afe1c057aa7f28 22-Feb-2013 Matt Kopec <Matt.Kopec@intel.com> Fix clang warnings related to python macro redefinition and printf format specifiers.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175829 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9da225f5634046120475ca2af89d08b09e3747a8 20-Feb-2013 Jim Ingham <jingham@apple.com> If RunThreadPlan is called on a thread that doesn't have a selected frame, select frame 0.

<rdar://problem/13093321>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175573 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
68bd76ffe3cfc53b363d4dd1e8a6b58e07d30fce 14-Feb-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13200878>

When launching in the shell, make sure if you specify a relative path, and if the current working directory has a space in it, that we don't hose the shell invocation.

Currently if we launch with a relative path, we prepend the current working directory to the PATH using:

PATH=`cwd`:$PATH a.out ...

We needed to add quotes around the value for PATH to make sure if any paths in PATH contained spaces, that we don't hose the shell command. Now we do a:

PATH="`cwd`:$PATH" a.out ...




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
89e248f04ecb87d0df4a4b96158c3fac0a3e43c7 09-Feb-2013 Jim Ingham <jingham@apple.com> Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction interoperate to fix problems where
hitting auto-continue signals while running a thread plan would cause us to lose control of the debug
session.

<rdar://problem/12993641>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
2ddb2b8aed6d43665c6955255f6a077574a08412 01-Feb-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13092722>

Fix in loading mach files from memory when using DynamicLoaderMacOSXDYLD.

Removed the uuid mismatch warning that could be spit out and any time during debugging and removed the test case that was looking for that. Currently the "add-dsym" or "target symbols add" command will report an error when the UUID's don't match.

Be more careful when checking and resolving section + offset addresses to make sure none of the base addresses are invalid.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
46be7f2e4321966f22385fafa82bbb67ebd32232 31-Jan-2013 Jim Ingham <jingham@apple.com> Change the default behavior for unwinding and breakpoints when running expressions.

<rdar://problem/13121442>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
090f83176695d86197b0e86b67dee4160ec5003d 26-Jan-2013 Jim Ingham <jingham@apple.com> Add "target.process.stop-on-shared-library-events" setting, and make it work.
Add the ability to give breakpoints a "kind" string, and have the StopInfoBreakpoint
print that in the brief description if set. Also print the kind - if set - in the breakpoint
listing.
Give kinds to a bunch of the internal breakpoints.
We were deleting the Mac OS X dynamic loader breakpoint as though the id we had stored away was
a breakpoint site ID, but in fact it was a breakpoint id, so we never actually deleted it. Fixed that.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173555 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
52ebc0aab1fdecb634801deceeddd71a14c2148c 19-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13010007>

Added the ability for OS plug-ins to lazily populate the thread this. The python OS plug-in classes can now implement the following method:

class OperatingSystemPlugin:
def create_thread(self, tid, context):
# Return a dictionary for a new thread to create it on demand

This will add a new thread to the thread list if it doesn't already exist. The example code in lldb/examples/python/operating_system.py has been updated to show how this call us used.

Cleaned up the code in PythonDataObjects.cpp/h:
- renamed all classes that started with PythonData* to be Python*.
- renamed PythonArray to PythonList. Cleaned up the code to use inheritance where
- Centralized the code that does ref counting in the PythonObject class to a single function.
- Made the "bool PythonObject::Reset(PyObject *)" function be virtual so each subclass can correctly check to ensure a PyObject is of the right type before adopting the object.
- Cleaned up all APIs and added new constructors for the Python* classes to they can all construct form:
- PyObject *
- const PythonObject &
- const lldb::ScriptInterpreterObjectSP &

Cleaned up code in ScriptInterpreterPython:
- Made calling python functions safer by templatizing the production of value formats. Python specifies the value formats based on built in C types (long, long long, etc), and code often uses typedefs for uint32_t, uint64_t, etc when passing arguments down to python. We will now always produce correct value formats as the templatized code will "do the right thing" all the time.
- Fixed issues with the ScriptInterpreterPython::Locker where entering the session and leaving the session had a bunch of issues that could cause the "lldb" module globals lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame to not be initialized.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
8170de626a2230d18795fe966a2c6530cb4623cf 16-Jan-2013 Greg Clayton <gclayton@apple.com> Removed unused variable.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
64742744396c966e8de770e765130629b0c78335 16-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13009943>

Added a unique integer identifier to processes. Some systems, like JTAG or other simulators, might always assign the same process ID (pid) to the processes that are being debugged. In order for scripts and the APIs to uniquely identify the processes, there needs to be another ID. Now the SBProcess class has:

uint32_t SBProcess::GetUniqueID();

This integer ID will help to truly uniquely identify a process and help with appropriate caching that can be associated with a SBProcess object.





git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
b794020ffbd6473c59a6e98be044df50abf7fc30 15-Jan-2013 Jim Ingham <jingham@apple.com> Separated the "expr --unwind-on-error" behavior into two parts, actual errors (i.e. crashes) which continue to be
controlled by the --unwind-on-error flag, and --ignore-breakpoint which separately controls behavior when a called
function hits a breakpoint. For breakpoints, we don't unwind, we either stop, or ignore the breakpoint, which makes
more sense.
Also make both these behaviors globally settable through "settings set".
Also handle the case where a breakpoint command calls code that ends up re-hitting the breakpoint. We were recursing
and crashing. Now we just stop without calling the second command.

<rdar://problem/12986644>
<rdar://problem/9119325>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
aad2b0f2e5da0ecbf22ab7fead4c06671f64c6c5 11-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/12990038>

Fixed an issue where the platform auto select code was changing the architecture and causing the wrong architecture to be assigned to the target.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
b6059b2b562c6bfeaa4288ad127aad670cff852c 13-Dec-2012 Jim Ingham <jingham@apple.com> Fixed a thinko in the handling of the case where more than one thread had stopped with real stop reasons at the same time.
Should be that if any of the threads wants to stop, we should stop. The opposite was what was actually happening

<rdar://problem/12869725>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
40e278caddf5442776f9408f20d757cc85fe630a 13-Dec-2012 Sean Callanan <scallanan@apple.com> Removed the == and != operators from ArchSpec, since
equality can be strict or loose and we want code to
explicitly choose one or the other.

Also renamed the Compare function to IsEqualTo, to
avoid confusion.

<rdar://problem/12856749>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
d35b7b3bfd21f4fd6b048693563eef1b772ae197 07-Dec-2012 Daniel Malea <daniel.malea@intel.com> More Linux warnings fixes (remove default labels as needed):
- as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations

Patch by Matt Kopec!




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169633 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
6475c42148a8ea1ca86e5db465db7eca742d897d 04-Dec-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12798131>

Cleaned up the option parsing code to always pass around the short options as integers. Previously we cast this down to "char" and lost some information. I recently added an assert that would detect duplicate short character options which was firing during the test suite.

This fix does the following:
- make sure all short options are treated as "int"
- make sure that short options can be non-printable values when a short option is not required or when an option group is mixed into many commands and a short option is not desired
- fix the help printing to "do the right thing" in all cases. Previously if there were duplicate short character options, it would just not emit help for the duplicates
- fix option parsing when there are duplicates to parse options correctly. Previously the option parsing, when done for an OptionGroup, would just start parsing options incorrectly by omitting table entries and it would end up setting the wrong option value



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
f14269add7f6fb84da7ccfd866f8e9f7e81068be 29-Nov-2012 Han Ming Ong <hanming@apple.com> <rdar://problem/12780259>

Prevent async and sync calls to get profile data from stomping on each other.
At the same time, don't use '$' as end delimiter per chunk of profile data.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
507a638609d962bf330c4ec08ee6c381ffd8695e 29-Nov-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12655594>

Be sure to resolve the file path for the "target.process.python-os-plugin-path" setting.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
dacdc0156a2b548a19110cd63b800331cd512032 29-Nov-2012 Jim Ingham <jingham@apple.com> Add an example of using the target.process.extra-startup-command to turn on debugserver logging since
we always forget how to do this...


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
76b258db0611dad2f5b5ae51721a4bc0abd580ae 27-Nov-2012 Jim Ingham <jingham@apple.com> The Function calling thread plan was replacing the stored stop info too soon, causing recursive entry into the
breakpoint StopInfo's PerformAction, which is bad. Reworked this so that it is now correct.

<rdar://problem/12501259>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
559cf6e8b52b940f5f4362b32d628838d6301e2e 17-Nov-2012 Jason Molenda <jmolenda@apple.com> Han Ming's commit in r168228 had a bunch of 4-space tabs
in the source files. Expand to spaces. No content changes,
just whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
2529aa356e8cf9c1395da46f66ea2518dfa1982d 17-Nov-2012 Han Ming Ong <hanming@apple.com> Follow up on <rdar://12720514>. Removed commented out code.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
fb9cee64303d36d6fe5d87e63dd8701d1ddb70a9 17-Nov-2012 Han Ming Ong <hanming@apple.com> <rdar://problem/12720514> Sub-TLF: Provide service to profile the inferior

This allows client to query profiling states on the inferior.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168228 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
146d9522c95c0c8c5409539813b55e08b99196ee 08-Nov-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12586350>

This commit does three things:
(a) introduces a new notification model for adding/removing/changing modules to a ModuleList, and applies it to the Target's ModuleList, so that we make sure to always trigger the right set of actions
whenever modules come and go in a target. Certain spots in the code still need to "manually" notify the Target for several reasons, so this is a work in progress
(b) adds a new capability to the Platforms: locating a scripting resources associated to a module. A scripting resource is a Python file that can load commands, formatters, ... and any other action
of interest corresponding to the loading of a module. At the moment, this is only implemented on Mac OS X and only for files inside .dSYM bundles - the next step is going to be letting
the frameworks themselves hold their scripting resources. Implementors of platforms for other systems are free to implement "the right thing" for their own worlds
(c) hooking up items (a) and (b) so that targets auto-load the scripting resources as the corresponding modules get loaded in a target. This has a few caveats at the moment:
- the user needs to manually add the .py file to the dSYM (soon, it will also work in the framework itself)
- if two modules with the same name show up during the lifetime of an LLDB session, the second one won't be able to load its scripting resource, but will otherwise work just fine



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167569 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
34507e41794909465d168af4048ebd07ee7819e8 31-Oct-2012 Greg Clayton <gclayton@apple.com> Carlo Kok found an issue where default parameters were causing the wrong argument to be passed. I got rid of the default args so we don't run into this.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
843327854a86a1d44f03b838767575ccba8bb77a 29-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12500785>

I tracked down a leak that could happen when detaching from a process where the lldb_private::Process objects would stay around forever. This was caused by a eStateDetached event that was queued up on the lldb_private::Process private state thread listener. Since process events contain shared pointers to the process, this is dangerous if they don't get consume or cleared as having the lldb_private::Process class contain a collection of things that have a shared pointer to yourself is obviously bad.

To fix this I modified the Process::Finalize() function to clear this list. The actual thing that was holding onto the ModuleSP and thus the static archive, was a stack frame. Since the process wasn't going away, it still had thread objects and they still had frames. I modified the Thread::Destroy() to clear the stack frames to ensure this further doesn't happen.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9a91ef68c2650113da5488e09e9cb5f6aa88f6ab 24-Oct-2012 Sean Callanan <scallanan@apple.com> This is a fix for the command option parser.

There was a generic catch-all type for path arguments
called "eArgTypePath," and a specialized version
called "eArgTypeFilename." It turns out all the
cases where we used eArgTypePath we could have
used Filename or we explicitly meant a directory.

I changed Path to DirectoryName, made it use the
directory completer, and rationalized the uses of
Path.

<rdar://problem/12559915>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
2e7f313dc473b036788319690116b324cb44b765 19-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12491420>

Added a new setting that allows a python OS plug-in to detect threads and provide registers for memory threads. To enable this you set the setting:

settings set target.process.python-os-plugin-path lldb/examples/python/operating_system.py

Then run your program and see the extra threads.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
0c8446cc220c429fb51f8f9864275c8b1c768533 18-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12462048>

LLDB changes argv[0] when debugging a symlink. Now we have the notion of argv0 in the target settings:

target.arg0 (string) =

There is also the program argument that are separate from the first argument that have existed for a while:

target.run-args (arguments) =

When running "target create <exe>", we will place the untouched "<exe>" into target.arg0 to ensure when we run, we run with what the user typed. This has been added to the ProcessLaunchInfo and all other needed places so we always carry around the:
- resolved executable path
- argv0
- program args

Some systems may not support separating argv0 from the resolved executable path and the ProcessLaunchInfo needs to carry all of this information along so that each platform can make that decision.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
47beabb1386be44e3f90dbc30a0b22c23b93a4dc 16-Oct-2012 Jim Ingham <jingham@apple.com> Add the ability to set timeout & "run all threads" options both from the "expr" command and from
the SB API's that evaluate expressions.

<rdar://problem/12457211>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6bc24c10080b624a2782e6e42f683e5d65c6903c 16-Oct-2012 Jim Ingham <jingham@apple.com> Patch from Matt Kopec <matt.kopec@intel.com> to fix the problem that if two breakpoints were set on consecutive addresses, the continue from the
first breakpoint would skip the second.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
d34a3b23c8a90f7c32cbb0b7a9e4899bfb7ff53c 12-Oct-2012 Greg Clayton <gclayton@apple.com> Modified patch from Matt Kopec that makes sure the run lock is acquired when attaching and makes sure the pid is being set on linux in the process info.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
bf41e19c78f0c84671d21eadec3954ab6db550c1 05-Oct-2012 Jason Molenda <jmolenda@apple.com> Ran the sources through the compiler with -Wshadow warnings
enabled after we'd found a few bugs that were caused by shadowed
local variables; the most important issue this turned up was
a common mistake of trying to obtain a mutex lock for the scope
of a code block by doing

Mutex::Locker(m_map_mutex);

This doesn't assign the lock object to a local variable; it is
a temporary that has its dtor called immediately. Instead,

Mutex::Locker locker(m_map_mutex);

does what is intended. For some reason -Wshadow happened to
highlight these as shadowed variables.

I also fixed a few obivous and easy shadowed variable issues
across the code base but there are a couple dozen more that
should be fixed when someone has a free minute.
<rdar://problem/12437585>




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165269 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
bb1af9ce3e25eae9916f85cb9a0c82e291c20bb4 11-Sep-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11935492>

Fixed an issue where if we call "Process::Destroy()" and the process is running, if we try to stop it and get "exited" back as the stop reason, we will still deliver the exited event.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
b9950593807dad072c9cab77f2b84cb0e8004ffe 10-Sep-2012 Jim Ingham <jingham@apple.com> Fixed a few places where we were doing:

uint32_t size = ThreadList.GetSize();
for (i=0; i < size; ++i)

without grabbing the thread list mutex.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
e1a654b5237df6f282f56ecae3279b6271e125dc 06-Sep-2012 Jim Ingham <jingham@apple.com> Include a useful bit of log output in the "step" as well as the "process" logs.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
8290bba24800aeb9c1588ae7b81932feef8786c1 05-Sep-2012 Jim Ingham <jingham@apple.com> If the ThreadList ShouldStop restarts the target, don't resume it again.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
38ae5b92d135877de7de36aa5171b7700f928f94 05-Sep-2012 Greg Clayton <gclayton@apple.com> Fix the log channel used in Process.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
777c6b7bf6ee77604942de17fc19c0421603fbe1 04-Sep-2012 Greg Clayton <gclayton@apple.com> Modified patch from Matt Kopec that fixes a process launch issue on linux where we wouldn't acquire the process run lock.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
0c8fa2d7dd18ae1816c82846234c45f79142e3df 01-Sep-2012 Jim Ingham <jingham@apple.com> Initial check-in of "fancy" inlined stepping. Doesn't do anything useful unless you switch LLDB_FANCY_INLINED_STEPPING to true. With that
on, basic inlined stepping works, including step-over of inlined functions. But for some as yet mysterious reason i386 debugging gets an
assert and dies immediately. So for now its off.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163044 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
d0bdddff8bc6dd5f71492452ce2bbd72fdaa147b 22-Aug-2012 Jim Ingham <jingham@apple.com> Rework how the API mutex is acquired when filling out an ExecutionContext from an ExecutionContextRef,
particularly in the SBThread & SBFrame interfaces. Instead of filling the whole context & then getting
the API mutex, we now get only the target, acquire the API mutex from it, then fill out the rest of the
context. This removes a race condition where you get a ThreadSP, then wait on the API mutex while another
command Destroy's the Thread you've just gotten.
Also fixed the ExecutionContextRef::Get*SP calls so they don't return invalid objects.
Also fixed the ExecutionContext::Has*Scope calls so they don't claim to have a scope if the object representing
that scope has been destroyed.
Also fixed a think-o in Thread::IsValid which was causing it to return the opposite of the desired value.

<rdar://problem/11995490>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c6e82e4a323d7a7168b05365c53c9bc2e0d418e3 22-Aug-2012 Greg Clayton <gclayton@apple.com> Remove further outdated "settings" code and also implement a few missing things.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
73844aa19a7360b662e2be710fc3c969d6c86606 22-Aug-2012 Greg Clayton <gclayton@apple.com> Reimplemented the code that backed the "settings" in lldb. There were many issues with the previous implementation:
- no setting auto completion
- very manual and error prone way of getting/setting variables
- tons of code duplication
- useless instance names for processes, threads

Now settings can easily be defined like option values. The new settings makes use of the "OptionValue" classes so we can re-use the option value code that we use to set settings in command options. No more instances, just "does the right thing".



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
b386d82334b65fb984348f2027b1cb7714de993f 09-Aug-2012 Sean Callanan <scallanan@apple.com> Removed explicit NULL checks for shared pointers
and instead made us use implicit casts to bool.
This generated a warning in C++11.

<rdar://problem/11930775>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
96abc62dcb25159dbb532e477ba2cf6d85b81700 08-Aug-2012 Sean Callanan <scallanan@apple.com> Added a 'void' format so that the user can manually
suppress all non-error output from the "expression"
command.

<rdar://problem/11225150>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.cpp
6cca9695637b27bd583eaae310d5c09dede7cc49 17-Jul-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11672978> Fixing an issue where an ObjC object might come out without a description because the expression used to obtain it would timeout before running to completion

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
5b0a5ac06d3be8ca483ac214930126234ad3f99f 11-Jul-2012 Sean Callanan <scallanan@apple.com> Fixed a bug that caused the Process not to rebroadcast
the fact that a process exited while running a thread
plan. For example, if a user types the expression

expr (void)exit(0)

then the process terminates but LLDB does not notify
listeners like Xcode that this occurred.

<rdar://problem/11845155>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
f90b5f34b87e0c1354b4d6f3d24830e69a2949a0 08-Jun-2012 Sean Callanan <scallanan@apple.com> Added a setting (target.process.disable-memory-cache)
that controls whether memory is cached. This is off
by default (i.e., memory is cached) because it greatly
improves performance.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158173 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
4389256aecd2693109969c21fa2f00c4612320b3 06-Jun-2012 Jim Ingham <jingham@apple.com> Make sure that when if we are going to Halt while the process is in the middle of HandlePrivateEvent we
wait till that is done. We need a stronger way to do this, but in practice this works and using some locking
strategy is harder because Halt & HandlePrivateEvent generally happen on different threads.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
a3772860a8d4ba6472e8a3c77c85b925ca454556 02-Jun-2012 Sean Callanan <scallanan@apple.com> Fixed a problem where detaching from a process
left a read-write lock dangling, causing crashes
in debug builds.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9336790a758b8f8b87d95e6658bb8fdb34766c2f 30-May-2012 Jim Ingham <jingham@apple.com> We were accessing the ModuleList in the target without locking it for tasks like
setting breakpoints. That's dangerous, since while we are setting a breakpoint,
the target might hit the dyld load notification, and start removing modules from
the list. This change adds a GetMutex accessor to the ModuleList class, and
uses it whenever we are accessing the target's ModuleList (as returned by GetImages().)

<rdar://problem/11552372>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
f4928de7bfe2b292b98f97fbf3789b80564755e7 23-May-2012 Jim Ingham <jingham@apple.com> Process::Destroy should Halt before it tries to destroy so we don't have race conditions where we are in the middle of trying to service an event when we go to Destroy.
The AttachCompletionHandler should note that it has restarted the target if it indeed does so.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6b1763b5ab8f182029807293d74a66e1e1c6bafd 21-May-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11355592> Fixing a bug where we would incorrectly try and determine a dynamic type for a variable of a pointer type that is not a valid generic type for dynamic pointers.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
eeeb2afb11f0726a7990101e2d55aa470118dec4 19-May-2012 Greg Clayton <gclayton@apple.com> Forgot to bump the local string buffer up in size after debugging to make sure long strings would be correctly read when the buffer is too small for the string.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
dd29b97f71187509df339596c3397dea0e429754 19-May-2012 Greg Clayton <gclayton@apple.com> Found a quick way to improve the speed with which we can read object files from memory when they are in the shared cache: always read the symbol table strings from memory and let the process' memory cache do the work.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
cf5927ee246f5e431162f2753ed9e040dd060fe5 18-May-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11386214>
<rdar://problem/11455913>

"target symbol add" should flush the cached frames
"register write" should flush the thread state in case registers modifications change stack




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
f63f2ba42b9db6fa1a2c3e8d4536d61c2d4ee2d7 16-May-2012 Jim Ingham <jingham@apple.com> Always call RefreshStateAfterStop when we get a stop event. We were skipping doing it in the case where we had interrupted the target. Presumably at some point in the past RefreshStateAfterStop was done more directly when we handled the interrupt, but it isn't any more so now we need to do it all the time.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
027aaa74a914823ab4c9cf8f3274d179e97fdb53 19-Apr-2012 Jim Ingham <jingham@apple.com> Switch to setting the write side of the run lock when we call Resume. Then make a PrivateResume that doesn't switch the run-lock state, and use that where we are resuming without changing the public resume state.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155092 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
77d40710a275d2b7e68fe005391f77801b9cd480 18-Apr-2012 Greg Clayton <gclayton@apple.com> Make sure an error is returned when Process::LoadImage() fails.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
97471184b8823c949bc68bbf54ea3edf3845a750 14-Apr-2012 Greg Clayton <gclayton@apple.com> Added a new host function that allows us to run shell command and get the output from them along with the status and signal:

Error
Host::RunShellCommand (const char *command,
const char *working_dir,
int *status_ptr,
int *signo_ptr,
std::string *command_output_ptr,
uint32_t timeout_sec);

This will allow us to use this functionality in the host lldb_private::Platform, and also use it in our lldb-platform binary. It leverages the existing code in Host::LaunchProcess and ProcessLaunchInfo.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
f641af3c2ff03ba3c0b1cee0a02a1b051f5e6ebc 14-Apr-2012 Jim Ingham <jingham@apple.com> The run all threads timeout in RunThreadPlan should respect the user timeout, not be arbitrarily 10 seconds (which was too long anyway...)
Also added some logging to RunThreadPlan and made others more regular.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154708 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
d21d98b3cd51d9109631ad1605ee7f7dbac3cfbb 10-Apr-2012 Jim Ingham <jingham@apple.com> Two changes,

1) Start the PrivateStateThread stopped, and then in
StartPrivateStateThread, make the private state thread and then
resume it before we say the thread is created. That way we know it is
listening for events by the time we get out of
StartPrivateStateThread.

2) Backstop running a thread plan when calling Process::RunThreadPlan
on the private state thread with a ThreadPlanBase so that running the
plan doesn't pass its stop events to whatever plans happen to be above
us on the thread plan stack.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
1831e78a6253392fca1c99e555e7adaa3f372647 07-Apr-2012 Jim Ingham <jingham@apple.com> We sometimes need to be able to call functions (via Process::RunThreadPlan) from code run on the private state thread. To do that we have to
spin up a temporary "private state thread" that will respond to events from the lower level process plugins. This check-in should work to do
that, but it is still buggy. However, if you don't call functions on the private state thread, these changes make no difference.

This patch also moves the code in the AppleObjCRuntime step-through-trampoline handler that might call functions (in the case where the debug
server doesn't support the memory allocate/deallocate packet) out to a safe place to do that call.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154230 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
ce96dad5ccafe2cb3899c4dd2d724ccacb4c2e46 06-Apr-2012 Bill Wendling <isanbard@gmail.com> Order ivar initializers to how they're declared in the class.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
a894fe78bc15344a0025c1154e414c554ab31dd9 05-Apr-2012 Greg Clayton <gclayton@apple.com> Added a new Host class: ReadWriteLock

This abstracts read/write locks on the current host system. It is currently backed by pthread_rwlock_t objects so it should work on all unix systems.

We also need a way to control multi-threaded access to the process through the public API when it is running. For example it isn't a good idea to try and get stack frames while the process is running. To implement this, the lldb_private::Process class now contains a ReadWriteLock member variable named m_run_lock which is used to control the public process state. The public process state represents the state of the process as the client knows it. The private is used to control the actual current process state. So the public state of the process can be stopped, yet the private state can be running when evaluating an expression for example.

Adding the read/write lock where readers are clients that want the process to stay stopped, and writers are clients that run the process, allows us to accurately control multi-threaded access to the process.

Switched the SBThread and SBFrame over to us shared pointers to the ExecutionContextRef class instead of making their own class to track this. This fixed an issue with assigning on SBFrame to another and will also centralize the code that tracks weak references to execution context objects into one location.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
e31176627725f4236c9ca049edc027756709780b 10-Mar-2012 Jim Ingham <jingham@apple.com> Fix the process of getting the ObjC runtime - if we ask for it too early (in the process of handling the
load notification for the first load) then we will set it the runtime to NULL and won't re-search for it.
Added a way for the dynamic loader to force a re-search, since it knows the world has changed.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
95ec1688db0efe51509ad9356052f5004d8856e0 06-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10840355>

Fixed STDERR to not be opened as readable. Also cleaned up some of the code that implemented the file actions as some of the code was using the wrong variables, they now use the right ones (in for stdin, out for stdout, err for stderr).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
6c5438bf1d7af0f0ef1e81a30ad53e3fe93c35a8 24-Feb-2012 Greg Clayton <gclayton@apple.com> Fixed a crasher that was happening after making ObjectFile objects have a
weak reference back to the Module. We were crashing when trying to make a
memory object file since it was trying to get the object in the Module
constructor before the "Module *" had been put into a shared pointer, and the
module was trying to initialize a weak pointer back to it.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
761133029ba2d5bb0c21c3a871dede340b2775fc 22-Feb-2012 Greg Clayton <gclayton@apple.com> For stepping performance I added the ability to outlaw all memory accesseses
to the __PAGEZERO segment on darwin. The dynamic loader now correctly doesn't
slide __PAGEZERO and it also registers it as an invalid region of memory. This
allows us to not make any memory requests from the local or remote debug session
for any addresses in this region. Stepping performance can improve when uninitialized
local variables that point to locations in __PAGEZERO are attempted to be read
from memory as we won't even make the memory read or write request.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
289afcb5e26c2527a0d2e71f84e780b86bbcf90a 18-Feb-2012 Greg Clayton <gclayton@apple.com> The second part in thread hardening the internals of LLDB where we make
the lldb_private::StackFrame objects hold onto a weak pointer to the thread
object. The lldb_private::StackFrame objects the the most volatile objects
we have as when we are doing single stepping, frames can often get lost or
thrown away, only to be re-created as another object that still refers to the
same frame. We have another bug tracking that. But we need to be able to
have frames no longer be able to get the thread when they are not part of
a thread anymore, and this is the first step (this fix makes that possible
but doesn't implement it yet).

Also changed lldb_private::ExecutionContextScope to return shared pointers to
all objects in the execution context to further thread harden the internals.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
04200f6251401ccf3d07b09b5c4d29006cdf1cfa 14-Feb-2012 Sean Callanan <scallanan@apple.com> Only allow expressions to use the JIT if memory
can be allocated in the process.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9ce953807eb814a93b449dc243de4f7bf32c3115 14-Feb-2012 Greg Clayton <gclayton@apple.com> Full core file support has been added for mach-o core files.

Tracking modules down when you have a UUID and a path has been improved.

DynamicLoaderDarwinKernel no longer parses mach-o load commands and it
now uses the memory based modules now that we can load modules from memory.

Added a target setting named "target.exec-search-paths" which can be used
to supply a list of directories to use when trying to look for executables.
This allows one or more directories to be used when searching for modules
that may not exist in the SDK/PDK. The target automatically adds the directory
for the main executable to this list so this should help us in tracking down
shared libraries and other binaries.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
b5a8f1498e1ddaeed5187a878d57ea0b74af9c26 05-Feb-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10560053>

Fixed "target modules list" (aliased to "image list") to output more information
by default. Modified the "target modules list" to have a few new options:

"--header" or "-h" => show the image header address
"--offset" or "-o" => show the image header address offset from the address in the file (the slide applied to the shared library)

Removed the "--symfile-basename" or "-S" option, and repurposed it to
"--symfile-unique" "-S" which will show the symbol file if it differs from
the executable file.

ObjectFile's can now be loaded from memory for cases where we don't have the
files cached locally in an SDK or net mounted root. ObjectFileMachO can now
read mach files from memory.

Moved the section data reading code into the ObjectFile so that the object
file can get the section data from Process memory if the file is only in
memory.

lldb_private::Module can now load its object file in a target with a rigid
slide (very common operation for most dynamic linkers) by using:

bool
Module::SetLoadAddress (Target &target, lldb::addr_t offset, bool &changed)

lldb::SBModule() now has a new constructor in the public interface:

SBModule::SBModule (lldb::SBProcess &process, lldb::addr_t header_addr);

This will find an appropriate ObjectFile plug-in to load an image from memory
where the object file header is at "header_addr".




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
334d33a19fd28cf41cba74cc61cf149e7101a603 30-Jan-2012 Greg Clayton <gclayton@apple.com> SBFrame is now threadsafe using some extra tricks. One issue is that stack
frames might go away (the object itself, not the actual logical frame) when
we are single stepping due to the way we currently sometimes end up flushing
frames when stepping in/out/over. They later will come back to life
represented by another object yet they have the same StackID. Now when you get
a lldb::SBFrame object, it will track the frame it is initialized with until
the thread goes away or the StackID no longer exists in the stack for the
thread it was created on. It uses a weak_ptr to both the frame and thread and
also stores the StackID. These three items allow us to determine when the
stack frame object has gone away (the weak_ptr will be NULL) and allows us to
find the correct frame again. In our test suite we had such cases where we
were just getting lucky when something like this happened:

1 - stop at breakpoint
2 - get first frame in thread where we stopped
3 - run an expression that causes the program to JIT and run code
4 - run more expressions on the frame from step 2 which was very very luckily
still around inside a shared pointer, yet, not part of the current
thread (a new stack frame object had appeared with the same stack ID and
depth).

We now avoid all such issues and properly keep up to date, or we start
returning errors when the frame doesn't exist and always responds with
invalid answers.

Also fixed the UserSettingsController (not going to rewrite this just yet)
so that it doesn't crash on shutdown. Using weak_ptr's came in real handy to
track when the master controller has already gone away and this allowed me to
pull out the previous NotifyOwnerIsShuttingDown() patch as it is no longer
needed.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
13d24fb1817faa7ccc4cfd799113ba1a2b8968eb 29-Jan-2012 Greg Clayton <gclayton@apple.com> Switching back to using std::tr1::shared_ptr. We originally switched away
due to RTTI worries since llvm and clang don't use RTTI, but I was able to
switch back with no issues as far as I can tell. Once the RTTI issue wasn't
an issue, we were looking for a way to properly track weak pointers to objects
to solve some of the threading issues we have been running into which naturally
led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared
pointer from just a pointer, which is also easily solved using the
std::tr1::enable_shared_from_this class.

The main reason for this move back is so we can start properly having weak
references to objects. Currently a lldb_private::Thread class has a refrence
to its parent lldb_private::Process. This doesn't work well when we now hand
out a SBThread object that contains a shared pointer to a lldb_private::Thread
as this SBThread can be held onto by external clients and if they end up
using one of these objects we can easily crash.

So the next task is to start adopting std::tr1::weak_ptr where ever it makes
sense which we can do with lldb_private::Debugger, lldb_private::Target,
lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
many more objects now that they are no longer using intrusive ref counted
pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
pointers).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
182be6a8df48d9c22ac6a0a5ad58b962887f4f11 21-Jan-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10732738>

Release more stuff in Process::Destroy().



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
faf0478359a33b892bc778a52accbac1895725e4 05-Jan-2012 Sean Callanan <scallanan@apple.com> Fixed a potential hang while trying to execute
a function in the inferior.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147592 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
daa6efe771f5f068e29328a774fa5bf2358ce14a 21-Dec-2011 Sean Callanan <scallanan@apple.com> The "desired result type" code in the expression
parser has hitherto been an implementation waiting
for a use. I have now tied the '-o' option for
the expression command -- which indicates that the
result is an Objective-C object and needs to be
printed -- to the ExpressionParser, which
communicates the desired type to Clang.

Now, if the result of an expression is determined
by an Objective-C method call for which there is
no type information, that result is implicitly
cast to id if and only if the -o option is passed
to the expression command. (Otherwise if there
is no explicit cast Clang will issue an error.
This behavior is identical to what happened before
r146756.)

Also added a testcase for -o enabled and disabled.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
4a2e33769873d68d5703da5742c0e248f46e3a72 15-Dec-2011 Greg Clayton <gclayton@apple.com> Expose new read memory fucntion through python in SBProcess:

size_t
SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);

uint64_t
SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);

lldb::addr_t
SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &error);

These ReadCStringFromMemory() has some SWIG type magic that makes it return the
python string directly and the "buf" is not needed:

error = SBError()
max_cstr_len = 256
cstr = lldb.process.ReadCStringFromMemory (0x1000, max_cstr_len, error)
if error.Success():
....

The other two functions behave as expteced. This will make it easier to get integer values
from the inferior process that are correctly byte swapped. Also for pointers, the correct
pointer byte size will be used.

Also cleaned up a few printf style warnings for the 32 bit lldb build on darwin.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
60526c438ed8c41f54e4b76fc008c99ff4b9da17 01-Dec-2011 Jim Ingham <jingham@apple.com> Protect a few log->Printf calls with "if (log)"...


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
0963fdd2478c6404d11b96e7d5ae1f2de8b3bb1f 18-Nov-2011 Greg Clayton <gclayton@apple.com> Looking at our memory usage with Instruments when debugging a large application
we say that the vectors of DWARFDebugInfoEntry objects were the highest on the
the list.

With these changes we cut our memory usage by 40%!!! I did this by reducing
the size of the DWARFDebugInfoEntry from a previous:

uint32_t offset
uint32_t parent_idx
uint32_t sibling_idx
Abbrev * abbrev_ptr

which was 20 bytes, but rounded up to 24 bytes due to alignment. Now we have:

uint32_t offset
uint32_t parent_idx
uint32_t sibling_idx
uint32_t abbr_idx:15, // 32767 possible abbreviation codes
has_children:1, // 0 = no children, 1 = has children
tag:16; // DW_TAG_XXX value

This gets us down to 16 bytes per DIE. I tested some VERY large DWARF files
(900MB) and found there were only ~700 unique abbreviations, so 32767 should
be enough for any sane compiler. If it isn't there are built in assertions
that will fire off and tell us.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
202060806d75f812b56a3cfa70d85fff536e5c2f 17-Nov-2011 Greg Clayton <gclayton@apple.com> Fixed an issue with the pthread_setspecific() where we weren't NULL-ing out
the thread specific data and were destroying the thread specfic data more
than once.

Also added the ability to ask a lldb::StateType if it is stopped with an
additional paramter of "must_exist" which means that the state must be a
stopped state for a process that still exists. This means that eStateExited
and eStateUnloaded will no longer return true if "must_exist" is set to true.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
527154d8e532f27f25af226c9e1dac607c48b5d1 15-Nov-2011 Greg Clayton <gclayton@apple.com> Added a new class to Process.h: ProcessAttachInfo. This class contains enough
info for us to attach by pid, or by name and will also allow us to eventually
do a lot more powerful attaches. If you look at the options for the "platform
process list" command, there are many options which we should be able to
specify. This will allow us to do things like "attach to a process named 'tcsh'
that has a parent process ID of 123", or "attach to a process named 'x' which
has an effective user ID of 345".

I finished up the --shell implementation so that it can be used without the
--tty option in "process launch". The "--shell" option now can take an
optional argument which is the path to the shell to use (or a partial name
like "sh" which we will find using the current PATH environment variable).

Modified the Process::Attach to use the new ProcessAttachInfo as the sole
argument and centralized a lot of code that was in the "process attach"
Execute function so that everyone can take advantage of the powerful new
attach functionality.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
2d9adb73af7520bec430e0585ca40467828e6ed1 12-Nov-2011 Greg Clayton <gclayton@apple.com> Added the ability to run a process in a shell on MacOSX currently when using
the --tty option. So you can now get shell expansion and file redirection:

(lldb) process launch --tty --shell -- *.jpg < in.txt > out.txt

Again, the "--tty" is mandatory for now until we hook this up to other
functions. The shell is also currently hard coded to "/bin/bash" and not the
"SHELL" variable. "/bin/tcsh" was causing problems which I need to dig into.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144443 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
0296fe73a7cb1482226b1303a795ede00e12d677 08-Nov-2011 Jim Ingham <jingham@apple.com> Do a better job of detecting when a breakpoint command has set the target running again (except you have to ignore
cases where the breakpoint runs expressions, those don't count as really "running again").


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
abb3302051246273eb92cca203c9a1b9d9736e05 08-Nov-2011 Greg Clayton <gclayton@apple.com> Moved many of the "settings" that used to be in "target.process.*" to just
be in the target. All of the environment, args, stdin/out/err files, etc have
all been moved. Also re-enabled the ability to launch a process in a separate
terminal on MacOSX.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
5b658cc411e8810073f7f633f3c5d6f177cb3dcd 08-Nov-2011 Sean Callanan <scallanan@apple.com> Added a language parameter to the expression parser,
which will in the future allow expressions to be
compiled as C, C++, and Objective-C instead of the
current default Objective-C++. This feature requires
some additional support from Clang -- specifically, it
requires reference types in the parser regardless of
language -- so it is not yet exposed to the user.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.cpp
567e7f3ba16eb48cb9fd6a2f26f2f7269eb6983c 22-Sep-2011 Greg Clayton <gclayton@apple.com> Converted the lldb_private::Process over to use the intrusive
shared pointers.

Changed the ExecutionContext over to use shared pointers for
the target, process, thread and frame since these objects can
easily go away at any time and any object that was holding onto
an ExecutionContext was running the risk of using a bad object.

Now that the shared pointers for target, process, thread and
frame are just a single pointer (they all use the instrusive
shared pointers) the execution context is much safer and still
the same size.

Made the shared pointers in the the ExecutionContext class protected
and made accessors for all of the various ways to get at the pointers,
references, and shared pointers.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6cf6c474742a23e7cb6b4f618bf1de711db90a85 21-Sep-2011 Sean Callanan <scallanan@apple.com> Fixed a problem where expressions would attempt to
allocate memory in a process that did not support
expression execution. Also improved detection of
whether or not a process can execute expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140202 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
e40b6424d9e49306392bec4b44060da36414c382 18-Sep-2011 Greg Clayton <gclayton@apple.com> Don't put modules for .o files into the global shared module list. We
used to do this because we needed to find the shared pointer for a .o
file when the .o file's module was needed in a SymbolContext since the
module in a symbol context was a shared pointer. Now that we are using
intrusive pointers we don't have this limitation anymore since any
instrusive shared pointer can be made from a pointer to an object
all on its own.

Also switched over to having the Module and SymbolVendor use shared
pointers to their object files as had a leak on MacOSX when the
SymbolVendor's object file wasn't the same as the Module's (debug info
in a stand along file (dSYM file)). Now everything will correctly clean
itself up when the module goes away after an executable gets rebuilt.

Now we correctly get rid of .o files that are used with the DWARF with
debug map executables on subsequent runs since the only shared pointer
to the object files in from the DWARF symbol file debug map parser, and
when the module gets replaced, it destroys to old one along with all .o
files.

Also added a small optimization when using BSD archives where we will
remove old BSD containers from the shared list when they are outdated.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140002 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
987c7ebe1daa425ba7abfa9643800e3237146fc0 17-Sep-2011 Greg Clayton <gclayton@apple.com> Adopt the intrusive pointers in:

lldb_private::Breakpoint
lldb_private::BreakpointLocations
lldb_private::BreakpointSite
lldb_private::Debugger
lldb_private::StackFrame
lldb_private::Thread
lldb_private::Target



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c0c53249938e49e006a982057e9106a97da5ea89 15-Sep-2011 Jim Ingham <jingham@apple.com> Track whether a process was Launched or Attached to. If Attached, the detach when the debugger is destroyed, rather than killing the process. Also added a Debugger::Clear, which gets called in Debugger::Destroy to deal with all the targets in the Debugger. Also made the Driver's main loop call Destroy on the debugger, rather than just Destroying the currently selected Target's process.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
47dc457387b690c5e4df1c0c7dd8c4337b92e630 15-Sep-2011 Sean Callanan <scallanan@apple.com> This patch modifies the expression parser to allow it
to execute expressions even in the absence of a process.
This allows expressions to run in situations where the
target cannot run -- e.g., to perform calculations based
on type information, or to inspect a binary's static
data.

This modification touches the following files:

lldb-private-enumerations.h
Introduce a new enum specifying the policy for
processing an expression. Some expressions should
always be JITted, for example if they are functions
that will be used over and over again. Some
expressions should always be interpreted, for
example if the target is unsafe to run. For most,
it is acceptable to JIT them, but interpretation
is preferable when possible.

Target.[h,cpp]
Have EvaluateExpression now accept the new enum.

ClangExpressionDeclMap.[cpp,h]
Add support for the IR interpreter and also make
the ClangExpressionDeclMap more robust in the
absence of a process.

ClangFunction.[cpp,h]
Add support for the new enum.

IRInterpreter.[cpp,h]
New implementation.

ClangUserExpression.[cpp,h]
Add support for the new enum, and for running
expressions in the absence of a process.

ClangExpression.h
Remove references to the old DWARF-based method
of evaluating expressions, because it has been
superseded for now.

ClangUtilityFunction.[cpp,h]
Add support for the new enum.

ClangExpressionParser.[cpp,h]
Add support for the new enum, remove references
to DWARF, and add support for checking whether
the expression could be evaluated statically.

IRForTarget.[h,cpp]
Add support for the new enum, and add utility
functions to support the interpreter.

IRToDWARF.cpp
Removed

CommandObjectExpression.cpp
Remove references to the obsolete -i option.

Process.cpp
Modify calls to ClangUserExpression::Evaluate
to pass the correct enum (for dlopen/dlclose)

SBValue.cpp
Add support for the new enum.

SBFrame.cpp
Add support for he new enum.

BreakpointOptions.cpp
Add support for the new enum.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
0d7f7775b6e1e7fd957b306828e9537cdb1e27b2 15-Sep-2011 Jim Ingham <jingham@apple.com> Take out all the separate places in Attach where we were getting the target architecture, and move that but of functionality into CompleteAttach.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
72095e8654137c40dcbf246b8cf9f01dd9360f3d 14-Sep-2011 Jim Ingham <jingham@apple.com> If we haven't gotten the architecture of the process we're attaching
to by the time we get to the AttachCompletionHandler, do it before
completing the attach.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
b14ec34165772877c8242f5b15acb116b0d9a9b5 09-Sep-2011 Johnny Chen <johnny.chen@apple.com> Patch from Filipe!

One fixes a trailing comma bug (g++ doesn't like them)
The other gets the Error from the result of an expression evaluation and uses it as the error for the Process::LoadImage() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139336 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
23967773eda67ca32904b15cc80e556dd38266a8 25-Aug-2011 Johnny Chen <johnny.chen@apple.com> Make ThreadList::GetSelectedThread() select and return the 0th thread if there's no
currently selected thread. And update the call sites accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
7bbebaf6b46cd5d504544ad432d06fb989b770f9 13-Aug-2011 Jim Ingham <jingham@apple.com> Remember to restore the frame in the exe_ctx passed in to RunThreadPlan.
Also, default "source_init_file" to False in the version of SBDebugger::Create
so that we don't pick up the init file in Python.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137545 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
f6d3d79f94e1909056bb73322c09120936d08ccf 10-Aug-2011 Jim Ingham <jingham@apple.com> Fix a bunch of places where we were calling log->Printf to put CStrings.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
ed3f86b97e0a84d6ca9bda7eaeff3a12ed353a90 10-Aug-2011 Sean Callanan <scallanan@apple.com> Fixed a potential crash in Process.cpp when we
used a log unchecked.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
21f37ad875d4f50d1b4b3d307e120f6d27103730 09-Aug-2011 Jim Ingham <jingham@apple.com> Move the handling of breakpoint conditions from the Private event loop to the StopInfoBreakpoint::DoActions, which happens as the
event is removed. Also use the return value of asynchronous breakpoint callbacks, they get checked before, and override the
breakpoint conditions.

Added ProcessModInfo class, to unify "stop_id generation" and "memory modification generation", and use where needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
82820f9f021e289431ff3b79e56bd7d88097f327 29-Jun-2011 Jim Ingham <jingham@apple.com> Remove a few more places where we were iterating linearly over the Breakpoint Site's rather than
looking up what we needed by address, which is much faster.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
4985959bb1ce4ce9859cbfdf4c330262d2f250ab 22-Jun-2011 Greg Clayton <gclayton@apple.com> Add a 10 second timeout to ensure that we don't lock up if we never get to the
process entry point.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
e6bd142d9fa7ed149bd37efd8a75637375f165b7 20-Jun-2011 Jim Ingham <jingham@apple.com> Use the dyld_mode, image_infos & image_infos_count passed into the shared library notification function
to update libraries rather than reading the whole all_imaage_infos structure every time we get notified.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
439944614eba902fd4faf2bc9a1d838a4fbf5784 04-Jun-2011 Greg Clayton <gclayton@apple.com> Make sure we are ok to stop in a thread plan and have no stop reason for
the thread we were running on (other thread crashed or had exceptional stop
reason).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132599 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c0fa53324d62a48257c092a3347d6e7236aa3152 23-May-2011 Greg Clayton <gclayton@apple.com> Added new lldb_private::Process memory read/write functions to stop a bunch
of duplicated code from appearing all over LLDB:

lldb::addr_t
Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error);

bool
Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error);

size_t
Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error);

size_t
Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error);

in lldb_private::Process the following functions were renamed:

From:
uint64_t
Process::ReadUnsignedInteger (lldb::addr_t load_addr,
size_t byte_size,
Error &error);

To:
uint64_t
Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr,
size_t byte_size,
uint64_t fail_value,
Error &error);

Cleaned up a lot of code that was manually doing what the above functions do
to use the functions listed above.

Added the ability to get a scalar value as a buffer that can be written down
to a process (byte swapping the Scalar value if needed):

uint32_t
Scalar::GetAsMemoryData (void *dst,
uint32_t dst_len,
lldb::ByteOrder dst_byte_order,
Error &error) const;

The "dst_len" can be smaller that the size of the scalar and the least
significant bytes will be written. "dst_len" can also be larger and the
most significant bytes will be padded with zeroes.

Centralized the code that adds or removes address bits for callable and opcode
addresses into lldb_private::Target:

lldb::addr_t
Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;

lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;

All necessary lldb_private::Address functions now use the target versions so
changes should only need to happen in one place if anything needs updating.

Fixed up a lot of places that were calling :

addr_t
Address::GetLoadAddress(Target*);

to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress()
as needed. There were many places in the breakpoint code where things could
go wrong for ARM if these weren't used.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6cf4d2b31bf208cd6e48d4e37af671ab9b451446 22-May-2011 Jim Ingham <jingham@apple.com> Change the m_update_state to an int, and only trigger the "on removal"
action the second time the event is removed (the first is the internal ->
external transition, the second when it is pulled off the public event
queue, and further times when it is put back because we are faking a
stop reason to hide the expression evaluation stops.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
265ab33ae56209d2bfdc47510a557aa075b2a829 19-May-2011 Greg Clayton <gclayton@apple.com> Moved a lot of simple functions from StoppointLocation.cpp to be inlined in
StoppointLocation.h.

Added a new lldb_private::Address function:

addr_t
Address::GetOpcodeLoadAddress (Target *target) const;

This will strip any special bits from an address to make sure it is suitable
for use in addressing an opcode. Often ARM addresses have an extra bit zero
that can be set to indicate ARM vs Thumb addresses (gotten from return address
registers, or symbol addresses that may be marked up specially). We need to
strip these bits off prior to setting breakpoints, so we can centralized the
place to do this inside the Address class.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
5ab7fba0d0a07add74e542689e51b729a26b7dc5 18-May-2011 Jim Ingham <jingham@apple.com> RunThreadPlan should set the plan to "not private" since it needs that,
and then reset it to the original value when done.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
2370a97fe5bea6fa9d82f40bb34d37d3d3bda317 17-May-2011 Jim Ingham <jingham@apple.com> Fix the error message when an expression evaluation is interrupted by a crash/breakpoint hit to
give the reason for the interrupt. Also make sure it we don't want to unwind from the evaluation
we print something if it is interrupted.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
75906e4ec98af3717e415727a8d663a4e246bb4f 11-May-2011 Greg Clayton <gclayton@apple.com> Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into their
respective ABI plugins as they were plug-ins that supplied ABI specfic info.

Also hookep up the UnwindAssemblyInstEmulation so that it can generate the
unwind plans for ARM.

Changed the way ABI plug-ins are handed out when you get an instance from
the plug-in manager. They used to return pointers that would be mananged
individually by each client that requested them, but now they are handed out
as shared pointers since there is no state in the ABI objects, they can be
shared.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
696cf5f6f2a77b87a4b06cdf0f697749b494665f 07-May-2011 Sean Callanan <scallanan@apple.com> Made expressions that are just casts of pointer
variables be evaluated statically.

Also fixed a bug that caused the results of
statically-evaluated expressions to be materialized
improperly.

This bug also removes some duplicate code.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
4a348081030cdd2af758fddc869518357d9befd3 02-May-2011 Caroline Tice <ctice@apple.com> This patch captures and serializes all output being written by the
command line driver, including the lldb prompt being output by
editline, the asynchronous process output & error messages, and
asynchronous messages written by target stop-hooks.

As part of this it introduces a new Stream class,
StreamAsynchronousIO. A StreamAsynchronousIO object is created with a
broadcaster, who will eventually broadcast the stream's data for a
listener to handle, and an event type indicating what type of event
the broadcaster will broadcast. When the Write method is called on a
StreamAsynchronousIO object, the data is appended to an internal
string. When the Flush method is called on a StreamAsynchronousIO
object, it broadcasts it's data string and clears the string.

Anything in lldb-core that needs to generate asynchronous output for
the end-user should use the StreamAsynchronousIO objects.

I have also added a new notification type for InputReaders, to let
them know that a asynchronous output has been written. This is to
allow the input readers to, for example, refresh their prompts and
lines, if desired. I added the case statements to all the input
readers to catch this notification, but I haven't added any code for
handling them yet (except to the IOChannel input reader).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
17cd995147b3324680d845b3fc897febcc23c9e0 22-Apr-2011 Greg Clayton <gclayton@apple.com> Did some work on the "register read" command to only show the first register
set by default when dumping registers. If you want to see all of the register
sets you can use the "--all" option:

(lldb) register read --all

If you want to just see some register sets, you can currently specify them
by index:

(lldb) register read --set 0 --set 2

We need to get shorter register set names soon so we can specify the register
sets by name without having to type too much. I will make this change soon.

You can also have any integer encoded registers resolve the address values
back to any code or data from the object files using the "--lookup" option.
Below is sample output when stopped in the libc function "puts" with some
const strings in registers:

Process 8973 stopped
* thread #1: tid = 0x2c03, 0x00007fff828fa30f libSystem.B.dylib`puts + 1, stop reason = instruction step into
frame #0: 0x00007fff828fa30f libSystem.B.dylib`puts + 1
(lldb) register read --lookup
General Purpose Registers:
rax = 0x0000000100000e98 "----------------------------------------------------------------------"
rbx = 0x0000000000000000
rcx = 0x0000000000000001
rdx = 0x0000000000000000
rdi = 0x0000000100000e98 "----------------------------------------------------------------------"
rsi = 0x0000000100800000
rbp = 0x00007fff5fbff710
rsp = 0x00007fff5fbff280
r8 = 0x0000000000000040
r9 = 0x0000000000000000
r10 = 0x0000000000000000
r11 = 0x0000000000000246
r12 = 0x0000000000000000
r13 = 0x0000000000000000
r14 = 0x0000000000000000
r15 = 0x0000000000000000
rip = 0x00007fff828fa30f libSystem.B.dylib`puts + 1
rflags = 0x0000000000000246
cs = 0x0000000000000027
fs = 0x0000000000000000
gs = 0x0000000000000000

As we can see, we see two constant strings and the PC (register "rip") is
showing the code it resolves to.

I fixed the register "--format" option to work as expected.

Added a setting to disable skipping the function prologue when setting
breakpoints as a target settings variable:

(lldb) settings set target.skip-prologue false

Updated the user settings controller boolean value handler funciton to be able
to take the default value so it can correctly respond to the eVarSetOperationClear
operation.

Did some usability work on the OptionValue classes.

Fixed the "image lookup" command to correctly respond to the "--verbose"
option and display the detailed symbol context information when looking up
line table entries and functions by name. This previously was only working
for address lookups.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
abe0fed36d83e1c37af9dae90c2d25db742b4515 18-Apr-2011 Greg Clayton <gclayton@apple.com> Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).

Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.

We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:

(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52

Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
e41494a9092e15192012a5e0a8a1ffd66c70b8bb 16-Apr-2011 Jim Ingham <jingham@apple.com> Add support for "dynamic values" for C++ classes. This currently only works for "frame var" and for the
expressions that are simple enough to get passed to the "frame var" underpinnings. The parser code will
have to be changed to also query for the dynamic types & offsets as it is looking up variables.

The behavior of "frame var" is controlled in two ways. You can pass "-d {true/false} to the frame var
command to get the dynamic or static value of the variables you are printing.

There's also a general setting:

target.prefer-dynamic-value (boolean) = 'true'

which is consulted if you call "frame var" without supplying a value for the -d option.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129623 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
143fcc3a15425659b381502ed4e1e50a3e726f36 13-Apr-2011 Greg Clayton <gclayton@apple.com> Added two new classes for command options:

lldb_private::OptionGroup
lldb_private::OptionGroupOptions

OptionGroup lets you define a class that encapsulates settings that you want
to reuse in multiple commands. It contains only the option definitions and the
ability to set the option values, but it doesn't directly interface with the
lldb_private::Options class that is the front end to all of the CommandObject
option parsing. For that the OptionGroupOptions class can be used. It aggregates
one or more OptionGroup objects and directs the option setting to the
appropriate OptionGroup class. For an example of this, take a look at the
CommandObjectFile and how it uses its "m_option_group" object shown below
to be able to set values in both the FileOptionGroup and PlatformOptionGroup
classes. The members used in CommandObjectFile are:

OptionGroupOptions m_option_group;
FileOptionGroup m_file_options;
PlatformOptionGroup m_platform_options;

Then in the constructor for CommandObjectFile you can combine the option
settings. The code below shows a simplified version of the constructor:

CommandObjectFile::CommandObjectFile(CommandInterpreter &interpreter) :
CommandObject (...),
m_option_group (interpreter),
m_file_options (),
m_platform_options(true)
{
m_option_group.Append (&m_file_options);
m_option_group.Append (&m_platform_options);
m_option_group.Finalize();
}

We append the m_file_options and then the m_platform_options and then tell
the option group the finalize the results. This allows the m_option_group to
become the organizer of our prefs and after option parsing we end up with
valid preference settings in both the m_file_options and m_platform_options
objects. This also allows any other commands to use the FileOptionGroup and
PlatformOptionGroup classes to implement options for their commands.

Renamed:
virtual void Options::ResetOptionValues();
to:
virtual void Options::OptionParsingStarting();

And implemented a new callback named:

virtual Error Options::OptionParsingFinished();

This allows Options subclasses to verify that the options all go together
after all of the options have been specified and gives the chance for the
command object to return an error. It also gives a chance to take all of the
option values and produce or initialize objects after all options have
completed parsing.

Modfied:

virtual Error
SetOptionValue (int option_idx, const char *option_arg) = 0;

to be:

virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg) = 0;

(option_idx is now unsigned).




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
f15996eea072cdaa8a092f22d3a1212b3d95f0ec 08-Apr-2011 Greg Clayton <gclayton@apple.com> Modified the ArchSpec to take an optional "Platform *" when setting the triple.
This allows you to have a platform selected, then specify a triple using
"i386" and have the remaining triple items (vendor, os, and environment) set
automatically.

Many interpreter commands take the "--arch" option to specify an architecture
triple, so now the command options needed to be able to get to the current
platform, so the Options class now take a reference to the interpreter on
construction.

Modified the build LLVM building in the Xcode project to use the new
Xcode project level user definitions:

LLVM_BUILD_DIR - a path to the llvm build directory
LLVM_SOURCE_DIR - a path to the llvm sources for the llvm that will be used to build lldb
LLVM_CONFIGURATION - the configuration that lldb is built for (Release,
Release+Asserts, Debug, Debug+Asserts).

I also changed the LLVM build to not check if "lldb/llvm" is a symlink and
then assume it is a real llvm build directory versus the unzipped llvm.zip
package, so now you can actually have a "lldb/llvm" directory in your lldb
sources.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129112 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
fa3a16a2ea380ef38388ebe323817bd1b32c20cd 31-Mar-2011 Jim Ingham <jingham@apple.com> Convert ValueObject to explicitly maintain the Execution Context in which they were created, and then use that when they update themselves. That means all the ValueObject evaluate me type functions that used to require a Frame object now do not. I didn't remove the SBValue API's that take this now useless frame, but I added ones that don't require the frame, and marked the SBFrame taking ones as deprecated.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128593 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
b344843f75ef893762c93fd0a22d2d45712ce74d 24-Mar-2011 Greg Clayton <gclayton@apple.com> Fixed the LLDB build so that we can have private types, private enums and
public types and public enums. This was done to keep the SWIG stuff from
parsing all sorts of enums and types that weren't needed, and allows us to
abstract our API better.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
4fdf7602bedd8be648f3c549074cf13d90a05f03 20-Mar-2011 Greg Clayton <gclayton@apple.com> Split all of the core of LLDB.framework/lldb.so into a
static archive that can be linked against. LLDB.framework/lldb.so
exports a very controlled API. Splitting the API into a static
library allows other tools (debugserver for now) to use the power
of the LLDB debugger core, yet not export it as its API is not
portable or maintainable. The Host layer and many of the other
internal only APIs can now be statically linked against.

Now LLDB.framework/lldb.so links against "liblldb-core.a" instead
of compiling the .o files only for the shared library. This fix
is only for compiling with Xcode as the Makefile based build already
does this.

The Xcode projecdt compiler has been changed to LLVM. Anyone using
Xcode 3 will need to manually change the compiler back to GCC 4.2,
or update to Xcode 4.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
d60d94a5126b93fda98678a68322abc2164073db 11-Mar-2011 Jim Ingham <jingham@apple.com> Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.

Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
2a456816c5d7c575f2e141acd48bb5f8085d9910 10-Mar-2011 Caroline Tice <ctice@apple.com> The UserSettings controllers must be initialized & terminated in the
correct order. Previously this was tacitly implemented but not
enforced, so it was possible to accidentally do things in the wrong
order and cause problems. This fixes that problem.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
d284b663aa7d08b4f767de5ffa6289f33fcbcce7 18-Feb-2011 Greg Clayton <gclayton@apple.com> Added new target instance settings for execution settings:

Targets can now specify some additional parameters for when we debug
executables that can help with plug-in selection:

target.execution-level = auto | user | kernel
target.execution-mode = auto | dynamic | static
target.execution-os-type = auto | none | halted | live

On some systems, the binaries that are created are the same wether you use
them to debug a kernel, or a user space program. Many times inspecting an
object file can reveal what an executable should be. For these cases we can
now be a little more complete by specifying wether to detect all of these
things automatically (inspect the main executable file and select a plug-in
accordingly), or manually to force the selection of certain plug-ins.

To do this we now allow the specficifation of wether one is debugging a user
space program (target.execution-level = user) or a kernel program
(target.execution-level = kernel).

We can also specify if we want to debug a program where shared libraries
are dynamically loaded using a DynamicLoader plug-in
(target.execution-mode = dynamic), or wether we will treat all symbol files
as already linked at the correct address (target.execution-mode = static).

We can also specify if the inferior we are debugging is being debugged on
a bare board (target.execution-os-type = none), or debugging an OS where
we have a JTAG or other direct connection to the inferior stops the entire
OS (target.execution-os-type = halted), or if we are debugging a program on
something that has live debug services (target.execution-os-type = live).

For the "target.execution-os-type = halted" mode, we will need to create
ProcessHelper plug-ins that allow us to extract the process/thread and other
OS information by reading/writing memory.

This should allow LLDB to be used for a wide variety of debugging tasks and
handle them all correctly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125815 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
88fa7bdfdc4b4880bd1fc12b95fa5a37a7457c74 16-Feb-2011 Jim Ingham <jingham@apple.com> Destroy the dynamic loader plugin in Process::Finalize. If you wait till the auto_ptr gets deleted in the normal course of things the real process class will have been destroyed already, and it's hard to shut down the dynamic loader without accessing some process pure virtual method.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
f9f40c20b210eea72ab042c63178ca000f005ed9 08-Feb-2011 Jim Ingham <jingham@apple.com> Rework the RunThreadPlan event handling to use Event Hijacking not stopping the event thread. Also clarify the logic of the function.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.cpp
68bffc51b218dc3a124820cb4d983204bf20be4a 29-Jan-2011 Jim Ingham <jingham@apple.com> The m_next_action is simpler if it is an auto_pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
84c8638c46e3325d73e614b4ce0ad383ff216488 29-Jan-2011 Jim Ingham <jingham@apple.com> Handle the case where the "NextEventAction" wants to kill us on some event other than eStateExited.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c2dc7c88cebe05cce059970cc907768256b28a42 29-Jan-2011 Jim Ingham <jingham@apple.com> Added a completion action class to the Process events so that we can make things like Attach and later Launch start their job, and then return to the event loop while waiting for the work to be done.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124520 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
644ddfbc1b36eabdb93c5acb150f9a77a92ee1fd 27-Jan-2011 Greg Clayton <gclayton@apple.com> Fixed a crasher when there is no log in Process::SetExitStatus (...).




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
d330bfd8c5fff8cf2f883f55fa3d2de4a305c48f 24-Jan-2011 Greg Clayton <gclayton@apple.com> One more thing... Resume any threads that we discover were created while we stop as
they may be in sensitive areas and we set breakpoints on the thread creation routines
if we are running expressions, so the threads should quickly get to a safe spot.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124115 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
b349adcc8e782ec0b7e63a634d92f577ee917691 24-Jan-2011 Greg Clayton <gclayton@apple.com> Make the logging come out all lined up and such.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124112 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6ae318c875fac58fb2d952739ee554c5ba18368f 23-Jan-2011 Jim Ingham <jingham@apple.com> Add some more logging of broadcaster and Process. Also, protect the event broadcasting against hijacking in mid-event delivery.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.cpp
f4fbc0b6c4ce465dca72467e3e33edfa5f7381e2 22-Jan-2011 Greg Clayton <gclayton@apple.com> Avoid the race condition Stephen Wilson was worried about in revision 123465 by making a local copy. We need to be able to have the private state thread let the lldb_private::Process class that it has exited, otherwise we end up with a timeout when the process destructor or DoDestroy is called where the private state thread has already exited and then StopPrivateStateThread() will wait for the thread which has already existed to respond to it.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
c556b46d7eaf949acd818d9ca4d64ddd952345cf 22-Jan-2011 Jim Ingham <jingham@apple.com> Add more logging. Try to handle the case where "Halt" fails. This is kind of a losing game in the end, if we can't halt the target, it is not clear what we can do but keep trying...

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
15dcb7ca49b8d8f46910cf085b4c249aac5317fa 20-Jan-2011 Jim Ingham <jingham@apple.com> Back up both the register AND the stop state when calling functions.
Set the thread state to "bland" before calling functions so they don't
inherit the pending signals and die.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
772ab948e42647129fcfd2e14b20e58e9fa2e28d 14-Jan-2011 Stephen Wilson <wilsons@start.ca> Do not prematurely invalidate thread handle.

Setting m_private_state_thread to an invalid value when the child thread exits
results in a race condition between calls to ThreadCancel and ThreadJoin.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9ff73eded653eaff1d98c5ae585044cae8e9bb71 14-Jan-2011 Stephen Wilson <wilsons@start.ca> Do not prefix log messages with ProcessMacOSX from the context of Process.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6a92553d2cc2b7a3b853fcb6da101583435c2dc0 13-Jan-2011 Sean Callanan <scallanan@apple.com> Implemented a major overhaul of the way variables are handled
by LLDB. Instead of being materialized into the input structure
passed to the expression, variables are left in place and pointers
to them are materialzied into the structure. Variables not resident
in memory (notably, registers) get temporary memory regions allocated
for them.

Persistent variables are the most complex part of this, because they
are made in various ways and there are different expectations about
their lifetime. Persistent variables now have flags indicating their
status and what the expectations for longevity are. They can be
marked as residing in target memory permanently -- this is the
default for result variables from expressions entered on the command
line and for explicitly declared persistent variables (but more on
that below). Other result variables have their memory freed.

Some major improvements resulting from this include being able to
properly take the address of variables, better and cleaner support
for functions that return references, and cleaner C++ support in
general. One problem that remains is the problem of explicitly
declared persistent variables; I have not yet implemented the code
that makes references to them into indirect references, so currently
materialization and dematerialization of these variables is broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c2b9825ed2e06f90bb2764181fa53afd1a3763eb 12-Jan-2011 Stephen Wilson <wilsons@start.ca> Log diagnostic when setting software breakpoints only on failure.

Previously we would be posting a "FAILED" message to the log channel even when
the operation succeeded.

Also, take this opportunity to add braces thus eliminating an "ambiguous else"
compiler warning.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
fd119995f2693eb6e9e2ea3e685f9d872f5cd4f1 07-Jan-2011 Greg Clayton <gclayton@apple.com> Added memory caching to lldb_private::Process. All lldb_private::Process
subclasses will automatically be able to take advantage of caching. The
cache line size is set to 512 by default.

This greatly speeds up stack backtraces on MacOSX when using the
ProcessGDBRemote process plug-in since only about 6300 packets per second
can be sent.

Initial speedups show:

Prior to caching: 10,000 stack frames took 5.2 seconds
After caching: 10,000 stack frames in 240 ms!

About a 20x speedup!



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
08d7d3ae16110aa68ed40c161eac8571aeb94cd9 06-Jan-2011 Greg Clayton <gclayton@apple.com> Fixed issues with RegisterContext classes and the subclasses. There was
an issue with the way the UnwindLLDB was handing out RegisterContexts: it
was making shared pointers to register contexts and then handing out just
the pointers (which would get put into shared pointers in the thread and
stack frame classes) and cause double free issues. MallocScribble helped to
find these issues after I did some other cleanup. To help avoid any
RegisterContext issue in the future, all code that deals with them now
returns shared pointers to the register contexts so we don't end up with
multiple deletions. Also now that the RegisterContext class doesn't require
a stack frame, we patched a memory leak where a StackFrame object was being
created and leaked.

Made the RegisterContext class not have a pointer to a StackFrame object as
one register context class can be used for N inlined stack frames so there is
not a 1 - 1 mapping. Updates the ExecutionContextScope part of the
RegisterContext class to never return a stack frame to indicate this when it
is asked to recreate the execution context. Now register contexts point to the
concrete frame using a concrete frame index. Concrete frames are all of the
frames that are actually formed on the stack of a thread. These concrete frames
can be turned into one or more user visible frames due to inlining. Each
inlined stack frame has the exact same register context (shared via shared
pointers) as any parent inlined stack frames all the way up to the concrete
frame itself.

So now the stack frames and the register contexts should behave much better.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
f72fdeee129bbd7195f3db888b561ede689886aa 16-Dec-2010 Greg Clayton <gclayton@apple.com> Added the ability to read unsigned integers from the Process:

uint64_t Process::ReadUnsignedInteger (addr_t addr, size_t int_byte_size, Error &error);


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
1f3dd643e10552de04644986a603f7ff02ed4beb 15-Dec-2010 Greg Clayton <gclayton@apple.com> Fix invalid conversion from "const char *" to "char *" for linux systems. strchr() on darwin returns "char *" so we weren't seeing this issue on MacOSX.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121897 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
427f290ff96f3ab9f2cf3a1af7001d2c560424c7 14-Dec-2010 Greg Clayton <gclayton@apple.com> Modified LLDB expressions to not have to JIT and run code just to see variable
values or persistent expression variables. Now if an expression consists of
a value that is a child of a variable, or of a persistent variable only, we
will create a value object for it and make a ValueObjectConstResult from it to
freeze the value (for program variables only, not persistent variables) and
avoid running JITed code. For everything else we still parse up and JIT code
and run it in the inferior.

There was also a lot of clean up in the expression code. I made the
ClangExpressionVariables be stored in collections of shared pointers instead
of in collections of objects. This will help stop a lot of copy constructors on
these large objects and also cleans up the code considerably. The persistent
clang expression variables were moved over to the Target to ensure they persist
across process executions.

Added the ability for lldb_private::Target objects to evaluate expressions.
We want to evaluate expressions at the target level in case we aren't running
yet, or we have just completed running. We still want to be able to access the
persistent expression variables between runs, and also evaluate constant
expressions.

Added extra logging to the dynamic loader plug-in for MacOSX. ModuleList objects
can now dump their contents with the UUID, arch and full paths being logged with
appropriate prefix values.

Thread hardened the Communication class a bit by making the connection auto_ptr
member into a shared pointer member and then making a local copy of the shared
pointer in each method that uses it to make sure another thread can't nuke the
connection object while it is being used by another thread.

Added a new file to the lldb/test/load_unload test that causes the test a.out file
to link to the libd.dylib file all the time. This will allow us to test using
the DYLD_LIBRARY_PATH environment variable after moving libd.dylib somewhere else.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
b37813353540bcabee7af5f096515a8180be0426 05-Dec-2010 Greg Clayton <gclayton@apple.com> Make sure that STDOUT and STDERR events in lldb_private::Process carry along
a ProcessEventData so clients can get the process from these events.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120947 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
eecb0f3b5021e37311f9588f14bcab38a35b8e9a 04-Dec-2010 Greg Clayton <gclayton@apple.com> More reverting of the EOF stuff as the API was changed which we don't want to
do. Closing on EOF is an option that can be set on the
lldb_private::Communication or the lldb::SBCommunication objects after they
are created. Of course the EOF support isn't hooked up, so they don't do
anything at the moment, but they are left in so when the code is fixed, it
will be easy to get working again.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
a99b0bf8bd41541cc29eab76d23f90976ba0736a 04-Dec-2010 Greg Clayton <gclayton@apple.com> Added the ability to display the new "target.process.inherit-env" setting.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120863 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
638351aee118e89c658ca295cb4e9d1db7849bef 04-Dec-2010 Greg Clayton <gclayton@apple.com> Added the ability for a process to inherit the current host environment. This
was done as an settings variable in the process for now. We will eventually
move all environment stuff over to the target, but we will leave it with the
process for now. The default setting is for a process to inherit the host
environment. This can be disabled by setting the "inherit-env" setting to
false in the process.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
9c11d478f7c2a1611b591cd599782b7a0a8c5c37 02-Dec-2010 Johnny Chen <johnny.chen@apple.com> Fixed a typo in comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
9ac497bc11512d221b3962e4f883eeac07db188a 02-Dec-2010 Caroline Tice <ctice@apple.com> Add proper EOF handling to Communication & Connection classes:

Add bool member to Communication class indicating whether the
Connection should be closed on receiving an EOF or not. Update the
Connection read to return an EOF status when appropriate. Modify the
Communication class to pass the EOF along or not, and to close the
Connection or not, as appropriate.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120723 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
360f53f3c216ee4fb433da0a367168785328a856 30-Nov-2010 Jim Ingham <jingham@apple.com> Moved the code in ClangUserExpression that set up & ran the thread plan with timeouts, and restarting with all threads into a utility function in Process. This required a bunch of renaming.

Added a ThreadPlanCallUserExpression that differs from ThreadPlanCallFunction in that it holds onto a shared pointer to its ClangUserExpression so that can't go away before the thread plan is done using it.

Fixed the stop message when you hit a breakpoint while running a user expression so it is more obvious what has happened.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c4f55fee15b66ea53da092ca50400ac5d8b0692d 19-Nov-2010 Caroline Tice <ctice@apple.com> Add the ability to catch and do the right thing with Interrupts (often control-c)
and end-of-file (often control-d).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
c0c1b0c0cfd2aeaf01111762fd66e59d6273bcea 19-Nov-2010 Greg Clayton <gclayton@apple.com> Fixed an issue where the UserSettingsControllers were being created out of
order and this was causing the target, process and thread trees to not be
available.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119784 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
990de7bb41d3afec6b789155408ff322187d8682 19-Nov-2010 Greg Clayton <gclayton@apple.com> Cleaned up code that wasn't using the Initialize and Terminate paradigm by
changing it to use it. There was an extra parameter added to the static
accessor global user settings controllers that wasn't needed. A bool was being
used as a parameter to the accessor just so it could be used to clean up
the global user settings controller which is now fixed by splitting up the
initialization into the "static void Class::Initialize()", access into the
"static UserSettingsControllerSP & Class::GetSettingsController()", and
cleanup into "static void Class::Terminate()".

Also added initialize and terminate calls to the logging code to avoid issues
when LLDB is shutting down. There were cases after the logging was switched
over to use shared pointers where we could crash if the global destructor
chain was being run and it causes the log to be destroyed and any any logging
occurred.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.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/Target/Process.cpp
745ac7a5826fe7c392007941a4046bfb1a8dff81 11-Nov-2010 Jim Ingham <jingham@apple.com> Add ThreadPlanTracer class to allow instruction step tracing of execution.
Also changed eSetVarTypeBool to eSetVarTypeBoolean to make it consistent with eArgTypeBoolean.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
ea9d4267a629a1c732eb0400fa0288cee31ad49d 05-Nov-2010 Jim Ingham <jingham@apple.com> Added the equivalent of gdb's "unwind-on-signal" to the expression command, and a parameter to control it in ClangUserExpression, and on down to ClangFunction.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
0baa394cd55c6dfb7a6259d215d0dea2b708067b 04-Nov-2010 Greg Clayton <gclayton@apple.com> Added support for loading and unloading shared libraries. This was done by
adding support into lldb_private::Process:

virtual uint32_t
lldb_private::Process::LoadImage (const FileSpec &image_spec,
Error &error);

virtual Error
lldb_private::Process::UnloadImage (uint32_t image_token);

There is a default implementation that should work for both linux and MacOSX.
This ability has also been exported through the SBProcess API:

uint32_t
lldb::SBProcess::LoadImage (lldb::SBFileSpec &image_spec,
lldb::SBError &error);

lldb::SBError
lldb::SBProcess::UnloadImage (uint32_t image_token);

Modified the DynamicLoader plug-in interface to require it to be able to
tell us if it is currently possible to load/unload a shared library:

virtual lldb_private::Error
DynamicLoader::CanLoadImage () = 0;

This way the dynamic loader plug-ins are allows to veto whether we can
currently load a shared library since the dynamic loader might know if it is
currenlty loading/unloading shared libraries. It might also know about the
current host system and know where to check to make sure runtime or malloc
locks are currently being held.

Modified the expression parser to have ClangUserExpression::Evaluate() be
the one that causes the dynamic checkers to be loaded instead of other code
that shouldn't have to worry about it.






git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118227 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
49ce682dfa7993d31206cea19ce7006cd3f3077e 31-Oct-2010 Greg Clayton <gclayton@apple.com> Cleaned up the API logging a lot more to reduce redundant information and
keep the file size a bit smaller.

Exposed SBValue::GetExpressionPath() so SBValue users can get an expression
path for their values.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117851 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
6297a3a5c4d8b61f2429f371bdf207043dbca832 20-Oct-2010 Jim Ingham <jingham@apple.com> Don't cache the public stop reason, since it can change as plan completion gets processed. That means GetStopReason needs to return a shared pointer, not a pointer to the thread's cached version. Also allow the thread plans to get and set the thread private stop reason - that is usually more appropriate for the logic the thread plans need to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
36f63a92bae332929e1a047b59ed6df651d8537f 19-Oct-2010 Greg Clayton <gclayton@apple.com> Stop the driver from handling SIGPIPE in case we communicate with stale
sockets so the driver doesn't just crash.

Added support for connecting to named sockets (unix IPC sockets) in
ConnectionFileDescriptor.

Modified the Host::LaunchInNewTerminal() for MacOSX to return the process
ID of the inferior process instead of the process ID of the Terminal.app. This
was done by modifying the "darwin-debug" executable to connect to lldb through
a named unix socket which is passed down as an argument. This allows a quick
handshake between "lldb" and "darwin-debug" so we can get the process ID
of the inferior and then attach by process ID and avoid attaching to the
inferior by process name since there could be more than one process with
that name. This still has possible race conditions, those will be fixed
in the near future. This fixes the SIGPIPE issues that were sometimes being
seen when task_for_pid was failing.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
d168690e51f9020b926d3d0d57dc9a2cfb2095a8 15-Oct-2010 Jim Ingham <jingham@apple.com> Added support for breakpoint conditions. I also had to separate the "run the expression" part of ClangFunction::Execute from the "Gather the expression result" so that in the case of the Breakpoint condition I can move the condition evaluation into the normal thread plan processing.

Also added support for remembering the "last set breakpoint" so that "break modify" will act on the last set breakpoint.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
028784b321087f1547df8f02f01631c59e5a9859 14-Oct-2010 Johnny Chen <johnny.chen@apple.com> Fix a regression introduced in r116430 with the added 'break' statement,
which broke test/breakpoint_locations.

Add a comment about intentional fall-through in the case statement.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
23d6f274bdb3d91d8c78b24f008ef1e7ce63dbbe 13-Oct-2010 Caroline Tice <ctice@apple.com> Add new argument type, eArgSignalName,

Add missing break statment to case statement in Process::ShouldBroadcastEvent.

Add new command, "process handle" to allow users to control process behavior on
the receipt of various Unix signals (whether the process should stop; whether the
process should be passed the signal; whether the debugger user should be notified
that the signal came in).




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
63e24d7aeae8a7feb2aae0581e597b922749d4a1 12-Oct-2010 Jim Ingham <jingham@apple.com> Add a way to temporarily divert events from a broadcaster to a private listener.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
a830adbcd63d1995a01e6e18da79893c1426ca43 04-Oct-2010 Greg Clayton <gclayton@apple.com> There are now to new "settings set" variables that live in each debugger
instance:

settings set frame-format <string>
settings set thread-format <string>

This allows users to control the information that is seen when dumping
threads and frames. The default values are set such that they do what they
used to do prior to changing over the the user defined formats.

This allows users with terminals that can display color to make different
items different colors using the escape control codes. A few alias examples
that will colorize your thread and frame prompts are:

settings set frame-format 'frame #${frame.index}: \033[0;33m${frame.pc}\033[0m{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{ \033[0;35mat \033[1;35m${line.file.basename}:${line.number}}\033[0m\n'

settings set thread-format 'thread #${thread.index}: \033[1;33mtid\033[0;33m = ${thread.id}\033[0m{, \033[0;33m${frame.pc}\033[0m}{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{, \033[1;35mstop reason\033[0;35m = ${thread.stop-reason}\033[0m}{, \033[1;36mname = \033[0;36m${thread.name}\033[0m}{, \033[1;32mqueue = \033[0;32m${thread.queue}}\033[0m\n'

A quick web search for "colorize terminal output" should allow you to see what
you can do to make your output look like you want it.

The "settings set" commands above can of course be added to your ~/.lldbinit
file for permanent use.

Changed the pure virtual
void ExecutionContextScope::Calculate (ExecutionContext&);
To:
void ExecutionContextScope::CalculateExecutionContext (ExecutionContext&);

I did this because this is a class that anything in the execution context
heirarchy inherits from and "target->Calculate (exe_ctx)" didn't always tell
you what it was really trying to do unless you look at the parameter.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115485 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
b66cd074ec097b5b0a6f2ce292f5072aa1217ca6 28-Sep-2010 Jim Ingham <jingham@apple.com> Replace the vestigial Value::GetOpaqueCLangQualType with the more correct Value::GetValueOpaqueClangQualType.

But mostly, move the ObjC Trampoline handling code from the MacOSX dyld plugin to the AppleObjCRuntime classes.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114935 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
1ebef44c126bd3a615b3ad844c46a82a82efa0e7 27-Sep-2010 Caroline Tice <ctice@apple.com> Create more useful instance names for target, process and thread instances.

Change default 'set' behavior so that all instance settings for the specified variable will be
updated, unless the "-n" ("--no_override") command options is specified.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
642036f22366d47ea8e6f8498bedb92b88f7f79f 23-Sep-2010 Jim Ingham <jingham@apple.com> Committing the skeleton of Language runtime plugin classes.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
bcb5b454767121980d937d2610ba762fdb575c45 20-Sep-2010 Caroline Tice <ctice@apple.com> Make GetInstanceSettingsValue methods take an Error * rather than an Error &,
and have them return a bool to indicate success or not.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114361 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
5bc8c97d62b2e399bd90fb7e00c903d7887412ab 20-Sep-2010 Caroline Tice <ctice@apple.com> Add UserSettings to Target class, making Target settings
the parent of Process settings; add 'default-arch' as a
class-wide setting for Target. Replace lldb::GetDefaultArchitecture
with Target::GetDefaultArchitecture & Target::SetDefaultArchitecture.

Add 'use-external-editor' as user setting to Debugger class & update
code appropriately.

Add Error parameter to methods that get user settings, for easier
reporting of bad requests.

Fix various other minor related bugs.

Fix test cases to work with new changes.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
d0a5a23d734da7a2170802ccd096f53b8a527811 19-Sep-2010 Greg Clayton <gclayton@apple.com> Added code that will allow completely customizable prompts for use in
replacing the "(lldb)" prompt, the "frame #1..." displays when doing
stack backtracing and the "thread #1....". This will allow you to see
exactly the information that you want to see where you want to see it.
This currently isn't hookup up to the prompts yet, but it will be soon.

So what is the format of the prompts? Prompts can contain variables that
have access to the current program state. Variables are text that appears
in between a prefix of "${" and ends with a "}". Some of the interesting
variables include:

// The frame index (0, 1, 2, 3...)
${frame.index}

// common frame registers with generic names
${frame.pc}
${frame.sp}
${frame.fp}
${frame.ra}
${frame.flags}

// Access to any frame registers by name where REGNAME is any register name:
${frame.reg.REGNAME}

// The current compile unit file where the frame is located
${file.basename}
${file.fullpath}

// Function information
${function.name}
${function.pc-offset}

// Process info
${process.file.basename}
${process.file.fullpath}
${process.id}
${process.name}

// Thread info
${thread.id}
${thread.index}
${thread.name}
${thread.queue}
${thread.stop-reason}

// Target information
${target.arch}

// The current module for the current frame (the shared library or executable
// that contains the current frame PC value):
${module.file.basename}
${module.file.fullpath}

// Access to the line entry for where the current frame is when your thread
// is stopped:
${line.file.basename}
${line.file.fullpath}
${line.number}
${line.start-addr}
${line.end-addr}

Many times the information that you might have in your prompt might not be
available and you won't want it to print out if it isn't valid. To take care
of this you can enclose everything that must resolve into a scope. A scope
is starts with '{' and ends with '}'. For example in order to only display
the current file and line number when the information is available the format
would be:

"{ at {$line.file.basename}:${line.number}}"

Broken down this is:

start the scope: "{"

format whose content will only be displayed if all information is available:
"at {$line.file.basename}:${line.number}"

end the scope: "}"

We currently can represent the infomration we see when stopped at a frame:

frame #0: 0x0000000100000e85 a.out`main + 4 at test.c:19

with the following format:

"frame #${frame.index}: ${frame.pc} {${module.file.basename}`}{${function.name}{${function.pc-offset}}{ at ${line.file.basename}:${line.number}}\n"

This breaks down to always print:

"frame #${frame.index}: ${frame.pc} "

only print the module followed by a tick if we have a valid module:

"{${module.file.basename}`}"

print the function name with optional offset:
"{${function.name}{${function.pc-offset}}"

print the line info if it is available:

"{ at ${line.file.basename}:${line.number}}"

then finish off with a newline:

"\n"

Notice you can also put newlines ("\n") and tabs and everything else you
are used to putting in a format string when desensitized with the \ character.

Cleaned up some of the user settings controller subclasses. All of them
do not have any global settings variables and were all implementing stubs
for the get/set global settings variable. Now there is a default version
in UserSettingsController that will do nothing.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
75b11a343a035ab426473a785a045f0614af9984 16-Sep-2010 Caroline Tice <ctice@apple.com> Fix issues with CreateInstanceName, a virtual function, being called
in an initializer.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
c14069e2764a57c55e60ea9406842858a509223c 14-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed an issue that was always causing an extra empty argument to be sent
to any inferior process because the code was checking if no run args were
set and then adding and empty string. This was happening for environment
vars as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
396704be65012c4bdebdd9072e6b77f09cf0384b 09-Sep-2010 Caroline Tice <ctice@apple.com> Add comments to InstanceSettings constructors explaining why they have
to be set up the way they are. Comment out code that removes pending
settings for live instances (after the settings are copied over).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
f2c330df115cfdaedbf9d359b00f3ebb3cab9887 09-Sep-2010 Caroline Tice <ctice@apple.com> Move the ProcessPlugins enum definition from lldb-enumerations.h to
Process.h; modify the process.plugins settings variable to use the
correct plugin names.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
004afcb95736e97d071b1dd9b5254800e11e581c 08-Sep-2010 Caroline Tice <ctice@apple.com> Make sure creating a pending instance doesn't also trigger creating a live instance; also make sure creating a
pending instance uses the specified instance name rather than creating a new one; add brackets to instance names
when searching for and removing pending instances.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113370 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
7ac83bd367f4baf856cbb8a1fa82f8edf44edb93 07-Sep-2010 Jim Ingham <jingham@apple.com> Move common code from GetSettingsController in Process & Debugger into static functions
in UserSettingsController.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113268 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
87097234900636ba2c93f13ed4f8909fa7580b7d 07-Sep-2010 Caroline Tice <ctice@apple.com> Fix various minor bugs in the Settings stuff.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6e4c5ce0f697eb9899a54854a2a9004e961b0de2 04-Sep-2010 Caroline Tice <ctice@apple.com> This is a very large commit that completely re-does the way lldb
handles user settable internal variables (the equivalent of set/show
variables in gdb). In addition to the basic infrastructure (most of
which is defined in UserSettingsController.{h,cpp}, there are examples
of two classes that have been set up to contain user settable
variables (the Debugger and Process classes). The 'settings' command
has been modified to be a command-subcommand structure, and the 'set',
'show' and 'append' commands have been moved into this sub-commabnd
structure. The old StateVariable class has been completely replaced
by this, and the state variable dictionary has been removed from the
Command Interpreter. Places that formerly accessed the state variable
mechanism have been modified to access the variables in this new
structure instead (checking the term-width; getting/checking the
prompt; etc.)

Variables are attached to classes; there are two basic "flavors" of
variables that can be set: "global" variables (static/class-wide), and
"instance" variables (one per instance of the class). The whole thing
has been set up so that any global or instance variable can be set at
any time (e.g. on start up, in your .lldbinit file), whether or not
any instances actually exist (there's a whole pending and default
values mechanism to help deal with that).




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
8b4c16e6ca818961ce6229e419dc960e07737c91 19-Aug-2010 Greg Clayton <gclayton@apple.com> Fixed a long delay in shutdown times by invalidating m_private_state_thread right before the private state thread (which calls "void *Process::RunPrivateStateThread ()") exits.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@111567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
ea2941843e51df4018bbe9f0f42050964d78d2c0 17-Aug-2010 Jim Ingham <jingham@apple.com> Don't try to get the architecture up front when doing attach -w.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@111302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
a48fe1637ec6a381e500633c087f76662e364c20 11-Aug-2010 Sean Callanan <scallanan@apple.com> Added support for persistent variables to the
expression parser. It is now possible to type:

(lldb) expr int $i = 5; $i + 1
(int) 6
(lldb) expr $i + 2
(int) 7

The skeleton for automatic result variables is
also implemented. The changes affect:

- the process, which now contains a
ClangPersistentVariables object that holds
persistent variables associated with it
- the expression parser, which now uses
the persistent variables during variable
lookup
- TaggedASTType, where I loaded some commonly
used tags into a header so that they are
interchangeable between different clients of
the class


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
6fb8baa66796cdb23f337dd03272bf15d97fdab9 10-Aug-2010 Jim Ingham <jingham@apple.com> Make breakpoint commands work again. Added a PerformAction to the stop info - actions are run when the
stop event is pulled from the event queue. Then made the StopInfoBreakpoint's PerformAction do the
breakpoint command.
Also fixed the StopInfoBreakpoint's GetDescription so it gets the breakpoint location info, not the breakpoint
site info.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110637 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
c607d8681f443d03806f105ceceb11dcadd16184 22-Jul-2010 Greg Clayton <gclayton@apple.com> This patch changes the point at which Process::m_private_state_thread is
invalidated. There was a race condition where the private thread would
invalidate its own pthread_t object before the parent could perform a
pthread_cancel/pthread_join sequence.

Patch from Stephen Wilson.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp
141eeac2adf8987d31b1f0e955c259e93e539b18 20-Jul-2010 Stephen Wilson <wilsons@start.ca> Fix assertion conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108879 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.cpp
3fd1f36c937575dbf57bae04c7ebaef78d8ecc1d 17-Jul-2010 Stephen Wilson <wilsons@start.ca> Have Process::CreateBreakpointSite return a break_id_t instead of a user_id_t.
Also, update BreakpointLocation::ResolveBreakpointSite to check for invalid
breakpoint ID's using the proper magic constant.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.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/Target/Process.cpp
5a47e8bcc7277dc3683f2af2aeb9717184e8360c 19-Jun-2010 Jim Ingham <jingham@apple.com> Two changes in this checkin. Added a ThreadPlanKind so that I can do some reasoning based on the kind of thread plan
without having to use RTTI.
Removed the ThreadPlanContinue and replaced with a ShouldAutoContinue query that serves the same purpose. Having to push
another plan to assert that if there's no other indication the target should continue when this plan is popped was flakey
and error prone. This method is more stable, and fixed problems we were having with thread specific breakpoints.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Target/Process.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/Target/Process.cpp