summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O
Commit message (Collapse)AuthorAgeFilesLines
* Sketch out the armv7 and arm64 core file writing support inJason Molenda2014-11-121-7/+169
| | | | | | | | | | | | | | | ObjectFileMachO. It's close but we seem to be missing some of the memory region segments - not exactly sure how that's happening. The register context writing into the LC_THREAD load commands is working correctly though. Slightly reordered the arm64 definitions in ArchSpec.cpp so when we look for an arm64 core file definiton we're getting a cpu subtype of CPU_ANY which we can't put in the mach header of a core file. Make the first definition we find by linear search have the currently correct '1' cpu subtype. llvm-svn: 221743
* Add support for 32-bit core file dumping. Add support for i386 process core ↵Jason Molenda2014-11-111-20/+120
| | | | | | file dumping. llvm-svn: 221683
* Remove unused variable.Jason Molenda2014-10-161-3/+1
| | | | | | clang static analyzer fixit. llvm-svn: 219904
* Fixed an issue where the last N load commands in the mach-o core file would ↵Greg Clayton2014-09-161-0/+1
| | | | | | | | | | not be read in where N was the number of LC_THREAD load commands. I now properly increment the ncmds for each LC_THREAD and now core files are saved correctly. <rdar://problem/18312703> llvm-svn: 217905
* Fix up lldb build for llvm r217172.Todd Fiala2014-09-041-3/+3
| | | | | | Changes reference to 4th element in version_min_command from reserved to sdk. llvm-svn: 217185
* When adding a dSYM to an existing ObjectFile, we can have a situationJason Molenda2014-08-221-0/+12
| | | | | | | | | | | | | | | | | | with binaries in the dyld shared cache (esp on iOS) where the file address for the executable binary (maybe from memory, maybe from an expanded copy of the dyld shared cache) is different from the file address in the dSYM. In that case, ObjectFileMachO replaces the file addresses from the original binary with the dSYM file addresses (usually 0-based) -- lldb doesn't have a notion of two file addresses for a given module so they need to agree. There was a cache of file addresses over in the Symtab so I added a method to the Module and the objects within to clear any file address caches if they exist, and added an implementation in the Symtab module to do that. <rdar://problem/16929569> llvm-svn: 216258
* When constructing an ArchSpec from a MachO cpu type and subtype, don't set ↵Greg Clayton2014-07-291-2/+6
| | | | | | | | the OS for x86_64 and x86 in case the binary ends up being for macosx or ios. <rdar://problem/17819272> llvm-svn: 214188
* ObjectFileMachO: Silence signed/unsigned comparison warningDavid Majnemer2014-07-241-2/+1
| | | | | | | | | | | | | | | | | | | | File::SeekFromStart returns an off_t representing the position of the file after seeking. This return value is always going to be one of two values: the input or -1 in the case of failure. ObjectFileMachO compares an expression of type off_t from the return of File::SeekFromStart(segment.fileoff) and compares it for equality with segment.fileoff. The type of segment_command_64::fileoff is unsigned while off_t is signed, comparing them emits a diagnostic under GCC. Instead, we can just compare SeekFromSTart with -1 to see if we successfully seeked. Differential Revision: http://reviews.llvm.org/D4634 llvm-svn: 213822
* Plugins: silence a few more signed comparision warningsSaleem Abdulrasool2014-07-231-1/+2
| | | | | | Address a few signed-compare warnings that were triggered on GCC 4.8.2. llvm-svn: 213716
* Target: silence a GCC warningSaleem Abdulrasool2014-07-231-1/+3
| | | | | | | | | GCC emits a warning: warning: enumeral and non-enumeral type in conditional expression [enabled by default] which does not seem to have a flag to control it. Simply add an explicit cast for the boolean value. llvm-svn: 213715
* Use PRIx64.Joerg Sonnenberger2014-07-181-1/+1
| | | | llvm-svn: 213366
* Fixed the objective C symbol parsing in ObjectFileMachO.Greg Clayton2014-07-171-6/+0
| | | | | | | | | | | | | This fixes all of the hidden ivar test cases and any case where we try to find the full definition of an objective C class. This also means hidden ivars show up again. <rdar://problem/15458957> llvm.org/pr20270 llvm.org/pr20269 llvm.org/pr20272 llvm-svn: 213328
* __arm64__ and __aarch64__ #ifdef adjustmentsTodd Fiala2014-07-091-4/+4
| | | | | | | | Change by Paul Osmialowski See http://reviews.llvm.org/D4379 for details. llvm-svn: 212583
* Fix typos.Bruce Mitchener2014-07-011-13/+13
| | | | llvm-svn: 212132
* Patch from Keno Fischer to enable JITLoaderGDB with mach-o file support.Greg Clayton2014-06-241-1/+4
| | | | | | The patch is as is with the functionality left disabled for apple vendors because of performance regressions. If this is enabled it ends up searching for symbols in all shared libraries that are loadeded. llvm-svn: 211638
* Correctly classify code sections as code sections by using the ↵Greg Clayton2014-06-161-113/+149
| | | | | | | | | | S_ATTR_PURE_INSTRUCTIONS and S_ATTR_SOME_INSTRUCTIONS section flags. Also correctly set the symbol type of symbols for S_REGULAR and other section types. <rdar://problem/16896734> llvm-svn: 211073
* Remove unused variablesSaleem Abdulrasool2014-06-131-1/+1
| | | | | | | | Address the 'variable set but not used' warning from GCC. In some cases a few additional calls were removed where there should be no visible side effects of the calls (i.e. should not effect any cached state). llvm-svn: 210879
* Added the ability to save core files:Greg Clayton2014-06-132-1/+419
| | | | | | | | | | | (lldb) file /bin/ls (lldb) b malloc (lldb) run (lldb) process save-core /tmp/ls.core Each ObjectFile plug-in now has the option to save core files by registering a new static callback. llvm-svn: 210864
* iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator ↵Greg Clayton2014-05-292-47/+102
| | | | | | | | | | | | | | | | | | apps and binaries. Changes include: - ObjectFileMachO can now determine if a binary is "*-apple-ios" or "*-apple-macosx" by checking the min OS and SDK load commands - ArchSpec now says "<arch>-apple-macosx" is equivalent to "<arch>-apple-ios" since the simulator mixes and matches binaries (some from the system and most from the iOS SDK). - Getting process inforamtion on MacOSX now correctly classifies iOS simulator processes so they have "*-apple-ios" architectures in the ProcessInstanceInfo - PlatformiOSSimulator can now list iOS simulator processes correctly instead of showing nothing by using: (lldb) platform select ios-simulator (lldb) platform process list - debugserver can now properly return "*-apple-ios" for the triple in the process info packets for iOS simulator executables - GDBRemoteCommunicationClient now correctly passes along the triples it gets for process info by setting the OS in the llvm::Triple correctly <rdar://problem/17060217> llvm-svn: 209852
* ReExported symbols can point to a library that doesn't actuallyJim Ingham2014-05-212-0/+12
| | | | | | | | | contain the symbol, but just reexports wholesale from another library. Handle this case. <rdar://problem/16977589> llvm-svn: 209270
* When increasing the amount of a file read, read the total of the Mach-O headerJason Molenda2014-04-221-2/+3
| | | | | | | | plus the size of the load commands in case the LC_UUID load command comes near the end of the file. <rdar://problem/16599318> llvm-svn: 206865
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-5/+9
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* Workaround for collision between enum members in LLVM's MachO.h and system ↵Jim Ingham2014-04-022-5/+6
| | | | | | | | | | headers on Mac OS X (in particular mach/machine.h). <rdar://problem/16494607> llvm-svn: 205480
* sanitise sign comparisonsSaleem Abdulrasool2014-04-021-1/+1
| | | | | | | | This is a mechanical change addressing the various sign comparison warnings that are identified by both clang and gcc. This helps cleanup some of the warning spew that occurs during builds. llvm-svn: 205390
* lldb arm64 import.Jason Molenda2014-03-291-6/+151
| | | | | | | | | | | | | | | | These changes were written by Greg Clayton, Jim Ingham, Jason Molenda. It builds cleanly against TOT llvm with xcodebuild. I updated the cmake files by visual inspection but did not try a build. I haven't built these sources on any non-Mac platforms - I don't think this patch adds any code that requires darwin, but please let me know if I missed something. In debugserver, MachProcess.cpp and MachTask.cpp were renamed to MachProcess.mm and MachTask.mm as they picked up some new Objective-C code needed to launch processes when running on iOS. llvm-svn: 205113
* Verify we have a correct ELF or Mach core file before we return a valid ↵Greg Clayton2014-03-071-3/+2
| | | | | | instace of ProcessElfCore or ProcessMachCore respectively. llvm-svn: 203274
* Modified ObjectFile::SetLoadAddress() to now be:Greg Clayton2014-02-072-22/+85
| | | | | | | | | | | | | | ObjectFile::SetLoadAddress (Target &target, lldb::addr_t value, bool value_is_offset); Now "value" is a slide if "value_is_offset" is true, and "value" is an image base address otherwise. All previous usage of this API was using slides. Updated the ObjectFileELF and ObjectFileMachO SetLoadAddress methods to do the right thing. Also updated the ObjectFileMachO::SetLoadAddress() function to not load __LINKEDIT when it isn't needed and to only load sections that belong to the executable object file. llvm-svn: 201003
* Implement ObjectFileMachO::SetLoadAddress().Greg Clayton2014-02-062-0/+59
| | | | llvm-svn: 200943
* If a library has no N_FUN symbols we don't succeed in finding resolver ↵Greg Clayton2014-01-161-2/+2
| | | | | | | | symbols, now we do. <rdar://problem/15831334> llvm-svn: 199345
* Make sure we correctly merge all N_FUN symbols with non-stab entries even if ↵Greg Clayton2014-01-161-50/+82
| | | | | | | | there are multiple symbols with the same name. <rdar://problem/15831292> llvm-svn: 199344
* The actual indirect symbol is not the one at the address of the Trie entry ↵Jim Ingham2014-01-101-27/+42
| | | | | | marked with the EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER, it is given in the address in the “other” field in that entry. llvm-svn: 198967
* Added the ability to get the SDK path for a target using the platform ↵Greg Clayton2013-10-242-0/+132
| | | | | | | | plugins. If LLDB lives inside an Xcode.app bundle, it will select the SDK in the Xcode bundle, else it will use the currently selected Xcode. Also added the DWARFDataExtractor classes to the Xcode project file. llvm-svn: 193380
* <rdar://problem/14496092>Greg Clayton2013-10-211-35/+240
| | | | | | | | Fixed an issue with reexported symbols on MacOSX by adding support for symbols re-exporting symbols. There is now a new symbol type eSymbolTypeReExported which contains a new name for the re-exported symbol and the new shared library. These symbols are only used when a symbol is re-exported as a symbol under a different name. Modified the expression parser to be able to deal with finding the re-exported symbols and track down the actual symbol it refers to. llvm-svn: 193101
* <rdar://problem/15191078>Greg Clayton2013-10-111-1/+1
| | | | | | Fixed Module::ResolveSymbolContextForAddress() to be able to also look in the SymbolVendor's SymbolFile's ObjectFile for a more meaningful symbol when a symbol lookup finds a synthetic symbol from the main object file. This will help lookups on MacOSX as the main executable might be stripped, but the dSYM file always has a full symbol table. llvm-svn: 192510
* Convert to UNIX line endings.Joerg Sonnenberger2013-09-251-5/+5
| | | | llvm-svn: 191367
* Change ProcessMachCore to search for both a user-process dyld binaryJason Molenda2013-09-141-2/+2
| | | | | | | | | | | | | | | | and a mach kernel in all the pages of the core file. If it finds a user-process dyld binary, assume this is a user process that had a copy of the mach kernel in memory when it crashed (e.g. lldb doing kernel debugging) even though we found the kernel binary first. Also, change the error messages about sections extending past the end of the file to be warnings and make the messages sound less severe. Most user process core files have one section that isn't included in the file and there's no reason to worry people about that. <rdar://problem/14473235> llvm-svn: 190741
* Fixed a few typos.Ashok Thirumurthi2013-08-271-2/+2
| | | | llvm-svn: 189355
* Fix some names in the wake of my Mach-O changes to LLVM.Charles Davis2013-08-271-282/+277
| | | | llvm-svn: 189317
* When ObjectFileMachO::GetModuleSpecifications is getting the ArchSpecJason Molenda2013-08-271-0/+5
| | | | | | | | | out of a binary, if the Mach-O binary is MH_PRELOAD ("standalone"), don't let the OS be set to "ios" or "macosx" - there will be no dynamic loader used when debugging this process. <rdar://problem/9956443> llvm-svn: 189305
* MingW compilation (windows). Includes various refactoring to improve ↵Virgile Bello2013-08-231-1/+1
| | | | | | portability. llvm-svn: 189107
* Follow-up to the checkin of r188532 -- make sure thatJason Molenda2013-08-171-0/+9
| | | | | | | we've read the ObjectFile's Symtab before we change the File addresses in the Sections. llvm-svn: 188604
* Add a new Section::SetFileAddress method to change a Section's fileJason Molenda2013-08-161-10/+24
| | | | | | | | | | | | | | | | | | | | | address. When loading a dSYM, and the file addresses of the dSYM Sections are different than the executable binary Sections' file addresses, the debug info won't be remapped to the actual load addresses correctly. This only happens with binaries on the in-memory shared cache binaries where their File addresses have been set to their actual load address (outside an offset value) whereas the original executable and dSYM have 0-based File addresses. I think this patch will not be activated for other cases -- this is the only case we know of where the dSYM and the executable's File addresses differ -- but if this causes other problems we can restrict it more carefully. <rdar://problem/12335086> llvm-svn: 188532
* <rdar://problem/14717184>Greg Clayton2013-08-131-1/+11
| | | | | | Improve the documentation for the new target.memory-module-load-level setting, and also return an error when there is no nlist data when appropriate. llvm-svn: 188317
* <rdar://problem/14717184>Greg Clayton2013-08-131-639/+648
| | | | | | | | | | | | LLDB needs in memory module load level settings to control how much information is read from memory when loading in memory modules. This change adds a new setting: (lldb) settings set target.memory-module-load-level [minimal|partial|complete] minimal will load only sections (no symbols, or function bounds via function starts or EH frame) partial will load sections + bounds complete will load sections + bounds + symbols llvm-svn: 188246
* Fixed GetModuleSpecifications() to work better overall:Greg Clayton2013-07-121-1/+2
| | | | | | | | | | | - 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 llvm-svn: 186211
* Cleanup on the unified section list changes. Main changes are:Greg Clayton2013-07-102-462/+471
| | | | | | | | | | | | | | | - 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) llvm-svn: 185990
* Split symbol support for ELF and Linux.Michael Sartain2013-07-012-3/+10
| | | | llvm-svn: 185366
* <rdar://problem/13941992>Greg Clayton2013-06-041-5/+7
| | | | | | 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. llvm-svn: 183247
* <rdar://problem/13128331>Greg Clayton2013-05-151-24/+21
| | | | | | | | 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". llvm-svn: 181916
* <rdar://problem/13748253>Greg Clayton2013-05-141-91/+141
| | | | | | Combine N_GSYM stab entries with their non-stab counterpart (data symbols) to make the symbol table smaller with less duplicate named symbols. llvm-svn: 181841
OpenPOWER on IntegriCloud