Commit Graph

21788 Commits

Author SHA1 Message Date
Alex Langford 3014efe071 [lldb] Remove unused parameter from ValueObject::GetExpressionPath
I previously removed the code in ValueObject::GetExpressionPath that
took advantage of the parameter `qualify_cxx_base_classes`. As a result,
this is now unused and can be removed.
2020-02-03 10:50:38 -08:00
Alex Langford 5b0c8dd3a4 [lldb] Delete ClangForward.h
Summary:
I think that there are very few things from clang that actually need forward
declaration, so not having a ClangForward header makes sense.

Differential Revision: https://reviews.llvm.org/D73827
2020-02-03 10:43:12 -08:00
Raphael Isemann fad012bce1 Reland "[lldb] Increase the rate at which ConstString's memory allocator scales the memory chunks it allocates""
The parent revision is now passing the sanitizer bots and landed as 46e5603c8a,
so this can now actually land.
2020-02-03 14:59:55 +01:00
Raphael Isemann 7f4cb2e7b6 [lldb] Make the order in which ClusterManager calls destructors deterministic
Summary:
ClusterManager is using a SmallPtrSet to store the objects in it. We always only add every object once so using a set is not necessary.
Furthermore having a set means that iterating over it is nondeterministic (at least with more than 16 objects in it), so the order in
which the destructors for the managed objects are called is currently also non-deterministic.

This just replaces the SmallPtrSet with a SmallVector.

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: mgrang, abidh, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73871
2020-02-03 13:33:44 +01:00
Martin Storsjö eb5ee9275d [LLDB] Add missing declarations for linking to psapi
This fixes building for mingw with BUILD_SHARED_LIBS. In static builds,
the psapi dependency gets linked in transitively from Support, but
when linking Support dynamically, it's revealed that these components
also need linking against psapi.

Differential Revision: https://reviews.llvm.org/D73839
2020-02-03 12:59:11 +02:00
Raphael Isemann 0afdc7bed8 Revert "[lldb] Increase the rate at which ConstString's memory allocator scales the memory chunks it allocates"
This reverts commit 500c324fa1 because its parent commit
b848b510a8 is failing on the sanitizer bots.
2020-02-03 11:09:45 +01:00
Raphael Isemann 500c324fa1 [lldb] Increase the rate at which ConstString's memory allocator scales the memory chunks it allocates
Summary:
We currently do far more malloc calls than necessary in the ConstString BumpPtrAllocator. This is due to the 256 BumpPtrAllocators
our ConstString implementation uses internally which end up all just receiving a small share of the total allocated memory
and therefore keep allocating memory in small chunks for far too long. This patch fixes this by increasing the rate at which we increase the
memory chunk size so that our collection of BumpPtrAllocators behaves in total similar to a single BumpPtrAllocator.

Reviewers: llunak

Reviewed By: llunak

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D71699
2020-02-03 10:59:35 +01:00
Martin Storsjö 534aeb0b78 [LLDB] Fix GCC warnings about extra semicolon. NFC. 2020-02-03 09:55:02 +02:00
Alex Langford 2637769b9f [lldb] Remove LanguageRuntime::GetOverrideExprOptions
LanguageRuntime::GetOverrideExprOptions is specific to clang and was
only overridden in RenderScriptRuntime. LanguageRuntime in shouldn't
have any knowledge of clang, so remove it from LanguageRuntime and leave
it only in RenderScriptRuntime.
2020-01-31 22:05:23 -08:00
Jonas Devlieghere c62ffb1b19 [lldb/Reproducers] Include string length in string (de)serialization.
This allows us to differentiate between an empty string and a nullptr.

(cherry picked from commit 53e206284fa715886020d6a5553bf791582850a3)
2020-01-31 17:40:49 -08:00
Vedant Kumar 14394a4209 [lldb/TypeSystemClang] Use references in a static helper, NFC 2020-01-31 16:33:12 -08:00
Vedant Kumar 14135f50a0 [lldb/Value] Avoid reading more data than the host has available
Value::GetValueByteSize() reports the size of a Value as the size of its
underlying CompilerType. However, a host buffer that backs a Value may
be smaller than GetValueByteSize().

This situation arises when the host is only able to partially evaluate a
Value, e.g. because the expression contains DW_OP_piece.

The cleanest fix I've found to this problem is Greg's suggestion, which
is to resize the Value if (after evaluating an expression) it's found to
be too small. I've tried several alternatives which all (in one way or
the other) tried to teach the Value/ValueObjectChild system not to read
past the end of a host buffer, but this was flaky and impractical as it
isn't easy to figure out the host buffer's size (Value::GetScalar() can
point to somewhere /inside/ a host buffer, but you need to walk up the
ValueObject hierarchy to try and find its size).

This fixes an ASan error in lldb seen when debugging a clang binary.
I've added a regression test in test/functionalities/optimized_code. The
point of that test is not specifically to check that DW_OP_piece is
handled a particular way, but rather to check that lldb doesn't crash on
an input that it used to crash on.

Testing: check-lldb, and running the added tests using a sanitized lldb

--

Thanks to Jim for pointing out that an earlier version of this patch,
which simply changed the definition of Value::GetValueByteSize(), would
interact poorly with the ValueObject machinery.

Thanks also to Pavel who suggested a neat way to test this change
(which, incidentally, caught another ASan issue still present in the
original version of this patch).

rdar://58665925

Differential Revision: https://reviews.llvm.org/D73148
2020-01-31 16:33:12 -08:00
Vedant Kumar 009e3e53c1 [lldb/MCDisasm] Simplify predicates in MCDisasmInstance, NFC 2020-01-31 16:33:12 -08:00
Alex Langford 8e36d24fca [lldb] Remove unused CPPLanguageRuntime dependency 2020-01-31 15:23:18 -08:00
Jonas Devlieghere abb0357123 [lldb/Test] Fix more substr ordering issues that only repro on the bot 2020-01-31 14:42:41 -08:00
Jonas Devlieghere 83510e144b [lldb/Test] Fix substr order in TestWatchLocationWithWatchSet.py 2020-01-31 14:36:39 -08:00
Jonas Devlieghere d3bdd51f70 [lldb/Platform] Always print Kernel last
Specializations of the Platform class print the kernel after calling the
super method. By printing the kernel at the end in the super class, we
guarantee the order is the same on different platforms.
2020-01-31 14:36:39 -08:00
Jonas Devlieghere 6f2a4c424e Revert "[lldb/Test] Make substrs argument to self.expect ordered."
Temporarily revert to fix the tests that only fail on the bots because
of the newly enforced substr order.
2020-01-31 13:50:39 -08:00
Jonas Devlieghere d02fb002dd [lldb/Test] Make substrs argument to self.expect ordered.
This patch changes the behavior of the substrs argument to self.expect.
Currently, the elements of substrs are unordered and as long as the
string appears in the output, the assertion passes.

We can be more precise by requiring that the substrings be ordered in
the way they appear. My hope is that this will make it harder to
accidentally pass a check because a string appears out of order.

Differential revision: https://reviews.llvm.org/D73766
2020-01-31 13:35:37 -08:00
Jonas Devlieghere 1463341f4b [lldb/Test] Fix substrs order in self.expect for the remaining tests (NFC)
Currently the substrs parameter takes a list of strings that need to be
found but the ordering isn't checked. D73766 might change that so this
changes a several tests so that the order of the strings in the substrs
list is in the order in which they appear in the output.
2020-01-31 13:35:33 -08:00
Michał Górny 83a7a4aaad [lldb] [test] Skip 128-bit int tests on i386 (no __int128_t) 2020-01-31 21:59:38 +01:00
Jonas Devlieghere 81b0becaae [lldb/Test] Fix substrs order in self.expect for more tests (NFC)
Currently the substrs parameter takes a list of strings that need to be
found but the ordering isn't checked. D73766 might change that so this
changes a several tests so that the order of the strings in the substrs
list is in the order in which they appear in the output.
2020-01-31 12:44:24 -08:00
Alex Langford 8be30215fe [lldb] Move clang-based files out of Symbol
Summary:
This change represents the move of ClangASTImporter, ClangASTMetadata,
ClangExternalASTSourceCallbacks, ClangUtil, CxxModuleHandler, and
TypeSystemClang from lldbSource to lldbPluginExpressionParserClang.h

This explicitly removes knowledge of clang internals from lldbSymbol,
moving towards a more generic core implementation of lldb.

Reviewers: JDevlieghere, davide, aprantl, teemperor, clayborg, labath, jingham, shafik

Subscribers: emaste, mgorny, arphaman, jfb, usaxena95, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73661
2020-01-31 12:20:10 -08:00
Jonas Devlieghere f5a71b49be [lldb/Test] Fix substrs order in self.expect for more tests (NFC)
Currently the substrs parameter takes a list of strings that need to be
found but the ordering isn't checked. D73766 might change that so this
changes a several tests so that the order of the strings in the substrs
list is in the order in which they appear in the output.
2020-01-31 12:19:29 -08:00
Jonas Devlieghere 574685b879 [lldb/Symbol] Use StringRef ctor to prevent incorrect overload
Use the StringRef constructor instead of toStringRef so we don't end up
with the wrong overload (llvm::toStringRef(bool)).

Fixes PR44736
2020-01-31 11:00:46 -08:00
Jonas Devlieghere 2c19d05ae9 [lldb/Test] Fix substrs order in self.expect for more tests (NFC)
Currently the substrs parameter takes a list of strings that need to be
found but the ordering isn't checked. D73766 might change that so this
changes a several tests so that the order of the strings in the substrs
list is in the order in which they appear in the output.
2020-01-31 10:29:33 -08:00
Raphael Isemann 6c7efe2eec [lldb][NFC] Fix expect calls with wrong order of 'substrs' items for D73766
Currently the substrs parameter takes a list of strings
that need to be found but the ordering isn't checked. D73766
might change that so this changes a several tests so that
the order of the strings in the substrs list is in the order
in which they appear in the output.
2020-01-31 17:54:18 +01:00
Jan Kratochvil edc3f4f02e [NFC] [lldb] Unindent DWARFDebugInfoEntry::GetDWARFDeclContext
Reduce code indentation level.
2020-01-31 16:51:33 +01:00
Jan Kratochvil 6dd0163502 [lldb] Revert refactorization from: Move non-DWARF code: DWARFUnit -> SymbolFileDWARF
Reverting part of commit 789beeeca3.

Its DWARFDebugInfoEntry::GetDWARFDeclContext() refactorization for
return value is now adding it in opposite order.
2020-01-31 16:06:23 +01:00
Pavel Labath 33f65f393f [lldb] Add a basic unit test for the SharedCluster class 2020-01-31 15:46:41 +01:00
Pavel Labath b8966de73f [lldb] Remove some dead code from SharingPtr.h
These classes are not used.
2020-01-31 15:46:41 +01:00
Jan Kratochvil 789beeeca3 [lldb] Move non-DWARF code: DWARFUnit -> SymbolFileDWARF
This patchset is removing non-DWARF code from DWARFUnit for better
future merge with LLVM DWARF as discussed with @labath.

Differential revision: https://reviews.llvm.org/D70646
2020-01-31 15:16:31 +01:00
Pavel Labath 877963a35a [lldb/DWARF] Delete some dead code in SymbolFileDWARF
- m_debug_loc(lists) are unused since the relevant logic was moved to
  DWARFContext.
- const versions of DebugInfo(), DebugAbbrev() are not used, and they
  are dangerous to use as they do not initialize the relevant objects.
2020-01-31 14:47:25 +01:00
Raphael Isemann 09217b60fc [lldb][NFC] Add a CompilerDecl->clang::Decl conversion function to ClangUtil
This automatically does the type checking for the cast.
2020-01-31 13:20:02 +01:00
Raphael Isemann 1ccc702912 [lldb][NFC] Remove unnecessary ClangASTImporter checks in ClangASTSource
A ClangASTSource always has a ClangASTImporter. Let's remove these sporadic
checks with a single assert during construction. They were added originally
for the modern-type-lookup mode that didn't use a ClangASTImporter in there.
2020-01-31 13:17:08 +01:00
Raphael Isemann 19f1ce6735 [lldb][NFC] Remove ParserVars::m_parser_type member that was never read
We only assign values to this member but never read it. Also the
type in there has no side effects so let's just remove it.
2020-01-31 12:54:01 +01:00
Raphael Isemann 99e63f5825 [lldb] Print the command output when 'expect' fails even if a custom msg is passed
Currently if 'expect' fails and a custom msg is supplied, then lldbtest
will not print the actual command output. This makes it impossible to know
why the test actually failed. This just prints the command output even
if the msg parameter was supplied.
2020-01-31 10:16:46 +01:00
Raphael Isemann 46ca55f2a2 [lldb][NFC] Add safe Decl->CompilerDecl conversion function TypeSystemClang
This adds a conversion function from clang::Decl to CompilerDecl. It checks
that the TypeSystemClang in the CompilerDecl actually fits to the clang::Decl
AST during creation, thus preventing the creation of CompilerDecl instances with
inconsistent state.
2020-01-31 09:44:24 +01:00
Raphael Isemann 48acece15d [lldb][NFC] Cleanup ClangASTImporter::LayoutInfo 2020-01-31 09:06:09 +01:00
Alex Langford 381e81a048 [lldb][NFCI] Remove UserExpression::GetJITModule
UserExpression::GetJITModule was used to support an option in
UserExpression::Evaluate that let you hold onto the JIT Module used during
the expression evaluation. This was only actually used in one spot --
REPL::IOHandlerInputComplete. That method didn't actually take use the
JIT module it got back, so this feature was not used in practice.
This means that we can delete the support in UserExpression::Evaluate
and delete the UserExpression::GetJITModule method entirely.
2020-01-30 23:20:19 -08:00
Alex Langford 22b044877d [lldb][NFCI] Remove unused LanguageType parameters
These parameters are unused in these methods, and some of them only had a
LanguageType parameter to pipe to other methods that don't use it
either.
2020-01-30 21:57:23 -08:00
Jonas Devlieghere 196b31f9f1 [lldb/Lit] Fix UnboundLocalError when reaching a timeout.
Fixes the UnboundLocalError for the local variables out, err and
exitCode when a timeout is hit.
2020-01-30 21:23:58 -08:00
Alex Langford 31905c2bbb [lldb][NFCI] Delete commented out code 2020-01-30 18:02:36 -08:00
Alex Langford e1451a724d [lldb][NFCI] Rename variable in ValueObject 2020-01-30 16:53:01 -08:00
Hector Diaz 45e3f6660c Auto-completion bug fix for dot operator
Summary:
There was a bug on LLDB VSCode where there was the following behavior:

//Code

```
struct foo {
    int bar:
};
...
foo my_foo = {10};
```

Trying to auto-complete my_foo.b with my_foo.bar resulted instead with my_foo.my_foo.bar

This diff fixes this bug and adds some tests to check correct behavior.

It also fixes the same bug using the arrow operator (->) when user manually requests completions.
TODO: Fix bug where no recommended completions are automatically shown with arrow operator

{F11249959}

{F11249958}

Reviewers: wallace

Reviewed By: wallace

Subscribers: teemperor, labath, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73506
2020-01-30 16:02:58 -08:00
Jonas Devlieghere 457a6d49d5 [lldb/Reproducers] Fix typo in CMake so we actually replay.
The CMakeLists.txt had a typo which meant that check-lldb-repro was
capturing twice instead of capturing and then replaying. This also
uncovered a missing import in lldb-repro.py. This patch fixes both
issues.
2020-01-30 15:51:29 -08:00
Jonas Devlieghere 58c4fa2c53 [lldb/Reproducers] Use LLDB_RECORD_DUMMY for GetStopDescription
GetStopDescription writes to a const char* with a given length. However,
the reproducer instrumentation serialized the char pointer and length
separately.

To serialize the string, we naively look for the first null byte to
determine its length. This can lead to the method overwriting the input
buffer when the assumed string length is smaller than the actual number
of bytes written by GetStopDescription.

The real solution is to have a custom serializer that takes both
arguments into account. However, given that these are output parameters,
they don't affect replay. If the string is passed as input later, it's
is recorded as such. Therefore I've replaced the instrumentation macro
with LLDB_RECORD_DUMMY which skips the serialization.
2020-01-30 15:40:58 -08:00
Raphael Isemann 92a42b6a4d [lldb][NFC] LLDB_LOGF to LLDB_LOG conversion in ClangASTImporter 2020-01-30 22:10:31 +01:00
Jonas Devlieghere 05badc60b7 [lldb/Reproducers] Fix API boundary tracking bug
When recording the result from the LLDB_RECORD_RESULT macro, we need to
update the boundary so we capture the copy constructor. However, when
called to record the this pointer of the (copy) constructor itself, the
boundary should not be toggled, because it is called from the
LLDB_RECORD_CONSTRUCTOR macro, which might be followed by other API
calls.

This manifested itself as an object encountered during replay that we
hadn't seen before. The index-to-object mapping would return a nullptr
and lldb would crash.
2020-01-30 11:22:12 -08:00
Ayke van Laethem 727ed11b24
[AVR] Recognize the AVR architecture in lldb
This commit adds AVR support to lldb. With this change, it can load a
binary and do basic things like dump a line table.

Not much else has been implemented, that should be done in later
changes.

Differential Revision: https://reviews.llvm.org/D73539
2020-01-30 13:40:31 +01:00