summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Target
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Add a SubsystemRAII that takes care of calling Initialize and ↵Raphael Isemann2019-12-231-23/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Terminate in the unit tests Summary: Many of our tests need to initialize certain subsystems/plugins of LLDB such as `FileSystem` or `HostInfo` by calling their static `Initialize` functions before the test starts and then calling `::Terminate` after the test is done (in reverse order). This adds a lot of error-prone boilerplate code to our testing code. This patch adds a RAII called SubsystemRAII that ensures that we always call ::Initialize and then call ::Terminate after the test is done (and that the Terminate calls are always in the reverse order of the ::Initialize calls). It also gets rid of all of the boilerplate that we had for these calls. Per-fixture initialization is still not very nice with this approach as it would require some kind of static unique_ptr that gets manually assigned/reseted from the gtest SetUpTestCase/TearDownTestCase functions. Because of that I changed all per-fixture setup to now do per-test setup which can be done by just having the SubsystemRAII as a member of the test fixture. This change doesn't influence our normal test runtime as LIT anyway runs each test case separately (and the Initialize/Terminate calls are anyway not very expensive). It will however make running all tests in a single executable slightly slower. Reviewers: labath, JDevlieghere, martong, espindola, shafik Reviewed By: labath Subscribers: mgorny, rnkovacs, emaste, MaskRay, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71630
* Modernize the rest of the Find.* API (NFC)Adrian Prantl2019-10-171-2/+3
| | | | | | | | | | | | This patch removes the size_t return value and the append parameter from the remainder of the Find.* functions in LLDB's internal API. As in the previous patches, this is motivated by the fact that these parameters aren't really used, and in the case of the append parameter were frequently implemented incorrectly. Differential Revision: https://reviews.llvm.org/D69119 llvm-svn: 375160
* Move ProcessInstanceInfoTest to UtilityPavel Labath2019-08-262-94/+0
| | | | | | The class under test was moved in r355342. This moves the test code too. llvm-svn: 369907
* ProcessInstanceInfo: Fix dumping of invalid user idsPavel Labath2019-08-261-0/+18
| | | | | | | Don't attempt to print invalid user ids. Previously, these would come out as UINT32_MAX, or as an assertion failure. llvm-svn: 369906
* [ExecutionContext] Return the target/process byte order.Jonas Devlieghere2019-08-072-2/+124
| | | | | | | | | | | | | Currently ExecutionContext::GetByteOrder() always returns the host byte order. This seems like a simple mistake: the return keyword appears to have been omitted by accident. This patch fixes that and adds a unit test. Bugreport: https://llvm.org/PR37950 Differential revision: https://reviews.llvm.org/D48704 llvm-svn: 368181
* SymbolVendor: Move Symtab construction into the SymbolFilePavel Labath2019-07-262-0/+4
| | | | | | | | | | | | | | | Summary: Instead of having SymbolVendor coordinate Symtab construction between Symbol and Object files, make the SymbolVendor function a passthrough, and put all of the logic into the SymbolFile. Reviewers: clayborg, JDevlieghere, jingham, espindola Subscribers: emaste, mgorny, arichardson, MaskRay, lldb-commits Differential Revision: https://reviews.llvm.org/D65208 llvm-svn: 367086
* C.128 override, virtual keyword handlingRaphael Isemann2019-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Refactor user/group name resolving codePavel Labath2019-03-042-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This creates an abstract base class called "UserIDResolver", which can be implemented to provide user/group ID resolution capabilities for various objects. Posix host implement a PosixUserIDResolver, which does that using posix apis (getpwuid and friends). PlatformGDBRemote forwards queries over the gdb-remote link, etc. ProcessInstanceInfo class is refactored to make use of this interface instead of taking a platform pointer as an argument. The base resolver class already implements caching and thread-safety, so implementations don't have to worry about that. The main motivating factor for this was to remove external dependencies from the ProcessInstanceInfo class (so it can be put next to ProcessLaunchInfo and friends), but it has other benefits too: - ability to test the user name caching code - ability to test ProcessInstanceInfo dumping code - consistent interface for user/group resolution between Platform and Host classes. Reviewers: zturner, clayborg, jingham Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D58167 llvm-svn: 355323
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-192-8/+6
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-012-4/+3
| | | | | | | | | 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
* [FileSystem] Remove Exists() from FileSpecJonas Devlieghere2018-11-011-3/+4
| | | | | | | | | This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 llvm-svn: 345854
* [FileSystem] Remove GetByteSize() from FileSpecJonas Devlieghere2018-11-011-2/+2
| | | | | | | | | This patch removes the GetByteSize method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53788 llvm-svn: 345812
* [FileSystem] Extend file system and have it use the VFS.Jonas Devlieghere2018-10-311-1/+4
| | | | | | | | | | | | | | | | This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
* Remove UUID::SetFromCStringPavel Labath2018-06-211-1/+1
| | | | | | Replace uses with SetFromStringRef. NFC. llvm-svn: 335246
* Replace HostInfo::GetLLDBPath with specific functionsPavel Labath2018-06-191-2/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 llvm-svn: 335052
* Fix PathMappingListTest on windowsPavel Labath2018-06-141-3/+11
| | | | | | | | | | | | | r334615 changed the the value of FileSpec.IsRelative("/") for windows path syntax. We previously considered it absolute but now it is considered relative (I guess because it's interpretation depends on the current drive). This cause a failure in PathMappingList test, which assumed that "/" will not get remapped as it is an absolute path. As this is no longer true on windows, I replace "/" with a really absolute path. llvm-svn: 334702
* Fix PathMappingList tests on windowsPavel Labath2018-05-231-25/+24
| | | | | | | | | | The tests added in r332842 don't work on windows, because they do path comparisons on strings, and on windows, the paths coming out of the mappings had backslashes in them. This switches comparisons to FileSpecs, so the results come out right. llvm-svn: 333074
* Fix PathMappingList for relative and empty paths after recent FileSpec ↵Greg Clayton2018-05-212-0/+110
| | | | | | | | | | | | | | | | | | normalization changes PathMappingList was broken for relative and empty paths after normalization changes in FileSpec. There were also no tests for PathMappingList so I added those. Changes include: Change PathMappingList::ReverseRemapPath() to take FileSpec objects instead of ConstString. The only client of this was doing work to convert to and from ConstString objects for no reason. Normalize all paths prefix and replacements that are added to the PathMappingList vector so they match the paths that have been already normalized in the debug info Unify code in the two forms of PathMappingList::RemapPath() so only one contains the actual functionality. Prior to this, there were two versions of this code. Use FileSpec::AppendPathComponent() and remove a long standing TODO so paths are correctly appended to each other. Added tests for absolute, relative and empty paths. Differential Revision: https://reviews.llvm.org/D47021 llvm-svn: 332842
* FileSpec: Remove PathSyntax enum and use llvm version insteadPavel Labath2018-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: The llvm version of the enum has the same enumerators, with stlightly different names, so this is mostly just a search&replace exercise. One concrete benefit of this is that we can remove the function for converting between the two enums. To avoid typing llvm::sys::path::Style::windows everywhere I import the enum into the FileSpec class, so it can be referenced as FileSpec::Style::windows. Reviewers: zturner, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D46753 llvm-svn: 332247
* Fix a compiler warning in ModuleCacheTest.cpp, NFCVedant Kumar2018-02-231-2/+2
| | | | llvm-svn: 325974
* cmake + xcode: prevent gtests from using includes from project rootTim Hammerquist2017-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: At present, several gtests in the lldb open source codebase are using #include statements rooted at $(SOURCE_ROOT)/${LLDB_PROJECT_ROOT}. This patch cleans up this directory/include structure for both CMake and Xcode build systems. rdar://problem/33835795 Reviewers: zturner, jingham, beanz Reviewed By: beanz Subscribers: emaste, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D36598 llvm-svn: 314849
* [unittests] Add a helper function for getting an input filePavel Labath2017-06-292-8/+5
| | | | | | | | | | | | | | | | | Summary: Fetching an input file required about five lines of code, and this was repeated in multiple unit tests, with slight variations. Add a helper function for doing that into the lldbUtilityMocks module (which I rename to lldbUtilityHelpers to commemorate the fact it includes more than mocks) Reviewers: zturner, eugene Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34683 llvm-svn: 306668
* Rename Error -> Status.Zachary Turner2017-05-121-3/+3
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Add format_provider for the MemoryRegionInfo::OptionalBool enumPavel Labath2017-02-222-0/+21
| | | | llvm-svn: 295821
* Fix unittests after r295088Pavel Labath2017-02-151-0/+0
| | | | | | | This resurrects TestModule.so which got lost during the move and is needed for the ModuleCache test. llvm-svn: 295171
* Remove dependencies from Utility to Core and Target.Zachary Turner2017-02-143-0/+192
With this patch, the only dependency left is from Utility to Host. After this is broken, Utility will finally be standalone. Differential Revision: https://reviews.llvm.org/D29909 llvm-svn: 295088
OpenPOWER on IntegriCloud