Commit Graph

34 Commits

Author SHA1 Message Date
Chris Bieneman d3199f5ed2 [CMake] Initial support for LLDB.framework
Summary:
This patch adds a CMake option LLDB_BUILD_FRAMEWORK, which builds libLLDB as a macOS framework instead of as a *nix shared library.

With this patch any LLDB executable that has the INCLUDE_IN_FRAMEWORK option set will be built into the Framework's resources directory, and a symlink to the exeuctable will be placed under the build directory's bin folder. Creating the symlinks allows users to run commands from the build directory without altering the workflow.

The framework generated by this patch passes the LLDB test suite, but has not been tested beyond that. It is not expected to be fully ready to ship, but it is a first step.

With this patch binaries that are placed inside the framework aren't being properly installed. Fixing that would increase the patch size significantly, so I'd like to do that in a follow-up.

Reviewers: zturner, tfiala

Subscribers: beanz, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D24749

llvm-svn: 282110
2016-09-21 21:02:16 +00:00
Pavel Labath 0e947eb636 Add cmake option to choose whether to use the builtin demangler
Summary:
Previously the builting demangler was on for platforms that explicitly set a flag by modifying
Mangled.cpp (windows, freebsd). The Xcode build always used builtin demangler by passing a
compiler flag. This adds a cmake flag (defaulting to ON) to configure the demangling library used
at build time. The flag is only available on non-windows platforms as there the system demangler
is not present (in the form we're trying to use it, at least).
The impact of this change is:
- linux: switches to the builtin demangler
- freebsd, windows: NFC (I hope)
- netbsd: switches to the builtin demangler
- osx cmake build: switches to the builtin demangler (matching the XCode build)

The main motivation for this is the cross-platform case, where it should bring more consistency
by removing the dependency on the host demangler (which can be completely unrelated to the debug
target).

Reviewers: zturner, emaste, krytarowski

Subscribers: emaste, clayborg, lldb-commits

Differential Revision: https://reviews.llvm.org/D23830

llvm-svn: 279808
2016-08-26 09:47:58 +00:00
Pavel Labath 2f430a1938 Remove cmake legacy code
Summary: Cmake 2.8 support is gone and not coming back. We can remove a bit of legacy code now.

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D23554

llvm-svn: 278924
2016-08-17 11:55:50 +00:00
Omair Javaid 9fab64643d Fix LLDBConfig.cmake to enable python enabled build for all 64 bit lldb targets
Differential revision: https://reviews.llvm.org/D22771

llvm-svn: 276814
2016-07-26 21:43:02 +00:00
Pavel Labath a0adeb69ab [cmake] Remove the LLDB versions of the exception-controlling variables
Summary:
One can still use the LLVM variables to control this: LLVM_ENABLE_EH, LLVM_ENABLE_RTTI. It's not
clear to me why one would want to control these at lldb level and it's generally not even a good
idea to compile parts of the same binary with different values of these flags.

Reviewers: zturner, tfiala

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D20673

llvm-svn: 270863
2016-05-26 16:11:04 +00:00
Pavel Labath 95d6c7731c [cmake] Add a big warning about a libstdc++ issue
Summary:
Recent increase in the usage of std::weak_ptr has caused us to rediscover an issue in libstdc++
versions prior to 4.9 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656>, which make this class
unusable without exceptions in the presence of multiple threads. It's virtualy impossible to work
around this issue without implementing our own shared_ptr/weak_ptr substitutes, which does not
seem like a good idea.

Therefore, I am adding a big CMake warning which warns you about this issue if you're attempting
a to do a build which is suceptible to this problem and suggests possible alternatives. Right
now, nothing spectacular will happen if you ignore this warning (all the crashes I have seen
occur during process shutdown), but there's no guarantee the situation will not change in the
future.

Reviewers: tberghammer, tfiala, nitesh.jain, omjavaid, emaste, krytarowski

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D20671

llvm-svn: 270854
2016-05-26 15:16:11 +00:00
Zachary Turner 190fadcdb2 Unicode support on Win32.
Win32 API calls that are Unicode aware require wide character
strings, but LLDB uses UTF8 everywhere.  This patch does conversions
wherever necessary when passing strings into and out of Win32 API
calls.

Patch by Cameron
Differential Revision: http://reviews.llvm.org/D17107
Reviewed By: zturner, amccarth

llvm-svn: 264074
2016-03-22 17:58:09 +00:00
Aidan Dodds a15b44c967 Patch cmake to allow detection of python 2.7.9+
Some distributions of python have their version defined as follows in patchlevel.h (note the '+'):
#define PY_VERSION "2.7.9+"
The '+' char needs to be stripped by the cmake regex so that LLDBs python lib detection is successful.

Differential Revision: http://reviews.llvm.org/D15566

llvm-svn: 255893
2015-12-17 14:13:39 +00:00
Bruce Mitchener eb0a6f4308 Use library discovery for curses and panel
Summary:
This approach is tunable with custom paths for curses library.

It also detects whether there are requirements met.

I make use of it on NetBSD.

Patch by Kamil Rytarowski. Thanks!

Reviewers: clayborg

Subscribers: brucem, joerg, lldb-commits

Differential Revision: http://reviews.llvm.org/D14529

llvm-svn: 253151
2015-11-15 01:53:23 +00:00
Bruce Mitchener d31113f0b9 Add more NetBSD platform glue for lldb
Summary:
These changes are still incomplete, but  we are almost there.

Changes:
- CMake and gmake code
- SWIG code
- minor code additions

Reviewers: emaste, joerg

Subscribers: youri, akat1, brucem, lldb-commits, joerg

Differential Revision: http://reviews.llvm.org/D14042

llvm-svn: 252403
2015-11-07 15:31:54 +00:00
Chaoren Lin 41c502318c Correctly include LLVM_EXTERNAL_CLANG_SOURCE_DIR.
Reviewers: sas, ovyalov

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14166

llvm-svn: 251589
2015-10-29 00:48:38 +00:00
Stephane Sezer d1517e184c Avoid using `..` in paths for include dirs.
Summary:
This breaks when using a symlink from llvm/tools/lldb to the lldb source
tree, instead of cloning directly as a child. With this change, we can
build properly, even when using links.

Reviewers: dawn, brucem, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14089

llvm-svn: 251530
2015-10-28 17:34:45 +00:00
Tamas Berghammer e7ec227839 Disable the strict-aliasing warnings produced by gcc
GCC produce a lot of strict-aliasing warning for the LLDB codebase
what makes reading the compile output very difficult. This change
disable these warnings to reduce the noise as we already ignore them.

We should consider re-enabling the warning if we fix all (or most)
strict-aliasing violation first.

Differential revision: http://reviews.llvm.org/D13981

llvm-svn: 251107
2015-10-23 10:34:53 +00:00
Zachary Turner e24ad03ae6 Disable libxml2 on Windows for now.
Newer versions of CMake include a "smarter" FindLibxml2 package.
In theory this is a good thing, but on Windows it's now smart
enough to find the version that comes with Gnuwin32, which doesn't
appear to be a valid libxml2 distribution.  Or at the very least,
LLDB currently uses some header files from libxml2 that are not
part of this distribution.

Nobody on Windows is using any of this functionality right now
anyway, so just disable it.

llvm-svn: 250709
2015-10-19 17:34:51 +00:00
Todd Fiala d6f840609b cmake: provide flag that enables 'log enable --stack' to provide useful file/function info on POSIX systems
Adding the following flag to a cmake line:
-DLLDB_EXPORT_ALL_SYMBOLS=TRUE

will cause all symbols to be exported from liblldb.  This enables the llvm
backtrace mechanism to see and report backtrace symbols properly when using
(lldb) log enable --stack ...

Prior to this change, only the SB API symbols would show up on Linux and other
systems that use a public-symbols-based backtrace lookup mechanism.

log enable --stack ... is a very handy, quick way to understand the flow
of how some log lines are getting hit within lldb without having to hook
up a top-level debugger over your current debug session.

llvm-svn: 250299
2015-10-14 14:52:15 +00:00
Zachary Turner 3a1acdd955 Have CMake translate LLDB_PYTHON_HOME to forward slashes.
Using backslashes causes the compiler to interpret them as
escape sequences.

llvm-svn: 249885
2015-10-09 19:45:26 +00:00
Bruce Mitchener 3ddef773ad Make CMake display more readable paths to Python binaries on Windows
Summary:
Previously CMake would display messages like these:

```
-- LLDB Found PythonExecutable: $<$<CONFIG:Debug>:C:/Projects/Python-2.7.9-bin/x64/python_d.exe>$<$<NOT:$<CONFIG:Debug>>:C:/Projects/Python-2.7.9-bin/x64/python.exe>
-- LLDB Found PythonLibs: $<$<CONFIG:Debug>:C:/Projects/Python-2.7.9-bin/x64/libs/python27_d.lib>$<$<NOT:$<CONFIG:Debug>>:C:/Projects/Python-2.7.9-bin/x64/libs/python27.lib>
-- LLDB Found PythonDLL: $<$<CONFIG:Debug>:C:/Projects/Python-2.7.9-bin/x64/python27_d.dll>$<$<NOT:$<CONFIG:Debug>>:C:/Projects/Python-2.7.9-bin/x64/python27.dll>
```

This patch makes the messages look like this:

```
-- LLDB Found PythonExecutable: C:/Projects/Python-2.7.9-bin/x64/python.exe and C:/Projects/Python-2.7.9-bin/x64/python_d.exe
-- LLDB Found PythonLibs: C:/Projects/Python-2.7.9-bin/x64/libs/python27.lib and C:/Projects/Python-2.7.9-bin/x64/libs/python27_d.lib
-- LLDB Found PythonDLL: C:/Projects/Python-2.7.9-bin/x64/python27.dll and C:/Projects/Python-2.7.9-bin/x64/python27_d.dll
```

I've also added checks to ensure the messages are actually accurate, as in check that the files actually exist before claiming they've been found. If any of the files are missing Python integration will be disabled for the build.

Patch by Vadim Macagon. Thanks!

Reviewers: brucem, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13520

llvm-svn: 249671
2015-10-08 08:50:20 +00:00
Zachary Turner f2be3dfd81 Teach CMake to find versions of Python != 2.7
llvm-svn: 249466
2015-10-06 21:11:15 +00:00
Bruce Mitchener 852cb7fb0d Use the correct Python lib for each build configuration generated by the Visual Studio CMake generator
Summary:
Previously `CMAKE_BUILD_TYPE` was used to determine whether to link in `python27.lib` or `python27_d.lib`, unfortunately this only works reliably when using a CMake generator that generates a single build configuration (e.g. Ninja). The Visual Studio CMake generator generates four build configurations at once (`Debug`, `Release`, `RelWithDebInfo`, `MinSizeRel`), so if `CMAKE_BUILD_TYPE` is set to `Debug` all four build configurations end up linking in `python27_d.lib`, this is clearly undesirable.

To ensure that the correct Python lib is used for each build configuration the value of `PYTHON_LIBRARY` is now determined using generator expressions that evaluate to either the debug or release Python lib. The values of `PYTHON_EXECUTABLE` and `PYTHON_DLL` are now likewise determined using generator expressions.

Note that these changes only apply to the Windows build.

Patch by Vadim Macagon. Thanks!

Reviewers: zturner, brucem

Subscribers: zturner, lldb-commits

Differential Revision: http://reviews.llvm.org/D13234

llvm-svn: 248991
2015-10-01 07:47:38 +00:00
Bruce Mitchener 40889cd75a [cmake] Build lldb-server on Darwin, set dep on FreeBSD.
Summary:
This switches the decision as to whether or not to lldb-server should
be built to check the same flag that was added that controls whether
or not it is added as a dependency to the 'lldb' target.

It also sets that flag on FreeBSD to maintain parity with the existing
build configuration / situation on FreeBSD.

Reviewers: labath, emaste, tfiala

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12925

llvm-svn: 247913
2015-09-17 18:35:33 +00:00
Todd Fiala 509300d94c cmake fixes for lldb target.
ninja lldb now does the following:
* forces the python post-build step to fire, which sets up the python lldb module properly.
* on Darwin and Linux, requires the lldb-server target to be built.
* on Darwin, requires the debugserver target to be built.

See http://reviews.llvm.org/D12899 for details.

llvm-svn: 247810
2015-09-16 15:34:06 +00:00
Bruce Mitchener 2f9aa57927 [cmake] Remove LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION.
Summary:
This should be a mandatory build process going forward, if Python
is enabled. The longer term desire is to remove the old shell
scripts entirely.

Reviewers: zturner, clayborg, labath

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12667

llvm-svn: 246979
2015-09-08 05:00:22 +00:00
Bruce Mitchener 4aed72571a Use -Wno-vla-extension globally.
Summary:
This was previously only established within debugserver, but
there is a use of the VLA extension in source/Host/macosx/Symbols.cpp,
so ignore this warning globally.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12515

llvm-svn: 246605
2015-09-01 23:43:51 +00:00
Pavel Labath 4a0d7bcaa7 Fix liblldb linking on RHEL 6 (bug #24140)
Patch by Eugene Zelenko.

llvm-svn: 242525
2015-07-17 15:26:27 +00:00
Bruce Mitchener 1f44139a4f cmake no longer needs to deal with -std=c++11 checks.
LLVM requires and handles this now and has the correct compiler
version checks. This block of code for cmake in LLDB is no longer
needed.

Summary: cmake no longer needs to deal with -std=c++11 checks.

Reviewers: labath

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10994

llvm-svn: 241590
2015-07-07 14:52:59 +00:00
Pavel Labath b065ff6caf Add Support for LLVM_INSTALL_TOOLCHAIN_ONLY (bug #23784)
Support for LLVM_INSTALL_TOOLCHAIN_ONLY is modeled on same functionality
from LLVM and Clang CMake files.

Patch by: Eugene Zelenko

llvm-svn: 240935
2015-06-29 11:03:21 +00:00
Pavel Labath 33b51e87e1 [linux] Use cmake to detect support process_vm_readv (bug #23918)
Summary:
Some old linux versions do not have process_vm_readv function defined. Even older versions do not
have even the __NR_process_vm_readv syscall number. We use cmake to detect these situations and
fallback appropriately: in the first case, we can issue the syscall manually, while it the latter
case, we need to drop fast memory read support completely.

Test Plan: linux test suite passes

Reviewers: ovyalov, Eugene.Zelenko

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10727

llvm-svn: 240927
2015-06-29 09:18:17 +00:00
Andrew Wilkins 7175f16cdb [lldb] Enable building with Cmake/BUILD_SHARED_LIBS
Summary:
Several changes to fix CMake builds of LLDB with the
BUILD_SHARED_LIBS setting on.

- Force all internal libraries to be built STATIC.
- Add additional library dependencies (pthread, dl,
  runtimedyld).
- modify finalisation of SWIG wrapper to symlink the
  "lib" dir into python/site-packages, so _lldb.so's
  RPATH resolves.

Test Plan: Verified one test case with "dotest.py".

Reviewers: sylvestre.ledru, zturner

Reviewed By: zturner

Subscribers: zturner, ted, tberghammer, emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D10157

llvm-svn: 239007
2015-06-04 03:12:37 +00:00
Zachary Turner 1b988b4b64 Fix line endings.
I must have committed these with windows line endings a few months
ago when I did this work.

llvm-svn: 237283
2015-05-13 19:45:06 +00:00
Colin Riley c3c95b22a9 Adds lldb support for querying the register mapping from gdbserver remote targets using qXfer:features:read packet. Only enabled if libxml2 enabled in build.
Differential Revision: http://reviews.llvm.org/D8999

llvm-svn: 235109
2015-04-16 15:51:33 +00:00
Zachary Turner dd50f7421c Making linking against Python simpler on Windows.
This patch deprecates the three Python CMake variables in favor of
a single variable PYTHON_HOME which points to the root of a python
installation.  Since building Python doesn't output the files in
a structure that is compatible with the PYTHONHOME environment
variable, we also provide a script install_custom_python.py which
will copy the output of a custom python build to the correct
directory structure.

The supported workflow after this patch will be to build python
once for each configuration and architecture {Debug,Release} x {x86,x64}
and then run the script.  Then run CMake specifying -DPYTHON_HOME=<path>

The first time you do this will probably require you to delete your
CMake cache.

The old workflow is still supported during a transitionary period,
but a warning is printed at CMake time, and this will eventually
be removed.

Differential Revision: http://reviews.llvm.org/D8979

llvm-svn: 234660
2015-04-10 22:58:56 +00:00
Zachary Turner eeba1a896a [CMake] Make the unittests link against everything...
Sigh.  There's really not a good alternative until we decouple
python from lldb better.  The only way the build works right now
is by having every executable link against every LLDB library.
This causes implicit transitive link dependencies on the union
of everything that LLDB brings in.  Which means that if all we
want is one header file from interpreter, we have to bring in
everything, including everything that everything depends on,
which means python.

There's outstanding efforts to address this, but it's not yet
complete.  So until then, this is all we can do.

llvm-svn: 232287
2015-03-14 23:39:28 +00:00
Zachary Turner 26d7fcfc38 Create a CMake build for the gtest unit tests.
llvm-svn: 232210
2015-03-13 20:54:21 +00:00
Zachary Turner 44a14d95c2 [CMake] Refactor LLDB main CMake file.
The existing state of affairs was getting a little unwieldy.

All of LLDB's utility functions and initial configuration was in
the root CMake file.  I split this up into 3 separate files and
moved them to relevant subfolders under cmake/modules.

Also, I deleted the add_lldb_definitions() function.  It seemed
to be somewhat useless and did not serve any real purpose that
I was able to figure out.

llvm-svn: 231010
2015-03-02 20:45:26 +00:00