summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
Commit message (Collapse)AuthorAgeFilesLines
* [lldb][ELF] Read symbols from .gnu_debugdata sect.Konrad Kleine2019-10-071-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If the .symtab section is stripped from the binary it might be that there's a .gnu_debugdata section which contains a smaller .symtab in order to provide enough information to create a backtrace with function names or to set and hit a breakpoint on a function name. This change looks for a .gnu_debugdata section in the ELF object file. The .gnu_debugdata section contains a xz-compressed ELF file with a .symtab section inside. Symbols from that compressed .symtab section are merged with the main object file's .dynsym symbols (if any). In addition we always load the .dynsym even if there's a .symtab section. For example, the Fedora and RHEL operating systems strip their binaries but keep a .gnu_debugdata section. While gdb already can read this section, LLDB until this patch couldn't. To test this patch on a Fedora or RHEL operating system, try to set a breakpoint on the "help" symbol in the "zip" binary. Before this patch, only GDB can set this breakpoint; now LLDB also can do so without installing extra debug symbols: lldb /usr/bin/zip -b -o "b help" -o "r" -o "bt" -- -h The above line runs LLDB in batch mode and on the "/usr/bin/zip -h" target: (lldb) target create "/usr/bin/zip" Current executable set to '/usr/bin/zip' (x86_64). (lldb) settings set -- target.run-args "-h" Before the program starts, we set a breakpoint on the "help" symbol: (lldb) b help Breakpoint 1: where = zip`help, address = 0x00000000004093b0 Once the program is run and has hit the breakpoint we ask for a backtrace: (lldb) r Process 10073 stopped * thread #1, name = 'zip', stop reason = breakpoint 1.1 frame #0: 0x00000000004093b0 zip`help zip`help: -> 0x4093b0 <+0>: pushq %r12 0x4093b2 <+2>: movq 0x2af5f(%rip), %rsi ; + 4056 0x4093b9 <+9>: movl $0x1, %edi 0x4093be <+14>: xorl %eax, %eax Process 10073 launched: '/usr/bin/zip' (x86_64) (lldb) bt * thread #1, name = 'zip', stop reason = breakpoint 1.1 * frame #0: 0x00000000004093b0 zip`help frame #1: 0x0000000000403970 zip`main + 3248 frame #2: 0x00007ffff7d8bf33 libc.so.6`__libc_start_main + 243 frame #3: 0x0000000000408cee zip`_start + 46 In order to support the .gnu_debugdata section, one has to have LZMA development headers installed. The CMake section, that controls this part looks for the LZMA headers and enables .gnu_debugdata support by default if they are found; otherwise or if explicitly requested, the minidebuginfo support is disabled. GDB supports the "mini debuginfo" section .gnu_debugdata since v7.6 (2013). Reviewers: espindola, labath, jankratochvil, alexshap Reviewed By: labath Subscribers: rnkovacs, wuzish, shafik, emaste, mgorny, arichardson, hiraditya, MaskRay, lldb-commits Tags: #lldb, #llvm Differential Revision: https://reviews.llvm.org/D66791 llvm-svn: 373891
* ObjectFile[ELF]: Refactor gnu_debuglink interfacePavel Labath2019-08-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The contents of the gnu_debuglink section were passed through the GetDebugSymbolFilePaths interface, which was more generic than needed. As the only class implementing this function is ObjectFileELF, we can modify the function to return just a single FileSpec (instead of a list). Also, since the SymbolVendorELF already assumes ELF object files, we don't have to make this method available on the generic ObjectFile interface -- instead we can put it on ObjectFileELF directly. This change also makes is so that if the Module has an explicit symbol file spec set, we disregard the value the value of the debug link (instead of doing a secondary lookup using that). I think it makes sense to honor the users wishes if he had explicitly set the symbol file spec, and this seems to be consistent with what SymbolVendorMacOSX is doing (SymbolVendorMacOSX.cpp:125). The main reason for making these changes is to make the treatment of build-ids and debug links simpler in the follow-up patch. Reviewers: clayborg, jankratochvil, mgorny, espindola Subscribers: emaste, arichardson, MaskRay, lldb-commits Differential Revision: https://reviews.llvm.org/D65560 llvm-svn: 367824
* Add llvm-style RTTI to ObjectFile hierarchyPavel Labath2019-07-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: On the heels of D62934, this patch uses the same approach to introduce llvm RTTI support to the ObjectFile hierarchy. It also replaces the existing uses of GetPluginName doing run-time type checks with llvm::dyn_cast and friends. This formally introduces new dependencies from some other plugins to ObjectFile plugins. However, I believe this is fine because: - these dependencies were already kind of there, and the only reason we could get away with not modeling them explicitly was because the code was relying on magically knowing what will GetPluginName() return for a particular kind of object files. - the dependencies themselves are logical (it makes sense for SymbolVendorELF to depend on ObjectFileELF), or at least don't actively get in the way (the JitLoaderGDB->MachO thing). - they don't introduce any new dependency loops as ObjectFile plugins don't depend on any other plugins Reviewers: xiaobai, JDevlieghere, espindola Subscribers: emaste, mgorny, arichardson, MaskRay, lldb-commits Differential Revision: https://reviews.llvm.org/D65450 llvm-svn: 367413
* ELF: Fix a "memset clearing object of non-trivial type" warningPavel Labath2019-07-221-3/+1
| | | | | | | | Just delete the memset as the ELFHeader constructor already zero-initializes the object. Also clean up the ObjectFileELF constructors/desctructors while I'm in there. llvm-svn: 366692
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-101-7/+0
| | | | | | | | | | | | | | | | | | | | | | | A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-111-7/+7
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere2019-02-131-3/+3
| | | | | | | | | | | | | | | | | The `ap` suffix is a remnant of lldb's former use of auto pointers, before they got deprecated. Although all their uses were replaced by unique pointers, some variables still carried the suffix. In r353795 I removed another auto_ptr remnant, namely redundant calls to ::get for unique_pointers. Jim justly noted that this is a good opportunity to clean up the variable names as well. I went over all the changes to ensure my find-and-replace didn't have any undesired side-effects. I hope I didn't miss any, but if you end up at this commit doing a git blame on a weirdly named variable, please know that the change was unintentional. llvm-svn: 353912
* Simplify ObjectFile::GetUUIDPavel Labath2019-02-111-1/+1
| | | | | | | | | instead of returning the UUID through by-ref argument and a boolean value indicating success, we can just return it directly. Since the UUID class already has an invalid state, it can be used to denote the failure without the additional bool. llvm-svn: 353714
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Implement ObjectFileELF::GetBaseAddressPavel Labath2019-01-101-0/+2
| | | | | | | | | Summary: The concept of a base address was already present in the implementation (it's needed for computing section load addresses properly), but it was never exposed through this function. This fixes that. llvm-svn: 350804
* Simplify ObjectFile::GetArchitecturePavel Labath2019-01-031-1/+1
| | | | | | | | | | | | | | | | Summary: instead of returning the architecture through by-ref argument and a boolean value indicating success, we can just return the ArchSpec directly. Since the ArchSpec already has an invalid state, it can be used to denote the failure without the additional bool. Reviewers: clayborg, zturner, espindola Subscribers: emaste, arichardson, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D56129 llvm-svn: 350291
* ELF: Don't create sections for section header index 0Pavel Labath2018-12-181-2/+2
| | | | | | | | | | | | | | | | | | | Summary: The first section header does not define a real section. Instead it is used for various elf extensions. This patch skips creation of a section for index 0. This has one furtunate side-effect, in that it allows us to use the section header index as the Section ID (where 0 is also invalid). This way, we can get rid of a lot of spurious +1s in the ObjectFileELF code. Reviewers: clayborg, krytarowski, joerg, espindola Subscribers: emaste, lldb-commits, arichardson Differential Revision: https://reviews.llvm.org/D55757 llvm-svn: 349498
* ELF: more section creation cleanupPavel Labath2018-12-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch attempts to move as much code as possible out of the CreateSections function to make room for future improvements there. Some of this may be slightly over-engineered (VMAddressProvider), but I wanted to keep the logic of this function very simple, because once I start taking segment headers into acount (as discussed in D55356), the function is going to grow significantly. While in there, I also added tests for various bits of functionality. This should be NFC, except that I changed the order of hac^H^Heuristicks for determining section type slightly. Previously, name-based deduction (.symtab -> symtab) would take precedence over type-based (SHT_SYMTAB -> symtab) one. In fact we would assert if we ran into a .text section with type SHT_SYMTAB. Though unlikely to matter in practice, this order seemed wrong to me, so I have inverted it. Reviewers: clayborg, krytarowski, espindola Subscribers: emaste, arichardson, lldb-commits Differential Revision: https://reviews.llvm.org/D55706 llvm-svn: 349268
* ELF: Simplify program header iterationPavel Labath2018-12-121-12/+4
| | | | | | | | | | | | | Instead of GetProgramHeaderCount+GetProgramHeaderByIndex, expose an ArrayRef of all program headers, to enable range-based iteration. Instead of GetSegmentDataByIndex, expose GetSegmentData, taking a program header (reference). This makes the code simpler by enabling range-based loops and also allowed to remove some null checks, as it became locally obvious that some pointers can never be null. llvm-svn: 348928
* Remove header grouping comments.Jonas Devlieghere2018-11-111-2/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Move AddressClass to private enums since API doesn't provide any functions ↵Tatyana Krasnukha2018-06-271-2/+2
| | | | | | | | to manage it. This change allows to make AddressClass strongly typed enum and not to have issues with old versions of SWIG that don't support enum classes. llvm-svn: 335710
* Enable AUTOBRIEF in doxygen configuration.Adrian Prantl2018-05-021-5/+5
| | | | | | | | | | | | | | This brings the LLDB configuration closer to LLVM's and removes visual clutter in the source code by removing the @brief commands from comments. This patch also reflows the paragraphs in all doxygen comments. See also https://reviews.llvm.org/D46290. Differential Revision: https://reviews.llvm.org/D46321 llvm-svn: 331373
* Re-land: [lldb] Use vFlash commands when writing to target's flash memory ↵Pavel Labath2018-03-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | regions The difference between this and the previous patch is that now we use ELF physical addresses only for loading objects into the target (and the rest of the module load address logic still uses virtual addresses). Summary: When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region. A bare metal target may have this kind of setup. - Update ObjectFileELF to set load addresses using physical addresses. A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address. - Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications - Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html Reviewers: clayborg, labath Reviewed By: labath Subscribers: llvm-commits, arichardson, emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D42145 Patch by Owen Shaw <llvm@owenpshaw.net>. llvm-svn: 327970
* Revert "[lldb] Use vFlash commands when writing to target's flash memory ↵Pavel Labath2018-02-281-6/+0
| | | | | | | | | | | | regions" This reverts commit r326261 as it introduces inconsistencies in the handling of load addresses for ObjectFileELF -- some parts of the class use physical addresses, and some use virtual. This has manifested itself as us not being able to set the load address of the vdso "module" on android. llvm-svn: 326367
* [lldb] Use vFlash commands when writing to target's flash memory regionsPavel Labath2018-02-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | Summary: When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region. A bare metal target may have this kind of setup. - Update ObjectFileELF to set load addresses using physical addresses. A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address. - Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications - Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html Reviewers: clayborg, labath Reviewed By: labath Subscribers: arichardson, emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D42145 Patch by Owen Shaw <llvm@owenpshaw.net> llvm-svn: 326261
* ObjectFileELF: Add support for compressed sectionsPavel Labath2017-12-151-0/+7
| | | | | | | | | | | | | | | | Summary: We use the llvm decompressor to decompress SHF_COMPRESSED sections. This enables us to read data from debug info sections, which are sometimes compressed, particuarly in the split-dwarf case. This functionality is only available if llvm is compiled with zlib support. Reviewers: clayborg, zturner Subscribers: emaste, mgorny, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D40616 llvm-svn: 320813
* Move ArchSpec to the Utility modulePavel Labath2017-11-131-3/+1
| | | | | | | | | | | | | The rationale here is that ArchSpec is used throughout the codebase, including in places which should not depend on the rest of the code in the Core module. This commit touches many files, but most of it is just renaming of #include lines. In a couple of cases, I removed the #include ArchSpec line altogether, as the file was not using it. In one or two places, this necessitated adding other #includes like lldb-private-defines.h. llvm-svn: 318048
* Improve FreeBSD kernel debuggingEd Maste2017-10-021-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSD kernel modules are actually relocatable (.o) ELF files and this previously caused some issues for LLDB. This change addresses these when using lldb to symbolicate FreeBSD kernel backtraces. The major problems: - Relocations were not being applied to the DWARF debug info despite there being code to do this. Several issues prevented it from working: - Relocations are computed at the same time as the symbol table, but in the case of split debug files, symbol table parsing always redirects to the primary object file, meaning that relocations would never be applied in the debug file. - There's actually no guarantee that the symbol table has been parsed yet when trying to parse debug information. - When actually applying relocations, it will segfault because the object files are not mapped with MAP_PRIVATE and PROT_WRITE. - LLDB returned invalid results when performing ordinary address-to- symbol resolution. It turned out that the addresses specified in the section headers were all 0, so LLDB believed all the sections had overlapping "file addresses" and would sometimes return a symbol from the wrong section. Patch by Brian Koropoff Differential Revision: https://reviews.llvm.org/D38142 llvm-svn: 314672
* [linux] Change the way we load vdso pseudo-modulePavel Labath2017-06-201-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is basically a revert of D16107 and parts of D10800, which were trying to get vdso loading working. They did this by implementing a generic load-an-elf-file from memory approach, which is not correct, since we cannot assume that an elf file is loaded in memory in full (it usually isn't, as there's no need to load section headers for example). This meant that we would read garbage instead of section sizes, and if that garbage happened to be a large number, we would crash while trying to allocate a buffer to accomodate the hypothetical section. Instead of this, I add a bit of custom code to load the vdso to DynamicLoaderPOSIXDYLD (which already needed to handle the vdso specially). I determine the size of the memory to read using Process::GetMemoryRegionInfo, which is information coming from the OS, and cannot be forged by a malicious/misbehaving application. Reviewers: eugene, clayborg Subscribers: lldb-commits, ravitheja, tberghammer, emaste Differential Revision: https://reviews.llvm.org/D34352 llvm-svn: 305780
* Rename Error -> Status.Zachary Turner2017-05-121-1/+1
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Change UniqueCStringMap to use ConstString as the keyPavel Labath2017-05-021-1/+1
| | | | | | | | | | | | | | | | Summary: UniqueCStringMap "sorts" the entries for fast lookup, but really it only cares about uniqueness. ConstString can be compared by pointer alone, rather than with strcmp, resulting in much faster comparisons. Change the interface to take ConstString instead, and propagate use of the type to the callers where appropriate. Reviewers: #lldb, clayborg Reviewed By: clayborg Subscribers: labath, jasonmolenda, lldb-commits Differential Revision: https://reviews.llvm.org/D32316 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 301908
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-221-2/+2
| | | | llvm-svn: 298536
* Move UUID from Core -> Utility.Zachary Turner2017-03-041-1/+1
| | | | llvm-svn: 296941
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-415/+351
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* ObjectFile: parse EABI AttributesSaleem Abdulrasool2016-04-231-0/+4
| | | | | | | | This adds basic parsing of the EABI attributes section. This section contains additional information about the target for which the file was built. Attempt to infer additional architecture information from that section. llvm-svn: 267291
* Improve the handling of missing elf symtab and missing symbol sizesTamas Berghammer2016-02-181-3/+4
| | | | | | | | | | | | | | | * Generate artificial symbol names from eh_fame during symbol parsing so these symbols are already present when we calcualte the size of the symbols where 0 is specified. * Fix symbol size calculation for the last symbol in the file where it have to last until the end of the parent section. This is the re-commit of the original change after fixing some test failures on OSX. Differential revision: http://reviews.llvm.org/D16996 llvm-svn: 261205
* Revert "Improve the handling of missing elf symtab and missing symbol sizes"Tamas Berghammer2016-02-101-4/+3
| | | | | | | | This reverts commit 252dda67782f2cbf838e375bce21ed4191f6d9ce. The commit caused several test failure on the OSX build bot. llvm-svn: 260377
* Improve the handling of missing elf symtab and missing symbol sizesTamas Berghammer2016-02-101-3/+4
| | | | | | | | | | | | * Generate artificial symbol names from eh_fame during symbol parsing so these symbols are already present when we calcualte the size of the symbols where 0 is specified. * Fix symbol size calculation for the last symbol in the file where it have to last until the end of the parent section. Differential revision: http://reviews.llvm.org/D16996 llvm-svn: 260369
* Fix for Bug 25338Ravitheja Addepally2016-01-191-2/+11
| | | | | | | | | | | | | | | | Summary: The issue arises because LLDB is not able to read the vdso library correctly. The fix adds memory allocation callbacks to allocate sufficient memory in case the requested offsets don't fit in the memory buffer allocated for the ELF. Reviewers: lldb-commits, clayborg, deepak2427, ovyalov, labath, tberghammer Differential Revision: http://reviews.llvm.org/D16107 llvm-svn: 258122
* Update for llvm change. NFC.Rafael Espindola2016-01-181-1/+1
| | | | llvm-svn: 258080
* Make core files not crash when you load a core file into LLDB with just ↵Greg Clayton2015-10-281-0/+6
| | | | | | | | | | | | | | | "lldb -c core". To do this I added a few new ways to determine the OS from PT_NOTE notes in the ELF file: 1 - Look for "LINUX" notes which indicate "linux" should be the OS 2 - Look through the "CORE" notes with NT_FILE as the type and sniff data from the paths listed in this section. On Ubuntu they contain "/lib/x86_64-linux-gnu" which has the triple and allows us to set "linux" as the OS in the architecture returned from ObjectFileELF::GetArchitecture(). Setting the OS correctly allows us to get the triple correct so we can extract registers without asserting and killing LLDB. Also use the data from the NT_FILE to set the main executable if one isn't set in ProcessElfCore::DoLoadCore(). llvm-svn: 251537
* Fix Clang-tidy modernize-use-override warnings in ↵Eugene Zelenko2015-10-231-4/+9
| | | | | | source/Plugins/ObjectContainer and ObjectFile; other minor fixes. llvm-svn: 251119
* Fix [vdso] handling on Android (x86 and aarch64)Tamas Berghammer2015-06-301-1/+1
| | | | | | | | | | | | | | * 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
* Ignore mapping symbols on aarch64Tamas Berghammer2015-04-071-0/+5
| | | | | | | | | | | 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
* Remove "virtual" and add "override" to all functions that are overridden to ↵Greg Clayton2015-03-121-42/+42
| | | | | | quiet warnings. llvm-svn: 231990
* Correctly resolve symbol names containing linker annotationsPavel Labath2015-03-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* ELF: store the thumbness of a function in symbol flags.Todd Fiala2014-09-151-0/+3
| | | | | | | | | | | | 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
* Fix ObjectFileELF to determine architectures independent of host.Todd Fiala2014-06-271-2/+10
| | | | | | | | | | | | | | | | | | 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
* Improve Elf object file UUID calculation performance.Todd Fiala2014-03-251-0/+12
| | | | | | | | | | | This change makes significant improvements in the performance of calculating a UUID within ObjectFileELF, and handles both running processes and core files correctly. This does lazy evaluation of UUID generation and caches the result when calculated. Change by Piotr Rak. llvm-svn: 204749
* Add support for JIT debugging on Linux using the GDB JIT interface. Patch ↵Andrew MacPherson2014-03-051-0/+31
| | | | | | written with Keno Fischer. llvm-svn: 202956
* Modified ObjectFile::SetLoadAddress() to now be:Greg Clayton2014-02-071-1/+3
| | | | | | | | | | | | | | 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
* Factor some methods that were in DynamicLoaderPOSIXDYLD.Steve Pucci2014-02-061-0/+3
| | | | | | | | | | | | | | | Move some code that was in DynamicLoaderPOSIXDLYD into the base class DynamicLoader. In the case of UpdateLoadedSections(), the test to see whether a file is loadable (its address is zero) is not generally applicable so that test is changed to a more universally applicable check for the SHF_ALLOC flag on the section. Also make it explicit that the reading of the module_id in DynamicLoaderPOSIXDYLD::GetThreadLocalData() is using a hardcoded size (of module_id) of 4, which might not be appropriate on big-endian 64-bit systems, leaving a FIXME comment in place. llvm-svn: 200939
* elf: Move elf note parsing to ObjectFileELF.cppEd Maste2013-12-021-0/+28
| | | | | | | | | Separate ELF note implementations were introduced for core files and GNU build-id. Move the more general one from elf-core to ObjectFileELF and use it for build-id as well. Review: http://llvm-reviews.chandlerc.com/D1902 llvm-svn: 196125
* Simplify indirect rld_map for mips (rework r192408).Ed Maste2013-10-111-1/+1
| | | | | | | | | Just pass a Target* into ObjectFileELF::GetImageInfoAddress so that it can do the extra dereference necessary on MIPS, instead of passing a flag back to the caller. Review: http://llvm-reviews.chandlerc.com/D1899 llvm-svn: 192469
* Support mips shared object debug infoEd Maste2013-10-111-1/+1
| | | | | | | | | | MIPS's .dyanamic section is read-only. Instead of using DT_DEBUG for the pointer to dyld information it uses a separate tag DT_MIPS_RLD_MAP which points to storage in the read-write .rld_map section, which in turn points to the dyld information. Review: http://llvm-reviews.chandlerc.com/D1890 llvm-svn: 192408
OpenPOWER on IntegriCloud