Commit Graph

100 Commits

Author SHA1 Message Date
Jonas Devlieghere ff5982aa91 [test] Fix various module cache bugs and inconsistencies
Currently, lit tests don't set neither the module cache for building
inferiors nor the module cache used by lldb when running tests.
Furthermore, we have several places where we rely on the path to the
module cache being always the same, rather than passing the correct
value around. This makes it hard to specify a different module cache
path when debugging a a test.

This patch reworks how we determine and pass around the module cache
paths and fixes the omission on the lit side. It also adds a sanity
check to the lit and dotest suites.

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

llvm-svn: 370394
2019-08-29 18:37:05 +00:00
Jonas Devlieghere b543c16869 [dotest] Remove -q (quiet) flag.
This patch removes the -q (quiet) flag and changing the default
behavior. Currently the flag serves two purposes that are somewhat
contradictory, as illustrated by the difference between the argument
name (quiet) and the configuration flag (parsable). On the one hand it
reduces output, but on the other hand it prints more output, like the
result of individual tests. My proposal is to guard the extra output
behind the verbose flag and always print the individual test results.

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

llvm-svn: 370226
2019-08-28 16:28:58 +00:00
Jonas Devlieghere be019c7a1f [TableGen] Move helpers into LLDBTableGenUtils.
Instead of polluting the LLDBTableGenBackends header with helpers used
by both emitters, move them into a separate files.

llvm-svn: 367377
2019-07-31 00:47:00 +00:00
Jonas Devlieghere f63054f400 [TableGen] Include vector
Fixes "no member named 'vector' in namespace 'std'" compile error.

llvm-svn: 367375
2019-07-31 00:20:55 +00:00
Jonas Devlieghere 310f6b89b1 [TableGen] Reuse typedef across emitters (NFC)
This moves the std::map typedef into the header so it can be reused by
all the emitter implementations.

llvm-svn: 367363
2019-07-30 22:50:37 +00:00
Jonas Devlieghere a8ea595509 [lldb] Also include the array definition in Properties.inc
Right now our Properties.inc only generates the initializer for the
options list but not the array declaration boilerplate around it. As the
array definition is identical for all arrays, we might as well also let
the Properties.inc generate it alongside the initializers.

Unfortunately we cannot do the same for enums, as there's this magic
ePropertyExperimental, which needs to come at the end to be interpreted
correctly. Hopefully we can get rid of this in the future and do the
same for the property enums.

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

llvm-svn: 367238
2019-07-29 16:41:30 +00:00
Raphael Isemann 4e44c77ab3 [lldb][NFC] Split emitting and parsing in LLDBOptionDefEmitter
Splitting the different logic is cleaner and we it will be easier
to implement the enum emitting (which otherwise would have to
reimplement the Record parsing).

llvm-svn: 367207
2019-07-29 08:22:41 +00:00
Raphael Isemann bd68a052f2 [lldb] Also include the array definition in CommandOptions.inc
Summary:
Right now our CommandOptions.inc only generates the initializer for the options list but
not the array declaration boilerplate around it. As the array definition is identical for all arrays,
we might as well also let the CommandOptions.inc generate it alongside the initializers.

This patch will also allow us to generate additional declarations related to that option list in
the future (e.g. a enum class representing the specific options which would make our
handling code less prone).

This patch also fixes a few option tables that didn't follow our naming style.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 367186
2019-07-28 06:24:07 +00:00
Raphael Isemann 0ab0bb91aa [lldb] Don't dynamically allocate the posix option validator.
We dynamically allocate the option validator which means we
can't mark this list of OptionDefinitions as constexpr. It's also
more complicated than necessary.

llvm-svn: 367102
2019-07-26 11:46:21 +00:00
Jonas Devlieghere 7296fac558 [Tablegen] Fix issues caused by incorrect escaping.
The printEscapedString would escape newlines by their ASCII values
instead of prefixing them with a `\`. Remove the escaping logic and
escape the strings in the definition file.

llvm-svn: 367065
2019-07-25 22:17:08 +00:00
Jonas Devlieghere 971f9ca612 Let tablegen generate property definitions
Property definitions are currently defined in a PropertyDefinition array
and have a corresponding enum to index in this array. Unfortunately this
is quite error prone. Indeed, just today we found an incorrect merge
where a discrepancy between the order of the enum values and their
definition caused the test suite to fail spectacularly.

Tablegen can streamline the process of generating the property
definition table while at the same time guaranteeing that the enums stay
in sync. That's exactly what this patch does. It adds a new tablegen
file for the properties, building on top of the infrastructure that
Raphael added recently for the command options. It also introduces two
new tablegen backends: one for the property definitions and one for
their corresponding enums.

It might be worth mentioning that I generated most of the tablegen
definitions from the existing property definitions, by adding a dump
method to the struct. This seems both more efficient and less error
prone that copying everything over by hand. Only Enum properties needed
manual fixup for the EnumValues and DefaultEnumValue fields.

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

llvm-svn: 367058
2019-07-25 21:36:37 +00:00
Jonas Devlieghere 9870f6ad2c [TableGen] Fix comments/headers referencing clang (NFC)
Remove references to clang's TableGen implementation. Presumably these
files were originally copied over.

llvm-svn: 366982
2019-07-25 04:38:46 +00:00
Jonas Devlieghere 1cb102cac9 [lldb] Fix enum value description
llvm-svn: 366863
2019-07-23 22:46:16 +00:00
Jonas Devlieghere db1eb7c569 [utils] Remove sync-source (with SVN)
llvm-svn: 366833
2019-07-23 18:09:13 +00:00
Jonas Devlieghere 93f505942c [Utils] Add back utils directory
Due to a bug my earlier commit removed the whole utils directory:
https://reviews.llvm.org/D65123

llvm-svn: 366830
2019-07-23 17:47:08 +00:00
Jonas Devlieghere 6491076ec6 [Utils] Remove legacy scripts
As pointed out by Nathan in D65155, these scrips don't seem to serve any
real need anymore.

llvm-svn: 366827
2019-07-23 17:23:36 +00:00
Raphael Isemann f94668e336 [lldb][NFC] Tablegenify breakpoint
llvm-svn: 366673
2019-07-22 10:02:09 +00:00
Raphael Isemann ce8df1f41d [lldb] Don't double emit option groups
We currently emit the option groups twice if Groups<[1,2,3]> is
used in the tablegen. This leads to compilation errors. This
patch just removes the line that accidentially emits the option
group a second time.

llvm-svn: 366414
2019-07-18 08:22:11 +00:00
Nathan Lanza bd3e74c73d Only build lldb-tblgen if it's not a current target
Summary:
When doing standalone builds, you could potentially be building against
an llvm which also built lldb. If this were the case, you'd be
attempting to build this target twice.

Reviewers: xiaobai

Subscribers: mgorny

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

llvm-svn: 366394
2019-07-18 01:26:53 +00:00
Raphael Isemann 6f4fb4e7ad [lldb] Let table gen create command option initializers.
Summary:
We currently have man large arrays containing initializers for our command options.
These tables are tricky maintain as we don't have any good place to check them for consistency and
it's also hard to read (`nullptr, {}, 0` is not very descriptive).

This patch fixes this by letting table gen generate those tables. This way we can have a more readable
syntax for this (especially for all the default arguments) and we can let TableCheck check them
for consistency (e.g. an option with an optional argument can't have `eArgTypeNone`, naming of flags', etc.).

Also refactoring the related data structures can now be done without changing the hundred of option initializers.

For example, this line:
```
{LLDB_OPT_SET_ALL, false, "hide-aliases",         'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Hide aliases in the command list."},
```
becomes this:
```
  def hide_aliases : Option<"hide-aliases", "a">, Desc<"Hide aliases in the command list.">;
```

For now I just moved a few initializers to the new format to demonstrate the change. I'll slowly migrate the other
option initializers tables  in separate patches.

Reviewers: JDevlieghere, davide, sgraenitz

Reviewed By: JDevlieghere

Subscribers: jingham, xiaobai, labath, mgorny, abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 365908
2019-07-12 15:30:55 +00:00
Stefan Granitz 113320d3b6 [CMake] Fix lldb-dotest for single-config generators in standalone builds
Differential Revision: https://reviews.llvm.org/D62859

llvm-svn: 363279
2019-06-13 17:35:43 +00:00
Stefan Granitz 088410ffc6 [CMake] Add special case for processing LLDB_DOTEST_ARGS
Summary:
Allow to run the test suite when building LLDB Standalone with Xcode against a provided LLVM build-tree that used a single-configuration generator like Ninja.

So far both test drivers, lit-based `check-lldb` as well as `lldb-dotest`, were looking for test dependencies (clang/dsymutil/etc.) in a subdirectory with the configuration name (Debug/Release/etc.). It was implicitly assuming that both, LLDB and the provided LLVM used the same generator. In practice, however, the opposite is quite common: build the dependencies with Ninja and LLDB with Xcode for development*. With this patch it becomes the default.

(* In fact, it turned out that the Xcode<->Xcode variant didn't even build out of the box. It's fixed since D62879)

Once this is sound, I'm planning the following steps:
* add stage to the [lldb-cmake-standalone bot](http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/) to build and test it
* update `Building LLDB with Xcode` section in the docs
* bring the same mechanism to swift-lldb
* fade out the manually maintained Xcode project

On macOS build and test like this:
```
$ git clone https://github.com/llvm/llvm-project.git /path/to/llvm-project

$ cd /path/to/lldb-dev-deps
$ cmake -GNinja -C/path/to/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" /path/to/llvm-project/llvm
$ ninja

$ cd /path/to/lldb-dev-xcode
$ cmake -GXcode -C/path/to/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake -DLLDB_BUILD_FRAMEWORK=Off -DLLVM_DIR=/path/to/lldb-dev-deps/lib/cmake/llvm -DClang_DIR=/path/to/lldb-dev-deps/lib/cmake/clang /path/to/llvm-project/lldb
$ xcodebuild -configuration Debug -target check-lldb
$ xcodebuild -configuration Debug -target lldb-dotest
$ ./Debug/bin/lldb-dotest
```

Reviewers: JDevlieghere, jingham, xiaobai, stella.stamenova, labath

Reviewed By: stella.stamenova

Subscribers: labath, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 362803
2019-06-07 14:32:51 +00:00
Stefan Granitz a3388e5f9e [CMake] Folder structure for generated Xcode project to cover more targets
llvm-svn: 361799
2019-05-28 09:29:05 +00:00
Michal Gorny eae1493688 [lldb] [lit] Add tests for reading ZMM registers (AVX512)
Differential Revision: https://reviews.llvm.org/D61212

llvm-svn: 359439
2019-04-29 11:38:10 +00:00
Michal Gorny 2ff59e554b [lldb] [lit] Add register read tests for YMM registers (AVX)
Differential Revision: https://reviews.llvm.org/D61074

llvm-svn: 359304
2019-04-26 13:21:58 +00:00
Michal Gorny 9c3824aad7 [lldb] [lit] Add feature flags for native CPU features
Add a new lit-cpuid tool that detects CPU features used by some of
the tests, and use it to populate available_features in lit.  For now,
this means that the test for MM/XMM register read will be run only
when the host CPU support SSE instruction set.  However, this is going
to make it possible to introduce additional tests relying on AVX.

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

llvm-svn: 359303
2019-04-26 13:21:46 +00:00
Jonas Devlieghere 6ed7a95c9e [lldb-dotest] Print dotest.py invocation.
In order to debug a failing python test, you need to debug Python
instead of the wrapper. For a while I've been adding and removing this,
but I think it could be useful for everyone.

llvm-svn: 357554
2019-04-03 01:26:38 +00:00
Serge Guelton 3a22c3cc2b Python 2/3 compat: StringIO
Differential Revision: https://reviews.llvm.org/D59582

llvm-svn: 356910
2019-03-25 15:23:34 +00:00
Serge Guelton b833c6af59 Python 2/3 compat: queue vs Queue
Differential Revision: https://reviews.llvm.org/D59590

llvm-svn: 356906
2019-03-25 15:14:56 +00:00
Serge Guelton 525cd59f5a Python 2/3 compatibility: from __future__ import print_function
Differential Revision: https://reviews.llvm.org/D59580

llvm-svn: 356695
2019-03-21 18:27:40 +00:00
Serge Guelton 32cffcf1ab Use list comprehension instead of map/filter to prepare Python2/3 compat
Differential Revision: https://reviews.llvm.org/D59579

llvm-svn: 356647
2019-03-21 07:19:09 +00:00
Pavel Labath b302bd2324 Use sys.executable in lldb-dotest
Without that, dotest.py would be executed with the default python
interpreter, which may not be the same one that lldb is built with.

This still requires the user do know which python interpreter to use
when running lldb-dotest, but now he is at least able to choose it, if
he knows which one to use.

llvm-svn: 354105
2019-02-15 07:41:17 +00:00
James Y Knight 5d71fc5d7b Adjust documentation for git migration.
This fixes most references to the paths:
 llvm.org/svn/
 llvm.org/git/
 llvm.org/viewvc/
 github.com/llvm-mirror/
 github.com/llvm-project/
 reviews.llvm.org/diffusion/

to instead point to https://github.com/llvm/llvm-project.

This is *not* a trivial substitution, because additionally, all the
checkout instructions had to be migrated to instruct users on how to
use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of
checking out various projects into various subdirectories.

I've attempted to not change any scripts here, only documentation. The
scripts will have to be addressed separately.

Additionally, I've deleted one document which appeared to be outdated
and unneeded:
  lldb/docs/building-with-debug-llvm.txt

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

llvm-svn: 352514
2019-01-29 16:37:27 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
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
2019-01-19 08:50:56 +00:00
Bruce Mitchener 173946dca6 Fix typos.
Reviewers: lldb-commits

Subscribers: srhines, ki.stfu

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

llvm-svn: 343825
2018-10-04 22:33:39 +00:00
Jonas Devlieghere 52721286b2 [CMake] Unify and relayer testing
This patch restructures part of LLDB's testing configuration:

1. I moved the test dependencies up the chain so every dotest dependency
   becomes a lit dependency as well. It wouldn't make sense for dotest to
   have other dependencies when it's being run by lit. Lit on the other
   hand can still specify extra dependencies.

2. I replaced as much generator expressions with variables as possible.
   This is consistent with the rest of LLVM and doesn't break generators
   that support multiple targets (MSVC, Xcode). This wasn't a problem
   before, but now we need to expand the dotest arguments in the lit
   configuration and there's only one test suite even with multiple
   targets.

3. I moved lldb-dotest into it's own directory under utils since there's
   no need anymore for it to located under `test/`.

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

llvm-svn: 331463
2018-05-03 16:54:10 +00:00
Kate Stone b9c1b51e45 *** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style.  This kind of mass change has
*** two obvious implications:

Firstly, merging this particular commit into a downstream fork may be a huge
effort.  Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit.  The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):

    find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
    find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;

The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.

Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit.  There are alternatives available that will attempt
to look through this change and find the appropriate prior commit.  YMMV.

llvm-svn: 280751
2016-09-06 20:57:50 +00:00
Zachary Turner 9618980a19 Python 3: Modernize exception raising syntax.
Old-style: `raise foo, bar`
New-style: `raise foo(bar)`

These two statements are equivalent, but the former is an error in
Python 3.

llvm-svn: 251977
2015-11-03 21:01:45 +00:00
Todd Fiala 53e758b09c syncsource.py: a specific dir's source_excludes may now include the special entry "<no-defaults>".
The <no-defaults> special entry will prevent that specific directory's excludes from
receiving the global default source excludes.  This allows overriding the global default
in a specific instance, simplifying the syntax for that case.

llvm-svn: 249705
2015-10-08 17:43:02 +00:00
Todd Fiala 5493e31be0 Adjustments to syncsource.py.
- renamed sync-source.py to syncsource.py to appease pylint.
- added missing lib/transfer/__init__.py file.  Fumble from
  git to svn.
- adjusted README to call sync-source.py syncsource.py, and
  call .sync-sourcerc .syncsourcerc.
- marked syncsource.py as executable by all.

llvm-svn: 247922
2015-09-17 19:23:50 +00:00
Todd Fiala 37e56318ec Add sync-source.py utility.
See:
http://reviews.llvm.org/D12940

for more  details.

See utils/sync-source/README.txt for documentation
and a sample .sync-sourcerc file.

llvm-svn: 247903
2015-09-17 17:14:31 +00:00
Wei Pan 133ac8714d LUI: Fix some issues causing crashes in the source view
llvm-svn: 193217
2013-10-23 01:18:21 +00:00
Sriram Murali 1aeda01c44 lui: enable tab completion in command window
llvm-svn: 192814
2013-10-16 17:08:55 +00:00
Sriram Murali 8a0386654a prevent lui from crashing with small source files
llvm-svn: 192811
2013-10-16 16:48:43 +00:00
Ben Langmuir 4a665f1105 A couple of small visual improvements for lui
Change titles to white rather than green text to improve readability on blue
background, and use erase() instead of clear() to reduce flicker in the source
window.

llvm-svn: 192768
2013-10-16 03:01:04 +00:00
Ben Langmuir a084b33fb8 lui: clean up breakpoint window, and allow multi-line list items
* Clean the SBBreakpoint: id = out of the output
* clamp output to window width (eventually we should be able to scroll
left/right)
* On 'tab', expand a breakpoint to show its locations
* Allow enter/space to toggle breakpoints

llvm-svn: 192766
2013-10-16 02:01:41 +00:00
Ben Langmuir ac20991f1d Add a ListWin to cui to show scrollabled lists
Author: Paul Redmond <paul.redmond@intel.com>
llvm-svn: 192765
2013-10-16 02:00:21 +00:00
Daniel Malea e33c4ba05c Add LLVM license headers to lldb ui frontend
llvm-svn: 192466
2013-10-11 17:13:07 +00:00
Daniel Malea 4c3261d1b3 Initial checkin of curses-based LLDB UI (lui)
LLDB (Terminal) User Interface
==============================
This directory contains the curses user interface for LLDB. To use it, ensure Python can find your lldb module. You may have to modify PYTHONPATH for that purpose:

$ export PYTHONPATH=/path/to/lldb/module

Then, run the lui.py. To load a core file:
$ ./lui.py --core core

To create a target from an executable:
$ ./lui.py /bin/echo "hello world"

To attach to a running process:
$ ./lui.py --attach <pid>


Known Issues
============
1. Resizing the terminal will most likely cause lui to crash.
2. Missing paging in command-window
3. Only minimal testing (on Ubuntu Linux x86_64)

Missing Features
================
- stdin/stdout/stderr windows
- memory window
- backtrace window
- threads window
- tab-completion
- syntax-highlighting (via pygments library)
- (local) variables window
- registers window
- disassembly window
- custom layout

llvm-svn: 192326
2013-10-09 22:11:30 +00:00
Daniel Malea bb43721a35 Fixed continue issues with process attach/detach
- added code for tracking transition from eStateAttaching to eStateStopped in event listener and handling process continuation there.

Patch by Arthur Evstifeev!

llvm-svn: 182806
2013-05-28 21:27:03 +00:00