Commit Graph

19774 Commits

Author SHA1 Message Date
Alex Langford 24604ec799 [Core] Generalize ValueObject::MaybeCalculateCompleteType
Summary:
Instead of hardcoding ClangASTContext and ObjCLanguageRuntime, we can
generalize this by creating the method GetRuntimeType in
LanguageRuntime and moving the current MaybeCalculateCompleteType
implementation into ObjCLanguageruntime::GetRuntimeType

Reviewers: jingham, clayborg, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 365939
2019-07-12 18:34:37 +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
Nathan Lanza 320d6795b2 [windows] re-call signal in sigint_handler for Windows
Summary:
Windows requires re-setting the signal handler each time it is used
and thus ctrl-c was not behaving properly on Windows

Reviewers: jfb

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

llvm-svn: 365868
2019-07-12 04:43:46 +00:00
Alex Langford bab7e3d78b [Expression] Move IRDynamicChecks to ClangExpressionParser
Summary:
IRDynamicChecks in its current form is specific to Clang since it deals
with the C language family. It is possible that we may want to
instrument code generated for other languages, but we can factor in a
more general mechanism to do so at a later time.

This decouples ObCLanguageRuntime from Expression!

Reviewers: compnerd, clayborg, jingham, JDevlieghere

Subscribers: mgorny, lldb-commits

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

llvm-svn: 365853
2019-07-12 00:58:02 +00:00
Alex Langford 2c3c045dcb [Target] Replace Plugin headers with non-plugin headers
llvm-svn: 365843
2019-07-11 23:45:35 +00:00
Jonas Devlieghere f4af9a9d80 Add convenience methods to convert LLDB to LLVM data structures.
This patch adds two convenience methods named GetAsLLVM to the LLDB
counterparts of the DWARF DataExtractor and the DWARF context. The
DWARFContext, once created, is cached for future usage.

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

llvm-svn: 365819
2019-07-11 20:26:53 +00:00
Raphael Isemann 2bc8ab6852 [lldb] Make TestDeletedExecutable more reliable
Summary:
It seems that calling Popen can return to the caller before the started process has read all the needed information
from its executable. This means that in case we delete the executable while the process is still starting up,
this test will create a zombie process which in turn leads to a failing test. On my macOS system this happens quite frequently.

This patch fixes this by letting the test synchronize with the inferior after it has started up.

Reviewers: davide

Reviewed By: davide

Subscribers: labath, friss, lldb-commits

Tags: #lldb

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

llvm-svn: 365813
2019-07-11 19:27:33 +00:00
Raphael Isemann 60b71ce0e4 [lldb] Don't use __FUNCTION__ as a file name
Summary:
I saw while debugging that we call this file `ParseInternal`, which is not a very good name for our
fake expression file and also adds this unnecessary link between the way we name this function
and the other source location names we get from the expression parser. This patch is renaming
it to `<lldb-expr>` which is closer to the way Clang names its buffers, it doesn't depend on the
function name (which changes when I refactor this code) and it's easier to grep for.

Reviewers: davide

Reviewed By: davide

Subscribers: abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 365812
2019-07-11 19:26:55 +00:00
David Carlier 65d49fa60f [LLDB] Fix FreeBSD build.
To align with the LaunchThread change.

Reviewers: MaskRay, mgorny

Reviewed By: MaskRay

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

llvm-svn: 365761
2019-07-11 12:21:04 +00:00
Raphael Isemann df9051e7cf [lldb] Disable TestDollarInVariable.py on Windows
It seems on Windows we don't handle the lldb_expr_result variable correctly:

```
AssertionError: False is not True : 'expr $__lldb_expr_result' returns expected result, got '(int &) $0 = 0x0000000000000000'
```

I'll disable the test until I can find a way to debug this on Windows.

llvm-svn: 365719
2019-07-11 00:35:31 +00:00
Jonas Devlieghere 597dc0061f [swig] Add workaround for old swig
Apparently, when using swig 1.3.40, properties to set values do not work
without the `__swig_setmethods__` workaround. I conditionally added this
back for SBTypeCategory, as it's causing a test failure on GreenDragon,
while I investigate this further.

llvm-svn: 365718
2019-07-11 00:12:59 +00:00
Raphael Isemann 0171866672 [lldb] Fix handling of dollar characters in expr command
llvm-svn: 365698
2019-07-10 21:04:01 +00:00
Alex Langford 461a9d98d7 [Expression] IR Instrumenters should have a UtilityFunction
Right now, IR Instrumenters take a DynamicCheckerFunctions object which
has all the UtilityFunctions used to instrument IR for expressions.
However, each Instrumenter (in practice) uses exactly one
UtilityFunction, so let's change the abstraction.

llvm-svn: 365696
2019-07-10 20:41:36 +00:00
Nico Weber d24faac011 Add Python 3.6 and 3.7 to the version list
Python 3.6 and 3.7 have been released.

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

Patch from Christian Biesinger <cbiesinger@google.com>!

llvm-svn: 365688
2019-07-10 19:18:38 +00:00
Davide Italiano 89ed2e0a0a [scripts] Remove the unused 'shush' script.
There are pre-made utilities doing this. If somebody finds an
use for it and wants to resurrect, I would recommend to revise
the error messages.

llvm-svn: 365677
2019-07-10 18:13:46 +00:00
Pavel Labath 1abaeece71 Options: Reduce code duplication
Summary:
While investigating breakages caused by D63110, I noticed we were
building the short options strings in three places. Some of them used a
leading ':' to detect missing arguments, and some didn't. This was the
indirect cause of D63110. Here, I move the common code into a utility
function.

Also, unify the code which appends the sentinel value at the end of the
option vector, and make it harder for users to pass invalid argc-argv
combos to getopt (another component of D63110) by having the
OptionParser::Parse function take a (Mutable)ArrayRef.

This unification has uncovered that we don't handle missing arguments
while building aliases, However, it's not possible to write an effective
test for this, as right now it is not possible to return an error out of
the alias parsing code (which means we are printing the generic
"failure" message even after this patch).

Reviewers: mgorny, aprantl

Reviewed By: mgorny

Subscribers: lldb-commits

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

llvm-svn: 365665
2019-07-10 17:09:47 +00:00
Pavel Labath 0ace98c9df ObjectFileELF: Add support for gnu-style compressed sections
With this style, a compressed section is indicated by a "z" in the section
name, instead of a section header flag. This patch consists of two small tweaks:
- use an llvm Decompressor method in order to properly detect compressed sections
- make sure we recognise .zdebug_info (and friends) when classifying section types.

llvm-svn: 365654
2019-07-10 16:10:43 +00:00
Stefan Granitz bf223dff7e [CMake][NFC] Remove dead code lldb_append_link_flags() from AddLLDB.cmake
llvm-svn: 365651
2019-07-10 16:02:46 +00:00
Stefan Granitz 86d3c9fd1f [CMake][NFC] Polish comments in AddLLDB.cmake
llvm-svn: 365650
2019-07-10 16:00:03 +00:00
Stefan Granitz f554ce7f92 [CMake] Add Apple-lldb-Linux.cmake cache
llvm-svn: 365649
2019-07-10 15:59:56 +00:00
Stefan Granitz 839e305eb1 [CMake] Polish Apple-lldb caches
llvm-svn: 365648
2019-07-10 15:59:50 +00:00
Stefan Granitz 110f97632e [CMake] `install-distribution` for LLDB on Darwin
Summary:
There's a number of requirements for installing LLDB on macOS that are untypical for LLVM projects: use special install-prefix for LLDB.framework, ship headers and tools as framework resources, patch RPATHs, externalize debug-info to dSYM's and strip binaries with `-ST`. For some of it we could use `llvm_externalize_debuginfo()` in the past and just add special cases. However, this complicates the code for all projects and comes with the major drawback, that it adds all these actions at build-time, i.e. dSYM creation and stripping take a lot of time and don't make sense at build-time.

LLVM's distribution mechanism (https://llvm.org/docs/BuildingADistribution.html) appears to be the natural candidate to install LLDB. Based on D64399 (enable in standalone builds), this patch integrates framework installation with the distribution mechanism and adds custom stripping flags and dSYM creation at install-time. Unlike the abandoned D61952, it leaves build-tree binaries untouched, so there's no side-effects on testing. Potential install-order issues must be handled externally.

Please let me know what you think, while I run a few more tests and add remarks+documentation.

Reviewers: xiaobai, compnerd, JDevlieghere, davide, labath, mgorny

Reviewed By: xiaobai, JDevlieghere

Subscribers: lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 365617
2019-07-10 11:09:29 +00:00
Stefan Granitz 05adc0f317 [CMake] Distribution builds for LLDB standalone
Summary:
Enable `distribution` and `install-distribution` targets in LLDB standalone and pre-populate the cache accordingly on macOS.
Documentation for distribution builds is here: https://llvm.org/docs/BuildingADistribution.html

Reviewers: xiaobai, mgorny, JDevlieghere, davide, compnerd

Reviewed By: xiaobai, JDevlieghere

Subscribers: lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 365616
2019-07-10 11:09:11 +00:00
Stefan Granitz 685911ffce [CMake] Remove extra lldb-framework target
Summary: The custom lldb-framework target was meant to encapsulate all build steps that LLDB.framework needs on top of the ordinaly liblldb. In the end all of it happens in post-build steps, so we can do the same with liblldb and cut down another source of confusion.

Reviewers: xiaobai, JDevlieghere

Reviewed By: xiaobai, JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 365615
2019-07-10 11:09:01 +00:00
Aaron Smith 6858f337a8 Revert accidental change to file
llvm-svn: 365593
2019-07-10 03:41:34 +00:00
Aaron Smith 053eb35651 Try again to move common functionality from ProcessWindows into ProcessDebugger
This reverts commit ed499a36b6 and addresses
a problem causing a Windows build bot to hang.

llvm-svn: 365592
2019-07-10 03:34:57 +00:00
Alex Langford 269b9f940f [lldb] Quick Fix: IRExecutionUnit check pointer before access it
Summary:
Move checking pointer code block before accessing the pointer
This caused lldb to crash when testing on Android

Patch by Wanyi Ye!

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

llvm-svn: 365567
2019-07-09 22:24:54 +00:00
Alex Langford 695f7821e2 [lldb_test_suite] Fix lldb test suite targeting remote Android
Summary:
Fixed `Android.rules` for running test suite on remote android
- the build configuration is not compatible with ndk structure, change it to link to static libc++
- generally clang should be able to use libc++ and will link against the right library, but some libc++ installations require the user manually link libc++abi.
- add flag `-lc++abi` to fix the test binary build failure

Added `skipIfTargetAndroid` `skipUnlessTargetAndroid` for better test support
- the `skipIfPlatform` method will ask `lldbplatformutil.getPlatform()` for platform info which is actually the os type, and //Android// is not os type but environment
- create this function to handle the android target condition

**To Run Test on Remote Android**
1 start lldb-server on your devices
2 run lldb-dotest with following configuration:
`./lldb-dotest --out-of-tree-debugserver --arch aarch64 --platform-name remote-android --platform-url connect://localhost:12345 --platform-working-dir /data/local/tmp/ --compiler your/ndk/clang`

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: labath, javed.absar, kristof.beyls, srhines, lldb-commits

Tags: #lldb

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

llvm-svn: 365561
2019-07-09 21:35:58 +00:00
Dave Lee 90148db02a [Docs] Replace SVN revisions with lldb versions
Summary: Replaces references to svn commits with the lldb version number those commits first appeared in. Themotivation is to show that these features are no longer that new and can generally be adopted.

Reviewers: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 365559
2019-07-09 21:21:45 +00:00
Stella Stamenova 20ecec6116 [lldb, windows] Include WindowsError instead of ErrorHandling in ThreadLauncher
ErrorHandling.h does not include WindowsError.h which is needed for mapWindowsError

llvm-svn: 365533
2019-07-09 18:41:31 +00:00
Stella Stamenova 2ea514c566 [lldb-suite] Skip TestMachCore on Windows
This test was originally marked as expected failure on Windows, but it is timing out instead of outright failing now. The expectedFailure attribute does not correctly track timeouts (as in, they don't count as failures), so now this is causing the test suite to fail.

llvm-svn: 365527
2019-07-09 18:18:02 +00:00
Stella Stamenova 631b5f7dc0 [lldb, windows] Update two more locations that use LaunchThread to the new function signature
llvm-svn: 365526
2019-07-09 18:10:36 +00:00
Stefan Granitz e5b868d6a3 [CMake] Polish a comment
llvm-svn: 365459
2019-07-09 10:29:07 +00:00
Stefan Granitz e9298dc902 [CMake] Don't initialize LLVM_INSTALL_TOOLCHAIN_ONLY in Apple-lldb-base cache
llvm-svn: 365458
2019-07-09 10:29:00 +00:00
Stefan Granitz 189355f3ee [CMake] Remove old lldb_setup_framework_rpaths_in_tool()
llvm-svn: 365457
2019-07-09 10:28:53 +00:00
Jonas Devlieghere 53d5f3a08d Fix ASCII art header
llvm-svn: 365421
2019-07-09 01:35:34 +00:00
Jonas Devlieghere 4936cbc9f1 [Windows] Include ErrorHandling.h
Include ErrorHandling.h for mapWindowsError.

llvm-svn: 365420
2019-07-09 01:35:31 +00:00
Davide Italiano 68946d10ad [crashlog] Fix a mismatch between bytes and strings.
The functions in read_plist() want bytes as input, not
strings.

<rdar://problem/52600712>

llvm-svn: 365416
2019-07-09 01:05:12 +00:00
Jonas Devlieghere ba06f15ac8 [ThreadLauncher] Use mapWindowsError and LLDB_INVALID_HOST_THREAD
Address post-commit feedback from Pavel and Jim.

llvm-svn: 365403
2019-07-08 22:45:59 +00:00
Stella Stamenova 7f843e22ba [lldb, windows] When StartMonitoring fails, return a proper error
This is possible now that the function returns an llvm::Expected

llvm-svn: 365400
2019-07-08 22:09:08 +00:00
Jonas Devlieghere a5ede3182b Remove install-headers
After discussing this internally, it is my understanding this was used
for building LLDB internally at Apple, and is no longer used or
necessary.

llvm-svn: 365392
2019-07-08 21:53:22 +00:00
Jonas Devlieghere cbdf794872 Remove lldb-perf
As discussed offline, this tool is no longer used or maintained, and
doesn't provide the right abstraction for performance tracking in lldb.

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

llvm-svn: 365391
2019-07-08 21:38:34 +00:00
Jonas Devlieghere 39d1f2f5ea [Windows] Convert GetLastError to std::error_code
Create a std::error_code from the result of GetLastError, which in turn
we can use to return an llvm::Error.

llvm-svn: 365390
2019-07-08 21:19:02 +00:00
Stella Stamenova 05590baa07 [lldb] Fix two more issues in Windows following rL365226: Change LaunchThread interface to return an expected
A couple of the function signatures changed and they were not updated in the Windows HostProcess

llvm-svn: 365388
2019-07-08 21:17:58 +00:00
Stella Stamenova ed499a36b6 Revert "Move common functionality from processwindows into processdebugger"
This reverts commit 9c01eaff6a.

The changes in this commit are causing several of the LLDB tests to hang and/or timeout.

llvm-svn: 365371
2019-07-08 18:53:32 +00:00
Jonas Devlieghere 099231839a [Host] Fix out-of-line definition on Windows
Add missing interface changes after r365295.

llvm-svn: 365358
2019-07-08 17:45:11 +00:00
Jonas Devlieghere 2734f5c89c [Host] Fix out-of-line definition of StartMonitoringChildProcess
llvm-svn: 365344
2019-07-08 16:31:37 +00:00
Michal Gorny 10c96cabc1 [lldb] [test] Update NetBSD XFAILs in test suite
llvm-svn: 365338
2019-07-08 16:16:07 +00:00
Fangrui Song 23d10f7a4e Change LaunchThread interface to return an Expected for non-Apple-non-Windows
Fixes Linux build errors after D64163/r365226

llvm-svn: 365295
2019-07-08 07:07:05 +00:00
Saleem Abdulrasool 842f55f3ef Process: generalise Windows thread setup
The Windows build currently cannot support debugging foreign targets or
debugging Windows ARM NT and Windows ARM64 targets.  Do not assume a
x64/x86 host.  This enables building lldb for Windows ARM64.

llvm-svn: 365282
2019-07-07 17:58:11 +00:00