Commit Graph

23277 Commits

Author SHA1 Message Date
Luboš Luňák 2f1b24b70c [lldb][gui] implement TerminalSizeChanged()
Differential Revision: https://reviews.llvm.org/D85088
2020-08-05 09:51:12 +02:00
Luboš Luňák c952ec15d3 [lldb] fix building with panel.h being in /usr/include/ncurses/
My openSUSE 15.2 has /usr/include/curses.h as a symlink to
/usr/include/ncurses/curses.h , but there's no such symlink
for panel.h . Prefer using /usr/include/ncurses for the includes
if they are found there by the CMake check.

Differential Revision: https://reviews.llvm.org/D85219
2020-08-05 09:51:12 +02:00
Fred Riss 4c9ed3ed3d [lldb/testsuite] Skip 'frame diagnose' tests based on architecture
AFAICS, the feature only works on x86, skipping the tests has nothing to
do with the target being iOS or remote.
2020-08-04 17:45:55 -07:00
Adrian Prantl 7e9bab6ad5 Fix debugserver's qProcessInfo reporting of maccatalyst binaries
This patch is similar in spirit to https://reviews.llvm.org/D84480,
but does the maccatalyst/macosx disambiguation. I also took the
opportunity to factor out the gdb-remote packet log scanning used by
several testcases into lldbutil functions.

rdar://problem/66059257

Differential Revision: https://reviews.llvm.org/D84576
2020-08-04 16:42:14 -07:00
Jonas Devlieghere e8b7edafc3 [lldb/Test] Add @skipIfRemote decorator to TestProcessList.py
lldb-platform contains a very minimal support for the qfProcessInfo
packet, only allowing the simplest query to get most of the testsuite
running, and returning very little information about the matched
processes.
2020-08-04 14:40:07 -07:00
Jonas Devlieghere ba3d84d82b [lldb/Test] Skip tests that try to get the remote environment
We don't support getting the remote environment. The gdb remote protocol
has no packet for that.
2020-08-04 14:01:57 -07:00
Yifan Shen e7af98680a [lldb-vscode ]Add Syntax Highlighting to Disassembly View
When lldb cannot find source file thus IDE renders a disassembly view, add syntax highlighting for constants, registers and final line comments for better debugging experience.
The original plain disassembly view looks like:
{F12401687}
An ideal view is like the screenshot attached.
{F12401515}

In this diff, the mimeType is a kind of media type for formatting the content in the response to a source request. Elements in the disassembly view, like constants, registers and final line comments are colored for highlighting.
A built-in support in the VSCode IDE for syntax highlighting will identify the which mimeType to apply and render the disassembly view as expected.

Reviewed By: wallace, clayborg

Differential Revision: https://reviews.llvm.org/D84555
2020-08-04 13:31:44 -07:00
Jonas Devlieghere bb33f925a6 [lldb/Test] Add missing stdio.h includes
Fixes error: implicit declaration of function 'printf' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
2020-08-04 13:08:14 -07:00
Jordan Rupprecht 31ec6e969d [test] Fix another realpath->abspath.
This is a followup to 817b3a6fe3a4452eb61a2503c8beaa7267ca0351: in `builder_base` we should use abspath, not realpath, because the name is significant.
This is used by test cases that use `@skipIf(compiler="clang", compiler_version=['<', <version>])`
2020-08-04 11:06:31 -07:00
Jonas Devlieghere 041c7b84a4 [lldb/Host] Upstream macOS TCC code
Upstream the code for dealing with TCC introduced in macOS Mojave. This
will make the debuggee instead of the debugger responsible for the
privileges it needs.

Differential revision: https://reviews.llvm.org/D85217
2020-08-04 09:23:54 -07:00
Jordan Rupprecht 817b3a6fe3 [test] Use abspath instead of realpath sometimes
In these two cases, use of `os.path.realpath` is problematic:

- The name of the compiler is significant [1] . For testing purposes, we might
  provide a compiler called "clang" which is actually a symlink to some build
  script (which does some flag processing before invoking the real clang). The
  destination the symlink may not be called "clang", but we still want it to be
  treated as such.
- When using a build system that puts build artifacts in an arbitrary build
  location, and later creates a symlink for it (e.g. creates a
  "<lldb root>/lldbsuite/test/dotest.py" symlinks that points to
  "/build/artifact/<hash>/dotest.py"), looking at the realpath will not match
  the "test" convention required here.

[1] See `Makefile.rules` in the lldb tree, e.g. we use different flags if the compiler is named "clang"

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D85175
2020-08-04 08:20:50 -07:00
Luboš Luňák daa1c6d9d1 [lldb] fix typo 2020-08-04 12:05:57 +02:00
Jonas Devlieghere d6a5cce0e7 [lldb/Test] Fix skipTestIfFn for fucntions that return a value
Sometimes the decorator is used on a common function rather than the
test method, which can return a value. This fails with decorators that
use skipTestIfFn under the hood.
2020-08-03 19:56:12 -07:00
Jordan Rupprecht a06c28df3e Temporarily revert "[test] Exit with an error if no tests are run."
This reverts commit adb5c23f8c. It surprisingly fails on a windows build bot: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/18009

Will reland after some investigation and/or after adding some extra logging to help debug the issue.
2020-08-03 18:37:50 -07:00
Jordan Rupprecht adb5c23f8c [test] Exit with an error if no tests are run.
If the test suite is misconfigured when it's run (a bad regexp, wrong test directory, etc.), the test suite may not discover any tests. When this happens, the test runner exits happily because no tests failed:

```
Ran 0 tests in 0.000s
RESULT: PASSED (0 passes, 0 failures, 0 errors, 0 skipped, 0 expected failures, 0 unexpected successes)
```

Change this to return an error so the misconfiguration can be more easily detected. Verified that `lldb-dotest -p TestDoesNotExist.py` successfully fails.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D85169
2020-08-03 16:32:12 -07:00
Tatyana Krasnukha e97c693bb0 [lldb/Process/Windows] Attempting to kill exited/detached process in not an error
The lldb test-suite on Windows reports a 'CLEANUP ERROR' when attempting to kill
an exited/detached process. This change makes ProcessWindows consistent with
the other processes which only log the error. After this change a number of
'CLEANUP ERROR' messages are now removed.

Differential Revision: https://reviews.llvm.org/D84957
2020-08-03 12:52:43 +03:00
Luboš Luňák 18d4069503 fix lldb test on lib64 systems
Differential revision: https://reviews.llvm.org/D85096
2020-08-03 11:19:07 +02:00
Raphael Isemann 8aeb212887 [debugserver] Fix that is_dot_app is producing unused warnings
Some build configurations don't use this static function.
2020-08-03 10:24:21 +02:00
Jan Kratochvil e6c2c9a7d1 [lldb] [test] Fix DW_TAG_GNU_call_site-DW_AT_low_pc.s relocation
I have made the DW_FORM_ref4 relative. One could also use relocated
DW_FORM_ref_addr instead.

Tested with:
        echo 'void f(){}'|clang -o 1.o -c -Wall -g -x c -;./bin/clang -o 1 1.o ../llvm-monorepo/lldb/test/Shell/SymbolFile/DWARF/DW_TAG_GNU_call_site-DW_AT_low_pc.s;./bin/lldb --no-lldbinit ./1 -o r -o 'p p' -o exit
2020-08-02 22:41:02 +02:00
Adrian Prantl 5110fd0343 Convert to early exit (NFC) 2020-07-31 14:55:09 -07:00
Luboš Luňák 77d5a63c19 [lldb] report an error if a CLI option lacks an argument
Differential Revision: https://reviews.llvm.org/D84955
2020-07-31 22:02:40 +02:00
Luboš Luňák 8739445e32 [lldb] force full gui redraw on Ctrl+L
As is common with curses apps, this allows to redraw everything
in case something corrupts the screen. Apparently key modifiers
are difficult with curses (curses FAQ it "doesn't do that"),
thankfully Ctrl+key are simply control characters, so it's
(ascii & 037) => 12.

Differential Revision: https://reviews.llvm.org/D84972
2020-07-31 22:02:40 +02:00
Jonas Devlieghere 162e9f72ac [lldb/Test] Reduce code duplication by importing subprocess globally
Import the subprocess module once instead of doing it inline which is
error prone and leads to needless code duplication.
2020-07-31 10:56:13 -07:00
Jason Molenda abf546dd4f debguserver's type sniffer to only treat .app things that end in .app
On an iOS device, if debugserver is left to figure out how to launch
the binary provided, it looks at the filename to see if it contains
".app" and asks FrontBoard to launch it.  However, if this is actually
a command line app with the characters ".app" in the name, it would
end up trying to launch that via the FrontBoard calls even though it
needed to be launched via posix_spawn.  For instance, a command line
program called com.application.tester.

Jim suggested this patch where we only send binaries that end in ".app"
to FrontBoard.

Often debugsever is invoked with a --launch command line argument to
specify the launch method, and none of this code is hit in that
instance.

<rdar://problem/65297100>
2020-07-30 21:14:33 -07:00
Davide Italiano 57605758b5 [debugserver/Apple Silicon] Handoff connections when attaching to translated processes
When we detect a process that the native debugserver cannot handle,
handoff the connection fd to the translated debugserver.
2020-07-30 16:21:05 -07:00
Jonas Devlieghere 02c1bba670 [lldb/Docs] Remove stale bot on GreenDragon and add reproducer one
- Remove the link to the Python 3 job which no longer exists.
 - Add a link to the reproducer job.
2020-07-30 13:51:16 -07:00
Jonas Devlieghere 8c1a31d833 [lldb/Docs] Add lldb-arm-ubuntu to the list of bots 2020-07-30 13:47:21 -07:00
Jonas Devlieghere 3bb48898bc [lldb/Test] Use self.assertIn in TestGdbRemoteTargetXmlPacket
On the ARM buildbot the returned architecture is `armv8l` while
getArchitecture() just returns `arm`.
2020-07-30 11:48:35 -07:00
Jonas Devlieghere 41909e9682 [lldb] Add copy ctor/assignment operator to SBCommandInterpreterRunOptions 2020-07-30 10:39:30 -07:00
Jordan Rupprecht be198e03eb [lldb][test] Move registers-target-xml-reading target to the correct test location.
This test was added in D74217 (and the `.categories` file later added in ccf1c30cde) around the same time I moved the test tree from `lldb/packages/Python/lldbsuite/test` to `lldb/test/API` (D71151). Since this got lost in the move, it isn't running. (I introduced an intentional syntax error, and `ninja check-lldb` passes).

I moved it to the correct location, and now it runs and passes -- locally, at least -- as `ninja check-lldb-api-tools-lldb-server-registers-target-xml-reading`.
2020-07-30 10:28:32 -07:00
Jordan Rupprecht 09cb6f233d [lldb][NFC][test] Fix comment referring to FileCheck instead of yaml2obj 2020-07-30 09:47:44 -07:00
Jonas Devlieghere b6635b5b15 [lldb] Add SBCommandInterpreterRunOptions to LLDB.h 2020-07-30 08:46:19 -07:00
Raphael Isemann a4a0844248 [lldb] Don't use static locals for return value storage in some *AsCString functions
Let's just return a std::string to make this safe. formatv seemed overkill for formatting
the return values as they all just append an integer value to a constant string.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D84505
2020-07-30 12:17:42 +02:00
Jonas Devlieghere 9a3dbc9723 [lldb] Move finish_swig logic into a function in the binding dir
Move the finish_swig logic into a function in the bindings directory. By
making this a function I can reuse the logic internally where we ship
two Python versions and therefore need to finish the bindings twice.
2020-07-29 17:59:56 -07:00
Jonas Devlieghere 6587ff77ea [lldb] Fix llvm-lit in standalone builds
LLVM's make_paths_relative uses Python3_EXECUTABLE which isn't set in
standalone LLDB builds.
2020-07-29 15:38:40 -07:00
shafik 6700f4b9fe [LLDB] Add checks for ValueObjectSP in Cocoa summary providers
We saw a crash recently (rdar://problem/65276489) that looks related to an invalid ValueObjectSP in a summary providers in Cocoa.cpp e.g. NSBundleSummaryProvider(...).
This adds checks before we use them usually by calling NSStringSummaryProvider.

Differential Revision: https://reviews.llvm.org/D84272
2020-07-29 14:47:18 -07:00
Luboš Luňák 13978643b6 [lldb] implement 'up' and 'down' shortcuts in lldb gui
Also add a unittest.

Differential Revision: https://reviews.llvm.org/D68541
2020-07-29 22:30:23 +02:00
Luboš Luňák 336c7029ef [lldb] change shortcut for 'step out' from 'o' to 'f'
This makes it consistent with gdb tui, where 'f' is 'finish'.
See the discussion at https://reviews.llvm.org/D68541 .

Differential Revision: https://reviews.llvm.org/D68909
2020-07-29 22:30:23 +02:00
Luboš Luňák 47d2c7cd5d [lldb] remove somewhat dangerous 'd'(etach) and 'k'(ill) shortcuts
'd' would be much better used for up/down shortcuts, and this also removes
the possibility of ruining the whole debugging session by accidentally
hitting 'd' or 'k'. Also change menu to have both 'detach and resume'
and 'detach suspended' to make it clear which one is which. See
discussion at https://reviews.llvm.org/D68541 .

Differential Revision: https://reviews.llvm.org/D68908
2020-07-29 22:30:23 +02:00
Tatyana Krasnukha da0bba5c9a [lldb/Breakpoint] Rename StoppointLocation to StoppointSite and drop its relationship with BreakpointLocation
Both of BreakpointLocation and BreakpointSite were inherited from StoppointLocation. However, the only thing
they shared was hit counting logic. The patch encapsulates those logic into StoppointHitCounter, renames
StoppointLocation to StoppointSite, and stops BreakpointLocation's inheriting from it.

Differential Revision: https://reviews.llvm.org/D84527
2020-07-29 22:07:46 +03:00
Tatyana Krasnukha d5c1f686e3 [lldb/BreakpointSite] Handle all ways of control flow 2020-07-29 21:53:18 +03:00
Tatyana Krasnukha ebaa8b1c60 [lldb] Don't use hardware index to determine whether a breakpoint site is hardware
Most process plugins (if not all) don't set hardware index for breakpoints. They even
are not able to determine this index.

This patch makes StoppointLocation::IsHardware pure virtual and lets BreakpointSite
override it using more accurate BreakpointSite::Type.

It also adds assertions to be sure that a breakpoint site is hardware when this is required.

Differential Revision: https://reviews.llvm.org/D84257
2020-07-29 21:27:24 +03:00
Tatyana Krasnukha b352e62fea [lldb] Make process plugins check whether a hardware breakpoint is required
Remove @skipIfWindows as process should report the error correctly on Windows now.

Differential Revision: https://reviews.llvm.org/D84255
2020-07-29 21:27:23 +03:00
Tatyana Krasnukha f7ec3e3be7 [lldb] Skip overlapping hardware and external breakpoints when writing memory
This fixes the assertion `assert(intersects);` in the Process::WriteMemory function.

Differential Revision: https://reviews.llvm.org/D84254
2020-07-29 21:27:23 +03:00
Tatyana Krasnukha c114352edf [lldb/test] Put hardware breakpoint tests together, NFC
Create a common base class for them to re-use supports_hw_breakpoints function in decorators.

Differential Revision: https://reviews.llvm.org/D84311
2020-07-29 21:20:04 +03:00
Jonas Devlieghere 4add853647 [lldb] Improve platform handling in CreateTargetInternal
Currently, `target create` has no --platform option. However,
TargetList::CreateTargetInternal which is called under the hood, will
return an error when either no platform or multiple matching platforms
are found, saying that a platform should be specified with --platform.

This patch adds the platform option, but that doesn't solve either of
these errors.

 - If more than one platform matches, specifying the platform isn't
   going to fix that. The current code will only look at the
   architecture instead. I've updated the error message to ask the user
   to specify an architecture.

 - If no architecture is found, specifying a new one via platform isn't
   going to change that either because we already try to find one that
   matches the given architecture.

Differential revision: https://reviews.llvm.org/D84809
2020-07-29 10:30:20 -07:00
Jonas Devlieghere 2fa3da7dcd [lldb] Remove unused option '--platform-path' for 'target create'
Differential revision: https://reviews.llvm.org/D84800
2020-07-28 16:16:30 -07:00
Zahira Ammarguellat 80bd6ae13e On Windows build, making the /bigobj flag global , instead of passing it per file.
To avoid having this flag be passed in per/file manner, we are instead
passing it globally.

This fixes this bug: https://bugs.llvm.org/show_bug.cgi?id=46733

Reviewed-by: aaron.ballman, beanz, meinersbur

Differential Revision: https://reviews.llvm.org/D84038
2020-07-28 18:04:36 -05:00
Amy Huang 394db22595 Revert "Switch to using -debug-info-kind=constructor as default (from =limited)"
This reverts commit 227db86a1b.

Causing debug info errors in google3 LTO builds; also causes a
debuginfo-test failure.
2020-07-28 11:23:59 -07:00
Shu Anzai 5608f28f55 [lldb] Change the definition of ANSI_UNFAINT
Change the definition of ANSI_UNFAINT in Editline.cpp.

Differential revision: https://reviews.llvm.org/D84695
2020-07-28 11:06:45 -07:00
Fred Riss 8120eba5fc [lldb/ArchSpec] Always match simulator environment in IsEqualTo
Summary:
Initially, Apple simulator binarie triples didn't use a `-simulator`
environment and were just differentiated based on the architecture.
For example, `x86_64-apple-ios` would obviously be a simualtor as iOS
doesn't run on x86_64. With Catalyst, we made the disctinction
explicit and today, all simulator triples (even the legacy ones) are
constructed with an environment. This is especially important on Apple
Silicon were the architecture is not different from the one of the
simulated device.

This change makes the simulator part of the environment always part of
the criteria to detect whether 2 `ArchSpec`s are equal or compatible.

Reviewers: aprantl

Subscribers: inglorion, dexonsmith, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D84716
2020-07-27 17:33:37 -07:00
Petr Hosek 64d99cc6ab [CMake] Move find_package(ZLIB) to LLVMConfig
This way, downstream projects don't have to invoke find_package(ZLIB)
reducing the amount of boilerplate.

Differential Revision: https://reviews.llvm.org/D84691
2020-07-27 17:13:55 -07:00
Fred Riss ef748b58d3 [lldb] NFC: Use early exit in ArchSpec::IsEqualTo 2020-07-27 14:12:02 -07:00
Adrian Prantl 113f56fbb8 Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)
This cleanup patch unifies all methods called GetByteSize() in the
ValueObject hierarchy to return an optional, like the methods in
CompilerType do. This means fewer magic 0 values, which could fix bugs
down the road in languages where types can have a size of zero, such
as Swift and C (but not C++).

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

This re-lands the patch with bogus :m_byte_size(0) initalizations removed.
2020-07-27 13:26:35 -07:00
Fred Riss 4c6eebf86a [lldb/AppleSimulator] Always provide a -simulator environment
Summary:
This commit is somewhat NFC-ish today as the environment of triples
is not considered when comparing s if one of them is
not set (I plan to change that).

We have made simulator triples unambiguous these days, but the
simulator platforms still advertise triples without the
environment. This wasn't an issue when the sims ran only on
a very different architecure than the real device, but this
has changed with Apple Silicon.

This patch simplifies the way GetSupportedArchitectureAtIndex
is implemented for the sim platforms and adds the environment.
It also trivially adds support for Apple Silicon to those
platforms.

Reviewers: aprantl

Subscribers: lldb-commits
2020-07-27 12:50:50 -07:00
Jonas Devlieghere 536baa11cf [lldb] Remove CMAKE_VERSION checks now that the minimum version is 3.13.4 2020-07-27 12:31:41 -07:00
Raphael Isemann 432241955e [lldb][NFC] Use a StringRef for AddRegexCommand::AddRegexCommand parameters
Summary: This way we can get rid of this 1024 char buffer workaround.

Reviewers: #lldb, labath

Reviewed By: labath

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D84528
2020-07-27 14:36:47 +02:00
Raphael Isemann db203e0268 [lldb] Modernize away some snprintf calls
Reviewers: #lldb, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D84530
2020-07-27 14:27:54 +02:00
Pavel Labath 1956cf1042 [lldb/DWARF] Don't treat class declarations with children as definitions
Summary:
This effectively reverts r188124, which added code to handle
(DW_AT_)declarations of structures with some kinds of children as
definitions. The commit message claims this is a workaround for some
kind of debug info produced by gcc. However, it does not go into
specifics, so it's hard to reproduce or verify that this is indeed still a
problem.

Having this code is definitely a problem though, because it mistakenly
declares incomplete dwarf declarations to be complete. Both clang (with
-flimit-debug-info) and gcc (by default) generate DW_AT_declarations of
structs with children. This happens when full debug info for a class is
not emitted in a given compile unit (e.g. because of vtable homing), but
the class has inline methods which are used in the given compile unit.
In that case, the compilers emit a DW_AT_declaration of a class, but
add a DW_TAG_subprogram child to it to describe the inlined instance of
the method.

Even though the class tag has some children, it definitely does not
contain enough information to construct a full class definition (most
notably, it lacks any members). Keeping the class as incomplete allows
us to search for a real definition in other modules, helping the
-flimit-debug-info flow. And in case the definition is not found we can
display a error message saying that, instead of just showing an empty
struct.

Reviewers: clayborg, aprantl, JDevlieghere, shafik

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D83302
2020-07-27 12:58:22 +02:00
Pavel Labath 2e828e7579 [lldb] Fix e89414f406 for msvc
MSVC finds the APInt construction ambiguous. Use a case to help it
choose the right constructor.
2020-07-27 11:49:46 +02:00
Pavel Labath e89414f406 [lldb/Utility] Clean up Scalar constructors
- move initialization to initializer lists
- make desctructor non-virtual (nothing else is)
- fix long double constructor so that it actually works
2020-07-27 10:06:56 +02:00
Pavel Labath 81d7ebaf5c [lldb/Utility] Fix a bug in RangeMap::CombineConsecutiveRanges
The function didn't combine a large entry which overlapped several other
entries, if those other entries were not overlapping among each other.

E.g., (0,20),(5,6),(10,11) produced (0,20),(10,11)

Now it just produced (0,20).
2020-07-27 10:06:56 +02:00
Eric Christopher 4b14ef33e8 Temporarily Revert "Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)"
as it's causing numerous (176) test failures on linux.

This reverts commit 1d9b860fb6.
2020-07-25 18:42:04 -07:00
Adrian Prantl 1d9b860fb6 Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)
This cleanup patch unifies all methods called GetByteSize() in the
ValueObject hierarchy to return an optional, like the methods in
CompilerType do. This means fewer magic 0 values, which could fix bugs
down the road in languages where types can have a size of zero, such
as Swift and C (but not C++).

Differential Revision: https://reviews.llvm.org/D84285
2020-07-25 08:27:21 -07:00
Adrian Prantl e937840dbd Upstream macCatalyst support in ArchSpec and associated unit tests. 2020-07-24 18:01:41 -07:00
Jonas Devlieghere 34d4c8a53e [lldb] Have LanguageRuntime and SystemRuntime share a base class (NFC)
LangaugeRuntime and SystemRuntime now both inherit from Runtime.
2020-07-24 16:28:34 -07:00
Jonas Devlieghere 99996213eb [lldb] Don't wrap and release raw pointer in unique_ptr (NFC) 2020-07-24 16:28:34 -07:00
Petr Hosek c86f56e32e [CMake] Find zlib when building lldb as standalone
This addresses the issue introduced by 10b1b4a.
2020-07-24 13:36:13 -07:00
Yifan Shen 2c1bea88a5 Add Debug Info Size to Symbol Status
If a module has debug info, the size of debug symbol will be displayed after the Symbols Loaded Message for each module in the VScode modules view.{F12335461}

Reviewed By: wallace, clayborg

Differential Revision: https://reviews.llvm.org/D83731
2020-07-24 13:30:04 -07:00
Walter Erquinigo 313b60742a Revert "Add Debug Info Size to Symbol Status"
This reverts commit 986e3af53b.

It incorrectly deleted clang/tools/clang-format/git-clang-format
2020-07-24 13:28:29 -07:00
Yifan Shen 986e3af53b Add Debug Info Size to Symbol Status
Summary: If a module has debug info, the size of debug symbol will be displayed after the Symbols Loaded Message for each module in the VScode modules view.{F12335461}

Reviewers: wallace, clayborg

Reviewed By: wallace, clayborg

Subscribers: cfe-commits, aprantl, lldb-commits

Tags: #lldb, #clang

Differential Revision: https://reviews.llvm.org/D83731
2020-07-24 13:26:06 -07:00
shafik 0db2934b0f [ASTImporter] Modify ImportDefiniton for ObjCInterfaceDecl so that we always the ImportDeclContext one we start the definition
Once we start the definition of an ObjCInterfaceDecl we won't attempt to ImportDeclContext
later on. Unlike RecordDecl case which uses DefinitionCompleter to force completeDefinition
we don't seem to have a similar mechanism for ObjCInterfaceDecl.

This fix was needed due to a bug we see in LLDB expression parsing where an initial expression
cause an ObjCInterfaceDecl to be defined and subsequent expressions during import do not call
ImportDeclContext and we can end up in a situation where ivars are imported out of order and not all ivars are imported.

Differential Revision: https://reviews.llvm.org/D83972
2020-07-24 13:15:08 -07:00
Jonas Devlieghere 0b339c0692 [lldb] Inform every language runtime of the modified modules
When a process is notified that modules got loaded, currently only
existing language runtimes are given a chance to deal with that. This
means that if the runtime for a given language wasn't needed before it
won't be informed of the module chance.

This is wrong because the module change might be what triggers the need
for a certain runtime. Instead, we should give the language runtime for
every supported language a chance to deal with the modified modules.

Differential revision: https://reviews.llvm.org/D84475
2020-07-24 12:10:45 -07:00
Adrian Prantl 58d84eb534 debugserver: Support ios simulator load command disambiguation in qProcessInfo
This patch basically moves the disambiguation code from a place where
it was complicated to implement straight to where the load command is
parsed, which has the neat side affect of actually supporting all call
sites!

rdar://problem/66011909

Differential Revision: https://reviews.llvm.org/D84480
2020-07-24 09:49:16 -07:00
Fred Riss 22c16360dd [lldb/ObjectFileMachO] Correctly account for resolver symbols
Summary:
The resolver addresses stored in the dyld trie are relative to the base
of the __TEXT segment. This is usually 0 in a dylib, so this was never
noticed, but it is not 0 for most dylibs integrated in the shared cache.
As we started using the shared cache images recently as symbol source,
this causes LLDB to fail to resolve symbols which go through a runtime
resolver.

Reviewers: jasonmolenda, jingham

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D84083
2020-07-24 09:19:17 -07:00
Petr Hosek 10b1b4a231 [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-07-23 23:05:36 -07:00
Petr Hosek 38c71b7c85 Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit 1d09ecf361 since
it breaks sanitizer bots.
2020-07-23 15:12:42 -07:00
Petr Hosek 1d09ecf361 [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-07-23 14:47:25 -07:00
Jonas Devlieghere cee60bbf41 [lldb] Remove the user-defined copy-ctor in ConstString
ConstString is essentially trivially copyable yet it has a user defined
copy constructor that copies its one member pointer. Remove it so it
qualifies as trivial in the eyes of the compiler.

This also fixes two unused variable warnings now that the compiler knows
that the constructor has no side-effects.

Differential revision: https://reviews.llvm.org/D84440
2020-07-23 13:09:08 -07:00
Raphael Isemann 4a3a821c68 [lldb] Make socket_packet_pump.py work in Python3
Summary:

The `string_escape` encoding used here was removed in Python 3 which makes the
test crash during tearDown:

```
  File "lldb/third_party/Python/module/unittest2/unittest2/case.py", line 386, in run
    self.tearDown()
  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py", line 124, in tearDown
    self._pump_queues.verify_queues_empty()
  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py", line 55, in verify_queues_empty
    _dump_queue(self.packet_queue())
  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py", line 28, in _dump_queue
    print(codecs.encode(the_queue.get(True), "string_escape"))
LookupError: unknown encoding: string_escape
```

Just replace it with `repr` which should work in both Python versions.

Reviewers: labath, JDevlieghere

Reviewed By: labath, JDevlieghere

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D84017
2020-07-23 18:36:50 +02:00
Raphael Isemann 77ae06b8c6 [lldb][NFC] Remove FormatMap
Summary:

FormattersContainer.h has two containers: FormatMap and FormattersContainer
itself. FormatMap is essentially just a SetVector with a listener interface that
is aspiring to be thread-safe as most of its functions lock its member mutex.

FormattersContainer is for the most part just calling the matching functions of
internal FormatMap instance and essentially acts as a wrapper class with some
minor formatter search functionality on top. The only difference is that the
FormattersContainer's public `Get` function is actually searching formatters in
the list of formatters (and for example doing regex-matching) while FormatMap's
`Get` function is just looking up a a format by the type matcher string.

This patch deletes `FormatMap` by just renaming it to `FormattersContainer` and
pulling in the two `Get` functions from the original `FormattersContainer`
class.

The only other user of `FormatMap` was the `NamedSummariesMap` in the
`FormatManager` which I migrated by just making it also a `FormattersContainer`
and replaced the only call to the `Get` function (which now has new semantics)
with `GetExact` (which is FormattersContainer's function that has the semantics
of FormatMap's `Get`). As `NamedSummariesMap` only stores non-regex-based
formatters, both `Get` and `GetExact` would have worked, so this was mostly to
clarify that this is supposed to be NFC.

I also added the missing mutex lock in the `GetCount` function which was
previously missing in the `FormatMap` implementation. Technically not "NFC" but
I anyway had to change the function...

Reviewers: labath, mib

Reviewed By: labath

Subscribers: abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D84296
2020-07-23 18:34:59 +02:00
Raphael Isemann 4d489e9f91 Reland [lldb] Unify type name matching in FormattersContainer II
This was originally reverted because the m_valid member in TypeMatcher was
unused in builds with disabled asserts. Now the member is gone and the default
constructor is deleted (thanks Eric for the idea!).

Summary:

FormattersContainer stores LLDB's formatters. It's implemented as a templated
map-like data structures that supports any kind of value type and only allows
ConstString and RegularExpression as the key types. The keys are used for
matching type names (e.g., the ConstString key `std::vector` matches the type
with the same name while RegularExpression keys match any type where the
RegularExpression instance matches).

The fact that a single FormattersContainer can only match either by string
comparison or regex matching (depending on the KeyType) causes us to always have
two FormatterContainer instances in all the formatting code. This also leads to
us having every type name matching logic in LLDB twice. For example,
TypeCategory has to implement every method twice (one string matching one, one
regex matching one).

This patch changes FormattersContainer to instead have a single `TypeMatcher`
key that wraps the logic for string-based and regex-based type matching and is
now the only possible KeyType for the FormattersContainer. This means that a
single FormattersContainer can now match types with both regex and string
comparison.

To summarize the changes in this patch:
* Remove all the `*_Impl` methods from `FormattersContainer`
* Instead call the FormatMap functions from `FormattersContainer` with a
  `TypeMatcher` type that does the respective matching.
* Replace `ConstString` with `TypeMatcher` in the few places that directly
  interact with `FormattersContainer`.

I'm working on some follow up patches that I split up because they deserve their
own review:

* Unify FormatMap and FormattersContainer (they are nearly identical now).
* Delete the duplicated half of all the type matching code that can now use one
  interface.
* Propagate TypeMatcher through all the formatter code interfaces instead of
  always offering two functions for everything.

There is one ugly design part that I couldn't get rid of yet and that is that we
have to support getting back the string used to construct a `TypeMatcher` later
on. The reason for this is that LLDB only supports referencing existing type
matchers by just typing their respective input string again (without even
supplying if it's a regex or not).

Reviewers: davide, mib

Reviewed By: mib

Subscribers: mgorny, JDevlieghere

Differential Revision: https://reviews.llvm.org/D84151
2020-07-23 18:17:42 +02:00
Jonas Devlieghere ccdb5b4bbe [lldb] Pass ConstString by value (again) (NFC)
This reverts "Eliminate unneeded value parameters in Utility" for
ConstString. As Pavel pointed out on the mailing list, the class *is*
trivially copyable.
2020-07-23 09:08:32 -07:00
Raphael Isemann 5477fbc294 [lldb] Make deleting frame recognizers actually work
Summary:

Frame recognizers are stored alongside a flag that indicates whether they were
deleted by the user. If the flag is set, they are supposed to be ignored by the
rest of the frame recognizer code. 'frame recognizer delete' is supposed to set
that flag. 'frame recognizer clear' however actually deletes all frame
recognizers (so, it doesn't set the flag but directly deletes them from the
list).

The current implementation of this concept is pretty broken. `frame recognizer
delete` sets the flag, but it somehow thinks that the recognizer id is an index
in the recognizer list. That's not true as it's actually just a member of each
recognizer entry. So it actually just sets the `deleted` flag for a random other
recognizer. The tests for the recognizer still pass as `frame recognizer list`
is also broken and just completely ignored the `deleted` flag and lists all
recognizers. Also `frame recognizer delete` just ignores if it can't actually
delete a recognizer if the id is invalid.

I think we can simplify this whole thing by just actually deleting recognizers
instead of making sure all code is actually respecting the `deleted` flag. I
assume the intention of this was to make sure that all recognizers are getting
unique ids over the course of an LLDB session, but as `clear` is actually
deleting them and we keep recycling ids, that didn't really work to begin with.

This patch deletes the `deleted` flag and just actually deletes the stored
recognizer. Also adds the missing error message in case it find a recognizer
with a given id.

Reviewers: mib

Reviewed By: mib

Subscribers: abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D84404
2020-07-23 17:43:37 +02:00
Xing GUO 92874d2866 [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.
This patch refactors `emitDebugInfo()` to make the length field be
inferred from its content. Besides, the `Visitor` class is removed in
this patch. The original `Visitor` class helps us determine an
appropriate length and emit the .debug_info section. These two
processes can be merged into one process. Besides, the length field
should be inferred when it's missing rather than when it's zero.

Reviewed By: jhenderson, labath

Differential Revision: https://reviews.llvm.org/D84008
2020-07-23 23:00:19 +08:00
Pavel Labath 9cdd68e7c1 Recommit "[lldb/API] Overwrite variables with SBLaunchInfo::SetEnvironment(append=true)"
The patch was reverted 27d52cd86a because of failures in
TestWeakSymbols.py. These have now been addressed in D83552.

The original commit message was:
This function was documented to overwrite entries with D76111, which was
adding a couple of similar functions. However, this function (unlike the
functions added in that patch) was/is not actually overwriting variables
-- any pre-existing variables would get ignored.

This behavior does not seem to be intentional. In fact, before the refactor in
D41359, this function could introduce duplicate entries, which could
have very surprising effects both inside lldb and on other applications
(some applications would take the first value, some the second one; in
lldb, attempting to unset a variable could make the second variable
become active, etc.).

Overwriting seems to be the most reasonable behavior here, so change the
code to match documentation.

Differential Revision: https://reviews.llvm.org/D83306
2020-07-23 14:17:57 +02:00
Med Ismail Bennani e605994bb3 [lldb/test] Fix TestHistoryRecall failure (NFC)
This patch fixes a test failure in TestHistoryRecall caused by the move
of the `history` subcommand to the `session` command.

This change was introduced by commit 85fbb08fa2.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-07-23 13:27:12 +02:00
Med Ismail Bennani 85fbb08fa2 [lldb/interpreter] Move the history subcommand to session (NFCI)
This patch moves the `history` subcommand from the `command` to `session`
command. I think it makes more sense to have it there because as the `command`
usage suggests, it should be used to manage custom LLDB commands.

However, `history` is essentially tied to a debugging session and holds
all the commands (not specifically custom ones).

This also makes it more discoverable by adding an alias for it (mimicking
the shell builtin).

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-07-23 13:05:45 +02:00
Eric Christopher 3a75466f41 Temporarily Revert "Reland [lldb] Unify type name matching in FormattersContainer"
as it breaks bots with due to m_valid being an unused class member
except in assert builds.

This reverts commit 074b121642.
2020-07-23 00:47:05 -07:00
Serge Pavlov dab898f9ab [Windows] Fix limit on command line size
This reapplies commit d4020ef7c4, reverted in ac0edc5588 because it
broke build of LLDB. This commit contains appropriate changes for LLDB.
The original commit message is below.

Documentation on CreateProcessW states that maximal size of command line
is 32767 characters including ternimation null character. In the
function llvm::sys::commandLineFitsWithinSystemLimits this limit was set
to 32768. As a result if command line was exactly 32768 characters long,
a response file was not created and CreateProcessW was called with
too long command line.

Differential Revision: https://reviews.llvm.org/D83772
2020-07-23 11:39:42 +07:00
Logan Smith 77e0e9e17d Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
add_compile_options is more sensitive to its location in the file than add_definitions--it only takes effect for sources that are added after it. This updated patch ensures that the add_compile_options is done before adding any source files that depend on it.

Using add_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 17:50:19 -07:00
Jonas Devlieghere 8acaceb14c [lldb] Fix LLDB_DEFAULT_TEST_ARCH for standalone builds
LLVM_TARGET_ARCH is not exported by LLVM so we can't use it from
standalone builds. Default to the architecture in LLVM_HOST_TRIPLE when
no LLDB_DEFAULT_TEST_ARCH was specified.
2020-07-22 17:04:42 -07:00
Logan Smith 97a0f80c46 Revert "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
This reverts commit 388c9fb1af.
2020-07-22 15:07:01 -07:00
Logan Smith 388c9fb1af Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories.
Using add_compile_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 14:19:34 -07:00
Jonas Devlieghere 0d5fc82245 [lldb] Eliminate unneeded value parameters in Utility (NFC)
Eliminates value parameter for types that are not trivially copyable.
2020-07-22 13:56:23 -07:00
David Blaikie fdb45f54b6 lldb fix for b198de67e0 (PCH/modular codegen refactor) 2020-07-22 13:12:00 -07:00
Jonas Devlieghere d2ec91845c [lldb] Use std::make_unique<DynamicRegisterInfo> (NFC) 2020-07-22 11:32:48 -07:00
Louis Dionne afa1afd410 [CMake] Bump CMake minimum version to 3.13.4
This upgrade should be friction-less because we've already been ensuring
that CMake >= 3.13.4 is used.

This is part of the effort discussed on llvm-dev here:

  http://lists.llvm.org/pipermail/llvm-dev/2020-April/140578.html

Differential Revision: https://reviews.llvm.org/D78648
2020-07-22 14:25:07 -04:00
Hans Wennborg 3eec657825 Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.
After lots of follow-up fixes, there are still problems, such as
-Wno-suggest-override getting passed to the Windows Resource Compiler
because it was added with add_definitions in the CMake file.

Rather than piling on another fix, let's revert so this can be re-landed
when there's a proper fix.

This reverts commit 21c0b4c1e8.
This reverts commit 81d68ad27b.
This reverts commit a361aa5249.
This reverts commit fa42b7cf29.
This reverts commit 955f87f947.
This reverts commit 8b16e45f66.
This reverts commit 308a127a38.
This reverts commit 274b6b0c7a.
This reverts commit 1c7037a2a5.
2020-07-22 20:23:58 +02:00
Adrian Prantl 6dbd4775bf Fix Windows build 2020-07-22 11:01:25 -07:00