summaryrefslogtreecommitdiff
path: root/lldb
AgeCommit message (Collapse)Author
2019-01-15[LLDB] Remove the unused variable oso_dwarf.David L. Jones
Patch by Ali Tamur! (tamur@google.com)
2019-01-14[SymbolFile] Remove SymbolContext parameter from FindTypes.Zachary Turner
This parameter was only ever used with the Module set, and since a SymbolFile is tied to a module, the parameter turns out to be entirely unnecessary. Furthermore, it doesn't make a lot of sense to ask a caller to ask SymbolFile which is tied to Module X to find types for Module Y, but that possibility was open with the previous interface. By removing this parameter from the API, it makes it harder to use incorrectly as well as easier for an implementor to understand what it needs to do.
2019-01-14[SymbolFile] Remove the SymbolContext parameter from FindNamespace.Zachary Turner
Every callsite was passing an empty SymbolContext, so this parameter had no effect. Inside the DWARF implementation of this function, however, there was one codepath that checked members of the SymbolContext. Since no call-sites actually ever used this functionality, it was essentially dead code, so I've deleted this code path as well.
2019-01-14[SymbolFile] Rename ParseFunctionBlocks to ParseBlocksRecursive.Zachary Turner
This method took a SymbolContext but only actually cared about the case where the m_function member was set. Furthermore, it was intended to be implemented to parse blocks recursively despite not documenting this in its name. So we change the name to indicate that it should be recursive, while also limiting the function parameter to be a Function&. This lets the caller know what is required to use it, as well as letting new implementers know what kind of inputs they need to be prepared to handle.
2019-01-14[lldbsuite] Skip two more flaky tests on WindowsStella Stamenova
TestNamespaceLookup occasionally passes unexpectedly and TestExitDuringStep occasionally fails unexpectedly
2019-01-14[Core] Use the implementation method GetAddressOf in ValueObjectConstResultChildAleksandr Urakov
Summary: This patch allows to retrieve an address object for `ValueObject`'s children retrieved through e.g. `GetChildAtIndex` or `GetChildMemberWithName`. It just uses the corresponding method of the implementation object `m_impl` to achieve that. Reviewers: zturner, JDevlieghere, clayborg, labath, serge-sans-paille Reviewed By: clayborg Subscribers: leonid.mashinskiy, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D56147
2019-01-14[CMake] LLVM exports utility targets since r350959, so we can use them ↵Stefan Granitz
without standalone-checks now
2019-01-12Add SymbolFileBreakpad.Jason Molenda
2019-01-11[lldbsuite] Skip TestExitDuringStep on WindowsStella Stamenova
This test is flaky on Windows and will occasionally hang or fail.
2019-01-11Fix build breaks after the ParseCompileUnit changes.Zachary Turner
The addition of SymbolFileBreakpad crossed paths with my change, so this interface needs to be fixed up as well.
2019-01-11Attempt to fix PDB tests broken by r350924Pavel Labath
The patch added the symbol plugin name to the lldb-test output. Update the tests to account for that.
2019-01-11[CMake] Include tests by default also in standalone buildsStefan Granitz
In-tree builds include tests by default. Standalone builds should behave the same.
2019-01-11[SymbolFile] Make ParseCompileUnitXXX accept a CompileUnit&.Zachary Turner
Previously all of these functions accepted a SymbolContext&. While a CompileUnit is one member of a SymbolContext, there are also many others, and by passing such a monolithic parameter in this way it makes the requirements and assumptions of the API unclear for both callers as well as implementors. All these methods need is a CompileUnit. By limiting the parameter type in this way, we simplify the code as well as make it self-documenting for both implementers and users. Differential Revision: https://reviews.llvm.org/D56564
2019-01-11[CMake] Remove dead code and outdated commentsStefan Granitz
Summary: All of these changes are NOPs. Reviewers: stella.stamenova, labath, JDevlieghere Reviewed By: stella.stamenova Subscribers: mgorny, lldb-commits, #lldb Differential Revision: https://reviews.llvm.org/D56609
2019-01-11Introduce SymbolFileBreakpad and use it to fill symtabPavel Labath
Summary: This commit adds the glue code necessary to integrate the SymbolFileBreakpad into the plugin system. Most of the methods are stubbed out. The only method implemented method is AddSymbols, which parses the PUBLIC "section" of the breakpad "object file", and fills out the Module's symtab. To enable testing this, I've made two additional changes: - dump Symtab from the SymbolVendor class. The symtab was already being dumped as a part of the object file dump, but that happened before symbol vendor kicked in, so it did not reflect any symbols added there. - add ability to explicitly specify the external symbol file in lldb-test (so that the object file could be linked with the breakpad symbol file). To make things simpler, I've changed lldb-test from consuming multiple inputs (and dumping their symbols) to having it just process a single file per invocation. This was not a problem since everyone was using it that way already. Reviewers: clayborg, zturner, lemo, markmentovai, amccarth Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D56173
2019-01-11ELF: Fix base address computation code for files generated by yaml2objPavel Labath
The code was assuming that the elf file will have a PT_LOAD segment starting from the first byte of the file. While this is true for files generated by most linkers (it's a way of saving space), it is not a requirement. And files not satisfying this constraint can still be perfectly executable. yaml2obj is one of the tools which produces files like this. This patch relaxes the check in ObjectFileELF to take the address of the first PT_LOAD segment as the base address of the object (instead of the one with the offset 0). Since the PT_LOAD segments are supposed to be sorted according to the VM address, this entry will also be the one with the lowest VM address. If we ever run into files which don't have the PT_LOAD segments sorted, we can easily change this code to return the lowest VM address as the base address (if that is the correct thing to do for these files).
2019-01-10Change SymbolFile::ParseTypes to ParseTypesForCompileUnit.Zachary Turner
The function SymbolFile::ParseTypes previously accepted a SymbolContext. This makes it extremely difficult to implement faithfully, because you have to account for all possible combinations of members being set in the SymbolContext. On the other hand, no clients of this function actually care about implementing this function to this strict of a standard. AFAICT, there is actually only 1 client in the entire codebase, and it is the function ParseAllDebugSymbols, which is itself only called for testing purposes when dumping information. At this call-site, the only field it sets is the CompileUnit, meaning that an implementer of a SymbolFile need not worry about any examining or handling any other fields which might be set. By restricting this API to accept exactly a CompileUnit& and nothing more, we can simplify the life of new SymbolFile plugin implementers by making it clear exactly what the necessary and sufficient set of functionality they need to implement is, while at the same time removing some dead code that tried to handle other types of SymbolContext fields that were never going to be set anyway. Differential Revision: https://reviews.llvm.org/D56462
2019-01-10[NativePDB] Add support for parsing typedef records.Zachary Turner
Typedefs are represented as S_UDT records in the globals stream. This creates a strange situation where "types" are actually represented as "symbols", so they need special handling. In order to test this, we don't just use lldb and print out some variables causing the AST to get created, because variables whose type is a typedef will have debug info referencing the original type, not the typedef. So we use lldb-test instead which will parse all debug info in the entire file. This exposed some problems with lldb-test and the native reader, mainly that certain types of obscure symbols which we can find when iterating every single record would trigger crashes. These have been fixed as well so that lldb-test can be used to test this functionality. Differential Revision: https://reviews.llvm.org/D56461
2019-01-10lldbtest.py: try to fix a runtime exceptionAdrian Prantl
found on http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/32/consoleFull#15046896708254eaf0-7326-4999-85b0-388101f2d404
2019-01-10[opaque pointer types] Remove some calls to generic Type subtype accessors.James Y Knight
That is, remove many of the calls to Type::getNumContainedTypes(), Type::subtypes(), and Type::getContainedType(N). I'm not intending to remove these accessors -- they are useful/necessary in some cases. However, removing the pointee type from pointers would potentially break some uses, and reducing the number of calls makes it easier to audit.
2019-01-10Fix compilation error on 32-bit architectures introduced in r350511Pavel Labath
The issue was a narrowing conversion when converting from uint64_t to a size_t.
2019-01-10Revert "Add a verbose mode to "image dump line-table" and use it to write a ↵Pavel Labath
.debug_line test" This reverts commit r350802 because the test fails on windows. This happens because we treat the paths as windows paths even though they have linux path separators in the asm file. That results in wrong paths being computed (\tmp\tmp\a.c instead of /tmp/a.c). Reverting until I can figure out what to do with this.
2019-01-10PECOFF: Fix section name computationPavel Labath
If a section name is exactly 8 bytes long (or has been truncated to 8 bytes), it will not contain the terminating nul character. This means reading the name as a c string will pick up random data following the name field (which happens to be the section vm size). This fixes the name computation to avoid out-of-bounds access and adds a test. Reviewers: zturner, stella.stamenova Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56124
2019-01-10Implement ObjectFileELF::GetBaseAddressPavel Labath
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.
2019-01-10Add a verbose mode to "image dump line-table" and use it to write a ↵Pavel Labath
.debug_line test Summary: The motivation for this is being able to write tests for the upcoming breakpad line table parser, but this could be useful for testing the low-level workings of any line table format. Or simply for viewing the line table information with more detail (the brief format doesn't include any of the flags for end_of_prologue and similar). I've also removed the load_addresses argument from the DumpCompileUnitLineTable function, as it wasn't being used anywhere. Reviewers: clayborg, zturner Subscribers: JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D56315
2019-01-10[Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.Davide Italiano
Summary: In python 2, strings and bytes are the same, but they're not in python 3, hence the return of read() needs an explicit conversion. While I'm around, rename the return of Popen() from `pipe` to `process`, as that's what Popen returns. Reviewers: JDevlieghere, friss, zturner, aprantl, serge-sans-paille Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56517
2019-01-10A little cleanup / commenting on locating kernel binaries while IJason Molenda
was working on something else. DynamicLoaderDarwinKernel::SearchForKernelNearPC should have had an early return if the pc value is not in high memory; add that. The search for a kernel at 0x2000 offsets was a stopgap; it doesn't need to be checked any longer.
2019-01-10[lldb-server] Add unnamed pipe support to PipeWindowsAaron Smith
Summary: This adds unnamed pipe support in PipeWindows to support communication between a debug server and child process. Modify PipeWindows::CreateNew to support the creation of an unnamed pipe. Rename the previous method that created a named pipe to PipeWindows::CreateNewNamed. Reviewers: zturner, llvm-commits Reviewed By: zturner Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56234
2019-01-09Write PDB/variables.test to be more robust.Zachary Turner
CHECK-DAG can't really be mixed with CHECK-NEXT statements because each non DAG check sets a new search-origin for following CHECK-DAG statements. This was passing by coincidence before, but a benign change in the way we process symbols caused the order of the output to be different, which triggered this test to fail. This change makes the test resilient against ordering problems by running a separate invocation of FileCheck for each function that we want to test. Note that with the Native PDB reader, we have full control over the ordering that symbols are processed in, so we don't have to worry about different machines returning things in different orders due to different DIA SDK versions.
2019-01-09[Python] Update PyString_FromString() to work for python 2 and 3.Davide Italiano
Reviewers: aprantl, JDevlieghere, friss, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56511
2019-01-09Change lldb-test to use ParseAllDebugSymbols.Zachary Turner
ParseDeclsForContext was originally created to serve the very specific case where the context is a function block. It was never intended to be used for arbitrary DeclContexts, however due to the generic name, the DWARF and PDB plugins implemented it in this way "just in case". Then, lldb-test came along and decided to use it in that way. Related to this, there are a set of functions in the SymbolFile class interface whose requirements and expectations are not documented. For example, if you call ParseCompileUnitFunctions, there's an inherent requirement that you create entries in the underlying clang AST for these functions as well as their signature types, because in order to create an lldb_private::Function object, you have to pass it a CompilerType for the parameter representing the signature. On the other hand, there is no similar requirement (either inherent or documented) if one were to call ParseDeclsForContext. Specifically, if one calls ParseDeclsForContext, and some variable declarations, types, and other things are added to the clang AST, is it necessary to create lldb::Variable, lldb::Type, etc objects representing them? Nobody knows. There is, however, an accidental requirement, because since all of the plugins implemented this just in case, lldb-test came along and used ParsedDeclsForContext, and then wrote check lines that depended on this. When I went to try and implemented the NativePDB reader, I did not adhere to this (in fact, from a layering perspective I went out of my way to avoid it), and as a result the existing DIA PDB tests don't work when the native PDB reader is enabled, because they expect that calling ParseDeclsForContext will modify the *module's* view of symbols, and not just the internal AST. All of this confusion, however, can be avoided if we simply stick to using ParseDeclsForContext for its original intended use case (blocks), and use a different function (ParseAllDebugSymbols) for its intended use case which is, unsuprisingly, to parse all the debug symbols (which is all lldb-test really wanted to do anyway). In the future, I would like to change ParseDeclsForContext to ParseDeclsForFunctionBlock, then delete all of the dead code inside that handles other types of DeclContexts (and probably even assert if the DeclContext is anything other than a block). A few PDB tests needed to be fixed up as a result of this, and this also exposed a couple of bugs in the DIA PDB reader (doesn't matter much since it should be going away soon, but worth mentioning) where the appropriate AST entries weren't being created always. Differential Revision: https://reviews.llvm.org/D56418
2019-01-09ELF: create "container" sections from PT_LOAD segmentsPavel Labath
Summary: This is the result of the discussion in D55356, where it was suggested as a solution to representing the addresses that logically belong to a module in memory, but are not a part of any of its sections. The ELF PT_LOAD segments are similar to the MachO "load commands", except that the relationship between them and the object file sections is a bit weaker. While in the MachO case, the sections belonging to a specific segment are placed directly inside it in the object file logical structur, in the ELF case, the sections and segments form two separate hierarchies. This means that it is in theory possible to create an elf file where only a part of a section would belong to some segment (and another part to a different one). However, I am not aware of any tool which would produce such a file (and most tools will have problems ingesting them), so this means it is still possible to follow the MachO model and make sections children of the PT_LOAD segments. In case we run into (corrupt?) files with overlapping sections, I have added code (and tests) which adjusts the sizes and/or drops the offending sections in order to present a reasonable image to the upper layers of LLDB. This is mostly done for completeness, as I don't anticipate running into this situation in the real world. However, if we do run into it, and the current behavior is not suitable for some reason, we can implement this logic differently. Reviewers: clayborg, jankratochvil, krytarowski, joerg, espindola Subscribers: emaste, arichardson, lldb-commits Differential Revision: https://reviews.llvm.org/D55998
2019-01-09[CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary ↵Stefan Granitz
directory Summary: In standalone builds `LLVM_BINARY_DIR` was equal to `LLDB_BINARY_DIR` so far. This is counterintuitive and invalidated the values of `LLDB_DEFAULT_TEST_DSYMUTIL/FILECHECK/COMPILER` etc. Reviewers: zturner, labath, clayborg, JDevlieghere, stella.stamenova, serge-sans-paille Reviewed By: labath Subscribers: mgorny, friss, lldb-commits, #lldb Differential Revision: https://reviews.llvm.org/D56443
2019-01-09[CMake] Fix standalone builds: workaround the cxx target not getting ↵Stefan Granitz
imported yet (unlike clang target) Summary: Handle standalone builds separately and print a warning if we have no libcxx. Reviewers: aprantl, JDevlieghere Reviewed By: JDevlieghere Subscribers: mgorny, lldb-commits, #lldb Differential Revision: https://reviews.llvm.org/D56399
2019-01-09[CMakeLists] Sort tools/CMakeLists.txtJonas Devlieghere
2019-01-08Change std::sort to llvm::sort to detect non-determinism.Jonas Devlieghere
LLVM added wrappers to std::sort (r327219) that randomly shuffle the container before sorting. The goal is to uncover non-determinism due to undefined sorting order of objects having the same key. This can be enabled with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON.
2019-01-08Fix unused private field warning.Raphael Isemann
Summary: The member is private and unused if HAVE_LIBCOMPRESSION is undefined, which triggers Clang's -Wunused-private-field warning. Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56458
2019-01-08[BreakpointList] Simplify/modernize BreakpointList (NFC)Jonas Devlieghere
I was looking at the code in BreakpointList.cpp and found it deserved a quick cleanup. - Use std::vector instead of a std::list. - Extract duplicate code for notifying. - Remove code duplication when returning a const value. - Use range-based for loop. - Use early return in loops. Differential revision: https://reviews.llvm.org/D56425
2019-01-08[PdbAstBuilder] Remove unused functionsJonas Devlieghere
PdbAstBuilder.cpp:273:20: warning: unused function 'GetParentUniqueName' [-Wunused-function] PdbAstBuilder.cpp:267:13: warning: unused function 'IsUniqueNameEnumTag' [-Wunused-function]
2019-01-08Convert to LLDB coding style (NFC)Adrian Prantl
2019-01-08ProcessLaunchInfo: Remove Target referencePavel Labath
Summary: The target was being used in FinalizeFileActions to provide default values for stdin/out/err. Also, most of the logic of this function was very specific to how the lldb's Target class wants to launch processes, so I, move it to Target::FinalizeFileActions, inverting the dependency. The only piece of logic that was useful elsewhere (lldb-server) was the part which sets up a pty and relevant file actions. I've kept this part as ProcessLaunchInfo::SetUpPtyRedirection. This makes ProcessLaunchInfo independent of any high-level lldb constructs. Reviewers: zturner, jingham, teemperor Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56196
2019-01-08[SymbolContext] Remove dead codeJonas Devlieghere
Removes two methods from SymbolContextList that aren't referenced.
2019-01-07Simplify code.Adrian Prantl
2019-01-07Clarify comment and variable names. (NFC)Adrian Prantl
2019-01-07Rename DWARFDIE::GetDWOContext() -> GetDeclContext() (NFC)Adrian Prantl
Despite the name, this function has nothing to do with the DWO format.
2019-01-07[lldb] Fix -Wstring-plus-int warning in POSIX-DYLD/AuxVector.cppJorge Gorbe Moya
2019-01-07Split two sub-tests into separate top-level methods.Adrian Prantl
2019-01-07Refactor test, no changes expected.Adrian Prantl
2019-01-07Use the minidump exception record if presentLeonard Mosescu
If the minidump contains a saved exception record use it automatically. Differential Revision: https://reviews.llvm.org/D56293
2019-01-07Fine-tune and document the barrier in TestQueues.Adrian Prantl