Commit Graph

48 Commits

Author SHA1 Message Date
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
Vedant Kumar e62b54ed2a Revert "[lldb][cmake] Remove libclang as an lldbBase dependency (NFCI)"
This reverts commit r279296. Including LLDBDependencies breaks the
netbsd lldb bot because it exposes LLDB_USED_LIBS, which causes
lldb_link_common_libs to run to completion in unintended sites, which
results in a malformed call to target_link_libraries.

  http://lab.llvm.org:8011/builders/lldb-amd64-ninja-netbsd7/builds/5989

Thanks to Chris Bieneman for figuring this out!

llvm-svn: 279322
2016-08-19 21:00:40 +00:00
Vedant Kumar 181f924beb [lldb][cmake] Remove libclang as an lldbBase dependency (NFCI)
It's pulling in all kinds of things it doesn't need (e.g, clang-tidy!).

Eliminating this dependency removes 1056 dependencies from the
'CommandObjectFrame.cpp.o' target and 454 dependencies from the 'lldb'
target. On my machine, this shaves 7 minutes off of a clean build of
lldb.

Thanks to Zachary Turner for pointing out some issues with an earlier
version of this patch!

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

llvm-svn: 279296
2016-08-19 18:41:50 +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
Eugene Zelenko dab35bd67f Fixes for standalone build:
* include CheckAtomic to set HAVE_CXX_ATOMICS64_WITHOUT_LIB properly (introduced in r274121)
* hint Clang CMake files for LLVM CMake files location (inctroduced in ~ r274176)

Differential revision: https://reviews.llvm.org/D22322

llvm-svn: 275641
2016-07-15 22:46:15 +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
Eugene Zelenko 000752f171 Fix standalone LLDB build, when LLVM/Clang were built with LLVM_INSTALL_TOOLCHAIN_ONLY=ON.
Fix standalone build with CMake 2.8.12.2.

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

llvm-svn: 269996
2016-05-18 22:50:08 +00:00
Kamil Rytarowski f49f2ee6d6 Add CMake bits necessary for standalone build
Summary: Developed on NetBSD with pkgsrc.

Reviewers: zturner, labath

Subscribers: jevinskie, zturner, tfiala, Eugene.Zelenko, artagnon, joerg, lldb-commits

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

llvm-svn: 269332
2016-05-12 19:49:17 +00:00
Kamil Rytarowski 90db606429 Fix NetBSD build with CMake 3.5.2
Summary:
Building HEAD of LLDB fails in linking against DebugInfoPDB. It also prints the following warning:

```
CMake Warning (dev) in source/Plugins/SymbolFile/PDB/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "lldbPluginSymbolFilePDB" has an INTERFACE_LINK_LIBRARIES property.
  This should be preferred as the source of the link interface for this
  library but because CMP0022 is not set CMake is ignoring the property and
  using the link implementation as the link interface instead.

  INTERFACE_LINK_LIBRARIES:

    LLVMDebugInfoPDB

  Link implementation:

    (empty)
```

CMP0022 was introduced in CMake-2.8.11, bump minimal required version from 2.8 to 3.0 to gain more useful features like libexecinfo(3) detection on NetBSD.

Reviewers: emaste, zturner, labath

Subscribers: zturner, lldb-commits, joerg

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

llvm-svn: 268191
2016-05-01 10:23:24 +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
Zachary Turner 74e08ca05c Add support for reading line tables from PDB files.
PDB is Microsoft's debug information format, and although we
cannot yet generate it, we still must be able to consume it.
Reason for this is that debug information for system libraries
(e.g. kernel32, C Runtime Library, etc) only have debug info
in PDB format, so in order to be able to support debugging
of system code, we must support it.

Currently this code should compile on every platform, but on
non-Windows platforms the PDB plugin will return 0 capabilities,
meaning that for now PDB is only supported on Windows.  This
may change in the future, but the API is designed in such a way
that this will require few (if any) changes on the LLDB side.
In the future we can just flip a switch and everything will
work.

This patch only adds support for line tables.  It does not return
information about functions, types, global variables, or anything
else.  This functionality will be added in a followup patch.

Differential Revision: http://reviews.llvm.org/D17363
Reviewed by: Greg Clayton

llvm-svn: 262528
2016-03-02 22:05:52 +00:00
Niels Ole Salscheider 6795eff63e Fix the search path for CMake files
This allows to find the LLVM's CMake files after moving them in
r259821.

llvm-svn: 259845
2016-02-04 23:28:57 +00:00
Pavel Labath 48003e721e Fix linking with LLVM_LINK_LLVM_DYLIB=ON
Linking with LLVM shared libraries currently produces linker errors.  This works around the issue
(pr24953) by disabling linking with llvm so for lldb libraries.

Patch by Evangelos Foutras.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 258921
2016-01-27 11:02:02 +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
Ramkumar Ramachandra f7e934d12a LLDBStandalone: Report nice errors on missing vars
Differential Revision: http://reviews.llvm.org/D13819

llvm-svn: 252624
2015-11-10 18:09:14 +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 6512cad8e5 Standalone cmake build improvements (bug #23889)
patch by Eugene Zelenko.

llvm-svn: 242529
2015-07-17 15:50:48 +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 be9f9c177a Enclose CLANG_USED_LIBS in --start/end-group when linking liblldb (bug #24044)
Patch by Eugene Zelenko.

llvm-svn: 241576
2015-07-07 12:24:33 +00:00
Pavel Labath df0ee89d45 LLDB standalone build: check if Clang was built independently from LLVM
This is fix for bug 23704: LLDB standalone build always include
ClangConfig.cmake even if Clang was built with LLVM (ClangConfig.cmake
doesn't exist).

Patch by: Eugene Zelenko

llvm-svn: 241575
2015-07-07 12:08:09 +00:00
Ed Maste e164ad8dfb Remove DOS line endings from LLDBStandalone.cmake
llvm-svn: 241361
2015-07-03 16:39:17 +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 799770c03a Fix linking of unit tests via CMake on Windows.
A previous attempt to make the unit tests link properly on
Linux broke it for Windows.  This patch fixes it for both platforms.

llvm-svn: 232648
2015-03-18 16:56:24 +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