History log of /external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
7c6bda45b0ad0cb4105da2aa676cecc32c0a7074 04-Jun-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13941992>

Accept mach-o files with bad segments. Many core files are not created correctly and we should still be able to glean any information we can from them.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
95fd285b13f437e29181c3d4bb9b6aeab62e013e 15-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13128331>

Fixed "target symbols add" to correctly extract all module specifications from a dSYM file that is supplied and match the symbol file to a current target module using the UUID values if they are available.

This fixes the case where you add a dSYM file (like "foo.dSYM") which is for a renamed executable (like "bar"). In our case it was "mach_kernel.dSYM" which didn't match "mach_kernel.sys".



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
a8364e966aa020af0dd0a24046f32f8f7fcc9898 15-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13748253>

Combine N_GSYM stab entries with their non-stab counterpart (data symbols) to make the symbol table smaller with less duplicate named symbols.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0c7c90a807bd2718c1aff63aa84ab14e86e02c29 14-May-2013 Jason Molenda <jmolenda@apple.com> A few more small tweaks to arm core file handling.
Most importantly, have DoReadGPR/DoReadFPU/DoReadEXC return -1
to indicate failure if they're called. Else these could override
the Error setting for the relevant thread state -- if the core file
didn't include a floating point thread state, for instance, these
functions would clear the Error setting for that register set and
lldb would display random bytes as those registers' contents.
<rdar://problem/13665075>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
2f0387654349206d14af7ba8a724cedeade12e35 14-May-2013 Jason Molenda <jmolenda@apple.com> Small change to the previous checkin, read in the fpu register context
in one large block - and be sure toget the fpscr value as well when
processing a core file.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
3b244b7e347e23b4483acc947296ade053432637 14-May-2013 Jason Molenda <jmolenda@apple.com> Fixes to read the floating point and exception registers sets out
of arm Mach-O core files.
<rdar://problem/13665075>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0e191607adcb0ea8ebd06c278be648a7f5c0097f 10-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13854277>
<rdar://problem/13594769>

Main changes in this patch include:
- cleanup plug-in interface and use ConstStrings for plug-in names
- Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp
- Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging

The plug-in interface changes:

Modified the lldb_private::PluginInterface class that all plug-ins inherit from:

Changed:

virtual const char * GetPluginName() = 0;

To:

virtual ConstString GetPluginName() = 0;

Removed:

virtual const char * GetShortPluginName() = 0;

- Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names.
- Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc.






git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
36b877d2d27f7d1890f2d13807a3addb216648e2 25-Apr-2013 Greg Clayton <gclayton@apple.com> Added the ability to extract a ModuleSpecList (a new class) from an ObjectFile. This is designed to be used when you have an object file that contains one or more architectures (MacOSX universal (fat) files) and/or one or more objects (BSD archive (.a files)).

There is a new static ObjectFile function you can call:

size_t
ObjectFile::GetModuleSpecifications (const FileSpec &file,
lldb::offset_t file_offset,
ModuleSpecList &specs)

This will fill in "specs" which the details of all the module specs (file + arch + UUID (if there is one) + object name (for BSD archive objects eventually) + file offset to the object in question).

This helps us when a user specifies a file that contains a single architecture, and also helps us when we are given a debug symbol file (like a dSYM file on MacOSX) that contains one or more architectures and we need to be able to match it up to an existing Module that has no debug info.



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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
81a96aa6242f7b559770f5dc62316253cb8cb0d4 18-Apr-2013 Greg Clayton <gclayton@apple.com> Since we use C++11, we should switch over to using std::unique_ptr when C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++.

Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
3e649057fa43a75d9db4498ea30d24907c0de5e3 17-Apr-2013 Daniel Malea <daniel.malea@intel.com> Fix build on Linux
- add a workaround header to define uuid_t on platforms that need it
- unbreak remote debugging of mac os x apps



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
2ceae99039da9adb5ef56584be8b300388e98524 17-Apr-2013 Jason Molenda <jmolenda@apple.com> Fix a pointer arithmetic thinko in ObjectFileMachO::GetLLDBSharedCacheUUID().


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179643 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
6ff916f55c8550f2f8199b130ae6b4a99dd205fb 16-Apr-2013 Jason Molenda <jmolenda@apple.com> Add warning messages for the cases where the inferior process shared cache
differs from lldb's own shared cache, and where the inferior process shared
cache does not match up with the on-disk shared cache file.

Simplify the code where lldb gets its own shared cache uuid a little bit.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179633 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
bb75986fc654232256e544edb1cf8a90a273d4a6 16-Apr-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13468295>

Show an error message when we have a corrupt mach-o file where the LC_SEGMENT or LC_SEGMENT_64 load command have file offsets or file offsets + sizes that extend beyond the end of the file.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
45c7550007ce13ecac458f2e7a7849a996b166b7 16-Apr-2013 Jason Molenda <jmolenda@apple.com> The dyld_all_image_infos structure, at version 13 and higher, has
a UUID for the shared cache libraries that can be used to confirm
that one process' shared cache is the same as another, or that a
process' in-memory shared cache is a match for a given on-disk
dyld_shared_cache binary file. Use these UUIDs to catch some
uncommon problems when the shared caches are being changed for debug
purposes.
<rdar://problem/13524467>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179583 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
2120aef346c158f12ba72129796c6164a4981585 16-Apr-2013 Jason Molenda <jmolenda@apple.com> Fix some minor code indentation mistakes in ObjectFileMachO.
No code changes in this checkin, only whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
adf9e3db9be8f32e7eda7d4bb5b3b8f4d59ce46d 10-Apr-2013 Jason Molenda <jmolenda@apple.com> When ObjectFileMachO::ParseSections() notices that it has a truncated file, zero out the
SectionList so we don't try to do anything with this file. Currently we end up crashing
later in the debug session when we read past the end of the file -- this at least gets us
closer with something like ProcessMachCore printing "error: core file has no sections".
<rdar://problem/13468295>


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

LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down.

All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
825a96a61c06c85eab4b07a7a018fdcc3d664009 22-Mar-2013 Jason Molenda <jmolenda@apple.com> Don't try to read the eh_frame section out of a dSYM.
It won't have one and it isn't needed.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
d793839192c6351a1615cf723564ef672bd8b877 21-Mar-2013 Jason Molenda <jmolenda@apple.com> Add a new method GetFunctionAddressAndSizeVector to DWARFCallFrameInfo.
This returns a vector of <file address, size> entries for all of
the functions in the module that have an eh_frame FDE.

Update ObjectFileMachO to use the eh_frame FDE function addresses if
the LC_FUNCTION_STARTS section is missing, to fill in the start
addresses of any symbols that have been stripped from the binary.

Generally speaking, lldb works best if it knows the actual start
address of every function in a module - it's especially important
for unwinding, where lldb inspects the instructions in the prologue
of the function. In a stripped binary, it is deprived of this
information and it reduces the quality of our unwinds and saved
register retrieval.

Other ObjectFile users may want to use the function addresses from
DWARFCallFrameInfo to fill in any stripped symbols like ObjectFileMachO
does already.
<rdar://problem/13365659>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
9badb6c001eb6cfa8135aab4f1ce19f5efd0fdd6 07-Mar-2013 Jason Molenda <jmolenda@apple.com> Remove some tabs and extraneous space chars from ObjectFileMachO.cpp.
Noticed these while working on the last commit.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
6bcabae25ca2260d33e864c178ecd9aae119a273 07-Mar-2013 Jason Molenda <jmolenda@apple.com> Retrieve the dyld shared cache mapping offset from the shared cache instead of hardcoding the value.
Read the version number of the dyld shared cache.
<rdar://problem/13311882>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
464a5063bc59755cb6ec063d0b2491097302d2ab 04-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13338643>

DWARF with .o files now uses 40-60% less memory!

Big fixes include:
- Change line table internal representation to contain "file addresses". Since each line table is owned by a compile unit that is owned by a module, it makes address translation into lldb_private::Address easy to do when needed.
- Removed linked address members/methods from lldb_private::Section and lldb_private::Address
- lldb_private::LineTable can now relink itself using a FileRangeMap to make it easier to re-link line tables in the future
- Added ObjectFile::ClearSymtab() so that we can get rid of the object file symbol tables after we parse them once since they are not needed and kept memory allocated for no reason
- Moved the m_sections_ap (std::auto_ptr to section list) and m_symtab_ap (std::auto_ptr to the lldb_private::Symtab) out of each of the ObjectFile subclasses and put it into lldb_private::ObjectFile.
- Changed how the debug map is parsed and stored to be able to:
- Lazily parse the debug map for each object file
- not require the address map for a .o file until debug information is linked for a .o file



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0688435f443de94c82a1ec3b33451beaf2f0b43d 27-Feb-2013 Greg Clayton <gclayton@apple.com> Added eSymbolTypeResolver to a few switch statements that needed it.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0bf22380daa9ddbd8c0e8da81d3bc82c2601e5e6 05-Feb-2013 Jason Molenda <jmolenda@apple.com> Change ObjectFileMachO::ParseSymtab to read the external
function stub routine addresses from an in-memory-only
MachO object file. This was the only remaining part of
ParseSymtab() that was assuming a file exists.
<rdar://problem/13139585>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174455 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
90b9cc8bb04c1937c398490064b0da98253c4acf 26-Jan-2013 Jason Molenda <jmolenda@apple.com> One more change of a uint32_t variable to offset_t
to match Greg's dataextractor patch, this one in some
#if defined arm code.


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

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

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

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

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



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

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

<rdar://problem/12856749>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
b76f77eb6d28b7cbbc5c4d81614379f8e029b4ba 13-Dec-2012 Jason Molenda <jmolenda@apple.com> Remove insufficient linkedit address check; the problem
is deeper than that and avoiding the crash in this
one part of code won't solve anything. I know where
the real problem is now.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
e8a321d6e8957f245b6a2cf665b792324953e202 07-Dec-2012 Jason Molenda <jmolenda@apple.com> <rdar://problem/12831670>
When using the same-device optimization for shared cache libraries, if
we have an invalid load address for __LINKEDIT, don't try to read
anything out of lldb's own address space. Reading it out of the remote
address space will fail gracefully if we have bad addresses but reading
it out of lldb's own address space will result in a crash.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
01e6a58b057676d5dc434876dbb2d54871bb962e 27-Nov-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12106825>

Allow the expression parser to see more than just data symbols. We now accept any symbol that has an address. We take precautions to only accept symbols by their mangled or demangled names only if the demangled name was not synthesized. If the demangled name is synthesized, then we now mark symbols accordingly and only compare against the mangled original name.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
21a2543251940af5592c7c72dac895148fc609e0 16-Nov-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12238339>

Make sure architectures are obeyed for skinny mach files.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
b5431d08d0dfb961ea0833ec485f11b9aa3541d1 31-Oct-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12602978>

RegisterContextKDP_i386 was not correctly writing registers due to missing "virtual" keywords. Added the virtual keywords and made the functions pure virtual to ensure subclasses can't get away without implementing these functions.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
4df2b7f432a8a76f2073c4db9ed84bda9be68a30 07-Sep-2012 Greg Clayton <gclayton@apple.com> Train LLDB to deal with bad linker N_SO entries that point to our source files for debug map + DWARF in .o file debugging.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163417 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
ab77dcb5ff41709505eb73008af3e576bf4f55f3 06-Sep-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12237556>

Fixed an issue where we didn't parse N_SO stab pairs where the first N_SO was a relative path.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
d4330e6663781f12e0bf206b8323c672f0189b02 05-Sep-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/12100588>

Don't crash when we can't resolve our stub to a symbol.



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

<rdar://problem/11930775>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
292cca834d6ce7e78509e3bf09b7d1a4bc6614e9 20-Jul-2012 Jason Molenda <jmolenda@apple.com> Change the things we pass to Mangled::SetValue to be ConstStrings instead of
char*'s - Greg removed the methods which accept char*'s earlier today.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
c02400422d5e644a2a486bce5517d46d435a3f02 19-Jul-2012 Greg Clayton <gclayton@apple.com> Cleaned up the lldb_private::Mangled class to get rid of the tokenizing code that has bit rotted and isn't being used. Also cleaned up the API to the "lldb_private::Mangled" to always take "const ConstString &" arguments instead of both "const ConstString &" and "const char *".



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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
a5689d522eea6406e1ddcc8495687917942c84d5 12-Jul-2012 Sean Callanan <scallanan@apple.com> Blacklisted a UUID that is generated by OpenCL on
Mac OS X, because the UUID is the same for all
OpenCL-generated dylibs and therefore would
conflict.

<rdar://problem/11620586>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
fd3b35d8374196b1c69397a52c797f8e93cda27a 22-Jun-2012 Jason Molenda <jmolenda@apple.com> Additional comment in ObjectFileMachO::ParseSymtab to explain
the layout of the dyld shared cache file and how we're stepping
through it; also use offsetof to find offsets of struct elements.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
b62abd5162c166f81e5c9b473f754d957657b891 21-Jun-2012 Jason Molenda <jmolenda@apple.com> Preliminary set of changes to ObjectFileMachO::ParseSymtab when lldb
is being run on iOS natively and we are examining a binary that is
in the shared-cache. The shared cache may be set up to not load the
symbol names in memory (and may be missing some local symbols entirely,
to boot) so we need to read the on-disk-but-not-mapped-into-memory cache
of symbol names/symbols before we start processing the in-memory nlist
entries.

This code needs to be reorganized into its own separate method, ideally
we'll find some way to not duplicate the nlist symbol handling. But
we need to handle this new format quickly and we'll clean up later.

Thanks for James McIlree for the patch. Fixes <rdar://problem/11639018>.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158891 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
716a6647382d32ea9859027f7eea07e6ff2acf76 08-Jun-2012 Sean Callanan <scallanan@apple.com> Committed a change to the SectionList that introduces
a cache of address ranges for child sections,
accelerating lookups. This cache is built during
object file loading, and is then set in stone once
the object files are done loading. (In Debug builds,
we ensure that the cache is never invalidated after
that.)


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
5fa6cd36ba1806303de8c3973b36337574cd4dc2 30-May-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11537498>

Fixed an issue with the symbol table parsing of files that have STAB entries in them where there are two N_SO entries where the first has a directory, and the second contains a full path:

[ 0] 00000002 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/src/'
[ 1] 0000001e 64 (N_SO ) 00 0000 0000000000000000 '/Volumes/data/src/Source/main.m'
[ 2] 00000047 66 (N_OSO ) 09 0001 000000004fc642d2 '/tmp/main.o'
[ 3] 00000001 2e (N_BNSYM ) 01 0000 0000000000003864
[ 4] 000000bd 24 (N_FUN ) 01 0000 0000000000003864 '_main'
[ 5] 00000001 24 (N_FUN ) 00 0000 00000000000000ae
[ 6] 00000001 4e (N_ENSYM ) 01 0000 00000000000000ae
[ 7] 00000001 64 (N_SO ) 01 0000 0000000000000000

We now correctly combine entries 0 and 1 into a single entry.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
54e3371c9260525efa58a87ce2e0c6dcaf0ba2cf 25-May-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11535465>

LC_ENCRYPTION_INFO with "cryptid == 0" is not actually encrypted and LLDB fails to read memory from file.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
3a5dc01cf4c06eaa5057aef6a5289aec00c2adef 25-May-2012 Greg Clayton <gclayton@apple.com> Fixed an issue where we might have easy access to the string table data for a mach file from memory even though we have a process. So now we don't read the string table strings from memory when we don't have to.



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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
6f7f8daf508b225f0e1327f90237fd79912ca309 24-Apr-2012 Greg Clayton <gclayton@apple.com> Added support for the LC_ENCRYPTION_INFO load command.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
2a76fbf9ca189aa2269ad8382ed07f68062fa2e4 24-Apr-2012 Jason Molenda <jmolenda@apple.com> A small fix for ObjectFileMachO::ParseSymtab() where a pointer
into the middle of a vector was being used after the vector may
have been resized.
<rdar://problem/11284937>



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
29021d341d8985ff180a0f1cdb0ce7a8504a83f6 18-Apr-2012 Greg Clayton <gclayton@apple.com> Added an iOS local debugging optimization when reading the __LINKEDIT section data for files in the dyld shared cache.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
d2653c29ee7023d7bc2b504267169bbad68d988b 14-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11042408>

Fixed an issue with the FUNC_STARTS load command where we would get the
symbol size wrong and we would add all sorts of symbols due to bit zero being
set to indicate thumb.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152696 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
9482f05e109d617061c1ade6d9672dfcb8427547 14-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11034170>

Simplify the locking strategy for Module and its owned objects to always use the Module's mutex to avoid A/B deadlocks. We had a case where a symbol vendor was locking itself and then calling a function that would try to get it's Module's mutex and at the same time another thread had the Module mutex that was trying to get the SymbolVendor mutex. Now any classes that inherit from ModuleChild should use the module lock using code like:

void
ModuleChildSubclass::Function
{
ModuleSP module_sp(GetModule());
if (module_sp)
{
lldb_private::Mutex::Locker locker(module_sp->GetMutex());
... do work here...
}
}

This will help avoid deadlocks by using as few locks as possible for a module and all its child objects and also enforce detecting if a module has gone away (the ModuleSP will be returned empty if the weak_ptr does refer to a valid object anymore).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
4aa2edf602fa60693afa33d4fe0d1d459a488333 09-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11016907>

Get function boundaries from the LC_FUNCTION_STARTS load command. This helps to determine symbol sizes and also allows us to be able to debug stripped binaries.

If you have a stack backtrace that goes through a function that has been stripped from the symbol table, the variables for any functions above that stack frame will most likely be incorrect. It can also affect our ability to step in/out/through of a function.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152381 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
6e12c7a5a851f661677b16c544aac2f93fb6e86d 08-Mar-2012 Sean Callanan <scallanan@apple.com> Updated the revision of LLVM/Clang used by LLDB.
This takes two important changes:

- Calling blocks is now supported. You need to
cast their return values, but that works fine.

- We now can correctly run JIT-compiled
expressions that use floating-point numbers.

Also, we have taken a fix that allows us to
ignore access control in Objective-C as in C++.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0c31d3d3a4a1d00d53346d8a23b0519f47e55d1f 07-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10997402>

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
9ce953807eb814a93b449dc243de4f7bf32c3115 14-Feb-2012 Greg Clayton <gclayton@apple.com> Full core file support has been added for mach-o core files.

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
ac725afac61b48d1dc0e38370d824fe45c52c3b7 10-Feb-2012 Sean Callanan <scallanan@apple.com> Improved detection of object file types, moving
detection of kernels into the object file and
adding a new category for raw binary images.
Fixed all clients who previously searched for
sections manually, making them use the object
file's facilities instead.


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

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
b5a8f1498e1ddaeed5187a878d57ea0b74af9c26 05-Feb-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10560053>

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

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

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

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

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

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

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

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

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

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




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
db2dc2b824b61ef7578dc8cdad7b338aa82b1f17 12-Jan-2012 Greg Clayton <gclayton@apple.com> Big change in the way ObjectFile file contents are managed. We now
mmap() the entire object file contents into memory with MAP_PRIVATE.
We do this because object file contents can change on us and currently
this helps alleviate this situation. It also make the code for accessing
object file data much easier to manage and we don't end up opening the
file, reading some data and closing the file over and over.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
df6dc88322f103b263092d752db4490e628a1cbd 05-Jan-2012 Greg Clayton <gclayton@apple.com> Added code in the Host layer that can report system log messages
so that we don't have "fprintf (stderr, ...)" calls sprinkled everywhere.
Changed all needed locations over to using this.

For non-darwin, we log to stderr only. On darwin, we log to stderr _and_
to ASL (Apple System Log facility). This will allow GUI apps to have a place
for these error and warning messages to go, and also allows the command line
apps to log directly to the terminal.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0fea0512e47d1820dd78de2748b874c81eea77d6 30-Dec-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10368163>

Watch for empty symbol tables by doing a lot more error checking on
all mach-o symbol table load command values and data that is obtained.
This avoids a crash that was happening when there was no string table.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
115213c2c4e38af52ef43bfecc2028c1e04a02bf 16-Dec-2011 Jim Ingham <jingham@apple.com> Fix a bug where when debugging with .o files, we end up with two symbols for each real OBJC_CLASS_$_whatever, one of which is correctly classified as an ObjCClass symbol, and the other is just a data symbol. This was messing up the ObjC dynamic type detection.
<rdar://problem/10589527>

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
d0b7cfa22722fdaf4111a61d6eeb02a587710e16 03-Dec-2011 Sean Callanan <scallanan@apple.com> Testcase fixes with the new symbol lookup code for
Objective-C, making symbol lookups for various raw
Objective-C symbols work correctly. The IR interpreter
makes these lookups because Clang has emitted raw
symbol references for ivars and classes.

Also improved performance in SymbolFiles, caching the
result of asking for SymbolFile abilities.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
038f1c07ca16f5ae501fa221a1d8a1cebf103d34 03-Dec-2011 Greg Clayton <gclayton@apple.com> Remove accidental "else" that was left in in prior checking.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
3f69eacbb218a37390822c89d3675bd740590382 03-Dec-2011 Greg Clayton <gclayton@apple.com> Added new symbol types for Objective C classes, metaclasses, and ivars. Each
object file can correctly make these symbols which will abstract us from the
file format and ABI and we can then ask for the objective C class symbol for
a class and find out which object file it was defined in.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0c496cd73b30842b49dcc26975fb50c0c77ad34f 22-Nov-2011 Greg Clayton <gclayton@apple.com> 12% allocated memory savings when debugging clang with DWARF in .o files by
making sure we perfectly size our vector of symbols on the symbol table.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145069 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
a1b9a90b7aef446302de9b845dc4f3b0e1473aa7 13-Nov-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10338439>

This is the actual fix for the above radar where global variables that weren't
initialized were not being shown correctly when leaving the DWARF in the .o
files. Global variables that aren't intialized have symbols in the .o files
that specify they are undefined and external to the .o file, yet document the
size of the variable. This allows the compiler to emit a single copy, but makes
it harder for our DWARF in .o files with the executable having a debug map
because the symbol for the global in the .o file doesn't exist in a section
that we can assign a fixed up linked address to, and also the DWARF contains
an invalid address in the "DW_OP_addr" location (always zero). This means that
the DWARF is incorrect and actually maps all such global varaibles to the
first file address in the .o file which is usually the first function. So we
can fix this in either of two ways: make a new fake section in the .o file
so that we have a file address in the .o file that we can relink, or fix the
the variable as it is created in the .o file DWARF parser and actually give it
the file address from the executable. Each variable contains a
SymbolContextScope, or a single pointer that helps us to recreate where the
variables came from (which module, file, function, etc). This context helps
us to resolve any file addresses that might be in the location description of
the variable by pointing us to which file the file address comes from, so we
can just replace the SymbolContextScope and also fix up the location, which we
would have had to do for the other case as well, and update the file address.
Now globals display correctly.

The above changes made it possible to determine if a variable is a global
or static variable when parsing DWARF. The DWARF emits a DW_TAG_variable tag
for each variable (local, global, or static), yet DWARF provides no way for
us to classify these variables into these categories. We can now detect when
a variable has a simple address expressions as its location and this will help
us classify these correctly.

While making the above changes I also noticed that we had two symbol types:
eSymbolTypeExtern and eSymbolTypeUndefined which mean essentially the same
thing: the symbol is not defined in the current object file. Symbol objects
also have a bit that specifies if a symbol is externally visible, so I got
rid of the eSymbolTypeExtern symbol type and moved all code locations that
used it to use the eSymbolTypeUndefined type.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
a9c4f31f3c511a731fecdf09e8f032f4f537ebfa 31-Oct-2011 Greg Clayton <gclayton@apple.com> <rdar://problem/10368163>

Fixed an issue where if a mach-o symbol table was corrupt and had a string
table offset that is invalid, we could crash. We now properly check the string
table offset and ignore any symbols with invalid strings.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
24a6bd9835ed1655984397b0cdf35127e47681e9 27-Oct-2011 Greg Clayton <gclayton@apple.com> Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself.

Added 3 new formats which can be used to display data:

eFormatAddressInfo
eFormatHexFloat
eFormatInstruction

eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".

eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".

eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is
"instruction".

Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public
API.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143114 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
aa4a553d4b8cd37f13bd4946f504265000a7bcc4 13-Oct-2011 Sean Callanan <scallanan@apple.com> Removed namespace qualification from symbol queries.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.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
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
00db215522a0cf31082d26d7ab30d2aa30965acf 05-Oct-2011 Greg Clayton <gclayton@apple.com> Enable all the new accelerator tables if they are present and don't manually
index the DWARF. Also fixed an issue with memory accelerator tables with a
size of 1 where we would loop infinitely.

Added support for parsing the new .apple_namespaces section which gives us a
memory hash table for looking up namespaces.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
f6e3de2d877dc94120c72624a79e488c9bea5c35 28-Sep-2011 Greg Clayton <gclayton@apple.com> Convert over to the latest and greatest on disc accelerator
hash tables. Renamed the DWARF sections to ".apple_names" and
".apple_types" until we get more buy in from other vendors.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
6a64bbf41006e1184315b6593d7ec9d81c1c4654 21-Sep-2011 Greg Clayton <gclayton@apple.com> The first part of a fix for being able to select an architecture slice from
a file when the target has a triple with an unknown vendor and/or OS and the
slice of the file itself has a valid vendor and/or OS.

The Module now adopts the ObjectFile's architecture after a valid architecture
has been loaded to make sure the module matches the object file.



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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
c8cf5e234be554d4acb6ae644a8269c303c4f56e 02-Sep-2011 Greg Clayton <gclayton@apple.com> Added support for accessing and loading our new .debug_names and .debug_types
DWARF accelerator table sections to the DWARF parser. These sections are similar
to the .debug_pubnames and .debug_pubtypes, but they are designed to be hash tables
that are saved to disc in a way that the sections can just be loaded into memory
and used without any work on the debugger side. The .debug_pubnames and .debug_pubtypes
sections are not ordered, contain a copy of the name in the section itself which
makes these sections quite large, they only include publicly exported names (so no
static functions, no types defined inside functions), many compilers put different
information in them making them very unreliable so most debugger ignore these sections
and parse the DWARF on their own. The tables must also be parsed and sorted in order
to be used effectively. The new sections can be quickly loaded and very efficiently be used
to do name to DIE lookups with very little up front work. The format of these new
sections will be changing while we work out the bugs, but we hope to have really
fast name to DIE lookups soon.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
811b9c568bb0127f09a6cdd94842586eebf25d02 26-Aug-2011 Greg Clayton <gclayton@apple.com> Fixed an assertion that could happen if we happened to parse a mach-o object
file that had a symbol that had a section specified where the section had
zero size. We now honor this section definition for the symbol and don't
assert anymore.



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

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

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

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

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

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




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
5638d2c0d72747d8334638a128a17246353b53a7 10-Jul-2011 Greg Clayton <gclayton@apple.com> Fixed an assertion crasher. We now handle things correclty and
emit an error to stderr when we see this issue.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
ca31997f0ff24dbba39623054d5a94a0181c52d6 09-Jul-2011 Greg Clayton <gclayton@apple.com> Added the ability to get an abstract file type (executable, object file,
shared library, etc) and strata (user/kernel) from an object file. This will
help with plug-in and platform selection when given a new binary with the
"target create <file>" command.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
dab471f7fd8052a2f40e0202ca8b57a7fead732e 19-Jun-2011 Greg Clayton <gclayton@apple.com> Fixed a crasher where we were accessing a symbol with a bad index.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133377 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
54b38413f62af3bcaeb8802a978cc621c8e88eb1 25-May-2011 Greg Clayton <gclayton@apple.com> ABI plug-ins must implement the following pure virtual functions:

virtual bool
ABI::StackUsesFrames () = 0;

Should return true if your ABI uses frames when doing stack backtraces. This
means a frame pointer is used that points to the previous stack frame in some
way or another.

virtual bool
ABI::CallFrameAddressIsValid (lldb::addr_t cfa) = 0;

Should take a look at a call frame address (CFA) which is just the stack
pointer value upon entry to a function. ABIs usually impose alignment
restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
This function should return true if "cfa" is valid call frame address for
the ABI, and false otherwise. This is used by the generic stack frame unwinding
code to help determine when a stack ends.

virtual bool
ABI::CodeAddressIsValid (lldb::addr_t pc) = 0;

Validates a possible PC value and returns true if an opcode can be at "pc".
Some ABIs or architectures have fixed width instructions and must be aligned
to a 2 or 4 byte boundary. "pc" can be an opcode or a callable address which
means the load address might be decorated with extra bits (such as bit zero
to indicate a thumb function call for ARM targets), so take this into account
when returning true or false. The address should also be validated to ensure
it is a valid address for the address size of the inferior process. 32 bit
targets should make sure the address is less than UINT32_MAX.

Modified UnwindLLDB to use the new ABI functions to help it properly terminate
stacks.


Modified the mach-o function that extracts dependent files to not resolve the
path as the paths inside a binary might not match those on the current
host system.




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



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

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

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

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


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

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




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

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
2877594f4442cfc4d0ed2abd30af6b8027a84fc1 08-Mar-2011 Jim Ingham <jingham@apple.com> Add a method "GetEntryPoint" to the ObjectFile class, and implement it on MachO & ELF - though the ELF implementation is probably a little weak. Then use this method in place of directly looking for "start" in the ThreadPlanCallFunction constructor to find the stopping point for our function evaluation.

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

uint32_t
ArchSpec::GetMachOCPUType () const;

uint32_t
ArchSpec::GetMachOCPUSubType () const;

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

All code has been updated to deal with the changes.

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



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




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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
ddff7cca4b3d2507706ed9011e6f0a503b984195 04-Feb-2011 Greg Clayton <gclayton@apple.com> Remove bzero use and replace with memset (patch from Kirk Beitz).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124897 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0467c78e9a75eff9ec33d3c1f39fa83e1c5d9241 04-Feb-2011 Greg Clayton <gclayton@apple.com> Applied a fix to qualify "UUID" with the lldb_private namespace to fix
build issues on MinGW.



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



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



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

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



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

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

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

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

Removed deprecated functions from the DynamicLoaderMacOSXDYLD class.

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





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

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

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



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

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

FileSpec::FileSpec (const char *path);

and in the:

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

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

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

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

So I removed the constructor that just takes a path:

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

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

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

I also removed the default parameter to SetFile():

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116944 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
08a73204faf6db215f22f5cefaf84b57cfd69e6a 09-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed a typo from my previous "Added support for LC_LOAD_UPWARD_DYLIB in mach-o files".

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116132 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
ca2c0936ab75bf70b9cccf7fa717a87c1048735e 09-Oct-2010 Greg Clayton <gclayton@apple.com> Added support for LC_LOAD_UPWARD_DYLIB in mach-o files.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
8d3802d9d6c1be4c0d37c4d269b18bcb865823e6 08-Oct-2010 Greg Clayton <gclayton@apple.com> Added mutex protection to the Symtab class.

Added a new SortOrder enumeration and hooked it up to the "image dump symtab"
command so we can dump symbol tables in the original order, sorted by address,
or sorted by name.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
3fed8b9b2696fc2ea78005c8f9b1c621d5748042 08-Oct-2010 Greg Clayton <gclayton@apple.com> Hooked up ability to look up data symbols so they show up in disassembly
if the address comes from a data section.

Fixed an issue that could occur when looking up a symbol that has a zero
byte size where no match would be returned even if there was an exact symbol
match.

Cleaned up the section dump output and added the section type into the output.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
6af4fad40d2d2a5aaa7da3112000af89b8cf3298 06-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed an issue with the mach-o file parser when parsing indirect symbol stubs
where the symbol index was set to INDIRECT_SYMBOL_ABS and was causing an
assertion to fire when we loaded older Mac OS X binaries.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
637029b85196806ce0f39271764efae43c888e85 12-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed an issue I found in the mach-o symbol table parsing where
we cached remapping information using the old nlist index to the
new symbol index, yet we tried to lookup the symbol stubs that
were for symbols that had been remapped by ID instead of using
the new symbol index. This is now fixed and the mach-o symbol tables
are fixed.

Use the delta between two vector entries to determine the stride
in case any padding is inserted by compilers for bsearch calls
on symbol tables when finding symbols by their original ID.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
7c36fa07bc2c2c7efc4a28ad540f7711491f379d 11-Sep-2010 Greg Clayton <gclayton@apple.com> Remove the eSymbolTypeFunction, eSymbolTypeGlobal, and eSymbolTypeStatic.
They will now be represented as:
eSymbolTypeFunction: eSymbolTypeCode with IsDebug() == true
eSymbolTypeGlobal: eSymbolTypeData with IsDebug() == true and IsExternal() == true
eSymbolTypeStatic: eSymbolTypeData with IsDebug() == true and IsExternal() == false

This simplifies the logic when dealing with symbols and allows for symbols
to be coalesced into a single symbol most of the time.

Enabled the minimal symbol table for mach-o again after working out all the
kinks. We now get nice concise symbol tables and debugging with DWARF in the
.o files with a debug map in the binary works well again. There were issues
where the SymbolFileDWARFDebugMap symbol file parser was using symbol IDs and
symbol indexes interchangeably. Now that all those issues are resolved
debugging is working nicely.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
e34ee5f4beb9acad6c340174e71b6732adc6c613 11-Sep-2010 Jim Ingham <jingham@apple.com> Always look up the symbols with FindSymbolByID since we are minimizing the symbol list.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
8c8488087c9e6bf32065ad05b4e6be78b2cd1046 08-Sep-2010 Greg Clayton <gclayton@apple.com> Disable minimized symbol tables for now as this was causing test suite failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
576a68b11040d567a45dd14bc63590f1b5e0f099 08-Sep-2010 Greg Clayton <gclayton@apple.com> Enable minimized symbol tables when parsing mach-o files. This
new change will omit unneeded symbol table entries and coalesce
function entries (N_FUN stab entries) with their linker code
symbol (N_SECT symbols) into only the function symbol to avoid
duplicate symbol table entries. It will also coalesce N_STSYM and
the data linker symbol into just one static data symbol.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
0ad086f3ab18d6927b9df2f79169607d3a5d90e4 07-Sep-2010 Greg Clayton <gclayton@apple.com> Added Symtab::FindSymbolByID() in preparation for enabling the minimal
symbol tables. Minimal symbol tables enable us to merge two symbols, one
debug symbol and one linker symbol, into a single symbol that can carry
just as much information and will avoid duplicate symbols in the symbol
table.



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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
32a8c7e02b84fbc36ee0fdb553002a1880c8d83e 22-Jul-2010 Greg Clayton <gclayton@apple.com> Modified both the ObjectFileMachO and ObjectFileELF to correctly set the
SectionType for Section objects for DWARF.

Modified the DWARF plug-in to get the DWARF sections by SectionType so we
can safely abstract the LLDB core from section names for the various object
file formats.

Modified the SectionType definitions for .debug_pubnames and .debug_pubtypes
to use the correct case.



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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
ccfba727178bb919cdff3365839bed9584df2560 07-Jul-2010 Jason Molenda <jmolenda@apple.com> Switch over to using llvm's dwarf constants file.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
661825b68e95abdfab2c7242c0d515e8260d1431 29-Jun-2010 Greg Clayton <gclayton@apple.com> Fixed debug map in executable + DWARF in .o debugging on Mac OS X.

Added the ability to dump any file in the global module cache using any of
the "image dump" commands. This allows us to dump the .o files that are used
with DWARF + .o since they don't belong the the target list for the current
target.



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

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

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



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


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp