summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile
Commit message (Collapse)AuthorAgeFilesLines
...
* Avoid crashing by not mmap'ing files on network mounted file systems.Greg Clayton2015-02-233-13/+13
| | | | | | | | | | | | | | | | | | | | This is implemented by making a new FileSystem function: bool FileSystem::IsLocal(const FileSpec &spec) Then using this in a new function: DataBufferSP FileSpec::MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const; This function only mmaps data if the file is a local file since that means we can reliably page in data. We were experiencing crashes where people would use debug info files on network mounted file systems and that mount would go away and cause the next access to a page that wasn't paged in to crash LLDB. We now avoid this by just copying the data into a heap buffer and keeping a permanent copy to avoid the crash. Updated all previous users of FileSpec::MemoryMapFileContentsIfLocal() in ObjectFile subclasses over to use the new FileSpec::MemoryMapFileContentsIfLocal() function. <rdar://problem/19470249> llvm-svn: 230283
* Exit early from DumpELFProgramHeaders if parse failsEd Maste2015-02-231-15/+15
| | | | | | | This matches the way DumpELFSectionHeaders is implemented and is recommended by the LLVM coding conventions. llvm-svn: 230228
* Make sure things build for iOS after recent changes.Greg Clayton2015-02-201-7/+9
| | | | llvm-svn: 230076
* Correctly handle N_INDR nlist entries and don't rely on the trie information ↵Greg Clayton2015-02-141-20/+108
| | | | | | | | in order to reproduce them since this dyld trie info can be missing. <rdar://problem/19749670> llvm-svn: 229201
* Don't wait for the dynamic loader to set a module as a dynamic link editor, ↵Greg Clayton2015-02-052-1/+10
| | | | | | | | | | figure it out through the ObjectFile. Background: dyld binaries often have extra symbols in their symbol table like "malloc" and "free" for the early bringup of dyld and we often don't want to set breakpoints in dynamic linker binaries. We also don't want to call the "malloc" or "free" function in dyld when a user writes an expression like "(void *)malloc(123)" so we need to avoid doing name lookups in dyld. We mark Modules as being dynamic link editors and this helps do correct lookups for breakpoints by name and function lookups. <rdar://problem/19716267> llvm-svn: 228261
* Fix it so we always get major, minor and update from the version in ↵Greg Clayton2015-02-041-12/+4
| | | | | | | | ObjectFileMachO::GetMinimumOSVersion(...) and ObjectFileMachO::GetSDKVersion(...). <rdar://problem/19697053> llvm-svn: 228092
* Don't stomp the triple when loading a PECOFF target.Zachary Turner2015-01-221-1/+8
| | | | | | | | | | | | | | | | | | | | | When you create a target, it tries to look for the platform's list of supported architectures for a match. The match it finds can contain specific triples, like i386-pc-windows-msvc. Later, we overwrite this value with the most generic triple that can apply to any platform with COFF support, causing some of the fields of the triple to get overwritten. This patch changes the behavior to only merge in values from the COFF triple if the fields of the matching triple were unknown/unspecified to begin with. This fixes load address resolution on Windows, since it enables the DynamicLoaderWindows to be used instead of DynamicLoaderStatic. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D7120 llvm-svn: 226849
* [LLDB][MIPS] Adding SoftwareBreakpointTrapOpcode and RelocationJumpSlotType ↵Mohit K. Bhakkad2015-01-081-0/+3
| | | | | | | | | | | | | | | | for MIPS Patch by Bhushan Attarde Reviewers: clayborg Reviewed By: clayborg Subscribers: petarj, dsanders, mohit.bhakkad, lldb-commits Differential Revision: http://reviews.llvm.org/D6861 llvm-svn: 225436
* The lldb unwinder can now use the unwind information from the compact-unwind Jason Molenda2014-12-081-4/+17
| | | | | | | | | | | | | | | | | | section for x86_64 and i386 targets on Darwin systems. Currently only the compact unwind encoding for normal frame-using functions is supported but it will be easy handle frameless functions when I have a bit more free time to test it. The LSDA and personality routines for functions are also retrieved correctly for functions from the compact unwind section. This new code is very fresh -- it passes the lldb testsuite and I've done by-hand inspection of many functions and am getting correct behavior for all of them. There may need to be some bug fixing over the next couple weeks as I exercise and test it further. But I think it's fine right now so I'm committing it. <rdar://problem/13220837> llvm-svn: 223625
* Enable armv7 core file writing for Mach-O binaries. Jason Molenda2014-11-121-3/+4
| | | | | | | The problems with the dyld all image infos struct seems to be specific to arm64. llvm-svn: 221760
* 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
* First cut of PowerPC(64) support in LLDB.Justin Hibbits2014-10-312-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: This adds preliminary support for PowerPC/PowerPC64, for FreeBSD. There are some issues still: * Breakpoints don't work well on powerpc64. * Shared libraries don't yet get loaded for a 32-bit process on powerpc64 host. * Backtraces don't work. This is due to PowerPC ABI using a backchain pointer in memory, instead of a dedicated frame pointer register for the backchain. * Breakpoints on functions without debug info may not work correctly for 32-bit powerpc. Reviewers: emaste, tfiala, jingham, clayborg Reviewed By: clayborg Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D5988 llvm-svn: 220944
* Remove unused variable.Jason Molenda2014-10-161-3/+1
| | | | | | clang static analyzer fixit. llvm-svn: 219904
* Improve the handling of kalimba ELF file section type recognition.Matthew Gardiner2014-10-151-8/+15
| | | | | | | | Recognise the SHT_NOBITS property in kalimba ELF, and determine this to be of type zerofilled. Subsequently recognise this type to represent bytes on the target's DATA address space, and therefore be sized accordingly. llvm-svn: 219782
* Very minimal support 24-bit kalimbas. Vanilla "memory read" for data sectionsMatthew Gardiner2014-09-291-3/+43
| | | | | | | | | | | works, as do breakpoints, run and pause, display zeroth frame. See http://reviews.llvm.org/D5503 for a fuller description of the changes in this commit. llvm-svn: 218596
* 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
* ELF: store the thumbness of a function in symbol flags.Todd Fiala2014-09-152-2/+56
| | | | | | | | | | | | This allows us to fixup the address of the symbol as soon as we parse it so that lldb is not confused thinking there are two different symbols in the binary (one with the thumb bit, one without). Also, differentiating between THUMB and ARM symbols allows the debugger to place the right type of breakpoint. Change by Stephane Sezer. llvm-svn: 217841
* Handle ARM ELF symbols properly: skip $t* and $a* symbols in ObjectFileELF.Todd Fiala2014-09-151-0/+26
| | | | | | | | | | | | | | | ELF objects contain marker symbols to differentiate between ARM and THUMB functions. Instead of storing them internally and having garbage show up when symbols are searched for by the user, we can just skip them and not store them at all, as we never actually need them. Change by Stephane Sezer. Tested: Ubuntu 14.04 x86_64 MacOSX 10.9.4 x86_64 llvm-svn: 217782
* 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
* lldb - ELF: add ARM64 relocation jump slot handling in ELFHeader.Todd Fiala2014-08-291-0/+3
| | | | | | | | See http://reviews.llvm.org/D4579 for more details. Change by Paul Osmialowski. llvm-svn: 216739
* Add support for kalimba architecture variants 3, 4 and 5.Matthew Gardiner2014-08-271-2/+36
| | | | | | | | Add entries to core_definitions and elf_arch_entries for those variants. Select the subtype for the variant by parsing the e_flags field of the elf header. llvm-svn: 216541
* 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
* Move Host::GetArchitecture to HostInfo::GetArchitecture.Zachary Turner2014-08-201-4/+3
| | | | | | | | As a side effect, this patch also eliminates all of the preprocessor conditionals previously used to implement GetArchitecture(). llvm-svn: 216074
* Move some Host logic into HostInfo class.Zachary Turner2014-08-191-4/+6
| | | | | | | | | | | | | | | | | | This patch creates a HostInfo class, a static class used to answer basic queries about the host platform. As part of this change, some functionality is moved from Host to HostInfo, and relevant fixups are performed in the rest of the codebase. This is part of a larger effort to isolate more code in the Host layer into platform-specific groups, to make it easier to make platform specific changes for a particular Host without breaking other hosts. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4963 llvm-svn: 215992
* Silence a warning saying "typedef requires a name" from clang.Greg Clayton2014-07-291-1/+1
| | | | llvm-svn: 214247
* Remove unused variable that was causing a warning.Greg Clayton2014-07-291-1/+0
| | | | llvm-svn: 214230
* 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
* Fix supported architectures on PlatformWindows.Zachary Turner2014-07-282-1/+30
| | | | | | | | | | i386, i486, i486sx, and i686 are all indistinguishable as far as PE/COFF files are concerned. This patch adds support for all of these architectures to PlatformWindows. Differential Revision: http://reviews.llvm.org/D4658 llvm-svn: 214092
* 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
* Fix an issue where an entry point of 0x00 would cause LLDB to think that the ↵Deepak Panickal2014-07-221-1/+1
| | | | | | ELF is not executable without checking for ET_EXEC llvm-svn: 213644
* Dynamic loader for the Hexagon DSPDeepak Panickal2014-07-211-0/+3
| | | | llvm-svn: 213565
* 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
* Add kalimba as a platform.Todd Fiala2014-07-161-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | This change comprises of additions and some minor changes in order that "kalimba" is listed as a supported platform and that debugging any kalimbas results in PlatformKalimba being associated with the target. The changes are as follows: * The PlatformKalimba implementation itself * A tweak to ArchSpec * .note parsing for Kalimba in ObjectFileELF.cpp * Plugin registration * Makefile additions Change by Matthew Gardiner Minor tweak for cmake and Xcode by Todd Fiala Tested: Ubuntu 14.04 x86_64, clang 3.5-built lldb, all tests pass. MacOSX 10.9.4, Xcode 6.0 Beta 1-built lldb, all tests pass. llvm-svn: 213158
* Allow generic ARM cores to match any more specific ARM architecture.Greg Clayton2014-07-121-2/+23
| | | | | | <rdar://problem/15932248> llvm-svn: 212863
* Modify ObjectFileELF::GetArchitecture() to avoid calling ↵Todd Fiala2014-07-111-2/+5
| | | | | | | | ParseSectionHeaders() when we have headers. Change by Matthew Gardiner. llvm-svn: 212825
* Prevent ObjectFileELF::GetSectionHeaderInfo() from reparsing section headers.Todd Fiala2014-07-111-4/+4
| | | | | | | | | | | | | If we have any section headers in the collection, we already parsed them. Therefore, don't reparse the section headers when the section_headers collection is not empty. See this thread for more details: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140707/011721.html Change by Matthew Gardiner llvm-svn: 212822
* __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-082-5/+5
| | | | llvm-svn: 212553
* Start converting usages of off_t to other types.Zachary Turner2014-07-022-4/+5
| | | | | | | | | | | | | | | | | | | | | | | off_t is a type which is used for file offsets. Even more specifically, it is only used by a limited number of C APIs that deal with files. Any usage of off_t where the variable is not intended to be used with one of these APIs is a bug, by definition. This patch corrects some easy mis-uses of off_t, generally by converting them to lldb::offset_t, but sometimes by using other types such as size_t, when appropriate. The use of off_t to represent these offsets has worked fine in practice on linux-y platforms, since we used _FILE_OFFSET_64 to guarantee that off_t was a uint64. On Windows, however, _FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit. So the usage of off_t on Windows actually leads to legitimate bugs. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4358 llvm-svn: 212192
* Fix typos.Bruce Mitchener2014-07-012-16/+16
| | | | llvm-svn: 212132
* Fix ObjectFileELF to determine architectures independent of host.Todd Fiala2014-06-272-37/+303
| | | | | | | | | | | | | | | | | | Previously ObjectFileELF was simplifying and assuming the object file it was looking at was the same as the host architecture/triple. This would break attempts to run, say, lldb on MacOSX against lldb-gdbserver on Linux since the MacOSX lldb would say that the linux elf file was really an Apple MacOSX architecture. Chaos would ensue. This change allows the elf file to parse ELF notes for Linux, FreeBSD and NetBSD, and determine the OS appropriately from them. It also initializes the OS type from the ELF header OSABI if it is set (which it is for FreeBSD but not for Linux). Added a test with freebsd and linux images that verify that '(lldb) image list -t -A' prints out the expected architecture for each. llvm-svn: 211907
* Replace GCC-specific intrinsic with portable alternative.Zachary Turner2014-06-251-1/+5
| | | | | | | | | | | | | | | | Not all supported compilers have GCC intrinsics, so this patch uses the correct portable alternative. Additionally, this patch fixes an off-by-one error. __builtin_ffs returns the 1-based index of the least-significant 1-bit, but the function expects the base 2 logarithm of the number, which is equivalent to the 0-based index of the least-significant 1-bit. Reviewed by: Keno Fischer Differential Revision: http://reviews.llvm.org/D4284 llvm-svn: 211669
* Patch from Keno Fischer to enable JITLoaderGDB with mach-o file support.Greg Clayton2014-06-243-1/+6
| | | | | | 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
OpenPOWER on IntegriCloud