summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add warning messages for the cases where the inferior process shared cacheJason Molenda2013-04-161-5/+10
| | | | | | | | | 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. llvm-svn: 179633
* <rdar://problem/13468295>Greg Clayton2013-04-161-13/+24
| | | | | | 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. llvm-svn: 179605
* The dyld_all_image_infos structure, at version 13 and higher, hasJason Molenda2013-04-161-13/+110
| | | | | | | | | | | | 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> llvm-svn: 179583
* Fix some minor code indentation mistakes in ObjectFileMachO.Jason Molenda2013-04-161-39/+39
| | | | | | No code changes in this checkin, only whitespace. llvm-svn: 179579
* When ObjectFileMachO::ParseSections() notices that it has a truncated file, ↵Jason Molenda2013-04-101-0/+26
| | | | | | | | | | | 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> llvm-svn: 179152
* <rdar://problem/13521159>Greg Clayton2013-03-271-8/+8
| | | | | | | | 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. llvm-svn: 178191
* Don't try to read the eh_frame section out of a dSYM.Jason Molenda2013-03-221-1/+5
| | | | | | It won't have one and it isn't needed. llvm-svn: 177688
* Add a new method GetFunctionAddressAndSizeVector to DWARFCallFrameInfo.Jason Molenda2013-03-211-0/+33
| | | | | | | | | | | | | | | | | | | | | | | 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> llvm-svn: 177624
* Remove some tabs and extraneous space chars from ObjectFileMachO.cpp.Jason Molenda2013-03-061-136/+136
| | | | | | Noticed these while working on the last commit. llvm-svn: 176590
* Retrieve the dyld shared cache mapping offset from the shared cache instead ↵Jason Molenda2013-03-061-14/+64
| | | | | | | | | of hardcoding the value. Read the version number of the dyld shared cache. <rdar://problem/13311882> llvm-svn: 176589
* <rdar://problem/13338643>Greg Clayton2013-03-041-4/+0
| | | | | | | | | | | | | | | | 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 llvm-svn: 176454
* Added eSymbolTypeResolver to a few switch statements that needed it.Greg Clayton2013-02-271-0/+1
| | | | llvm-svn: 176210
* <rdar://problem/13159777> Greg Clayton2013-02-061-8/+29
| | | | | | | | | | | | | | 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. llvm-svn: 174524
* Change ObjectFileMachO::ParseSymtab to read the externalJason Molenda2013-02-051-2/+14
| | | | | | | | | 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> llvm-svn: 174455
* One more change of a uint32_t variable to offset_tJason Molenda2013-01-261-1/+1
| | | | | | | to match Greg's dataextractor patch, this one in some #if defined arm code. llvm-svn: 173564
* <rdar://problem/13069948>Greg Clayton2013-01-251-33/+34
| | | | | | | | | | | | 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. llvm-svn: 173463
* Removed the == and != operators from ArchSpec, sinceSean Callanan2012-12-131-1/+1
| | | | | | | | | | | | 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> llvm-svn: 170152
* Remove insufficient linkedit address check; the problemJason Molenda2012-12-131-1/+1
| | | | | | | | 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. llvm-svn: 170068
* <rdar://problem/12831670>Jason Molenda2012-12-071-1/+1
| | | | | | | | | | 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. llvm-svn: 169582
* <rdar://problem/12106825>Greg Clayton2012-11-271-77/+88
| | | | | | 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. llvm-svn: 168668
* <rdar://problem/12238339> Greg Clayton2012-11-161-0/+5
| | | | | | Make sure architectures are obeyed for skinny mach files. llvm-svn: 168205
* <rdar://problem/12602978>Greg Clayton2012-10-301-1/+13
| | | | | | 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. llvm-svn: 167066
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-16/+19
| | | | llvm-svn: 165808
* Train LLDB to deal with bad linker N_SO entries that point to our source ↵Greg Clayton2012-09-071-0/+36
| | | | | | files for debug map + DWARF in .o file debugging. llvm-svn: 163417
* <rdar://problem/12237556>Greg Clayton2012-09-051-31/+40
| | | | | | Fixed an issue where we didn't parse N_SO stab pairs where the first N_SO was a relative path. llvm-svn: 163259
* <rdar://problem/12100588>Greg Clayton2012-09-051-1/+7
| | | | | | Don't crash when we can't resolve our stub to a symbol. llvm-svn: 163189
* Removed explicit NULL checks for shared pointersSean Callanan2012-08-091-2/+2
| | | | | | | | | and instead made us use implicit casts to bool. This generated a warning in C++11. <rdar://problem/11930775> llvm-svn: 161559
* Change the things we pass to Mangled::SetValue to be ConstStrings instead of Jason Molenda2012-07-201-5/+5
| | | | | | char*'s - Greg removed the methods which accept char*'s earlier today. llvm-svn: 160539
* Cleaned up the lldb_private::Mangled class to get rid of the tokenizing code ↵Greg Clayton2012-07-181-6/+6
| | | | | | 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 *". llvm-svn: 160466
* Ran the static analyzer on the codebase and found a few things.Greg Clayton2012-07-171-5/+0
| | | | llvm-svn: 160338
* Blacklisted a UUID that is generated by OpenCL onSean Callanan2012-07-121-0/+13
| | | | | | | | | | Mac OS X, because the UUID is the same for all OpenCL-generated dylibs and therefore would conflict. <rdar://problem/11620586> llvm-svn: 160135
* Additional comment in ObjectFileMachO::ParseSymtab to explainJason Molenda2012-06-221-6/+14
| | | | | | | the layout of the dyld shared cache file and how we're stepping through it; also use offsetof to find offsets of struct elements. llvm-svn: 158962
* Preliminary set of changes to ObjectFileMachO::ParseSymtab when lldbJason Molenda2012-06-211-8/+847
| | | | | | | | | | | | | | | | | 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>. llvm-svn: 158891
* Committed a change to the SectionList that introducesSean Callanan2012-06-081-1/+1
| | | | | | | | | | | 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.) llvm-svn: 158188
* <rdar://problem/11537498>Greg Clayton2012-05-301-2/+20
| | | | | | | | | | | | | | | | | 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. llvm-svn: 157712
* <rdar://problem/11535465> Greg Clayton2012-05-251-8/+15
| | | | | | LC_ENCRYPTION_INFO with "cryptid == 0" is not actually encrypted and LLDB fails to read memory from file. llvm-svn: 157487
* Fixed an issue where we might have easy access to the string table data for ↵Greg Clayton2012-05-251-17/+21
| | | | | | 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. llvm-svn: 157482
* Found a quick way to improve the speed with which we can read object files ↵Greg Clayton2012-05-181-23/+48
| | | | | | 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. llvm-svn: 157083
* Added support for the LC_ENCRYPTION_INFO load command.Greg Clayton2012-04-241-2/+28
| | | | llvm-svn: 155423
* A small fix for ObjectFileMachO::ParseSymtab() where a pointerJason Molenda2012-04-241-1/+5
| | | | | | | | into the middle of a vector was being used after the vector may have been resized. <rdar://problem/11284937> llvm-svn: 155421
* Added an iOS local debugging optimization when reading the __LINKEDIT ↵Greg Clayton2012-04-181-11/+51
| | | | | | section data for files in the dyld shared cache. llvm-svn: 154984
* <rdar://problem/11042408>Greg Clayton2012-03-141-7/+49
| | | | | | | | 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. llvm-svn: 152696
* <rdar://problem/11034170> Greg Clayton2012-03-131-306/+347
| | | | | | | | | | | | | | | | | | | 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). llvm-svn: 152679
* <rdar://problem/11016907>Greg Clayton2012-03-091-730/+871
| | | | | | | | 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. llvm-svn: 152381
* Updated the revision of LLVM/Clang used by LLDB.Sean Callanan2012-03-081-0/+11
| | | | | | | | | | | | | | | 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++. llvm-svn: 152286
* <rdar://problem/10997402>Greg Clayton2012-03-071-12/+11
| | | | | | | | | | | 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. llvm-svn: 152244
* <rdar://problem/10103468>Greg Clayton2012-02-241-61/+69
| | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 151336
* Added the ability to get a ObjectFile versions from the ObjectFileGreg Clayton2012-02-221-0/+51
| | | | | | | subclasses if the object files support version numbering. Exposed this through SBModule for upcoming data formatter version checking stuff. llvm-svn: 151190
* Full core file support has been added for mach-o core files.Greg Clayton2012-02-131-36/+251
| | | | | | | | | | | | | | | | 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. llvm-svn: 150426
* Improved detection of object file types, movingSean Callanan2012-02-101-2/+14
| | | | | | | | | | 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. llvm-svn: 150272
OpenPOWER on IntegriCloud