Commit Graph

20817 Commits

Author SHA1 Message Date
Raphael Isemann ffe170c6e2 [lldb] Fix minidebuginfo-set-and-hit-breakpoint.test
This was failing for me because of this error:
llvm-objcopy: error: 'build/tools/lldb/test/ObjectFile/ELF/Output/minidebuginfo-set-and-hit-breakpoint.test.tmp.mini_debuginfo': section '.dynsym' cannot be removed because it is referenced by the section '.hash'

Patch by Konrad Kleine!

llvm-svn: 374352
2019-10-10 14:00:32 +00:00
Raphael Isemann ccd54a1349 [lldb] Add log output for the support files we pass to the CppModuleConfiguration
CppModuleConfiguration is the most likely point of failure when we have weird
setups where we fail to load a C++ module. With this logging it should be easier
to figure out why we can't find a valid configuration as the configuration only
depends on the list of file paths.

llvm-svn: 374350
2019-10-10 13:43:37 +00:00
Pavel Labath 5070322332 Fix the unwinding plan augmentation from x86 assembly
Unwind plan augmentation should compute the plan row at offset x from
the instruction before offset x, but currently we compute it from the
instruction at offset x. Note that this behavior is a regression
introduced when moving the x86 assembly inspection engine to its own
file
(1c9858b298 (diff-375a2be066db6f34bb9a71442c9b71fcL913));
the original version handled this properly by copying the previous
instruction out before advancing the instruction pointer.

The relevant bug with more info is here: https://bugs.llvm.org/show_bug.cgi?id=43561

Differential Revision: https://reviews.llvm.org/D68454
Patch by Jaroslav Sevcik <jarin@google.com>.

llvm-svn: 374342
2019-10-10 13:23:09 +00:00
Pavel Labath c8c71e6f76 Fix some dangling else warnings
EXPECT_EQ contains an if-else statement. It also contains some magic to
suppress the dangling else warnings, but it seems that some new
compilers can see through that...

llvm-svn: 374341
2019-10-10 13:23:02 +00:00
Raphael Isemann f5b2b76008 [lldb] Make sure import-std-module/sysroot actually passes for the right reasons
This test was previously passing because myabs was actually emitted into the
debug information and we called that. The test itself was broken as it didn't
use the libc++ directory structure (the /v1/ directory was just called /include/).

This patch gives myabs a default argument which we can't get from debug information
and inlines the function to make sure we can't call it from LLDB without loading
the C++ module.

llvm-svn: 374335
2019-10-10 12:57:14 +00:00
Pavel Labath 342b1b2e9b File: Handle more cases in GetOptionsFromMode
The "b" (binary) flag is meaningless most of the time, but the relevant
standars allow it. The standards permit one to spell it both as "r+b"
and "rb+", so handle both cases.

This fixes TestFileHandle.test_binary_inout with python2.

llvm-svn: 374331
2019-10-10 12:40:27 +00:00
Aleksandr Urakov 0891366571 [Windows] Introduce a switch for the `lldb-server` mode on Windows
Summary:
This patch introduces a switch, based on the environment variable
`LLDB_USE_LLDB_SERVER`, to determine whether to use the `ProcessWindows` plugin
(the old way) or the `lldb-server` way for debugging on Windows.

Reviewers: labath, amccarth, asmith, stella.stamenova

Reviewed By: labath, amccarth

Subscribers: mstorsjo, abidh, JDevlieghere, lldb-commits, leonid.mashinskiy

Tags: #lldb

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

llvm-svn: 374325
2019-10-10 12:21:04 +00:00
Pavel Labath 44506cd7f2 TestFileHandle.py: relax exception type checks
the exceptions returned differ between swig4 (TypeError) and swig<=3
(NotImplementedError). Just check for the base Exception class instead.

Theoretically we could switch on the swig version and expect the precise
type directly, but checking the exact type does not seem that important.

Thanks to Raphael for helping me figure this out.

llvm-svn: 374322
2019-10-10 12:07:30 +00:00
Raphael Isemann 95e264fc8a [lldb][NFC] Remove strange bool parameter from Searcher::SearchCallback
Summary:
The SearchCallback has a bool parameter that we always set to false, we never use in any callback implementation and that also changes its name
from one file to the other (either `containing` and `complete`). It was added in the original LLDB check in, so there isn't any history what
this was supposed to be, so let's just remove it.

Reviewers: jingham, JDevlieghere, labath

Reviewed By: jingham, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374313
2019-10-10 11:26:51 +00:00
Raphael Isemann 067bb1f546 [lldb] Fix out of bounds read in DataExtractor::GetCStr and add unit test that function.
Summary:
The `if (*cstr_end == '\0')` in the previous code checked if the previous loop terminated because it
found a null terminator or because it reached the end of the data. However, in the case that we hit
the end of the data before finding a null terminator, `cstr_end` points behind the last byte in our
data and `*cstr_end` reads the memory behind the array (which may be uninitialised)

This patch just rewrites that function use `std::find` and adds the relevant unit tests.

Reviewers: labath

Reviewed By: labath

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

llvm-svn: 374311
2019-10-10 11:15:38 +00:00
Raphael Isemann 186f1c58c5 [lldb][NFC] Use llvm::all_of instead of std::all_of in CppModuleConfiguration
llvm-svn: 374307
2019-10-10 10:56:12 +00:00
Pavel Labath c92a75fec0 s/@expectedFailure/@expectedFailureAll in TestFileHandle
The test isn't using @expectedFailure correctly, which causes weird
errors, at least with python2, at least with linux. Possibly that
function shouldn't even be public as it's main use is as a backed for
other decorators.

llvm-svn: 374299
2019-10-10 09:52:32 +00:00
Raphael Isemann 7c47b4a113 [lldb][NFC] Use unique_ptr in DiagnosticManager to express ownership
llvm-svn: 374289
2019-10-10 08:30:10 +00:00
Jason Molenda d6e9e99cec Change debugserver to use the brk #0 for breakpoints.
debugserver had been using an instruction that would work
for armv7 or aarch64 processes, but we don't have armv7 code
running on arm64 devices any more so this is unnecessary.

<rdar://problem/56133118>

llvm-svn: 374264
2019-10-10 00:12:05 +00:00
Frederic Riss 80b080723f TestMTCSimple.py: allow the test to run on Darwin embedded platforms
The test needed some updates to run using a different UI toolkit
and with a different libMTC, but it should run fine on a device.

llvm-svn: 374262
2019-10-09 23:52:31 +00:00
Frederic Riss adc5043fa2 TestIndirectSymbols: Modernize the Makefile
This old test used a completely hand-rolled Makefile. Modernize so that
it's able to cross-compile. And XFAIL the test as it fails on embedded
targets...

llvm-svn: 374256
2019-10-09 22:47:28 +00:00
Frederic Riss 0e891bcf79 Makefile.rules: add missing CODESIGN call
When building an executable and a shared library at the same time (yes,
Makefile.rules is setup to do this!) the executable was not codesigned.

llvm-svn: 374251
2019-10-09 22:35:56 +00:00
Haibo Huang 1a50941771 [lldb] Put site-packages into a sub dir of CMAKE_CFG_INTDIR
Summary: Fixes issue like D68719

Reviewers: tatyana-krasnukha

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 374250
2019-10-09 22:34:55 +00:00
Greg Clayton dc9276b7d7 Set eRegisterKindEHFrame register numbers for 32 bit ARM register contexts in minidumps
Stack unwinding was sometimes failing when trying to unwind stacks in 32 bit ARM. I discovered this was because the EH frame register numbers were not set. This patch fixes this issue and adds a unit test to verify this doesn't regress.

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

llvm-svn: 374246
2019-10-09 22:16:12 +00:00
Jonas Devlieghere f204914fee [CMake] Use the correct lit.cfg.py
llvm-svn: 374244
2019-10-09 22:09:57 +00:00
Greg Clayton 0156be59b4 Fix a crasher due to an assert when two files have the same UUID but different paths.
Summary: The PlaceholderObjectFile has an assert in SetLoadAddress that fires if "m_base == value" is not true. To avoid this, we create check that the base address matches, and if it doesn't we clear the module that was found using the UUID so that we create a new PlaceholderObjectFile. Added a test to cover this issue.

Reviewers: labath, aadsm, dvlahovski

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374242
2019-10-09 22:03:15 +00:00
Lawrence D'Anna 5da2bc22ba remove a smattering of isolated, unnecessary uses of FILE*
Summary:
There a a few call sites that use FILE* which are easy to
fix without disrupting anything else.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374239
2019-10-09 21:50:52 +00:00
Lawrence D'Anna 9eb1371923 SBFile support in SBCommandReturnObject
Summary:
This patch add SBFile interfaces to SBCommandReturnObject, and
removes the internal callers of its FILE* interfaces.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374238
2019-10-09 21:50:49 +00:00
Lawrence D'Anna b24022cd72 SBFile: add a bunch of tests that should eventually work.
Summary:
It's really annoying and confusing to have to keep referring
back to earlier versions of this SBFile work to find the
tests that need to be added for each patch, and not duplicate
them with new tests.

This patch just imports all my tests.   A bunch of them don't
work yet, so they are marked to be skipped.   They'll be
unmarked as I fix them.

One of these tests will actually trip an assert in the SWIG
code now instead of just failing, so I'm fixing that here too.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374237
2019-10-09 21:50:46 +00:00
Jonas Devlieghere 865cd0932f [Reproducer] Add convenience methods IsCapturing and IsReplaying.
Add convenience methods to the Reproducer class for when you don't need
access to the generator and the loader.

llvm-svn: 374236
2019-10-09 21:47:49 +00:00
Frederic Riss ffb26d9c78 TestHelloWorld: Make compatible with remote testing
The synchronization token handling was not remote-friendly.

llvm-svn: 374234
2019-10-09 21:41:02 +00:00
Cameron Desrochers 745e57c593 [LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduced in r374195
Differential Revision: https://reviews.llvm.org/D68641

llvm-svn: 374231
2019-10-09 21:15:48 +00:00
Jonas Devlieghere 988ad41948 [LLDB] Remove standalone build dep on llvm-strip
When building standalone, since llvm-strip is a symlink, it is created
using add_custom_command/add_custom_target which cannot be exported, and
thus cannot be depended on by lldb.

Patch by: Gwen Mittertreiner

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

llvm-svn: 374229
2019-10-09 21:06:03 +00:00
Jim Ingham c0da1282fc Revert "[lldb] Calculate relative path for symbol links"
This reverts commit 958091c209.

This commit incorrectly sets the _lldb.so symlink (at least it does when
building in Stefans' two build directory mode, where you build llvm with
cmake/ninja and lldb with cmake/Xcode, using a cmake generated project.

The _lldb.so link is SUPPOSED to point to:

bin/LLDB.framework/Versions/A/LLDB

but instead it points to

bin/LLDB

which is where LLDB was staged to before constructing the framework.  This
causes all sorts of problems when we then build the lldb driver into bin -
remember that MacOS is a case-preserving but case insensitive filesystem -
so when we later go to dlopen _lldb.so, we dlopen the main executable instead.

llvm-svn: 374226
2019-10-09 20:56:43 +00:00
Lawrence D'Anna 21b8a8ae27 allow arbitrary python streams to be converted to SBFile
Summary:
This patch adds SWIG typemaps that can convert arbitrary python
file objects into lldb_private::File.

A SBFile may be initialized from a python file using the
constructor.   There are also alternate, tagged constructors
that allow python files to be borrowed, and for the caller
to control whether or not the python I/O methods will be
called even when a file descriptor is available.I

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: zturner, amccarth, lldb-commits

Tags: #lldb

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

llvm-svn: 374225
2019-10-09 20:56:17 +00:00
Frederic Riss 868b47fcbe Skip Apple simulator test for all remote testing scenarios.
The test makes no sense to run remotely, period. The architecture of
the target is not the discriminant here.

llvm-svn: 374217
2019-10-09 20:39:04 +00:00
Jonas Devlieghere d61ef7c46d [CMake] Fix add_lldb_test_dependency
This function would ignore all but the first argument. Now it correctly
adds every dependency by iterating over its arguments.

llvm-svn: 374216
2019-10-09 20:36:29 +00:00
Jonas Devlieghere be1c290226 [utils] Update lldb-dotest for new test layout
The path to dotest.py changed after the test directory reorganization.

llvm-svn: 374215
2019-10-09 20:30:54 +00:00
Vedant Kumar c7cfa7c34e [test] Skip entry value test when clang < 10.0.0
clang-9 emitted the wrong opcode for entry values on Darwin.

rdar://56119661

llvm-svn: 374212
2019-10-09 20:21:33 +00:00
Jonas Devlieghere 87aa9c9e4d Re-land "[test] Split LLDB tests into API, Shell & Unit"
The original patch got reverted because it broke `check-lldb` on a clean
build. This fixes that.

llvm-svn: 374201
2019-10-09 19:22:02 +00:00
Lawrence D'Anna 609010d063 protect libedit and LLDB gui from receiving null FILE* streams
Summary:
We now have valid files that will return NULL from GetStream().
libedit and the LLDB gui are the only places left that need FILE*
streams.  Both are doing curses-like user interaction that only
make sense with a real terminal anyway, so there is no need to convert
them off of their use of FILE*.   But we should check for null streams
before enabling these features.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374197
2019-10-09 18:43:03 +00:00
Cameron Desrochers 89386daa95 [LLDB] Fix for synthetic children memory leak
The lifetime of a ValueObject and all its derivative ValueObjects (children, clones, etc.) is managed by a ClusterManager. These objects are only destroyed when every shared pointer to any of the managed objects in the cluster is destroyed. This means that no object in the cluster can store a shared pointer to another object in the cluster without creating a memory leak of the entire cluster. However, some of the synthetic children front-end implementations do exactly this; this patch fixes that.

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

llvm-svn: 374195
2019-10-09 18:27:33 +00:00
Antonio Afonso 70aa6fb6e3 Update breakpad lit test to be independent of the unnamed symbol number
llvm-svn: 374192
2019-10-09 18:02:59 +00:00
Adrian Prantl 0115c10328 Revert [test] Split LLDB tests into API, Shell & Unit
as it appears to have broken check-lldb.

This reverts r374184 (git commit 22314179f0)

llvm-svn: 374187
2019-10-09 17:35:43 +00:00
Adrian Prantl f98606f177 Remove obsolete parameter.
llvm-svn: 374185
2019-10-09 16:55:27 +00:00
Jonas Devlieghere 22314179f0 [test] Split LLDB tests into API, Shell & Unit
LLDB has three major testing strategies: unit tests, tests that exercise
the SB API though dotest.py and what we currently call lit tests. The
later is rather confusing as we're now using lit as the driver for all
three types of tests. As most of this grew organically, the directory
structure in the LLDB repository doesn't really make this clear.

The 'lit' tests are part of the root and among these tests there's a
Unit and Suite folder for the unit and dotest-tests. This layout makes
it impossible to run just the lit tests.

This patch changes the directory layout to match the 3 testing
strategies, each with their own directory and their own configuration
file. This means there are now 3 directories under lit with 3
corresponding targets:

 - API (check-lldb-api): Test exercising the SB API.
 - Shell (check-lldb-shell): Test exercising command line utilities.
 - Unit (check-lldb-unit): Unit tests.

Finally, there's still the `check-lldb` target that runs all three test
suites.

Finally, this also renames the lit folder to `test` to match the LLVM
repository layout.

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

llvm-svn: 374184
2019-10-09 16:38:47 +00:00
Adrian Prantl 939411c1aa Remove the is_mangled flag from Mangled and Symbol
Testing whether a name is mangled or not is extremely cheap and can be
done by looking at the first two characters. Mangled knows how to do
it. On the flip side, many call sites that currently pass in an
is_mangled determination do not know how to correctly do it (for
example, they leave out Swift mangling prefixes).

This patch removes this entry point and just forced Mangled to
determine the mangledness of a string itself.

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

llvm-svn: 374180
2019-10-09 16:22:14 +00:00
Hans Wennborg 1e1e3ba252 Unify the two CRC implementations
David added the JamCRC implementation in r246590. More recently, Eugene
added a CRC-32 implementation in r357901, which falls back to zlib's
crc32 function if present.

These checksums are essentially the same, so having multiple
implementations seems unnecessary. This replaces the CRC-32
implementation with the simpler one from JamCRC, and implements the
JamCRC interface in terms of CRC-32 since this means it can use zlib's
implementation when available, saving a few bytes and potentially making
it faster.

JamCRC took an ArrayRef<char> argument, and CRC-32 took a StringRef.
This patch changes it to ArrayRef<uint8_t> which I think is the best
choice, and simplifies a few of the callers nicely.

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

llvm-svn: 374148
2019-10-09 09:06:30 +00:00
Raphael Isemann 4e969da33e [lldb] Don't crash when the ASTImporter produces diagnostics but instead log them.
When playing with the C++ module prototype I noticed I can get LLDB to crash
by making a result type that depends on __make_integer_seq (a BuiltinTemplate)
which is not supported by the ASTImporter yet. This causes the ASTImporter to emit
a diagnostic when copying the type to the ScratchASTContext. As deporting the result
type is done after we are done parsing and the Clang's diagnostic engine asserts that
it can only be used during parsing, it crashes LLDB while trying to render the diagnostic
in the HandleDiagnostic method of ClangDiagnosticManagerAdapter.

This patch just moves the HandleDiagnostic call to Clang behind our check that we still
have a DiagnosticManager (which we remove after parsing) which prevents the assert
from firing. We also shouldn't ignore such diagnostics, so I added a log statement for
them.

There doesn't seem to way to test this as these diagnostic only happen when we copy
a node that's not supported by the ASTImporter which should never happen once
we can copy everything with the ASTImporter, so every test case we add here will
eventually become invalid.

(Note that most of this diff is just whitespace changes as we now use an early exit
instead of a huge 'if' block).

llvm-svn: 374145
2019-10-09 08:30:06 +00:00
Antonio Afonso ad6690afa3 Explicitly set entry point arch when it's thumb [Second Try]
Summary:
This is a redo of D68069 because I reverted it due to some concerns that were now addressed along with the new comments that @labath added.

I found a case where the main android binary (app_process32) had thumb code at its entry point but no entry in the symbol table indicating this. This made lldb set a 4 byte breakpoint at that address (we default to arm code) instead of a 2 byte one (like we should for thumb).
The big deal with this is that the expression evaluator uses the entry point as a way to know when a JITed expression has finished executing by putting a breakpoint there. Because of this, evaluating expressions on certain android devices (Google Pixel something) made the process crash.
This was fixed by checking this specific situation when we parse the symbol table and add an artificial symbol for this 2 byte range and indicating that it's arm thumb.

I created 2 unit tests for this, one to check that now we know that the entry point is arm thumb, and the other to make sure we didn't change the behaviour for arm code.

I also run the following on the command line with the `app_process32` where I found the issue:
**Before:**
```
(lldb) dis -s 0x1640 -e 0x1644
app_process32[0x1640]: .long  0xf0004668                ; unknown opcode
```
**After:**
```
(lldb) dis -s 0x1640 -e 0x1644
app_process32`:
app_process32[0x1640] <+0>: mov    r0, sp
app_process32[0x1642]:      andeq  r0, r0, r0
```

Reviewers: clayborg, labath, wallace, espindola

Reviewed By: labath

Subscribers: labath, lldb-commits, MaskRay, kristof.beyls, arichardson, emaste, srhines

Tags: #lldb

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

llvm-svn: 374132
2019-10-08 23:44:49 +00:00
Adrian Prantl 35b63a435c Revert Trust the arange accelerator tables in dSYMs
This reverts r374117 (git commit 6399db2f6f)
while inspecting bot breakage.

llvm-svn: 374121
2019-10-08 21:34:22 +00:00
Adrian Prantl 6399db2f6f Trust the arange accelerator tables in dSYMs
When ingesting aranges from a dSYM it makes sense to always trust the
contents of the accelerator table since it always comes from
dsymutil. According to Instruments, skipping the decoding of all CU
DIEs to get at the DW_AT_ranges attribute removes ~3.5 seconds from
setting a breakpoint by file/line when debugging clang with a
dSYM. Interestingly on the wall clock the speedup is less noticeable,
but still present.

rdar://problem/56057688

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

llvm-svn: 374117
2019-10-08 21:14:36 +00:00
Vedant Kumar 4805c817c3 StopInfo/Mach: Delete PPC support
LLDB appears to have at least partial support for PPC, but PPC on Mach
isn't a thing AFAIK.

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

llvm-svn: 374114
2019-10-08 20:47:44 +00:00
Frederic Riss b56e3a1723 Add test coverage to printing of enums and fix display of unsigned values
TestCPP11EnumTypes.py should have covered all our bases when it comes
to typed enums, but it missed the regression introduced in r374066.
The reason it didn't catch it is somewhat funny: the test was copied
over from another test that recompiled a source file with a different
base type every time, but neither the test source nor the python code
was adapted for testing enums. As a result, this test was just running
8 times the exact same checks on the exact same binary.

This commit fixes the coverage and addresses the issue revealed by
the new tests.

llvm-svn: 374108
2019-10-08 19:52:01 +00:00
Vedant Kumar 07c5f2a9b0 StopInfo/Mach: Use early-exits, reflow messy comments, NFCI
llvm-svn: 374106
2019-10-08 19:40:13 +00:00
Jonas Devlieghere b328dcbf85 [Reproducer] Don't isntrument methods that get called from the signal handler.
LLDB's signal handlers call SBDebugger methods, which themselves try to
be really careful about not doing anything non-signal safe. The
Reproducer record macro is not careful though, and does unsafe things
which potentially caused LLDB to crash. Given that these methods are not
particularly interesting I've swapped the RECORD macros with DUMMY ones,
so that we still register the API boundary but don't do anything
non-signal safe.

Thanks Jim for figuring this one out!

llvm-svn: 374104
2019-10-08 19:17:42 +00:00
Alex Langford 28fcc033c8 [CMake] Fix building without python on Windows
Summary: find_python_libs_windows might set LLDB_DISABLE_PYTHON to ON.
Unfortunately we do not re-check this variable before using variables filled in
by find_python_libs_windows, leading to a failed configuration.

llvm-svn: 374100
2019-10-08 18:38:46 +00:00
Adrian Prantl 065d34dbe1 Reflow/fix doxygen comments.
llvm-svn: 374096
2019-10-08 18:04:49 +00:00
Frederic Riss 5d415b706f Fix sign extension handling in DumpEnumValue
When an enumerator has an unsigned type and its high bit set, the
code introduced in r374067 would fail to match it due to a sign
extension snafu. This commit fixes this aspec of the code and should
fix the bots.

I think it's not a complete fix though, I'll add more test coverage
and additional tweaks in a follow-up commit.

llvm-svn: 374095
2019-10-08 17:59:02 +00:00
Lawrence D'Anna 085328eeee exception handling in PythonDataObjects.
Summary:
Python APIs nearly all can return an exception.   They do this
by returning NULL, or -1, or some such value and setting
the exception state with PyErr_Set*().   Exceptions must be
handled before further python API functions are called.   Failure
to do so will result in asserts on debug builds of python.
It will also sometimes, but not usually result in crashes of
release builds.

Nearly everything in PythonDataObjects.h needs to be updated
to account for this.   This patch doesn't fix everything,
but it does introduce some new methods using Expected<>
return types that are safe to use.

split off from https://reviews.llvm.org/D68188

Reviewers: JDevlieghere, jasonmolenda, labath, zturner

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374094
2019-10-08 17:56:18 +00:00
Adrian Prantl 8db229e287 ObjectFileMachO: Replace std::map with llvm::DenseMap (NFC)
This makes parsing the symbol table of clang marginally faster. (Hashtable versus tree).

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

llvm-svn: 374084
2019-10-08 16:59:24 +00:00
Adrian Prantl ea63775054 Replace regex match with rfind (NFCish)
This change is mostly performance-neutral since our regex engine is
fast, but it's IMHO slightly more readable.  Also, matching matching
parenthesis is not a great match for regular expressions.

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

llvm-svn: 374082
2019-10-08 16:29:39 +00:00
Adrian Prantl 917b8df0e5 Replace static const StringRef with StringRef (NFC)
Differential Revision: https://reviews.llvm.org/D68597

llvm-svn: 374081
2019-10-08 16:29:36 +00:00
Adrian Prantl bde5a6a45a Remove constructor and unused method (NFC).
Differential Revision: https://reviews.llvm.org/D68595

llvm-svn: 374080
2019-10-08 16:29:33 +00:00
Shafik Yaghmour 02376077be Revert "[platform process list] add a flag for showing the processes of all users"
This reverts commit 080f35fb875f52c924ee37ed4d56a51fe7056afa.

 Conflicts:
	packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py

llvm-svn: 374077
2019-10-08 16:24:28 +00:00
Frederic Riss 3fb4e49a68 [Testsuite] Get rid of most of the recursive shared library Makefiles
Most of the secondary Makefiles we have are just a couple variable
definitions and then an include of Makefile.rules. This patch removes
most of the secondary Makefiles and replaces them with a direct
invocation of Makefile.rules in the main Makefile. The specificities
of each sub-build are listed right there on the recursive $(MAKE)
call. All the variables that matter are being passed automagically by
make as they have been passed on the command line. The only things you
need to specify are the variables customizating the Makefile.rules
logic for each image.

This patch also removes most of the clean logic from those Makefiles
and from Makefile.rules. The clean rule is not required anymore now
that we run the testsuite in a separate build directory that is wiped
with each run. The patch leaves a very crude version of clean in
Makefile.rules which removes everything inside of $(BUILDDIR). It does
this only when the $(BUILDDIR) looks like a sub-directory of our
standard testsuite build directory to be extra safe.

Reviewers: aprantl, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374076
2019-10-08 16:23:28 +00:00
Konrad Kleine 6d7fb29914 [lldb] Avoid resource leak
Summary:
Before the pointer variable `args_dict` was assigned the result of an
allocation with `new` and then `args_dict` is passed to
`GetValueForKeyAsDictionary` which immediatly and unconditionally
assigns `args_dict` to `nullptr`:

```
    bool GetValueForKeyAsDictionary(llvm::StringRef key,
                                    Dictionary *&result) const {
      result = nullptr;
```

This caused a memory leak which was found in my coverity scan instance
under CID 224753: https://scan.coverity.com/projects/kwk-llvm-project.

Reviewers: jankratochvil, teemperor

Reviewed By: teemperor

Subscribers: teemperor, lldb-commits

Tags: #lldb

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

llvm-svn: 374071
2019-10-08 15:56:02 +00:00
Konrad Kleine 8970d88b65 Simplify LZMA decoding by using ArrayRef::take_back
Summary: Follow-up for D66791#inline-616303

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374069
2019-10-08 15:43:29 +00:00
Frederic Riss 41ff39605e Add pretty printing of Clang "bitfield" enums
Summary:
Using enumerators as flags is standard practice. This patch adds
support to LLDB to display such enum values symbolically, eg:

(E) e1 = A | B

If enumerators don't cover the whole value, the remaining bits are
displayed as hexadecimal:

(E) e4 = A | 0x10

Detecting whether an enum is used as a bitfield or not is
complicated. This patch implements a heuristic that assumes that such
enumerators will either have only 1 bit set or will be a combination
of previous values.

This patch doesn't change the way we currently display enums which the
above heuristic would not consider as bitfields.

Reviewers: jingham, labath

Subscribers: lldb-commits

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

llvm-svn: 374067
2019-10-08 15:35:59 +00:00
Frederic Riss d6470fb01a Extract and simplify DumpEnumValue
llvm-svn: 374066
2019-10-08 15:35:58 +00:00
Pavel Labath 9a44ab7763 Tweak minidebuginfo-set-and-hit-breakpoint.test
On my system, llvm-objcopy was refusing to remove the .dynsym section
because it was still referenced from .rela.plt. Remove that section too,
and clarify that this is needed only because llvm-objcopy
--only-keep-debug does not work (does not set the sections to
SHT_NOBITS). Also, ensure that the test is not creating temporary files
in the source tree.

llvm-svn: 374046
2019-10-08 13:51:05 +00:00
Pavel Labath c41294705b Revert "[lldb-server/android] Show more processes and package name when necessary"
This reverts r373758 because it causes several to test to be flaky (=
failing ~90% of the time) on linux.

llvm-svn: 374030
2019-10-08 09:05:31 +00:00
Pavel Labath 07932b1088 Fix a -Wpedantic warning
namespace-closing '}' don't need ';'.

llvm-svn: 374029
2019-10-08 09:05:25 +00:00
Jonas Devlieghere e21399b02e Revert "ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested"
This breaks TestProcessAttach and TestHelloWorld on Darwin.

llvm-svn: 374008
2019-10-08 01:16:59 +00:00
Lawrence D'Anna 68491f5072 test fix: TestLoadUsingPaths should use realpath
Summary:
TestLoadUsingPaths will fail if the build directory has
symlinks in its path, because the real paths reported by
the debugger won't match the symlink-laden paths it's expecting.

This can be solved just by using os.path.realpath on the base
path for the test.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374007
2019-10-08 01:16:29 +00:00
Antonio Afonso ffc67f9251 Fixing missing lldb-scripts rename from D68370
llvm-svn: 374005
2019-10-08 01:10:03 +00:00
Jonas Devlieghere ce3314cf28 [CMake] Add two more uses of add_lldb_test_dependency
llvm-svn: 374000
2019-10-08 00:44:54 +00:00
Haibo Huang 0016b450be [lldb] Reverts part of 61f471a
Seems I wrongly merged an old patch.

Reverts the change related to python dir for windows.

FileSpec should always contain normalized path. I.e. using '/' even in
windows.

llvm-svn: 373998
2019-10-08 00:33:26 +00:00
Lawrence D'Anna 5d10e417e9 DWIMy filterspecs for dotest.py
Summary:
dotest.py currently requires a filterspec to be of the
form `TestCase.test_method`.   This patch makes it more
flexible, so you can pass `TestModule.TestCase.test_method`
or `TestModule.TestCase` or `TestCase.test_method` or just
`test_method`.

This makes it more convenient to just copy a test name
out of the terminal after running a bunch of tests and use
it as a filterspec.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere

Subscribers: jingham, lldb-commits

Tags: #lldb

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

llvm-svn: 373997
2019-10-08 00:26:53 +00:00
Jonas Devlieghere 37cf39df20 [CMake] Track test dependencies with add_lldb_test_dependency
I often use `ninja lldb-test-deps` to build all the test dependencies
before running a subset of the tests with `lit --filter`. This
functionality seems to break relatively often because test dependencies
are tracked in an ad-hoc way acrooss cmake files. This patch adds a
helper function `add_lldb_test_dependency` to unify test dependency
tracking by adding dependencies to lldb-test-deps.

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

llvm-svn: 373996
2019-10-08 00:21:34 +00:00
Jonas Devlieghere 6f23e5f6d5 [CMake] Remove stale comment
llvm-svn: 373995
2019-10-08 00:14:02 +00:00
Jonas Devlieghere 4bddca306a [MachO] Fix symbol merging during symtab parsing.
The symtab parser in ObjectFileMachO has logic to coalesce debug (STAB)
and non-debug symbols, based on the address and the symbol name for
static (STSYM) and global symbols (GSYM) respectively. It makes the
assumption that the debug variant is always encountered first. Rather
than creating a second entry in the symbol table for the non-debug
symbol, the latter gets merged into the existing debug symbol.

This breaks when the linker emits the non-debug symbol first. We'd end
up with two entries in the symbol table, each containing part of the
information LLDB relies on. Indeed, commenting out the merging logic
breaks the test suite spectacularly.

This patch solves that problem by always parsing the debug symbols
first. This guarantees that the assumption for merging holds.

I'm not particularly happy with  adding a lambda, but after numerous
attempts this is the best solution I could come up with. The symtab
parsing logic is pretty complex in that it touches a lot of things. I've
experienced first hand that it's very easy to break things. I believe
this approach strikes a balance between fixing the issue while limiting
the risk of regressions.

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

llvm-svn: 373994
2019-10-08 00:13:59 +00:00
Haibo Huang 61f471a705 [lldb] Unifying lldb python path
Based on mgorny@'s D67890

There are 3 places where python site-package path is calculated
independently:

1. finishSwigPythonLLDB.py where files are written to site-packages.

2. lldb/scripts/CMakeLists.txt where site-packages are installed.

3. ScriptInterpreterPython.cpp where site-packages are added to
PYTHONPATH.

This change creates the path once and use it everywhere. So that they
will not go out of sync.

Also it provides a chance for cross compiling users to specify the right
path for site-packages.

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373991
2019-10-07 23:49:01 +00:00
Alex Langford f4c7345b88 [Symbol] Remove unused method ClangASTContext::GetObjCClassName
llvm-svn: 373990
2019-10-07 23:43:33 +00:00
Davide Italiano 33f054a316 [CMake] We only want to copy the headers for macOS.
<rdar://problem/55916729>

llvm-svn: 373970
2019-10-07 21:38:30 +00:00
Adrian Prantl 69a3b21a5c Mark constructor as default and remove implementation (NFC)
llvm-svn: 373968
2019-10-07 21:23:19 +00:00
Davide Italiano 2b371fbedd [debugserver] Include the correct header.
<rdar://problem/55916729>

llvm-svn: 373957
2019-10-07 20:35:22 +00:00
Jonas Devlieghere 4db091754b [test] Rename `Modules` to `ObjectFile` (NFC)
llvm-svn: 373955
2019-10-07 20:31:28 +00:00
Jonas Devlieghere 369407fc52 [MachO] Shuffle some things around in ParseSymtab (NFC)
llvm-svn: 373954
2019-10-07 20:31:22 +00:00
Walter Erquinigo 8b6dcc1d8c [gdb-remote] process properly effective uid
Summary:
Someone wrote SetEffectiveSetEffectiveGroupID instead of SetEffectiveUserID.

After this fix, the android process list can show user names, e.g.

```
PID    PARENT USER       GROUP      EFF USER   EFF GROUP  TRIPLE                               ARGUMENTS
====== ====== ========== ========== ========== ========== ============================== ============================
529    1      root       0          root       0                                         /sbin/ueventd
```
Reviewers: labath,clayborg,aadsm,xiaobai

Subscribers:

llvm-svn: 373953
2019-10-07 20:26:49 +00:00
Walter Erquinigo 6e1a0cf46b [platform process list] add a flag for showing the processes of all users
Summary:
For context: https://reviews.llvm.org/D68293

We need a way to show all the processes on android regardless of the user id.
When you run `platform process list`, you only see the processes with the same user as the user that launched lldb-server. However, it's quite useful to see all the processes, though, and it will lay a foundation for full apk debugging support from lldb.

Before:
```
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
3234   1                 aarch64-unknown-linux-android adbd
8034   3234              aarch64-unknown-linux-android sh
9096   3234              aarch64-unknown-linux-android sh
9098   9096              aarch64-unknown-linux-android lldb-server
(lldb) ^D
```

Now:
```
(lldb) platform process list -x
205 matching processes were found on "remote-android"
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
1      0                                          init
524    1                                          init
525    1                                          init
531    1                                          ueventd
568    1                                          logd
569    1                 aarch64-unknown-linux-android servicemanager
570    1                 aarch64-unknown-linux-android hwservicemanager
571    1                 aarch64-unknown-linux-android vndservicemanager
577    1                 aarch64-unknown-linux-android qseecomd
580    577               aarch64-unknown-linux-android qseecomd
...
23816  979                                        com.android.providers.calendar
24600  979                                        com.verizon.mips.services
27888  979                                        com.hualai
28043  2378                                       com.android.chrome:sandboxed_process0
31449  979                                        com.att.shm
31779  979                                        com.samsung.android.authfw
31846  979                                        com.samsung.android.server.iris
32014  979                                        com.samsung.android.MtpApplication
32045  979                                        com.samsung.InputEventApp
```

Reviewers: labath,xiaobai,aadsm,clayborg

Subscribers:

llvm-svn: 373931
2019-10-07 17:49:32 +00:00
Vedant Kumar 40a1853c49 [DWARFASTParserClang] Factor out structure-like type parsing, NFC
Split out the logic to parse structure-like types into a separate
function, in an attempt to reduce the complexity of ParseTypeFromDWARF.

Inspired by discussion in https://reviews.llvm.org/D68130.

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

llvm-svn: 373927
2019-10-07 17:22:53 +00:00
Vedant Kumar fccfe2c04a [DWARFASTParserClang] Delete commented-out typedef, NFC
(& group together all the protected members & typedefs)

llvm-svn: 373926
2019-10-07 17:22:50 +00:00
Pavel Labath f7bd5bffed ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested
Since D68289, a couple of tests on linux started being extremely flaky.
All of them were doing name-based attaching and were failing because
they couldn't find an unambiguous process to attach to.

The patch above changed the process finding logic, so that failure to
find a process name does not constitute an error. This meant that a lot
more transient processes showed up in the process list during the test
suite run. Previously, these processes would not appear as they would be
gone by the time we went to read their executable name, arguments, etc.

Now, this alone should not cause an issue were it not for the fact that
we were considering a process with no name as if it matched by default
(even if we were explicitly searching for a process with a specified
name). This meant that any of the "transient" processes with no name
would make the name match ambiguous. That clearly seems like a bug to me
so I fix that.

llvm-svn: 373925
2019-10-07 17:17:53 +00:00
Konrad Kleine 2c082b4827 [lldb][ELF] Read symbols from .gnu_debugdata sect.
Summary:
If the .symtab section is stripped from the binary it might be that
there's a .gnu_debugdata section which contains a smaller .symtab in
order to provide enough information to create a backtrace with function
names or to set and hit a breakpoint on a function name.

This change looks for a .gnu_debugdata section in the ELF object file.
The .gnu_debugdata section contains a xz-compressed ELF file with a
.symtab section inside. Symbols from that compressed .symtab section
are merged with the main object file's .dynsym symbols (if any).
In addition we always load the .dynsym even if there's a .symtab
section.

For example, the Fedora and RHEL operating systems strip their binaries
but keep a .gnu_debugdata section. While gdb already can read this
section, LLDB until this patch couldn't. To test this patch on a
Fedora or RHEL operating system, try to set a breakpoint on the "help"
symbol in the "zip" binary. Before this patch, only GDB can set this
breakpoint; now LLDB also can do so without installing extra debug
symbols:

    lldb /usr/bin/zip -b -o "b help" -o "r" -o "bt" -- -h

The above line runs LLDB in batch mode and on the "/usr/bin/zip -h"
target:

    (lldb) target create "/usr/bin/zip"
    Current executable set to '/usr/bin/zip' (x86_64).
    (lldb) settings set -- target.run-args  "-h"

Before the program starts, we set a breakpoint on the "help" symbol:

    (lldb) b help
    Breakpoint 1: where = zip`help, address = 0x00000000004093b0

Once the program is run and has hit the breakpoint we ask for a
backtrace:

    (lldb) r
    Process 10073 stopped
    * thread #1, name = 'zip', stop reason = breakpoint 1.1
        frame #0: 0x00000000004093b0 zip`help
    zip`help:
    ->  0x4093b0 <+0>:  pushq  %r12
        0x4093b2 <+2>:  movq   0x2af5f(%rip), %rsi       ;  + 4056
        0x4093b9 <+9>:  movl   $0x1, %edi
        0x4093be <+14>: xorl   %eax, %eax

    Process 10073 launched: '/usr/bin/zip' (x86_64)
    (lldb) bt
    * thread #1, name = 'zip', stop reason = breakpoint 1.1
      * frame #0: 0x00000000004093b0 zip`help
        frame #1: 0x0000000000403970 zip`main + 3248
        frame #2: 0x00007ffff7d8bf33 libc.so.6`__libc_start_main + 243
        frame #3: 0x0000000000408cee zip`_start + 46

In order to support the .gnu_debugdata section, one has to have LZMA
development headers installed. The CMake section, that controls this
part looks for the LZMA headers and enables .gnu_debugdata support by
default if they are found; otherwise or if explicitly requested, the
minidebuginfo support is disabled.

GDB supports the "mini debuginfo" section .gnu_debugdata since v7.6
(2013).

Reviewers: espindola, labath, jankratochvil, alexshap

Reviewed By: labath

Subscribers: rnkovacs, wuzish, shafik, emaste, mgorny, arichardson, hiraditya, MaskRay, lldb-commits

Tags: #lldb, #llvm

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

llvm-svn: 373891
2019-10-07 10:32:16 +00:00
Sylvestre Ledru 68f58a75a7 Do not install lit-cpuid
Summary:
AFAIK, lit-cpuid is used by the tests. 
Installing it causes LLVMExports*.cmake files to depend
on this program.
It causes some serious packaging issues as it would means
that llvm-dev depends on lldb.

See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941082
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941306

See also https://bugs.llvm.org/show_bug.cgi?id=43035
for a similar issue caused by
https://reviews.llvm.org/D56606

Reviewers: mgorny

Reviewed By: mgorny

Subscribers: delcypher, lldb-commits

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

llvm-svn: 373819
2019-10-05 08:22:40 +00:00
Jonas Devlieghere 4e5d9e120b [MachO] Reduce indentation further in ParseSymtab (NFC)
llvm-svn: 373810
2019-10-04 23:09:55 +00:00
Jonas Devlieghere cd5cd7d14c [test] Run TestLaunchWithShellExpand with /bin/sh on POSIX.
Now that we do shell expansion on POSIX with the user's shel, this test
can potentially fail. This should ensure that we always use /bin/sh.

llvm-svn: 373804
2019-10-04 22:21:35 +00:00
Jonas Devlieghere 5042882698 [MachO] Move nlist parsing into helper function (NFC)
llvm-svn: 373803
2019-10-04 22:21:32 +00:00
Davide Italiano 68d01d9429 [debugserver] Don't link against Cocoa, it's not needed.
<rdar://problem/55916729>

llvm-svn: 373795
2019-10-04 21:51:35 +00:00
Jason Molenda 984d08c680 Expand on the qfProcessInfo documentation, add examples from
lldb-gdb-remote.txt and text explaining the no-criteria mode.

llvm-svn: 373789
2019-10-04 21:01:52 +00:00
Jan Kratochvil 4c7b842185 [lldb] [testsuite] Mark TestSBCommandReturnObject as failing on Windows
Filed:
	testsuite: TestSBCommandReturnObject: object has no attribute 'dylibPath'
	https://bugs.llvm.org/show_bug.cgi?id=43570

http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/9530/steps/test/logs/stdio

AttributeError: 'TestSBCommandReturnObject' object has no attribute 'dylibPath'

Fix crash on SBCommandReturnObject & assignment
https://reviews.llvm.org/D67589
  env = {self.dylibPath: self.getLLDBLibraryEnvVal()}

I do not know how to link with liblldb on Windows so marking it as failing on
Windows.

llvm-svn: 373787
2019-10-04 20:49:44 +00:00
Jonas Devlieghere 2a711814b0 [Host] Return status directly from RunShellCommand
Thanks for catching this, Pavel!

llvm-svn: 373783
2019-10-04 19:54:45 +00:00
Jonas Devlieghere e973fc0056 [MachO] Add early returns to save some indentation.
This file really suffered from the Great Reformat. I'm adding a few
early returns to give the deeply nested code some more breathing room.

llvm-svn: 373778
2019-10-04 19:37:59 +00:00
Jonas Devlieghere 845292cba3 [MachO] Reformat before making changes to this file (NFC)
llvm-svn: 373777
2019-10-04 19:37:52 +00:00
Jonas Devlieghere a8c04469e5 [Host] Don't discard return value from RunShellCommand
The recent change to expand arguments with the user's shell sometimes
caused a timeout and the error was not propagated.

llvm-svn: 373776
2019-10-04 19:37:46 +00:00
Jan Kratochvil 4112b47335 [lldb] Fix crash on SBCommandReturnObject & assignment
I was writing an SB API client and it was crashing on:
	bool DoExecute(SBDebugger dbg, char **command, SBCommandReturnObject &result) {
	  result = subcommand(dbg, "help");

That is because SBCommandReturnObject &result gets initialized inside LLDB by:
	bool DoExecute(Args &command, CommandReturnObject &result) override {
	  // std::unique_ptr gets initialized here from `&result`!!!
	  SBCommandReturnObject sb_return(&result);
	  DoExecute(...);
	  sb_return.Release();

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

llvm-svn: 373775
2019-10-04 19:32:57 +00:00
Antonio Afonso f6bedd81cc Componentize lldb/scripts to use with LLVM_DISTRIBUTION_COMPONENTS
Summary:
I'd like to install lldb using the install-distribution target with LLVM_DISTRIBUTION_COMPONENTS but this is currently not possible as the lldb/scripts do not provide any component we can use and install the python scripts.
For this effect I created an lldb-python-scripts target and added the install-lldb-python-scripts llvm install target.

I tested with:
cmake ... -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_DISTRIBUTION_COMPONENTS="lldb;liblldb;lldb-python-scripts" ...
DESTDIR=... ninja install-distribution

Then checked with bin/lldb -x -o 'script import lldb'

Reviewers: labath, xiaobai, clayborg, lanza

Subscribers: mgorny, lldb-commits, smeenai, wallace

Tags: #lldb

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

llvm-svn: 373768
2019-10-04 18:10:42 +00:00
Walter Erquinigo 9819b9d35f [process info] Remove assert in DoGetGroupName
Summary:
Disabling this assert prevents lldb-server from crashing, which prevents it from finding the user and group names of a given process list.

Before this change, the process list didn't contain names:

```
PID    PARENT USER       GROUP      EFF USER   EFF GROUP  TRIPLE                               ARGUMENTS
====== ====== ========== ========== ========== ========== ============================== ============================
27585  982    10098      10098      10098      10098                                     com.LogiaGroup.LogiaDeck
27623  982    10098      10098      10098      10098                                     com.digitalturbine.ignite.suspend.DataUsageRecorderService
28024  982    10199      10199      10199      10199                                     com.google.vr.vrcore
28061  983    10353      10353      10353      10353                                     com.instagram.android:videoplayer
28121  982    10045      10045      10045      10045                                     com.sec.spp.push
28325  982    10247      10247      10247      10247                                     com.facebook.orca
28714  982    10367      10367      10367      10367                                     com.samsung.android.dialer
29867  3208   2000       2000       2000       2000       aarch64-unknown-linux-android  /system/bin/sh-c /data/local/tmp/lldb-server platform --listen *:5557 --server --log-file /data/local/tmp/logs --log-channels gdb-remote all --log-channels lldb all
```

After this change, the list looks much better

```
PID    PARENT USER       GROUP      EFF USER   EFF GROUP  TRIPLE                               ARGUMENTS
====== ====== ========== ========== ========== ========== ============================== ============================
24459  1      wifi       1010       wifi       1010       aarch64-unknown-linux-android  /vendor/bin/hw/wpa_supplicant-O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 -g@android:wpa_wlan0
25098  982    u0_a42     10042      u0_a42     10042                                     com.samsung.android.messaging
25442  982    u0_a65     10065      u0_a65     10065                                     com.samsung.android.mobileservice
25974  982    u0_a9      10009      u0_a9      10009                                     com.samsung.android.contacts
26377  982    radio      1001       radio      1001                                      com.samsung.android.incallui
26390  983    u0_a26     10026      u0_a26     10026                                     com.samsung.android.game.gametools
26876  983    u0_a306    10306      u0_a306    10306                                     com.tencent.mm:push
```

Reviewers: clayborg,aadsm,xiaobai,labath

Subscribers:

llvm-svn: 373760
2019-10-04 16:56:23 +00:00
Walter Erquinigo 856383555b [lldb-server/android] Show more processes and package name when necessary
Summary:
By default `platform process list` only shows the processes of the current user that lldb-server can parse.
There are several problems:
- apk programs don't have an executable file. They instead use a package name as identifier.
- each apk also runs under a different user. That's how android works
- because of the user permission, some files like /proc/<pid>/{environ,exe} can't be read.

This results in a very small process list.

This is a local run on my machine
```
(lldb) platform process list
2 matching processes were found on "remote-android"
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
23291  3177              aarch64-unknown-linux-android sh
23301  23291            aarch64-unknown-linux-android lldb-server
```
However, I have 700 processes running at this time.

By implementing a few fallbacks for android, I've expanded this list to 202, filtering out kernel processes, which would presumably appear in this list if the device was rooted.

```
(lldb) platform process list
202 matching processes were found on "remote-android"
PID    PARENT USER       TRIPLE                   NAME
====== ====== ========== ======================== ============================
...
12647  3208              aarch64-unknown-linux-android sh
12649  12647             aarch64-unknown-linux-android lldb-server
12653  982                                        com.samsung.faceservice
13185  982                                        com.samsung.vvm
15899  982                                        com.samsung.android.spay
16220  982                                        com.sec.spp.push
17126  982                                        com.sec.spp.push:RemoteDlcProcess
19772  983                                        com.android.chrome
20209  982                                        com.samsung.cmh:CMH
20380  982                                        com.google.android.inputmethod.latin
20879  982                                        com.samsung.android.oneconnect:Receiver
21212  983                                        com.tencent.mm
24459  1                 aarch64-unknown-linux-android wpa_supplicant
25974  982                                        com.samsung.android.contacts
26293  982                                        com.samsung.android.messaging
28714  982                                        com.samsung.android.dialer
31605  982                                        com.samsung.android.MtpApplication
32256  982                                        com.bezobidny
```

Something to notice is that the architecture is unkonwn for all apks. And that's fine, because run-as would be required to gather this information and that would make this entire functionality massively slow.

There are still several improvements to make here, like displaying actual user names, which I'll try to do in a following diff.

Note: Regarding overall apk debugging support from lldb. I'm planning on having lldb spawn lldb-server by itself with the correct user, so that everything works well. The initial lldb-server used for connecting to the remote platform can be reused for such purpose. Furthermore, eventually lldb could also launch that initial lldb-server on its own.

Reviewers: clayborg, aadsm, labath, xiaobai

Subscribers: srhines, krytarowski, kristof.beyls, lldb-commits

Tags: #lldb

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

llvm-svn: 373758
2019-10-04 16:35:59 +00:00
Michal Gorny 9735739be7 [lldb] [cmake] Support linking against clang-cpp dylib
Link against clang-cpp dylib rather than split libs when
CLANG_LINK_CLANG_DYLIB is enabled.

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

llvm-svn: 373734
2019-10-04 12:03:03 +00:00
Raphael Isemann baf769d322 [lldb] Get the TargetAPI lock in SBProcess::IsInstrumentationRuntimePresent
Summary:
We should get the TargetAPI lock here to prevent the process of being destroyed while we are in the function. Thanks Jim for explaining what's going on.

Fixes rdar://54424754

Reviewers: jingham

Reviewed By: jingham

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

llvm-svn: 373725
2019-10-04 09:54:58 +00:00
Raphael Isemann 91ad5398d1 [lldb] Fix that 'ninja clean' breaks the build by deleting debugserver_vers.c
Summary:
We mark debugserver_vers.c as a generated file in CMake. This means that when we run `ninja clean` we end up deleting that file,
but any following `ninja` invocation will fail due to the file missing. The file can't be generated as `ninja` doesn't know it has to
rerun CMake to create the file. Turns out that marking the output of configure_file as generated is wrong as explained in this bug report:
https://gitlab.kitware.com/cmake/cmake/issues/18032

This patch just removes that property. The only side effect of this seems to be that this file maybe shows up in your IDE when
opening our CMake project, but that seems like a small sacrifice.

This patch can be quickly tested by running `ninja clean ; ninja lldbDebugserverCommon`. Before this patch the build will fail
due to debugserver_vers.c missing.

Reviewers: JDevlieghere, labath

Reviewed By: labath

Subscribers: mgorny, abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 373723
2019-10-04 09:52:26 +00:00
Sam McCall f6a2086d52 [lldb] Fix -Wreorder-ctor in r373673
llvm-svn: 373721
2019-10-04 09:41:43 +00:00
Sam McCall 4128dc4500 [lldb] Fix typo in r373675
llvm-svn: 373719
2019-10-04 09:33:04 +00:00
Raphael Isemann 51e0bbb02d [lldb][modern-type-lookup] No longer import temporary declarations into the persistent AST
Summary:
As we figured out in D67803, importing declarations from a temporary ASTContext that were originally from a persistent ASTContext
causes a bunch of duplicated declarations where we end up having declarations in the target AST that have no associated ASTImporter that
can complete them.

I haven't figured out how/if we can solve this in the current way we do things in LLDB, but in the modern-type-lookup this is solvable
as we have a saner architecture with the ExternalASTMerger. As we can (hopefully) make modern-type-lookup the default mode in the future,
I would say we try fixing this issue here. As we don't use the hack that was reinstated in D67803 during modern-type-lookup, the test case for this
is essentially just printing any kind of container in `std::` as we would otherwise run into the issue that required a hack like D67803.

What this patch is doing in essence is that instead of importing a declaration from a temporary ASTContext, we instead check if the
declaration originally came from a persistent ASTContext (e.g. the debug information) and we directly import from there. The ExternalASTMerger
is already connected with ASTImporters to these different sources, so this patch is essentially just two parts:
1. Mark our temporary ASTContext/ImporterSource as temporary when we import from the expression AST.
2. If the ExternalASTMerger sees we import from the expression AST, instead of trying to import these temporary declarations, check if we
can instead import from the persistent ASTContext that is already connected. This ensures that all records from the persistent source actually
come from the persistent source and are minimally imported in a way that allows them to be completed later on in the target AST.

The next step is to run the ASTImporter for these temporary expressions with the MinimalImport mode disabled, but that's a follow up patch.

This patch fixes most test failures with modern-type-lookup enabled by default (down to 73 failing tests, which includes the 22 import-std-module tests
which need special treatment).

Reviewers: shafik, martong

Reviewed By: martong

Subscribers: aprantl, rnkovacs, christof, abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

llvm-svn: 373711
2019-10-04 08:26:17 +00:00
Antonio Afonso ae08e479aa Revert "Explicitly set entry point arch when it's thumb"
Backing out because SymbolFile/Breakpad/symtab.test is failing and it seems to be a legit issue. Will investigate.

This reverts commit 72153f95ee4c1b52d2f4f483f0ea4f650ec863be.

llvm-svn: 373687
2019-10-04 01:45:58 +00:00
Jonas Devlieghere 2d511023c6 [Python] Remove unused variable
warning: unused variable 'py_func_obj' [-Wunused-variable]
  PyObject *py_func_obj = m_py_obj;
llvm-svn: 373686
2019-10-04 01:38:57 +00:00
Richard Smith 772e266fbf Properly handle instantiation-dependent array bounds.
We previously failed to treat an array with an instantiation-dependent
but not value-dependent bound as being an instantiation-dependent type.
We now track the array bound expression as part of a constant array type
if it's an instantiation-dependent expression.

llvm-svn: 373685
2019-10-04 01:25:59 +00:00
Antonio Afonso ac14695804 Explicitly set entry point arch when it's thumb
Summary:
I found a case where the main android binary (app_process32) had thumb code at its entry point but no entry in the symbol table indicating this. This made lldb set a 4 byte breakpoint at that address (we default to arm code) instead of a 2 byte one (like we should for thumb).
The big deal with this is that the expression evaluator uses the entry point as a way to know when a JITed expression has finished executing by putting a breakpoint there. Because of this, evaluating expressions on certain android devices (Google Pixel something) made the process crash.
This was fixed by checking this specific situation when we parse the symbol table and add an artificial symbol for this 2 byte range and indicating that it's arm thumb.

I created 2 unit tests for this, one to check that now we know that the entry point is arm thumb, and the other to make sure we didn't change the behaviour for arm code.

I also run the following on the command line with the `app_process32` where I found the issue:
**Before:**
```
(lldb) dis -s 0x1640 -e 0x1644
app_process32[0x1640]: .long  0xf0004668                ; unknown opcode
```
**After:**
```
(lldb) dis -s 0x1640 -e 0x1644
app_process32`:
app_process32[0x1640] <+0>: mov    r0, sp
app_process32[0x1642]:      andeq  r0, r0, r0
```

Reviewers: clayborg, labath, wallace, espindola

Subscribers: srhines, emaste, arichardson, kristof.beyls, MaskRay, lldb-commits

Tags: #lldb

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

llvm-svn: 373680
2019-10-04 00:11:22 +00:00
Jim Ingham ebaa3eb127 Python3 doesn't seem to allow you to tell whether an object is a class
PyClass_Check and everything it relied on seems gone from Python3.7.  So
I won't check whether it is a class first...

Also cleaned up a couple of warnings.

llvm-svn: 373679
2019-10-03 23:57:34 +00:00
Jim Ingham f9d8bbee89 Forgot to change the header guards on OptionGroupPythonClassWithDict.
I think that's what is confusing the modules build on the bots.

llvm-svn: 373677
2019-10-03 23:32:42 +00:00
Jim Ingham 27a14f19c8 Pass an SBStructuredData to scripted ThreadPlans on use.
This will allow us to write reusable scripted ThreadPlans, since
you can use key/value pairs with known keys in the plan to parametrize
its behavior.

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

llvm-svn: 373675
2019-10-03 22:50:18 +00:00
Jim Ingham 943a24812d Break out the Python class & key/value options into a separate OptionGroup.
Use this in the scripted breakpoint command.  Added some tests for parsing
the key/value options.  This uncovered a bug in handling parsing errors mid-line.
I also fixed that bug.

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

llvm-svn: 373673
2019-10-03 22:18:51 +00:00
Walter Erquinigo e0a398bf31 [process list] make the TRIPLE column wider
Summary:
Now that `process list` works better on the android platform, the arch aarch64-unknown-linux-android appears quite often.
The existing printed width of the TRIPLE column is not long enough, which doesn't look okay.
E.g.
```
1561   1016                    aarch64-unknown-linux-android ip6tables-restore
1999   1                       aarch64-unknown-linux-android tlc_server
2332   982                                              com.android.systemui
2378   983                                              webview_zygote
```

Now, after adding 6 spaces, it looks better

```
PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
...
1561   1016              aarch64-unknown-linux-android  ip6tables-restore
1999   1                 aarch64-unknown-linux-android  tlc_server
2332   982                                              com.android.systemui
2378   983                                              webview_zygote
2448   982                                              com.sec.location.nsflp2
```

Reviewers: clayborg, labath, xiaobai, aadsm

Reviewed By: labath

Subscribers: srhines, kristof.beyls, lldb-commits

Tags: #lldb

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

llvm-svn: 373670
2019-10-03 21:57:01 +00:00
Haibo Huang 48b38c93bc [lldb] Remove unused variables.
Fixes the comment in https://reviews.llvm.org/D67993

llvm-svn: 373669
2019-10-03 21:56:59 +00:00
Haibo Huang 958091c209 [lldb] Calculate relative path for symbol links
Summary: This replaces the hard coded path.

Reviewers: labath, mgorny

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373668
2019-10-03 21:52:20 +00:00
Jonas Devlieghere 350147c746 [test] Disable TestCustomShell on Linux
ShellExpandArguments is unimplemented on Linux. I need to come up with
another way to test this on Linux.

llvm-svn: 373662
2019-10-03 20:49:55 +00:00
Jonas Devlieghere 5f775d2912 [JSON] Don't wrap json::Array in a value (NFC)
There's no need to wrap the just-constructed json::Array in a
json::Value, we can just return that and pass ownership to the
raw_ostream.

llvm-svn: 373656
2019-10-03 20:10:56 +00:00
Jonas Devlieghere f149ea8bb5 [Host] Return the user's shell from GetDefaultShell
LLDB handles shell expansion by running lldb-argdumper under a shell.
Currently, this is always /bin/sh on POSIX. This potentially leads to
different behavior between lldb and the user's current shell. Here's an
example of different expansions between shells:

$ /bin/bash -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}'
-config={Options:[key:foo_key]} -config={Options:[value:foo_value]}

$ /bin/zsh -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}'
zsh:1: no matches found: -config={Options:[key:foo_key]}

$ /bin/sh -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}'
-config={Options:[key:foo_key]} -config={Options:[value:foo_value]}

$ /bin/fish -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}'
-config=Options:[key:foo_key] -config=Options:[value:foo_value]

To reduce surprises, this patch returns the user's current shell. It
first looks at the SHELL environment variable. If that isn't set, it'll
ask for the user's default shell. Only if that fails, we'll fallback to
/bin/sh, which should always be available.

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

llvm-svn: 373644
2019-10-03 18:29:01 +00:00
Pavel Labath 0577a0cedb "Fix" TestFileHandle.py on non-darwin platforms
This test exposed a very long standing issue that the python file
objects returned by the FILE* typemap were unusable on non-darwin
platforms. The reason they work on darwin is that they rely on a
non-standard extension to fetch the "mode" of a FILE* object. On other
platforms, this code was #ifdefed out, and so we were returning an empty
mode.

As there's no portable way to get this information, I just change the
non-darwin path to return "r+", which should permit both reading and
writing operations on the object. If the underlying file descriptor
turns out to be incompatible with this mode, the operating system should
return EBADF (or equivalent), instead of the "file not open for XXX"
error from python.

llvm-svn: 373573
2019-10-03 08:44:33 +00:00
Pavel Labath ecd849ed56 Fix a use-after-free in GDBRemoteCommunicationServerLLGS
Although it's called "GetString", StreamString::GetString actually
returns a StringRef. Creating a json object with a StringRef does not
make a copy, which means the StringRef will be dangling as soon as the
underlying stream is destroyed. Add a .str() to force the json object to
hold a copy of the string.

This fixes nearly every test on linux.

llvm-svn: 373572
2019-10-03 07:59:26 +00:00
Lawrence D'Anna f913fd6eb0 factor out an abstract base class for File
Summary:
This patch factors out File as an abstract base
class and moves most of its actual functionality into
a subclass called NativeFile.   In the next patch,
I'm going to be adding subclasses of File that
don't necessarily have any connection to actual OS files,
so they will not inherit from NativeFile.

This patch was split out as a prerequisite for
https://reviews.llvm.org/D68188

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373564
2019-10-03 04:31:46 +00:00
Lawrence D'Anna 96898eb6a9 SBDebugger::SetInputFile, SetOutputFile, etc.
Summary:
Add new methods to SBDebugger to set IO files as SBFiles instead of
as FILE* streams.

In future commits, the FILE* methods will be deprecated and these
will become the primary way to set the debugger I/O streams.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 373563
2019-10-03 04:04:48 +00:00
Lawrence D'Anna 5750453020 new api class: SBFile
Summary:
SBFile is a scripting API wrapper for lldb_private::File

This is the first step in a project to enable arbitrary python
io.IOBase file objects -- including those that override the read()
and write() methods -- to be used as the main debugger IOStreams.

Currently this is impossible because python file objects must first
be converted into FILE* streams by SWIG in order to be passed into
the debugger.

full prototype: https://github.com/smoofra/llvm-project/tree/files

Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath

Reviewed By: labath

Subscribers: labath, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 373562
2019-10-03 04:01:07 +00:00
Davide Italiano 3c1084373d [ARM64] XPC services are unsupported on device.
While around, clean up support for a 8 years old OS.

<rdar://problem/55916729>

llvm-svn: 373510
2019-10-02 19:20:24 +00:00
Davide Italiano 293ec1e16a [RegisterContextDarwin_arm64] Include the headers for getsysctlbyname.
This code is only used under __arm64__, use the correct guard.

<rdar://problem/55916729>

llvm-svn: 373509
2019-10-02 19:20:21 +00:00
Davide Italiano ef46be6c2a [ObjectFileMachO] FileSpec::SetFile() now takes the style as arg.
Another block that's only compiled on __arm64__ and wasn't
updated.

<rdar://problem/55916729>

llvm-svn: 373508
2019-10-02 19:20:18 +00:00
Davide Italiano 6fdeb0324f [ObjectFileMachO] Catch up with FileDesc changes.
This didn't show up because nobody built __arm64__ in a while.

<rdar://problem/55916729>

llvm-svn: 373507
2019-10-02 19:20:15 +00:00
Jonas Devlieghere 2a0c8b1143 [JSON] Remove Utility/JSON.{h|cpp}
This patch is the final step in my quest to get rid of the JSON parser
in LLDB. Vedant's coverage report [1] shows that it was mostly untested.
Furthermore, the LLVM implementation has a much nicer API and using it
means one less thing to maintain for LLDB.

[1] http://lab.llvm.org:8080/coverage/coverage-reports/index.html

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

llvm-svn: 373501
2019-10-02 18:02:36 +00:00
Jonas Devlieghere 4f8151e62e [JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerCommon
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerCommon.

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

llvm-svn: 373500
2019-10-02 18:02:32 +00:00
Jonas Devlieghere 7cb720dda0 [JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerPlatform
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerPlatform.

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

llvm-svn: 373499
2019-10-02 18:02:29 +00:00
Jonas Devlieghere 2a5a906753 [JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationClient
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationClient.

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

llvm-svn: 373498
2019-10-02 18:02:26 +00:00
Jonas Devlieghere 9beb45671b [JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerLLGS
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerLLGS.

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

llvm-svn: 373497
2019-10-02 18:02:23 +00:00
Raphael Isemann 5c375ed669 [lldb] Fix evaluation of nested classes with parent from other CU
This makes sure that we associate DIEs that are imported from other CUs with the appropriate decl context.

Without this fix, nested classes can be dumped directly into their CU context if their parent was imported from another CU.

Reviewed By: teemperor, labath

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

Patch by Jaroslav Sevcik!

llvm-svn: 373470
2019-10-02 13:46:17 +00:00
Raphael Isemann ecbfb851a0 [lldb][NFC] Remove ClangASTContext::Clear
We now only use this function directly after initialization. As Clear()
resets the ASTContext back to its initial state, this is just a no-op.
There are no other users for this and we no longer can set the ASTContext
after construction, so Clear has no useful purpose anymore. It's also
mostly copy-pasted from Finalize().

llvm-svn: 373460
2019-10-02 12:38:04 +00:00
Raphael Isemann 2eb963abff [lldb][NFC] Create the ASTContext in ClangASTContext exactly once.
Reason for this patch is the Ssame reason as for the previous patches:
Having a ClangASTContext and being able to switch the associated ASTContext isn't
a use case we have (or should have), so let's simplify all this code.
This way it becomes clearer in what order we initialize data structures.

The DWARFASTParserClangTests changes are necessary as the test is using
a ClangASTContext but relied on the fact that no called function ever calls
getASTContext() on our ClangASTContext (as that would create the ASTContext).
As we now always create the ASTContext the fact that we had an uninitialized
FileSystem made the test crash.

llvm-svn: 373457
2019-10-02 12:26:08 +00:00
Adrian Prantl e2385e089d Make yet another attempt in restoring SymbolFilePDBTests
The original test was passing false to the append argument of
FindTypes (the only use of this feature!). This patch now replicates
that by passing a fresh TypeMap into the function where applicable.

llvm-svn: 373409
2019-10-02 00:06:27 +00:00
Jordan Rupprecht a77c3ef03c [lldb] Fix unused variable warning
llvm-svn: 373399
2019-10-01 22:04:14 +00:00
Adrian Prantl f3d2158616 Make another attempt at fixing SymbolFilePDBTests.
llvm-svn: 373373
2019-10-01 18:15:22 +00:00
Jonas Devlieghere e09adb400b [JSON] Use LLVM's library for argdumper
This patch replaces the LLDB's JSON implementation with the one from
LLVM in argdumper.

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

llvm-svn: 373361
2019-10-01 17:41:55 +00:00
Jonas Devlieghere 57b468820f [JSON] Use LLVM's library for decoding JSON in StructuredData
This patch replaces the hand-rolled JSON decoding in StructuredData with
LLVM's JSON library.

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

llvm-svn: 373360
2019-10-01 17:41:52 +00:00
Jonas Devlieghere 2783d81791 [JSON] Use LLVM's library for encoding JSON in StructuredData
This patch replaces the hand-rolled JSON emission in StructuredData with
LLVM's JSON library.

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

llvm-svn: 373359
2019-10-01 17:41:48 +00:00
Adrian Prantl dffe5dfa5c Fix a syntax error.
llvm-svn: 373355
2019-10-01 17:10:25 +00:00
Adrian Prantl ad08a5f0f1 Fix a condition-flip regression introduced in r373344.
llvm-svn: 373354
2019-10-01 17:08:44 +00:00