Commit Graph

21196 Commits

Author SHA1 Message Date
Davide Italiano 15a172bebb [TypeCategory] Nothing passes down a list of languages.
Summary: This should allow further simplifications, but it's a first step.

Reviewers: teemperor, jingham, friss

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70983
2019-12-03 13:57:58 -08:00
Jonas Devlieghere 0e9b0b6d11 [EditLine] Fix RecallHistory to make it go in the right direction.
The naming used by editline for the history operations is counter
intuitive to how it's used in lldb for the REPL.

 - The H_PREV operation returns the previous element in the history,
   which is newer than the current one.
 - The H_NEXT operation returns the next element in the history, which
   is older than the current one.

This exposed itself as a bug in the REPL where the behavior of up- and
down-arrow was inverted. This wasn't immediately obvious because of how
we save the current "live" entry.

This patch fixes the bug and introduces and enum to wrap the editline
operations that match the semantics of lldb.

Differential revision: https://reviews.llvm.org/D70932
2019-12-03 08:12:10 -08:00
Jonas Devlieghere 62827737ac [lldb/Reproducer] Add version check
To ensure a reproducer works correctly, the version of LLDB used for
capture and replay must match. Right now the reproducer already contains
the LLDB version. However, this is purely informative. LLDB will happily
replay a reproducer generated with a different version of LLDB, which
can cause subtle differences.

This patch adds a version check which compares the current LLDB version
with the one in the reproducer. If the version doesn't match, LLDB will
refuse to replay. It also adds an escape hatch to make it possible to
still replay the reproducer without having to mess with the recorded
version. This might prove useful when you know two versions of LLDB
match, even though the version string doesn't. This behavior is
triggered by passing a new flag -reproducer-skip-version-check to the
lldb driver.

Differential revision: https://reviews.llvm.org/D70934
2019-12-03 07:54:42 -08:00
Pavel Labath ad5bb05405 [lldb] Remove unneeded semicolon in IOHandlerCursesGUI 2019-12-03 16:22:52 +01:00
Pavel Labath 159641d710 [lldb] Use llvm range functions in LineTable.cpp
to avoid needing to declare iterators everywhere.
2019-12-03 16:22:52 +01:00
Alexandre Ganea 1cc0ba4cbd [LLDB] Disable MSVC warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has C-linkage specified, but returns UDT 'llvm::Expected<bool>' which is incompatible with C
Differential Revision: https://reviews.llvm.org/D70830
2019-12-03 09:53:26 -05:00
Raphael Isemann 7caa17caf8 [lldb][NFC] Move Curses interface implementation to own file
Summary:
The IOHandler class source file is currently around 4600 LOC. However only 200
of these lines are concerned with the actual IOHandler class and the rest are the
implementations for Editline, IOHandlerConfirm and the Curses interface. All these
large features also cause that the IOHandler (which is in Core) has a large set of dependencies
on other parts of LLDB.

This patch splits out the code for the curses interface into its own file. This way
the simple IOHandler code is no longer buried in-between much larger functionalities.

Next up is splitting out the other IOHandlers into their own files and then move them
to more appropriate parts of LLDB.

Reviewers: labath, clayborg, JDevlieghere

Reviewed By: labath

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70946
2019-12-03 14:01:18 +01:00
Djordje Todorovic 409350deea Revert "[LiveDebugValues] Introduce entry values of unmodified params"
This reverts commit rG4cfceb910692 due to LLDB test failing.
2019-12-03 13:13:27 +01:00
Raphael Isemann 16c0653db1 [lldb][NFC] Extract searching for function SymbolContexts out of ClangExpressionDeclMap::LookupFunction
This code was just creating a new SymbolContextList with any found functions
in the front and orders them by how close they are to the current frame.
This refactors this code into its own function to make this more obvious.

Doesn't do any other changes to the code, so this is NFC.
2019-12-03 12:33:24 +01:00
Raphael Isemann b37a43d93d [lldb] Remove all remaining tabs from TestReturnValue.py
I assumed this was just a single typo, but it seems we actually have
a whole bunch of tabs in this file which cause Python to complain
about mixing tabs and spaces.
2019-12-03 12:14:40 +01:00
Raphael Isemann 4821d2a014 [lldb][NFC] Test going up/down one line in the multiline expression editor 2019-12-03 12:06:40 +01:00
Diana Picus 057626b439 Fixup 6d18e53: xfail TestShowLocationDwarf5.py properly
Forgot to squash this...
2019-12-03 11:53:28 +01:00
Raphael Isemann 46d0ec3a80 [lldb] Remove tab from TestReturnValue.py
Mixing tabs and spaces makes Python exit with this error:

  File "llvm/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py", line 23
    return (self.getArchitecture() == "aarch64" and self.getPlatform() == "linux")
                                                                                 ^
TabError: inconsistent use of tabs and spaces in indentation
2019-12-03 11:44:24 +01:00
Pavel Labath 2b8db387f2 [lldb] Move register info "augmentation" from gdb-remote into ABI
Summary:
Previously the ABI plugin exposed some "register infos" and the
gdb-remote code used those to fill in the missing bits. Now, the
"filling in" code is in the ABI plugin itself, and the gdb-remote code
just invokes that.

The motivation for this is two-fold:
a) the "augmentation" logic is useful outside of process gdb-remote. For
  instance, it would allow us to avoid repeating the register number
  definitions in minidump code.
b) It gives more implementation freedom to the ABI classes. Now that
  these "register infos" are essentially implementation details, classes
  can use other methods to obtain dwarf/eh_frame register numbers -- for
  instance they can consult llvm MC layer.

Since the augmentation code was not currently tested anywhere, I took
the opportunity to create a simple test for it.

Reviewers: jasonmolenda, clayborg, tatyana-krasnukha

Subscribers: aprantl, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70906
2019-12-03 11:39:20 +01:00
Djordje Todorovic 4cfceb9106 [LiveDebugValues] Introduce entry values of unmodified params
The idea is to remove front-end analysis for the parameter's value
modification and leave it to the value tracking system. Front-end in some
cases marks a parameter as modified even the line of code that modifies the
parameter gets optimized, that implies that this will cover more entry
values even. In addition, extending the support for modified parameters
will be easier with this approach.

Since the goal is to recognize if a parameter’s value has changed, the idea
at very high level is: If we encounter a DBG_VALUE other than the entry
value one describing the same variable (parameter), we can assume that the
variable’s value has changed and we should not track its entry value any
more. That would be ideal scenario, but due to various LLVM optimizations,
a variable’s value could be just moved around from one register to another
(and there will be additional DBG_VALUEs describing the same variable), so
we have to recognize such situation (otherwise, we will lose a lot of entry
values) and salvage the debug entry value.

Differential Revision: https://reviews.llvm.org/D68209
2019-12-03 11:01:45 +01:00
Diana Picus 6d18e5366c Mark some tests as xfail on AArch64 Linux
I have either opened new bug reports for these tests, or added links to
existing bugs.

This should help make the lldb-aarch64-ubuntu buildbot green (there will
still be some unexpected passes that someone should look into, but those
can be handled later).
2019-12-03 10:57:42 +01:00
Raphael Isemann 315600f480 [lldb][NFC] Remove ThreadSafeSTLVector and ThreadSafeSTLMap and their use in ValueObjectSynthetic
Summary:
ThreadSafeSTLVector and ThreadSafeSTLMap are not useful for achieving any degree of thread safety in LLDB
and should be removed before they are used in more places. They are only used (unsurprisingly incorrectly) in
`ValueObjectSynthetic::GetChildAtIndex`, so this patch replaces their use there with a simple mutex with which
we guard the related data structures. This doesn't make ValueObjectSynthetic::GetChildAtIndex
any more thread-safe, but on the other hand it at least allows us to get rid of the ThreadSafeSTL* data structures
without changing the observable behaviour of ValueObjectSynthetic (beside that it is now a few bytes smaller).

Reviewers: labath, JDevlieghere, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70845
2019-12-03 09:18:44 +01:00
Martin Storsjö 62a635e864 [LLDB] [test] Try to fix the test from 7d019d1a3b when run on Windows. 2019-12-02 23:36:36 +02:00
Jonas Devlieghere 8f2c100f6f [lldb/CMake] Add in_call_stack to the utilities package
A subset of the examples are shipped as python packages. Include the
in_call_stack utility.
2019-12-02 13:03:24 -08:00
Jonas Devlieghere e5290a06d6 [lldb/CMake] Simplify logic for adding example Python packages (NFC)
This simplifies the CMake logic for adding the Python examples to the
Python package. It unifies the use of create_python_package by adding
the NOINIT option and removes the `target` argument, which is always
`finish_swig`.
2019-12-02 13:03:24 -08:00
Martin Storsjö 7d019d1a3b [LLDB] Set the right address size on output DataExtractors from ObjectFile
If filling in a DataExtractor from an ObjectFile, e.g. via the
ReadSectionData method, the output DataExtractor gets the address
size from the m_data member.

ObjectFile's m_data member is initialized without knowledge about
the address size (so the address size is set based on the host's
sizeof(void*), and at that point within ObjectFile's constructor,
virtual methods implemented in subclasses (like GetAddressByteSize())
can't be called, therefore fix it up when filling in external
DataExtractors.

This makes sure that line tables from executables with a different
address size are parsed properly; previously this tripped up
DWARFDebugLine::LineTable::parse for 32 bit executables on a 64 bit
host, as the address size in the line table (4) didn't match the
one set in the DWARFDataExtractor.

Differential Revision: https://reviews.llvm.org/D70848
2019-12-02 22:42:00 +02:00
António Afonso afd5d91281 [lldb] Fix TestFormattersSBAPI test
Summary:
This test was broken in two ways:
* Using the wrong API (e.g.: format = instead of SetFormat)
* The hex checker was only checking "01" which will pass with 0x0000001

Reviewers: clayborg, lanza, wallace

Reviewed By: clayborg

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70884
2019-12-02 12:24:11 -08:00
Raphael Isemann d62026e2dd [lldb][NFC] Don't calculate member indices in DWARFASTParserClang::ParseChildMembers
We keep counting members and then don't do anything with the computed result.
2019-12-02 14:43:40 +01:00
Raphael Isemann 4f728bfc13 [lldb][NFC] Use raw_ostream instead of Stream in Baton::GetDescription
Removing raw_ostream here is getting us closer to removing LLDB's Stream
class.
2019-12-02 13:27:21 +01:00
Raphael Isemann f8fb3729e9 [lldb][NFC] Make Stream's IndentLevel an unsigned integers.
We expect it to be always positive values and LLVM/Clang's IndentLevel
values are already unsigned integers, so we should do the same.
2019-12-02 13:01:26 +01:00
Raphael Isemann 160a5045c6 [lldb][NFC] Add 'breakpoint command list' test
The command has zero test coverage and I'll have to touch the
code formatting the output commands, so let's start by adding a
test for it.
2019-12-02 11:57:55 +01:00
Martin Storsjö 45c843de4e [LLDB] [ARM] Use r11 as frame pointer on Windows on ARM
Extend EmulateMOVRdRm to identify "mov r11, sp" in thumb mode as
setting the frame pointer, if r11 is the frame pointer register.

Differential Revision: https://reviews.llvm.org/D70797
2019-11-29 16:06:17 +02:00
Raphael Isemann 8059188c45 [lldb][NFC] Remove unused ClangASTContext::GetBasicType(ConstString) 2019-11-29 14:11:25 +01:00
Raphael Isemann c214c92f3b [lldb][NFC] Remove ClangASTContext::GetBuiltinTypeForEncodingAndBitSize overload 2019-11-29 13:57:02 +01:00
Raphael Isemann bc7f1df6b6 [lldb][NFC] Explicitly ask for a ClangASTContext in ClangASTSource
ClangASTSource currently takes a clang::ASTContext and keeps that
around, but a lot of LLDB's functionality for doing operations
on a clang::ASTContext is in its ClangASTContext twin class. We
currently constantly recompute the respective ClangASTContext
from the clang::ASTContext while we instead could just pass and
store a ClangASTContext in the ClangASTSource. This also allows
us to get rid of a bunch of unreachable error checking for cases
where recomputation fails for some reason.
2019-11-29 13:28:55 +01:00
Raphael Isemann 76016f9b3a [lldb][NFC] Early exit in ClangASTContext::CreateInstance 2019-11-29 12:49:33 +01:00
Pavel Labath 656a8123de [lldb] Fix windows build for 38870af 2019-11-29 12:48:25 +01:00
Raphael Isemann d752b75d7f [lldb][NFC] Simplify regex_chars in CommandCompletions 2019-11-29 12:34:23 +01:00
Raphael Isemann d1d6049e9d [lldb][NFC] Remove dead logging code from DWARFASTParserClang::CompleteRecordType
This code is behind a `if (log)` that is always a nullptr as the initializer
was commented out. One could uncomment the initializer code, but then this logging
code just leads to a deadlock as it tries to aquire the module lock.
This removes the logging code until I get this working again.
2019-11-29 12:13:34 +01:00
Pavel Labath 38870af859 [lldb] Remove FileSpec->CompileUnit inheritance
Summary:
CompileUnit is a complicated class. Having it be implicitly convertible
to a FileSpec makes reasoning about it even harder.

This patch replaces the inheritance by a simple member and an accessor
function. This avoid the need for casting in places where one needed to
force a CompileUnit to be treated as a FileSpec, and does not add much
verbosity elsewhere.

It also fixes a bug where we were wrongly comparing CompileUnit& and a
CompileUnit*, which compiled due to a combination of this inheritance
and the FileSpec*->FileSpec implicit constructor.

Reviewers: teemperor, JDevlieghere, jdoerfert

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70827
2019-11-29 11:44:45 +01:00
Raphael Isemann a48b5e2474 [lldb][NFC] Fix header guard comment in ThreadSafeDenseMap.h 2019-11-29 11:34:18 +01:00
Konrad Kleine c671639af6 [lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Summary:
I found the above named method hard to read because it had

a) many nested blocks,
b) one return statement at the end with some logic involved,
c) a duplicated while-loop with just small differences in it.

I decided to refactor this function by employing an early exit strategy.
In order to capture the logic in the return statement and to not have it
repeated more than once I chose to implement a very small lamda function
that captures all the variables it needs.
I also replaced the two while-loops with just one.

This is a non-functional change (NFC).

Reviewers: jdoerfert, teemperor

Reviewed By: teemperor

Subscribers: labath, teemperor, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70774
2019-11-28 21:37:31 +01:00
Alexandre Ganea bdad3ec75a [LLDB] On Windows, force error message formatting to English
This fixes the Utility/StatusTest.ErrorWin32 unit test on non-English locales.

Differential Revision: https://reviews.llvm.org/D70442
2019-11-28 14:15:13 -05:00
Alexandre Ganea b4dfc5508f [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope
Differential Revision: https://reviews.llvm.org/D70448
2019-11-28 14:00:56 -05:00
Raphael Isemann c2dd84e396 [lldb][NFC] Remove CompilerDeclContext::IsClang
This method is only used in ClangASTContext.

Also removes the includes we only needed for the ClangASTContext RTTI check
in the CompilerDecl[Context].cpp files.
2019-11-28 15:54:11 +01:00
Raphael Isemann f39277c1d3 [lldb][NFC] Remove unused variable in ClangASTSource::CompleteType
Now that CompilerDeclContext is a trivial class, Clang started warning
that this unused variable is in fact unused. Let's remove it.
2019-11-28 15:32:56 +01:00
Raphael Isemann e0203b25af [lldb][NFC] Simplify CompilerDecl and CompilerDeclContext initialization 2019-11-28 15:27:54 +01:00
Raphael Isemann 3cd8ba0e37 [lldb][NFC] Remove unused CompilerDecl::IsClang 2019-11-28 15:11:37 +01:00
Pavel Labath b18e190b7c [lldb] refactor FileSpec::Equal
The logic of this function was quite hard to follow. Replace it with a
much simpler, equivalent, implementation.
2019-11-28 14:33:25 +01:00
Pavel Labath bf716eb807 [lldb] Add FileSpec::Equal unit tests
this is in preparation of a refactor of this method.
2019-11-28 14:31:52 +01:00
Pavel Labath d1a561d446 [lldb] Simplify and improve FileSpecTest
Summary:
A most of these tests create FileSpecs with a hardcoded style. Add
utility functions which create a file spec of a given style to simplify
things.

While in there add SCOPED_TRACE messages to tests which loop over
multiple inputs to ensure it's clear which of the inputs failed.

Reviewers: teemperor

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70814
2019-11-28 14:31:29 +01:00
Raphael Isemann 50e2ffa18d Revert "[lldb] NFC: refactor CompileUnit::ResolveSymbolContext"
This reverts commit 373e2a4f69.

This broke breakpoint setting.
2019-11-28 14:25:46 +01:00
Raphael Isemann 42c857aa47 [lldb][NFC] Remove unused STLUtil include and STLUtil.h header 2019-11-28 14:11:35 +01:00
Raphael Isemann a54ef8af89 [lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key 2019-11-28 14:05:47 +01:00
Konrad Kleine 373e2a4f69 [lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Summary:
I found the above named method hard to read because it had

a) many nested blocks and
b) one return statement at the end with some logic involved.

I decided to refactor this function by employing an early exit strategy.
In order to capture the logic in the return statement and to not have it
repeated more than once I chose to implement a very small lamda function
that captures all the variables it needs.

This is a non-functional change (NFC).

Reviewers: jdoerfert

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70774
2019-11-28 14:00:38 +01:00