Commit Graph

20718 Commits

Author SHA1 Message Date
Pavel Labath 390accea83 unwind-via-stack-win.yaml: update for changes in yaml format
llvm-svn: 374353
2019-10-10 14:01:59 +00:00
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