• Home
  • History
  • Annotate
  • only in /external/lldb/source/API/
History log of /external/lldb/source/API/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d55c5b19487ef22383a32548f1143f1dfac2478f 14-Oct-2013 Todd Fiala <tfiala@google.com> Add Android.mk support for building LLDB on Linux host.

This change adds support for building LLDB with the following
build command from the top level:

make FORCE_BUILD_LLVM_COMPONENTS=true ANDROID_BUILD_LLDB=true lldb

There are known issues with the google linux host gcc 4.6.2+ variant
currently used to build host executables. A follow up change will
apply a temporary work-around that will be used until either the
compiler is fixed or a new compiler is used.

Change-Id: I18451f73cbe2264074cd8fba6397680855352a93
ndroid.mk
5bcb221ca649f07ccfaadf4228a8b552d85e56c9 27-Jul-2013 Jason Molenda <jmolenda@apple.com> Fix the logging messages for SBFrame::FindRegister().


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187264 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
6855784d6c31c060c230d99f6107c52fa22f1b3f 26-Jul-2013 Jason Molenda <jmolenda@apple.com> Add an SBFrame::FindRegister() method to make it a little
easier to retrieve a register value.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187184 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
008f3dc79c762b7d240b5ad6d4fb148c5cb039ca 18-Jul-2013 Jim Ingham <jingham@apple.com> This commit does two things. One, it converts the return value of the QueueThreadPlanXXX
plan providers from a "ThreadPlan *" to a "lldb::ThreadPlanSP". That was needed to fix
a bug where the ThreadPlanStepInRange wasn't checking with its sub-plans to make sure they
succeed before trying to proceed further. If the sub-plan failed and as a result didn't make
any progress, you could end up retrying the same failing algorithm in an infinite loop.

<rdar://problem/14043602>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@186618 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
7980d35608225dc71b3dd946d4c3aea85bc24e85 13-Jul-2013 Greg Clayton <gclayton@apple.com> Fixed GetModuleSpecifications() to work better overall:
- MachO files now correctly extract the UUID all the time
- More file size and offset verification done for universal mach-o files to watch for truncated files
- ObjectContainerBSDArchive now supports enumerating all objects in BSD archives (.a files)
- lldb_private::Module() can not be properly constructed using a ModuleSpec for a .o file in a .a file
- The BSD archive plug-in shares its cache for GetModuleSpecifications() and the create callback
- Improved printing for ModuleSpec objects



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@186211 91177308-0d34-0410-b5e6-96231b3b80d8
BModuleSpec.cpp
52f792329be5db8e38961350589e97e8f2823acd 12-Jul-2013 Greg Clayton <gclayton@apple.com> Huge change to clean up types.

A long time ago we start with clang types that were created by the symbol files and there were many functions in lldb_private::ClangASTContext that helped. Later we create ClangASTType which contains a clang::ASTContext and an opauque QualType, but we didn't switch over to fully using it. There were a lot of places where we would pass around a raw clang_type_t and also pass along a clang::ASTContext separately. This left room for error.

This checkin change all type code over to use ClangASTType everywhere and I cleaned up the interfaces quite a bit. Any code that was in ClangASTContext that was type related, was moved over into ClangASTType. All code that used these types was switched over to use all of the new goodness.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@186130 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTarget.cpp
BType.cpp
BValue.cpp
7940069905bee0b2e5f0661bf37c9f906ddf8603 10-Jul-2013 Greg Clayton <gclayton@apple.com> Cleanup on the unified section list changes. Main changes are:
- ObjectFile::GetSymtab() and ObjectFile::ClearSymtab() no longer takes any flags
- Module coordinates with the object files and contain a unified section list so that object file and symbol file can share sections when they need to, yet contain their own sections.

Other cleanups:
- Fixed Symbol::GetByteSize() to not have the symbol table compute the byte sizes on the fly
- Modified the ObjectFileMachO class to compute symbol sizes all at once efficiently
- Modified the Symtab class to store a file address lookup table for more efficient lookups
- Removed Section::Finalize() and SectionList::Finalize() as they did nothing
- Improved performance of the detection of symbol files that have debug maps by excluding stripped files and core files, debug files, object files and stubs
- Added the ability to tell if an ObjectFile has been stripped with ObjectFile::IsStripped() (used this for the above performance improvement)



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185990 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
b9d995d0863e1860c12c4ace0d5eb0ba832f9c99 09-Jul-2013 Enrico Granata <egranata@apple.com> Second attempt at getting the PyCallable changes in trunk

Thanks to Daniel Malea for helping test this patch for Linux happiness!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185965 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
1617c78ddc892e090065b12e545ba2eb51c286d1 09-Jul-2013 Greg Clayton <gclayton@apple.com> Added missing SBModuleSpec.cpp file to the CMakeLists.txt



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185878 91177308-0d34-0410-b5e6-96231b3b80d8
MakeLists.txt
f9215bae3f7f76ad98bace0097821a12415690c5 09-Jul-2013 Greg Clayton <gclayton@apple.com> Added a way to extract the module specifications from a file. A module specification is information that is required to describe a module (executable, shared library, object file, ect). This information includes host path, platform path (remote path), symbol file path, UUID, object name (for objects in .a files for example you could have an object name of "foo.o"), and target triple. Module specification can be used to create a module, or used to add a module to a target. A list of module specifications can be used to enumerate objects in container objects (like universal mach files and BSD archive files).

There are two new classes:

lldb::SBModuleSpec
lldb::SBModuleSpecList

The SBModuleSpec wraps up a lldb_private::ModuleSpec, and SBModuleSpecList wraps up a lldb_private::ModuleSpecList.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185877 91177308-0d34-0410-b5e6-96231b3b80d8
BFileSpec.cpp
BModule.cpp
BModuleSpec.cpp
BTarget.cpp
26bc105b1882a78de609d46d148ad2b5c4d50656 03-Jul-2013 Daniel Malea <daniel.malea@intel.com> Revert commits that cause broken builds on GCC buildbots
- build fails due to PyCallable template definition inside an extern "C" scope

This commit reverts 185240, 184893 and 184608.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185560 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
a807ceef5dad2b24e5bae5c5a193ff03aa7ec8d9 01-Jul-2013 Michael Sartain <mikesart@valvesoftware.com> Split symbol support for ELF and Linux.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185366 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
151416f6288315ef6d6061f60154db21798180a9 29-Jun-2013 Greg Clayton <gclayton@apple.com> Fixed SBProcess::RemoteLaunch() to use the platform executable path. Patch from Sebastien Metrot.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185245 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
9c9a7bf57d081271c7e971decfe221561a920bcd 26-Jun-2013 Enrico Granata <egranata@apple.com> <rdar://problem/14266411>

The semi-unofficial way of returning a status from a Python command was to return a string (e.g. return "no such variable was found") that LLDB would pick as a clue of an error having happened

This checkin changes that:
- SBCommandReturnObject now exports a SetError() call, which can take an SBError or a plain C-string
- script commands now drop any return value and expect the SBCommandReturnObject ("return object") to be filled in appropriately - if you do nothing, a success will be assumed

If your commands were relying on returning a value and having LLDB pick that up as an error, please change your commands to SetError() through the return object or expect changes in behavior



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184893 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
77e67a51acb825d79d25be687c085833713d5205 19-Jun-2013 Greg Clayton <gclayton@apple.com> Implemented a types.py module that allows types to be inspected for padding.

The script was able to point out and save 40 bytes in each lldb_private::Section by being very careful where we need to have virtual destructors and also by re-ordering members.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184364 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
a8b56238ce138e70433a0ce0b4218c9257beae38 19-Jun-2013 Greg Clayton <gclayton@apple.com> Added the ability to get a list of types from a SBModule or SBCompileUnit. Sebastien Metrot wanted this, and sent a hollowed out patch. I filled in the blanks and did the low level implementation. The new functions are:

//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// module.
///
/// @param[in] type_mask
/// A bitfield that consists of one or more bits logically OR'ed
/// together from the lldb::TypeClass enumeration. This allows
/// you to request only structure types, or only class, struct
/// and union types. Passing in lldb::eTypeClassAny will return
/// all types found in the debug information for this module.
///
/// @return
/// A list of types in this module that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList
SBModule::GetTypes (uint32_t type_mask)


//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// compile unit.
///
/// @param[in] type_mask
/// A bitfield that consists of one or more bits logically OR'ed
/// together from the lldb::TypeClass enumeration. This allows
/// you to request only structure types, or only class, struct
/// and union types. Passing in lldb::eTypeClassAny will return
/// all types found in the debug information for this compile
/// unit.
///
/// @return
/// A list of types in this compile unit that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList
SBCompileUnit::GetTypes (uint32_t type_mask = lldb::eTypeClassAny);

This lets you request types by filling out a mask that contains one or more bits from the lldb::TypeClass enumerations, so you can only get the types you really want.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184251 91177308-0d34-0410-b5e6-96231b3b80d8
BCompileUnit.cpp
BModule.cpp
be2f9090cf7d64a0f021cbc4036f4172baba1cd2 18-Jun-2013 Jim Ingham <jingham@apple.com> We were getting an assert because somebody was making a watchpoint that was
neither read nor write. Tighten up the checking so this isn't possible.

<rdar://problem/14111167>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184245 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
ba3ebe1d3e6d13c42f7e35ff715431573af65681 13-Jun-2013 Greg Clayton <gclayton@apple.com> Added a SBSection::GetParent() to the API.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183948 91177308-0d34-0410-b5e6-96231b3b80d8
BSection.cpp
0d2318750a93a698fad5ac628b989f428a0caf28 12-Jun-2013 Enrico Granata <egranata@apple.com> Improvements to the data formatters SB API:

- exposing new accessors: formats/format, ..., that allow you to iterate over all formatters
e.g. sys_category = lldb.debugger.GetCategory("system").summary['char *']
- ensuring that C++-based synthetic children provider can at least print their description accurately, if nothing else



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183805 91177308-0d34-0410-b5e6-96231b3b80d8
BTypeSynthetic.cpp
17d5a0358d60922707fdab6ec9c3251ca44dd614 23-May-2013 Michael Sartain <mikesart@valvesoftware.com> Add ${ansi.XX} parsing to lldb prompt, use-color setting, and -no-use-colors command line options.
settings set use-color [false|true]
settings set prompt "${ansi.bold}${ansi.fg.green}(lldb)${ansi.normal} "
also "--no-use-colors" on the command prompt



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182609 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
0c2921f5b9dab2ca1832bb746ab3aa3f66fdd0b5 15-May-2013 Jim Ingham <jingham@apple.com> Fixed a few obvious errors pointed out by the static analyzer.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181911 91177308-0d34-0410-b5e6-96231b3b80d8
BCommunication.cpp
BFrame.cpp
bef2dde1407f2b7b7cf36739d23439c8f1dd0fc4 15-May-2013 Jim Ingham <jingham@apple.com> Change the mechanism around SBValue::GetSP() so that it always requires the target API lock AND the
process StopLocker (if there is a process) before it will hand out SBValues. We were doing this in
an ad hoc fashion previously, and then playing whack-a-mole whenever we found a place where we should
have been doing this but weren't. Really, it doesn't make sense to be poking at SBValues when the target
is running, the dynamic and synthetic values can't really be computed, and the underlying memory may be
incoherent.

<rdar://problem/13819378> Sometimes when stepping fast, my inferior is killed by debugserver


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181863 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.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
BProcess.cpp
08f60c88b61c42c35abf3233f0cbe19d29fbe814 04-May-2013 Jason Molenda <jmolenda@apple.com> fix a couple of clang static analyzer warnings.
Most important was a new[] + delete mismatch in ScanFormatDescriptor()
and a couple of possible memory leaks in FileSpec::EnumerateDirectory().


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181080 91177308-0d34-0410-b5e6-96231b3b80d8
BListener.cpp
42b336cd509cad89be08f78775d3b1c8c7656a1b 04-May-2013 Jason Molenda <jmolenda@apple.com> Remove the UUID::GetAsCString() method which required a buffer to save the
UUID string in; added UUID::GetAsString() which returns the uuid string in
a std::string. Updated callers to use the new method.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181078 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
0765e3274aab0551fea7678bee565c7d68e0b786 03-May-2013 Enrico Granata <egranata@apple.com> <rdar://problem/11742979>

SWIG is smart enough to recognize that C++ operators == and != mean __eq__ and __ne__ in Python and do the appropriate translation
But it is not smart enough to recognize that mySBObject == None should return False instead of erroring out
The %pythoncode blocks are meant to provide those extra smarts (and they play some SWIG&Python magic to find the right function to call behind the scenes with no risk of typos :-)
Lastly, SBBreakpoint provides an == but never provided a != operator - common courtesy is to provide both

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180987 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
78280ba2d849f92a700ba15be3efa9eef5ffc730 02-May-2013 Enrico Granata <egranata@apple.com> <rdar://problem/13499317>

Enabling Python commands to produce Unicode output via:

result.PutCString(u”whatever”)

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180930 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.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
BProcess.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
BProcess.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
BProcess.cpp
97a19b21dacd9063bb5475812df7781777262198 29-Apr-2013 Greg Clayton <gclayton@apple.com> Cleanup logging to use the new "std::string FileSpec::GetPath()" function. Also added a similar function for modules:

std::string
Module::GetSpecificationDescription () const;

This returns the module as "/usr/lib/libfoo.dylib" for normal files (calls "std::string FileSpec::GetPath()" on m_file) but it also might include the object name in case the module is for a .o file in a BSD archive ("/usr/lib/libfoo.a(bar.o)"). Cleaned up necessary logging code to use it.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180717 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
bf26ea6ffa9426b8f23c78aa8cf18b809beb364c 23-Apr-2013 Enrico Granata <egranata@apple.com> Daniel Malea reported seeing warnings for the use of anonymous namespaces in our public API.
Removing these namespace { ... } declarations (but still keeping the helper *Impl objects outside of namespace lldb proper)

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180067 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
BValueList.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
BTypeCategory.cpp
BValue.cpp
2c354722318f0fcad087c76f2bc0dc8db9200b4b 16-Apr-2013 Andrew Kaylor <andrew.kaylor@intel.com> Adding new Python API function to check for stopped threads.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179577 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
ab8e00e51475b9148626bfdf99549b7ffc3d046d 13-Apr-2013 Sean Callanan <scallanan@apple.com> Added a SetData() method to ValueObject. This
lets a ValueObject's contents be set from raw
data. This has certain limitations (notably,
registers can only be set to data that is as
large as the register) but will be useful for
the new Materializer.

I also exposed this interface through SBValue.
I have added a testcase that exercises various
special cases of SBValue::SetData().


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179437 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
03dd6a4202cad821f06911d6b961b21b13a3e449 04-Apr-2013 Jim Ingham <jingham@apple.com> The SBValue impl class's GetSP can now fetch the dynamic type or the synthetic
children - which it may have to compute. Thus it needs to take the API lock.

<rdar://problem/13560869>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178734 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
dd03f0a4bf976e844f19dd0adc76c0bfa39470d3 01-Apr-2013 Daniel Malea <daniel.malea@intel.com> Avoid hang in attach-by-name test case
- Check that process attach succeeded before attempting to WaitForProcessToStop (observed to cause hangs on Linux)
- Update comment in TestHelloWorld case -- attaching by name still broken



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178491 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
d4f95f3c9462a977f8c15c5062d30bf62cd49110 29-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/11730263>

PC relative loads are missing disassembly comments when disassembled in a live process.

This issue was because some sections, like __TEXT and __DATA in libobjc.A.dylib, were being moved when they were put into the dyld shared cache. This could also affect any other system that slides sections individually.

The solution is to keep track of wether the bytes we will disassemble are from an executable file (file address), or from a live process (load address). We now do the right thing based off of this input in all cases.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178315 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BAddress.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCommunication.cpp
BCompileUnit.cpp
BData.cpp
BDebugger.cpp
BDeclaration.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFileSpecList.cpp
BFrame.cpp
BFunction.cpp
BHostOS.cpp
BInputReader.cpp
BLineEntry.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
BValueList.cpp
BWatchpoint.cpp
59b96d5fdda21be0c7abbe7567af75239748be61 25-Mar-2013 Greg Clayton <gclayton@apple.com> Modified patch from Prabhat Verma to enable loading core files through the SBTarget API.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177932 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
8aab31c3555a2486aa2eded117e2e3d74fef4805 25-Mar-2013 Han Ming Ong <hanming@apple.com> <rdar://problem/13404009>

Only get the attach_info's user ID if the supplied user info is invalid.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177900 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
535f53c8795b3592ce835804af5cef89be39ceea 19-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13443931>

Fixed a crasher in the SourceManager where it wasn't checking the m_target member variable for NULL.

In doing this fix, I hardened this class to have weak pointers to the debugger and target in case they do go away. I also changed SBSourceManager to hold onto weak pointers to the debugger and target so they don't keep objects alive by holding a strong reference to them.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177365 91177308-0d34-0410-b5e6-96231b3b80d8
BSourceManager.cpp
fe6dc6e241c52822710380cec0931351a1d7b2d3 14-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13421412>

Many "byte size" members and variables were using a mixture of uint32_t and size_t. Switching over to using uint64_t everywhere.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177091 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
7d4083837c5a258375fdc185d464b4ed15759a4b 02-Mar-2013 Jim Ingham <jingham@apple.com> Convert from the C-based LLVM Disassembler shim to the full MC Disassembler API's.
Calculate "can branch" using the MC API's rather than our hand-rolled regex'es.
As extra credit, allow setting the disassembly flavor for x86 based architectures to intel or att.

<rdar://problem/11319574>
<rdar://problem/9329275>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176392 91177308-0d34-0410-b5e6-96231b3b80d8
BFunction.cpp
BSymbol.cpp
BTarget.cpp
fe9d7bf031886309d33a575c67aad2d313bbc60a 28-Feb-2013 Enrico Granata <egranata@apple.com> Fixing the log line for SBValue::MightHaveChildren() to report the correct function name

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176232 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
cc28859e487562a6f39f1c22a72b417b5a8e3a1b 28-Feb-2013 Enrico Granata <egranata@apple.com> the log entry for SBThread::GetProcess() would not include the pointer to the process because we were using the value of the (otherwise unused) process_sp - instead of fetching the SP from sb_process

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176231 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
a7e864cb0a450c7ef65b6f9f6c9bae839c405906 23-Feb-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13265297>

StackFrame assumes m_sc is additive, but m_sc can lose its target. So now the SymbolContext::Clear() method takes a bool that indicates if the target should be cleared. Modified all existing code to properly set the bool argument.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175953 91177308-0d34-0410-b5e6-96231b3b80d8
BSymbolContext.cpp
aebeefd3adb11cf535b9a7b6ad4e9c39e005a7b5 21-Feb-2013 Daniel Malea <daniel.malea@intel.com> Adding CMake build system to LLDB. Some known issues remain:
- generate-vers.pl has to be called by cmake to generate the version number
- parallel builds not yet supported; dependency on clang must be explicitly specified

Tested on Linux.
- Building on Mac will require code-signing logic to be implemented.
- Building on Windows will require OS-detection logic and some selective directory inclusion

Thanks to Carlo Kok (who originally prepared these CMakefiles for Windows) and Ben Langmuir
who ported them to Linux!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175795 91177308-0d34-0410-b5e6-96231b3b80d8
MakeLists.txt
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
BProcess.cpp
9c7108fecfda761c8c619b6100f680355d289fbe 07-Feb-2013 Enrico Granata <egranata@apple.com> Renaming SBValueList::get() to
opaque_ptr since it returns a void* instead of an usable object.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174673 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BValueList.cpp
ac6692008aef670d21d6671cbfb6b5d2110b5d62 07-Feb-2013 Enrico Granata <egranata@apple.com> Correct logging for function calls that return SBValueList



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174670 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BValueList.cpp
5c1700af5ceb00fd46a97d524a83e4e43453538c 07-Feb-2013 Enrico Granata <egranata@apple.com> <rdar://problem/13107151>

SBValueList was backed by a ValueObjectList. This caused us to lose track of the additional metadata in the ValueImpl that backs SBValue.
This checkin fixes that by backing SBValueList with ValueListImpl (that essentially wraps a vector<SBValue>).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174638 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BModule.cpp
BTarget.cpp
BValueList.cpp
cbe61bd26db663fa3036866dc33315c6ffc37910 06-Feb-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13159777>

lldb was mmap'ing archive files once per .o file it loads, now it correctly shares the archive between modules.

LLDB was also always mapping entire contents of universal mach-o files, now it maps just the slice that is required.

Added a new logging channel for "lldb" called "mmap" to help track future regressions.

Modified the ObjectFile and ObjectContainer plugin interfaces to take a data offset along with the file offset and size so we can implement the correct caching and efficient reading of parts of files without mmap'ing the entire file like we used to.

The current implementation still keeps entire .a files mmaped (once) and entire slices from universal files mmaped to ensure that if a client builds their binaries during a debug session we don't lose our data and get corrupt object file info and debug info.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174524 91177308-0d34-0410-b5e6-96231b3b80d8
BSection.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
BModule.cpp
ad72e52945ee0560fc2b22dce0087d4c7274a218 01-Feb-2013 Greg Clayton <gclayton@apple.com> Allow the target to give out the size of the red zone for given ABIs.

A bit of cleanup in the heap module.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174129 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
1f71bcf1b4dd9993b7e93c2dc80ef2697c2f6eca 29-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/12524607>

Flush the process when symbols are loaded/unloaded manually. This was going on in:
- "target modules load" command
- SBTarget::SetSectionLoadAddress(...)
- SBTarget::ClearSectionLoadAddress(...)
- SBTarget::SetModuleLoadAddress(...)
- SBTarget::ClearModuleLoadAddress(...)



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173745 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
f509c5ec066599a3399fced39ea36996184939e8 29-Jan-2013 Enrico Granata <egranata@apple.com> <rdar://problem/12978143>

Data formatters now cache themselves.
This commit provides a new formatter cache mechanism. Upon resolving a formatter (summary or synthetic), LLDB remembers the resolution for later faster retrieval.
Also moved the data formatters subsystem from the core to its own group and folder for easier management, and done some code reorganization.
The ObjC runtime v1 now returns a class name if asked for the dynamic type of an object. This is required for formatters caching to work with the v1 runtime.
Lastly, this commit disposes of the old hack where ValueObjects had to remember whether they were queried for formatters with their static or dynamic type.
Now the ValueObjectDynamicValue class works well enough that we can use its dynamic value setting for the same purpose.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173728 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BTypeCategory.cpp
BTypeFilter.cpp
BTypeFormat.cpp
BTypeNameSpecifier.cpp
BTypeSummary.cpp
BTypeSynthetic.cpp
BValue.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
BData.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
BProcess.cpp
392bd8d8356a35a0ad7a9990e1e05d0509971c4b 16-Jan-2013 Enrico Granata <egranata@apple.com> <rdar://problem/13021266>

Adding FindFirstGlobalVariable to SBModule and SBTarget
These calls work like FindGlobalVariables but they only return the first match found and so they can return an SBValue instead of an SBValueList for added convenience of use



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172636 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTarget.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
BProcess.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
BExpressionOptions.cpp
0e3b98e7de6d69613a9729bac9d4b965c0635698 09-Jan-2013 Jim Ingham <jingham@apple.com> Add an SBProcess API to get the current StopID, either considering or ignoring stops caused by expression
evaluation.

<rdar://problem/12968562>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@171914 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
836064ad50d20992275e3647aba2fb0cb0fc571e 08-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/12586010>

Python OS plug-ins now fetch thread registers lazily.

Also changed SBCommandInterpreter::HandleCommand() to not take the API lock. The logic here is that from the command line you can execute a command that might result in another thread (like the private process thread) to execute python or run any code that can re-enter the public API. When this happens, a deadlock immediately occurs for things like "process launch" and "process attach".



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@171901 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
19b646725e7d6bebda787fa3cb55ff223a00d907 04-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/12928282>

Added SBTarget::EvaluateExpression() so expressions can be evaluated without needing a process.

Also fixed many functions that deal with clang AST types to be able to properly handle the clang::Type::Elaborated types ("struct foo", "class bar").



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@171476 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
aa93c931a4c1275b2fecec23ef34f231afda4773 21-Dec-2012 Jim Ingham <jingham@apple.com> Added an SBAPI to get the PythonPath (if the Host knows how to do that). And a -P option to the Driver
to print it out. Changed dotest.py to use that to find the PythonPath it should use given the lldb binary
it was told to run.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170932 91177308-0d34-0410-b5e6-96231b3b80d8
BHostOS.cpp
278f16e1dd4097bf3dd12b0f63f1fac0f11c4006 21-Dec-2012 Andrew Kaylor <andrew.kaylor@intel.com> Adding eStopReasonThreadExiting and fixing the handling of this state on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170800 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
282c22c6a6b6e54324b0d474b90d918bbfd3a10e 20-Dec-2012 Sean Callanan <scallanan@apple.com> This patch removes the SymbolFileSymtab support
for reporting class types from Objective-C runtime
class symbols. Instead, LLDB now queries the
Objective-C runtime for class types.

We have also added a (minimal) Objective-C runtime
type vendor for Objective-C runtime version 1, to
prevent regressions when calling class methods in
the V1 runtime.

Other components of this fix include:

- We search the Objective-C runtime in a few more
places.

- We enable enumeration of all members of
Objective-C classes, which Clang does in certain
circumstances.

- SBTarget::FindFirstType and SBTarget::FindTypes
now query the Objective-C runtime as needed.

- I fixed several test cases.

<rdar://problem/12885034>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170601 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BWatchpoint.cpp
bb04be12f8762500c1c308b0d1b93fe8f69c667f 15-Dec-2012 Jim Ingham <jingham@apple.com> Remove the “len” defaulted parameter from CommandReturnObject::AppendMessage, AppendWarning and AppendError. Nobody was using them, and it meant if you accidentally used the AppendWarning when you meant AppendWarningWithFormat with an integer in the format string, it would compile and then return your string plus some unknown amount of junk.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170266 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
f2ca573e8dc034ecc5050a874d8f01ace0703e18 12-Dec-2012 Jim Ingham <jingham@apple.com> Fixed a few bugs in the "step in" thread plan logic.
Added a "step-in-target" flag to "thread step-in" so if you have something like:

Process 28464 stopped
* thread #1: tid = 0x1c03, function: main , stop reason = breakpoint 1.1
frame #0: 0x0000000100000e08 a.out`main at main.c:62
61
-> 62 int A6 = complex (a(4), b(5), c(6)); // Stop here to step targetting b and hitting breakpoint.
63

and you want to get into "complex" skipping a, b and c, you can do:

(lldb) step -t complex
Process 28464 stopped
* thread #1: tid = 0x1c03, function: complex , stop reason = step in
frame #0: 0x0000000100000d0d a.out`complex at main.c:44
41
42 int complex (int first, int second, int third)
43 {
-> 44 return first + second + third; // Step in targetting complex should stop here
45 }
46
47 int main (int argc, char const *argv[])



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170008 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
18e0830db3f7602e3b97f543161b1b1e21824a44 08-Dec-2012 Greg Clayton <gclayton@apple.com> Added GetCanonicalType() to SBType:

lldb::SBType
SBType::GetCanonicalType();



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169655 91177308-0d34-0410-b5e6-96231b3b80d8
BType.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
BValue.cpp
0b93a7546473b15fb14dbc129f1fe5ed6ee14976 05-Dec-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12749733>

Always allows getting builtin types by name even if there is no backing debug information.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169424 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTarget.cpp
BType.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
BCommandInterpreter.cpp
BDebugger.cpp
BEvent.cpp
BListener.cpp
BProcess.cpp
BSourceManager.cpp
BTarget.cpp
BThread.cpp
BTypeCategory.cpp
BTypeFilter.cpp
BTypeFormat.cpp
BTypeNameSpecifier.cpp
BTypeSummary.cpp
BTypeSynthetic.cpp
BValue.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
BThread.cpp
b3dafc6a81a014339015701c9872624f2aeddd43 04-Dec-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12750060>

Add the ability to get a symbol or symbols by name and type from a SBModule, and also the ability to get all symbols by name and type from SBTarget objects.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169205 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTarget.cpp
b1087a27f7babc43f332c9d49ac4554892133a41 30-Nov-2012 Jim Ingham <jingham@apple.com> Save and restore terminal state when lldb is suspended with SIGTSTP and resumed with SIGCONT.
Readline & gdb have a bunch of code to handle older UNIX'es with other job control mechanisms.
I didn't try to replicate that.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169032 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.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
BAddress.cpp
BBlock.cpp
BBreakpoint.cpp
BCommandInterpreter.cpp
BCommunication.cpp
BData.cpp
BDebugger.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BProcess.cpp
BSection.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
15fd97d8923c76e3cdf6de20614939879dc1bde9 29-Nov-2012 Jim Ingham <jingham@apple.com> Tighten up how we acquire the underlying frame in the SBFrame methods. We were getting
the frame and then getting the run lock. Which means that our frame could have gotten
invalidated by stopping between the time we got the frame and assured the the target was
stopped. Now we get the run lock first, and THEN resolve the underlying frame object.

<rdar://problem/12621607>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168838 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.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
BProcess.cpp
1e4d8f06d77559e13844d116515412520b4713cc 31-Oct-2012 Sean Callanan <scallanan@apple.com> Rmoved a duplicate version of SetSelectedThreadByID
that confused external clients.

<rdar://problem/12599528>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167097 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
99270577568c7829116a97094eabceaee9a21737 30-Oct-2012 Greg Clayton <gclayton@apple.com> Added the ability to get function return and argument types to SBType():

bool
SBType::IsFunctionType ();

lldb::SBType
SBType::GetFunctionReturnType ();

lldb::SBTypeList
SBType::GetFunctionArgumentTypes ();



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167023 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
aaf00885e53cfe26b3b89376f97096a9a3ef3b81 30-Oct-2012 Greg Clayton <gclayton@apple.com> Add missing return to SBAddress::GetOffset(). This was caught by Carlo Kok.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167019 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
fee26ee9a5db37e71f5d5aed279c634bbdab7c8c 26-Oct-2012 Jim Ingham <jingham@apple.com> Add API to get the process plugin name & short name.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166799 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
4a0a1252629a807d37ac252b0239f10204eddedc 24-Oct-2012 Enrico Granata <egranata@apple.com> Reimplementing SBValue/ValueObject.GetValueAsUnsigned() in terms of appropriate calls in Scalar - Making sure Scalar does the right thing when casting signed values to unsigned ones.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166618 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
0fd6c8dc95068f9c05f4706bc97ff25bf75684a2 24-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12481949> Fixing SBValue.GetValueAsSigned() to do the right thing when dealing with a 32-bit negative value

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166603 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
9e376625d6354d77cd6240007f0d42034dd3f1ee 23-Oct-2012 Jim Ingham <jingham@apple.com> Watchpoints remember the type of the expression or variable they were set with, and use
it to print the old and new values.
Temporarily disable the "out of scope" checking since it didn't work correctly, and was
not what people generally expected watchpoints to be doing.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166472 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
BValue.cpp
54037b1488e3344575714d8358728e042fa801c7 23-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12493007>

Added a new API call to help efficiently determine if a SBValue could have children:

bool
SBValue::MightHaveChildren ();

This is inteneded to be used bui GUI programs that need to show if a SBValue needs a disclosure triangle when displaying a hierarchical type in a tree view without having to complete the type (by calling SBValue::GetNumChildren()) as completing the type is expensive.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166460 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
6837dfd894dffac06d0c02fcf10064b2012de3dd 22-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12524810>

Fixed a crasher where if an invalid SBTarget was passed to:

lldb::addr_t
SBAddress::GetLoadAddress (const SBTarget &target) const;

We would crash.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166439 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
3d656c729a1ed0abad4e5a2d76f6e8a6904f66aa 22-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12437442>
Given our implementation of ValueObjects we could have a scenario where a ValueObject has a dynamic type of Foo* at one point, and then its dynamic type changes to Bar*
If Bar* has synthetic children enabled, by the time we figure that out, our public API is already vending SBValues wrapping a DynamicVO, instead of a SyntheticVO and there was
no trivial way for us to change the SP inside an SBValue on the fly
This checkin reimplements SBValue in terms of a wrapper, ValueImpl, that allows this substitutions on-the-fly by overriding GetSP() to do The Right Thing (TM)
As an additional bonus, GetNonSyntheticValue() now works, and we can get rid of the ForceDisableSyntheticChildren idiom in ScriptInterpreterPython
Lastly, this checkin makes sure the synthetic VOs get the correct m_value and m_data from their parents (prevented summaries from working in some cases)



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166426 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
BFrame.cpp
BValue.cpp
4e8467404c8e603422a44f4db448546e0a98f696 20-Oct-2012 Sean Callanan <scallanan@apple.com> Improved logging for the SBTarget's launching
and attaching APIs.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166356 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
ed0a0fbd021e44727469d6fa20cc337c58bd04c3 18-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12462048>
<rdar://problem/12068650>

More fixes to how we handle paths that are used to create a target.

This modification centralizes the location where and how what the user specifies gets resolved. Prior to this fix, the TargetList::CreateTarget variants took a FileSpec object which meant everyone had the opportunity to resolve the path their own way. Now both CreateTarget variants take a "const char *use_exe_path" which allows the TargetList::CreateTarget to centralize where the resolving happens and "do the right thing".




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166186 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
75a443b04197d18c7034968e11ce831166df3703 17-Oct-2012 Greg Clayton <gclayton@apple.com> API cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166070 91177308-0d34-0410-b5e6-96231b3b80d8
BExpressionOptions.cpp
BFrame.cpp
BValue.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
BExpressionOptions.cpp
BFrame.cpp
BValue.cpp
b8fda50a3e97699af76a406f03d139ee1bd94d01 16-Oct-2012 Enrico Granata <egranata@apple.com> Removing the two extra GetXSize(bool) calls since we do not desire to support them long-term

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166060 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
c2bc7944f7c2f10114426f447259a35acb0b1e18 16-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12446320> Fixing an issue with our Driver where setting an immediate output would not cause suppression of the final printout. This allows effective output redirection for Python commands

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166058 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
949b7178cf48cc4cf8533c729999a6c90785773d 13-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12490588>

From SBType, we can now get a lldb::BasicType enumeration out of an existing type.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165857 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
82560f25ae1b4a55c927df9ccf1bd1becc01b1c1 13-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12490558>

SBProcess::SetSelectedThreadByID() had a "uint32_t tid" parameter which would truncate 64 bit thread IDs (lldb::tid_t is 64 bit).


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165852 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
6f01c93497df194b6f2194630a81e87d806ce0e0 12-Oct-2012 Jim Ingham <jingham@apple.com> Bunch of cleanups for warnings found by the llvm static analyzer.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165808 91177308-0d34-0410-b5e6-96231b3b80d8
BTypeNameSpecifier.cpp
BTypeSummary.cpp
5e91e379b3be10738ab5aeae87b47001de16cd7c 12-Oct-2012 Greg Clayton <gclayton@apple.com> Patch from Daniel Malea that cleans up the process parameters for Process/Thread classes for POSIX and Linux.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165806 91177308-0d34-0410-b5e6-96231b3b80d8
BDeclaration.cpp
49306144bb37f0b3423d992f17cdcc24703374b4 11-Oct-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12462744> Implement a new SBDeclaration class to wrap an lldb_private::Declaration - make a GetDeclaration() API on SBValue to return a declaration. This will only work for vroot variables as they are they only objects for which we currently provide a valid Declaration

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

<rdar://problem/12383087>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165640 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
f737d372a9672c9feaedf4b2cd7b16e31357d38e 09-Oct-2012 Greg Clayton <gclayton@apple.com> Added a new "module" log channel which covers module creation, deletion, and common module list actions.

Also added a new option for "log enable" which is "--stack" which will print out a stack backtrace for each log line.

This was used to track down the leaking module issue I fixed last week.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165438 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
2753a024a5a314232baa579c0ada87551aa86988 05-Oct-2012 Jim Ingham <jingham@apple.com> Add one-shot breakpoints (-o option to "break set") and a tbreak alias for our gdb friends.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165328 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.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
BDebugger.cpp
BProcess.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
BTarget.cpp
6d101887bb427b3c879c0c06775ab4dcb1cd265b 29-Sep-2012 Enrico Granata <egranata@apple.com> Implementing plugins that provide commands.
This checkin adds the capability for LLDB to load plugins from external dylibs that can provide new commands
It exports an SBCommand class from the public API layer, and a new SBCommandPluginInterface

There is a minimal load-only plugin manager built into the debugger, which can be accessed via Debugger::LoadPlugin.

Plugins are loaded from two locations at debugger startup (LLDB.framework/Resources/PlugIns and ~/Library/Application Support/LLDB/PlugIns) and more can be (re)loaded via the "plugin load" command

For an example of how to make a plugin, refer to the fooplugin.cpp file in examples/plugins/commands

Caveats:
Currently, the new API objects and features are not exposed via Python.
The new commands can only be "parsed" (i.e. not raw) and get their command line via a char** parameter (we do not expose our internal Args object)
There is no unloading feature, which can potentially lead to leaks if you overwrite the commands by reloading the same or different plugins
There is no API exposed for option parsing, which means you may need to use getopt or roll-your-own


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164865 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BCommandReturnObject.cpp
437b5bccea45a5981edbbbeb4e23424aec4ce774 28-Sep-2012 Greg Clayton <gclayton@apple.com> Wrapped up the work I am going to do for now for the "add-dsym" or "target symfile add" command.

We can now do:

Specify a path to a debug symbols file:
(lldb) add-dsym <path-to-dsym>

Go and download the dSYM file for the "libunc.dylib" module in your target:
(lldb) add-dsym --shlib libunc.dylib

Go and download the dSYM given a UUID:
(lldb) add-dsym --uuid <UUID>

Go and download the dSYM file for the current frame:
(lldb) add-dsym --frame



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164806 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
02fac1c72565c8de5edc0921a5edf9d6da7b34ca 27-Sep-2012 Greg Clayton <gclayton@apple.com> If we are attached to a platform, then make sure that we can verify that a process exists when attaching by "pid" before we try and do a lengthy command that could take a while to timeout.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164738 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
3fcc297c999218b19d7d5ad049e9c955c4bc481d 26-Sep-2012 Jim Ingham <jingham@apple.com> Add an API to figure out whether a breakpoint is internal or not.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164648 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
3acaa926c8f0d32da48db61a5fcb95276e6a4006 25-Sep-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/9959501>

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164584 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.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
BBreakpoint.cpp
BCommunication.cpp
BDebugger.cpp
BFileSpec.cpp
BProcess.cpp
BValue.cpp
6b70f0317707698df7c26bdfebbe90b41087e0ab 15-Sep-2012 Jim Ingham <jingham@apple.com> Remove a duplicate frame_sp local that was shadowing the one we copied the incoming SBFrame into.

<rdar://problem/12304255>

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163943 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
be0cde978e34379e30c01c92858f8f037d80d388 14-Sep-2012 Jim Ingham <jingham@apple.com> SBThread::StepOut and SBThread::StepOutOfFrame should both run all threads.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163938 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
52124e7711fc5628df6a256c6125f9e4e9a97a5d 14-Sep-2012 Jim Ingham <jingham@apple.com> SBThread::StepOverUntil should run all threads. It is running to breakpoints, so running one thread is likely to cause the target to stall.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163924 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
f59388aa57559d7d074613d65b88abacfd699845 14-Sep-2012 Jim Ingham <jingham@apple.com> Make the unwinding of the stack part of "thread return" work, and add the thread return command.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163867 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
a17a81a1a9ff6b8d87c4a1e47dd874f6ea8a4f1d 12-Sep-2012 Jim Ingham <jingham@apple.com> Start at getting "thread return" working. Doesn't work yet.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163670 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
c643077dd2048204d78bc8b19629d0a3dca055fd 07-Sep-2012 Greg Clayton <gclayton@apple.com> Patch from Andrew Kaylor for linux:

The attached patch fixes a problem with performing an attach from the SBTarget API on Linux (and other systems that use ProcessPOSIX).

When Process::Attach was called from SBTarget, it resulted in a call to a form of the DoAttachWithID function that wasn't implemented in ProcessPOSIX, and so it fell back to the default implementation (which just returns an error). It didn't seem necessary to use the attach_info parameter for this case, so I just implemented it as a call to the simpler version of the function.

In debugging this problem, I also found that SBTarget wasn't checking the return value from the Attach call, causing it to hang when the attach fails.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163399 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
7de0117c60163841c493c8db3e891e4839390acb 07-Sep-2012 Enrico Granata <egranata@apple.com> Fixing a constness issue in an otherwise trivial patch

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163352 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
df83db835a5e026a2270dcc334e848452208691d 06-Sep-2012 Enrico Granata <egranata@apple.com> Restoring an API as deprecated which was removed in a previous commit

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163351 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
d27026e46d8430fb451d85ac161a8492e1930245 05-Sep-2012 Enrico Granata <egranata@apple.com> Implementing an Options class for EvaluateExpression() in order to make the signature more compact and make it easy to 'just run an expression'

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163239 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BValue.cpp
ae2ae94bd72daf435204e99a0e03ccc64470a843 04-Sep-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11485744> Implement important data formatters in C++. Have the Objective-C language runtime plugin expose class descriptors objects akin to the objc_runtime.py Pythonic implementation. Rewrite the data formatters for some core Cocoa classes in C++ instead of Python.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163155 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTypeSummary.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
BFrame.cpp
BInstruction.cpp
BModule.cpp
BProcess.cpp
BSection.cpp
BTarget.cpp
BValue.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
BFrame.cpp
BProcess.cpp
BThread.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
BDebugger.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
BDebugger.cpp
684d401c119c41f36d1bb6d2d0ae733fbfb537f3 21-Aug-2012 Jim Ingham <jingham@apple.com> SBValue::GetTypeName and SBValue::GetByteSize might have to update the dynamic value - which might involve running code. So they need to take the stop lock & target locks.

<rdar://problem/12001204>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162250 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
f590be8aaa0aba484d828019111d61dff33b273e 20-Aug-2012 Filipe Cabecinhas <me@filcab.net> A baton isn't needed to dispatch input.

I also added a typemap to make DispatchInput usable in Python.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162204 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
9880efacdd3a5e855b405d89433a01170422a889 11-Aug-2012 Jim Ingham <jingham@apple.com> Add explicit casts to bool in "shared pointer is valid" constructs that return bool.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161719 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
BWatchpoint.cpp
f6132ef983e8a5b98fbe5e184f5128eff8c04730 01-Aug-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11275622>

Added new API to lldb::SBTypeMember for bitfields:

bool SBTypeMember::IsBitfield();
uint32_t SBTypeMember::GetBitfieldSizeInBits();

Also added new properties for easy access. Now SBTypeMember objects in python have a "fields" property for all type fields, "bases" for all direct bases, "vbases" for all virtual base classes and "members" for a combo of all three organized by bit offset. They all return a python list() of SBTypeMember objects. Usage:
(lldb) script
>>> t = lldb.target.FindFirstType("my_type")
>>> for field in t.fields:
... print field
>>> for vbase in t.vbases:
... print vbase
>>> for base in t.bases:
... print base
>>> for member in t.members:
... print member

Also added new "is_bitfield" property to the SBTypeMember objects that will return the result of SBTypeMember::IsBitfield(), and "bitfield_bit_size" which will return the result of SBTypeMember::GetBitfieldSizeInBits();

I also fixed "SBTypeMember::GetOffsetInBytes()" to return the correct byte offset.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161091 91177308-0d34-0410-b5e6-96231b3b80d8
BType.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
BProcess.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
BTarget.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
BFrame.cpp
BTarget.cpp
a092d901bec2beaed29603acad318d8d93da3f4a 17-Jul-2012 Jason Molenda <jmolenda@apple.com> Change UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly so it records
the state of the unwind instructions once the prologue has finished. If it hits an
early return epilogue in the middle of the function, re-instate the prologue after that
epilogue has completed so that we can still unwind for cases where the flow of control
goes past that early-return. <rdar://problem/11775059>

Move the UnwindPlan operator== definition into the .cpp file, expand the definition a bit.

Add some casts to a SBCommandInterpreter::HandleCompletion() log statement so it builds without
warning on 64- and 32-bit systems.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160337 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
b3a1a2bba41281ba56a99fe64887a8a04760784c 14-Jul-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11870357>

Allow "frame variable" to find ivars without the need for "this->" or "self->".


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160211 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
efbdd2280873cc87634bf4f4a37ab8b99662522a 13-Jul-2012 Jim Ingham <jingham@apple.com> Add accessors on process to get & set the selected thread by IndexID (useful since that's the one that "thread list" shows and it won't get reused even if the underlying system thread ID gets reused.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160187 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
bcaf99a74367d464dd38011e26b9b4be56b503ba 12-Jul-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11791234>

Fixed a case where the python interpreter could end up holding onto a previous lldb::SBProcess (probably in lldb.process) when run under Xcode. Prior to this fix, the lldb::SBProcess held onto a shared pointer to a lldb_private::Process. This in turn could cause the process to still have a thread list with stack frames. The stack frames would have module shared pointers in the lldb_private::SymbolContext objects.

We also had issues with things staying in the shared module list too long when we found things by UUID (we didn't remove the out of date ModuleSP from the global module cache).

Now all of this is fixed and everything goes away between runs.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160140 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
545762f7780bece4e9255e052c0a50a1ea66ce57 07-Jul-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11357711>

Fixed a crasher where the section load list was not thread safe.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159884 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
5c5a38e7c640e9448241ec2aca0c60047ec3273c 28-Jun-2012 Greg Clayton <gclayton@apple.com> Added the ability to read the dSYM plist file with source remappings even when DebugSymbols isn't used to find the dSYM. We now parse the plist as XML in the MacOSX symbol vendor.

Added the ability to get a section load address given a target which is needed for a previous checking which saves crashlogs.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159298 91177308-0d34-0410-b5e6-96231b3b80d8
BSection.cpp
3a70d5d2f090682dda624de23dbb6e8d580d08f0 27-Jun-2012 Greg Clayton <gclayton@apple.com> Make the IsValid() operator for SBLineEntry "do the right thing" by returning true if the line entry is valid, not just if the opaque pointer to lldb_private::LineEntry is non NULL.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159287 91177308-0d34-0410-b5e6-96231b3b80d8
BLineEntry.cpp
839de396873071d193ed76b0206686af41540962 27-Jun-2012 Jim Ingham <jingham@apple.com> Make a way to set the result status for Python defined commands, and don't overwrite the status of the result if
the python command has set it.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159273 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
bc8c4996019433dbf3437e690ec9aa16730194d8 26-Jun-2012 Jim Ingham <jingham@apple.com> Add API logging to SBCommandInterpreter::HandleCompletion().

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159180 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
ee306fa748b51abb55c4006e1b877a1ac2343836 07-Jun-2012 Jim Ingham <jingham@apple.com> Add API logging for SBDebugger::MemoryPressureDetected.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158159 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
a442da2c8213b09b6b3869c8e30b5d98023ed7ba 06-Jun-2012 Jim Ingham <jingham@apple.com> Add the SBWatchpoint::GetError back, we have clients who use it.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158092 91177308-0d34-0410-b5e6-96231b3b80d8
BWatchpoint.cpp
9c4a3442b99aa324f1ee41ecf85a460452b01feb 05-Jun-2012 Johnny Chen <johnny.chen@apple.com> Funnel the old API call SBValue::Watch (bool resolve_location, bool read, bool write) to the one which takes an SBError.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157969 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
8a5ce77ad5356af485a119186fc2ad536d21149b 05-Jun-2012 Johnny Chen <johnny.chen@apple.com> Cannot break the existing API client of SBValue::Watch(bool resolve_location, bool read, bool write).
Leave this method in the codebase for a while.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157967 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
3f883496e92fce5011f6bf585af3ac6d1cddb64f 05-Jun-2012 Johnny Chen <johnny.chen@apple.com> rdar://problem/11584012

Refactorings of watchpoint creation APIs so that SBTarget::WatchAddress(), SBValue::Watch(), and SBValue::WatchPointee()
now take an additional 'SBError &error' parameter (at the end) to contain the reason if there is some failure in the
operation. Update 'watchpoint set variable/expression' commands to take advantage of that.

Update existing test cases to reflect the API change and add test cases to verify that the SBError mechanism works for
SBTarget::WatchAddress() by passing an invalid watch_size.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157964 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
BValue.cpp
BWatchpoint.cpp
12b7ea35275fe86d7393811080b93cf656805aca 04-Jun-2012 Greg Clayton <gclayton@apple.com> Patch that fixes log messages in SBValue.cpp from Lau Sennels.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157949 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
bbf6aa50c0f83ea8e745d518b8c14e01f34a16b0 01-Jun-2012 Johnny Chen <johnny.chen@apple.com> Thread-hardening the SB API calls related to watchpoint operations.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157776 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
01bc2d493b48e4904e3241a7768e18fdd9bb6835 31-May-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11328896> Fixing a bug where regex commands were saved in the history even if they came from a 'command sourced' file - this fix introduces a command sourcing depth and disables history for all levels of depth > 0, which means no commands go into history when being sourced from a file. we need an integer depth because command files might themselves source other command files, ...

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157727 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
299aa709d2e2a1b6b46609b1d105b53730ff4c66 29-May-2012 Enrico Granata <egranata@apple.com> rdar://problem/10996978 - Fixing an issue where crash reports for the expression parser might include symbols from the user's application

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157631 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
191343e7213d3d717327319352d086f981fa8e58 24-May-2012 Johnny Chen <johnny.chen@apple.com> Add SBProcess::GetNumSupportedHardwareWatchpoints() API and export it through the Python scripting bridge.
Add/modify some test cases.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157353 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
2cf5ccbbbe3343a6c973d0d65ad5de178a414e30 22-May-2012 Jim Ingham <jingham@apple.com> Also push file & line breakpoints past the prologue. Also added a "-K" argument to the relevant
"break set" commands to set this per breakpoint. Also, some CreateBreakpoint API's in the lldb_private
namespace had "internal" first and "skip_prologue" second. "internal should always be last. Fixed that.

rdar://problem/11484729


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157225 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
f7d782b70647870cdf3c2683b3a027660a9534d5 19-May-2012 Filipe Cabecinhas <me@filcab.net> Fixes the case where we created a dummy target, deleted it, and then tried to evaluate an expression with no target.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157110 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
1c4ae3e669a5b2aa0ba0850f8e880eb9fefb719a 16-May-2012 Jim Ingham <jingham@apple.com> Add an accessor on SBBreakpointLocation to get its location ID.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156891 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpointLocation.cpp
d82bc6d623930e796d596d190399ec2450980e0f 12-May-2012 Jim Ingham <jingham@apple.com> Found one more place where the OkayToDiscard needs to be consulted.
Also changed the defaults for SBThread::Step* to not delete extant plans.
Also added some test cases to test more complex stepping scenarios.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156667 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BThread.cpp
0fef968c843be422d6facc2e8d54d8471eee88ed 10-May-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11330621>

Fixed the DisassemblerLLVMC disassembler to parse more efficiently instead of parsing opcodes over and over. The InstructionLLVMC class now only reads the opcode in the InstructionLLVMC::Decode function. This can be done very efficiently for ARM and architectures that have fixed opcode sizes. For x64 it still calls the disassembler to get the byte size.

Moved the lldb_private::Instruction::Dump(...) function up into the lldb_private::Instruction class and it now uses the function that gets the mnemonic, operandes and comments so that all disassembly is using the same code.

Added StreamString::FillLastLineToColumn() to allow filling a line up to a column with a character (which is used by the lldb_private::Instruction::Dump(...) function).

Modified the Opcode::GetData() fucntion to "do the right thing" for thumb instructions.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156532 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
BInstructionList.cpp
f92ddcc2fda5ca564acc37d2fecd4b577dfc2bde 09-May-2012 Jim Ingham <jingham@apple.com> Print out a notification when the process of a target other than the currently selected target stops.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156433 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
07baf83fe7ae25ac87d38cd4fc19647b020adfad 08-May-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11338654> Fixing a bug where having a summary for a bitfield without a format specified would in certain cases crash LLDB - This has also led to refactoring the by-type accessors for the data formatter subsystem. These now belong in our internal layer, and are just invoked by the public API stratum

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156429 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
651cbe2e3f6efb8bd579a5007c2d2f90f0ab7633 08-May-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11239650> Fixing a bug where the SetValueFromCString() method failed to operate on dynamic values. The fix consists in making the set operation fall through to the parent. We only actually allow this if the dynamic value is at a 0-offset from the parent, or the new value is 0. Other scenarios would need agreement on the actual meaning of the set operation (do we keep offsetting? do we just assume the user knows what they are doing?) so we prevent them, and let the expression parser deal with the complexity

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156422 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
4c87ebf1b443573929c149eebb969a40bcb410d4 08-May-2012 Jim Ingham <jingham@apple.com> Fixing some indentation.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156412 91177308-0d34-0410-b5e6-96231b3b80d8
BListener.cpp
4758a3ced524198d2cf9c50bab9b088adcbda9cb 08-May-2012 Enrico Granata <egranata@apple.com> First part of a fix to make GetNonSyntheticValue() work correctly

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156397 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
5f2b926834ef43ae25cf3afdabaf4c79fda1153e 08-May-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10605072>

Fixed the command callback override lookup function so we can now override the "process launch" command (or any other multi-word commands).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156368 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.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
BDebugger.cpp
1b584ebc1de8b50fe375cffb5fb33ad13be10046 05-May-2012 Jim Ingham <jingham@apple.com> Don't expose the pthread_mutex_t underlying the Mutex & Mutex::Locker classes.
No one was using it and Locker(pthread_mutex_t *) immediately asserts for
pthread_mutex_t's that don't come from a Mutex anyway. Rather than try to make
that work, we should maintain the Mutex abstraction and not pass around the
platform implementation...

Make Mutex::Locker::Lock take a Mutex & or a Mutex *, and remove the constructor
taking a pthread_mutex_t *. You no longer need to call Mutex::GetMutex to pass
your mutex to a Locker (you can't in fact, since I made it private.)


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156221 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BDebugger.cpp
BFunction.cpp
BInstruction.cpp
BSymbol.cpp
88e3de205708f14431559072ca258899b5ac31cc 03-May-2012 Jim Ingham <jingham@apple.com> Clean up the usage of "MasterPlan" status in ThreadPlans. Only user-initiated plans
should be MasterPlans that want to stay on the plan stack. So make all plans NOT
MasterPlans by default and then have the SB API's and the CommandObjectThread step
commands set this explicitly.

Also added a "clean up" phase to the Thread::ShouldStop so that if plans get stranded
on the stack, we can remove them. This is done by adding an IsPlanStale method to the
thread plans, and if the plan can know that it is no longer relevant, it returns true,
and the plan and its sub-plans will get discarded.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156101 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
f0bc81575b0048a004add5e0212a6a15757dbdb0 23-Apr-2012 Greg Clayton <gclayton@apple.com> Added the ability to specify the symbol file for a module when adding it to a target.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155384 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
9274ba370543c91f8d69c77c0ca5906f7a19ca84 19-Apr-2012 Jim Ingham <jingham@apple.com> We take the API mutex first and the stop mutex second in general, so do it here as well.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155077 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
887f62dc481f40cd8b9ab235bb5a57774b8e61fe 14-Apr-2012 Jim Ingham <jingham@apple.com> The API lock was getting dropped too soon in GetVariables. GetValueObjectForFrameVariable could run the target (to get dynamic values) and that requires the target lock.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154711 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
5b4905dbd678c8e96d2b9a760e3d28dc4592221a 13-Apr-2012 Jim Ingham <jingham@apple.com> Couple more places in SBValue where you need to take the run-lock.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154683 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
7fb143064009e34dbb7a602924e9807375f72a46 13-Apr-2012 Greg Clayton <gclayton@apple.com> Expose GetAddressClass() from both the SBAddress and SBInstruction so clients can tell the difference between ARM/Thumb opcodes when disassembling ARM.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154633 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BInstruction.cpp
2642585f2ecaf522675521ef8d3df5122bcdd4b8 12-Apr-2012 Greg Clayton <gclayton@apple.com> Fixed an issue that happens in LLDB versions after SBFrame switched to using a lldb::ExecutionContextRefSP where we might segfault due to using a shared pointer with NULL in it. The SBFrame object should always have a valid lldb::ExecutionContextRefSP in it. The SBFrame::Clear() method was doing the wrong thing and is now fixed.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154614 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
50561699a9a14c716d1099ae1d38be2f31534b67 11-Apr-2012 Greg Clayton <gclayton@apple.com> Cleaned up code that was getting SBData for an SBInstruction.



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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154458 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BDebugger.cpp
BFunction.cpp
BInstruction.cpp
BSymbol.cpp
860b9ea0038cdcea2dda00b1657f945363c96d00 09-Apr-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11202426>

Work around a deadlocking issue where "SBDebugger::MemoryPressureDetected ()" is being called and is causing a deadlock. We now just try and get the lock when trying to trim down the unique modules so we don't deadlock debugger GUI programs until we can find the root cause.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154339 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
9f95fb63a492b53206d578f46e73899d60d70321 06-Apr-2012 Greg Clayton <gclayton@apple.com> In a prior commit, I changed the parameters around on a ModuleList::FindTypes where the old parameters that existing clients were using would have been compatible, so I renamed ModuleList::FindTypes to ModuleList::FindTypes2. Then I made fixes and verified I updated and fixed all client code, but I forgot to rename the function back to ModuleList::FindTypes(). I am doing that now and also cleaning up the C++ dynamic type code a bit.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154182 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
9f3c98e1cfdb463848cb13d03312fab8a5ec7f0d 06-Apr-2012 Greg Clayton <gclayton@apple.com> Added logging when API calls try to do something that shouldn't be done when the process is stopped by having logging calls that end with "error: process is running".

Also test for the process to be stopped when many SBValue API calls are made to make sure it is safe to evaluate values, children of values and much more.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154160 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BProcess.cpp
BThread.cpp
BValue.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
BFrame.cpp
BProcess.cpp
BThread.cpp
69c540dc5b2b498e4bb9a4cb8d7cd4e3c993bbbc 04-Apr-2012 Greg Clayton <gclayton@apple.com> Change SBAddress back to using a std::auto_ptr to a lldb_private::Address as the lldb_private::Address has a weak pointer to the section which has a weak pointer back to the module, so it is safe to have just a lldb_private::Address object now.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154045 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BLineEntry.cpp
a9fe7e77bf7f1ec9793e685e2a01c7cc1b0c590c 03-Apr-2012 Bill Wendling <isanbard@gmail.com> Return 0 for the size_t return type.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153930 91177308-0d34-0410-b5e6-96231b3b80d8
BStream.cpp
3be42fb4ff54e71afe0b9aac83b7fa3068a3d873 02-Apr-2012 Greg Clayton <gclayton@apple.com> Export the ability to see if a symbol is externally visible and also if the symbol was synthetically added to the symbol table (the symbol was not part of the symbol table itself but came from another section).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153893 91177308-0d34-0410-b5e6-96231b3b80d8
BSymbol.cpp
2a508dd3b82ab6b4450832c87c998bf4d109cf6d 29-Mar-2012 Greg Clayton <gclayton@apple.com> Removed unused variable.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153625 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
9af596da04b01a4ac4f9dcab5b46dc675334e7df 28-Mar-2012 Greg Clayton <gclayton@apple.com> Fixed some space formatting.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153582 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
9ab696e40530fa966e08cab7af77ea62e4fff1c0 27-Mar-2012 Greg Clayton <gclayton@apple.com> lldb_private::Section objects have a boolean flag that can be set that
indicates that the section is thread specific. Any functions the load a module
given a slide, will currently ignore any sections that are thread specific.

lldb_private::Section now has:

bool
Section::IsThreadSpecific () const
{
return m_thread_specific;
}

void
Section::SetIsThreadSpecific (bool b)
{
m_thread_specific = b;
}

The ELF plug-in has been modified to set this for the ".tdata" and the ".tbss"
sections.

Eventually we need to have each lldb_private::Thread subclass be able to
resolve a thread specific section, but for now they will just not resolve. The
code for that should be trivual to add, but the address resolving functions
will need to be changed to take a "ExecutionContext" object instead of just
a target so that thread specific sections can be resolved.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153537 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
dba1de8d585f27601162f674d30ab71d9c83ccde 27-Mar-2012 Enrico Granata <egranata@apple.com> Synthetic values are now automatically enabled and active by default. SBValue is set up to always wrap a synthetic value when one is available.
A new setting enable-synthetic-value is provided on the target to disable this behavior.
There also is a new GetNonSyntheticValue() API call on SBValue to go back from synthetic to non-synthetic. There is no call to go from non-synthetic to synthetic.
The test suite has been changed accordingly.
Fallout from changes to type searching: an hack has to be played to make it possible to use maps that contain std::string due to the special name replacement operated by clang
Fixing a test case that was using libstdcpp instead of libc++ - caught as a consequence of said changes to type searching


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153495 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
dc0a38c5a727cae5362b218a3180d0f4265a619d 27-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11113279>

Fixed type lookups to "do the right thing". Prior to this fix, looking up a type using "foo::bar" would result in a type list that contains all types that had "bar" as a basename unless the symbol file was able to match fully qualified names (which our DWARF parser does not).

This fix will allow type matches to be made based on the basename and then have the types that don't match filtered out. Types by name can be fully qualified, or partially qualified with the new "bool exact_match" parameter to the Module::FindTypes() method.

This fixes some issue that we discovered with dynamic type resolution as well as improves the overall type lookups in LLDB.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153482 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTarget.cpp
BType.cpp
BValue.cpp
d44c9d31d23d0b44ce40325ad69226889a9638bc 24-Mar-2012 Enrico Granata <egranata@apple.com> Adding a new API call IsTypeComplete() to SBType. This call is meant to check if the type has been previously completed or not (which is mostly interesting from a performance point of view)

Adding a test case that checks that we do not complete types before due time. This should help us track cases similar to the cascading data formatters.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153363 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
f5dc0fc131b0a4350a0a19a32013088ec41cfeea 22-Mar-2012 Jason Molenda <jmolenda@apple.com> SBTypeCategory::GetName returns const char* so return
NULL instead of false if no valid name (fixes compiler
warning).


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153282 91177308-0d34-0410-b5e6-96231b3b80d8
BTypeCategory.cpp
b1db658333cdebca31a128be95e926d80c3c7796 20-Mar-2012 Greg Clayton <gclayton@apple.com> Platforms can now auto-select themselves if you specify a full target triple when doing a "target create" command.

Each platform now knows if it can handle an architecture and a platform can be found using an architecture. Each platform can look at the arch, vendor and OS and know if it should be used or not.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153104 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
b451f5f1606fc5effdc809fa2261263851fff8f5 16-Mar-2012 Johnny Chen <johnny.chen@apple.com> Patch from dawn@burble.org:

GetSupportFileAtIndex(), GetNumSupportFiles(), FindSupportFileIndex():
Add API support for getting the list of files in a compilation unit.
GetNumCompileUnits(), GetCompileUnitAtIndex():
Add API support for retrieving the compilation units in a module.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152942 91177308-0d34-0410-b5e6-96231b3b80d8
BCompileUnit.cpp
BModule.cpp
598df88bd6fc33c6fb330bc859bdc277795501f3 14-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10434005>

Prepare LLDB to be built with C++11 by hiding all accesses to std::tr1 behind
macros that allows us to easily compile for either C++.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152698 91177308-0d34-0410-b5e6-96231b3b80d8
BTypeCategory.cpp
BValue.cpp
66c2e19e7c343e1ff0fd31180a12f8a68fc61b6c 08-Mar-2012 Greg Clayton <gclayton@apple.com> Moved inline functions into SBTarget.cpp and made destructors for SBLaunchInfo and SBAttachInfo to avoid link warnings.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152267 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
0c31d3d3a4a1d00d53346d8a23b0519f47e55d1f 07-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10997402>

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152244 91177308-0d34-0410-b5e6-96231b3b80d8
BSymbol.cpp
400105dd92731a0c8968d6296b0b7279b483ebf0 07-Mar-2012 Enrico Granata <egranata@apple.com> Using the new ScriptInterpreterObject in the implementation of synthetic children to enhance type safety
Several places in the ScriptInterpreter interface used StringList objects where an std::string would suffice - Fixed
Refactoring calls that generated special-purposes functions in the Python interpreter to use helper functions instead of duplicating blobs of code


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152164 91177308-0d34-0410-b5e6-96231b3b80d8
BTypeCategory.cpp
a989307c1ec2ef9cd52ec65fb2c877bb2df3aa3a 06-Mar-2012 Greg Clayton <gclayton@apple.com> Added the ability to disassembly "count" instructions given a SBAddress.
This was done in SBTarget:

lldb::SBInstructionList
lldb::SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count);

Also cleaned up a few files in the LLDB.framework settings.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152152 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
4722b10307668368bf0f12fa6b8691e4f4cb5488 06-Mar-2012 Jim Ingham <jingham@apple.com> Add a command and an SB API to create exception breakpoints. Make the break output prettier for Exception breakpoints.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152081 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
0164b750df7e431716abfd3b26f124dfeefeae76 05-Mar-2012 Johnny Chen <johnny.chen@apple.com> rdar://problem/10976649

Add SBFrame::IsEqual(const SBFrame &that) method and export it to the Python binding.
Alos add a test case test_frame_api_IsEqual() to TestFrames.py file.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152050 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
c86723f0a71f5d929f4543c544d9255da52ea49d 02-Mar-2012 Han Ming Ong <hanming@apple.com> <rdar://problem/10967188>

When using launch_info for launching with a target already set, we should just prepend the target's path as the first argument.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151867 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
94b4e9a0bd2914bec3f700ae37f5ad558ba19326 29-Feb-2012 Han Ming Ong <hanming@apple.com> <rdar://10949461>

Only set the ProcessSP when the attach is successful.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151741 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
f125250ba7bcaa2ea5ee95539a309e3fd2f8b5d7 29-Feb-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10605072>

Added the ability to override command line commands. In some cases GUI interfaces
might want to intercept commands like "quit" or "process launch" (which might cause
the process to re-run). They can now do so by overriding/intercepting commands
by using functions added to SBCommandInterpreter using a callback function. If the
callback function returns true, the command is assumed to be handled. If false
is returned the command should be evaluated normally.

Adopted this up in the Driver.cpp for intercepting the "quit" command.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151708 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
1328b1410eb0f5e03c3b3ee302e9adca3e1b0361 29-Feb-2012 Enrico Granata <egranata@apple.com> This commit:
a) adds a Python summary provider for NSDate
b) changes the initialization for ScriptInterpreter so that we are not passing a bulk of Python-specific function pointers around
c) provides a new ScriptInterpreterObject class that allows for ref-count safe wrapping of scripting objects on the C++ side
d) contains much needed performance improvements:
1) the pointer to the Python function generating a scripted summary is now cached instead of looked up every time
2) redundant memory reads in the Python ObjC runtime wrapper are eliminated
3) summaries now use the m_summary_str in ValueObject to store their data instead of passing around ( == copying) an std::string object
e) contains other minor fixes, such as adding descriptive error messages for some cases of summary generation failure


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151703 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
435c5ef364f2f660f5f7fbbd749c2d5db15450e2 29-Feb-2012 Han Ming Ong <hanming@apple.com> <rdar://10950312>

Need to GetProcess() to set the uid of the process to attach.


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

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151476 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BTarget.cpp
80efa5e90a2924575e068cc44ee53e480e1d1467 25-Feb-2012 Greg Clayton <gclayton@apple.com> Added some missing accessors to the SBAttachInfo for user and group ID
getting, setting, and checking.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151408 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
98ca1e668c33bad3095da78977aaa3ee0043e6d7 24-Feb-2012 Greg Clayton <gclayton@apple.com> Fixed the launching code when using the new SBLaunchInfo.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151392 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
0a8dcacde404c520f1131c641041dceb9f68b6fa 24-Feb-2012 Greg Clayton <gclayton@apple.com> Added the new way we will eventually do all attaches and launches. First clients
will fill out either a SBLaunchInfo or SBAttachInfo class, then call:

SBProcess SBTarget::Launch (SBLaunchInfo &, SBError &);
SBProcess SBTarget::Attach (SBAttachInfo &, SBError &);

The attach is working right now and allows the ability to set many filters such
as the parent process ID, the user/group ID, the effective user/group ID, and much
more.

The launch is not yet working, but I will get this working soon. By changing our
launch and attach calls to take an object, it allows us to add more capabilities to
launching and attaching without having to have launch and attach functions that
take more and more arguments.

Once this is all working we will deprecated the older launch and attach fucntions
and eventually remove them.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151344 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
BTarget.cpp
3508c387c3f0c9ecc439d98048fd7694d41bab1b 24-Feb-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10103468>

I started work on being able to add symbol files after a debug session
had started with a new "target symfile add" command and quickly ran into
problems with stale Address objects in breakpoint locations that had
lldb_private::Section pointers into modules that had been removed or
replaced. This also let to grabbing stale modules from those sections.
So I needed to thread harded the Address, Section and related objects.

To do this I modified the ModuleChild class to now require a ModuleSP
on initialization so that a weak reference can created. I also changed
all places that were handing out "Section *" to have them hand out SectionSP.
All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild
so all of the find plug-in, static creation function and constructors now
require ModuleSP references instead of Module *.

Address objects now have weak references to their sections which can
safely go stale when a module gets destructed.

This checkin doesn't complete the "target symfile add" command, but it
does get us a lot clioser to being able to do such things without a high
risk of crashing or memory corruption.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151336 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBreakpoint.cpp
BFunction.cpp
BModule.cpp
BSection.cpp
BSymbol.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
d8465214c43d29755822670ad21ced2506faae7a 22-Feb-2012 Jim Ingham <jingham@apple.com> Make Debugger::SetLoggingCallback public, and expose it through the SB API. Sometimes it is not
convenient to provide a log callback right when the debugger is created.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151209 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
49f4bf21e0fb7675d67f95dafe66a098d3205650 22-Feb-2012 Greg Clayton <gclayton@apple.com> Added the ability to get a ObjectFile versions from the ObjectFile
subclasses if the object files support version numbering. Exposed
this through SBModule for upcoming data formatter version checking stuff.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151190 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
c48ca82920bd333c7ccb6ec0e579207add130296 21-Feb-2012 Jason Molenda <jmolenda@apple.com> Patch Enrico's changes from r150558 on 2012-02-14 to build even if Python
is not available (LLDB_DISABLE_PYTHON is defined).

Change build-swig-Python.sh to emit an empty LLDBPythonWrap.cpp file if
this build is LLDB_DISABLE_PYTHON.

Change the "Copy to Xcode.app" shell script phase in the lldb.xcodeproj
to only do this copying for Mac native builds.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151035 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BFrame.cpp
BTypeCategory.cpp
BTypeSummary.cpp
BTypeSynthetic.cpp
BValue.cpp
6c530f2201be4788dedf3d5970399220fbd50b11 21-Feb-2012 Jim Ingham <jingham@apple.com> Add a logging mode that takes a callback and flush'es to that callback.
Also add SB API's to set this callback, and to enable the log channels.


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

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151009 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
BThread.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
BFrame.cpp
b4d7fc0c466d446876e5f2d701f0e574dd0be8e7 17-Feb-2012 Greg Clayton <gclayton@apple.com> This checking is part one of trying to add some threading safety to our
internals. The first part of this is to use a new class:

lldb_private::ExecutionContextRef

This class holds onto weak pointers to the target, process, thread and frame
and it also contains the thread ID and frame Stack ID in case the thread and
frame objects go away and come back as new objects that represent the same
logical thread/frame.

ExecutionContextRef objcets have accessors to access shared pointers for
the target, process, thread and frame which might return NULL if the backing
object is no longer available. This allows for references to persistent program
state without needing to hold a shared pointer to each object and potentially
keeping that object around for longer than it needs to be.

You can also "Lock" and ExecutionContextRef (which contains weak pointers)
object into an ExecutionContext (which contains strong, or shared pointers)
with code like

ExecutionContext exe_ctx (my_obj->GetExectionContextRef().Lock());



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150801 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
d760907c1d42726fa0c8c48efa28385ed339bb94 17-Feb-2012 Enrico Granata <granata.enrico@gmail.com> Adding formatters for several useful Objective-C/Cocoa data types. The new categories are not enabled at startup, but can be manually activated if desired.
Adding new API calls to SBValue to be able to retrieve the associated formatters
Some refactoring to FormatNavigator::Get() in order to shrink its size down to more manageable terms (a future, massive, refactoring effort will still be needed)
Test cases added for the above


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150784 91177308-0d34-0410-b5e6-96231b3b80d8
BTypeNameSpecifier.cpp
BValue.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
BBroadcaster.cpp
BCommandInterpreter.cpp
BCommunication.cpp
BEvent.cpp
BListener.cpp
BProcess.cpp
BTarget.cpp
16376ed044df3ee70fcf69e19f06af01e71a8e9a 15-Feb-2012 Enrico Granata <granata.enrico@gmail.com> <rdar://problem/10062621>
New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
SBTypeCategory
SBTypeFilter
SBTypeFormat
SBTypeSummary
SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150558 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BTypeCategory.cpp
BTypeFilter.cpp
BTypeFormat.cpp
BTypeNameSpecifier.cpp
BTypeSummary.cpp
BTypeSynthetic.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
BModule.cpp
302d78c71902398ce1f422bd09216dd53a6abb88 10-Feb-2012 Sean Callanan <scallanan@apple.com> Extended function lookup to allow the user to
indicate whether inline functions are desired.
This allows the expression parser, for instance,
to filter out inlined functions when looking for
functions it can call.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150279 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTarget.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
BTarget.cpp
28e23861bedbeb5e46be7d2af4c33bf5132422c6 08-Feb-2012 Jim Ingham <jingham@apple.com> Send Breakpoint Changed events for all the relevant changes to breakpoints.
Also, provide and use accessors for the thread options on breakpoints so we
can control sending the appropriate events.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150057 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
BBreakpointLocation.cpp
BProcess.cpp
7dd5c51fbab8384b18f20ecc125f9a1bb3c9bcb2 06-Feb-2012 Greg Clayton <gclayton@apple.com> Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.

Changed the FindFunction class from:

uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)

uint32_t
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)

To:

lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.

Exposed properties for lldb.SBSymbolContextList in python:

lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list

This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:

sc_list = lldb.target.FindFunctions("erase")

for function in sc_list.functions:
print function
for symbol in sc_list.symbols:
print symbol

Exposed properties for the lldb.SBSymbolContext objects in python:

lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol


Exposed properties for the lldb.SBBlock objects in python:

lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok

SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.

SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:

lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);

lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);

When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.

When a SBTarget is used, global an static variables can be viewed without a
running process.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149853 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBlock.cpp
BFrame.cpp
BFunction.cpp
BModule.cpp
BSymbolContext.cpp
BSymbolContextList.cpp
BTarget.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
BModule.cpp
39f54ea7c3e0f9fb3bdc0d17a8def6781159d24f 04-Feb-2012 Greg Clayton <gclayton@apple.com> Allow a SBAddress to be created from a SBSection and an offset.

Changed the lldb.SBModule.section[<str>] property to return a single section.

Added a lldb.SBSection.addr property which returns an lldb.SBAddress object.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149755 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
0a19a1b9c25117854f226256805239d95153ed2d 04-Feb-2012 Greg Clayton <gclayton@apple.com> Convert all python objects in our API to use overload the __str__ method
instead of the __repr__. __repr__ is a function that should return an
expression that can be used to recreate an python object and we were using
it to just return a human readable string.

Fixed a crasher when using the new implementation of SBValue::Cast(SBType).

Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general
improvements to the API.

Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't
correctly handle not having a target.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149743 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BTarget.cpp
BType.cpp
BValue.cpp
BValueList.cpp
BWatchpoint.cpp
d62b9c18f3fc567fa536e04faadd518cd363a22e 03-Feb-2012 Greg Clayton <gclayton@apple.com> Expose more convenience functionality in the python classes.

lldb.SBValueList now exposes the len() method and also allows item access:

lldb.SBValueList[<int>] - where <int> is an integer index into the list, returns a single lldb.SBValue which might be empty if the index is out of range
lldb.SBValueList[<str>] - where <str> is the name to look for, returns a list() of lldb.SBValue objects with any matching values (the list might be empty if nothing matches)
lldb.SBValueList[<re>] - where <re> is a compiles regular expression, returns a list of lldb.SBValue objects for containing any matches or a empty list if nothing matches

lldb.SBFrame now exposes:

lldb.SBFrame.variables => SBValueList of all variables that are in scope
lldb.SBFrame.vars => see lldb.SBFrame.variables
lldb.SBFrame.locals => SBValueList of all variables that are locals in the current frame
lldb.SBFrame.arguments => SBValueList of all variables that are arguments in the current frame
lldb.SBFrame.args => see lldb.SBFrame.arguments
lldb.SBFrame.statics => SBValueList of all static variables
lldb.SBFrame.registers => SBValueList of all registers for the current frame
lldb.SBFrame.regs => see lldb.SBFrame.registers

Combine any of the above properties with the new lldb.SBValueList functionality
and now you can do:

y = lldb.frame.vars['rect.origin.y']

or

vars = lldb.frame.vars
for i in range len(vars):
print vars[i]

Also expose "lldb.SBFrame.var(<str>)" where <str> can be en expression path
for any variable or child within the variable. This makes it easier to get a
value from the current frame like "rect.origin.y". The resulting value is also
not a constant result as expressions will return, but a live value that will
continue to track the current value for the variable expression path.

lldb.SBValue now exposes:

lldb.SBValue.unsigned => unsigned integer for the value
lldb.SBValue.signed => a signed integer for the value




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149684 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
4e6640ee7975a9b9b0854aaa1f4d2d0f08702110 03-Feb-2012 Greg Clayton <gclayton@apple.com> Fixed casting in the lldb::SBValue::Cast(SBType) function.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149673 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
3eeaf6e715784499520885535236ccff1ba56d1c 03-Feb-2012 Greg Clayton <gclayton@apple.com> Added support to SBType for getting template arguments from a SBType:

uint32_t
SBType::GetNumberOfTemplateArguments ();

lldb::SBType
SBType::GetTemplateArgumentType (uint32_t idx);

lldb::TemplateArgumentKind
SBType::GetTemplateArgumentKind (uint32_t idx);

Some lldb::TemplateArgumentKind values don't have a corresponding SBType
that will be returned from SBType::GetTemplateArgumentType(). This will
help our data formatters do their job by being able to find out the
type of template params and do smart things with those.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149658 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
86ad476885a1fc5a14692534fb841be4eee7722a 01-Feb-2012 Greg Clayton <gclayton@apple.com> Added fuzz testing for when we call API calls with an invalid object.
We previously weren't catching that SBValue::Cast(...) would crash
if we had an invalid (empty) SBValue object.

Cleaned up the SBType API a bit.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149447 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
4eb01a76678281b40c0cbe8cc728e2f7c4598710 31-Jan-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10776614>

Fixed an issue where we can crash if you call cast when the SBValue
doesn't contain a valid value.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149345 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
0416bdf783a7dc2544b9ab034e225391f8f47343 30-Jan-2012 Greg Clayton <gclayton@apple.com> lldb::SBTarget and lldb::SBProcess are now thread hardened. They both still
contain shared pointers to the lldb_private::Target and lldb_private::Process
objects respectively as we won't want the target or process just going away.

Also cleaned up the lldb::SBModule to remove dangerous pointer accessors.

For any code the public API files, we should always be grabbing shared
pointers to any objects for the current class, and any other classes prior
to running code with them.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149238 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BFrame.cpp
BModule.cpp
BProcess.cpp
BSymbolContext.cpp
BTarget.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
BAddress.cpp
BCommandInterpreter.cpp
BDebugger.cpp
BFrame.cpp
BFunction.cpp
BInstruction.cpp
BModule.cpp
BProcess.cpp
BSourceManager.cpp
BSymbol.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
90c5214bc61ee2cdf68236b36d9746ecd275302e 30-Jan-2012 Greg Clayton <gclayton@apple.com> Removed the "lldb-forward-rtti.h" header file as it was designed to contain
all RTTI types, and since we don't use RTTI anymore since clang and llvm don't
we don't really need this header file. All shared pointer definitions have
been moved into "lldb-forward.h".

Defined std::tr1::weak_ptr definitions for all of the types that inherit from
enable_shared_from_this() in "lldb-forward.h" in preparation for thread
hardening our public API.

The first in the thread hardening check-ins. First we start with SBThread.
We have issues in our lldb::SB API right now where if you have one object
that is being used by two threads we have a race condition. Consider the
following code:

1 int
2 SBThread::SomeFunction()
3 {
4 int result = -1;
5 if (m_opaque_sp)
6 {
7 result = m_opaque_sp->DoSomething();
8 }
9 return result;
10 }

And now this happens:

Thread 1 enters any SBThread function and checks its m_opaque_sp and is about
to execute the code on line 7 but hasn't yet
Thread 2 gets to run and class sb_thread.Clear() which calls m_opaque_sp.clear()
and clears the contents of the shared pointer member
Thread 1 now crashes when it resumes.

The solution is to use std::tr1::weak_ptr. Now the SBThread class contains a
lldb::ThreadWP (weak pointer to our lldb_private::Thread class) and this
function would look like:

1 int
2 SBThread::SomeFunction()
3 {
4 int result = -1;
5 ThreadSP thread_sp(m_opaque_wp.lock());
6 if (thread_sp)
7 {
8 result = m_opaque_sp->DoSomething();
9 }
10 return result;
11 }

Now we have a solid thread safe API where we get a local copy of our thread
shared pointer from our weak_ptr and then we are guaranteed it can't go away
during our function.

So lldb::SBThread has been thread hardened, more checkins to follow shortly.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149218 91177308-0d34-0410-b5e6-96231b3b80d8
BBroadcaster.cpp
BFrame.cpp
BProcess.cpp
BThread.cpp
BValue.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
BAddress.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BFrame.cpp
BFunction.cpp
BProcess.cpp
BSection.cpp
BSymbol.cpp
BTarget.cpp
BValue.cpp
1b925206e3c4867fea9eb55a4c6460962cf32564 29-Jan-2012 Greg Clayton <gclayton@apple.com> Added the ability to get the target triple, byte order and address byte size
from the SBTarget and SBModule interfaces. Also added many python properties
for easier access to many things from many SB objects.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149191 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BModule.cpp
BTarget.cpp
177bc682e2b45354e8b0753e705dc84255c42173 27-Jan-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10750012>

Remove a pseudo terminal master open and slave file descriptor that was being
used for pythong stdin. It was not hooked up correctly and was causing file
descriptor leaks.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149098 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
a6b7e323caa2bbd1b2835dcce775340b27c13bf3 07-Jan-2012 Greg Clayton <gclayton@apple.com> Patch from Enrico Granata that moves SBData related functions into the SBData
class instead of requiring a live process in order to be able to create useful
SBData objects.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147702 91177308-0d34-0410-b5e6-96231b3b80d8
BData.cpp
BProcess.cpp
9f074f0e030a74a3efd716a476b436f2d32bdf74 06-Jan-2012 Johnny Chen <johnny.chen@apple.com> http://llvm.org/bugs/show_bug.cgi?id=11619
Allow creating SBData values from arrays or primitives in Python

Patch submitted by Enrico Granata.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147639 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
a4b43ab3cb7580667f9d7b5534dbc0c426964000 23-Dec-2011 Johnny Chen <johnny.chen@apple.com> rdar://problem/10216227
LLDB (python bindings) Crashing in lldb::SBDebugger::DeleteTarget(lldb::SBTarget&)

Need to check the validity of (SBTarget&)target passed to SBDebugger::DeleteTarget()
before calling target->Destroy().


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147213 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.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
BFrame.cpp
BValue.cpp
9fd2e38a1fa7f5cbbf70de0e2de35f72d77aced5 20-Dec-2011 Johnny Chen <johnny.chen@apple.com> Work in progress for:

rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add a NULL check for SBValue.CreateValueFromExpression().


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146954 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
5a4bbceda5ba940b0a0cafa657a214c8e69e3512 20-Dec-2011 Johnny Chen <johnny.chen@apple.com> Work in progress for:

rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add a NULL check for SBTarget.AttachToProcessWithName() so it will not hang.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146948 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
71eae57270d2cf072669e0d7721cff2e4bcf9cd5 20-Dec-2011 Johnny Chen <johnny.chen@apple.com> Remove dead code found.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146936 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
4278bbed87590201f699769cdfbafcc5d6224c33 20-Dec-2011 Johnny Chen <johnny.chen@apple.com> Work in progress for:

rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBStream APIs.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146934 91177308-0d34-0410-b5e6-96231b3b80d8
BStream.cpp
dccbc4b4b10f3efe2da3872cf36436e82bc1cc87 20-Dec-2011 Johnny Chen <johnny.chen@apple.com> Minor format update (no semantic change).


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146930 91177308-0d34-0410-b5e6-96231b3b80d8
BSourceManager.cpp
bab8cc9b05a2559759ec3252c6c519ca77479675 19-Dec-2011 Johnny Chen <johnny.chen@apple.com> Work in progress for:

rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBCommandInterpreter APIs.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146909 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
e0bd571a8050da2b3462c35c9f209cbc9755c750 19-Dec-2011 Jim Ingham <jingham@apple.com> Add needed Clear methods.
<rdar://problem/10596340>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146902 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BValue.cpp
BValueList.cpp
87b8c4c4ab028a1810667e117545156d40e64ff3 19-Dec-2011 Johnny Chen <johnny.chen@apple.com> Work in progress for:

rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBModule and SBSection APIs.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146899 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BSection.cpp
bcbefa8de7877c5d0674d5816cf96db48b103e6f 17-Dec-2011 Johnny Chen <johnny.chen@apple.com> Fixed code rot pointed out by Jim.
SBThread::GetStopReasonDataCount/GetStopReasonDataAtIndex() need to handle eStopReasonWatchpoint.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146812 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
1586d9720002e407a3a097baf302de5fa4ca9c1b 17-Dec-2011 Jim Ingham <jingham@apple.com> Add the ability to capture the return value in a thread's stop info, and print it
as part of the thread format output.
Currently this is only done for the ThreadPlanStepOut.
Add a convenience API ABI::GetReturnValueObject.
Change the ValueObject::EvaluationPoint to BE an ExecutionContextScope, rather than
trying to hand out one of its subsidiary object's pointers. That way this will always
be good.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146806 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
BValue.cpp
c5486870833244b1c705901f678f0aa2dca5b67c 15-Dec-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10584789>

Added a static memory pressure function in SBDebugger:

void SBDebugger::MemoryPressureDetected ()

This can be called by applications that detect memory pressure to cause LLDB to release cached information.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146640 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.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
BProcess.cpp
943485c90bdee0cf29304418b6dd16ee9927633a 15-Dec-2011 Johnny Chen <johnny.chen@apple.com> http://llvm.org/bugs/show_bug.cgi?id=11579
lldb::SBValue::CreateValueFromAddress does not verify SBType::GetPointerType succeeds

SBValue::CreateValueFromAddress() should check the validity of type and its derived pointer type
before using it. Add a test case.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146629 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
ef1f690aa23e81a14654d4a6fe9df7810f4eda06 15-Dec-2011 Sean Callanan <scallanan@apple.com> I have added a function to SBTarget that allows
clients to disassemble a series of raw bytes as
demonstrated by a new testcase.

In the future, this API will also allow clients
to provide a callback that adds comments for
addresses in the disassembly.

I also modified the SWIG harness to ensure that
Python ByteArrays work as well as strings as
sources of raw data.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146611 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
cd186e5ef6dacca7bd4914e99ef6b7551b5e79e4 14-Dec-2011 Johnny Chen <johnny.chen@apple.com> http://llvm.org/bugs/show_bug.cgi?id=11560 lldb::SBTarget::FindFirstType crashes when passed None

Add null checks to several functions. Plus add test scenario for passing None to SBTarget.FindFirstType(None) and friends.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146540 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
1b42575189379cb0c1441f74a48127e9ab7335e3 08-Dec-2011 Jim Ingham <jingham@apple.com> Add SBValue::GetDynamicValue and SBValue::GetStaticValue API's.
<rdar://problem/10545069>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146173 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
3cbf848f6d6ab60cdbe232083a4cc9e56054ca6e 05-Dec-2011 Jim Ingham <jingham@apple.com> Sanity check the inputs to SBCommandInterpreter::HandleCompletion

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145840 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
bae39c554644de9f319f59c25a76ad64bd266f84 03-Dec-2011 Greg Clayton <gclayton@apple.com> Fixed some extra warnings that show up with the new clang.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145735 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
d5b0b447221ab6e1fe5c5223c6bf7604d4377e8b 02-Dec-2011 Greg Clayton <gclayton@apple.com> After moving lldb::pid_t to 64 bits, keep a deprecated version around for
previous binaries that link against this for a few builds to make sure we
can continue to run against previous binaries.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145668 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BBreakpoint.cpp
BProcess.cpp
BThread.cpp
1d1f39eaf84f5424b162a6c89a4c4621d390bc5a 29-Nov-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10429064>

Fixed an issue where if we are debugging on a remote platform and set a
platform path for our executable, it was not being honored by the new
launch functions that used the ProcessLaunchInfo.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145371 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BDebugger.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
BProcess.cpp
BTarget.cpp
96154be69fa240a662419183ed08e1cfc5418164 13-Nov-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10126482>

Fixed an issues with the SBType and SBTypeMember classes:
- Fixed SBType to be able to dump itself from python
- Fixed SBType::GetNumberOfFields() to return the correct value for objective C interfaces
- Fixed SBTypeMember to be able to dump itself from python
- Fixed the SBTypeMember ability to get a field offset in bytes (the value
being returned was wrong)
- Added the SBTypeMember ability to get a field offset in bits


Cleaned up a lot of the Stream usage in the SB API files.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144493 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBlock.cpp
BBreakpointLocation.cpp
BCommandReturnObject.cpp
BCompileUnit.cpp
BData.cpp
BDebugger.cpp
BEvent.cpp
BFileSpec.cpp
BFileSpecList.cpp
BFrame.cpp
BLineEntry.cpp
BModule.cpp
BProcess.cpp
BSection.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
BWatchpoint.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
BProcess.cpp
BTarget.cpp
6e56157a52b093759f13321b7f2d601e3eaea8a0 10-Nov-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/9334299>

Added the ability to get a type without qualifiers (const, volatile, restrict, etc).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144302 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
668a6c7050fb29a25d63ffeaad5b5fc3a0e0a142 10-Nov-2011 Greg Clayton <gclayton@apple.com> Made the Host::SetCrashDescription(const char *) function copy the incoming
string to avoid possible later crashes.

Modified the locations that do set the crash description to NULL out the
string when they are done doing their tasks.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144297 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
3e4238d47a6d1a3106f357d2e7b495870721c7ae 04-Nov-2011 Greg Clayton <gclayton@apple.com> Fixed the Xcode project building of LLVM to be a bit more user friendly:

- If you download and build the sources in the Xcode project, x86_64 builds
by default using the "llvm.zip" checkpointed LLVM.
- If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the
Xcode project will download the right LLVM sources and build them from
scratch
- If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib"
directory, we will use the sources you have placed in the LLDB directory.

Python can now be disabled for platforms that don't support it.

Changed the way the libllvmclang.a files get used. They now all get built into
arch specific directories and never get merged into universal binaries as this
was causing issues where you would have to go and delete the file if you wanted
to build an extra architecture slice.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143678 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.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
BProcess.cpp
BTarget.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
BThread.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
BBlock.cpp
BDebugger.cpp
BFunction.cpp
BProcess.cpp
BThread.cpp
59df36f99b76e33852e6848a162f5c2851074ea2 17-Oct-2011 Enrico Granata <granata.enrico@gmail.com> this patch introduces a new command script import command which takes as input a filename for a Python script and imports the module contained in that file. the containing directory is added to the Python path such that dependencies are honored. also, the module may contain an __lldb_init_module(debugger,dict) function, which gets called after importing, and which can somehow initialize the module's interaction with lldb

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142283 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
712a628dde2f4f786389feecf7e06e59f0853c75 17-Oct-2011 Johnny Chen <johnny.chen@apple.com> Add a commnad to set a condition for a watchpoint. Example:

watchpoint modify -c 'global==5'

modifies the last created watchpoint so that the condition expression
is evaluated at the stop point to decide whether we should proceed with
the stopping.

Also add SBWatchpont::SetCondition(const char *condition) to set condition
programmatically.

Test cases to come later.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142227 91177308-0d34-0410-b5e6-96231b3b80d8
BWatchpoint.cpp
41a55efdfd779b910fb3515c47357c97e695ec22 14-Oct-2011 Johnny Chen <johnny.chen@apple.com> Add SBWatchpoint::GetError() API, which is not currently populated as yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141979 91177308-0d34-0410-b5e6-96231b3b80d8
BWatchpoint.cpp
50e0534f2edd82964a997cde7a79c540e38e76ba 14-Oct-2011 Johnny Chen <johnny.chen@apple.com> Add a test case to exercise the newly added SB API:

lldb::SBWatchpoint
SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write)


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141931 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BFrame.cpp
BTarget.cpp
BValue.cpp
BWatchpoint.cpp
1fa6b3d6c83955fe06c63d3a4025f2c0ec431d68 13-Oct-2011 Greg Clayton <gclayton@apple.com> Cleaned up the SBWatchpoint public API.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141876 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
BValue.cpp
BWatchpoint.cpp
BWatchpointLocation.cpp
3e80cd9c9e6ae50ff54537551e2fe3ed5319b9b4 12-Oct-2011 Sean Callanan <scallanan@apple.com> Added ClangNamespaceDecl * parameters to several
core Module functions that the expression parser
will soon be using.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141766 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
141f8d98cb74262914d66a7af4732e8cb2d8699f 12-Oct-2011 Greg Clayton <gclayton@apple.com> Fix preprocessor warnings for no newline at the end of the source files.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141755 91177308-0d34-0410-b5e6-96231b3b80d8
BData.cpp
1fb8a2dd636ef408728989d8bbc6d1a7a73177cc 11-Oct-2011 Jim Ingham <jingham@apple.com> Add a SBTarget::BreakpointCreateByName API that allows you to specify the name
type mask.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141625 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
bc36a861b8e0b2f2dde34f27c9fa9629a357d598 08-Oct-2011 Greg Clayton <gclayton@apple.com> Added more functionality to Range template classes in RangeMap.h and converted remaining DWARF areas that were using ranges over to this class. Also converted lldb_private::Block to use it.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141460 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
8b7b2276132c7353cabd22000287b42badc26613 08-Oct-2011 Jim Ingham <jingham@apple.com> Move the responsibility for translating the various eFunctionNameType lookups to the
SymbolFIle (it was done mostly in the BreakpointResolverName resolver before.) Then
tailor our searches to the way the indexed maps are laid out. This removes a bunch
of test case failures using indexed dSYM's.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141428 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
5956604941210ec6070dde444d3dc7a0094df045 03-Oct-2011 Johnny Chen <johnny.chen@apple.com> Fix regression of test SourceManagerTestCase.test_display_source_python.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141021 91177308-0d34-0410-b5e6-96231b3b80d8
BSourceManager.cpp
15afa9f26a38ea55876ac4ee0b17f0ac8137e9c1 01-Oct-2011 Greg Clayton <gclayton@apple.com> Removed lldb::SBSourceManager_impl. We export everything in the lldb namespace
and this implemenation that backs our lldb::SBSourceManager should not be
exported.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140930 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BSourceManager.cpp
BTarget.cpp
5cac6a54b36dd4f9b0db570720b8d47a487343f9 01-Oct-2011 Johnny Chen <johnny.chen@apple.com> Add SBFrame.WatchLocation() to find and watch the location pointed to by
a variable usng the frame as the scope.

Add TestSetWatchpoint.py to exercise this API. Also fix some SWIG Python
docstrings.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140914 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.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
BSymbolContext.cpp
f29d7f2c30d1afaacc6d3bd293ebb66cfa695717 30-Sep-2011 Greg Clayton <gclayton@apple.com> Destroy a target when it is deleted.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140845 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
d65593d3a6bf4fd5045e92e23adeea03e1695ce6 30-Sep-2011 Greg Clayton <gclayton@apple.com> After deleting a target, clear the target object and remove orphaned modules.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140843 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
5eb54bb63835eb01b200223503b5fd89a7557dd5 27-Sep-2011 Johnny Chen <johnny.chen@apple.com> Add SBTarget::GetLastCreatedWatchpointLocation() API and export to the Python interface.
Also add rich comparison methods (__eq__ and __ne__) for SBWatchpointLocation.
Modify TestWatchpointLocationIter.py to exercise the new APIs.

Add fuzz testings for the recently added SBTarget APIs related to watchpoint manipulations.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140633 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
092bd1575675778c6ebe901a7760af7427db617e 27-Sep-2011 Johnny Chen <johnny.chen@apple.com> Export the watchpoint related API (SBWatchpointLocation class and added SBTarget methods)
to the Python interface.

Implement yet another (threre're 3 now) iterator protocol for SBTarget: watchpoint_location_iter(),
to iterate on the available watchpoint locations. And add a print representation for
SBWatchpointLocation.

Exercise some of these Python API with TestWatchpointLocationIter.py.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140595 91177308-0d34-0410-b5e6-96231b3b80d8
BWatchpointLocation.cpp
d9b4425303fd48210ab104ca6573c869083a8480 27-Sep-2011 Greg Clayton <gclayton@apple.com> Fixed the public and internal disassembler API to be named correctly:

const char *
SBInstruction::GetMnemonic()

const char *
SBInstruction::GetOperands()

const char *
SBInstruction::GetComment()

Fixed the symbolicate example script and the internals.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140591 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
096c293f8d4171448908801d5a1a74b152af1430 27-Sep-2011 Johnny Chen <johnny.chen@apple.com> Add SB API class SBWatchpointLocation and some extra methods to the SBTarget class to
iterate on the available watchpoint locations and to perform watchpoint manipulations.

I still need to export the SBWatchpointLocation class as well as the added watchpoint
manipulation methods to the Python interface. And write test cases for them.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140575 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
BWatchpointLocation.cpp
dfbe94934209c1ea94aa8a42fe8d4d705a2a4fb7 26-Sep-2011 Johnny Chen <johnny.chen@apple.com> Modify SBFrame::WatchValue() impl so that for the watchpoint location created,
it also populates the variable declaration location if possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140540 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
23b8abbe214c252028f6e09f79169529c846409d 26-Sep-2011 Greg Clayton <gclayton@apple.com> Added more functionality to the public API to allow for better
symbolication. Also improved the SBInstruction API to allow
access to the instruction opcode name, mnemonics, comment and
instruction data.

Added the ability to edit SBLineEntry objects (change the file,
line and column), and also allow SBSymbolContext objects to be
modified (set module, comp unit, function, block, line entry
or symbol).

The SymbolContext and SBSymbolContext can now generate inlined
call stack infomration for symbolication much easier using the
SymbolContext::GetParentInlinedFrameInfo(...) and
SBSymbolContext::GetParentInlinedFrameInfo(...) methods.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140518 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
BCompileUnit.cpp
BInstruction.cpp
BLineEntry.cpp
BSymbolContext.cpp
15ef51e3bd8229d3779f96e08b25b26182c91c6c 24-Sep-2011 Greg Clayton <gclayton@apple.com> Added the ability to get all section contents, or the section
contents starting at an offset (2 separate methods). This helps
the scripting interface stay more natural by allowing both from
Python.

Added the ability to dump data with address annotations when
call SBData::GetDescription().

Hooked up the SBSection to the __repr__ so you can print section
objects from within python.

Improved the dumping of symbols from python.

Fixed the .i interface references which were set to "Relative to this Group"
which somehow included Jim's "lldb-clean" root directory in the path. The
interfaces are now in a folder called "interfaces" withing the Xcode API
subfolder.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140451 91177308-0d34-0410-b5e6-96231b3b80d8
BData.cpp
BSection.cpp
980c7500ca60ce7ee0917ea77bc9bb4563950c57 24-Sep-2011 Greg Clayton <gclayton@apple.com> Fixed build issues after recent checkin.

Added the ability to get the name of the SBSection.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140444 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpointLocation.cpp
BSection.cpp
9a29f00d3dae2e368bd01226388633fe8653808e 24-Sep-2011 Jim Ingham <jingham@apple.com> Add GetAddress to SBBreakpointLocation, and put the .i files in the API section of the Xcode project.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140440 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpointLocation.cpp
3e8c25f62f92145b6fb699b379cbfe72b1245d4a 24-Sep-2011 Greg Clayton <gclayton@apple.com> Added to the public API to allow symbolication:
- New SBSection objects that are object file sections which can be accessed
through the SBModule classes. You can get the number of sections, get a
section at index, and find a section by name.
- SBSections can contain subsections (first find "__TEXT" on darwin, then
us the resulting SBSection to find "__text" sub section).
- Set load addresses for a SBSection in the SBTarget interface
- Set the load addresses of all SBSection in a SBModule in the SBTarget interface
- Add a new module the an existing target in the SBTarget interface
- Get a SBSection from a SBAddress object

This should get us a lot closer to being able to symbolicate using LLDB through
the public API.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140437 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BDebugger.cpp
BModule.cpp
BSection.cpp
BTarget.cpp
4c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8 24-Sep-2011 Johnny Chen <johnny.chen@apple.com> Add an SB API SBFrame::WatchValue() and exported to the Python interface to
set a watchpoint Pythonically. If the find-and-watch-a-variable operation
fails, an invalid SBValue is returned, instead.

Example Python usage:

value = frame0.WatchValue('global',
lldb.eValueTypeVariableGlobal,
lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE)

Add TestSetWatchpoint.py to exercise this API.
We have 400 test cases now.


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


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140362 91177308-0d34-0410-b5e6-96231b3b80d8
BCompileUnit.cpp
BFileSpecList.cpp
BTarget.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
BBreakpoint.cpp
BFunction.cpp
BInstruction.cpp
a8428a458e779a64c8642fef5d29c7f6cc1b95f9 22-Sep-2011 Sean Callanan <scallanan@apple.com> Fixed a problem with the IR interpreter that caused
it to generate result variables that were not bound
to their underlying data. This allowed the SBValue
class to use the interpreter (if possible).

Also made sure that any result variables that point
to stack allocations in the stack frame of the
interpreted expressions do not get live data.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140285 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
a253c93b90dac1a735195d5640814c21b1851839 21-Sep-2011 Greg Clayton <gclayton@apple.com> Fixed two printf format errors.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140239 91177308-0d34-0410-b5e6-96231b3b80d8
BFileSpecList.cpp
BTarget.cpp
03c8ee5aeafcd6c43f10002a4f8096af01780f86 21-Sep-2011 Jim Ingham <jingham@apple.com> Add a new breakpoint type "break by source regular expression".
Fix the RegularExpression class so it has a real copy constructor.
Fix the breakpoint setting with multiple shared libraries so it makes
one breakpoint not one per shared library.
Add SBFileSpecList, to be used to expose the above to the SB interface (not done yet.)


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140225 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BFileSpecList.cpp
BTarget.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
BData.cpp
BProcess.cpp
BTarget.cpp
BThread.cpp
BValue.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
BThread.cpp
02e210cad27e36108bef493b798c2c1eb3b04cb8 17-Sep-2011 Greg Clayton <gclayton@apple.com> Removed the function:

ModuleSP
Module::GetSP();

Since we are now using intrusive ref counts, we can easily turn any
pointer to a module into a shared pointer just by assigning it.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139984 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.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
BFrame.cpp
BValue.cpp
83dd2039d86b79e9cd5cf320bdb50c838fcb7b9c 14-Sep-2011 Jim Ingham <jingham@apple.com> Adding "-n", "-p" and "-w" flags to the lldb command-line tool to
allow attaching from the command line.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139665 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
cc637461f6c59851302836c64e0cb002de4f4571 13-Sep-2011 Jim Ingham <jingham@apple.com> SBSourceManager now gets the real source manager either from the Debugger or Target. Also, move the SourceManager file cache into the debugger
so it can be shared amongst the targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139564 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BDebugger.cpp
BSourceManager.cpp
BTarget.cpp
d68e089f8353eaf845c3559dac6d47b32830974f 10-Sep-2011 Greg Clayton <gclayton@apple.com> Added the ability to introspect types thourgh the public SBType interface.

Fixed up many API calls to not be "const" as const doesn't mean anything to
most of our lldb::SB objects since they contain a shared pointer, auto_ptr, or
pointer to the types which circumvent the constness anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139428 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BType.cpp
BValue.cpp
fdf24efe672bf3fa041cdbebd2d7f406b11882bd 09-Sep-2011 Jim Ingham <jingham@apple.com> Move the SourceManager from the Debugger to the Target. That way it can store the per-Target default Source File & Line.
Set the default Source File & line to main (if it can be found.) at startup. Selecting the current thread & or frame resets
the current source file & line, and "source list" as well as the breakpoint command "break set -l <NUM>" will use the
current source file.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139323 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BSourceManager.cpp
BThread.cpp
915448044bac6fdac22a33cc46697dcb771a8df2 06-Sep-2011 Enrico Granata <granata.enrico@gmail.com> Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139160 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BData.cpp
BValue.cpp
3370f0ce9e2ae2fe1f2adf3628f443053602efa4 20-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Fixed some SWIG interoperability issues

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138154 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BDebugger.cpp
d8b9b06fcf29565079ba8f3a87fb267d80bcc968 20-Aug-2011 Greg Clayton <gclayton@apple.com> Added the ability to create a SBCommandReturnObject object from a pointer
and also to later release the ownership of the pointer object. This was needed
for SWIG interaction.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138133 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.cpp
13a54a141acd6255e4e11db466951ec1f26aa2f5 19-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Taking care of an issue with using lldb_private types in SBCommandInterpreter.cpp ; Making NSString test case work on Snow Leopard ; Removing an unused variable warning

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138105 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
6b1596d81c34c6efb10ed51a3572d6b145b73f5b 17-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Changes to Python commands:
- They now have an SBCommandReturnObject instead of an SBStream as third argument
- The class CommandObjectPythonFunction has been merged into CommandObjectCommands.cpp
- The command to manage them is now:
command script with subcommands add, list, delete, clear
command alias is returned to its previous functionality
- Python commands are now part of an user dictionary, instead of being seen as aliases



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137785 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BCommandReturnObject.cpp
c2a2825d787be5459fc55264e55b6020ff62f68a 16-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Python commands:
It is now possible to use 'command alias --python' to define a command name that actually triggers execution of a Python function
(e.g. command alias --python foo foo_impl makes a command named 'foo' that runs Python function 'foo_impl')
The Python function foo_impl should have as signature: def foo_impl(debugger, args, stream, dict): where
debugger is an object wrapping an LLDB SBDebugger
args is the command line arguments, as an unparsed Python string
stream is an SBStream that represents the standard output
dict is an internal utility parameter and should be left untouched
The function should return None on no error, or an error string to describe any problems


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137722 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
19030d8e5545e0edbd59d8e44a16a11728089afa 15-Aug-2011 Enrico Granata <granata.enrico@gmail.com> Refactoring of ValueObject::DumpValueObject and 'frame variable', 'target variable' commands to use an Options object instead of passing an ever-increasing number of arguments to the DumpValueObject() method, with the ultimate aim of making that call private implementation

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137622 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.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
BDebugger.cpp
558dd5bc8b25722fa5b5106586b97ecf99e0026e 13-Aug-2011 Jim Ingham <jingham@apple.com> Add a version of SBDebugger::Create which allows us to specify whether to source
in the init files or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137541 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
574c3d63822cc7fd52bf6f6a94b6882fec4c8ce9 13-Aug-2011 Jim Ingham <jingham@apple.com> Make ValueObject::SetValueFromCString work correctly.
Also change the SourceInitFile to look for .lldb-<APPNAME> and source that
preferentially if it exists.
Also made the breakpoint site report its address as well as its breakpoint number
when it gets hit and can't find any the associated locations (usually because the
breakpoint got disabled or deleted programmatically between the time it was hit
and reported.)
Changed ThreadPlanCallFunction to initialize the ivar m_func in the initializers of the
constructor, rather than waiting to initialize till later on in the function.
Fixed a bug where if you make an SBError and the ask it Success, it returns false.
Fixed ValueObject::ResolveValue so that it resolves a temporary value, rather than
overwriting the one in the value object.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137536 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BError.cpp
BValue.cpp
c51ffbf896e398ada5f7e89b2fa5aec6f2224f09 12-Aug-2011 Greg Clayton <gclayton@apple.com> We were leaking a stack frame in StackFrameList in Thread.cpp which could
cause extra shared pointer references to one or more modules to be leaked.
This would cause many object files to stay around the life of LLDB, so after
a recompile and rexecution, we would keep adding more and more memory. After
fixing the leak, we found many cases where leaked stack frames were still
being used and causing crashes in the test suite. These are now all resolved.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137516 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
018921dd162d818e71cf1ac86d03422e88f0a674 12-Aug-2011 Enrico Granata <granata.enrico@gmail.com> *Some more optimizations in usage of ConstString
*New setting target.max-children-count gives an upper-bound to the number of child objects that will be displayed at each depth-level
This might be a breaking change in some scenarios. To override the new limit you can use the --show-all-children (-A) option
to frame variable or increase the limit in your lldbinit file
*Command "type synthetic" has been split in two:
- "type synthetic" now only handles Python synthetic children providers
- the new command "type filter" handles filters
Because filters and synthetic providers are both ways to replace the children of a ValueObject, only one can be effective at any given time.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137416 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.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
BProcess.cpp
BTarget.cpp
ee6e790171b9a04023d0ea22603f0ac0ecb9a2c6 11-Aug-2011 Johnny Chen <johnny.chen@apple.com> Incremental fixes of issues found by Xcode static analyzer.


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

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

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

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

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137196 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
a713b869459b1d4a62c54a68535e6a8fd71c8a62 10-Aug-2011 Johnny Chen <johnny.chen@apple.com> Fix indentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137165 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
0c64baff28c9340f84fa566df1bf9426ddd2dc31 06-Aug-2011 Johnny Chen <johnny.chen@apple.com> On second thought, add the IsValid() method to SBTypeList, making it similar to SBSymbolContextList and SBValueList.
Modify the test suite accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136990 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
8c1d7203f726e3a62b832dbeeaf0ae76f9f65222 05-Aug-2011 Greg Clayton <gclayton@apple.com> Fixed issues for iOS debugging where if a device has
a native architecture that doesn't match the universal
slice that is being used for all executables, we weren't
correctly descending through the platform architectures
and resolving the binaries.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136980 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
c9310303c8d302476f7670d2472a9ba321327f58 04-Aug-2011 Enrico Granata <granata.enrico@gmail.com> more logical behavior for SBValue::CreateValueFromAddress

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136886 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
c92eb4004a354b0ea085b610b2ba991e575b1c32 04-Aug-2011 Enrico Granata <granata.enrico@gmail.com> APIs to GetValueAsSigned/Unsigned() in SBValue now also accept an SBError parameter to give more info about any problem
The synthetic children providers now use the new (safer) APIs to get the values of objects
As a side effect, fixed an issue in ValueObject where ResolveValue() was not always updating the value before reading it


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136861 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
0fb0bcc9d4e951145e1b8c783652224c09b23af4 04-Aug-2011 Greg Clayton <gclayton@apple.com> Cleaned up the SBType.h file to not include internal headers and reorganized
the SBType implementation classes.

Fixed LLDB core and the test suite to not use deprecated SBValue APIs.

Added a few new APIs to SBValue:

int64_t
SBValue::GetValueAsSigned(int64_t fail_value=0);

uint64_t
SBValue::GetValueAsUnsigned(uint64_t fail_value=0)




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136829 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BModule.cpp
BTarget.cpp
BType.cpp
BValue.cpp
7dfb1bb0c83c8472e6736c380e816158c4916acd 03-Aug-2011 Enrico Granata <granata.enrico@gmail.com> bug fix in SBValue::CreateValueFromAddress() where using the resulting VO as a pointer would crash LLDB ; minor improvements in dynamic formatters lookup

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136743 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
979e20d127335143ffc89c2e37ec3a8b717ff22d 29-Jul-2011 Enrico Granata <granata.enrico@gmail.com> Public API changes:
- Completely new implementation of SBType
- Various enhancements in several other classes
Python synthetic children providers for std::vector<T>, std::list<T> and std::map<K,V>:
- these return the actual elements into the container as the children of the container
- basic template name parsing that works (hopefully) on both Clang and GCC
- find them in examples/synthetic and in the test suite in functionalities/data-formatter/data-formatter-python-synth
New summary string token ${svar :
- the syntax is just the same as in ${var but this new token lets you read the values
coming from the synthetic children provider instead of the actual children
- Python providers above provide a synthetic child len that returns the number of elements
into the container
Full bug fix for the issue in which getting byte size for a non-complete type would crash LLDB
Several other fixes, including:
- inverted the order of arguments in the ClangASTType constructor
- EvaluationPoint now only returns SharedPointer's to Target and Process
- the help text for several type subcommands now correctly indicates argument-less options as such


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136504 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BModule.cpp
BTarget.cpp
BType.cpp
BValue.cpp
9ae7cef26612773c6b3422834cec83f0fbb2cf8c 24-Jul-2011 Enrico Granata <granata.enrico@gmail.com> Python synthetic children:
- you can now define a Python class as a synthetic children producer for a type
the class must adhere to this "interface":
def __init__(self, valobj, dict):
def get_child_at_index(self, index):
def get_child_index(self, name):
then using type synth add -l className typeName
(e.g. type synth add -l fooSynthProvider foo)
(This is still WIP with lots to be added)
A small test case is available also as reference

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135865 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
a395506fb374f1f589d0d860f5e6c9fa7b1e0b9a 22-Jul-2011 Greg Clayton <gclayton@apple.com> Make the SBAddress class easier to use when using the public
API.

SBTarget changes include changing:

bool
SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr,
lldb::SBAddress& addr);

to be:

lldb::SBAddress
SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr);

SBAddress can how contruct itself using a load address and a target
which can be used to resolve the address:

SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);

This will actually just call the new SetLoadAddress accessor:

void
SetLoadAddress (lldb::addr_t load_addr,
lldb::SBTarget &target);

This function will always succeed in making a SBAddress object
that can be used in API calls (even if "target" isn't valid).
If "target" is valid and there are sections currently loaded,
then it will resolve the address to a section offset address if
it can. Else an address with a NULL section and an offset that is
the "load_addr" that was passed in. We do this because a load address
might be from the heap or stack.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135770 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BModule.cpp
BTarget.cpp
e4e3e2c0448bb0c77f8f8a3bbb47b951a481d3d8 22-Jul-2011 Enrico Granata <granata.enrico@gmail.com> when typing a summary string you can use the %S symbol to explicitly indicate that you want the summary to be used to print the target object
(e.g. ${var%S}). this might already be the default if your variable is of an aggregate type
new feature: synthetic filters. you can restrict the number of children for your variables to only a meaningful subset
- the restricted list of children obeys the typical rules (e.g. summaries prevail over children)
- one-line summaries show only the filtered (synthetic) children, if you type an expanded summary string, or you use Python scripts, all the real children are accessible
- to provide a synthetic children list use the "type synth add" command, as in:
type synth add foo_type --child varA --child varB[0] --child varC->packet->flags[1-4]
(you can use ., ->, single-item array operator [N] and bitfield operator [N-M]; array slice access is not supported, giving simplified names to expression paths is not supported)
- a new -S option to frame variable and target variable lets you override synthetic children and instead show real ones

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135731 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
7f163b363aeccffeec8eda23bd31e4965abc7226 16-Jul-2011 Enrico Granata <granata.enrico@gmail.com> Some descriptive text for the Python script feature:
- help type summary add now gives some hints on how to use it
frame variable and target variable now have a --no-summary-depth (-Y) option:
- simply using -Y without an argument will skip one level of summaries, i.e.
your aggregate types will expand their children and display no summary, even
if they have one. children will behave normally
- using -Y<int>, as in -Y4, -Y7, ..., will skip as many levels of summaries as
given by the <int> parameter (obviously, -Y and -Y1 are the same thing). children
beneath the given depth level will behave normally
-Y0 is the same as omitting the --no-summary-depth parameter entirely
This option replaces the defined-but-unimplemented --no-summary

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135336 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
8f64c47120c81728aac0ab0d66097c9a92284f6f 15-Jul-2011 Greg Clayton <gclayton@apple.com> Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the

SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);

The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:

int *foo_ptr = ...

And you have a SBValue that contains the value for "foo_ptr":

SBValue foo_value = ...

You can now get the "foo_ptr[12]" item by doing this:

v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);

Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.

Likewise if you have code like:

int array[2];

array_value = ....

v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"

But if you use the ability to create synthetic children:

v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid






git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135292 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
f7a9b14c2c02d2fa9fad586c19f29d77533fcc09 15-Jul-2011 Enrico Granata <granata.enrico@gmail.com> Python summary strings:
- you can use a Python script to write a summary string for data-types, in one of
three ways:
-P option and typing the script a line at a time
-s option and passing a one-line Python script
-F option and passing the name of a Python function
these options all work for the "type summary add" command
your Python code (if provided through -P or -s) is wrapped in a function
that accepts two parameters: valobj (a ValueObject) and dict (an LLDB
internal dictionary object). if you use -F and give a function name,
you're expected to define the function on your own and with the right
prototype. your function, however defined, must return a Python string
- test case for the Python summary feature
- a few quirks:
Python summaries cannot have names, and cannot use regex as type names
both issues will be fixed ASAP
major redesign of type summary code:
- type summary working with strings and type summary working with Python code
are two classes, with a common base class SummaryFormat
- SummaryFormat classes now are able to actively format objects rather than
just aggregating data
- cleaner code to print descriptions for summaries
the public API now exports a method to easily navigate a ValueObject hierarchy
New InputReaderEZ and PriorityPointerPair classes
Several minor fixes and improvements

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135238 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BValue.cpp
24b03108fe8d672bf96b2cfd491e99e601f03218 09-Jul-2011 Greg Clayton <gclayton@apple.com> Fixed the global and static variables to always be in scope.

Made it so that you can create synthetic children of array
value objects. This is for creating array members when the
array index is out of range. This comes in handy when you have
a structure definition like:

struct Collection
{
uint32_t count;
Item array[0];
};
"array" has 1 item, but many times in practice there are more
items in "item_array".

This allows you to do:

(lldb) target variable g_collection.array[3]

To implement this, the get child at index has been modified
to have a "ignore_array_bounds" boolean that can be set to true.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134846 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
968958c31c42224cfd5eb4ba0cf6fe0157ab375c 07-Jul-2011 Johnny Chen <johnny.chen@apple.com> Add SBValue::GetID() member method call API.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134636 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
bafc86e11a23ad23112f67a99e42aac7b0f207d7 06-Jul-2011 Greg Clayton <gclayton@apple.com> Made the string representation for a SBValue return what "frame variable"
would return instead of a less than helpful "name: '%s'" description.

Make sure that when we ask for the error from a ValueObject object we
first update the value if needed.

Cleaned up some SB functions to use internal functions and not re-call
through the public API when possible.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134497 91177308-0d34-0410-b5e6-96231b3b80d8
BError.cpp
BValue.cpp
107e53da8bdca540db8b734ed237688eaeee85c5 06-Jul-2011 Greg Clayton <gclayton@apple.com> Fixed some issues with ARM backtraces by not processing any push/pop
instructions if they are conditional. Also fixed issues where the PC wasn't
getting bit zero stripped for ARM targets when a stack frame was thumb. We
now properly call through the GetOpcodeLoadAddress() functions to make sure
the addresses are properly stripped for any targets that may decorate up
their addresses.

We now don't pass the SIGSTOP signals along. We can revisit this soon, but
currently this was interfering with debugging some older ARM targets that
don't have vCont support in the GDB server.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134461 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
b302b2f50e079b11a12ebafc29104c198f4f15e4 30-Jun-2011 Greg Clayton <gclayton@apple.com> Centralize all of the type name code so that we always strip the leading
"struct ", "class ", and "union " from the start of any type names that are
extracted from clang QualType objects. I had to fix test suite cases that
were expecting the struct/union/class prefix to be there.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134132 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
917c000e77fcf657099f59085d6436d179a39ea4 30-Jun-2011 Greg Clayton <gclayton@apple.com> Added support for finding and global variables in the SBTarget and SBModule
level in the public API.

Also modified the ValueObject values to be able to display global variables
without having a valid running process. The globals will read themselves from
the object file section data if there is no process, and from the process if
there is one.

Also fixed an issue where modifications for dynamic types could cause child
values of ValueObjects to not show up if the value was unable to evaluate
itself (children of NULL pointer objects).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134102 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BTarget.cpp
BValueList.cpp
446ccaa81e42b089b6245a950cb4fca05cce12dd 29-Jun-2011 Johnny Chen <johnny.chen@apple.com> Add fuzz calls to SBType, SBValue, and SBValueList.
Fixed crashes for SBValue fuzz calls.
And change 'bool SBType::IsPointerType(void)' to
'bool SBType::IsAPointerType(void)' to avoid name collision with the static 'bool SBType::IsPointerType(void *)'
function, which SWIG cannot handle.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134096 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
BValue.cpp
b9dcc51255c70db00c20f0b5e4b0a3e92d398f08 29-Jun-2011 Greg Clayton <gclayton@apple.com> Fixed an issue that was checked in with the dynamic types and update point
changes that caused all SBValue objects to completely ignore the target
lock due to bad C++ scoping of the target Mutex::Locker variables.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134081 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
e657fbc20b4d5199ad2daae85678f0038df5095d 29-Jun-2011 Johnny Chen <johnny.chen@apple.com> Add fuzz calls for SBTarget and SBThread.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134046 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
b7a9d64b2558ed5b8c15ce37de47fc7dd33004e8 29-Jun-2011 Johnny Chen <johnny.chen@apple.com> Add fuzz calls for SBModule and SBProcess.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134037 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
87ac9024b5ae2d4f1f66ea9128acb8e76825b358 25-Jun-2011 Greg Clayton <gclayton@apple.com> Bumped Xcode project versions to lldb-65 and debugserver-140.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133865 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
58513667f6765aa8db13cdc4abd500340c1cac80 25-Jun-2011 Jim Ingham <jingham@apple.com> Add support for looking up ivar offset from the ObjC runtime.


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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133785 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
BTarget.cpp
4ed315fdc503cfdc18e89b1eb43bf87e07fd1673 21-Jun-2011 Greg Clayton <gclayton@apple.com> Added the ability to find functions from either a SBModule (find functions
only in a specific module), or in a SBTarget (all modules for a target).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133498 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BSymbolContextList.cpp
BTarget.cpp
d2554b5b7d4531b44bfbbea00cccc5fd274ef76b 21-Jun-2011 Johnny Chen <johnny.chen@apple.com> Test lldb Python API object's default constructor and make sure it is invalid
after initial construction.

There are two exceptions to the above general rules, though; the API objects are
SBCommadnReturnObject and SBStream.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133475 91177308-0d34-0410-b5e6-96231b3b80d8
BCommunication.cpp
BInstructionList.cpp
582ed0ed40a4f4135368dc4d2aff44f22f04b701 18-Jun-2011 Greg Clayton <gclayton@apple.com> Added two new API functions to SBFrame:

const char *
SBFrame::GetFunctionName();

bool
SBFrame::IsInlined();


The first one will return the correct name for a frame. The name of a frame is:
- the name of the inlined function (if there is one)
- the name of the concrete function (if there is one)
- the name of the symbol (if there is one)
- NULL

We also can now easily check if a frame is an inline function or not.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133357 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
58d02ff2addb37231741506da3bf96cf31158ddd 17-Jun-2011 Johnny Chen <johnny.chen@apple.com> Add a bunch of test cases to TestHelloWorld.py to exercise combinations of dwarf/dsym debug setup.
Among them are test cases to exercise SBTarget.AttachToProcessWithName(); we attach to "hello_world",
and verify that, after attachment, the currently selected target indeed matches "hello_world".


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133279 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
604f0d336f0d9390a0405022ef660ae922ef29bf 17-Jun-2011 Greg Clayton <gclayton@apple.com> Added the notion of an system root for SDKs. This is a directory where all
libraries and headers exist. This can be specified using the platform select
function:

platform select --sysroot /Volumes/remote-root remote-macosx

Each platform subclass is free to interpret the sysroot as needed.

Expose the new SDK root directory through the SBDebugger class.

Fixed an issue with the GDB remote protocol where unimplemented packets were
not being handled correctly.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133231 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
63afdb07641f04aa7b60d895120b056124d3469b 17-Jun-2011 Greg Clayton <gclayton@apple.com> Improved the packet throughput when debugging with GDB remote by over 3x on
darwin (not sure about other platforms).

Modified the communication and connection classes to not require the
BytesAvailable function. Now the "Read(...)" function has a timeout in
microseconds.

Fixed a lot of assertions that were firing off in certain cases and replaced
them with error output and code that can deal with the assertion case.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133224 91177308-0d34-0410-b5e6-96231b3b80d8
BCommunication.cpp
535960ee92f58617fdcc016d75c49ddf650517df 17-Jun-2011 Johnny Chen <johnny.chen@apple.com> o TestHelloWorld.py:

Add a test case for the SBTarget::AttachToProcessWithID() API call.

o main.c:

The change goes with the added test case test_with_dwarf_and_attach_to_process_with_id_api() above.

o SBTarget.cpp:

Checks whether we're in synchronous mode. If yes, let's wait for the process to stop right after attaching.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133223 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
409646d247dc8a1efe4f199a1b251516ffc62f60 15-Jun-2011 Johnny Chen <johnny.chen@apple.com> Add an API to SBDebugger class:

bool SBDebugger::DeleteTarget(lldb::SBTarget &target);

which is used in the test tearDown() phase to cleanup the debugger's target list
so that it won't grow larger and larger as test cases are executed. This is also
a good opportunity to get rid of the arcane requirement that test cases exercising
the Python API must assign the process object to self.process so that it gets
shutdown gracefully. Instead, the shutdown of the process associated with each
target is now being now automatically.

Also get rid of an API from SBTarget class:

SBTarget::DeleteTargetFromList(lldb_private::TargetList *list);


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133091 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BTarget.cpp
84cc16d1ce51a1659d89e13ce42a09c3e3ebad14 14-Jun-2011 Caroline Tice <ctice@apple.com> Add error message; clean up comment.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132997 91177308-0d34-0410-b5e6-96231b3b80d8
BHostOS.cpp
421ca5014ea0e163998b9a8e0d777d3adb5c872e 29-May-2011 Greg Clayton <gclayton@apple.com> Don't have the debugger default to ignoring EOF. This is only what the driver
(or anything running in a terminal) wants. Not what a UI (Xcode) would want
where it creates a debugger per debug window. The current code had an infinite
loop after a debug session ended.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@132280 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
fab305b29d6a1cda5b41cd40eb3e11b31ff5f624 21-May-2011 Greg Clayton <gclayton@apple.com> Lock the target API mutex correctly in all cases and make sure m_opaque_sp
contains a valid pointer before trying to access the target.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131771 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
905acaf31904f352bab9f75fefa380aee297b0cb 21-May-2011 Greg Clayton <gclayton@apple.com> Now that we have dynamic values, we need to protect the GetChildAtIndex()
calls with the target API mutex.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131762 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
b38df1e945846a5d956974ec157902a6ad748868 10-May-2011 Caroline Tice <ctice@apple.com> Make sure writing asynchronous output only backs up
& overwrites prompt if the IOChannel input reader is the top
input reader.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131110 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
b07c62a233f3e54e78154a5718ea18eb51a0bea9 08-May-2011 Jim Ingham <jingham@apple.com> StepUntil should check whether the target of the step until is in the current
function and if not return an error.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131061 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
10de7d1db3ec782ea2ccda1f39c0a40b9c301594 04-May-2011 Jim Ingham <jingham@apple.com> Change "frame var" over to using OptionGroups (and thus the OptionGroupVariableObjectDisplay).
Change the boolean "use_dynamic" over to a tri-state, no-dynamic, dynamic-w/o running target,
and dynamic with running target.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130832 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BValue.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
BDebugger.cpp
ef80aabe53b7fdf61309ba6d3d6865c94c681345 02-May-2011 Jim Ingham <jingham@apple.com> Adding support for fetching the Dynamic Value for ObjC Objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130701 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.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
BDebugger.cpp
BModule.cpp
BTarget.cpp
888a7334344778d1a4edbd58b5852ae4d53ffed9 26-Apr-2011 Greg Clayton <gclayton@apple.com> Changed the emulate instruction function to take emulate options which
are defined as enumerations. Current bits include:

eEmulateInstructionOptionAutoAdvancePC
eEmulateInstructionOptionIgnoreConditions

Modified the EmulateInstruction class to have a few more pure virtuals that
can help clients understand how many instructions the emulator can handle:

virtual bool
SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0;


Where instruction types are defined as:

//------------------------------------------------------------------
/// Instruction types
//------------------------------------------------------------------
typedef enum InstructionType
{
eInstructionTypeAny, // Support for any instructions at all (at least one)
eInstructionTypePrologueEpilogue, // All prologue and epilogue instructons that push and pop register values and modify sp/fp
eInstructionTypePCModifying, // Any instruction that modifies the program counter/instruction pointer
eInstructionTypeAll // All instructions of any kind

} InstructionType;


This allows use to tell what an emulator can do and also allows us to request
these abilities when we are finding the plug-in interface.

Added the ability for an EmulateInstruction class to get the register names
for any registers that are part of the emulation. This helps with being able
to dump and log effectively.

The UnwindAssembly class now stores the architecture it was created with in
case it is needed later in the unwinding process.

Added a function that can tell us DWARF register names for ARM that goes
along with the source/Utility/ARM_DWARF_Registers.h file:

source/Utility/ARM_DWARF_Registers.c

Took some of plug-ins out of the lldb_private namespace.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130189 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
a2cffd3e511955855a1c281b45315cf911636a1c 26-Apr-2011 Caroline Tice <ctice@apple.com> Add 'lldb_private' namespace where necessary to prevent ambiguity and
resulting infinite loops.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130159 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
bdc36bd05d156143d9f2e568a1aa1b5253bbe1f1 25-Apr-2011 Johnny Chen <johnny.chen@apple.com> Make SBBreakpointLocation::GetDescription() API to be consistent with SBTarget,
i.e., with 'SBStream &description' first, followed by 'DescriptionLevel level'.

Modify lldbutil.py so that get_description() for a target or breakpoint location
can just take the lldb object itself without specifying an option to mean option
lldb.eDescriptionLevelBrief. Modify TestTargetAPI.py to exercise this logic path.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130147 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpointLocation.cpp
ff44ab42e9f5d8e4d550e11d1b69413e0bc75b71 23-Apr-2011 Greg Clayton <gclayton@apple.com> Fixed the SymbolContext::DumpStopContext() to correctly indent and dump
inline contexts when the deepest most block is not inlined.

Added source path remappings to the lldb_private::Target class that allow it
to remap paths found in debug info so we can find source files that are elsewhere
on the current system.

Fixed disassembly by function name to disassemble inline functions that are
inside other functions much better and to show enough context before the
disassembly output so you can tell where things came from.

Added the ability to get more than one address range from a SymbolContext
class for the case where a block or function has discontiguous address ranges.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130044 91177308-0d34-0410-b5e6-96231b3b80d8
BSourceManager.cpp
47da810225d8674eb9158bcf5f1f5b847cbaeedf 23-Apr-2011 Jim Ingham <jingham@apple.com> Fix up how the ValueObjects manage their life cycle so that you can hand out a shared
pointer to a ValueObject or any of its dependent ValueObjects, and the whole cluster will
stay around as long as that shared pointer stays around.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130035 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BValue.cpp
09008d035b798ccae9fc5208567aaf4a01a28b23 21-Apr-2011 Johnny Chen <johnny.chen@apple.com> Use self.TraceOn() API to decide whether to print debug output.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129935 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
6b8d3b5e7f0507aca2ee1c0937d7ec80fa2a9c5b 20-Apr-2011 Caroline Tice <ctice@apple.com> Add the infrastructure to test instruction emulations automatically.
The idea is that the instruction to be emulated is actually executed
on the hardware to be emulated, with the before and after state of the
hardware being captured and 'freeze-dried' into .dat files. The
emulation testing code then loads the before & after state from the
.dat file, emulates the instruction using the before state, and
compares the resulting state to the 'after' state. If they match, the
emulation is accurate, otherwise there is a problem.

The final format of the .dat files needs a bit more work; the plan is
to generalize them a bit and to convert the plain values to key-value pairs.
But I wanted to get this first pass committed.

This commit adds arm instruction emulation testing to the testsuite, along with
many initial .dat files.

It also fixes a bug in the llvm disassembler, where 32-bit thumb opcodes
were getting their upper & lower 16-bits reversed.

There is a new Instruction sub-class, that is intended to be loaded
from a .dat file rather than read from an executable. There is also a
new EmulationStateARM class, for handling the before & after states.
EmulationStates for other architetures can be added later when we
emulate their instructions.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129832 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
9ce9c3ce0106de3fe415596ca92b6133ab2d2ec0 19-Apr-2011 Greg Clayton <gclayton@apple.com> Fixed an issue where if you specify an architecture from the command line like:
$ lldb --arch i386-unknown-unknown a.out

It would then create a target with only the "i386" part due to
SBDebugger::GetDefaultArchitecture(...) truncating the arch triple due to the
way things used to be.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129731 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.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
BFrame.cpp
BValue.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
BTarget.cpp
0fe5a535b87841a5c422f4a79d55c21bf07b50ca 09-Apr-2011 Caroline Tice <ctice@apple.com> Fix various things in the instruction emulation code:

- Add ability to control whether or not the emulator advances the
PC register (in the emulation state), if the instruction itself
does not change the pc value..

- Fix a few typos in asm description strings.

- Fix bug in the carry flag calculation.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129168 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
ec2d9787bed36e9eda6eac1996c7bed76c8d3da4 08-Apr-2011 Stephen Wilson <wilsons@start.ca> Add missing headers.

Something changed in commit r129112 where a few standard headers vanished from
the include chain when building on Linux. Fix up by including limits.h for
INT_MAX and PATH_MAX where needed, and stdio.h for printf().



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129130 91177308-0d34-0410-b5e6-96231b3b80d8
BFileSpec.cpp
BLineEntry.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
BDebugger.cpp
BInstruction.cpp
af59180d46b42665dba3ea581fc501bb9fcb1fb7 06-Apr-2011 Caroline Tice <ctice@apple.com> Add Emulate and DumpEmulation to Instruction class.

Move InstructionLLVM out of DisassemblerLLVM class.

Add instruction emulation function calls to SBInstruction and SBInstructionList APIs.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128956 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
BInstructionList.cpp
919ee60577297be31eb69f14a5901e7c6170a9ca 01-Apr-2011 Johnny Chen <johnny.chen@apple.com> Add TestSymbolAPI.py to test the newly added SBSymbol and SBAddress APIs:

lldb::SymbolType SBSymbol::GetType();

lldb::SectionType SBAddress::GetSectionType ();
lldb::SBModule SBAddress::GetModule ();

Also add an lldb::SBModule::GetUUIDString() API which is easier for Python
to work with in the test script.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128695 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
b0e68d996b28cf81a28aeceefd69f7ed8d4aba99 31-Mar-2011 Greg Clayton <gclayton@apple.com> Added some functions to our API related to classifying symbols as code, data,
const data, etc, and also for SBAddress objects to classify their type of
section they are in and also getting the module for a section offset address.

lldb::SymbolType SBSymbol::GetType();

lldb::SectionType SBAddress::GetSectionType ();
lldb::SBModule SBAddress::GetModule ();




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128602 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BSymbol.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
BFrame.cpp
BValue.cpp
b5871fe4d11a06d5f468a607059a361cbdc25e1d 31-Mar-2011 Jim Ingham <jingham@apple.com> Add a LaunchSimple API that is nicer to use for quick scripts.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128588 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BTarget.cpp
889fbd0581c24523642e0a04d659cc8f3dcdb4ed 26-Mar-2011 Greg Clayton <gclayton@apple.com> Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:

uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;

uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;

Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.

Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.

Changed:

bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);

To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);

This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.

Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").

Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.

Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:

(lldb) disassemble --arch thumb --name main

You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0

Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128347 91177308-0d34-0410-b5e6-96231b3b80d8
BInstruction.cpp
BInstructionList.cpp
149731c0b267e5b6cd7192cbfac0c7f457ae5cfc 25-Mar-2011 Greg Clayton <gclayton@apple.com> Cleaned up the Disassembler code a bit more. You can now request a disassembler
plugin by name on the command line for when there is more than one disassembler
plugin.

Taught the Opcode class to dump itself so that "disassembler -b" will dump
the bytes correctly for each opcode type. Modified all places that were passing
the opcode bytes buffer in so that the bytes could be displayed to just pass
in a bool that indicates if we should dump the opcode bytes since the opcode
now lives inside llvm_private::Instruction.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128290 91177308-0d34-0410-b5e6-96231b3b80d8
BFunction.cpp
BInstruction.cpp
BInstructionList.cpp
BSymbol.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
BDebugger.cpp
BTarget.cpp
e86cbb9ef128db87cf904e330b2edfc15566bacd 22-Mar-2011 Greg Clayton <gclayton@apple.com> Abtracted the innards of lldb-core away from the SB interface. There was some
overlap in the SWIG integration which has now been fixed by introducing
callbacks for initializing SWIG for each language (python only right now).
There was also a breakpoint command callback that called into SWIG which has
been abtracted into a callback to avoid cross over as well.

Added a new binary: lldb-platform

This will be the start of the remote platform that will use as much of the
Host functionality to do its job so it should just work on all platforms.
It is pretty hollowed out for now, but soon it will implement a platform
using the GDB remote packets as the transport.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128053 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BDebugger.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
BDebugger.cpp
42da4dae5d7dccf98a57399d4689150b928ab545 05-Mar-2011 Johnny Chen <johnny.chen@apple.com> Add a test case ProcessAPITestCase.test_remote_launch() which tests SBProcess.RemoteLaunch()
API with a process not in eStateConnected, and checks that the remote launch failed.

Modify SBProcess::RemoteLaunch()/RemoteAttachToProcessWithID()'s log statements to fix a
crasher when logging is turned on.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127055 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
3809340ce8954dbeaf24907ece29cd6b179143ea 04-Mar-2011 James McIlree <jmcilree@apple.com> Expose ConnectRemote API through SBTarget and SBProcess.
Patch verified by Greg Clayton prior to checkin.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126974 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
BTarget.cpp
89f1aa732c8b1df90cbbfe116b6f06cf80a25ae3 03-Mar-2011 Greg Clayton <gclayton@apple.com> Export the ability to get the start and end addresses for functions
and symbols, and also allow clients to get the prologue size in bytes:

SBAddress
SBFunction::GetStartAddress ();

SBAddress
SBFunction::GetEndAddress ();

uint32_t
SBFunction::GetPrologueByteSize ();

SBAddress
SBSymbol::GetStartAddress ();

SBAddress
SBSymbol::GetEndAddress ();

uint32_t
SBSymbol::GetPrologueByteSize ();



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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126885 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
60a544f23362d4f2fbe1e68b9c5340aa5e11302c 01-Mar-2011 Johnny Chen <johnny.chen@apple.com> Add an API SBProcess::GetByteOrder() and add test cases which utilizes GetByteOrder(),
among other SBProcess APIs, to write (int)256 into a memory location of a global variable
(int)my_int and reads/checks the variable afterwards.


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

uint32_t
ArchSpec::GetMachOCPUType () const;

uint32_t
ArchSpec::GetMachOCPUSubType () const;

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

All code has been updated to deal with the changes.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126278 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
aa378b1f53f8b557ceab403e31e6c9ef9a20b77d 20-Feb-2011 Greg Clayton <gclayton@apple.com> Don't limit StreamTee to just two streams. It now can contain
N streams by making the stream a vector of stream shared pointers
that is protected by a mutex. Streams can be get/set by index which
allows indexes to be defined as stream indentifiers. If a stream is
set at index 3 and there are now streams in the collection, then
empty stream objects are inserted to ensure that stream at index 3
has a valid stream. There is also an append method that allows a stream
to be pushed onto the stack. This will allow our streams to be very
flexible in where the output goes.

Modified the CommandReturnObject to use the new StreamTee functionality.
This class now defines two StreamTee indexes: 0 for the stream string
stream, and 1 for the immediate stream. This is used both on the output
and error streams.

Added the ability to get argument types as strings or as descriptions.
This is exported through the SBCommandInterpreter API to allow external
access.

Modified the Driver class to use the newly exported argument names from
SBCommandInterpreter::GetArgumentTypeAsCString().



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126067 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
2e8cb8a7342a2ea672792067d712a794e215a3a7 19-Feb-2011 Jim Ingham <jingham@apple.com> - Changed all the places where CommandObjectReturn was exporting a StreamString to just exporting
a Stream, and then added GetOutputData & GetErrorData to get the accumulated data.
- Added a StreamTee that will tee output to two provided lldb::StreamSP's.
- Made the CommandObjectReturn use this so you can Tee the results immediately to
the debuggers output file, as well as saving up the results to return when the command
is done executing.
- HandleCommands now uses this so that if you have a set of commands that continue the target
you will see the commands come out as they are processed.
- The Driver now uses this to output the command results as you go, which makes the interface
more reactive seeming.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126015 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandReturnObject.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
BProcess.cpp
5892856b0cd6591194c669afab5bf9ac19c5b3a0 09-Feb-2011 Greg Clayton <gclayton@apple.com> Use Host::File in lldb_private::StreamFile and other places to cleanup host
layer a bit more.



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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125078 91177308-0d34-0410-b5e6-96231b3b80d8
BFileSpec.cpp
BHostOS.cpp
BTarget.cpp
271a5db096ae183e9235ebd273c4a6aab6130b3e 03-Feb-2011 Greg Clayton <gclayton@apple.com> Added a SBListener parameter to Launch and attach calls to avoid a race
condition that could occur when launching or attaching. What could happen is
you would launch/attach to a process, then you would need to tell a listener
to watch for process state changed events. In this case, if you waited too
long to listen for events, you could miss the initial stop event, requiring
clients to listen, then check the process state.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124818 91177308-0d34-0410-b5e6-96231b3b80d8
BListener.cpp
BTarget.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
BTarget.cpp
28d5fcc3158aebf543e0f3d0a3608c1746f5ef15 27-Jan-2011 Greg Clayton <gclayton@apple.com> Changed the SymbolFile::FindFunction() function calls to only return
lldb_private::Function objects. Previously the SymbolFileSymtab subclass
would return lldb_private::Symbol objects when it was asked to find functions.

The Module::FindFunctions (...) now take a boolean "bool include_symbols" so
that the module can track down functions and symbols, yet functions are found
by the SymbolFile plug-ins (through the SymbolVendor class), and symbols are
gotten through the ObjectFile plug-ins.

Fixed and issue where the DWARF parser might run into incomplete class member
function defintions which would make clang mad when we tried to make certain
member functions with invalid number of parameters (such as an operator=
operator that had no parameters). Now we just avoid and don't complete these
incomplete functions.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124359 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
7c330d677966431920c92bcf8e2ac7093719cbec 27-Jan-2011 Greg Clayton <gclayton@apple.com> Added support for some new environment variables within LLDB to enable some
extra launch options:

LLDB_LAUNCH_FLAG_DISABLE_ASLR disables ASLR for all launched processes

LLDB_LAUNCH_FLAG_DISABLE_STDIO will disable STDIO (reroute to "/dev/null")
for all launched processes

LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY will force all launched processes to be
launched in new terminal windows.

Also, don't init python if we never create a script interpreter.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124341 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
5ec14f83253f65f51cc0aff15ac34c0f32750e5e 23-Jan-2011 Greg Clayton <gclayton@apple.com> Deprecated old forms of SBTarget::Launch. There is not just one and no
SWIG renaming done to work around deprecated APIs.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124075 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
879bfee0ce2ddaaa50d41042002d5e38c938aed4 23-Jan-2011 Greg Clayton <gclayton@apple.com> Restored some missing APIs for the test suite. Now testsuite still has some failures
due to overloaded SBTarget::Launch() calls.

Bumping Xcode project versions: lldb-42 and debugserver-127.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124063 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BTarget.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
BProcess.cpp
c4ed12f9db1a526401f29a4cef17d78fa5e3da26 22-Jan-2011 Caroline Tice <ctice@apple.com> Add API and implementation for SBDebugger::Destroy and Debugger::Destroy.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124011 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
1ebdcc7789aac1ef30ad6dcd485dff86c63136ad 21-Jan-2011 Greg Clayton <gclayton@apple.com> Added support for stepping out of a frame. If you have 10 stack frames, and you
select frame #3, you can then do a step out and be able to go directly to the
frame above frame #3!

Added StepOverUntil and StepOutOfFrame to the SBThread API to allow more powerful
stepping.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123970 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BThread.cpp
00c3ae7dac4cf9654d1569735c41e58fb2fd8969 21-Jan-2011 Greg Clayton <gclayton@apple.com> Fixed up the SBValue::GetExpressionPath() to be more correct under more
circumstances.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123957 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
f41d4cab2c2807049f4d187ccded792269965fb8 18-Jan-2011 Greg Clayton <gclayton@apple.com> Fixed missing return value (patch from Stephen Wilson).

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

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

class ExternalASTSource {
....

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

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

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123613 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
BValue.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
BFrame.cpp
123db408a6bc06614ec893040aaad84d8d0d16f9 12-Jan-2011 Greg Clayton <gclayton@apple.com> Added the following functions to SBThread to allow threads to be suspended when a process is resumed:

bool SBThread::Suspend();
bool SBThread::Resume();
bool SBThread::IsSuspended();



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123300 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.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
BFrame.cpp
e179a5840a49167964ca768a13c252c58c9cffcc 05-Jan-2011 Greg Clayton <gclayton@apple.com> Added the ability to get an set the desired format for SBValue objects.

Fixed the display of complex numbers in lldb_private::DataExtractor::Dump(...)
and also fixed other edge display cases in lldb_private::ClangASTType::DumpTypeValue(...).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122895 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
bdcda468276dc9ab6bf648fc8cc07f3faad91526 20-Dec-2010 Greg Clayton <gclayton@apple.com> The LLDB API (lldb::SB*) is now thread safe!



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122262 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BCommandInterpreter.cpp
BDebugger.cpp
BFrame.cpp
BFunction.cpp
BProcess.cpp
BSymbol.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
BValueList.cpp
f5e4326a5c5ec87a57ec58497e191a04a4ec77e9 20-Dec-2010 Johnny Chen <johnny.chen@apple.com> Patch from Stephen Wilson:

Fix a typo where a qualification was being interpreted as a label.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122260 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
c0446861315ac0d5994f93510e24cbcac9f534ad 20-Dec-2010 Caroline Tice <ctice@apple.com> Add code to make sure InputReaders finish and are cleaned up when
a Debugger object is destroyed or re-set. (Thus making sure that, for
example, the Python interpreter finishes and exits cleanly rather than
being left in an undefined state.)



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122255 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
d6dfe043486507c06a0559cef7171ae6c3cc1a97 18-Dec-2010 Greg Clayton <gclayton@apple.com> Linux patches from Stephen Wilson.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122125 91177308-0d34-0410-b5e6-96231b3b80d8
BType.cpp
c5157ecb9c6185b92923fab50de53f3fad86095d 17-Dec-2010 Greg Clayton <gclayton@apple.com> Added access to set the current stack frame within a thread so any command
line commands can use the current thread/frame.

Fixed an issue with expressions that get sandboxed in an objective C method
where unichar wasn't being passed down.

Added a "static size_t Scalar::GetMaxByteSize();" function in case we need
to know the max supported by size of something within a Scalar object.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122027 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
b3e7181e269e8d26958efc47e362cb6189ecaaca 15-Dec-2010 Johnny Chen <johnny.chen@apple.com> Fix typos in SBBreakpoint::GetThreadIndex()/GetThreadName(), and test sequences
for the two API calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121898 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
a625387d0f22fd4eb240fd8a8fa894ecb8613475 15-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed an error where the thread index was being returned as zero in "uint32_t SBBreakpoint::GetThreadIndex() const" even when it isn't specified. It should be UINT32_MAX to indicate there is no thread index set for the breakpoint (the breakpoint isn't thread specific). Also fixed the ThreadSpec.cpp to use UINT32_MAX instead of -1. Fixed the logging Printf statement in "uint32_t SBBreakpoint::GetThreadIndex() const" to not print the address of the "index" function from <string.h>!


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121896 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
c3b61d239a53271d013b82ffaba6ab4e92b7fcc1 15-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed the "expression" command object to use the StackFrame::GetValueForExpressionPath()
function and also hooked up better error reporting for when things fail.

Fixed issues with trying to display children of pointers when none are
supposed to be shown (no children for function pointers, and more like this).
This was causing child value objects to be made that were correctly firing
an assertion.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121841 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
4e9267d43979b391cb4c311b378fa9991c63285b 14-Dec-2010 Greg Clayton <gclayton@apple.com> Changed:
SBValue SBFrame::LookupVar(const char *name);
To
SBValue SBFrame::FindVariable (const char *name);

Changed:
SBValue LookupVarInScope (const char *name, const char *scope);
to
SBValue FindValue (const char *name, ValueType value_type);

The latter makes it possible to not only find variables (params, locals, globals, and statics), but we can also now get register sets, registers and persistent variables using the frame as the context.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121777 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
0c8a190b5d6674b071611f9718e71d59aa54d492 14-Dec-2010 Johnny Chen <johnny.chen@apple.com> Fixed rdar://problem/8767055 test suite failure TestStaticVariables.py (ToT r121745).
Populate the variable list from the stack frame, first.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121773 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
dd62d729cf960051615a74c1e67e2e41ec789fd7 14-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed SBFrame to properly check to make sure it has a valid m_opaque_sp object
before trying to use it.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121748 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
BCompileUnit.cpp
BFrame.cpp
BFunction.cpp
BSymbol.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
BFrame.cpp
ea49cc78c01f34f874b7e710acebea4ead404be1 12-Dec-2010 Greg Clayton <gclayton@apple.com> Added the ability for SBTarget to resolve load addresses (convert lldb::addr_t values into resolved SBAddress objects). These SBAddress objects can then be used to resolve a symbol context using "lldb::SBSymbolContext ResolveSymbolContextForAddress (const lldb::SBAddress& addr, uint32_t resolve_scope);".

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121638 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
BTarget.cpp
e5791dd89688683c9e1ec874b0be6906517e6827 11-Dec-2010 Johnny Chen <johnny.chen@apple.com> Add test_display_source_python() test case to TestSourceManager.py which uses
the lldb PyThon API SBSourceManager to display source files.

To accomodate this, the C++ SBSourceManager API has been changed to take an
lldb::SBStream as the destination for display of source lines. Modify SBStream::ctor()
so that its opaque pointer is initialized with an StreamString instance.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121605 91177308-0d34-0410-b5e6-96231b3b80d8
BSourceManager.cpp
BStream.cpp
94d255f74c125889e5d0f607f4bfe5334a2999ee 07-Dec-2010 Sean Callanan <scallanan@apple.com> More logging for use in debugging the interactions
between clients of the LLDB API and the expression
parser.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121193 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
43edca38dda703786e2dc7ad61169b5b445551e6 07-Dec-2010 Greg Clayton <gclayton@apple.com> Added symbol table access through the module for now. We might need to expose
a SBSymtab class, but for now, we expose the symbols through the module.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121112 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.cpp
BSymbol.cpp
422b1ae11aaec0bea88d3d2d1f4cdb0147cef0ae 06-Dec-2010 Greg Clayton <gclayton@apple.com> Added a less than operator that will compare the internal opaque pointer values so SBBroadcaster objects can be contained in ordered containers or sorted.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120967 91177308-0d34-0410-b5e6-96231b3b80d8
BBroadcaster.cpp
0e0fd1c48fc313ce3fc582fe00c268ea020b73f4 05-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed an issue where SBProcess::LoadImage(...) was not returning the image
token.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120954 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
3ca95dac942597ca76101f6792f16e34e81dea1d 05-Dec-2010 Greg Clayton <gclayton@apple.com> Added "void SBBroadcaster::Clear ();" method to SBBroadcaster.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120949 91177308-0d34-0410-b5e6-96231b3b80d8
BBroadcaster.cpp
4f46cd1ea357deb03380258efadac9236ac0caa4 05-Dec-2010 Greg Clayton <gclayton@apple.com> Fixed a crasher when trying to get event data flavors on events that don't
have event data.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120948 91177308-0d34-0410-b5e6-96231b3b80d8
BEvent.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
BCommunication.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
BCommunication.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
BFrame.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
BDebugger.cpp
c35750a4869c3698ffb888ba5896fc56313583cc 19-Nov-2010 Johnny Chen <johnny.chen@apple.com> Fill in more test sequences for Python API SBFrame.LookupVarInScope(name, scope).

Change SBFrame::LookupVarInScope() to also work with "global" scope in addition
to "local" and "parameter" scope.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119811 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
640dc6b983964615bcb149d7d37ee007a13fb02c 18-Nov-2010 Greg Clayton <gclayton@apple.com> Added the ability to get more information on the SBThread's stop reason
by being able to get the data count and data. Each thread stop reason
has one or more data words that can help describe the stop. To do this
I added:

size_t
SBThread::GetStopReasonDataCount();

uint64_t
SBThread::GetStopReasonDataAtIndex(uint32_t idx);




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119720 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpointLocation.cpp
BThread.cpp
d6d806ceff943ca26c008f704013f18920685cfd 08-Nov-2010 Greg Clayton <gclayton@apple.com> Fixed FileSpec's operator == to deal with equivalent paths such as "/tmp/a.c"
and "/private/tmp/a.c". This was done by adding a "mutable bool m_is_resolved;"
member to FileSpec and then modifying the equal operator to check if the
filenames are equal, and if they are, then check the directories. If they are
not equal, then both paths are checked to see if they have been resolved. If
they have been resolved, we resolve the paths in temporary FileSpec objects
and set each of the m_is_resolved bools to try (for lhs and rhs) if the paths
match what is contained in the path. This allows us to do more intelligent
compares without having to resolve all paths found in the debug info (which
can quickly get costly if the files are on remote NFS mounts).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118387 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BAddress.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCommunication.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BHostOS.cpp
BInputReader.cpp
BLineEntry.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
BValueList.cpp
538eb82a89a68dbc57251915080bd5152b333978 06-Nov-2010 Greg Clayton <gclayton@apple.com> Added copy constructors and assignment operators to all lldb::SB* classes
so we don't end up with weak exports with some compilers.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118312 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCompileUnit.cpp
BDebugger.cpp
BEvent.cpp
BFrame.cpp
BFunction.cpp
BInstruction.cpp
BInstructionList.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSourceManager.cpp
BStringList.cpp
BSymbol.cpp
BTarget.cpp
BType.cpp
BValue.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
BFrame.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
BError.cpp
BProcess.cpp
135adf2058abf556ec6e672a8989079668d3aa7d 31-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed an include so case sensitive builders can build.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117864 91177308-0d34-0410-b5e6-96231b3b80d8
BModule.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
BAddress.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCommunication.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BHostOS.cpp
BInputReader.cpp
BLineEntry.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
1b28441cf05e7781bd9685a0cdcd349d8b09fefb 30-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed the copy constructor for SBThread.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117825 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
a66ba46379fe41036d870975c56ccc2319cb6618 30-Oct-2010 Greg Clayton <gclayton@apple.com> Improved API logging.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117772 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
BBreakpoint.cpp
BCommandInterpreter.cpp
BCommunication.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BInputReader.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.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
BCommunication.cpp
BListener.cpp
BProcess.cpp
BTarget.cpp
BThread.cpp
3f5ee7fd6991891f0892bd71537763d9b59acd12 29-Oct-2010 Greg Clayton <gclayton@apple.com> Modified the lldb_private::TypeList to use a std::multimap for quicker lookup
by type ID (the most common type of type lookup).

Changed the API logging a bit to always show the objects in the OBJECT(POINTER)
format so it will be easy to locate all instances of an object or references
to it when looking at logs.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117641 91177308-0d34-0410-b5e6-96231b3b80d8
BBroadcaster.cpp
BCommandInterpreter.cpp
BDebugger.cpp
BEvent.cpp
BFileSpec.cpp
BListener.cpp
BProcess.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
BValueList.cpp
77e9394f0af653ac0842066a9c7766a28d6c6b94 29-Oct-2010 Sean Callanan <scallanan@apple.com> Added a user-settable variable, 'target.expr-prefix',
which holds the name of a file whose contents are
prefixed to each expression. For example, if the file
~/lldb.prefix.header contains:

typedef unsigned short my_type;

then you can do this:

(lldb) settings set target.expr-prefix '~/lldb.prefix.header'
(lldb) expr sizeof(my_type)
(unsigned long) $0 = 2

When the variable is changed, the corresponding file
is loaded and its contents are fetched into a string
that is stored along with the target. This string
is then passed to each expression and inserted into
it during parsing, like this:

typedef unsigned short my_type;

void
$__lldb_expr(void *$__lldb_arg)
{
sizeof(my_type);
}


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117627 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
5790e062ca89a9daf1a9648e9b567cba17c9438b 28-Oct-2010 Caroline Tice <ctice@apple.com> Remove references to particular Python version (use the system default
version); change include statements to use Python.h in the Python framework
on Mac OS X systems; leave it using regular Python.h on other systems.

Note: I think this *ought* to work properly on Linux systems, but I don't have
a system to test it on...



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117612 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpointLocation.cpp
2763c6491cb2bfa25dbee34c9fa0b821abb3cda7 28-Oct-2010 Caroline Tice <ctice@apple.com> Make SBFrame::GetDescription a little more descriptive.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117497 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
7de24cc82694ad5cdde03b90c2546b7d56b251ce 27-Oct-2010 Caroline Tice <ctice@apple.com> Fix bugs attempting to write to API log after it has been
disabled.



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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117437 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
61ba7ec20f616f907473dd501341cef5b47fa3f8 27-Oct-2010 Caroline Tice <ctice@apple.com> Clean up the API logging code:
- Try to reduce logging to one line per function call instead of tw
- Put all arguments & their values into log for calls
- Add 'this' parameter information to function call logging, making it show the appropriate
internal pointer (this.obj, this.sp, this.ap...)
- Clean up some return values
- Remove logging of constructors that construct empty objects
- Change '==>' to '=>' for showing result values...
- Fix various minor bugs
- Add some protected 'get' functions to help getting the internal pointers for the 'this' arguments...



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117417 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCommunication.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BHostOS.cpp
BInputReader.cpp
BLineEntry.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
BValueList.cpp
7826c8894803dc729f29789ebc038956a94d3e7a 26-Oct-2010 Caroline Tice <ctice@apple.com> First pass at adding logging capabilities for the API functions. At the moment
it logs the function calls, their arguments and the return values. This is not
complete or polished, but I am committing it now, at the request of someone who
really wants to use it, even though it's not really done. It currently does not
attempt to log all the functions, just the most important ones. I will be
making further adjustments to the API logging code over the next few days/weeks.
(Suggestions for improvements are welcome).


Update the Python build scripts to re-build the swig C++ file whenever
the python-extensions.swig file is modified.

Correct the help for 'log enable' command (give it the correct number & type of
arguments).




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117349 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCommunication.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BHostOS.cpp
BInputReader.cpp
BLineEntry.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
BValueList.cpp
e3740831203337f606008b7c8d7ea34b521c8600 22-Oct-2010 Jim Ingham <jingham@apple.com> Add and SB API to set breakpoint conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117082 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
BBreakpointLocation.cpp
537a7a86687683fd403ce652d178fbc89e06ef9f 20-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed an issue where we were resolving paths when we should have been.

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

FileSpec::FileSpec (const char *path);

and in the:

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

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

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

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

So I removed the constructor that just takes a path:

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

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

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

I also removed the default parameter to SetFile():

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116944 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BFileSpec.cpp
BTarget.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
BThread.cpp
bf8e42b9da0e1c6349a727d644ad37610b00d556 15-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed an expression parsing issue where if you were stopped somewhere without
debug information and you evaluated an expression, a crash would occur as a
result of an unchecked pointer.

Added the ability to get the expression path for a ValueObject. For a rectangle
point child "x" the expression path would be something like: "rect.top_left.x".
This will allow GUI and command lines to get ahold of the expression path for
a value object without having to explicitly know about the hierarchy. This
means the ValueObject base class now has a "ValueObject *m_parent;" member.
All ValueObject subclasses now correctly track their lineage and are able
to provide value expression paths as well.

Added a new "--flat" option to the "frame variable" to allow for flat variable
output. An example of the current and new outputs:

(lldb) frame variable
argc = 1
argv = 0x00007fff5fbffe80
pt = {
x = 2
y = 3
}
rect = {
bottom_left = {
x = 1
y = 2
}
top_right = {
x = 3
y = 4
}
}
(lldb) frame variable --flat
argc = 1
argv = 0x00007fff5fbffe80
pt.x = 2
pt.y = 3
rect.bottom_left.x = 1
rect.bottom_left.y = 2
rect.top_right.x = 3
rect.top_right.y = 4


As you can see when there is a lot of hierarchy it can help flatten things out.
Also if you want to use a member in an expression, you can copy the text from
the "--flat" output and not have to piece it together manually. This can help
when you want to use parts of the STL in expressions:

(lldb) frame variable --flat
argc = 1
argv = 0x00007fff5fbffea8
hello_world._M_dataplus._M_p = 0x0000000000000000
(lldb) expr hello_world._M_dataplus._M_p[0] == '\0'




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116532 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BType.cpp
887aa2898314218406275a34cbec30c11cd00acd 11-Oct-2010 Greg Clayton <gclayton@apple.com> Added a "--no-lldbinit" option (-n for short (which magically matches
what gdb uses)) so we can tell our "lldb" driver program to not automatically
parse any .lldbinit files.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116179 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
451ee7c69bc03071ad322bc3f61d8ae28f515c5b 08-Oct-2010 Sean Callanan <scallanan@apple.com> Fixed a launching issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115999 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BBreakpoint.cpp
BFrame.cpp
BFunction.cpp
BProcess.cpp
BTarget.cpp
BThread.cpp
e47649c441e7abe1dc5158ec36bba1bb66fcbb08 07-Oct-2010 Johnny Chen <johnny.chen@apple.com> o SBtarget.cpp/.h:

Temporarily commenting out the deprecated LaunchProcess() method.
SWIG is not able to handle the overloaded functions.

o dotest.py/lldbtest.py:

Add an '-w' option to insert some wait time between consecutive test cases.

o TestClassTypes.py:

Make the breakpoint_creation_by_filespec_python() test method more robust and
more descriptive by printing out a more insightful assert message.

o lldb.swig: Coaches swig to treat StateType as an int type, instead of a C++ class.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115899 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
c5f728c81b4896cfbbc87ed1daedf42ba2c0ee63 07-Oct-2010 Greg Clayton <gclayton@apple.com> Expose the error contained within an SBValue.

Move anything that creates a new process into SBTarget. Marked some functions
as deprecated. I will remove them after our new API changes make it through
a build cycle.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115854 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
BValue.cpp
992ce267ba735d6ec834cd0778ebb891121690a2 06-Oct-2010 Greg Clayton <gclayton@apple.com> Leaving in deprecated functions until we can get a clean build with the new APIs in place before removing the deprecated functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115815 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
1a3083a04c20cc8e7298e03b731cab5d09aa7bad 06-Oct-2010 Greg Clayton <gclayton@apple.com> Added the first of hopefully many python example scripts that show how to
use the python API that is exposed through SWIG to do some cool stuff.

Also fixed synchronous debugging so that all process control APIs exposed
through the python API will now wait for the process to stop if you set
the async mode to false (see disasm.py).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115738 91177308-0d34-0410-b5e6-96231b3b80d8
BProcess.cpp
BTarget.cpp
BThread.cpp
5c4c746a3a83c1aad411c6cdc5f9525a4fc2d17e 06-Oct-2010 Greg Clayton <gclayton@apple.com> Added the ability to get the disassembly instructions from the function and
symbol.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115734 91177308-0d34-0410-b5e6-96231b3b80d8
BFunction.cpp
BInstruction.cpp
BInstructionList.cpp
BProcess.cpp
BSymbol.cpp
BThread.cpp
d171972ecc7788bdb02d3e81420a24841e09a2bf 05-Oct-2010 Greg Clayton <gclayton@apple.com> Added the notion that a value object can be constant by adding:
bool ValueObject::GetIsConstant() const;
void ValueObject::SetIsConstant();

This will stop anything from being re-evaluated within the value object so
that constant result value objects can maintain their frozen values without
anything being updated or changed within the value object.

Made it so the ValueObjectConstResult can be constructed with an
lldb_private::Error object to allow for expression results to have errors.

Since ValueObject objects contain error objects, I changed the expression
evaluation in ClangUserExpression from

static Error
ClangUserExpression::Evaluate (ExecutionContext &exe_ctx,
const char *expr_cstr,
lldb::ValueObjectSP &result_valobj_sp);

to:

static lldb::ValueObjectSP
Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr);

Even though expression parsing is borked right now (pending fixes coming from
Sean Callanan), I filled in the implementation for:

SBValue SBFrame::EvaluateExpression (const char *expr);

Modified all expression code to deal with the above changes.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115589 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
66ed2fbeaf588fe4105a1305f7e956dcf9fbe299 05-Oct-2010 Greg Clayton <gclayton@apple.com> Added a new ValueObject type that will be used to freeze dry expression
results. The clang opaque type for the expression result will be added to the
Target's ASTContext, and the bytes will be stored in a DataBuffer inside
the new object. The class is named: ValueObjectConstResult

Now after an expression is evaluated, we can get a ValueObjectSP back that
contains a ValueObjectConstResult object.

Relocated the value object dumping code into a static function within
the ValueObject class instead of being in the CommandObjectFrame.cpp file
which is what contained the code to dump variables ("frame variables").




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115578 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
8f1e08b43c84001dad99022799a08f4523592b8f 04-Oct-2010 Greg Clayton <gclayton@apple.com> Added GetSymbol to the frame.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115535 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.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
BFrame.cpp
BTarget.cpp
BThread.cpp
7ec03bda2b1f5eb01affe36eebdcc94436ae0f43 30-Sep-2010 Jim Ingham <jingham@apple.com> Change how we call Target::CreateBreakpoint to account for the new "name type" parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115210 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
462d4147f3bb9141bf62d904f58a623db00669df 29-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed the forward declaration issue that was present in the DWARF parser after
adding methods to C++ and objective C classes. In order to make methods, we
need the function prototype which means we need the arguments. Parsing these
could cause a circular reference that caused an assertion.

Added a new typedef for the clang opaque types which are just void pointers:
lldb::clang_type_t. This appears in lldb-types.h.

This was fixed by enabling struct, union, class, and enum types to only get
a forward declaration when we make the clang opaque qual type for these
types. When they need to actually be resolved, lldb_private::Type will call
a new function in the SymbolFile protocol to resolve a clang type when it is
not fully defined (clang::TagDecl::getDefinition() returns NULL). This allows
us to be a lot more lazy when parsing clang types and keeps down the amount
of data that gets parsed into the ASTContext for each module.

Getting the clang type from a "lldb_private::Type" object now takes a boolean
that indicates if a forward declaration is ok:

clang_type_t lldb_private::Type::GetClangType (bool forward_decl_is_ok);

So function prototypes that define parameters that are "const T&" can now just
parse the forward declaration for type 'T' and we avoid circular references in
the type system.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115012 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.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
BDebugger.cpp
e49ec18f1868168c8927ae30a379db176ca8cce3 23-Sep-2010 Caroline Tice <ctice@apple.com> Remove all the __repr__ methods from the API/*.h files, and put them
into python-extensions.swig, which gets included into lldb.swig, and
adds them back into the classes when swig generates it's C++ file. This
keeps the Python stuff out of the general API classes.

Also fixed a small bug in the copy constructor for SBSymbolContext.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114602 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBlock.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BCommandReturnObject.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BLineEntry.cpp
BModule.cpp
BProcess.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
1ca48b0529de3d8efc05037649fe178e90e36bb7 22-Sep-2010 Caroline Tice <ctice@apple.com> Remove SBCommandContext which was not needed or doing anything.

Add SBValueList.h & SBStream.h to build-swig-Python.sh; add SBValueList.h to lldb.swig



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114549 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandContext.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
BDebugger.cpp
e7a566e3301b272d18a5f752f99c8cb8b63b28a4 20-Sep-2010 Caroline Tice <ctice@apple.com> Fix indentations.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114326 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBlock.cpp
BCompileUnit.cpp
BEvent.cpp
BFunction.cpp
BTarget.cpp
98f930f429160f9777f626c3ac6aa609f4e965d2 20-Sep-2010 Caroline Tice <ctice@apple.com> Add GetDescription() and __repr__ () methods to most API classes, to allow
"print" from inside Python to print out the objects in a more useful
manner.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114321 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BBlock.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BCommandReturnObject.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BLineEntry.cpp
BModule.cpp
BProcess.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
238c0a1e7b733cee539258faa656159c63f9e893 18-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed the way set/show variables were being accessed to being natively
accessed by the objects that own the settings. The previous approach wasn't
very usable and made for a lot of unnecessary code just to access variables
that were already owned by the objects.

While I fixed those things, I saw that CommandObject objects should really
have a reference to their command interpreter so they can access the terminal
with if they want to output usaage. Fixed up all CommandObjects to take
an interpreter and cleaned up the API to not need the interpreter to be
passed in.

Fixed the disassemble command to output the usage if no options are passed
down and arguments are passed (all disassebmle variants take options, there
are no "args only").



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114252 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
86ba24de3b14dedb52d9c97269d23a90692626aa 17-Sep-2010 Johnny Chen <johnny.chen@apple.com> Fixed build error of LLDBWrapPython.cpp by removing the "protected" access modifier.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114194 91177308-0d34-0410-b5e6-96231b3b80d8
BStringList.cpp
ab7b39c679528fa2574430ec8035ee83d664acb8 17-Sep-2010 Greg Clayton <gclayton@apple.com> We now have SBStream that mirrors the generic stream classes we
use inside lldb (lldb_private::StreamFile, and lldb_private::StreamString).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114188 91177308-0d34-0410-b5e6-96231b3b80d8
BStream.cpp
dfc91c368886f961b5cac95efc9adfe9be05cf73 15-Sep-2010 Caroline Tice <ctice@apple.com> Remove unnecessary/inappropriate output-printing functions from
the API.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113993 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
BCommandInterpreter.cpp
BEvent.cpp
BProcess.cpp
BThread.cpp
BValue.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
BAddress.cpp
BBreakpoint.cpp
BFrame.cpp
BTarget.cpp
4ae519666628cca07c194bf677163009cc2e5a8b 11-Sep-2010 Jim Ingham <jingham@apple.com> Move the "Object Description" into the ValueObject, and the add an API to
SBValue to access it. For now this is just the result of ObjC NSPrintForDebugger,
but could be extended. Also store the results of the ObjC Object Printer in a
Stream, not a ConstString.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113660 91177308-0d34-0410-b5e6-96231b3b80d8
BValue.cpp
466f6c4c0783c6b5197059caccab94faf1e605e9 10-Sep-2010 Greg Clayton <gclayton@apple.com> Added some missing API for address resolving within a module, and looking
up a seciton offset address (SBAddress) within a module that returns a
symbol context (SBSymbolContext). Also added a SBSymbolContextList in
preparation for adding find/lookup APIs that can return multiple results.

Added a lookup example code that shows how to do address lookups.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113599 91177308-0d34-0410-b5e6-96231b3b80d8
BAddress.cpp
BModule.cpp
BSymbolContext.cpp
BSymbolContextList.cpp
eddffe93d2c9ebb575e7b03fe1c5e71f9ecaf9f1 10-Sep-2010 Caroline Tice <ctice@apple.com> If the file the user specifies can't be found in the current directory,
and the user didn't specify a particular directory, search for the file
using the $PATH environment variable.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113575 91177308-0d34-0410-b5e6-96231b3b80d8
BFileSpec.cpp
b8314fe67960cfcc5d9e9232be4c1914c9ef0ce3 09-Sep-2010 Caroline Tice <ctice@apple.com> Make API calls for setting/getting user settable variables static.
Modify Driver to handle SIGWINCH signals and automatically re-set the
term-width variable.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113506 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
1d2aefd474c9893407ef4deacefd08dd2ca2e806 09-Sep-2010 Caroline Tice <ctice@apple.com> Make all debugger-level user settable variables into instance variables.
Make get/set variable at the debugger level always set the particular debugger's instance variables rather than
the default variables.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113474 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
5bc7b67ccc8bb4a977d129e51313067dcbc7bb94 09-Sep-2010 Chris Lattner <sabre@nondot.org> eliminate some clang warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113438 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
69aa5d9a7620a183cdc4da12cc87ea82e2ffcbf9 07-Sep-2010 Greg Clayton <gclayton@apple.com> Added more API to lldb::SBBlock to allow getting the block
parent, sibling and first child block, and access to the
inline function information.

Added an accessor the StackFrame:

Block * lldb_private::StackFrame::GetFrameBlock();

LLDB represents inline functions as lexical blocks that have
inlined function information in them. The function above allows
us to easily get the top most lexical block that defines a stack
frame. When there are no inline functions in function, the block
returned ends up being the top most block for the function. When
the PC is in an inlined funciton for a frame, this will return the
first parent block that has inlined function information. The
other accessor: StackFrame::GetBlock() will return the deepest block
that matches the frame's PC value. Since most debuggers want to display
all variables in the current frame, the Block returned by
StackFrame::GetFrameBlock can be used to retrieve all variables for
the current frame.

Fixed the lldb_private::Block::DumpStopContext(...) to properly
display inline frames a block should display all of its inlined
functions. Prior to this fix, one of the call sites was being skipped.
This is a separate code path from the current default where inlined
functions get their own frames.

Fixed an issue where a block would always grab variables for any
child inline function blocks.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113195 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
BFrame.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
BCommandInterpreter.cpp
BDebugger.cpp
72b7158235500ae6d4b69ed378cbc36bf6e5cbe1 02-Sep-2010 Greg Clayton <gclayton@apple.com> Added a new bool parameter to many of the DumpStopContext() methods that
might dump file paths that allows the dumping of full paths or just the
basenames. Switched the stack frame dumping code to use just the basenames for
the files instead of the full path.

Modified the StackID class to no rely on needing the start PC for the current
function/symbol since we can use the SymbolContextScope to uniquely identify
that, unless there is no symbol context scope. In that case we can rely upon
the current PC value. This saves the StackID from having to calculate the
start PC when the StackFrame::GetStackID() accessor is called.

Also improved the StackID less than operator to correctly handle inlined stack
frames in the same stack.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112867 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
17dae081d7b88d24a7af6b07c10fc5981f81e2a9 02-Sep-2010 Greg Clayton <gclayton@apple.com> StackFrame objects now own ValueObjects for any frame variables (locals, args,
function statics, file globals and static variables) that a frame contains.
The StackFrame objects can give out ValueObjects instances for
each variable which allows us to track when a variable changes and doesn't
depend on variable names when getting value objects.

StackFrame::GetVariableList now takes a boolean to indicate if we want to
get the frame compile unit globals and static variables.

The value objects in the stack frames can now correctly track when they have
been modified. There are a few more tweaks needed to complete this work. The
biggest issue is when stepping creates partial stacks (just frame zero usually)
and causes previous stack frames not to match up with the current stack frames
because the previous frames only has frame zero. We don't really want to
require that all previous frames be complete since stepping often must check
stack frames to complete their jobs. I will fix this issue tomorrow.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112800 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
BValue.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
BTarget.cpp
74989e88af7e04f3fe0bb3a800163113d7e0ca12 30-Aug-2010 Jim Ingham <jingham@apple.com> Added a way to open the current source file & line in an external editor, and you can turn this on with:

lldb -e

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112502 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
4ead2e9a5a74f465d00b0301c165fbebf4ee4ff3 28-Aug-2010 Johnny Chen <johnny.chen@apple.com> o Exposed SBFileSpec to the Python APIs in lldb.py.

o Fixed a crasher when getting it via SBTarget.GetExecutable().

>>> filespec = target.GetExecutable()
Segmentation fault

o And renamed SBFileSpec::GetFileName() to GetFilename() to be consistent with FileSpec::GetFilename().



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112308 91177308-0d34-0410-b5e6-96231b3b80d8
BFileSpec.cpp
c833295baeec641086f536e78050388af36784f8 26-Aug-2010 Jim Ingham <jingham@apple.com> Change "Current" as in GetCurrentThread, GetCurrentStackFrame, etc, to "Selected" i.e. GetSelectedThread. Selected makes more sense, since these are set by some user action (a selection). I didn't change "CurrentProcess" since this is always controlled by the target, and a given target can only have one process, so it really can't be selected.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112221 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BDebugger.cpp
BProcess.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
b04e7a805310f2f2cc77947a8b263de9061617ae 24-Aug-2010 Greg Clayton <gclayton@apple.com> Got a lot of the kinks worked out in the inline support after debugging more
complex inlined examples.

StackFrame classes don't have a "GetPC" anymore, they have "GetFrameCodeAddress()".
This is because inlined frames will have a PC value that is the same as the
concrete frame that owns the inlined frame, yet the code locations for the
frame can be different. We also need to be able to get the real PC value for
a given frame so that variables evaluate correctly. To get the actual PC
value for a frame you can use:

addr_t pc = frame->GetRegisterContext()->GetPC();

Some issues with the StackFrame stomping on its own symbol context were
resolved which were causing the information to change for a frame when the
stack ID was calculated. Also the StackFrame will now correctly store the
symbol context resolve flags for any extra bits of information that were
looked up (if you ask for a block only and you find one, you will alwasy have
the compile unit and function).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@111964 91177308-0d34-0410-b5e6-96231b3b80d8
BFrame.cpp
33ed170599d41fe407a4dcf5f0875c75e1ad1375 24-Aug-2010 Greg Clayton <gclayton@apple.com> Added support for inlined stack frames being represented as real stack frames
which is now on by default. Frames are gotten from the unwinder as concrete
frames, then if inline frames are to be shown, extra information to track
and reconstruct these frames is cached with each Thread and exanded as needed.

I added an inline height as part of the lldb_private::StackID class, the class
that helps us uniquely identify stack frames. This allows for two frames to
shared the same call frame address, yet differ only in inline height.

Fixed setting breakpoint by address to not require addresses to resolve.

A quick example:

% cat main.cpp

% ./build/Debug/lldb test/stl/a.out
Current executable set to 'test/stl/a.out' (x86_64).
(lldb) breakpoint set --address 0x0000000100000d31
Breakpoint created: 1: address = 0x0000000100000d31, locations = 1
(lldb) r
Launching 'a.out' (x86_64)
(lldb) Process 38031 Stopped
* thread #1: tid = 0x2e03, pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280, stop reason = breakpoint 1.1, queue = com.apple.main-thread
277
278 _CharT*
279 _M_data() const
280 -> { return _M_dataplus._M_p; }
281
282 _CharT*
283 _M_data(_CharT* __p)
(lldb) bt
thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread
frame #0: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280
frame #1: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_rep() const at /usr/include/c++/4.2.1/bits/basic_string.h:288
frame #2: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::size() const at /usr/include/c++/4.2.1/bits/basic_string.h:606
frame #3: pc = 0x0000000100000d31, where = a.out`main [inlined] operator<< <char, std::char_traits<char>, std::allocator<char> > at /usr/include/c++/4.2.1/bits/basic_string.h:2414
frame #4: pc = 0x0000000100000d31, where = a.out`main + 33 at /Volumes/work/gclayton/Documents/src/lldb/test/stl/main.cpp:14
frame #5: pc = 0x0000000100000d08, where = a.out`start + 52

Each inline frame contains only the variables that they contain and each inlined
stack frame is treated as a single entity.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@111877 91177308-0d34-0410-b5e6-96231b3b80d8
BBlock.cpp
BFrame.cpp
BThread.cpp
ef28e2ab6bc6273c129f0bc8a0c88a24d3b6876e 05-Aug-2010 Greg Clayton <gclayton@apple.com> Added functionality to our API for SBType. This will allow users to eventually find and peruse static type information from modules.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110297 91177308-0d34-0410-b5e6-96231b3b80d8
BType.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
BThread.cpp
43490d1332d13694fb6690365984bf0ecdd8dcc3 30-Jul-2010 Greg Clayton <gclayton@apple.com> Added "void Clear();" methods to SBDebugger, SBTarget and SBThread so they can release their shared pointers.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109882 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
BTarget.cpp
BThread.cpp
c7f5d5c3a3b48869f5ad2a3cdc4b20ca40929ba3 24-Jul-2010 Greg Clayton <gclayton@apple.com> Added needed breakpoint functionality to the public API that includes:
SBTarget:
- get breakpoint count
- get breakpoint at index
SBBreakpoint:
- Extract data from breakpoint events



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109289 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpoint.cpp
BTarget.cpp
bef1583b89e73de77c8b0897fcf42b5b1fcabe4c 14-Jul-2010 Greg Clayton <gclayton@apple.com> I enabled some extra warnings for hidden local variables and for hidden
virtual functions and caught some things and did some general code cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108299 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
0a164a1664bce107a4049b838485863320c8292a 10-Jul-2010 Eli Friedman <eli.friedman@gmail.com> Misc warning fixes.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108029 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.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
akefile
BBreakpoint.cpp
BBreakpointLocation.cpp
BFrame.cpp
BTarget.cpp
BThread.cpp
704363531ee4877ccc6d35d0702876096f54c67b 01-Jul-2010 Greg Clayton <gclayton@apple.com> Centralized all disassembly into static functions in source/Core/Disassembler.cpp.

Added the ability to read memory from the target's object files when we aren't
running, so disassembling works before you run!

Cleaned up the API to lldb_private::Target::ReadMemory().

Cleaned up the API to the Disassembler to use actual "lldb_private::Address"
objects instead of just an "addr_t". This is nice because the Address objects
when resolved carry along their section and module which can get us the
object file. This allows Target::ReadMemory to be used when we are not
running.

Added a new lldb_private::Address dump style: DumpStyleDetailedSymbolContext
This will show a full breakdown of what an address points to. To see some
sample output, execute a "image lookup --address <addr>".

Fixed SymbolContext::DumpStopContext(...) to not require a live process in
order to be able to print function and symbol offsets.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107350 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.cpp
558be58c085ed1d3e33c01f5ea3bf0eff63ab827 30-Jun-2010 Caroline Tice <ctice@apple.com> Add a unique ID to each debugger instance.
Add functions to look up debugger by id
Add global variable to lldb python module, to hold debugger id
Modify embedded Python interpreter to update the global variable with the
id of its current debugger.
Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL)
as a valid value.

The point of all this is so that, when you drop into the embedded interpreter
from the command interpreter (or when doing Python-based breakpoint commands),
there is a way for the Python side to find/get the correct debugger
instance ( by checking debugger_unique_id, then calling
SBDebugger::FindDebuggerWithID on it).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107287 91177308-0d34-0410-b5e6-96231b3b80d8
BDebugger.cpp
034a7c3d0653d8daf0dec9543eab703c31d23239 29-Jun-2010 Greg Clayton <gclayton@apple.com> A little code cleanup to not create an script bridging object just to feed
the private object back to another internal function.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107118 91177308-0d34-0410-b5e6-96231b3b80d8
BTarget.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
BAddress.cpp
BBlock.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandContext.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCommunication.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BInputReader.cpp
BInstruction.cpp
BLineEntry.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSourceManager.cpp
BStringList.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
BValueList.cpp
9c6898b5686984baa09d0c694169cc935fc99562 22-Jun-2010 Jim Ingham <jingham@apple.com> Make an explicit GetThreadSpecNoCreate accessor so you don't have to get the const-ness right to ensure you are not making a copy of the owning breakpoint's ThreadSpec in a breakpoint location. Also change the name from NoCopy to NoCreate since that's clearer.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106578 91177308-0d34-0410-b5e6-96231b3b80d8
BBreakpointLocation.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
BThread.cpp
8e5e38f584a613f601a37f62e1b25230cb400c6f 18-Jun-2010 Jim Ingham <jingham@apple.com> Adding setting thread specific breakpoints by name, ID, index & queue name to the SB interfaces.


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


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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106034 91177308-0d34-0410-b5e6-96231b3b80d8
BCommandInterpreter.cpp
BDebugger.cpp
BProcess.cpp
BTarget.cpp
8f5fd6b999b0c9b7398870ccc3ed438d7a6a0830 12-Jun-2010 Greg Clayton <gclayton@apple.com> I have eliminated RTTI from LLDB!

Also added a shell script build phase that fixes the headers in
LLDB.framework.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105899 91177308-0d34-0410-b5e6-96231b3b80d8
BThread.cpp
1501a967735469f0e21950905cc64ca24d305fa0 09-Jun-2010 Eli Friedman <eli.friedman@gmail.com> Per surrounding style, use stdarg.h instead of cstdio, etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105711 91177308-0d34-0410-b5e6-96231b3b80d8
BError.cpp
7a62c8b129b7e1b5e838b7616a794e01df01818b 09-Jun-2010 Eli Friedman <eli.friedman@gmail.com> And some more include line fixes.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105704 91177308-0d34-0410-b5e6-96231b3b80d8
BError.cpp
BEvent.cpp
BFrame.cpp
BListener.cpp
BProcess.cpp
BSourceManager.cpp
BTarget.cpp
BThread.cpp
BValue.cpp
d6ec8aaa74c926cab7147259cdf772b1338d0336 09-Jun-2010 Eli Friedman <eli.friedman@gmail.com> Fix a bunch more include lines.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105702 91177308-0d34-0410-b5e6-96231b3b80d8
BBroadcaster.cpp
BCommandContext.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BDebugger.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
BAddress.cpp
BBlock.cpp
BBreakpoint.cpp
BBreakpointLocation.cpp
BBroadcaster.cpp
BCommandContext.cpp
BCommandInterpreter.cpp
BCommandReturnObject.cpp
BCommunication.cpp
BCompileUnit.cpp
BDebugger.cpp
BError.cpp
BEvent.cpp
BFileSpec.cpp
BFrame.cpp
BFunction.cpp
BHostOS.cpp
BInputReader.cpp
BInstruction.cpp
BInstructionList.cpp
BLineEntry.cpp
BListener.cpp
BModule.cpp
BProcess.cpp
BSourceManager.cpp
BStringList.cpp
BSymbol.cpp
BSymbolContext.cpp
BTarget.cpp
BThread.cpp
BType.cpp
BValue.cpp
BValueList.cpp