summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-test
Commit message (Collapse)AuthorAgeFilesLines
...
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-011-5/+5
| | | | | | | | | This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
* Fix clang -Wimplicit-fallthrough warnings across llvm, NFCReid Kleckner2018-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 llvm-svn: 345882
* [NFC] Turn "load dependent files" boolean into an enumJonas Devlieghere2018-09-201-4/+3
| | | | | | | | | | | | | | This is an NFC commit to refactor the "load dependent files" parameter from a boolean to an enum value. We want to be able to specify a default, in which case we decide whether or not to load the dependent files based on whether the target is an executable or not (i.e. a dylib). This is a dependency for D51934. Differential revision: https://reviews.llvm.org/D51859 llvm-svn: 342633
* [PDB] Restore AST from PDB symbolsAleksandr Urakov2018-09-101-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds an implementation of retrieving of declarations and declaration contexts based on PDB symbols. PDB has different type symbols for const-qualified types, and this implementation ensures that only one declaration was created for both const and non-const types, but creates different compiler types for them. The implementation also processes the case when there are two symbols corresponding to a variable. It's possible e.g. for class static variables, they has one global symbol and one symbol belonging to a class. PDB has no info about namespaces, so this implementation parses the full symbol name and tries to figure out if the symbol belongs to namespace or not, and then creates nested namespaces if necessary. Reviewers: asmith, zturner, labath Reviewed By: asmith Subscribers: aleksandr.urakov, teemperor, lldb-commits, stella.stamenova Tags: #lldb Differential Revision: https://reviews.llvm.org/D51162 llvm-svn: 341782
* [PDB] Resolve a symbol context block info correctlyAleksandr Urakov2018-08-291-0/+48
| | | | | | | | | | | | | | | | | | | Summary: This patch allows to resolve a symbol context block info even if a function info was not requested. Also it adds the correct resolving of nested blocks (the previous implementation used function blocks instead of them). Reviewers: zturner, asmith, labath Reviewed By: asmith Subscribers: lldb-commits, stella.stamenova Tags: #lldb Differential Revision: https://reviews.llvm.org/D51104 llvm-svn: 340901
* Add a test for reading lld-generated build-idsPavel Labath2018-06-291-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This test makes sure we are able to read the shorter build-ids which are generated by lld. To make this work, I've extended lldb-test to print the UUID of the loaded object file. I've renamed the lldb-test subcommand from "module-sections" to "object-file" to reflect the fact it prints more than just the sections. I've also added the module Architecture to the output, so we could avoid printing the entire symbol file information just to get the ArchSpec details in the lc_version_min test (which was also the only test in it's folder not using the module-sections command). Reviewers: aprantl, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48646 llvm-svn: 335967
* Retrieve a function PDB symbol correctly from nested blocksPavel Labath2018-06-281-24/+58
| | | | | | | | | | | | | | | | | | | Summary: This patch fixes a problem with retrieving a function symbol by an address in a nested block. In the current implementation of ResolveSymbolContext function it retrieves a symbol with PDB_SymType::None and then checks if found symbol's tag equals to PDB_SymType::Function. So, if nested block's symbol was found, ResolveSymbolContext does not resolve a function. Reviewers: asmith, labath, zturner Reviewed By: asmith, labath Differential Revision: https://reviews.llvm.org/D47939 Patch by Aleksandr Urakov <aleksandr.urakov@jetbrains.com> llvm-svn: 335822
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-131-1/+1
| | | | | | | | | | | | | | | | SetFile has an optional style argument which defaulted to the native style. This patch makes that argument mandatory so clients of the FileSpec class are forced to think about the correct syntax. At the same time this introduces a (protected) convenience method to update the file from within the FileSpec class that keeps the current style. These two changes together prevent a potential pitfall where the style might be forgotten, leading to the path being updated and the style unintentionally being changed to the host style. llvm-svn: 334663
* Fix build error introduced in r334498Pavel Labath2018-06-121-2/+2
| | | | | | | | | | Some gcc versions (circa 4.9) do not accept initializing Expected objects containing a reference to a function from a function. Change the Expected object to contain function pointers to work around this. llvm-svn: 334501
* lldb-test symbols: Add -file argument and the ability to dump global ↵Pavel Labath2018-06-121-73/+101
| | | | | | | | | | | | | | | variables in a file The motivation for this is to be able to Dwarf index ability to look up variables within a given compilation unit. It also fits in with the patch in progress at D47939, which will add the ability to look up funtions using file+line pairs. The verification of which lldb-test options can be used together was getting a bit unwieldy, so I moved the logic out into a separate function. llvm-svn: 334498
* PDB support of function-level linking and splitted functionsAaron Smith2018-06-081-17/+94
| | | | | | | | | | | | | | | | | | | Summary: The patch adds support of splitted functions (when MSVC is used with PGO) and function-level linking feature. SymbolFilePDB::ParseCompileUnitLineTable function relies on fact that ranges of compiled source files in the binary are continuous and don't intersect each other. The function creates LineSequence for each file and inserts it into LineTable, and implementation of last one relies on continuity of the sequence. But it's not always true when function-level linking enabled, e.g. in added input test file test-pdb-function-level-linking.exe there is xstring's std__basic_string_char_std__char_traits_char__std__allocator_char_____max_size (.00454820) between test-pdb-function-level-linking.cpp's foo (.00454770) and main (.004548F0). To fix the problem this patch renews the sequence on each address gap. Reviewers: asmith, zturner Reviewed By: asmith Subscribers: aleksandr.urakov, labath, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D47708 llvm-svn: 334260
* [IRMemoryMap] Use labels in the "malloc" and "free" lldb-test commandsVedant Kumar2018-06-041-37/+54
| | | | | | | | | | | | | | | | Change the syntax of the malloc and free commands in lldb-test's ir-memory-map subcommand to: <malloc> ::= <label> = malloc <size> <alignment> <free> ::= free <label> This should make it easier to read and extend tests in the future, e.g to test IRMemoryMap::WriteMemory or double-free behavior. Differential Revision: https://reviews.llvm.org/D47646 llvm-svn: 333930
* [IRMemoryMap] Test interleaved Mallocs and FreesVedant Kumar2018-05-311-3/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new command to the ir-memory-map tester: free <allocation-index> The argument to free is an index which identifies which live allocation to free. Index 0 identifies the first live allocation in the address space, index 1 identifies the second, etc. where the allocations are sorted in increasing order. For illustrative purposes, assume malloc returns monotonically increasing addresses. Here are some examples of how free would work: Example 1 --------- malloc 16 1 malloc 32 1 free 1 //< Free the 32-byte allocation. free 0 //< Next, free the 16-byte allocation. Example 2 --------- malloc 16 1 malloc 32 1 free 0 //< Free the 16-byte allocation. free 0 //< Next, free the 32-byte allocation. llvm-svn: 333700
* [lldb-test] Make logging available to all subcommandsVedant Kumar2018-05-311-0/+3
| | | | llvm-svn: 333699
* [IRMemoryMap] Test host-side allocationsVedant Kumar2018-05-311-3/+9
| | | | | | | | r333583 introduced testing for IRMemoryMap's process-side allocations (eAllocationPolicyProcessOnly). This adds support for the host-side variety (eAllocationPolicyHostOnly). llvm-svn: 333698
* Remove append parameter to FindGlobalVariablesPavel Labath2018-05-311-5/+3
| | | | | | | | | | | | | | | | | | | Summary: As discussed in https://bugs.llvm.org/show_bug.cgi?id=37317, FindGlobalVariables does not properly handle the case where append=false. As this doesn't seem to be used in the tree, this patch removes the parameter entirely. Reviewers: clayborg, jingham, labath Reviewed By: clayborg Subscribers: aprantl, lldb-commits, kubamracek, JDevlieghere Differential Revision: https://reviews.llvm.org/D46885 Patch by Tom Tromey <ttromey@mozilla.com>. llvm-svn: 333639
* [lldb-test] ir-memory-map: Avoid accessing a bad iteratorVedant Kumar2018-05-301-10/+8
| | | | | | | Do not access Probe.start() when Probe is at the end of the interval map. llvm-svn: 333585
* [lldb-test] Add a testing harness for the JIT's IRMemoryMapVedant Kumar2018-05-301-19/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This teaches lldb-test how to launch a process, set up an IRMemoryMap, and issue memory allocations in the target process through the map. This makes it possible to test IRMemoryMap in a targeted way. This has uncovered two bugs so far. The first bug is that Malloc performs an adjustment on the pointer returned from AllocateMemory (for alignment purposes) which ultimately allows overlapping memory regions to be created. The second bug is that after most of the address space on the host side is exhausted, Malloc may return the same address multiple times. These bugs (and hopefully more!) can be uncovered and tested for with targeted lldb-test commands. At an even higher level, the motivation for addressing these bugs is that they can lead to strange user-visible failures (e.g, variables assume the wrong value during expression evaluation, or the debugger crashes). See my third comment on this swift-lldb PR for an example: https://github.com/apple/swift-lldb/pull/652 I hope lldb-test is the right place to add this testing harness. Setting up a gtest-style unit test proved too cumbersome (you need to recreate or mock way too much debugger state), as did writing end-to-end tests (it's hard to write a test that actually hits a buggy path). With lldb-test, it's easy to read/generate the test input and parse the test output. I'll attach a simple "fuzz" tester which generates failing test cases to the Phab review. Here's an example: ``` Command: malloc(size=1024, alignment=32) Malloc: address = 0xca000 Command: malloc(size=64, alignment=16) Malloc: address = 0xca400 Command: malloc(size=1024, alignment=16) Malloc: address = 0xca440 Command: malloc(size=16, alignment=8) Malloc: address = 0xca840 Command: malloc(size=2048, alignment=16) Malloc: address = 0xcb000 Command: malloc(size=64, alignment=32) Malloc: address = 0xca860 Command: malloc(size=1024, alignment=16) Malloc: address = 0xca890 Malloc error: overlapping allocation detected, previous allocation at [0xca860, 0xca8a0) ``` {F6288839} Differential Revision: https://reviews.llvm.org/D47508 llvm-svn: 333583
* Move ObjectFile initialization out of SystemInitializerCommonPavel Labath2018-05-241-0/+12
| | | | | | | | | | | | | | | | | | | | | | Summary: For lldb-server, it is sufficient to parse only the native object file format for its target OS (no other file can be loaded into a running process). This moves the object file initialization code into specific initializer classes: lldb-test and liblldb get all object files; lldb-server gets only one of them. For this to work, I've needed to create a special SystemInitializer for use in lldb-server, instead of it calling directly into the common one. This reduces the size of lldb-server by about 2%, which is not earth-shattering, but it's an easy win, and it helps. Reviewers: zturner, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D47250 llvm-svn: 333182
* lldb-test symbols: Add ability to do name-based lookupPavel Labath2018-05-031-22/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: lldb-test already had the ability to dump all symbol information in a module. This is interesting, but it can be too verbose, and it also does not use the same APIs that lldb uses to query symbol information. The last part is interesting to me now, because I am about to add DWARF v5 debug_names support, which needs to implement these APIs. This patch adds a set of arguments to lldb-test, which modify it's behavior from dumping all symbols to dumping only the requested information: - --find={function,namespace,type,variable} - search for the given kind of objects. - --name - the name to search for. - --regex - whether to treat the "name" as a regular expression. This is not available for all lookup types (we do not have the required APIs for namespaces and types). - --context - specifies the context, which can be used to restrict the search. This argument takes a variable name (which must be defined and be unique), and we then use the context that this variable is defined in as the search context. - --function-flags={auto,full,base,method,selector} - a set of flags to further restrict the search for function symbols. Together, these flags and their combinations cover the main SymbolFile entry points which I will need to modify for the accelerator table support, and so I plan to do most of the regression testing this way. (I've also found this a useful tool for exploration of what the given APIs are supposed to do.) I add a couple of tests to demonstrate the usage of the usage of the various options, and also an xfailed test which demonstrates a bug I found while playing with this. The only requirement for these tests is the presence of lld -- the should run on any platform which is able to build lldb. These tests use c++ code as input, but this isn't a requirement. It is also possible to use IR, assembly or json to create the test module. Reviewers: davide, zturner, asmith, JDevlieghere, clayborg, alexshap Subscribers: mgorny, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D46318 llvm-svn: 331447
* Support reading section ".gnu_debugaltlink"Jan Kratochvil2018-04-291-0/+1
| | | | | | Differential revision: https://reviews.llvm.org/D40468 llvm-svn: 331148
* Re-add change for https://reviews.llvm.org/D42582 with added directories.Jim Ingham2018-03-122-3/+8
| | | | llvm-svn: 327331
* Revert "Improve prologue handling to support functions with multiple entry ↵Vedant Kumar2018-03-122-8/+3
| | | | | | | | | | | | | | | points." This reverts commit r327318. It breaks the Xcode and CMake Darwin builders: clang: error: no such file or directory: '.../source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp' clang: error: no input files More details are in https://reviews.llvm.org/D42582. llvm-svn: 327327
* Improve prologue handling to support functions with multiple entry points.Jim Ingham2018-03-122-3/+8
| | | | | | | | https://reviews.llvm.org/D42582 Patch from Leandro Lupori. llvm-svn: 327318
* Rewrite TestTargetSymbolsBuildidCase to be more focusedPavel Labath2018-03-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The test was failing in remote debugging scenario with windows as a host as cmd.exe is not able to parse the complicated shell commands in the Makefile. The test seemed like a perfect candidate for a more focused testing approach, so I have rewritten in on top of lldb-test's module-sections functionality. The slight gotcha there was that the Module::GetSectionList does not include the sections from the symbol file until someone manually calls Module::GetSymbolVendor. Normally, this is not an issue, because someone will have initialized the symbol vendor by the time anyone starts looking at the sections. However, when all one this is dump the section list, we run into this problem. I've tried making this behavior more automatic, but it turns out it's not that easy, so for now, I just manually initialize the Symbol Vendor before dumping out the sections in lldb-test. Reviewers: jankratochvil Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D42914 llvm-svn: 326805
* [LLDB] Initial version of PPC64 InstEmulationPavel Labath2018-02-271-0/+3
| | | | | | | | | | | | | | | Summary: Supports common prologue/epilogue instructions. Reviewers: clayborg, labath Reviewed By: clayborg, labath Subscribers: davide, anajuliapc, alexandreyy, lbianc, nemanjai, mgorny, kbarton Differential Revision: https://reviews.llvm.org/D43345 Author: Leandro Lupori <leandro.lupori@gmail.com> llvm-svn: 326224
* Add "lldb-test breakpoint" command and convert the case-sensitivity test to ↵Pavel Labath2018-02-261-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | use it Summary: The command takes two input arguments: a module to use as a debug target and a file containing a list of commands. The command will execute each of the breakpoint commands in the file and dump the breakpoint state after each one. The commands are expected to be breakpoint set/remove/etc. commands, but I explicitly allow any lldb command here, so you can do things like change setting which impact breakpoint resolution, etc. There is also a "-persistent" flag, which causes lldb-test to *not* automatically clear the breakpoint list after each command. Right now I don't use it, but the idea behind it was that it could be used to test more complex combinations of breakpoint commands (set+modify, set+disable, etc.). Right now the command prints out only the basic breakpoint state, but more information can be easily added there. To enable easy matching of the "at least one breakpoint location found" state, the command explicitly prints out the string "At least one breakpoint location.". To enable testing of breakpoints set with an absolute paths, I add the ability to perform rudimentary substitutions on the commands: right now the string %p is replaced by the directory which contains the command file (so, under normal circumstances, this will perform the same substitution as lit would do for %p). I use this command to rewrite the TestBreakpointCaseSensitivity test -- the test was checking about a dozen breakpoint commands, but it was launching a new process for each one, so it took about 90 seconds to run. The new test takes about 0.3 seconds for me, which is approximately a 300x speedup. Reviewers: davide, zturner, jingham Subscribers: luporl, lldb-commits Differential Revision: https://reviews.llvm.org/D43686 llvm-svn: 326112
* ObjectFileELF: Add support for compressed sectionsPavel Labath2017-12-151-1/+2
| | | | | | | | | | | | | | | | 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
* Add a symbols subcommand to lldb-test.Zachary Turner2017-12-021-1/+28
| | | | | | Differential Revision: https://reviews.llvm.org/D40745 llvm-svn: 319599
* Add lldb-test.Zachary Turner2017-12-016-0/+649
This is basically a proof-of-concept and starting point for having a testing-centric tool in LLDB. I'm sure this leaves a lot of room to be desired, but this at least allows us to have something to build on. Right now there is only one command, the `module-sections` command, and I created this command not because it was particularly special, but because it addressed an immediate use case and was extremely simple. Run the tool as `lldb-test module-sections <path-to-object>`. Feel free to add testing related stuff to your heart's content after this goes in. Implementing the commands themselves takes some work, but once they're there they can be reused without writing any code and result in very easy to use and maintain tests. Differential Revision: https://reviews.llvm.org/D40636 llvm-svn: 319504
OpenPOWER on IntegriCloud