summaryrefslogtreecommitdiff
path: root/lldb/utils
Commit message (Collapse)AuthorAgeFilesLines
* [NFC][TargetParser] Replace uses of llvm/Support/Host.hArchibald Elliott2023-02-101-1/+1
| | | | | | | The forwarding header is left in place because of its use in `polly/lib/External/isl/interface/extract_interface.cc`, but I have added a GCC warning about the fact it is deprecated, because it is used in `isl` from where it is included by Polly.
* [lldb] [utils] Fix linking lit-cpuid to LLVM dylibMichał Górny2022-12-261-1/+4
| | | | | | | | | | | | Use `LINK_COMPONENTS` instead of manual `target_link_libraries` to link lit-cpuid to LLVM components. This ensures that dylib is used along with `LLVM_LINK_LLVM_DYLIB` rather than linking to component libraries that may not be installed. This fixes build failure on Gentoo after a dep on TargetParser component was added in f09cf34d00625e57dea5317a3ac0412c07292148. Differential Revision: https://reviews.llvm.org/D140671
* [Support] Move TargetParsers to new componentArchibald Elliott2022-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fairly large changeset, but it can be broken into a few pieces: - `llvm/Support/*TargetParser*` are all moved from the LLVM Support component into a new LLVM Component called "TargetParser". This potentially enables using tablegen to maintain this information, as is shown in https://reviews.llvm.org/D137517. This cannot currently be done, as llvm-tblgen relies on LLVM's Support component. - This also moves two files from Support which use and depend on information in the TargetParser: - `llvm/Support/Host.{h,cpp}` which contains functions for inspecting the current Host machine for info about it, primarily to support getting the host triple, but also for `-mcpu=native` support in e.g. Clang. This is fairly tightly intertwined with the information in `X86TargetParser.h`, so keeping them in the same component makes sense. - `llvm/ADT/Triple.h` and `llvm/Support/Triple.cpp`, which contains the target triple parser and representation. This is very intertwined with the Arm target parser, because the arm architecture version appears in canonical triples on arm platforms. - I moved the relevant unittests to their own directory. And so, we end up with a single component that has all the information about the following, which to me seems like a unified component: - Triples that LLVM Knows about - Architecture names and CPUs that LLVM knows about - CPU detection logic for LLVM Given this, I have also moved `RISCVISAInfo.h` into this component, as it seems to me to be part of that same set of functionality. If you get link errors in your components after this patch, you likely need to add TargetParser into LLVM_LINK_COMPONENTS in CMake. Differential Revision: https://reviews.llvm.org/D137838
* [test] Fix LLDB tests with just-built libcxx when using a target directory.Jordan Rupprecht2022-10-262-0/+27
| | | | | | | | | | | | In certain configurations, libc++ headers all exist in the same directory, and libc++ binaries exist in the same directory as lldb libs. When `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is enabled (*and* the host is not Apple, which is why I assume this wasn't caught by others?), this is not the case: most headers will exist in the usual `include/c++/v1` directory, but `__config_site` exists in `include/$TRIPLE/c++/v1`. Likewise, the libc++.so binary exists in `lib/$TRIPLE/`, not `lib/` (where LLDB libraries reside). This also adds the just-built-libcxx functionality to the lldb-dotest tool. The `LIBCXX_` cmake config is borrowed from `libcxx/CMakeLists.txt`. I could not figure out a way to share the cmake config; ideally we would reuse the same config instead of copy/paste. Reviewed By: JDevlieghere, fdeazeve Differential Revision: https://reviews.llvm.org/D133973
* Fix a bug in lldb-dotest that was uncovered by setting no value for ↵Jim Ingham2022-08-311-1/+5
| | | | | | | | | | | | | | dotest_args_str. We were splitting the string, and adding that array to cmd. But split generated [''] which shows up later on as an empty "test directory search path". That got extended to the CWD + "" which generally doesn't have any tests, so lldb-dotest -p SomeRealTest.py would fail with a no matching tests error. Differential Revision: https://reviews.llvm.org/D133075
* [lldb] Fix dotest argument orderFelipe de Azevedo Piovezan2022-08-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running LLDB API tests, a user can override test arguments with LLDB_TEST_USER_ARGS. However, these flags used to be concatenated with a CMake-derived variable LLDB_TEST_COMMON_ARGS, as below: ``` set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS} CACHE INTERNAL STRING) ``` This is problematic, because LLDB_TEST_COMMON_ARGS must be processed first, while LLDB_TEST_USER_ARGS args must be processed last, so that user overrides are respected. Currently, if a user attempts to override one of the "inferred" flags, the user's request is ignored. This is the case, for example, with `--libcxx-include-dir` and `--libcxx-library-dir`. Both flags are needed by the greendragon bots. This commit removes the concatenation above, keeping the two original variables throughout the entire flow, processing the user's flag last. The variable LLDB_TEST_COMMON_ARGS needs to be a CACHE property, but it is modified throughout the CMake file with `set` or `list` or `string` commands, which don't work with properties. As such, a temporary variable `LLDB_TEST_COMMON_ARGS_VAR` is created. This was tested locally by invoking CMake with: -DLLDB_TEST_USER_ARGS="--libcxx-include-dir=blah --libcxx-library-dir=blah2" and checking that tests failed appropriately. Differential Revision: https://reviews.llvm.org/D132642
* [lldb] Refactor command option enum values (NFC)Jonas Devlieghere2022-07-141-6/+2
| | | | | | | | | | | | Refactor the command option enum values and the command argument table to connect the two. This has two benefits: - We guarantee that two options that use the same argument type have the same accepted values. - We can print the enum values and their description in the help output. (D129707) Differential revision: https://reviews.llvm.org/D129703
* [lldb] Match test dependencies name to other LLVM projects.Daniel Rodríguez Troitiño2021-05-212-2/+2
| | | | | | | | | | | | | | | | Other LLVM projects use the suffix `-depends` for the test dependencies, however LLDB uses `-deps` and seems to be the only project under the LLVM to do so. In order to make the projects more homogeneous, switch all the references to `lldb-test-deps` to `lldb-test-depends`. Additionally, provide a compatibility target with the old name and depending on the new name, in order to not break anyone workflow. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D102889
* Reapply "[lldb/test] Automatically find debug servers to test"Pavel Labath2021-02-212-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reapplies 7df4eaaa93/D96202, which was reverted due to issues on windows. These were caused by problems in the computation of the liblldb directory, which was fixed by D96779. The original commit message was: Our test configuration logic assumes that the tests can be run either with debugserver or with lldb-server. This is not entirely correct, since lldb server has two "personalities" (platform server and debug server) and debugserver is only a replacement for the latter. A consequence of this is that it's not possible to test the platform behavior of lldb-server on macos, as it is not possible to get a hold of the lldb-server binary. One solution to that would be to duplicate the server configuration logic to be able to specify both executables. However, that seems excessively redundant. A well-behaved lldb should be able to find the debug server on its own, and testing lldb with a different (lldb-|debug)server does not seem very useful (even in the out-of-tree debugserver setup, we copy the server into the build tree to make it appear "real"). Therefore, this patch deletes the configuration altogether and changes the low-level server retrieval functions to be able to both lldb-server and debugserver paths. They do this by consulting the "support executable" directory of the lldb under test. Differential Revision: https://reviews.llvm.org/D96202
* Revert "[lldb/test] Automatically find debug servers to test"Pavel Labath2021-02-112-0/+4
| | | | | The commit 7df4eaaa937332c0617aa665080533966e2c98a0 appears to break the windows bot. Revert while I investigate.
* [lldb/test] Automatically find debug servers to testPavel Labath2021-02-112-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Our test configuration logic assumes that the tests can be run either with debugserver or with lldb-server. This is not entirely correct, since lldb server has two "personalities" (platform server and debug server) and debugserver is only a replacement for the latter. A consequence of this is that it's not possible to test the platform behavior of lldb-server on macos, as it is not possible to get a hold of the lldb-server binary. One solution to that would be to duplicate the server configuration logic to be able to specify both executables. However, that seems excessively redundant. A well-behaved lldb should be able to find the debug server on its own, and testing lldb with a different (lldb-|debug)server does not seem very useful (even in the out-of-tree debugserver setup, we copy the server into the build tree to make it appear "real"). Therefore, this patch deletes the configuration altogether and changes the low-level server retrieval functions to be able to both lldb-server and debugserver paths. They do this by consulting the "support executable" directory of the lldb under test. Differential Revision: https://reviews.llvm.org/D96202
* [lldb/cmake] Reduce duplication in generation lldb-dotestPavel Labath2021-02-051-48/+29
| | | | | | | | Use indirection to avoid duplicated long lists of variables. Depends on D95261. Differential Revision: https://reviews.llvm.org/D96034
* [lldb/test] Reduce API test tools configuration boilerplatePavel Labath2021-02-052-14/+6
| | | | | | | | | | Replace the dotest command line options and various cmake variables, which are used for passing the locations of llvm tools to the API tests with a single variable, which points to the directory these tools are placed in. Besides reducing repetition, this also makes things more similar to how "normal" llvm tests are configured. Differential Revision: https://reviews.llvm.org/D95261
* [lldb] Remove LLDB session dir and just store test traces in the respective ↵Raphael Isemann2020-12-042-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test build directory Test runs log some of their output to files inside the LLDB session dir. This session dir is shared between all tests, so all the tests have to make sure they choose a unique file name inside that directory. We currently choose by default `<test-class-name>-<test-method-name>` as the log file name. However, that means that if not every test class in the test suite has a unique class name, then we end up with a race condition as two tests will try to write to the same log file. I already tried in D83767 changing the format to use the test file basename instead (which we already require to be unique for some other functionality), but it seems the code for getting the basename didn't work on Windows. This patch instead just changes that dotest stores the log files in the build directory for the current test. We know that directory is unique for this test, so no need to generate some unique file name now. Also removes all the environment vars and parameters related to the now unused session dir. The new log paths now look like this for a failure in 'TestCppOperators`: ``` ./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_dwarf/Failure.log ./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_dsym/Failure.log ./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_gmodules/Failure.log ``` Reviewed By: labath Differential Revision: https://reviews.llvm.org/D92498
* [lldb] Delete lldb/utils/testVedant Kumar2020-10-2810-1636/+0
| | | | | | | These utilities aren't useful any more -- delete them as a cleanup. Discussion: http://lists.llvm.org/pipermail/lldb-dev/2020-October/016536.html
* [lldb] Hoist -s (trace directory) argument out of LLDB_TEST_COMMON_ARGS (NFC)Jonas Devlieghere2020-09-292-4/+11
| | | | | | Give the trace directory argument its own variable (LLDB_TEST_TRACE_DIRECTORY) so that we can configure it in lit.site.cfg.py if we so desire.
* [lldb] Hoist --server argument out of LLDB_TEST_COMMON_ARGS (NFC)Jonas Devlieghere2020-09-292-1/+10
| | | | | Give the server argument its own variable (LLDB_TEST_SERVER) so that we can configure it in lit.site.cfg.py if we so desire.
* [lldb] Configure LLDB_FRAMEWORK_DIR in multi-generator buildsJonas Devlieghere2020-09-292-1/+6
|
* [lldb, tests] Correctly configure the yaml2obj pathsStella Stamenova2020-09-101-1/+1
| | | | | | | | They are currently not being set correctly for the case of multi-config generators like XCode and VS. There's also a typo in one of the cmake files. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D87466
* [lldb] Hoist --framework argument out of LLDB_TEST_COMMON_ARGS (NFC)Jonas Devlieghere2020-08-281-0/+2
| | | | | Give the framework argument its own variable (LLDB_FRAMEWORK_DIR) so that we can configure it in lit.site.cfg.py if we so desire.
* [lldb] Get rid of helper CMake variables for PythonJonas Devlieghere2020-08-171-1/+1
| | | | | | | | | | | | | | This patch is a big sed to rename the following variables: s/PYTHON_LIBRARIES/Python3_LIBRARIES/g s/PYTHON_INCLUDE_DIRS/Python3_INCLUDE_DIRS/g s/PYTHON_EXECUTABLE/Python3_EXECUTABLE/g s/PYTHON_RPATH/Python3_RPATH/g I've also renamed the CMake module to better express its purpose and for consistency with FindLuaAndSwig. Differential revision: https://reviews.llvm.org/D85976
* [lldb] Improve diagnostics in lldb-repro when replay failsJonas Devlieghere2020-08-131-1/+6
| | | | | | | - Print the replay invocation. - Keep the reproducer around. - Return the "opposite" exit code so we don't have to rely on FileCheck to fail the test when the expected exit code is non-zero.
* [lldb/Test] Fix missing yaml2obj in Xcode standalone build.Jonas Devlieghere2020-07-102-0/+7
| | | | | Rather than trying to find the yaml2obj from dotest we should pass it in like we do for dsymutil and FileCheck.
* [lldb/Reproducers] Rename developer-oriented reproducer flags.Jonas Devlieghere2020-07-091-1/+1
| | | | | | | This is a preparatory rename of the developer facing reproducer flags. reproducer-skip-version-check -> reproducer-no-version-check reproducer-auto-generate -> reproducer-generate-on-quit
* [lldb/Utils] Serialize exit code in lldb-repro.pyJonas Devlieghere2020-05-051-3/+12
| | | | | | | | | | | | | | | After 61d5b0e66394 more shell test are expected to exit with a non-zero status code. Because the exit status is computed in the driver and not behind the SB API layer, reproducers don't know about it and always return 0 unless replay failed. This discrepancy means that these tests don't work with lldb-repro.py and skipping them for this reason would be a pity. To solve this problem, the script now serializes the exit code during capture and returns that during replay. These is an assert that ensures that replay exits with a zero exit status to prevent replay failures from being silently ignored.
* Another attempt of D77452 - da0e91fee614e8686f48db28e6507c8abe061fc2Walter Erquinigo2020-04-152-0/+7
| | | | | | | | | [intel-pt] Improve the way the test determines whether to run - Now I'm creating a default value for the new test parameter - I fixed a small mistake in the skipping logic of the test ... I forgot to clear the cmake cache when testing my diff
* Revert "[intel-pt] Improve the way the test determines whether to run"Walter Erquinigo2020-04-152-7/+0
| | | | | | | | This reverts commit da0e91fee614e8686f48db28e6507c8abe061fc2. There's a failure in http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/8584 caused by a missing python object.
* [intel-pt] Improve the way the test determines whether to runWalter Erquinigo2020-04-152-0/+7
| | | | | | | | | | | | | | | | | | | | | Summary: @labath raised a concern on the way I was skipping this test. I think that was fair and I found a better way. Now I'm skipping if the CMAKE flag LLDB_BUILD_INTEL_PT is false. I added an enabled_plugins entry in the dotest configuration, which gets set by lit or lldb-dotest. The only available plugin right now is 'intel-pt', but I imagine it will be useful in the future for other kinds of plugins that get determined at configuration time. I didn't want to add a new argument option --enable-intel-pt or something or the sort, as it wouldn't be useful for other cases. Reviewers: labath, clayborg Subscribers: lldb-commits, labath Tags: #lldb Differential Revision: https://reviews.llvm.org/D77452
* [lldb]/Tablegen] Use ElementType instead of DefaultValueUnsingedJonas Devlieghere2020-03-201-3/+12
| | | | | | | | | | | | | The fourth field in the property struct is the default unsigned or enum value for all types, except for Array and Dictionary types. For those, it is the element type. During the tablegen conversion, this was incorrectly translated to DefaultValueUnsigned with a value corresponding to the OptionValue: enum type. So for OptionValue::eTypeString this became DefaultUnsignedValue<16>. This patch extends the tablegen backend to understand ElementType to express this as ElementType<"String">. Differential revision: https://reviews.llvm.org/D76535
* [lldb/Utils] Use PYTHON_EXECUTABLE to configure lldb-dotest's shebangJonas Devlieghere2020-03-151-1/+1
| | | | | | | | Ideally we'd want all shebangs to be configurable, but that's not a viable solution. Given that lldb-dotest is already configured, we might as well make sure it uses the correct interpreter. Differential revision: https://reviews.llvm.org/D76167
* [lldb] Update header guards to be consistent and compliant with LLVM (NFC)Jonas Devlieghere2020-02-172-4/+4
| | | | | | | | | LLDB has a few different styles of header guards and they're not very consistent because things get moved around or copy/pasted. This patch unifies the header guards across LLDB and converts everything to match LLVM's style. Differential revision: https://reviews.llvm.org/D74743
* [lldb\utils] Place lldb-repro in a per-configuration directory to support ↵Stella Stamenova2020-02-062-3/+22
| | | | | | | | | | | | | | | | multi-configuration generators Summary: Currently, lldb-repro is placed in the wrong location for multi-configuration generators. For example, in the case of VS, it is placed in a directory $(Configuration) instead of in each of Debug, Release, etc. Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: mgorny, lldb-commits, asmith Tags: #lldb Differential Revision: https://reviews.llvm.org/D74148
* [lldb/tests] Correctly configure the lldb dotest argumentsStella Stamenova2020-02-062-39/+51
| | | | | | | | | | | | | | | | | Summary: When the generator used for CMake is a multi-configuration generator (such as VS), the arguments passed to dotest are not currently configured correctly. There are a couple of issues: 1) The per-configuration files are all generated for the same configuration since the for loop overwrites the properties 2) Not all of the parameters are configured in the lit cfg, so they end up with %(build_mode)s as configuration and they point to non-existent paths Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: mgorny, lldb-commits, asmith Tags: #lldb Differential Revision: https://reviews.llvm.org/D74093
* [lldb] pass --lldb-libs-dir argument to lldb-dotestPavel Labath2020-02-052-0/+4
| | | | This argument was introduced in dcab9736f, but lldb-dotest was not handled.
* [lldb/Reproducers] Fix typo in CMake so we actually replay.Jonas Devlieghere2020-01-301-3/+4
| | | | | | | The CMakeLists.txt had a typo which meant that check-lldb-repro was capturing twice instead of capturing and then replaying. This also uncovered a missing import in lldb-repro.py. This patch fixes both issues.
* Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer2020-01-281-4/+4
| | | | | | | | | | This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
* [lldb/Util] Remove reproducers after replayJonas Devlieghere2020-01-231-1/+6
| | | | | | Except for debugging purposes there's no point in leaving the reproducer behind on disk after replay. This patch adds a cleanup in the replay case.
* [lldb/Util] Fix Python 3 incompatibility in lldb-reproJonas Devlieghere2020-01-231-2/+2
| | | | This fixes: TypeError: Unicode-objects must be encoded before hashing
* [lldb/Util] Use md5 instead of python's hash function.Jonas Devlieghere2020-01-231-4/+6
| | | | | | | Because of the way the Python hash function works, it's not guaranteed to be the same. This was causing a lot of reproducers to be generated for the same tests, even though the CWD or arguments didn't change. Switching to an MD5 hash should fix that.
* [lldb/Util] Fix lldb-repro now it doesn't take a path to lldbJonas Devlieghere2020-01-221-7/+7
| | | | | The indices into the arguments array were off because we no longer pass the path to lldb as the first argument.
* [lldb/Test] Check that attribute exists before comparing its valueJonas Devlieghere2020-01-201-0/+0
|
* [lldb/Util] Add a utility to run transparently capture and replay tests.Jonas Devlieghere2020-01-203-0/+65
| | | | | | | | | | | | | | This patch introduces a small new utility (lldb-repro) to transparently capture and replay debugger sessions through the command line driver. Its used to test the reproducers by running the test suite twice. During the first run, it captures a reproducer for every lldb invocation and saves it to a well-know location derived from the arguments and current working directory. During the second run, the test suite is run again but this time every invocation of lldb replays the previously recorded session. Differential revision: https://reviews.llvm.org/D72823
* [lldb/Cmake] Add a CMakeLists.txt to the utils directory...Jonas Devlieghere2020-01-161-0/+2
| | | | | | ... and include it from the main CMakeLists.txt instead of including the utility subdirectories directly. This is consistent with the other subdirectories and limits the scope of future changes.
* [lldb/Utils] Patch all variables used by lldb-dotest (2/2)Jonas Devlieghere2020-01-151-0/+12
| | | | | | | Instead of passing all the arguments for dotest.py as a single CMake variable, lldb-dotest now uses separate variables for the different test binaries. Before this change they'd all get patched as part of the LLDB_DOTEST_ARGS. We need to patch the new variables as well.
* [lldb/Utils] Patch all variables used by lldb-dotestJonas Devlieghere2020-01-151-0/+12
| | | | | | | Instead of passing all the arguments for dotest.py as a single CMake variable, lldb-dotest now uses separate variables for the different test binaries. Before this change they'd all get patched as part of the LLDB_DOTEST_ARGS. We need to patch the new variables as well.
* [lldb/Utils] Remove vim-lldbJonas Devlieghere2020-01-109-1834/+0
| | | | | | | | | The vim-lldb plugin is unmaintained and doesn't work with a recent vim installation that uses Python 3. This removes it from the LLDB repository. The code is still available under lldb-tools on GitHub like we did with for lldb-mi. (https://github.com/lldb-tools/vim-lldb) Differential revision: https://reviews.llvm.org/D72541
* [lldb/Test] Bypass LLDB_TEST_COMMON_ARGS for certain dotest args (NFC)Jonas Devlieghere2020-01-101-0/+10
| | | | | | | | Rather than serializing every argument through LLDB_TEST_COMMON_ARGS, we can pass some of them directly using their CMake variable. Although this does introduce some code duplication between lit's site config and the lldb-dotest utility, it also means that it becomes easier to override these values (WIP).
* [lldb] Respect previously set values of LLDB_TABLEGEN_EXEAlex Langford2019-12-161-11/+13
| | | | | | | If you set LLDB_TABLEGEN_EXE in a CMake cache file or in the CMake invocation line, your setting isn't respected. Setting up the tablegen for the host will overwrite the value that we set LLDB_TABLEGEN_EXE to, which defeats the whole point of setting it in the first place.
* [LLDB] Fix inline variable only used in assertion. (NFC)Jonas Devlieghere2019-10-251-2/+1
| | | | | | | | | This prevents unused variable warning/error in -DNDEBUG builds. The variable was introduced in 5934cd11ea3e. Patch by: Shu-Chun Weng Differential revision: https://reviews.llvm.org/D69451
* [TableGen] Add asserts to make sure default values match property typeJonas Devlieghere2019-10-251-0/+16
| | | | | | This adds a few asserts to the property TableGen backend to prevent mismatches between property types and their default values. This would've prevented a copy-paste mistake we discovered downstream.