aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/ObjectFile/ELF
AgeCommit message (Collapse)AuthorFilesLines
2025-10-30[NFCI][lldb][test] Fix mismatched C/C++ substitutions (#165773)Raul Tambre1-1/+1
Most of the cases were where a C++ file was being compiled with the C substitution. There were a few cases of the opposite though. LLDB seems to be the only real culprit in the LLVM codebase for these mismatches. Rest of the LLVM presumably sticks at least language-specific options in the common substitutions making the mistakes immediately apparent. I found these by using Clang frontend configuration files containing language-specific options for both C and C++ (e.g. `-std=c2y` and `-std=c++26`).
2025-09-26[lldb][test] Fix elf-no-shdrs-pt-notes.yaml on Windows (#160827)David Spickett1-2/+2
Windows paths have different slashes, but I don't think we care about the exact paths there anyway so I've just checked for the final filename. Fixes #160652
2025-09-25Modify ObjectFileELF so it can load notes from PT_NOTE segments. (#160652)Greg Clayton1-0/+706
The ObjectFileELF parser was not able to load ELF notes from PT_NOTE program headers. This patch fixes ObjectFileELF::GetUUID() to check the program header and parse the notes in any PT_NOTE segments. This will allow memory ELF files to extract the UUID from an in memory image that has no section headers. Added a test that creates an ELF file, strips all section headers, and then makes sure that LLDB can see the UUID value.
2025-07-30[lldb] Remove %T from lit tests (#151343)Aiden Grossman1-2/+2
%T has been deprecated for about seven years, mostly because it is not unique to each test which can lead to races. This patch updates the few remaining tests in lldb that use %T to not use it (either directly using files or creating their own temp dir). The eventual goal is to remove support for %T from llvm-lit given few tests use it and it still has racey behavior. This patch errors on the side of creating new temp dirs even when not strictly necessary to avoid needing to update filenames inside filecheck matchers.
2025-05-23[lldb] Change synthetic symbol names to have file address (#138416)Ely Ronnen1-2/+2
* Changes the default synthetic symbol names to contain their file address This is a new PR after the first PR (#137512) was reverted because it didn't update the way unnamed symbols were searched in the symbol table, which relied on the index being in the name. This time also added extra test to make sure the symbol is found as expected
2025-05-01Revert "[lldb] Change synthetic symbol names to have file address (#137512)"Felipe de Azevedo Piovezan1-2/+2
This reverts commit b69957fa642635f769c3aa33a539f74497df0b4d.
2025-05-01[lldb] Change synthetic symbol names to have file address (#137512)Ely Ronnen1-2/+2
Changes the default synthetic symbol names to contain their file address
2024-11-18Fix buildbots with no x86 target.Greg Clayton1-0/+1
Fix for: https://github.com/llvm/llvm-project/pull/116689
2024-11-18Add support for reading the dynamic symbol table from PT_DYNAMIC (#116689)Greg Clayton1-0/+44
Resubmissions of https://github.com/llvm/llvm-project/pull/112596 with buildbot fixes. Allow LLDB to parse the dynamic symbol table from an ELF file or memory image in an ELF file that has no section headers. This patch uses the ability to parse the PT_DYNAMIC segment and find the DT_SYMTAB, DT_SYMENT, DT_HASH or DT_GNU_HASH to find and parse the dynamic symbol table if the section headers are not present. It also adds a helper function to read data from a .dynamic key/value pair entry correctly from the file or from memory.
2024-11-18Revert "Add support for reading the dynamic symbol table from PT_DYNAMIC ↵Shubham Sandeep Rastogi1-42/+0
(#112596)" This reverts commit a7b2e73bcaa91255a20f1f2e692bec9eb6c17022. This patch broke the greendragon bot Failed Tests (10): lldb-api :: python_api/sbplatform/TestLocateModuleCallback.py lldb-unit :: Target/./TargetTests/LocateModuleCallbackTest/GetOrCreateModuleCallbackSuccessWithModuleAndSymbol lldb-unit :: Target/./TargetTests/LocateModuleCallbackTest/GetOrCreateModuleCallbackSuccessWithOnlySymbol lldb-unit :: Target/./TargetTests/LocateModuleCallbackTest/GetOrCreateModuleCallbackSuccessWithSymbolAsModule lldb-unit :: Target/./TargetTests/LocateModuleCallbackTest/GetOrCreateModuleCallbackSuccessWithSymbolAsModuleAndSymbol lldb-unit :: Target/./TargetTests/LocateModuleCallbackTest/GetOrCreateModuleCallbackSuccessWithSymbolByPlatformUUID lldb-unit :: Target/./TargetTests/LocateModuleCallbackTest/GetOrCreateModuleWithCachedModuleAndSymbol lldb-unit :: Target/./TargetTests/ModuleCacheTest/GetAndPut lldb-unit :: Target/./TargetTests/ModuleCacheTest/GetAndPutStrangeHostname lldb-unit :: Target/./TargetTests/ModuleCacheTest/GetAndPutUuidExists
2024-11-18Add support for reading the dynamic symbol table from PT_DYNAMIC (#112596)Greg Clayton1-0/+42
Allow LLDB to parse the dynamic symbol table from an ELF file or memory image in an ELF file that has no section headers. This patch uses the ability to parse the PT_DYNAMIC segment and find the DT_SYMTAB, DT_SYMENT, DT_HASH or DT_GNU_HASH to find and parse the dynamic symbol table if the section headers are not present. It also adds a helper function to read data from a .dynamic key/value pair entry correctly from the file or from memory.
2024-10-10[lldb][test] elf-memory.test requires LLDB build with Python support (#111810)Alex Bradbury1-1/+1
Otherwise it fails with "error: Embedded script interpreter unavailable. LLDB was built without scripting language support."
2024-08-12 [LLDB] Impove ObjectFileELF's .dynamic parsing and usage. (#102570)Greg Clayton3-0/+153
This patch improves the ability of a ObjectFileELF instance to read the .dynamic section. It adds the ability to read the .dynamic section from the PT_DYNAMIC program header which is useful for ELF files that have no section headers and for ELF files that are read from memory. It cleans up the usage of the .dynamic entries so that ObjectFileELF::ParseDynamicSymbols() is the only code that parses .dynamic entries, teaches that function the read and store the string values for each .dynamic entry. We now dump the .dynamic entries in the output of "image dump objfile". It also cleans up the code that gets the dynamic string table so that it can grab it from the DT_STRTAB and DT_STRSZ .dynamic entries for when we have a ELF file with no section headers or we are reading it from memory.
2024-08-08Revert "[LLDB] Impove ObjectFileELF's .dynamic parsing and usage. (#101237)"Leonard Chan3-150/+0
This reverts commit 28ba8a56b6fb9ec61897fa84369f46e43be94c03. Reverting since this broke the buildbot at https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/9352/.
2024-08-08[LLDB] Impove ObjectFileELF's .dynamic parsing and usage. (#101237)Greg Clayton3-0/+150
This patch improves the ability of a ObjectFileELF instance to read the .dynamic section. It adds the ability to read the .dynamic section from the PT_DYNAMIC program header which is useful for ELF files that have no section headers and for ELF files that are read from memory. It cleans up the usage of the .dynamic entries so that ObjectFileELF::ParseDynamicSymbols() is the only code that parses .dynamic entries, teaches that function the read and store the string values for each .dynamic entry. We now dump the .dynamic entries in the output of "image dump objfile". It also cleans up the code that gets the dynamic string table so that it can grab it from the DT_STRTAB and DT_STRSZ .dynamic entries for when we have a ELF file with no section headers or we are reading it from memory.
2024-07-11[lldb] Fix a bug for PT_TLS segments getting loaded when they shouldn't. ↵Greg Clayton1-2/+27
(#98432) PT_LOAD and PT_TLS segments are top level sections in the ObjectFileELF section list. The two segments can often have the same program header p_vaddr and p_paddr values and this can cause section load list issues in LLDB if we load the PT_TLS segments. What happens is the SectionLoadList::m_addr_to_sect, when a library is loaded, will first map one of the sections named "PT_LOAD[0]" with the load address that matches the p_vaddr entry from the program header. Then the "PT_TLS[0]" would come along and try to load this section at the same address. This would cause the "PT_LOAD[0]" section to be unloaded as the SectionLoadList::m_addr_to_sect would replace the value for the matching p_vaddr with the last section to be seen. The sizes of the PT_TLS and PT_LOAD that have the same p_vaddr value don't need to have the same byte size, so this could cause lookups to fail for an addresses in the "PT_LOAD[0]" section or any of its children if the offset is greater than the offset size of the PT_TLS segment. It could also cause us to incorrectly attribute addresses from the "PT_LOAD[0]" to the "PT_TLS[0]" segment when doing lookups for offset that are less than the size of the PT_TLS segment. This fix stops us from loading PT_TLS segments in the section load lists and will prevent the bugs that resulted from this. No addresses the the DWARF refer to TLS data with a "file address" in any way. They all have TLS DWARF location expressions to locate these variables. We also don't have any support for having actual thread specific sections and having those sections resolve to something different for each thread, so there currently is no point in loading thread specific sections. Both the ObjectFileMachO and ObjectFileCOFF both ignore thread specific sections at the moment, so this brings the ObjectFileELF to parity with those plug-ins. I added a test into an existing test to verify that things work as expected. Prior to this fix with a real binary, the output of "target dump section-load-list" would look like this for the old LLDB: ``` // (lldb) target dump section-load-list // addr = 0x0000000000000000, section = 0x55d46ab8c510: 0xfffffffffffffffd container [0x0000000000000000-0x0000000000000628) r-- 0x00000000 0x00000628 0x00000000 a.out.PT_LOAD[0] // addr = 0x0000000000001000, section = 0x55d46ab8b0c0: 0xfffffffffffffffc container [0x0000000000001000-0x0000000000001185) r-x 0x00001000 0x00000185 0x00000000 a.out.PT_LOAD[1] // addr = 0x0000000000002000, section = 0x55d46ac040f0: 0xfffffffffffffffb container [0x0000000000002000-0x00000000000020cc) r-- 0x00002000 0x000000cc 0x00000000 a.out.PT_LOAD[2] // addr = 0x0000000000003db0, section = 0x55d46ab7cef0: 0xfffffffffffffff6 container [0x0000000000003db0-0x0000000000003db4) r-- 0x00002db0 0x00000000 0x00000000 a.out.PT_TLS[0] ``` And this for the fixed LLDB: ``` // (lldb) target dump section-load-list // addr = 0x0000000000000000, section = 0x105f0a9a8: 0xfffffffffffffffd container [0x0000000000000000-0x0000000000000628) r-- 0x00000000 0x00000628 0x00000000 a.out.PT_LOAD[0] // addr = 0x0000000000001000, section = 0x105f0adb8: 0xfffffffffffffffc container [0x0000000000001000-0x0000000000001185) r-x 0x00001000 0x00000185 0x00000000 a.out.PT_LOAD[1] // addr = 0x0000000000002000, section = 0x105f0af48: 0xfffffffffffffffb container [0x0000000000002000-0x00000000000020cc) r-- 0x00002000 0x000000cc 0x00000000 a.out.PT_LOAD[2] // addr = 0x0000000000003db0, section = 0x105f0b078: 0xfffffffffffffffa container [0x0000000000003db0-0x0000000000004028) rw- 0x00002db0 0x00000274 0x00000000 a.out.PT_LOAD[3] ``` We can see that previously the "PT_LOAD[3]" segment would be removed from the section load list, and after the fix it remains and there is on PT_TLS in the loaded sections.
2024-05-01[LLDB][ELF] Fix section unification to not just use names. (#90099)Alastair Houghton1-0/+48
Section unification cannot just use names, because it's valid for ELF binaries to have multiple sections with the same name. We should check other section properties too. Fixes #88001. rdar://124467787
2023-04-29[lldb][ObjectFileELF] Support AArch32 in ApplyRelocationsStefan Gränitz1-0/+62
Allow the ObjectFileELF plugin to resolve R_ARM_ABS32 relocations from AArch32 object files. This fixes https://github.com/llvm/llvm-project/issues/61948 The existing architectures work with RELA-type relocation records that read addend from the relocation entry. REL-type relocations in AArch32 store addend in-place. The new function doesn't re-use ELFRelocation::RelocAddend32(), because the interface doesn't match: in addition to the relocation entry we need the actual target section memory. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D147642
2023-03-13[LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64Weining Lu1-4/+8
According to `/usr/include/elf.h` and `lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h`. For ELF64 relocation, types of `offset` and `addend` should be `elf_addr` and `elf_sxword`. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D145550
2023-03-13[LLDB][ObjectFileELF] Support LoongArch64 in ApplyReloctionsWeining Lu1-0/+45
Currently ApplyReloctions() deals with different archs' relocation types together (in a single `switch() {..}`). I think it is incorrect because different relocation types of different archs may have same enum values. For example: `R_LARCH_32` and `R_X86_64_64` are both `1`; `R_LARCH_64` and `R_X86_64_PC32` are both `2`. This patch handles each arch in seperate `switch()` to solve the enum values conflict issue. And a new test is added for LoongArch64. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D145462
2022-11-01[LLDB][LoongArch] Add LoongArch ArchSpec and subtype detectionTiezhu Yang1-0/+24
Define LoongArch architecture subtypes, add the LoongArch ArchSpec bits, and inspect the ELF header to detect the right subtype based on ELF class. Here is a simple test: ``` [loongson@linux ~]$ cat hello.c int main() { printf("Hello, World!\n"); return 0; } [loongson@linux ~]$ clang hello.c -g -o hello ``` Without this patch: ``` [loongson@linux ~]$ llvm-project/llvm/build/bin/lldb hello (lldb) target create "hello" error: '/home/loongson/hello' doesn't contain any 'host' platform architectures: unknown ``` With this patch: ``` [loongson@linux ~]$ llvm-project/llvm/build/bin/lldb hello (lldb) target create "hello" Current executable set to '/home/loongson/hello' (loongarch64). (lldb) run Process 735167 launched: '/home/loongson/hello' (loongarch64) Hello, World! Process 735167 exited with status = 0 (0x00000000) (lldb) quit [loongson@linux ~]$ llvm-project/llvm/build/bin/llvm-lit llvm-project/lldb/test/Shell/ObjectFile/ELF/loongarch-arch.yaml llvm-lit: /home/loongson/llvm-project/llvm/utils/lit/lit/llvm/config.py:456: note: using clang: /home/loongson/llvm-project/llvm/build/bin/clang -- Testing: 1 tests, 1 workers -- PASS: lldb-shell :: ObjectFile/ELF/loongarch-arch.yaml (1 of 1) Testing Time: 0.09s Passed: 1 ``` Reviewed By: SixWeining, xen0n, DavidSpickett Differential Revision: https://reviews.llvm.org/D137057
2022-09-13lldb: Add support for R_386_32 relocations to ObjectFileELFDavid M. Lary1-0/+57
I encountered an issue where `p &variable` was finding an incorrect address for 32-bit PIC ELF files loaded into a running process. The problem was that the R_386_32 ELF relocations were not being applied to the DWARF section, so all variables in that file were reporting as being at the start of their respective section. There is an assert that catches this on debug builds, but silently ignores the issue on non-debug builds. In this changeset, I added handling for the R_386_32 relocation type to ObjectFileELF, and a supporting function to ELFRelocation to differentiate between DT_REL & DT_RELA in ObjectFileELF::ApplyRelocations(). Demonstration of issue: ``` [dmlary@host work]$ cat rel.c volatile char padding[32] = "make sure var isnt at .data+0"; volatile char var[] = "test"; [dmlary@host work]$ gcc -c rel.c -FPIC -fpic -g -m32 [dmlary@host work]$ lldb ./exec (lldb) target create "./exec" Current executable set to '/home/dmlary/src/work/exec' (i386). (lldb) process launch --stop-at-entry Process 21278 stopped * thread #1, name = 'exec', stop reason = signal SIGSTOP frame #0: 0xf7fdb150 ld-2.17.so`_start ld-2.17.so`_start: -> 0xf7fdb150 <+0>: movl %esp, %eax 0xf7fdb152 <+2>: calll 0xf7fdb990 ; _dl_start ld-2.17.so`_dl_start_user: 0xf7fdb157 <+0>: movl %eax, %edi 0xf7fdb159 <+2>: calll 0xf7fdb140 Process 21278 launched: '/home/dmlary/src/work/exec' (i386) (lldb) image add ./rel.o (lldb) image load --file rel.o .text 0x40000000 .data 0x50000000 section '.text' loaded at 0x40000000 section '.data' loaded at 0x50000000 (lldb) image dump symtab rel.o Symtab, file = rel.o, num_symbols = 13: Debug symbol |Synthetic symbol ||Externally Visible ||| Index UserID DSX Type File Address/Value Load Address Size Flags Name ------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ---------------------------------- [ 0] 1 SourceFile 0x0000000000000000 0x0000000000000000 0x00000004 rel.c [ 1] 2 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 2] 3 Invalid 0x0000000000000000 0x50000000 0x0000000000000020 0x00000003 [ 3] 4 Invalid 0x0000000000000025 0x0000000000000000 0x00000003 [ 4] 5 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 5] 6 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 6] 7 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 7] 8 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 8] 9 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 9] 10 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 10] 11 Invalid 0x0000000000000000 0x0000000000000020 0x00000003 [ 11] 12 X Data 0x0000000000000000 0x50000000 0x0000000000000020 0x00000011 padding [ 12] 13 X Data 0x0000000000000020 0x50000020 0x0000000000000005 0x00000011 var (lldb) p &var (volatile char (*)[5]) $1 = 0x50000000 ``` Reviewed By: labath Differential Revision: https://reviews.llvm.org/D132954
2022-07-14[lldb] Remove ELF .zdebug supportFangrui Song1-2/+3
clang 14 removed -gz=zlib-gnu support and ld.lld/llvm-objcopy removed zlib-gnu support recently. Remove lldb support by migrating away from llvm::object::Decompressor::isCompressedELFSection. The API has another user llvm-dwp, so it is not removed in this patch. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D129724
2022-04-08Reland "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON""Fangrui Song1-1/+0
(With C++ exceptions, `clang++ --target=mips64{,el}-linux-gnu -fpie -pie -fuse-ld=lld` has link errors (lld does not implement some strange R_MIPS_64 .eh_frame handling in GNU ld). However, sanitizer-x86_64-linux-qemu used this to build ScudoUnitTests. Pined ScudoUnitTests to -no-pie.) Default the option introduced in D113372 to ON to match all(?) major Linux distros. This matches GCC and improves consistency with Android and linux-musl which always default to PIE. Note: CLANG_DEFAULT_PIE_ON_LINUX may be removed in the future. Differential Revision: https://reviews.llvm.org/D120305
2022-04-07Revert "Reland "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON"""Nico Weber1-0/+1
This reverts commit 2aca33baf15926afe2520a06b1427a9894226fd2. Broke tests on several bots, see comments on https://reviews.llvm.org/D120305
2022-04-06Reland "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON""Fangrui Song1-1/+0
(The upgrade of the ppc64le bot and D121257 have fixed compiler-rt failures. Tested by nemanjai.) Default the option introduced in D113372 to ON to match all(?) major Linux distros. This matches GCC and improves consistency with Android and linux-musl which always default to PIE. Note: CLANG_DEFAULT_PIE_ON_LINUX may be removed in the future. Differential Revision: https://reviews.llvm.org/D120305
2022-02-26Revert "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON"Nikita Popov1-0/+1
See post-commit discussion on https://reviews.llvm.org/D120305. This change breaks the clang-ppc64le-rhel buildbot, though there is suspicion that it's an issue with the bot. The change also had a larger than expected impact on compile-time and code-size. This reverts commit 3c4ed02698afec021c6bca80740d1e58e3ee019e and some followup changes.
2022-02-25[LLDB] Remove XFAIL from minidebuginfo-set-and-hit-breakpoint.testMuhammad Omair Javaid1-1/+0
This patch removes XFAIL from minidebuginfo-set-and-hit-breakpoint.test. Test started passing after 3c4ed02698afec021c6bca80740d1e58e3ee019e. Differential Revision: https://reviews.llvm.org/D120305
2021-12-03[LLDB] XFAIL on Arm/Linux minidebuginfo-set-and-hit-breakpoint.testMuhammad Omair Javaid1-0/+1
minidebuginfo-set-and-hit-breakpoint.test is failing on Arm/Linux most probably due to an ill formed binary after removal of certain sections from executable. I am marking it as XFAIL for further investigation.
2021-12-02Include extra input contents on this test so we can see why lldb-arm-ubuntu ↵Greg Clayton1-1/+1
buildbot is failing. Only lldb-arm-ubuntu is failing after https://reviews.llvm.org/D114288 and there isn't enough input context to see why this is failing. It works on x86_64 linux just fine.
2021-10-26[LLDB] Fix LLDB buildbots break due to --image-baseMuhammad Omair Javaid1-1/+1
LLDB build were failing due to following two test failures: lldb-shell :: ObjectFile/ELF/basic-info.yaml lldb-shell :: SymbolFile/DWARF/x86/debug-types-address-ranges.s There were caused by commit 6506907a0a1a8a789ad7036ef911f7e31213c9a5
2021-07-27Create synthetic symbol names on demand to improve memory consumption and ↵Greg Clayton1-2/+2
startup times. This is a resubmission of https://reviews.llvm.org/D105160 after fixing testing issues. This fix was created after profiling the target creation of a large C/C++/ObjC application that contained almost 4,000,000 redacted symbol names. The symbol table parsing code was creating names for each of these synthetic symbols and adding them to the name indexes. The code was also adding the object file basename to the end of the symbol name which doesn't allow symbols from different shared libraries to share the names in the constant string pool. Prior to this fix this was creating 180MB of "___lldb_unnamed_symbol" symbol names and was taking a long time to generate each name, add them to the string pool and then add each of these names to the name index. This patch fixes the issue by: not adding a name to synthetic symbols at creation time, and allows name to be dynamically generated when accessed doesn't add synthetic symbol names to the name indexes, but catches this special case as name lookup time. Users won't typically set breakpoints or lookup these synthetic names, but support was added to do the lookup in case it does happen removes the object file baseanme from the generated names to allow the names to be shared in the constant string pool Prior to this fix the startup times for a large application was: 12.5 seconds (cold file caches) 8.5 seconds (warm file caches) After this fix: 9.7 seconds (cold file caches) 5.7 seconds (warm file caches) The names of the symbols are auto generated by appending the symbol's UserID to the end of the "___lldb_unnamed_symbol" string and is only done when the name is requested from a synthetic symbol if it has no name. Differential Revision: https://reviews.llvm.org/D106837
2021-07-02Revert "Create synthetic symbol names on demand to improve memory ↵Jonas Devlieghere1-2/+2
consumption and startup times." This reverts commit c8164d0276b97679e80db01adc860271ab4a5d11 and 43f6dad2344247976d5777f56a1fc29e39c6c717 because it breaks TestDyldTrieSymbols.py on GreenDragon.
2021-06-29Create synthetic symbol names on demand to improve memory consumption and ↵Greg Clayton1-2/+2
startup times. This fix was created after profiling the target creation of a large C/C++/ObjC application that contained almost 4,000,000 redacted symbol names. The symbol table parsing code was creating names for each of these synthetic symbols and adding them to the name indexes. The code was also adding the object file basename to the end of the symbol name which doesn't allow symbols from different shared libraries to share the names in the constant string pool. Prior to this fix this was creating 180MB of "___lldb_unnamed_symbol" symbol names and was taking a long time to generate each name, add them to the string pool and then add each of these names to the name index. This patch fixes the issue by: - not adding a name to synthetic symbols at creation time, and allows name to be dynamically generated when accessed - doesn't add synthetic symbol names to the name indexes, but catches this special case as name lookup time. Users won't typically set breakpoints or lookup these synthetic names, but support was added to do the lookup in case it does happen - removes the object file baseanme from the generated names to allow the names to be shared in the constant string pool Prior to this fix the startup times for a large application was: 12.5 seconds (cold file caches) 8.5 seconds (warm file caches) After this fix: 9.7 seconds (cold file caches) 5.7 seconds (warm file caches) The names of the symbols are auto generated by appending the symbol's UserID to the end of the "___lldb_unnamed_symbol" string and is only done when the name is requested from a synthetic symbol if it has no name. Differential Revision: https://reviews.llvm.org/D105160
2021-06-29Revert D104488 and friends since it broke the windows botStella Stamenova1-2/+2
Reverts commits: "Fix failing tests after https://reviews.llvm.org/D104488." "Fix buildbot failure after https://reviews.llvm.org/D104488." "Create synthetic symbol names on demand to improve memory consumption and startup times." This series of commits broke the windows lldb bot and then failed to fix all of the failing tests.
2021-06-28Fix failing tests after https://reviews.llvm.org/D104488.Greg Clayton1-2/+2
Synthetic names no longer have the shared library name appended to the end.
2021-04-21[lldb/ELF] Fix IDs of synthetic eh_frame symbolsPavel Labath1-0/+32
The code used the total number of symbols to create a symbol ID for the synthetic symbols. This is not correct because the IDs of real symbols can be higher than their total number, as we do not add all symbols (and in particular, we never add symbol zero, which is not a real symbol). This meant we could have symbols with duplicate IDs, which caused problems if some relocations were referring to the duplicated IDs. This was the cause of the failure of the test D97786. This patch fixes the code to use the ID of the highest (last) symbol instead.
2021-02-11ObjectFileELF: Test whether reloc_header is non-null instead of asserting.Peter Collingbourne1-0/+148
It is possible for the GetSectionHeaderByIndex lookup to fail because the previous FindSectionContainingFileAddress lookup found a segment instead of a section. This is possible if the binary does not have a PLT (which means that lld will in some circumstances set DT_JMPREL to 0, which is typically an address that is part of the ELF headers and not in a section) and may also be possible if the section headers have been stripped. To handle this possibility, replace the assert with an if. Differential Revision: https://reviews.llvm.org/D93438
2021-01-26[LLDB][test] - Fix test after yaml2obj change.Georgii Rymar1-0/+1
D95354 started to set the sh_link field for SHT_SYMTAB sections. Previously it was set for symbol tables basing on their names (e.g. ".symtab"). This test now crashes see: http://lab.llvm.org:8011/#/builders/68/builds/5911 I updated it to restore the old behavior.
2021-01-07[LLDB][RISCV] Add RISC-V ArchSpec and rv32/rv64 variant detectionLuís Marques1-0/+24
Adds the RISC-V ArchSpec bits contributed by @simoncook as part of D62732, plus logic to distinguish between riscv32 and riscv64 based on ELF class. The patch follows the implementation approach previously used for MIPS. It defines RISC-V architecture subtypes and inspects the ELF header, namely the ELF class, to detect the right subtype. Differential Revision: https://reviews.llvm.org/D86292
2020-11-09[lldb][test] - Update test cases after yaml2obj change.Georgii Rymar8-29/+24
The format of program header descriptions was changed by D90458.
2020-08-20[test] Replace `yaml2obj >` with `yaml2obj -o` and remove unneeded input ↵Fangrui Song24-24/+24
redirection
2020-05-13[LLDB] Fix minidebuginfo-set-and-hit-breakpoint.test for arm 32-bitMuhammad Omair Javaid1-1/+1
This patch fixes minidebuginfo-set-and-hit-breakpoint.test for arm-linux targets. 32-bit elf executables use .rel.dyn and 64-bit uses .rela.dyn for relocation entries for dynamic symbols.
2020-02-20[lldb] Add boilerplate to recognize the .debug_tu_index sectionPavel Labath1-0/+14
It's just like debug_cu_index, only for type units.
2020-01-30[AVR] Recognize the AVR architecture in lldbAyke van Laethem1-0/+30
This commit adds AVR support to lldb. With this change, it can load a binary and do basic things like dump a line table. Not much else has been implemented, that should be done in later changes. Differential Revision: https://reviews.llvm.org/D73539
2020-01-24[lldb/Test] Update minidebuginfo-set-and-hit-breakpoint.testJonas Devlieghere1-4/+6
Update test to account for the new 'hardware' field between 'resolved' and 'hit count'.
2020-01-22[lldb] s/lldb/%lldb in two testsPavel Labath2-2/+2
%lldb is the proper substitution. Using "lldb" can cause us to execute the system lldb instead of the one we are testing. This happens at least in standalone builds.
2020-01-14[lldb/DWARF] Move location list sections into DWARFContextPavel Labath1-0/+28
These are the last sections not managed by the DWARFContext object. I also introduce separate SectionType enums for dwo section variants, as this is necessary for proper handling of single-file split dwarf.
2019-11-26[lldb/symbolvendorelf] Copy more sections from separate debug filesPavel Labath1-2/+72
Include the fancier DWARF5 sections too.
2019-11-26[lldb] Add boilerplate to recognize the .debug_rnglists.dwo sectionPavel Labath1-0/+14