summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Some minor improvements on the symtab parsing codeTamas Berghammer2015-10-271-7/+16
| | | | | | | | | | | | | | | * Remove an unneccessary re-computaion on arch spec from the ELF file * Use a local cache to optimize name based section lookups in symtab parsing * Optimize C++ method basename validation with replacing a regex with hand written code These modifications reduce the time required to parse the symtab from large applications by ~25% (tested with LLDB as inferior) Differential revision: http://reviews.llvm.org/D14088 llvm-svn: 251402
* ArchSpec: fix unintentional promotion of unspecified unknowns to specified ↵Todd Fiala2015-10-131-0/+6
| | | | | | | | | | | | | | | | | | | | | unknowns * ArchSpec::MergeFrom() would erroneously promote an unspecified unknown to a specified unknown when both the ArchSpec and the merged in ArchSpec were both unspecified unknowns. This no longer happens, which fixes issues with global module cache lookup in some situations. * Added ArchSpec::DumpTriple(Stream&) that now properly prints unspecified unknowns as '*' and specified unknows as 'unknown'. This makes it trivial to tell the difference between the two. Converted printing code over ot using DumpTriple() rather than building from scratch. * Fixed up a couple places that were not guaranteeing that an unspecified unknown was recorded as such. llvm-svn: 250253
* Romove accidentially added statement in r249020Sagar Thakur2015-10-011-2/+0
| | | | llvm-svn: 249021
* [LLDB][MIPS] Fix gp register value for o32 applications on 64-bit targetSagar Thakur2015-10-011-0/+2
| | | | | | | GP registers for o32 applications were always giving zero value because SetType() on the RegisterValue was causing the accessor functions to pickup the value from m_scalar of RegisterValue which is zero. In this patch byte size and byte order of register value is set at the time of setting the value of the register. llvm-svn: 249020
* Add support for .ARM.exidx unwind informationTamas Berghammer2015-09-301-0/+4
| | | | | | | | | .ARM.exidx/.ARM.extab sections contain unwind information used on ARM architecture from unwinding from an exception. Differential revision: http://reviews.llvm.org/D13245 llvm-svn: 248903
* [LLDB][MIPS] microMIPS breakpoints, disassembly and compressed addressesJaydeep Patil2015-09-221-0/+35
| | | | | | | | | | | | SUMMARY: This patch detects microMIPS symbols, sets breakpoints using un-compressed address and display disassembly in mixed mode for microMIPS applications (running on bare-iron targets). Reviewers: clayborg Subscribers: nitesh.jain, mohit.bhakkad, sagar, bhushan and lldb-commits Differential Revision: http://reviews.llvm.org/D12079 llvm-svn: 248248
* Add an OperatingSystem plugin to support goroutinesRyan Brown2015-09-161-0/+2
| | | | | | | | | | The Go runtime schedules user level threads (goroutines) across real threads. This adds an OS plugin to create memory threads for goroutines. It supports the 1.4 and 1.5 go runtime. Differential Revision: http://reviews.llvm.org/D5871 llvm-svn: 247852
* [LLDB][MIPS] Add support for DT_MIPS_RLD_MAP_RELBhushan D. Attarde2015-09-151-4/+23
| | | | | | | | | | | | SUMMARY: This patch provides support for MIPS specific DT_MIPS_RLD_MAP_REL tag in LLDB. This tag allows debugging of MIPS position independent executables and provides access to shared library information. Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits Differential Revision: http://reviews.llvm.org/D12794 llvm-svn: 247666
* Fix a small typo in ObjectFileELF.cpp.Stephane Sezer2015-09-111-1/+1
| | | | llvm-svn: 247452
* Improve the arm/aarch64 mapping symbol handlingTamas Berghammer2015-09-111-36/+51
| | | | | | | | | | | | Change the mapping symbol handling to handle the case when the mapping symbols are prefixed with an arbitrary prefix. This isn't strictly standard compliance, but if all symbols in an object file is prefixed with objcopy then the prefix will be added to the mapping symbol also. We still want to treat these symbols as mapping symbols to get the correct address class data. Differential revision: http://reviews.llvm.org/D12755 llvm-svn: 247400
* [LLDB][MIPS] Added support for the debugging of N32/O32 applications on ↵Mohit K. Bhakkad2015-09-091-10/+20
| | | | | | | | | | | | MIPS64 target. Patch by Nitesh Jain Reviewers: clayborg, ovyalov. Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar, nitesh.jain, lldb-commits. Differential Revision: http://reviews.llvm.org/D12671 llvm-svn: 247134
* Add basic fission support to SymbolFileDWARFTamas Berghammer2015-09-091-14/+26
| | | | | | | | | | | | | * Create new dwo symbol file class * Add handling for .dwo sections * Change indexes in SymbolFileDWARF to store compile unit offset next to DIE offset * Propagate queries from dwarf compile unit to the dwo compile unit where applicable Differential revision: http://reviews.llvm.org/D12291 llvm-svn: 247132
* Add support for DW_FORM_GNU_[addr,str]_indexTamas Berghammer2015-08-251-15/+21
| | | | | | | | | These are 2 new value currently in experimental status used when split debug info is enabled. Differential revision: http://reviews.llvm.org/D12238 llvm-svn: 245931
* Add absolute load address support for the DynamicLoader pluginsTamas Berghammer2015-08-241-26/+38
| | | | | | | | | | | | The POSIX linker generally reports the load bias for the loaded libraries but in some case it is useful to handle a library based on absolute load address. Example usecases: * Windows linker uses absolute addresses * Library list came from different source (e.g. /proc/<pid>/maps) Differential revision: http://reviews.llvm.org/D12233 llvm-svn: 245834
* Fix issues with separate symbolfile handlingTamas Berghammer2015-07-301-12/+29
| | | | | | Differential revision: http://reviews.llvm.org/D11595 llvm-svn: 243637
* Fix typos.Bruce Mitchener2015-07-221-5/+5
| | | | | | | | | | | | Summary: Fix a bunch of typos. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11386 llvm-svn: 242856
* [LLDB][MIPS] Detect MIPS application specific extensions like micromipsJaydeep Patil2015-07-161-0/+35
| | | | | | | | | | | | | | SUMMARY: The patch detects MIPS application specific extensions (ASE) like micromips by reading ELF header.e_flags and SHT_MIPS_ABIFLAGS section. MIPS triple does not contain ASE information like micromips, mips16, DSP, MSA etc. These can be read from header.e_flags or SHT_MIPS_ABIFLAGS section. Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, lldb-commits Differential Revision: http://reviews.llvm.org/D11133 llvm-svn: 242381
* Skip oatdata and oatexec symbols in system@framework@boot.oatTamas Berghammer2015-07-131-2/+14
| | | | | | | | | | | | | | On Android the oatdata and the oatexec symbols in system@framework@boot.oat covers the full .text section what causes issues with displaying unusable symbol name to the user and very slow unwinding speed because the instruction emulation based unwind plans try to emulate all instructions in these symbols. Don't add these symbols to the symbol list as they have no use for the debugger and they are causing a lot of trouble. Differential revision: http://reviews.llvm.org/D11065 llvm-svn: 242017
* Make many mangled functions that might demangle a name be allowed to specify ↵Greg Clayton2015-07-081-2/+3
| | | | | | a language to use in order to soon support Pascal and Java demangling. Dawn Perchik will take care of making this so. llvm-svn: 241751
* Use string::find(char) for single character strings.Bruce Mitchener2015-07-041-1/+1
| | | | | | | | | | | | Summary: Use string::find(char) for single character strings. Reviewers: abidh, ki.stfu, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10943 llvm-svn: 241390
* Fix [vdso] handling on Android (x86 and aarch64)Tamas Berghammer2015-06-301-4/+32
| | | | | | | | | | | | | | * Add in-memory object file handling to the core dynamic loader * Fix in memory object file handling in ObjectFileELF (previously only part of the file was loaded before parsing) * Fix load address setting in ObjectFileELF for 32-bit targets when the load bias is negative * Change hack in DYLDRendezvous.cpp to be more specific and not to interfere with object files with fixed load address Differential revision: http://reviews.llvm.org/D10800 llvm-svn: 241057
* Resubmitting 240466 after fixing the linux test suite failures.Greg Clayton2015-06-251-2/+2
| | | | | | | | | | | | | | | A few extras were fixed - Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. - Since some places want to access the address as a reference, I added a few new functions to symbol: Address &Symbol::GetAddressRef(); const Address &Symbol::GetAddressRef() const; Linux test suite passes just fine now. <rdar://problem/21494354> llvm-svn: 240702
* Fix location of symbol size calculation in ObjectFileELFTamas Berghammer2015-06-241-1/+1
| | | | | | Bug introduced by r240533 llvm-svn: 240537
* Improve instruction emulation based stack unwinding on ARMTamas Berghammer2015-06-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | * Add and fix the emulation of several instruction. * Disable frame pointer usage on Android. * Specify return address register for the unwind plan instead of explict tracking the value of RA. * Replace prologue detection heuristics (unreliable in several cases) with a logic to follow the branch instructions and restore the CFI value based on them. The target address for a branch should have the same CFI as the source address (if they are in the same function). * Handle symbols in ELF files where the symbol size is not specified with calcualting their size based on the next symbol (already done in MachO files). * Fix architecture in FuncUnwinders with filling up the inforamtion missing from the object file with the architecture of the target. * Add code to read register wehn the value is set to "IsSame" as it meanse the value of a register in the parent frame is the same as the value in the current frame. Differential revision: http://reviews.llvm.org/D10447 llvm-svn: 240533
* Improve OSType initialization in elf object file's arch_specEd Maste2015-06-051-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the OSType in the ArchSpec triple is needed to correctly setup up the register context plugin. ArchSpec::SetArchitecture, for Mach-O only, sets the OSType. For ELF it was left to the ObjectFileELF to fill in the missing OSType. This change moves the ObjectFileELF logic into ArchSpec. A new optional 'os' parameter has been added to SetArchitecture. For ELF, this value is the from the ELF header.e_ident[EI_OSABI]. The default value is 0 or ELFOSABI_NONE. The real work of determining the OSType was done by the ObjectFileELF helper function GetOsFromOSABI. This logic has been moved SetArchitecture. GetOsFromOSABI has been commented as being deprectated. It is left in to support asserts. For ELF the vendor value returned from SetArchitecture should be UnknownVendor. An unneeded resetting in ObjectFileELF has been removed and replaced with an assert. This fixes a problem reading a core file on FreeBSD/ARM because the spec triple was arm-unknown-unknown. Patch by Tom Rix. Differential Revision: http://reviews.llvm.org/D9292 llvm-svn: 239148
* Fix THUMB function detection when function name is not prefixed.Aidan Dodds2015-05-281-11/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D10062 llvm-svn: 238433
* Fix parsing of the plt section for android-armTamas Berghammer2015-05-081-6/+52
| | | | | | | | | | | | | | | | The ELF data contains two different errors in some ELF files on android. * The link field of the symbol table don't point to the plt section or to the dynsym section even when it is present in the ELF files. * The size of the plt entries aren't specified in the section header of the plt section. This CL adds some workarounds for these two issue with finding the sections by name if the link field is empty and by using a heuristic to calculate the size and offset of the plt entries. Differential revision: http://reviews.llvm.org/D9560 llvm-svn: 236818
* [LLDB][MIPS] Add MIPS32 and MIPS64 core revisionsMohit K. Bhakkad2015-04-231-7/+12
| | | | | | | | | | | | | | | Patch by Jaydeep Patil Added MIPS32 and MIPS64 core revisions. This would be followed by register context and emulate-instruction for MIPS32. DYLDRendezvous.cpp: On Linux link map struct does not contain extra load offset field. Reviewers: clayborg Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits. Differential Revision: http://reviews.llvm.org/D9190 llvm-svn: 235574
* Remove usages of host architecture within ELF object file for unknown parts ↵Oleksiy Vyalov2015-04-181-32/+0
| | | | | | | | of ArchSpec. http://reviews.llvm.org/D9078 llvm-svn: 235255
* Fix mapping symbol handling on arm 32/64Tamas Berghammer2015-04-171-25/+31
| | | | | | | | | | | | The debug info section contains some $d mapping symbol what is overlapping with code sections in other sections of the object file causing problem in the address class detection. This CL ignores these symboles from the address class map as the debug info sections don't use this map. Differential revision: http://reviews.llvm.org/D9050 llvm-svn: 235171
* Fix thumb symbol value fixup in ObjectFileELFTamas Berghammer2015-04-161-1/+1
| | | | llvm-svn: 235098
* Ignore mapping symbols on aarch64Tamas Berghammer2015-04-071-50/+77
| | | | | | | | | | | ELF symbol tables on aarch64 may contains some mapping symbols. They provide information about the underlying data but interfere with symbol look-up of lldb. They are already ignored on arm32. With this CL they will be ignored on aarch64 also. Differential revision: http://reviews.llvm.org/D8776 llvm-svn: 234307
* Parse .note.android.ident header from elf filesTamas Berghammer2015-03-181-1/+15
| | | | | | | | | | | In android a .note.android.ident section header is added to the elf files to provide information for the debuggers that it is an android specific module. This CL add logic to parse it out from the elf files and set the module specification based on it. Differential revision: http://reviews.llvm.org/D8377 llvm-svn: 232625
* [MIPS] - Register Context for MIPS64Mohit K. Bhakkad2015-03-171-0/+26
| | | | | | | | | | | | | | | | Patch by Jaydeep Patil Summery: 1. Add MIPS variants by parsing e_flags of the ELF 2. Create RegisterInfoInterface and RegisterContext for MIPS64 and MIPS64EL Reviewers: clayborg Subscribers: tberghammer, bhushan, mohit.bhakkad, sagar Differential Revision: http://reviews.llvm.org/D8166 llvm-svn: 232467
* Add Utility/ModuleCache class and integrate it with PlatformGDBRemoteServer ↵Oleksiy Vyalov2015-03-101-2/+1
| | | | | | | | - in order to allow modules caching from remote targets. http://reviews.llvm.org/D8037 llvm-svn: 231734
* Use the unified section list when generating a symbol tablePavel Labath2015-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Symbol table generation code was failing to take into account the debug symbols because the object file was looking only into its own section list when doing the generation, even though the debug symbols from another object file were correctly detected and loaded by the SymbolVendor. This changes the code to use the unified section list, which fixes this problem. Test Plan: I do not intend do submit this yet since it causes (or more like, exposes) the issue in D7884, but I wanted to put this out here, so that anyone who wants to take a look at it can do so. (And I also wanted to know if this is the right approach to the problem :). Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7913 llvm-svn: 231229
* Correctly resolve symbol names containing linker annotationsPavel Labath2015-03-041-6/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Symbols in ELF files can be versioned, but LLDB currently does not understand these. This problem becomes apparent once one loads glibc with debug info. Here (in the .symtab section) the versions are embedded in the name (name@VERSION), which causes issues when evaluating expressions referencing memcpy for example (current glibc contains memcpy@@GLIBC_2.14 and memcpy@GLIBC_2.2.5). This problem was not evident without debug symbols as the .dynsym section stores the bare names and the actual versions are present in a separate section (.gnu.version_d), which LLDB ignores. This resulted in two definitions of memcpy in the symbol table. This patch adds support for storing annotated names to the Symbol class. If Symbol.m_contains_linker_annotations is true then this symbol is annotated. Unannotated name can be obtained by calling StripLinkerAnnotations on the corresponding ObjectFile. ObjectFileELF implements this to strip @VERSION suffixes when requested. Symtab uses this function to add the bare name as well as the annotated name to the name lookup table. To preserve the size of the Symbol class, I had to steal one bit from the m_type field. Test Plan: This fixes TestExprHelpExamples.py when run with a glibc with debug symbols. Writing an environment agnostic test case would require building a custom shared library with symbol versions and testing symbol resolution against that, which is somewhat challenging. Reviewers: clayborg, jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8036 llvm-svn: 231228
* Avoid crashing by not mmap'ing files on network mounted file systems.Greg Clayton2015-02-231-6/+6
| | | | | | | | | | | | | | | | | | | | 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
* First cut of PowerPC(64) support in LLDB.Justin Hibbits2014-10-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* ELF: store the thumbness of a function in symbol flags.Todd Fiala2014-09-151-2/+53
| | | | | | | | | | | | 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
* 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
* 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
* 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
* 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
OpenPOWER on IntegriCloud