Commit Graph

406 Commits

Author SHA1 Message Date
Pavel Labath 6c99a3469d [lldb] Add support for a "global" lldbinit file
This patch adds introduces a new kind of an lldbinit file. Unlike the
lldbinit in the home directory (useful for customizing lldb to the needs
of a particular user), or the cwd lldbinit file (useful for
project-specific settings), this file can be used to customize an entire
lldb installation to a particular environment.

The feature is enabled at build time, by setting the
LLDB_GLOBAL_INIT_DIRECTORY variable to a path to a directory which
should contain an "lldbinit" file. Lldb will then load the file at
startup, if it exists, and if automatic init loading has not been
disabled. Relative paths will be resolved (at runtime) relative to the
location of the lldb library (liblldb or LLDB.framework).

The system-wide lldbinit file will be loaded first, before any
$HOME/.lldbinit and $CWD/.lldbinit files are processed, so that those
can override any system-wide settings.

More information can be found on the RFC thread at
<https://discourse.llvm.org/t/rfc-system-wide-lldbinit/59933>.

Differential Revision: https://reviews.llvm.org/D119831
2022-02-18 12:30:22 +01:00
John Ericson df31ff1b29 [cmake] Make include(GNUInstallDirs) always below project(..)
Its defaulting logic must go after `project(..)` to work correctly,  but `project(..)` is often in a standalone condition making this
awkward, since the rest of the condition code may also need GNUInstallDirs.

The good thing is there are the various standalone booleans, which I had missed before. This makes splitting the conditional blocks less awkward.

Reviewed By: arichardson, phosek, beanz, ldionne, #libunwind, #libc, #libc_abi

Differential Revision: https://reviews.llvm.org/D117639
2022-01-20 18:59:17 +00:00
John Ericson 9531146899 [lldb] Use `GNUInstallDirs` to support custom installation dirs.
Extracted from D99484. My new plan is to start from the outside and work
inward.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D115570
2021-12-22 00:28:53 +00:00
Michał Górny 209ec8e2ee [lldb] Silence CMake warnings about missing FindFBSDVMCore
Pass QUIET to find_package() in order to quiet the warning about missing
FindFBSDVMCore.cmake.  FBSDVMCore always provides native CMake config
files, therefore providing a fallback module serves no purpose.

Differential Revision: https://reviews.llvm.org/D115882
2021-12-16 18:01:51 +01:00
Michał Górny 9c7fbc3f9b [lldb] Introduce a FreeBSDKernel plugin for vmcores
Introduce a FreeBSDKernel plugin that provides the ability to read
FreeBSD kernel core dumps.  The plugin utilizes libfbsdvmcore to provide
support for both "full memory dump" and minidump formats across variety
of architectures supported by FreeBSD.  It provides the ability to read
kernel memory, as well as the crashed thread status with registers
on arm64, i386 and x86_64.

Differential Revision: https://reviews.llvm.org/D114911
2021-12-14 22:07:20 +01:00
Michał Górny 76c876e7e6 Revert "[lldb] Introduce a FreeBSDKernel plugin for vmcores"
This reverts commit aedb328a4d.
I have failed to make the new tests conditional to the presence
of libfbsdvmcore.
2021-12-14 18:17:54 +01:00
Michał Górny aedb328a4d [lldb] Introduce a FreeBSDKernel plugin for vmcores
Introduce a FreeBSDKernel plugin that provides the ability to read
FreeBSD kernel core dumps.  The plugin utilizes libfbsdvmcore to provide
support for both "full memory dump" and minidump formats across variety
of architectures supported by FreeBSD.  It provides the ability to read
kernel memory, as well as the crashed thread status with registers
on arm64, i386 and x86_64.

Differential Revision: https://reviews.llvm.org/D114911
2021-12-14 18:03:38 +01:00
John Ericson ddcc02dbcc Quote some more destination paths with variables
Just defensive CMake-ing. I pulled this from D115544 and D99484 which
are blocked on some lldb CI failures I don't yet understand. Hoping to land
something smaller in the meantime.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D115566
2021-12-13 17:29:08 +00:00
Med Ismail Bennani 30fc88bf1d Revert "Revert "Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM"""
This reverts commit 492de35df4.

I tried to apply John's changes in 8d897ec915 that were expected to
fix his patch but that didn't work unfortunately.

Reverting this again to fix the macOS bots and leave him more time to
investigate the issue.
2021-12-10 17:33:54 -08:00
John Ericson 492de35df4 Revert "Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM""
This reverts commit 797b50d4be.

See the original D99484. @mib who noticed the original problem could not longer
reproduce it, after I tried and also failed. We are threfore hoping it went
away on its own!

Reviewed By: mib

Differential Revision: https://reviews.llvm.org/D115544
2021-12-10 20:59:43 +00:00
Med Ismail Bennani 797b50d4be Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM"
This reverts commit 6fd2db04d0 since it
broke GreenDragon LLDB-Incremental bot:

https://green.lab.llvm.org/green/job/lldb-cmake/37560/console

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-11-02 19:11:44 +01:00
John Ericson 6fd2db04d0 Use `GNUInstallDirs` to support custom installation dirs. -- LLVM
This is a new draft of D28234. I previously did the unorthodox thing of
pushing to it when I wasn't the original author, but since this version

- Uses `GNUInstallDirs`, rather than mimics it, as the original author
  was hesitant to do but others requested.

- Is much broader, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I am using this patch (and many back-ports) as the basis of
https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS). It
looked like people were generally on board in D28234, but I make note of
this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM
already has some partial support for these sorts of things. For example
`LLVM_LIBDIR_SUFFIX`, or `COMPILER_RT_INSTALL_PATH`. Because it's not
quite clear yet what to do about those, we are holding off on changing
libdirs and `compiler-rt`. for this initial PR.

---

On the advice of @lebedev.ri, I am splitting this up a bit per
subproject, starting with LLVM. To allow it to be more easily reviewed. This and the subsequent patch must be landed together, as this will not build alone. But the rest can be landed on their own.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D100810
2021-11-02 10:23:30 -04:00
Dave Lee 65dae8b2f2 [lldb] Configure CMake policy CMP0116 for standalone builds
Using CMake >=3.20 results in many warnings about this new policy. This change silences the warnings by explicitly declaring use of the "OLD" behavior.

This applies D101083 to LLDBStandalone.cmake.

Differential Revision: https://reviews.llvm.org/D112497
2021-10-25 16:29:36 -07:00
Siger Yang 6de63b3ba5 [lldb/lua] Force Lua version to be 5.3
Due to CMake cache, find_package in FindLuaAndSwig.cmake
will be ignored. This commit adds EXACT and REQUIRED flags
to it and removes find_package in Lua ScriptInterpreter.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>

Reviewed By: tammela, JDevlieghere

Differential Revision: https://reviews.llvm.org/D108515
2021-10-12 21:34:15 +08:00
Alfonso Gregory a2c319fdc6 [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project
This way, we do not need to set LLVM_CMAKE_PATH to LLVM_CMAKE_DIR when (NOT LLVM_CONFIG_FOUND)

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D107717
2021-09-16 18:29:57 +02:00
Siger Yang 49229bb92b Revert "[lldb/lua] Force Lua version to be 5.3"
This commit causes buildbot failures if SWIG is available but Lua is
not present.

This reverts commit 7bb42dc6b1.
2021-09-03 17:31:25 +08:00
Siger Yang 7bb42dc6b1 [lldb/lua] Force Lua version to be 5.3
Due to CMake cache, find_package in FindLuaAndSwig.cmake
will be ignored. This commit adds EXACT and REQUIRED flags
to it and removes find_package in Lua ScriptInterpreter.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>

Reviewed By: tammela, JDevlieghere

Differential Revision: https://reviews.llvm.org/D108515
2021-09-03 15:22:57 +08:00
Michał Górny 614c7d0387 [lldb] [cmake] Add LLVM_LIT_ARGS override support for standalone builds
Add a LLVM_LIT_ARGS cached variable in order to make it possible
to override lit arguments when doing standalone builds.  Without that,
the user variable is ignored and the default options are always used.

Based on a similar solution found in clang.

Differential Revision: https://reviews.llvm.org/D107700
2021-08-09 23:36:01 +02:00
Neal Sidhwaney 55fd6f292f Revert "D106035: Remove conditional compilation for WCHAR support in libedit"
This reverts commit 7529f0e3e1.
2021-08-05 02:55:10 -07:00
Neal Sidhwaney 7529f0e3e1 D106035: Remove conditional compilation for WCHAR support in libedit
This change moves to using narrow character types and libedit APIs in
Editline, because those are the same types that the rest of LLVM/LLDB
uses, and it's generally considered better practice to use UTF-8
encoded in char than it is to use wider characters. However, for
character input, the change leaves in using a wchar to enable input of
multi-byte characters.

Differential Revision: https://reviews.llvm.org/D106035
2021-08-05 00:29:54 -07:00
Nico Weber bf3383501f [lldb] Get rid of HAVE_SYS_TYPES_H
LLVM includes this header unconditionally on all platforms
(including Windows), so this define should no longer be necessary.

No behavior change.

Differential Revision: https://reviews.llvm.org/D107338
2021-08-03 22:14:56 +02:00
Nico Weber 82dc463bb3 [lldb] Get rid of HAVE_SIGACTION
The .cpp file uses SIGNAL_POLLING_UNSUPPORTED to guard the call
to sigaction, so use it in the .h file too. (LLVM also calls
sigaction without a guard on non-Windows.)

No behavior change.

Differential Revision: https://reviews.llvm.org/D107255
2021-08-02 20:11:35 +02:00
Richard Howell 969eefd98e [lldb] add LLDB_SKIP_DSYM option
Add an option to skip generating a dSYM when installing the LLDB framework on Darwin.

Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D103124
2021-05-26 09:32:59 -07:00
Shoaib Meenai 015d78a25e [lldb] Remove XPCServices symlinking
This is a downstream change that was accidentally included upstream.

Reviewed By: vsk

Differential Revision: https://reviews.llvm.org/D97701
2021-03-01 11:23:46 -08:00
Jonas Devlieghere cb6d53ccdc [lldb] Bump the required SWIG version to 3
Bump the required SWIG version to 3. If my memory serves me well we last
bumped the required SWIG version to 2 for Python 3. At that time SWIG 3
had already been around for a while so everyone I know was already using
that.

It appears that SWIG 3 is the only version that officially supports
C++11 which we're using in the typemap. SWIG 3 was released in 2014 so I
think it's reasonable to make that the minimum required version.

https://bugs.llvm.org/show_bug.cgi?id=48685

Differential revision: https://reviews.llvm.org/D94244
2021-01-08 08:47:21 -08:00
Christopher Tetreault 26459e6d8e Fix "Unknown arguments specified" to if in lldb
Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D89807
2020-10-21 07:24:53 -07:00
Sylvestre Ledru 0784e17f1b Remove .svn from exclude list as we moved to git
Reviewed By: emaste

Differential Revision: https://reviews.llvm.org/D89859
2020-10-21 16:09:21 +02:00
Jonas Devlieghere c565f09f4b [lldb] Don't strip LLDB.framework on install
The framework build will run dsymutil after LLDB.framework is installed.
2020-10-20 18:16:36 -07:00
Pavel Labath d4a7c70751 [lldb] Add a cmake warning about the python/swig incompatibility
Raise awareness of the fact that some versions of swig and python (and
build types) just don't mix.

One day this will be a reason to require swig>=4.0, but this version is
too hot off the press right now..

Differential Revision: https://reviews.llvm.org/D88967
2020-10-08 18:42:50 +02:00
Pavel Labath 3dfb949861 [lldb] Check for and use ptsname_r if available
ptsname is not thread-safe. ptsname_r is available on most (but not all)
systems -- use it preferentially.

In the patch I also improve the thread-safety of the ptsname fallback
path by wrapping it in a mutex. This should guarantee the safety of a
typical ptsname implementation using a single static buffer, as long as
all callers go through this function.

I also remove the error arguments, as the only way this function can
fail is if the "primary" fd is not valid. This is a programmer error as
this requirement is documented, and all callers ensure that is the case.

Differential Revision: https://reviews.llvm.org/D88728
2020-10-07 15:29:29 +02:00
Raphael Isemann ce4d15fe14 [lldb] Symlink the Clang resource directory to the LLDB build directory in standalone builds
When doing a standalone build (i.e., building just LLDB against an existing
LLVM/Clang installation), LLDB is currently unable to find any Clang resource
directory that contains all the builtin headers we need to parse real source
code. This causes several tests that actually parse source code on disk within
the expression parser to fail (most notably nearly all the import-std-module
tests).

The reason why LLDB can't find the resource directory is that we search based on
the path of the LLDB shared library path. We assumed that the Clang resource
directory is in the same prefix and has the same relative path to the LLDB
shared library (e.g., `../clang/10.0.0/include`). However for a standalone build
where the existing Clang can be anywhere on the disk, so we can't just rely on
the hardcoded relative paths to the LLDB shared library.

It seems we can either solve this by copying the resource directory to the LLDB
installation, symlinking it there or we pass the path to the Clang installation
to the code that is trying to find the resource directory. When building the
LLDB framework we currently copy the resource directory over to the framework
folder (this is why the import-std-module are not failing on the Green Dragon
standalone bot).

This patch symlinks the resource directory of Clang into the LLDB build
directory. The reason for that is simply that this is only needed when running
LLDB from the build directory. Once LLDB and Clang/LLVM are installed the
already existing logic can find the Clang resource directory by searching
relative to the LLDB shared library.

Reviewed By: kastiglione, JDevlieghere

Differential Revision: https://reviews.llvm.org/D88581
2020-10-06 09:28:39 +02:00
Jonas Devlieghere e0b220d22e [lldb] Remove redundant call to FindBacktrace (NFC)
We're not using any of the Backtrace_* CMake variables set by
FindBacktrace in LLDB.
2020-08-20 22:41:49 -07:00
Jonas Devlieghere c1bc4fb95e [lldb] Simplify CMake logic with LLVM's append_if function
Use the append_if CMake function from HandleLLVMOptions. Since we
include this file in LLDBStandalone it should work in both for in-tree
and out-of-tree builds.
2020-08-20 22:35:31 -07:00
Jonas Devlieghere 75966ee241 [lldb] Get rid of helper CMake variables for Python
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
2020-08-17 08:47:52 -07:00
Jonas Devlieghere ce439cb1c9 [lldb] Remove Python 2 fallback and only support Python 3
This removes the fallback to Python 2 and makes Python 3 the only
supported configuration. This is the first step to fully migrate to
Python 3 over the coming releases as discussed on the mailing list.

http://lists.llvm.org/pipermail/lldb-dev/2020-August/016388.html

As a reminder, for the current release the test suite and the generated
bindings should remain compatible with Python 2.

Differential revision: https://reviews.llvm.org/D85942
2020-08-14 08:50:11 -07:00
Vedant Kumar d49aedd315 Build a flat LLDB.framework for embedded Darwin targets
This patch configures LLDB.framework to build as a flat unversioned
framework on non-macOS Darwin targets, which have never supported the
macOS framework layout.

This patch also renames the 'IOS' cmake variable to 'APPLE_EMBEDDED' to
reflect the fact that lldb is built for several different kinds of embedded
Darwin targets, not just iOS.

Differential Revision: https://reviews.llvm.org/D85770
2020-08-12 13:34:29 -07:00
Petr Hosek 31e5f7120b [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-08-11 20:22:11 -07:00
Petr Hosek a4d78d23c5 Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit ccbc1485b5 which
is still failing on the Windows MLIR bots.
2020-08-08 17:08:23 -07:00
Petr Hosek ccbc1485b5 [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-08-08 16:44:08 -07:00
Christian Kühnel f3cc4df51d Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit 1adc494bce.
This patch broke the Windows compilation on buildbot and pre-merge testing:
http://lab.llvm.org:8011/builders/mlir-windows/builds/5945
https://buildkite.com/llvm-project/llvm-master-build/builds/780
2020-08-07 09:36:49 +02:00
Petr Hosek 1adc494bce [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-08-05 16:07:11 -07:00
Hans Wennborg 3ab01550b6 Revert "[CMake] Simplify CMake handling for zlib"
This quietly disabled use of zlib on Windows even when building with
-DLLVM_ENABLE_ZLIB=FORCE_ON.

> Rather than handling zlib handling manually, use find_package from CMake
> to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
> HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
> set to YES, which requires the distributor to explicitly select whether
> zlib is enabled or not. This simplifies the CMake handling and usage in
> the rest of the tooling.
>
> This is a reland of abb0075 with all followup changes and fixes that
> should address issues that were reported in PR44780.
>
> Differential Revision: https://reviews.llvm.org/D79219

This reverts commit 10b1b4a231 and follow-ups
64d99cc6ab and
f9fec0447e.
2020-08-05 12:31:44 +02:00
Petr Hosek 64d99cc6ab [CMake] Move find_package(ZLIB) to LLVMConfig
This way, downstream projects don't have to invoke find_package(ZLIB)
reducing the amount of boilerplate.

Differential Revision: https://reviews.llvm.org/D84691
2020-07-27 17:13:55 -07:00
Jonas Devlieghere 536baa11cf [lldb] Remove CMAKE_VERSION checks now that the minimum version is 3.13.4 2020-07-27 12:31:41 -07:00
Petr Hosek c86f56e32e [CMake] Find zlib when building lldb as standalone
This addresses the issue introduced by 10b1b4a.
2020-07-24 13:36:13 -07:00
Jonas Devlieghere 6e670e0796 [lldb/Lua] Require Lua 5.3 2020-06-23 09:24:01 -07:00
Jonas Devlieghere 2c0afacada [lldb/CMake] Add LLDB_PYTHON_VERSION to use Python 2 with CMake > 3.12
In addition to having the default fallback from Python 3 to Python 2, it
should also be possible to build against Python 2 explicitly. This patch
makes that possible by setting LLDB_PYTHON_VERSION. The variable only
has effect with CMake 3.12 or later.

Differential revision: https://reviews.llvm.org/D81501
2020-06-09 14:11:11 -07:00
Haibo Huang 04daba9670 [lldb] Cleans up system_libs
Summary:
Long long ago system_libs was appended to LLDB_SYSTEM_LIBS in
cmake/LLDBDependencies.cmake. After that file was removed, system_libs
is orphaned.

Currently the only user is source/Utility. Move the logic there and
remove system_libs.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80253
2020-05-20 12:30:08 -07:00
Haibo Huang 780d7d7732 [lldb] Allows customizing libxml2 for darwin
Summary:
This changes allows to disable or use customized libxml2 for lldb.

1. Removes redundant include_directories. The one in LLDBConfig.cmake should be enough.

2. Link to ${LIBXML2_LIBRARIES} if xml2 is enabled.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80257
2020-05-20 12:27:08 -07:00
Jonas Devlieghere 397e69dbcb [lldb/CMake] Don't make PYTHON_RPATH a required variable. 2020-04-30 10:54:47 -07:00