summaryrefslogtreecommitdiffstats
path: root/lldb
Commit message (Collapse)AuthorAgeFilesLines
...
* [LLDB] Unit tests basic support for OpenBSDDavid Carlier2018-06-042-15/+23
| | | | | | | | | | | | Add OpenBSD python module in order to support unit tests. Reviewers: labath, zturner Reviewed By: labath Differential Revision: https://reviews.llvm.org/D47692 llvm-svn: 333888
* AppleDWARFIndex: Get function method-ness directly from debug infoPavel Labath2018-06-045-64/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When searching for methods only, we need to do extra work to make sure the functions we get from the apple tables are indeed methods. Previously we were resolving the DIE into a SymbolContext and then checked whether the enclosing CompilerDeclContext is a class (or struct, or union). This patch changes that to operate on the debug info directly. This should be: - simpler - faster - more consistent with the ManualDWARFIndex (which does the same check, only at indexing time). What we lose this ways is for the language plugin to have a say in what it considers to be a "class", but that's probably more flexibility than we need (and if we really wanted to do that in the future, we could implement a more direct way to consult the plugin about this). This also fixes the find-method-local-struct test, which was failing because we were not able to construct a CompilerDeclContext for a local struct correctly. As a drive-by, I rename the DWARFDIE's IsStructClassOrUnion method to match the name on the CompilerDeclContext class. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47470 llvm-svn: 333878
* Python: adjust the include directoriesSaleem Abdulrasool2018-06-041-6/+5
| | | | | | | Restructure the include search order to adjust for libedit. This ensures that the variables are not unused if they are not defined. llvm-svn: 333863
* [lldb, lldm-mi] Fix hanging of -exec-run command.Alexander Polyakov2018-06-033-0/+20
| | | | | | | | | | | | | | Summary: -exec-run command hanged in case of invalid or dummy target. Reviewers: aprantl, stella.stamenova Reviewed By: aprantl Subscribers: ki.stfu, llvm-commits, lldb-commits Differential Revision: https://reviews.llvm.org/D47678 llvm-svn: 333844
* Test commit. Fix typo in comment.Alexander Polyakov2018-06-031-1/+1
| | | | llvm-svn: 333837
* Fix silly error introduced after testing in r333813.James Y Knight2018-06-021-7/+0
| | | | | | Oops. llvm-svn: 333816
* Fix support for distinguishing archive members by timestamp on Darwin.James Y Knight2018-06-027-3/+136
| | | | | | | | | | | | | | | | | | | On Darwin, the binary's symbol table points to debug info in object files -- potentially object files within a static library. Such a library may have multiple entries with the same name, distinguished only by timestamp. The code was already _attempting_ to handle this case (see the code in ObjectContainerBSDArchive::Archive::FindObject which disambiguates via timestamp). But, unfortunately, while the timestamp was taken into account on the _first_ lookup, the result was then cached in a map keyed only off of the path. Added the timestamp to the cache, and added a test case. Differential Revision: https://reviews.llvm.org/D47660 llvm-svn: 333813
* [lit, pdb] Fix two failing PDB tests on WindowsStella Stamenova2018-06-012-8/+8
| | | | | | | | | | | | | | Summary: One of the tests is failing to build because it needs GS-, the second test does not correctly match all the expected function names because newer DIA SDKs annotate the function names with their return type and inputs (e.g. "static long `anonymous namespace'::StaticFunction(int)") Reviewers: asmith, zturner Reviewed By: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47653 llvm-svn: 333790
* [lit, lldbmi] Skip the new break-insert test on WindowsStella Stamenova2018-06-011-0/+4
| | | | | | | | | | | | | | Summary: Skip the new break-insert test on Windows because it hangs and so the test suite never completes. All other lldb-mi tests in the test suite are also skipped on windows Reviewers: asmith, aprantl, polyakov.alex Reviewed By: aprantl Subscribers: ki.stfu, llvm-commits Differential Revision: https://reviews.llvm.org/D47651 llvm-svn: 333789
* XFAIL TestIRMemoryMap.test on WindowsVedant Kumar2018-06-011-1/+1
| | | | | | | | I've xfailed this test instead of skipping it by request (https://reviews.llvm.org/D47646). Bug: https://bugs.llvm.org/show_bug.cgi?id=37656 llvm-svn: 333787
* Fix Module::FindTypes to return the correct number of matches.Frederic Riss2018-06-016-0/+43
| | | | | | | | | | | | | | | | | | | | | | In r331719, I changed Module::FindTypes not to limit the amount of types returned by the Symbol provider, because we want all possible matches to be able to filter them. In one code path, the filtering was applied to the TypeList without changing the number of types that gets returned. This is turn could cause consumers to access beyond the end of the TypeList. This patch fixes this case and also adds an assertion to TypeList::GetTypeAtIndex to catch those obvious programming mistakes. Triggering the condition in which we performed the incorrect access was not easy. It happened a lot in mixed Swift/ObjectiveC code, but I was able to trigger it in pure Objective C++ although in a contrieved way. rdar://problem/40254997 llvm-svn: 333786
* Disable TestIRMemoryMap.test on WindowsVedant Kumar2018-06-011-0/+2
| | | | | | | It's been pointed out in https://reviews.llvm.org/D47646 that lldb-test fails to create a usable process on Windows when running this test. llvm-svn: 333785
* [lldb, process] Fix occasional hang when launching a process in LLDBStella Stamenova2018-06-013-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Occasionally, when launching a process in lldb (especially on windows, but not limited to), lldb will hang before the process is launched and it will never recover. This happens because the timing of the processing of the state changes can be slightly different. The state changes that are issued are: 1) SetPublicState(eStateLaunching) 2) SetPrivateState(eStateLaunching) 3) SetPublicState(eStateStopped) 4) SetPrivateState(eStateStopped) What we expect to see is: public state: launching -> launching -> stopped private state: launching -> stopped What we see is: public state: launching -> stopped -> launching private state: launching -> stopped The second launching change to the public state is issued when WaitForProcessStopPrivate calls HandlePrivateEvent on the event which was created when the private state was set to launching. HandlePrivateEvent has logic to determine whether to broadcase the event and a launching event is *always* broadcast. At the same time, when the stopped event is processed by WaitForProcessStopPrivate next, the function exists and that event is never broadcast, so the public state remains as launching. HandlePrivateEvent does two things: determine whether there's a next action as well as determine whether to broadcast the event that was processed. There's only ever a next action set if we are trying to attach to a process, but WaitForProcessStopPrivate is only ever called when we are launching a process or connecting remotely, so the first part of HandlePrivateEvent (handling the next action) is irrelevant for WaitForProcessStopPrivate. As far as broadcasting the event is concerned, since we are handling state changes that already occurred to the public state (and are now duplicated in the private state), I believe the broadcast step is unnecessary also (and in fact, it causes the hang). This change removes the call to HandlePrivateEvent from inside WaitForProcessStopPrivate. Incidentally, there was also a bug filed recently that is the same issue: https://bugs.llvm.org/show_bug.cgi?id=37496 Reviewers: asmith, labath, zturner, jingham Reviewed By: zturner, jingham Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47609 llvm-svn: 333781
* Add dependency on clang-headers when building LLDB.framework using CMakeAlex Langford2018-06-011-0/+3
| | | | | | | | | | | | | | | Summary: The LLDB.framework generated when building with CMake + Ninja/Make is completely missing the clang headers. Although the code to copy them exists, we don't even generate them unless we're building LLDB standalone. Reviewers: clayborg, labath, sas Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D47612 llvm-svn: 333777
* Add .debug_names section glue codePavel Labath2018-06-017-0/+23
| | | | llvm-svn: 333743
* [lit] Remove the *.test suffix from two test inputsVedant Kumar2018-05-313-4/+4
| | | | | | | This prevents the test inputs from being marked as unsupported tests, due to their lack of RUN lines. llvm-svn: 333701
* [IRMemoryMap] Test interleaved Mallocs and FreesVedant Kumar2018-05-313-3/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-312-3/+11
| | | | | | | | r333583 introduced testing for IRMemoryMap's process-side allocations (eAllocationPolicyProcessOnly). This adds support for the host-side variety (eAllocationPolicyHostOnly). llvm-svn: 333698
* [IRMemoryMap] Fix the alignment adjustment in MallocVedant Kumar2018-05-314-33/+49
| | | | | | | | | | | | | | | | | | | | This prevents Malloc from allocating the same chunk of memory twice, as a byproduct of an alignment adjustment which gave the client access to unallocated memory. Prior to this patch, the newly-added test failed with: $ lldb-test ir-memory-map ... ir-memory-map-overlap1.test ... Command: malloc(size=64, alignment=32) Malloc: address = 0x1000cd080 Command: malloc(size=64, alignment=8) Malloc: address = 0x1000cd0b0 Malloc error: overlapping allocation detected, previous allocation at [0x1000cd080, 0x1000cd0c0) Differential Revision: https://reviews.llvm.org/D47551 llvm-svn: 333697
* Set m_struct_valid to initial value in ctor. Jason Molenda2018-05-311-1/+2
| | | | | | | | Patch from Tom Tromey <ttromey@mozilla.com>. Differential Revision: https://reviews.llvm.org/D47481 llvm-svn: 333690
* Remove infinite recursion due to FileSpec change.Jonas Devlieghere2018-05-311-5/+3
| | | | | | | | | Fixes infinite recursion due to change in how FileSpec deals with removing the last path component. Fixes timout for TestMiniDumpNew.py llvm-svn: 333666
* Remove the TestSequenceFunctions "example" testPavel Labath2018-05-311-34/+0
| | | | | | | | This test was using unittest (not unittest2) as the test framework, and it worked with dotest only by accident. Remove it as we have a much more realistic example test in test/testcases/sample_test. llvm-svn: 333640
* Remove append parameter to FindGlobalVariablesPavel Labath2018-05-3124-144/+88
| | | | | | | | | | | | | | | | | | | 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
* Simplify DWARFUnit::m_die_array swap() to use shrink_to_fit()Jan Kratochvil2018-05-311-9/+1
| | | | | | | | | rL145086 introduced m_die_array.shrink_to_fit() implemented by exact_size_die_array.swap, it was before LLVM became written in C++11. Differential revision: https://reviews.llvm.org/D47492 llvm-svn: 333636
* [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-303-20/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [LLDB] Re-apply r303907 that's reverted by mistakeTim Shen2018-05-302-7/+13
| | | | llvm-svn: 333552
* [FileSpec] Re-implmenet removeLastPathComponentJonas Devlieghere2018-05-303-30/+57
| | | | | | | | | | | | | | | | | | | | | When reading DBGSourcePathRemapping from a dSYM, we remove the last two path components to make the source lookup more general. However, when dealing with a relative path that has less than 2 components, we ended up with an invalid (empty) FileSpec. This patch changes the behavior of removeLastPathComponent to remove the last path component, if possible. It does this by checking whether a parent path exists, and if so using that as the new path. We rely entirely on LLVM's path implementation to do the heavy lifting. We now also return a boolean which indicates whether the operator was successful or not. Differential revision: https://reviews.llvm.org/D47495 rdar://37791687 llvm-svn: 333540
* @skipUnlessDarwin TestOrderedSetPavel Labath2018-05-301-0/+1
| | | | llvm-svn: 333526
* Fix return value of DWARFUnit::ExtractDIEsIfNeeded()Jan Kratochvil2018-05-301-6/+5
| | | | | | This is a leftover regression from: https://reviews.llvm.org/D46810 llvm-svn: 333517
* [LLDB] Revert r303907.Tim Shen2018-05-292-13/+7
| | | | | | See https://reviews.llvm.org/rL303907 for details about the bug. llvm-svn: 333478
* [ObjC] Add a Makefile for the test added in r333465.Davide Italiano2018-05-291-0/+6
| | | | | | | | | Not strictly necessary, but makes the test more robust in case we end up changing the defaults. <rdar://problem/40622096> llvm-svn: 333466
* [ObjC] Fix the formatter for NSOrderedSet.Davide Italiano2018-05-293-28/+30
| | | | | | | | While I'm here, delete some dead code. <rdar://problem/40622096> llvm-svn: 333465
* Remove unused DWARFUnit::HasDIEsParsed()Jan Kratochvil2018-05-292-4/+0
| | | | | | | It was not implemented correctly after https://reviews.llvm.org/D46810 but then it has not been used anywhere anyway. llvm-svn: 333452
* Fix compiler unused variable warning in DWARFUnitJan Kratochvil2018-05-291-2/+0
| | | | | | Alex Langford has reported it from: https://reviews.llvm.org/D46810 llvm-svn: 333449
* Remove lldb-private headers when building LLDB.framework with CMakeAlex Langford2018-05-291-2/+1
| | | | | | | | | | | | | | | | | | | | Summary: Generating LLDB.framework when building with CMake+Ninja will copy the lldb-private headers because public_headers contains them, even though we try to make sure they don't get copied by removing root_private_headers from root_public_headers. This patch also removes SystemInitializerFull.h from the LLDB.framework headers when building with CMake. Reviewers: compnerd, sas, labath, beanz, zturner Reviewed By: labath Subscribers: clayborg, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D47278 llvm-svn: 333444
* Fix DWARFUnit::GetUnitDIEPtrOnly stale pointerJan Kratochvil2018-05-295-80/+130
| | | | | | | | | | | | | GetUnitDIEPtrOnly() needs to return pointer to the first DIE. But the first element of m_die_array after ExtractDIEsIfNeeded(true) may move in memory after later ExtractDIEsIfNeeded(false). DWARFDebugInfoEntry::collection m_die_array is std::vector, its data may move during its expansion. Differential revision: https://reviews.llvm.org/D46810 llvm-svn: 333437
* [lit] Add support for passing arguments to dotest.py via lit.Jonas Devlieghere2018-05-291-0/+8
| | | | | | | | | | | | | | | | The lldb test suite is highly configurable. While part of this configuration takes place at configure/build-time, a common scenario involves running the test suite several times with different configuration. For example, we might want to test the current lldb against inferiors built with different compilers. This configuration was already possible for lldb-dotest, but was lacking for the lit counterpart. It is now possible to pass arguments to pass arguments like this: ./bin/llvm-lit ../llvm/tools/lldb/lit/Suite/ -Ddotest-args="-foo;-bar" llvm-svn: 333432
* [test] Fix --framework argument passed to dotest.Jonas Devlieghere2018-05-292-3/+7
| | | | | | | | | | The framework argument was broken when I removed the generator expressions upstream. I replaced $<TARGET_FILE_DIR:liblldb> with ${LLVM_LIBRARY_OUTPUT_INTDIR}) which is not correct. rdar://40534649 llvm-svn: 333412
* XFAIL TestMachCore for windows hostsPavel Labath2018-05-291-0/+1
| | | | | | | | It's been failing since I enabled the test for non-darwin targets. I made it reference the same bug as the linux core, as it's likely that the root cause is the same. llvm-svn: 333401
* Remove Linux-specific includes for posix/FileSystem.cppBruce Mitchener2018-05-291-5/+0
| | | | | | | | | | | | | | Summary: This improves the process of cross-compiling from macOS to Linux since these files aren't used / needed at all. Reviewers: clayborg, labath Subscribers: lldb-commits, krytarowski Differential Revision: https://reviews.llvm.org/D47420 llvm-svn: 333400
* Typo fixes.Bruce Mitchener2018-05-2937-72/+72
| | | | | | | | | | Reviewers: javed.absar Subscribers: ki.stfu, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D47421 llvm-svn: 333399
* ManualDWARFIndex: Treat DW_TAG_subprogram and DW_TAG_inlined_subroutine the ↵Pavel Labath2018-05-293-23/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | same way Summary: We were treating subprograms and inlined subroutines differently when building the index. The difference was in which indexes were individual tags inserted (subprograms went to all indexes, where as inlined subroutines only into the basename and full name indexes). This seems like an error, because an inlined subroutine can still represent an C++ or an ObjC method. I don't see anything in the subprogram branch which should not apply to an inlined subroutine, so I propose to just treat them identically. This makes searching for an inlined method behave the same way as for the apple index. I write an assembly-based test because I did not want to depend on particular clang inlining behavior (and because I wanted to see how hard would it be). Reviewers: clayborg, JDevlieghere Subscribers: eraman, lldb-commits Differential Revision: https://reviews.llvm.org/D47368 llvm-svn: 333398
* NFC: Fix some comment typos.Bob Wilson2018-05-284-4/+4
| | | | llvm-svn: 333364
* Fix memory leak in SubsPrimitiveParmItaniumRaphael Isemann2018-05-271-1/+3
| | | | | | | | | | | | | | Summary: FastDemangle gives us a C-string that we own (which is allocated in SymbolDemangler::GetDemangledCopy). As we are not deleting the string, we leak memory whenever we call SubsPrimitiveParmItanium. Reviewers: javed.absar Subscribers: kristof.beyls, chrib, lldb-commits Differential Revision: https://reviews.llvm.org/D47418 llvm-svn: 333353
* Add missing includes to some LLDB headers.Raphael Isemann2018-05-264-0/+7
| | | | | | | | | | Summary: When compiling with modules, these missing includes cause the build to fail (as the header can't be compiled into a module). Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47412 llvm-svn: 333345
* Don't include headers from inside a namespace in MIUtilSingletonHelper.hRaphael Isemann2018-05-261-2/+2
| | | | | | | | Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47410 llvm-svn: 333343
* Forward declare DumpValueObjectOptions in ValueObject.hRaphael Isemann2018-05-262-1/+4
| | | | | | | | | | | | Summary: This resolves unnecessary the header dependency from Core to DataFormatters. Patch is necessary for the introduction of C++ modules to the LLDB build system. Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D47409 llvm-svn: 333342
* Fix Xcode build broken by SystemInitializerFull.h moveAlex Langford2018-05-251-2/+2
| | | | llvm-svn: 333322
OpenPOWER on IntegriCloud