summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
Commit message (Collapse)AuthorAgeFilesLines
...
* [lldb] NFC modernize codebase with modernize-use-nullptrKonrad Kleine2019-05-23129-973/+992
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]] This commit is the result of modernizing the LLDB codebase by using `nullptr` instread of `0` or `NULL`. See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html for more information. This is the command I ran and I to fix and format the code base: ``` run-clang-tidy.py \ -header-filter='.*' \ -checks='-*,modernize-use-nullptr' \ -fix ~/dev/llvm-project/lldb/.* \ -format \ -style LLVM \ -p ~/llvm-builds/debug-ninja-gcc ``` NOTE: There were also changes to `llvm/utils/unittest` but I did not include them because I felt that maybe this library shall be updated in isolation somehow. NOTE: I know this is a rather large commit but it is a nobrainer in most parts. Reviewers: martong, espindola, shafik, #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits Tags: #lldb, #llvm Differential Revision: https://reviews.llvm.org/D61847 llvm-svn: 361484
* DWARFASTParserClang: Reduce indentationPavel Labath2019-05-231-1507/+1495
| | | | | | by two levels via early returns. llvm-svn: 361471
* DWARF: Don't compute address ranges for type unitsPavel Labath2019-05-237-116/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Type units don't describe any code, so they should never be the result of any address lookup queries. Previously, we would compute the address ranges for the type units for via the line tables they reference because the type units looked a lot like line-tables-only compile units. However, this is not correct, as the line tables are only referenced from type units so that other declarations can use the file names contained in them. In this patch I make the BuildAddressRangeTable function virtual, and implement it only for compile units. Testing this was a bit tricky, because the behavior depends on the order in which we add things to the address range map. This rarely caused a problem with DWARF v4 type units, as they are always added after all CUs. It happened more frequently with DWARF v5, as there clang emits the type units first. However, this is still not something that it is required to do, so for testing I've created an assembly file where I've deliberately sandwiched a compile unit between two type units, which should isolate us from both changes in how the compiler emits the units and changes in the order we process them. Reviewers: clayborg, aprantl, JDevlieghere Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62178 llvm-svn: 361465
* Simplify `GetName`+`AppendTypeName` by `DWARFDIE`Jan Kratochvil2019-05-234-168/+131
| | | | | | | | | | | | | | | In D61502#1503247 @clayborg suggested that DWARFUnit *+dw_offset_t can be now replaced by DWARFDIE. It is moved from DWARFDebugInfoEntry to DWARFDIE as noted by @clayborg. I have also removed return type as (1) it was wrong in one case and (2) no existing caller used the return type. I also refactored the deep nesting noted by @JDevlieghere. Differential Revision: https://reviews.llvm.org/D62211 llvm-svn: 361463
* [ARM64][AArch64] Update disassembler attributes to ARMv8.5 ISA with SVE ↵Omair Javaid2019-05-231-3/+3
| | | | | | | | | | extensions This patch updates assembler attributes for AArch64 targets so we can disassemble newer instructions supported in ISA version 8.5 and SVE extensions. Differential Revision: https://reviews.llvm.org/D62235 llvm-svn: 361451
* DWARFDebugInfoEntry: remove unused variablePavel Labath2019-05-221-4/+1
| | | | llvm-svn: 361361
* DWARF: Introduce DWARFTypeUnit classPavel Labath2019-05-2210-47/+111
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces the DWARFTypeUnit class, and teaches lldb to parse type units out of both the debug_types section (DWARF v4), and from the regular debug_info section (DWARF v5). The most important piece of functionality - resolving DW_AT_signatures to connect type forward declarations to their definitions - is not implemented here, but even without that, a lot of functionality becomes available. I've added tests for the commands that start to work after this patch. The changes in this patch were greatly inspired by D61505, which in turn took over changes from D32167. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: mgorny, jankratochvil, lldb-commits Differential Revision: https://reviews.llvm.org/D62008 llvm-svn: 361360
* Delete unnecessary copy ctorsFangrui Song2019-05-222-31/+0
| | | | llvm-svn: 361358
* Fix LLDB warnings when compiling with Clang 8.0Alexandre Ganea2019-05-213-18/+56
| | | | | | Differential Revision: https://reviews.llvm.org/D62021 llvm-svn: 361295
* Remove `SymbolFileDWARF *` when there is already `DWARFUnit *`Jan Kratochvil2019-05-218-249/+186
| | | | | | | | | | | | | | In D61502#1503247 @clayborg suggested that SymbolFileDWARF *dwarf2Data is really redundant in all the calls with also having DWARFUnit *cu. So remove it. One `SymbolFileDWARF *` nullptr check (DWARFDebugInfoEntry::GetDIENamesAndRanges) could be removed, other two nullptr checks (DWARFDebugInfoEntry::GetName and DWARFDebugInfoEntry::AppendTypeName) need to stay in place (now for `DWARFUnit *`). Differential Revision: https://reviews.llvm.org/D62011 llvm-svn: 361277
* DWARF: Port debug_addr over to DWARFContextPavel Labath2019-05-218-24/+13
| | | | llvm-svn: 361232
* DWARF: Introduce DWARFUnitHeader classPavel Labath2019-05-215-147/+168
| | | | | | | | | | | | | | | | | | | Summary: This patch introduces the DWARFUnitHeader class. Its purpose (and its structure, to the extent it was possible to make it) is the same as its LLVM counterpart -- to extract the unit header information before we actually construct the unit, so that we know which kind of units to construct. This is needed because as of DWARF5, type units live in the .debug_info section, which means it's not possible to statically determine the type of units in a given section. Reviewers: aprantl, clayborg, JDevlieghere Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D62073 llvm-svn: 361224
* DWARF: Port most of other sections over to DWARFContextPavel Labath2019-05-209-126/+80
| | | | | | | | This moves the sections from SymbolFileDWARF to DWARFContext, where it was trivial to do so. A couple of sections are still left in SymbolFileDWARF. These will be handled by separate patches. llvm-svn: 361127
* minidump: Remove checked-in files used for testing MemoryList handlingPavel Labath2019-05-201-0/+4
| | | | | | | Now that yaml2obj supports this stream, we can use the yaml form instead. llvm-svn: 361126
* minidump: Use MemoryList parsing code from llvmPavel Labath2019-05-173-42/+23
| | | | llvm-svn: 361010
* Make DWARFContext dwo-aware and port debug_info sections overPavel Labath2019-05-179-34/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The previous attempt and moving section handling over to DWARFContext (D59611) failed because it did not take into account the dwo sections correctly. All DWARFContexts (even those in SymbolFileDWARFDwo) used the main module for loading the sections, but in the dwo scenario some sections should come from the dwo file. This patch fixes that by making the DWARFContext aware of whether it a dwo context or a regular one. A dwo context gets two sections lists, and it knows where to look for a particular type of a section. This isn't fully consistent with how the llvm DWARFContext behaves, because that one leaves it up to the user to know whether it should ask for a dwo section or not. However, for the time being, it seems useful to have a single entity which knows how to peice together the debug info in dwo and non-dwo scenarios. The rough roadmap for the future is: - port over the rest of the sections to DWARFContext - find a way to get rid of SymbolFileDWARFDwo/Dwp/DwpDwo. This will likely involve adding the ability for the DWARFContext to spawn dwo sub-contexts, similarly to how it's done in llvm. - get rid of the special handling of the "dwo" contexts by making sure everything knows whether it should ask for the .dwo version of the section or not (similarly to how llvm's DWARFUnits do that) To demonstrate how the DWARFContext should behave in this new world, I port the debug_info section (which is debug_info.dwo in the dwo file) handling to DWARFContext. The rest of the sections will come in subsequent patches. Reviewers: aprantl, clayborg, JDevlieghere Subscribers: zturner, lldb-commits Differential Revision: https://reviews.llvm.org/D62012 llvm-svn: 361000
* DWARFContext: Return empty data extractors instead of null pointersPavel Labath2019-05-164-27/+23
| | | | | | | | | | | | | | | | | | | | | | | Summary: There are several reasons for doing this: - generally, there's no reason to differentiate between a section being absent and it being present, but empty - it matches more closely what llvm DWARF parser is doing (which also doesn't differentiate the two cases) - SymbolFileDWARF also doesn't differentiate the two cases, which makes porting the rest of sections easier - it fixes a bug in how the return-null-if-empty logic was implemented (it returned nullptr only the second time we tried to get the debug_aranges section), which meant that we hit an assert when trying to parse an empty-but-present section Reviewers: JDevlieghere, clayborg, aprantl Subscribers: zturner, lldb-commits Differential Revision: https://reviews.llvm.org/D61942 llvm-svn: 360874
* DWARF: Add ability to reference debug info coming from multiple sectionsPavel Labath2019-05-1616-55/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the ability to precisely address debug info in situations when a single file can have more than one debug-info-bearing sections (as is the case with type units in DWARF v4). The changes here can be classified into roughly three categories: - the code which addresses a debug info by offset gets an additional argument, which specifies the section one should look into. - the DIERef class also gets an additional member variable specifying the section. This way, code dealing with DIERefs can know which section is the object referring to. - the user_id_t encoding steals one bit from the dwarf_id field to store the section. This means the total number of separate object files (apple .o, or normal .dwo) is limited to 2 billion, but that is fine as it's not possible to hit that number without switching to DWARF64 anyway. This patch is functionally equivalent to (and inspired by) the two patches (D61503 and D61504) by Jan Kratochvil, but there are differences in the implementation: - it uses an enum instead of a bool flag to differentiate the sections - it increases the size of DIERef struct instead of reducing the amount of addressable debug info - it sets up DWARFDebugInfo to store the units in a single vector instead of two. This sets us up for the future in which type units can also live in the debug_info section, and I believe it's cleaner because there's no need for unit index remapping There are no tests with this patch as this is essentially NFC until we start parsing type units from the debug_types section. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: arphaman, jankratochvil, lldb-commits Differential Revision: https://reviews.llvm.org/D61908 llvm-svn: 360872
* Simplify Triple::ppc64{,le} checks with Triple::isPPC64()Fangrui Song2019-05-165-25/+14
| | | | | | | | | | While here, update some ppc64le specific check to isPPC64(), if it applies to big-endian as well, in the hope that it will ease the support of big-endian if people are interested in this area. The big-endian variant is used by at least FreeBSD, Gentoo Linux, Adélie Linux, and Void Linux. llvm-svn: 360868
* Simplify ArchSpec::IsMIPS()Fangrui Song2019-05-169-58/+13
| | | | llvm-svn: 360865
* Permit cross-CU referencesJan Kratochvil2019-05-1513-131/+110
| | | | | | | | | | | | | | So far dw_offset_t was global for the whole SymbolFileDWARF but with .debug_types the same dw_offset_t may mean two different things depending on its section (=CU). So references now return whole new referenced DWARFDIE instead of just dw_offset_t. This means that some functions have to now handle 16 bytes instead of 8 bytes but I do not see that anywhere performance critical. Differential Revision: https://reviews.llvm.org/D61502 llvm-svn: 360795
* [ASTImporter] Use llvm::Expected and Error in the importer APIGabor Marton2019-05-152-4/+26
| | | | | | | | | | | | | | | | | | | | | | Summary: This is the final phase of the refactoring towards using llvm::Expected and llvm::Error in the ASTImporter API. This involves the following: - remove old Import functions which returned with a pointer, - use the Import_New functions (which return with Err or Expected) everywhere and handle their return value - rename Import_New functions to Import This affects both Clang and LLDB. Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits Tags: #clang, #lldb Differential Revision: https://reviews.llvm.org/D61438 llvm-svn: 360760
* DWARF: s/CompileUnit/Unit/ in DWARFFormValuePavel Labath2019-05-155-59/+51
| | | | | | | | The class has been converted to use DWARFUnit, but a number of uses of the words compile unit remained. This removes all such references Get/SetCompileUnit becomes Get/SetUnit, and m_cu becomes m_unit. llvm-svn: 360754
* Replace assert with static_assert here applicable.Jonas Devlieghere2019-05-152-7/+7
| | | | | | | Replaces assert() with static_assert() if the condition is can be evaluated at compile time. llvm-svn: 360753
* [Target] Generalize some behavior in ThreadAlex Langford2019-05-151-0/+4
| | | | | | | | | | Summary: I don't think there's a good reason for this behavior to be considered ObjC-specific. We can generalize this. Differential Revision: https://reviews.llvm.org/D61776 llvm-svn: 360741
* DWARF/NFC: Centralize DIERef conversionsPavel Labath2019-05-143-40/+24
| | | | | | | | | | | | | apple and manual indexing code were creating a DIERef in a bunch of places. Though the code itself is not much, it is also easy to simplify by factoring out the DIERef creation. In HashedNameToDIE I create a conversion operator from DIEInfo to DIERef, and in ManualDWARFIndex I just create the DIERef in a global variable up-front. This also reduces the diff in follow-up patches which change how DIERefs are constructed. llvm-svn: 360669
* typedef enum -> enumFangrui Song2019-05-149-55/+40
| | | | | | | | Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61883 llvm-svn: 360654
* ARMDefines.h: fix -Wimplicit-fallthrough in -DLLVM_ENABLE_ASSERTIONS=OFF buildsFangrui Song2019-05-141-2/+3
| | | | | | | | Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D61844 llvm-svn: 360646
* DWARF/DIERef: remove non-const operator<Pavel Labath2019-05-131-2/+0
| | | | | | It serves no purpose as one can always invoke the const version instead. llvm-svn: 360583
* Breakpad: Generate unwind plans from STACK CFI recordsPavel Labath2019-05-132-2/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements the GetUnwindPlan interface (added in the previous patch) for SymbolFileBreakpad, and uses it to generate unwind plans from STACK CFI records in breakpad files. We first perform a light-weight parse of the breakpad in order to build up a map of regions covered by the unwind info so that we can later jump to the right record when we need to unwind a specific function. The actual parsing is relatively straight-forward, as the STACK CFI records are just another (text) form of the eh_frame unwind instructions, and the same goes for lldb's UnwindPlans. The newly-introduced PostfixExpression API is used to convert the breakpad postfix expressions into DWARF. The generated dwarf expressions are stored in a BumpPtrAllocator, as the UnwindPlan does not take ownership of the expression data it references (usually this is static data in an object file, so special ownership is needed). At this moment the generated unwind plans aren't used in the actual unwind machinery (only in the image show-unwind command), but that is coming in a separate patch. Reviewers: amccarth, clayborg, markmentovai Subscribers: aprantl, jasonmolenda, lldb-commits Differential Revision: https://reviews.llvm.org/D61733 llvm-svn: 360574
* [NativePDB] Support member function types in PdbAstBuilderAleksandr Urakov2019-05-132-0/+19
| | | | | | | | | | | | | | | | | Summary: This patch implements missing case in PdbAstBuilder::CreateType for LF_MFUNCTION. This is necessary, for example, in stack unwinding of struct methods. Reviewers: amccarth, aleksandr.urakov Reviewed By: amccarth Subscribers: abidh, teemperor, lldb-commits, leonid.mashinskiy Differential Revision: https://reviews.llvm.org/D61128 llvm-svn: 360569
* [DWARF] Use sequential integers for the IDs of the SymbolFileDWOsPavel Labath2019-05-132-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of using the offset of the contained compile unit, we use it's ID. The goal of this change is two-fold: - free up space in the user_id_t representation to enable storing the debug-info-carrying section (debug_types/debug_info) without decreasing the amount of debug info we can address (as would be the case with D61503). - be a step towards supporting DWO files containing more than one unit (important for debug_types+dwo, but can also happen with regular dwo+lto). For this part to fully work we'd still need to add a way to lookup the SymbolFileDWO without going through GetCompileUnitAtIndex, but making sure things don't accidentally work because the SymbolFile ID is the same as compile unit offset is a step towards that. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: mehdi_amini, dexonsmith, tberghammer, jankratochvil, lldb-commits Differential Revision: https://reviews.llvm.org/D61783 llvm-svn: 360565
* Fix file names in file headers. NFCFangrui Song2019-05-1310-10/+10
| | | | llvm-svn: 360554
* [Breakpoint] Make breakpoint language agnosticAlex Langford2019-05-112-45/+48
| | | | | | | | | | | | | | | | | | | Summary: Breakpoint shouldn't need to depend on any specific details from a programming language. Currently the only language-specific detail it takes advantage of are the different qualified names an objective-c method name might have when adding a name lookup. This is reasonably generalizable. The current method name I introduced is "GetVariantMethodNames", which I'm not particularly tied to. If you have a better suggestion, please do let me know. Reviewers: JDevlieghere, jingham, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D61746 llvm-svn: 360509
* Finish renaming CompileUnit -> UnitJan Kratochvil2019-05-1012-93/+85
| | | | | | | | | | | | | D42892 changed a lot of code to use superclass DWARFUnit instead of its subclass DWARFCompileUnit. Finish this change more thoroughly for any *CompileUnit* -> *Unit* names. Later patch will introduce DWARFTypeUnit which needs to be sometimes different from DWARFCompileUnit and it would be confusing without this renaming. Differential Revision: https://reviews.llvm.org/D61501 llvm-svn: 360443
* minidump: Don't eagerly resolve module paths read from the minidumpPavel Labath2019-05-101-1/+0
| | | | | | | | This can cause us to return paths to files on the local filesystem even if we don't end up using that file (for instance because the file is not a real module). llvm-svn: 360432
* Minidump: use ThreadList parsing code from llvm/ObjectPavel Labath2019-05-108-91/+36
| | | | llvm-svn: 360412
* [JITLoaderGDB] Set eTypeJIT for objects read from JIT descriptorsStefan Granitz2019-05-092-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: First part of a fix for JITed code debugging. This has been a regression from 5.0 to 6.0 and it's is still reproducible on current master: https://bugs.llvm.org/show_bug.cgi?id=36209 The address of the breakpoint site is corrupt: the 0x4 value we end up with, looks like an offset on a zero base address. When we parse the ELF section headers from the JIT descriptor, the load address for the text section we find in `header.sh_addr` is correct. The bug manifests in `VMAddressProvider::GetVMRange(const ELFSectionHeader &)` (follow it from `ObjectFileELF::CreateSections()`). Here we think the object type was `eTypeObjectFile` and unleash some extra logic [1] which essentially overwrites the address with a zero value. The object type is deduced from the ELF header's `e_type` in `ObjectFileELF::CalculateType()`. It never returns `eTypeJIT`, because the ELF header has no representation for it [2]. Instead the in-memory ELF object states `ET_REL`, which leads to `eTypeObjectFile`. This is what we get from `lli` at least since 3.x. (Might it be better to write `ET_EXEC` on the JIT side instead? In fact, relocations were already applied at this point, so "Relocatable" is not quite exact.) So, this patch proposes to set `eTypeJIT` explicitly whenever we read from a JIT descriptor. In `ObjectFileELF::CreateSections()` we can then call `GetType()`, which returns the explicit value or otherwise falls back to `CalculateType()`. LLDB then sets the breakpoint successfully. Next step: debug info. ``` Process 1056 stopped * thread #1, name = 'lli', stop reason = breakpoint 1.2 frame #0: 0x00007ffff7ff7000 JIT(0x3ba2030)`jitbp() JIT(0x3ba2030)`jitbp: -> 0x7ffff7ff7000 <+0>: pushq %rbp 0x7ffff7ff7001 <+1>: movq %rsp, %rbp 0x7ffff7ff7004 <+4>: movabsq $0x7ffff7ff6000, %rdi ; imm = 0x7FFFF7FF6000 0x7ffff7ff700e <+14>: movabsq $0x7ffff6697e80, %rcx ; imm = 0x7FFFF6697E80 ``` [1] It was first introduced with https://reviews.llvm.org/D38142#change-lF6csxV8HdlL, which has also been the original breaking change. The code has changed a lot since then. [2] ELF object types: https://github.com/llvm/llvm-project/blob/2d2277f5/llvm/include/llvm/BinaryFormat/ELF.h#L110 Reviewers: labath, JDevlieghere, bkoropoff, clayborg, espindola, alexshap, stella.stamenova Reviewed By: labath, clayborg Subscribers: probinson, emaste, aprantl, arichardson, MaskRay, AlexDenisov, yurydelendik, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61611 llvm-svn: 360354
* [DWARF] Centralize user_id <-> DWARFDIE conversionsPavel Labath2019-05-086-114/+55
| | | | | | | | | | | | | | | | | | | | | | | Summary: The logic for translating a user_id into a DWARFDIE was replicated in several places. This removes that redundancy and settles on a single implementation in SymbolFileDWARF. The reason for choosing that instead of DIERef was that we were always immediately converting the returned DIERef into a DWARFDIE anyway, which meant that one had to specify the SymbolFileDWARF argument twice (once to get the DIERef, and once to get the actual DIE). Also, passing a higher-level object (SymbolFileDWARF) into a lower-level one (DIERef) seemed like a less intuitive arrangement than doing things the other way around. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: tberghammer, jankratochvil, lldb-commits Differential Revision: https://reviews.llvm.org/D61648 llvm-svn: 360246
* RegisterContextLLDB: Push CFA value on DWARF stack when evaluating register ↵Pavel Labath2019-05-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | expressions Summary: This behavior is specified in the Section 6.4.2.3 (Register Rule instructions) of the DWARF4 spec. We were not doing that, which meant that any register rule which was relying on the cfa value being there was not evaluated correctly (it was aborted due to "out of bounds" access). I'm not sure how come this wasn't noticed before, but I guess this has something to do with the fact that dwarf unwind expressions are not used very often, and when they are, the situation is so complicated that the CFA is of no use. I noticed this when I started emitting dwarf expressions for the unwind information present in breakpad symbol files. Reviewers: jasonmolenda, clayborg Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D61018 llvm-svn: 360158
* Merge GetCompileUnitAtOffset + GetCompileUnitContainingDIEOffsetJan Kratochvil2019-05-062-49/+27
| | | | | | | | | | | | | | | | These two methods are very similar and various refactorizations need to modify both similar ways. One could also just remove GetCompileUnitAtOffset and make GetCompileUnitContainingDIEOffset to also accept offset of the CU itself (currently it accepts only DIE offsets after the CU header). But that would be less safe regarding some internal sanity checking. Further code refactorization has been suggested by Pavel Labath. Differential Revision: https://reviews.llvm.org/D61498 llvm-svn: 360038
* [DWARF] Reimplement/simplify DWARFUnit::GetIDPavel Labath2019-05-068-41/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The implementation of GetID used a relatively complicated algorithm, which returned some kind of an offset of the unit in some file (depending on the debug info flavour). The only thing this ID was used for was to enable subseqent retrieval of the unit from the SymbolFile. This can be made simpler if we just make the "ID" of the unit an index into the list of the units belonging to the symbol file. We already support indexed access to the units, so each unit already has a well "index" -- this just makes it accessible from within the unit. To make the distincion between "id" and "offset" clearer (and help catch any misuses), I also rename DWARFDebugInfo::GetCompileUnit (which accesses by offset) into DWARFDebugInfo::GetCompileUnitAtOffset. On its own, this only brings a minor simplification, but it enables further simplifications in the DIERef class (coming in a follow-up patch). Reviewers: JDevlieghere, clayborg, aprantl Subscribers: arphaman, jdoerfert, lldb-commits, tberghammer, jankratochvil Differential Revision: https://reviews.llvm.org/D61481 llvm-svn: 360014
* ExpressionParser: only force link MCJIT when neededSaleem Abdulrasool2019-05-031-5/+0
| | | | | | | | | | | This was added to support FreeBSD. The inclusion of this header increases the size of `lldb-server` due to MCJIT being forcefully preserved. Conditionalise the inclusion to shared builds of LLVM which will allow for MCJIT to be stripped if unnecessary when performing static linking of tools. This shaves off ~28% of the binary size for lldb-server when linked with gold using `-ffunction-sections` and `-fdata-sections`. llvm-svn: 359944
* Fixed some minor style issues in rLLDB359921 [NFC]Raphael Isemann2019-05-031-4/+4
| | | | | | | | Ran clang-format on the added test file and use the new StringRef comparison over the temporary ConstStrings. Also aligned the end of one of the code string literals. llvm-svn: 359931
* Fix for ambiguous lookup in expressions between local variable and namespaceShafik Yaghmour2019-05-031-13/+27
| | | | | | | | | Summary: In an Objective-C context a local variable and namespace can cause an ambiguous name lookup when used in an expression. The solution involves mimicking the existing C++ solution which is to add local using declarations for local variables. This causes a different type of lookup to be used which eliminates the namespace during acceptable results filtering. Differential Revision: https://reviews.llvm.org/D59960 llvm-svn: 359921
* C.128 override, virtual keyword handlingRaphael Isemann2019-05-0317-29/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: According to [C128] "Virtual functions should specify exactly one of `virtual`, `override`, or `final`", I've added override where a virtual function is overriden but the explicit `override` keyword was missing. Whenever both `virtual` and `override` were specified, I removed `virtual`. As C.128 puts it: > [...] writing more than one of these three is both redundant and > a potential source of errors. I anticipate a discussion about whether or not to add `override` to destructors but I went for it because of an example in [ISOCPP1000]. Let me repeat the comment for you here: Consider this code: ``` struct Base { virtual ~Base(){} }; struct SubClass : Base { ~SubClass() { std::cout << "It works!\n"; } }; int main() { std::unique_ptr<Base> ptr = std::make_unique<SubClass>(); } ``` If for some odd reason somebody removes the `virtual` keyword from the `Base` struct, the code will no longer print `It works!`. So adding `override` to destructors actively protects us from accidentally breaking our code at runtime. [C128]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final [ISOCPP1000]: https://github.com/isocpp/CppCoreGuidelines/issues/1000#issuecomment-476951555 Reviewers: teemperor, JDevlieghere, davide, shafik Reviewed By: teemperor Subscribers: kwk, arphaman, kadircet, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61440 llvm-svn: 359868
* RegisterContextLLDB::GetFullUnwindPlanForFrame has four verboseJason Molenda2019-05-021-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | logging messages that are written the same, making it difficult to know for certain which code path was taken based on a logfile. Add some words to make each unique. Right now the ordering for finding a FullUnwindPlan (ignoring fallback unwind plan logic) is 1. If this is a _sigtramp like function, try eh_frame which is hand written on darwin systems to account for finding the saved register context correctly. 2. Ask the DynamicLoader if eh_frame should be preferred for this frame. Some binaries on the system may have hand-written eh_frame and the DynamicLoader is the source for this. (primarily this is for hand-written assembly in the objc runtime, and we tell lldb to trust that for functions in libobjc.dylib.) 3. if 0th frame, use GetUnwindPlanAtNonCallSite plan. 4. GetUnwindPlanAtCallSite {for 0th or any other} 5. GetUnwindPlanAtNonCallSite {now for non-0th frames, only if not from a compiler? hm.} 6. GetUnwindPlanArchitectureDefaultAtFunctionEntry if we're on the first instruction 7. Architectural default unwind plan ABI::CreateDefaultUnwindPlan I'm moving #6 -- DefaultAtFunctionEntry -- up to between #3 and #4, where we're already doing things specific to the zeroth frame. If we're on the zeroth frame and the GetUnwindPlanAtNonCallSite plan has failed for some reason, and we're on the first instruction, we should definitely use DefaultAtFunctionEntry instead of any other unwind plan. If we're trying to step out of some rando function on the system that we couldn't assembly instruction inspect, this is sufficient for us to step out of it. llvm-svn: 359847
* Upstreaming an apple local patch by Frederic Riss.Jason Molenda2019-05-021-1/+32
| | | | | | | | | | | | | | | | | | | lldb has an expression that runs in the inferior process to collect the isa values and hash of the class names for classes in the system's shared cache. In recent OSes, swift classes are in this table and the function the jitted expression calls returns demangled names. We need to compute the hashes based on the mangled names. So for these names, return a hash value of 0 which indicates that lldb should read the class name directly out of the runtime tables and compute the hash itself. When this patch is absent, the lldb+swift testsuite has many failures on a recent macOS system; there isn't a direct non-swift way to test for this being correct. <rdar://problem/47935062> llvm-svn: 359843
* gdb-remote: fix the build on WindowsSaleem Abdulrasool2019-05-021-0/+3
| | | | | | | Windows does not have a definition for `mode_t`. Include the appropriate header. llvm-svn: 359816
* Remove unnecessary check in SymbolFileDWARF::ParseImportedModulesRaphael Isemann2019-05-021-3/+0
| | | | | | | | | | | | | | | | | | Summary: This check seems unnecessary as we already assert the same condition above and also access `sc.comp_unit` before this check. Reviewers: aprantl Reviewed By: aprantl Subscribers: jdoerfert, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61394 llvm-svn: 359813
OpenPOWER on IntegriCloud