Commit Graph

22193 Commits

Author SHA1 Message Date
Pavel Labath 6b37c476a2 [lldb] Improve test failure messages in vscode tests
A couple of tests sporadically fail on these assertions, but the error
messages do not give a clue as to what has actually happened.

Improve them so that we can better understand what is going wrong.
2020-03-10 14:32:45 +01:00
Pavel Labath 1ca1e08e75 [lldb] Break up CommandObjectDisassemble::DoExecute
The function consisted of a complicated set of conditions to compute the
address ranges which are to be disassembled (depending on the mode
selected by command line switches). This patch creates a separate
function for each mode, so that DoExecute is only left with the task of
figuring out how to dump the relevant ranges.

This is NFC-ish, except for one change in the error message, which is
actually an improvement.
2020-03-10 14:03:16 +01:00
Pavel Labath d00dff88b4 [lldb] Make UnwindLLDB a non-plugin
Summary:
This is the only real unwinder, and things have been this way for quite
a long time. At this point, the class has accumulated so many features
it is unlikely that anyone will want to reimplement the whole thing.

The class is also fairly closely coupled (through UnwindPlans and
FuncUnwinders) with a lot of other lldb components that it is hard to
imagine a different unwinder implementation being substantially
different without reimplementing all of those.

The existing unwinding functionality is nonetheless fairly complex and
there is space for adding more structure to it, but I believe a more
worthwhile effort would be to take the existing UnwindLLDB class and try
to break it down and introduce extension/customization points, instead
of writing a brand new Unwind implementation.

Reviewers: jasonmolenda, JDevlieghere, xiaobai

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75848
2020-03-10 13:56:15 +01:00
Djordje Todorovic 5aa5c943f7 Reland "[DebugInfo] Enable the debug entry values feature by default"
Differential Revision: https://reviews.llvm.org/D73534
2020-03-10 09:15:06 +01:00
Davide Italiano 9d389f7858 [AppleObjCRuntimeV2] Fix a typo. Evalulate -> evaluate. 2020-03-09 15:40:09 -07:00
Davide Italiano a3c4e6b44a [AppleObjC2RuntimeV2] Remove dead code. NFC. 2020-03-09 15:37:12 -07:00
Davide Italiano 3cabd173a1 [ObjC] Dynamic type resolution logging should go to the types log. 2020-03-09 15:35:51 -07:00
Fangrui Song 71269a1f17 [lldb] Add .clang-tidy with customization to disable readability-identifier-naming
Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D75810
2020-03-09 12:50:28 -07:00
Jonas Devlieghere 12ba989eef [lldb/Process] Update ThreadKDP for API change
GetUnwinder now returns a reference instead of a pointer.
2020-03-09 10:01:53 -07:00
Muhammad Omair Javaid 2b6ad82f8d [lldb/test] Fix arch arm for 32-bit armv7l/armv8l
This patch forces architecture "arm" if underlying os reports core
armv7l or armv8l. On linux systems 32 bit sysroot running on 64bit
AArch64 hardware reports armv7l or armv8l which is essently arm
32bit mode. This fixes 5 testcases on 32bit arm.
2020-03-09 20:32:18 +05:00
Pavel Labath 34d7143b03 [lldb] Fix windows build, second attempt 2020-03-09 16:24:34 +01:00
Pavel Labath 24b1831ebf [lldb] Fix windows&freebsd builds for c0b1af68 2020-03-09 14:55:43 +01:00
Pavel Labath c0b1af6878 [lldb] Return Unwinder& from Thread::GetUnwinder
The function always returns a valid object. Let the return type reflect
that, and remove some null checks.
2020-03-09 14:13:22 +01:00
Pavel Labath af3db4e9aa [lldb] Reduce duplication in the Disassembler class
Summary:
The class has two pairs of functions whose functionalities differ in
only how one specifies how much he wants to disasseble. One limits the
process by the size of the input memory region. The other based on the
total amount of instructions disassembled. They also differ in various
features (like error reporting) that were only added to one of the
versions.

There are various ways in which this could be addressed. This patch
does it by introducing a helper struct called "Limit", which is
effectively a pair specifying the value that you want to limit, and the
actual limit itself.

Reviewers: JDevlieghere

Subscribers: sdardis, jrtc27, atanasyan, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75730
2020-03-09 13:41:43 +01:00
Muhammad Omair Javaid ee4dc980c0 [lldb/test] Remove skip arm/aarch64 decorator from instruction counting tests
This patch removes skipIf decorator from instruction counting tests.
We now use inline intruction in testing inferior to make sure that
number of instructions stays fixed. This was tested on aarch64 linux.
2020-03-09 12:54:42 +05:00
Yaxun (Sam) Liu fe73d36f23 Fix lldb build failure due to clang mangler change 2020-03-08 00:38:30 -05:00
Michał Górny 172d564c73 [lldb] Un-XFAIL two tests on NetBSD 2020-03-07 18:35:22 +01:00
Raphael Isemann 6bbdecc5cf [lldb][NFC] Make TestStats.py not an inline test
There is still the bug that empty lines seem to skip any following expressions
and it makes it harder to commend between all the comments. Let's make this
a normal test instead which is just slightly more verbose but can be properly
formatted.
2020-03-06 18:47:59 -08:00
Raphael Isemann 8f7c911b58 [lldb][NFC] Refactor our option generation out of EvaluateExpression 2020-03-06 18:32:16 -08:00
Raphael Isemann 4e7c686e46 [lldb] Never compile the debugserver with Clang module flags
Summary:
Compiling ObjC++ with Clang modules is usually not working well and compiling
the small debugserver with modules is not worth the trouble.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74891
2020-03-06 17:26:39 -08:00
Raphael Isemann ce1bc00f37 [lldb][cmake] Move remove_module_flags macro to AddLLDB.cmake
Summary: This is currently hidden in the Host CMakeLists but we should also use this macro in other parts of LLDB where we have ObjC++ sources (see D74891)

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75164
2020-03-06 17:21:24 -08:00
Raphael Isemann 2bba1c22e7 tab completion for process signal
Summary: Provide a list of Unix signals for the tap completion for command "process signal".

Reviewers: teemperor

Subscribers: labath, jingham, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75418
2020-03-06 17:05:25 -08:00
Raphael Isemann 53b135eeb4 [lldb][NFC] Refactor TestSafeFuncCalls.py
Summary:
This patch inlines all the single-line functions that we only use once in the test
and replaces the assertTrue with an assertEquals to improve the error message
when this test fails.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75497
2020-03-06 15:46:36 -08:00
Adrian Prantl 33b696b57a Fix test broken by simulator triple changes. 2020-03-06 11:28:31 -08:00
Raphael Isemann 3b2c4e7178 [lldb] Remove some #ifdef LLDB_CONFIGURATION_DEBUG around asserts
Summary:
Otherwise this code won't run on the Release+Asserts builds we have on the CI.

Fixes rdar://problem/59867885 (partly)

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75493
2020-03-06 11:21:00 -08:00
Gongyu Deng ec31255c00 [lldb] Update the current execution context at the beginning of tab completions
Summary: Fix a bug that tab completions won't synchronous the current execution context. ( Thanks for Jim's explanation! )

Reviewers: teemperor, labath, jingham

Reviewed By: jingham

Subscribers: jingham, labath

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75597
2020-03-06 10:44:00 -08:00
Adrian Prantl 000847f8be Correctly identify iOS simulator processes in debugserver.
Starting with iOS 13 simulator binaries are identified with an
explicit platform in the new LC_BUILD_VERSION load command.

On older deployment targets using the LC_VERSION_MIN load commands,
this patch detects when an ios process runs on a macOS host and
updates the target triple with the "simulator" environment
accordingly.

(Patch re-applied with bugfix this time).

This is part of https://bugs.swift.org/browse/SR-11971

rdar://problem/58438125

Differential Revision: https://reviews.llvm.org/D75696
2020-03-06 10:16:47 -08:00
Adrian Prantl 4ebe9b498d Revert "Correctly identify iOS simulator processes in debugserver."
This reverts commit 59d816d884.

It broke TestGDBRemoteClient.
2020-03-06 10:16:47 -08:00
Adrian Prantl 3ed02340ea Increase default timeout in lldbutil.expect_state_changes() 2020-03-06 10:00:47 -08:00
Adrian Prantl 58c506d8e8 Correctly identify iOS simulator processes in debugserver.
Starting with iOS 13 simulator binaries are identified with an
explicit platform in the new LC_BUILD_VERSION load command.

On older deployment targets using the LC_VERSION_MIN load commands,
this patch detects when an ios process runs on a macOS host and
updates the target triple with the "simulator" environment
accordingly.

(Patch re-applied without modifications, the bot failure was unrelated).

This is part of https://bugs.swift.org/browse/SR-11971

rdar://problem/58438125

Differential Revision: https://reviews.llvm.org/D75696
2020-03-06 09:59:30 -08:00
Adrian Prantl 66a6fa631e Revert "Correctly identify iOS simulator processes in debugserver."
This reverts commit 59d816d884.

It broke TestGDBRemoteClient.
2020-03-06 09:52:20 -08:00
Adrian Prantl 59d816d884 Correctly identify iOS simulator processes in debugserver.
Starting with iOS 13 simulator binaries are identified with an
explicit platform in the new LC_BUILD_VERSION load command.

On older deployment targets using the LC_VERSION_MIN load commands,
this patch detects when an ios process runs on a macOS host and
updates the target triple with the "simulator" environment
accordingly.

This is part of https://bugs.swift.org/browse/SR-11971

rdar://problem/58438125

Differential Revision: https://reviews.llvm.org/D75696
2020-03-06 09:42:05 -08:00
Pavel Labath 92c0cda928 [lldb/Disassembler] Move address resolution into the ParseInstructions function
The static Disassembler can be thought of as shorthands for three
operations:
- fetch an appropriate disassembler instance (FindPluginForTarget)
- ask it to dissassemble some bytes (ParseInstructions)
- ask it to dump the disassembled instructions (PrintInstructions)

The only thing that's standing in the way of this interpretation is that
the Disassemble function also does some address resolution before
calling ParseInstructions. This patch moves this functionality into
ParseInstructions so that it is available to users who call
ParseInstructions directly.
2020-03-06 11:23:41 +01:00
Pavel Labath aa73ee052f [lldb/test] Use inline assembly for instruction counting tests
We have a test which checks that instruction-step really steps one
instruction, but the way it checks this makes it very susceptible to
codegen changes. This rewrites the test inferior to use inline assembly,
which guarantees a known sequence of instructions that the test can
check. This does mean we have to write separate assembly for each
architecture, but that is no better than having architecture-specific
assertions, which the test was already starting to accumulate.
2020-03-06 11:05:07 +01:00
Muhammad Omair Javaid eaddbc238d LLDB AArch64 skip single_step_only_steps_one_instruction* tests
This patch makes sure that LLDB AArch64/Linux testsuite skips
single_step_only_steps_one_instruction* tests. There is no possible
gaurantee for this test to pass and there already exists a bug report
against this bug.
2020-03-06 14:26:11 +05:00
Pavel Labath 71c1c18474 [lldb] Delete UnwindMacOSXFrameBackchain
Summary:
It isn't used anywhere (except on imaginary triples like
sparc-apple-ios) and it also violates plugin separation.

This patch deletes it and declares UnwindLLDB to be _the_ lldb unwinder.

Reviewers: jasonmolenda, JDevlieghere, xiaobai

Subscribers: jyknight, mgorny, krytarowski, fedor.sergeev, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75680
2020-03-06 08:27:13 +01:00
Jonas Devlieghere 621d969a96 [lldb/DWARF] Fix 80 col formatting (NFC)
Forgot to run git clang-format before landing my previous commit
(226d52b1fa).
2020-03-05 21:28:23 -08:00
Jonas Devlieghere 226d52b1fa [lldb/DWARF] Replace C style casts with static_cast<> (NFC)
Using static_cast instead of C style casts better conveys the code's
intent, is a tad more safe and stands out more.
2020-03-05 21:24:51 -08:00
Shu Anzai 467969161d [lldb/Core] Minor code cleanup in Editline.cpp (NFC)
Simplify the code a bit.

Differential revision: https://reviews.llvm.org/D75294
2020-03-05 16:15:26 -08:00
Raphael Isemann d0e8abc438 [lldb] Fix more typos in log statements in ClangASTSource
The indexes need to start at 0 but in D74951 I removed the first parameter
and didn't decrement all the indexes. This patch at least makes sure that
LLDB logging no longer crashes (but it still deadlocks).
2020-03-05 14:13:09 -08:00
Pavel Labath 04592d5b23 [lldb] s/ExecutionContext/Target in Disassembler
Some functions in this file only use the "target" component of an
execution context. Adjust the argument lists to reflect that.

This avoids some defensive null checks and simplifies most of the
callers.
2020-03-05 14:46:39 +01:00
Tatyana Krasnukha ef38283a09 [lldb][test] Temporarily X-fail TestPtrRefs.py and TestPtrRefsObjC.py
Bugzilla issue: llvm.org/pr45112
2020-03-05 14:38:44 +03:00
Pavel Labath ea68462ed1 [lldb] Make Disassembler::PrintInstructions a method
the previously static member function took a Disassembler* argument
anyway. This renames the argument to "this". The function also always
succeeds (returns true), so I change the return type to void.
2020-03-05 12:07:49 +01:00
Pavel Labath c6a38957a7 [lldb] Delete two overloads of Disassembler::Disassemble
by "inlining" them into their single caller (CommandObjectDisassemble).
The functions mainly consist of long argument lists and defensive
checks. These become unnecessary after inlining, so the end result is
less code. Additionally, this makes the implementation of
CommandObjectDisassemble more uniform (first figure out what you're
going to disassemble, then actually do it), which enables further
cleanups.
2020-03-05 11:00:37 +01:00
Tatyana Krasnukha aafd65ad9f [lldb][test] Replace HandleCommand with runCmd to check that a command succeeded 2020-03-05 12:37:08 +03:00
Tatyana Krasnukha d2e397f156 [lldb][test] These tests don't fail on Windows anymore 2020-03-05 12:37:08 +03:00
Tatyana Krasnukha 7a11cc06a4 [lldb][test] TestFileHandle: flush the output after write 2020-03-05 11:45:28 +03:00
Tatyana Krasnukha eecef3af2c [lldb][test] Enable fix-its for the test case that expects them enabled
Fix-its were intentionally disabled by TestBase.setUp so that incorrect expressions in tests
don't pass just because Clang thinks it has a fix-it.
2020-03-05 10:31:07 +03:00
Tatyana Krasnukha a31130f6fc [lldb][testsuite] Create a SBDebugger instance for each test
Some tests set settings and don't clean them up, this leads to side effects in other tests.
The patch removes a global debugger instance with a per-test debugger to avoid such effects.

From what I see, lldb.DBG was needed to determine the platform before a test is run,
lldb.selected_platform is used for this purpose now. Though, this required adding a new function
to the SBPlatform interface.

Differential Revision: https://reviews.llvm.org/D74903
2020-03-05 10:12:54 +03:00
Raphael Isemann 70b8f95813 [lldb][NFC] Use C++11 for loop in ClangASTSource::FindExternalLexicalDecls 2020-03-04 12:57:05 -08:00