Commit Graph

19606 Commits

Author SHA1 Message Date
Davide Italiano 8803124d23 [crashlog] Use loads() instead of readPlistFromString() for python 3.
<rdar://problem/50903413>

llvm-svn: 361087
2019-05-18 01:57:12 +00:00
Alex Langford 38cc896f00 Revert "Fix IPv6 support on lldb-server platform"
This reverts commit c28f81797084b8416ff5be4f9e79000a9741ca6a.
This reverts commit 7e79b64642486f510f7872174eb831df68d65b84.

Looks like there is more work to be done on this patch. I've spoken to
the author and for the time being we will revert to keep the buildbots
green.

llvm-svn: 361086
2019-05-18 01:09:44 +00:00
Alex Langford f9399de525 Unbreak windows build bot
Commit c28f81797084b8416ff5be4f9e79000a9741ca6a (svn r361079)
broke the windows buildbot. This should fix it.

llvm-svn: 361083
2019-05-18 00:09:43 +00:00
Jonas Devlieghere 2fc6b024b9 [CommandInterpreter] Refactor SourceInitFile
I was looking at the current implementation of SourceInitFile and there
were a few things that made this function hard to read:

 * The code to find the ~/.lldbinit file is duplicated across the cwd
   and non-cwd branch.
 * The ./.lldbinit is once computed by resolving .lldbinit and once by
   resolving ./.lldbinit.
 * It wasn't clear to me what happened when you're sourcing the
   .lldbinit file in the current working directory. Apparently we do
   nothing when we property to control that is set to warn (makes sense)
   and we don't care when the property is set to true (debatable).
 * There were at least two branches where the status of the
   CommandReturnObject were not set.

This patch attempts to simplify that code.

Differential revision: https://reviews.llvm.org/D61994

llvm-svn: 361080
2019-05-17 22:53:04 +00:00
Alex Langford d84d02e197 Fix IPv6 support on lldb-server platform
This is a general fix for the ConnectionFileDescriptor class but my main
motivation was to make lldb-server working with IPv6.
The connect URI can use square brackets ([]) to wrap the interface part
of the URI (e.g.: <scheme>://[<interface>]:<port>). For IPv6 addresses
this is a must since its ip can include colons and it will overlap with
the port colon otherwise. The URIParser class parses the square brackets
correctly but the ConnectionFileDescriptor doesn't generate them for
IPv6 addresses making it impossible to connect to the gdb server when
using this protocol.

How to reproduce the issue:

$ lldb-server p --server --listen [::1]:8080
...
$ lldb
(lldb) platform select remote-macosx
(lldb) platform connect connect://[::1]:8080
(lldb) platform process -p <pid>
error: unable to launch a GDB server on 'computer'

The server was actually launched we were just not able to connect to it.
With this fix lldb will correctly connect. I fixed this by wrapping the
ip portion with [].

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

Patch by António Afonso <antonio.afonso@gmail.com>

llvm-svn: 361079
2019-05-17 22:30:53 +00:00
Davide Italiano 53f68c5764 [EditLine] Check string pointers before dereferencing them.
Get*AtIndex() can return nullptr. This only happens in the swift
REPL support, so it's hard to test upstream.

<rdar://problem/50875178>

llvm-svn: 361078
2019-05-17 21:49:17 +00:00
Stefan Granitz fd0779181f [CMake] Add first CMake cache files
Summary:
CMake cache scripts pre-populate the CMakeCache in a build directory with commonly used settings.
The CMake invocation from D61952 could look like this:

```
cmake -G Ninja -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-osx.cmake -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;lldb" ../llvm-project/llvm
```

Options specified on the command line will override options in the cache files (as long as caches don't use `FORCE`).
What do you think? (This is a first proposal and not set in stone.)

Reviewers: xiaobai, compnerd, JDevlieghere, aprantl, labath

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 361069
2019-05-17 19:19:41 +00:00
Stefan Granitz dcc477e38c [CMake] Inline info plist in lldb driver
llvm-svn: 361068
2019-05-17 19:19:34 +00:00
Stella Stamenova 5bac706343 [CommandInterpreter] Fix trailing blanks after `all` or [0-9]+ for bt
The change that was committed for this used \\s to match spaces which does not work correctly on all platforms. Using [:space:] makes the test pass on both Linux and Windows

llvm-svn: 361064
2019-05-17 18:52:42 +00:00
Adrian Prantl 5d95b11b6b Update list of supported architectures.
llvm-svn: 361049
2019-05-17 17:05:23 +00:00
Jonas Devlieghere 777cad2c44 [Docs] Remove SVN checkout from LLDB build steps
This removes several older paragraphs in the LLDB build steps for Unix
systems which suggested checking out various components via SVN. Since
there's a separate page about getting the LLDB source which only
mentions Git, it seems appropriate to remove this older info from the
build docs.

Patch by: J. Ryan Stinnett

Differential revision: https://reviews.llvm.org/D62041

llvm-svn: 361046
2019-05-17 16:22:26 +00:00
Pavel Labath 62370dd0e0 minidump: Use MemoryList parsing code from llvm
llvm-svn: 361010
2019-05-17 09:47:34 +00:00
Pavel Labath ff9b4263f9 Make DWARFContext dwo-aware and port debug_info sections over
Summary:
The previous attempt and moving section handling over to DWARFContext
(D59611) failed because it did not take into account the dwo sections
correctly. All DWARFContexts (even those in SymbolFileDWARFDwo) used the
main module for loading the sections, but in the dwo scenario some
sections should come from the dwo file.

This patch fixes that by making the DWARFContext aware of whether it a
dwo context or a regular one. A dwo context gets two sections lists, and
it knows where to look for a particular type of a section. This isn't
fully consistent with how the llvm DWARFContext behaves, because that
one leaves it up to the user to know whether it should ask for a dwo
section or not. However, for the time being, it seems useful to have a
single entity which knows how to peice together the debug info in dwo
and non-dwo scenarios. The rough roadmap for the future is:
- port over the rest of the sections to DWARFContext
- find a way to get rid of SymbolFileDWARFDwo/Dwp/DwpDwo. This will
  likely involve adding the ability for the DWARFContext to spawn
  dwo sub-contexts, similarly to how it's done in llvm.
- get rid of the special handling of the "dwo" contexts by making
  sure everything knows whether it should ask for the .dwo version of
  the section or not (similarly to how llvm's DWARFUnits do that)

To demonstrate how the DWARFContext should behave in this new world, I
port the debug_info section (which is debug_info.dwo in the dwo file)
handling to DWARFContext. The rest of the sections will come in
subsequent patches.

Reviewers: aprantl, clayborg, JDevlieghere

Subscribers: zturner, lldb-commits

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

llvm-svn: 361000
2019-05-17 08:26:58 +00:00
Jonas Devlieghere 65cab8c639 [Docs] Fix headings in remote debugging
Add the proper headings instead of using just a bold font. Also add the
local ToC.

llvm-svn: 360971
2019-05-17 01:38:16 +00:00
Jonas Devlieghere 1e0ec81cf1 [Docs] Remove architectures from feature matrix
This is outdated, there's a bunch of architectures missing. If we want
them to be part of this table they should be a separate row anyway.

llvm-svn: 360967
2019-05-17 01:04:37 +00:00
Davide Italiano d768ee2140 [CommandInterpreter] Accept blanks after `all` or [0-9]+ for bt.
Previously "bt all    " would've failed as the regex didn't match
them.

Over the shoulder review by Jonas Devlieghere.

<rdar://problem/50824935>

llvm-svn: 360966
2019-05-17 01:03:21 +00:00
Jonas Devlieghere b5d7ad1d9a [Docs] Unify sidebar padding
Unify the padding across list items and the list header.

llvm-svn: 360964
2019-05-17 00:45:05 +00:00
Adrian Prantl 2b9a3ea13f Slightly update the macOS part of status.rst to be less out-of-date.
llvm-svn: 360956
2019-05-16 23:39:08 +00:00
Alex Langford d2284128a9 [Target] Stop linking against lldbPluginObjCLanguage
llvm-svn: 360945
2019-05-16 22:01:25 +00:00
Adrian Prantl de2cc01286 Factor out switch statement into a helper function (NFC)
This addresses post-commit review feedback for https://reviews.llvm.org/D62015.

llvm-svn: 360930
2019-05-16 20:03:05 +00:00
Adrian Prantl 431dd943a1 Make sure GetObjectDescription falls back to the Objective-C runtime.
This fixes an unintended regression introduced by
https://reviews.llvm.org/D61451 by making sure the Objective-C runtime
is also tried when the "correct" language runtime failed to return an
object description.

rdar://problem/50791055

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

llvm-svn: 360929
2019-05-16 19:21:31 +00:00
Jonas Devlieghere 3fdd4b74a6 [IRExecutionUnit] Remove static_assert
This doesn't make sense on platforms other than 64 bit.

llvm-svn: 360916
2019-05-16 16:54:41 +00:00
Pavel Labath 1a8630ac28 DWARFContext: Return empty data extractors instead of null pointers
Summary:
There are several reasons for doing this:
- generally, there's no reason to differentiate between a section being
  absent and it being present, but empty
- it matches more closely what llvm DWARF parser is doing (which also
  doesn't differentiate the two cases)
- SymbolFileDWARF also doesn't differentiate the two cases, which makes
  porting the rest of sections easier
- it fixes a bug in how the return-null-if-empty logic was implemented
  (it returned nullptr only the second time we tried to get the
  debug_aranges section), which meant that we hit an assert when trying
  to parse an empty-but-present section

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: zturner, lldb-commits

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

llvm-svn: 360874
2019-05-16 11:19:02 +00:00
Pavel Labath f4014e116e DWARF: Add ability to reference debug info coming from multiple sections
Summary:
This patch adds the ability to precisely address debug info in
situations when a single file can have more than one debug-info-bearing
sections (as is the case with type units in DWARF v4).

The changes here can be classified into roughly three categories:
- the code which addresses a debug info by offset gets an additional
  argument, which specifies the section one should look into.
- the DIERef class also gets an additional member variable specifying
  the section. This way, code dealing with DIERefs can know which
  section is the object referring to.
- the user_id_t encoding steals one bit from the dwarf_id field to store
  the section. This means the total number of separate object files
  (apple .o, or normal .dwo) is limited to 2 billion, but that is fine
  as it's not possible to hit that number without switching to DWARF64
  anyway.

This patch is functionally equivalent to (and inspired by) the two
patches (D61503 and D61504) by Jan Kratochvil, but there are differences
in the implementation:
- it uses an enum instead of a bool flag to differentiate the sections
- it increases the size of DIERef struct instead of reducing the amount
  of addressable debug info
- it sets up DWARFDebugInfo to store the units in a single vector
  instead of two. This sets us up for the future in which type units can
  also live in the debug_info section, and I believe it's cleaner
  because there's no need for unit index remapping

There are no tests with this patch as this is essentially NFC until
we start parsing type units from the debug_types section.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: arphaman, jankratochvil, lldb-commits

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

llvm-svn: 360872
2019-05-16 11:07:58 +00:00
Fangrui Song 2f677ab07b Simplify Triple::ppc64{,le} checks with Triple::isPPC64()
While here, update some ppc64le specific check to isPPC64(), if it
applies to big-endian as well, in the hope that it will ease the support
of big-endian if people are interested in this area. The big-endian
variant is used by at least FreeBSD, Gentoo Linux, Adélie Linux, and
Void Linux.

llvm-svn: 360868
2019-05-16 09:07:33 +00:00
Fangrui Song ddb93b637e Simplify ArchSpec::IsMIPS()
llvm-svn: 360865
2019-05-16 08:37:32 +00:00
Adrian Prantl 8b92bb359e Update LLDB license on the LLDB home page to Apache+LLVM.
llvm-svn: 360822
2019-05-15 21:58:43 +00:00
Adrian Prantl 0d11505c73 Get back the navigation sidebar on the LLDB website.
This returns the look & feel of the Sphinx-generated LLDB website to
the original pre-Sphinx layout.

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

llvm-svn: 360819
2019-05-15 21:49:00 +00:00
Michal Gorny 11b515ac0a [lldb] [test] Skip one more TestMiBreak on NetBSD
llvm-svn: 360800
2019-05-15 20:03:31 +00:00
Jan Kratochvil e8a039d62c Permit cross-CU references
So far dw_offset_t was global for the whole SymbolFileDWARF but with
.debug_types the same dw_offset_t may mean two different things depending on
its section (=CU). So references now return whole new referenced DWARFDIE
instead of just dw_offset_t.

This means that some functions have to now handle 16 bytes instead of 8 bytes
but I do not see that anywhere performance critical.

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

llvm-svn: 360795
2019-05-15 19:22:33 +00:00
Michal Gorny 9c7188a08a [lldb] [test] Mark frequently failing flaky tests skipped on NetBSD
llvm-svn: 360767
2019-05-15 12:13:20 +00:00
Fangrui Song 71a44224e5 Delete unnecessary copy ctors/copy assignment operators
It's the simplest and gives the cleanest semantics.

llvm-svn: 360762
2019-05-15 11:23:54 +00:00
Michal Gorny 9de9b5e950 [lldb] [lit] Pass --mode=compile to fix compiler-full-path.test
Pass '--mode=compile' to fix compiler-full-path.test failure on NetBSD
buildbot (apparently due to lack of 'link' executable).

Fixes r360355.  Acked by Pavel Labath.

llvm-svn: 360761
2019-05-15 10:48:55 +00:00
Gabor Marton 5ac6d49065 [ASTImporter] Use llvm::Expected and Error in the importer API
Summary:
This is the final phase of the refactoring towards using llvm::Expected
and llvm::Error in the ASTImporter API.
This involves the following:
- remove old Import functions which returned with a pointer,
- use the Import_New functions (which return with Err or Expected) everywhere
  and handle their return value
- rename Import_New functions to Import
This affects both Clang and LLDB.

Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits

Tags: #clang, #lldb

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

llvm-svn: 360760
2019-05-15 10:29:48 +00:00
Fangrui Song de1becfaa1 Group forward declarations in one namespace lldb_private {}
llvm-svn: 360757
2019-05-15 09:15:13 +00:00
Stefan Granitz a5588c4583 [CMake] Add error to clarify that lldb requires libcxx
Summary:
This adds a specific error message to clarify that lldb requires libcxx when
built together with clang on macOS. In addition, the lldb building docs are also
updated.

Fixes https://bugs.llvm.org/show_bug.cgi?id=41866

Reviewers: sgraenitz, JDevlieghere, EricWF

Reviewed By: sgraenitz

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 360756
2019-05-15 08:59:02 +00:00
Pavel Labath 041f40e5da DWARF: s/CompileUnit/Unit/ in DWARFFormValue
The class has been converted to use DWARFUnit, but a number of uses of
the words compile unit remained. This removes all such references
Get/SetCompileUnit becomes Get/SetUnit, and m_cu becomes m_unit.

llvm-svn: 360754
2019-05-15 07:45:40 +00:00
Jonas Devlieghere 4c1d6ee83d Replace assert with static_assert here applicable.
Replaces assert() with static_assert() if the condition is can be
evaluated at compile time.

llvm-svn: 360753
2019-05-15 05:39:41 +00:00
Jonas Devlieghere c18740976e Mark private unimplemented functions as deleted
Applies modernize-use-equals-delete to the LLDB code base and removes
the now redundant comments.

llvm-svn: 360751
2019-05-15 05:31:14 +00:00
Jonas Devlieghere c31a45e62a [Docs] Document lldb-dotest
Document the lldb-dotest binary.

llvm-svn: 360748
2019-05-15 04:42:30 +00:00
Saleem Abdulrasool a23cc727d8 Revert "build: use the correct variable"
This reverts commit b5a8abd57f23e2f621d5ceb0f64f1bb8f9579c3f.  This
should not be needed as the lldb-server tool will add
`LLDB_CAN_USE_LLDB_SERVER` which will never be set to true on Windows.

llvm-svn: 360745
2019-05-15 03:57:07 +00:00
Michal Gorny 3bdbd97d67 [lldb] [lit] Fix whitespace in matches for remaining AVX512 tests
llvm-svn: 360744
2019-05-15 03:32:47 +00:00
Alex Langford bd3adfe5e3 [Target] Generalize some behavior in Thread
Summary:
I don't think there's a good reason for this behavior to be considered
ObjC-specific. We can generalize this.

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

llvm-svn: 360741
2019-05-15 01:46:45 +00:00
Jim Ingham 7d7b788fb1 Make SBDebugger.RunCommandInterpreter callable from Python.
Authored by: Lukas Boger

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

llvm-svn: 360730
2019-05-15 00:08:55 +00:00
Davide Italiano 092f85a594 [lit/Register] Fix matching of the output.
llvm-svn: 360725
2019-05-14 23:17:12 +00:00
Saleem Abdulrasool 1acec2b639 build: use the correct variable
Adjust the variable that controls whether the unit tests use `lldb-server`.
This should repair the default build on Windows.

llvm-svn: 360695
2019-05-14 17:24:45 +00:00
Saleem Abdulrasool 1362905e8c lldb-server: rename `llgs::terminate` (NFC)
`terminate` overlaps with a C function on Windows:

```
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,13):  warning: 'terminate' redeclared without 'dllimport' attribute: 'dllexport' attribute added [-Winconsistent-dllimport]
static void terminate() { g_debugger_lifetime->Terminate(); }
            ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt_terminate.h(29,48):  note: previous declaration is here
    _ACRTIMP __declspec(noreturn) void __cdecl terminate() throw();
                                               ^
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,61):  warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
static void terminate() { g_debugger_lifetime->Terminate(); }
                                                            ^
```

Rename the function to `terminate_debugger` to avoid the errant match.

llvm-svn: 360693
2019-05-14 17:07:36 +00:00
Adrian Prantl 19ae9d010d Rename MacOS X -> macOS where applicable.
llvm-svn: 360691
2019-05-14 16:37:43 +00:00
Pavel Labath 62f5b591f4 DWARF/NFC: Centralize DIERef conversions
apple and manual indexing code were creating a DIERef in a bunch of
places. Though the code itself is not much, it is also easy to simplify
by factoring out the DIERef creation. In HashedNameToDIE I create a
conversion operator from DIEInfo to DIERef, and in ManualDWARFIndex I
just create the DIERef in a global variable up-front.

This also reduces the diff in follow-up patches which change how DIERefs
are constructed.

llvm-svn: 360669
2019-05-14 12:44:40 +00:00
Pavel Labath b1f213cfdc TestMinidumpNew.py: Use yaml2obj where possible
Replace checked-in minidumps with their yaml forms now that yaml2obj
supports the ThreadList stream. I delete the test_modules_in_mini_dump
test altogether as this functionality is covered more systematically in
TestMinidumpUUID.py.

llvm-svn: 360655
2019-05-14 08:59:08 +00:00
Fangrui Song efe8e7e36d typedef enum -> enum
Reviewed By: labath

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

llvm-svn: 360654
2019-05-14 08:55:50 +00:00
Pavel Labath 56f9afaf6b [CMake] Correctly reinstate LLDB_CAN_USE_LLDB_SERVER
r360631 introduced a "syntax error" which meant that cmake was still not
honoring the value of LLDB_CAN_USE_LLDB_SERVER variable. The correct
syntax for seting an internal cache variable is "set(VAR value CACHE
INTERNAL)", but the patch omitted the "CACHE" keyword. The "syntax
error" is in quotes because without the CACHE keyword this is still
valid syntax for setting the value of LLDB_CAN_USE_LLDB_SERVER to "1
INTERNAL".

There doesn't seem to be a need for this to be a cache variable so I'm
reverting this variable to a plain one, as it was before r360621.

This will hopefully fix the windows build.

llvm-svn: 360652
2019-05-14 08:18:06 +00:00
Fangrui Song 6c780b62f0 ARMDefines.h: fix -Wimplicit-fallthrough in -DLLVM_ENABLE_ASSERTIONS=OFF builds
Reviewed By: JDevlieghere

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

llvm-svn: 360646
2019-05-14 04:09:52 +00:00
Adrian Prantl 39084ce3ce LLDB website: Change the title back to "The LLDB Debugger"
This is what the old homepage also used.

llvm-svn: 360641
2019-05-14 02:31:56 +00:00
Jonas Devlieghere a2ad769226 [Docs] Differentiate between public and private API
On the homepage we should have a clear distinction between the public
and private C++ APIs.

llvm-svn: 360638
2019-05-14 00:36:05 +00:00
Jonas Devlieghere 42d65c572b [Docs] Fix code formattign in variable.rst
Fixes missing newline between :: and the actual code.

llvm-svn: 360632
2019-05-13 23:05:51 +00:00
Jonas Devlieghere 1d8b2a0661 [CMake] Reinstate LLDB_CAN_USE_LLDB_SERVER
We cannot manipulate the LLDB_TOOL_LLDB_SERVER_BUILD directly from
LLDBConfig.cmake because this would set the variable before the option
is defined in AddLLVM.cmake. Instead, we need to use the
LLDB_CAN_USE_LLDB_SERVER variable to conditionally add the lldb-server
subdirectory. This should ensure the variable doesn't get cleared.

llvm-svn: 360631
2019-05-13 22:55:11 +00:00
Jonas Devlieghere b40284dfb0 Disable TestEnvironment on Windows
The input source file seems to be triggering an error in the Visual
Studio headers.

> xstddef:338:2: error: ''auto' return without trailing return type;
> deduced return types are a C++14 extension

I tried converting the test to use the %build stuff Zachary added, but
that seems to be missing some Darwin support. Disabling the test on
Windows in the meantime.

llvm-svn: 360624
2019-05-13 22:02:09 +00:00
Jonas Devlieghere aeeeb37e37 [CMake] Simplify lldb-server handling
We can piggyback off the existing add_lldb_tool_subdirectory to decide
whether or not lldb-server should be built.

Differential revision: https://reviews.llvm.org/D61872

llvm-svn: 360621
2019-05-13 21:25:02 +00:00
Jonas Devlieghere ae54fc9f04 Merge target and launch info environments
Before this change we were overriding the launch info environment with
the target environment. This meant that the environment variables passed
to `process launch --environment <>` were lost. Instead of replacing the
environment, we should merge them.

Differential revision: https://reviews.llvm.org/D61864

llvm-svn: 360612
2019-05-13 19:17:48 +00:00
Jonas Devlieghere 6c86f7d75e Remove commented-out code
llvm-svn: 360611
2019-05-13 19:17:44 +00:00
Shafik Yaghmour 9acacebf83 [DataFormatters] FindLibCppStdFunctionCallableInfo() currently uses FindFunctions() in order to find a lambdas operator()() but using FindSymbolsMatchingRegExAndType() is cheaper and if we also anchor the regex using ^ this adds some additional performance gains.
Differential Revision: https://reviews.llvm.org/D61759

llvm-svn: 360599
2019-05-13 16:48:06 +00:00
Aleksandr Urakov 7f5318c892 [NativePDB] Fix tests after r360569
llvm-svn: 360587
2019-05-13 15:06:13 +00:00
Pavel Labath b1e28d9b6a DWARF/DIERef: remove non-const operator<
It serves no purpose as one can always invoke the const version instead.

llvm-svn: 360583
2019-05-13 13:52:40 +00:00
Pavel Labath 9cba2c9650 Add REQUIRES: windows to NativePDB/stack_unwinding01.cpp
The test runs the compiled executable. As such, it can only work on
windows hosts.

llvm-svn: 360576
2019-05-13 11:32:52 +00:00
Pavel Labath 1211baa51c Breakpad: Generate unwind plans from STACK CFI records
Summary:
This patch implements the GetUnwindPlan interface (added in the previous
patch) for SymbolFileBreakpad, and uses it to generate unwind plans from
STACK CFI records in breakpad files.

We first perform a light-weight parse of the breakpad in order to build
up a map of regions covered by the unwind info so that we can later jump
to the right record when we need to unwind a specific function.

The actual parsing is relatively straight-forward, as the STACK CFI records
are just another (text) form of the eh_frame unwind instructions, and
the same goes for lldb's UnwindPlans. The newly-introduced
PostfixExpression API is used to convert the breakpad postfix
expressions into DWARF. The generated dwarf expressions are stored in a
BumpPtrAllocator, as the UnwindPlan does not take ownership of the
expression data it references (usually this is static data in an object
file, so special ownership is needed).

At this moment the generated unwind plans aren't used in the actual
unwind machinery (only in the image show-unwind command), but that is
coming in a separate patch.

Reviewers: amccarth, clayborg, markmentovai

Subscribers: aprantl, jasonmolenda, lldb-commits

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

llvm-svn: 360574
2019-05-13 11:25:35 +00:00
Stefan Granitz 7e8be135cf Fix flakiness in lldb lit test
Messages "breakpoint locations added" and "process stopped" may come out of order.

Differential Revision: https://reviews.llvm.org/D61611#anchor-1499662

llvm-svn: 360571
2019-05-13 09:48:26 +00:00
Aleksandr Urakov 869f934d19 [NativePDB] Support member function types in PdbAstBuilder
Summary:
    This patch implements missing case in PdbAstBuilder::CreateType for
    LF_MFUNCTION. This is necessary, for example, in stack unwinding of struct
    methods.

    Reviewers: amccarth, aleksandr.urakov

    Reviewed By: amccarth

    Subscribers: abidh, teemperor, lldb-commits, leonid.mashinskiy

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

llvm-svn: 360569
2019-05-13 09:41:57 +00:00
Pavel Labath 0fab8b65de minidump: Use yaml instead of checked-in binaries for ThreadList tests
yaml2obj now supports the ThreadList stream.

llvm-svn: 360568
2019-05-13 09:35:00 +00:00
Pavel Labath 381ba9aedc [DWARF] Use sequential integers for the IDs of the SymbolFileDWOs
Summary:
Instead of using the offset of the contained compile unit, we use it's
ID. The goal of this change is two-fold:
- free up space in the user_id_t representation to enable storing the
  debug-info-carrying section (debug_types/debug_info) without
  decreasing the amount of debug info we can address (as would be the
  case with D61503).
- be a step towards supporting DWO files containing more than one unit
  (important for debug_types+dwo, but can also happen with regular
  dwo+lto). For this part to fully work we'd still need to add a way to
  lookup the SymbolFileDWO without going through GetCompileUnitAtIndex,
  but making sure things don't accidentally work because the SymbolFile
  ID is the same as compile unit offset is a step towards that.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: mehdi_amini, dexonsmith, tberghammer, jankratochvil, lldb-commits

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

llvm-svn: 360565
2019-05-13 08:58:34 +00:00
Pavel Labath 33fdaed491 @skipIfLinux flaky lldb-mi tests
llvm-svn: 360564
2019-05-13 08:48:03 +00:00
Fangrui Song 1effa6c665 Remove declaratons of deleted structs/classes
llvm-svn: 360562
2019-05-13 08:25:53 +00:00
Fangrui Song 89b35d9ccd [CMake] Add lli to LLDB_TEST_DEPS
lli is used by lit/Breakpoint/jitbp_elf.test
I had a test failure when running check-lldb-lit because my lli was stale.

llvm-svn: 360557
2019-05-13 05:05:46 +00:00
Fangrui Song b0e54cbcdf Fix file names in file headers. NFC
llvm-svn: 360554
2019-05-13 04:42:32 +00:00
Alex Langford 58a638b79f [Breakpoint] Make breakpoint language agnostic
Summary:
Breakpoint shouldn't need to depend on any specific details from a
programming language. Currently the only language-specific detail it takes
advantage of are the different qualified names an objective-c method name might
have when adding a name lookup. This is reasonably generalizable.

The current method name I introduced is "GetVariantMethodNames", which I'm not
particularly tied to. If you have a better suggestion, please do let me know.

Reviewers: JDevlieghere, jingham, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 360509
2019-05-11 03:32:25 +00:00
Jason Molenda abcb1215c9 Change the disabling of packet logging to be in TearDownHook lambdas.
llvm-svn: 360482
2019-05-10 23:22:15 +00:00
Jason Molenda 18ba8947a6 Ted pointed out that some of test tests that are enabling packet
logging when the testsuite is run with trace mode enabled are leaving
the logging enabled after the tests have finished.  That state
isn't cleared in a --no-multiprocess testsuite run.

llvm-svn: 360480
2019-05-10 23:03:05 +00:00
Jan Kratochvil 605627374e Finish renaming CompileUnit -> Unit
D42892 changed a lot of code to use superclass DWARFUnit instead of its
subclass DWARFCompileUnit.

Finish this change more thoroughly for any *CompileUnit* -> *Unit* names.
Later patch will introduce DWARFTypeUnit which needs to be sometimes different
from DWARFCompileUnit and it would be confusing without this renaming.

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

llvm-svn: 360443
2019-05-10 17:14:37 +00:00
Pavel Labath 78c1dcb7b7 minidump: Don't eagerly resolve module paths read from the minidump
This can cause us to return paths to files on the local filesystem even
if we don't end up using that file (for instance because the file is not
a real module).

llvm-svn: 360432
2019-05-10 15:05:26 +00:00
Michal Gorny 8d15f9913b [lldb] [lit] Fix clobbers in x86_64 register test
llvm-svn: 360423
2019-05-10 13:12:36 +00:00
Pavel Labath 6d40c29a7e Minidump: use ThreadList parsing code from llvm/Object
llvm-svn: 360412
2019-05-10 09:36:11 +00:00
Pavel Labath 22bbd7d690 FuncUnwinders: Add a new "SymbolFile" unwind plan
Summary:
some unwind formats are specific to a single symbol file and so it does
not make sense for their parsing code live in the general Symbol library
(as is the case with eh_frame for instance). This is the case for the
unwind information in breakpad files, but the same will probably be true
for PDB unwind info (once we are able to parse that).

This patch adds the ability to fetch an unwind plan provided by a symbol
file plugin, as discussed in the RFC at
<http://lists.llvm.org/pipermail/lldb-dev/2019-February/014703.html>.
I've kept the set of changes to a minimum, as there is no way to test
them until we have a symbol file which implements this API -- that is
comming in a follow-up patch, which will also implicitly test this
change.

The interesting part here is the introduction of the
"RegisterInfoResolver" interface. The reason for this is that breakpad
needs to be able to resolve register names (which are present as strings
in the file) into register enums so that it can construct the unwind
plan. This is normally done via the RegisterContext class, handing this
over to the SymbolFile plugin would mean that it has full access to the
debugged process, which is not something we want it to have. So instead,
I create a facade, which only provides the ability to query register
names, and hide the RegisterContext behind the facade.

Also note that this only adds the ability to dump the unwind plan
created by the symbol file plugin -- the plan is not used for unwinding
yet -- this will be added in a third patch, which will add additional
tests which makes sure the unwinding works as a whole.

Reviewers: jasonmolenda, clayborg

Subscribers: markmentovai, amccarth, lldb-commits

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

llvm-svn: 360409
2019-05-10 07:54:37 +00:00
Pavel Labath 21929d49d5 Revert "Disable the step over skipping calls feature since buildbots are not happy."
While this fixed the windows bot failures, it also broke all other bots.

Upon closer inspection, it turns out that the windows bots were "broken"
because two tests were unexpectedly passing -- i.e., the original patch
(r360375) actually improved our stepping support on windows.

So instead, I remove the relevant XFAILs.

This reverts commit r360397.

llvm-svn: 360407
2019-05-10 06:57:25 +00:00
Jonas Devlieghere 2f67cbb62c [Docs] Fix table formatting in Pytho reference
llvm-svn: 360398
2019-05-10 00:23:02 +00:00
Greg Clayton 23a7971ddf Disable the step over skipping calls feature since buildbots are not happy.
llvm-svn: 360397
2019-05-10 00:13:03 +00:00
Jonas Devlieghere 7b844849fe [Docs] Port python reference page
I somehow forgot to port over this page from the old website. Thank you
Jim for the heads up!

llvm-svn: 360386
2019-05-09 22:14:14 +00:00
Greg Clayton df225764b7 Improve step over performance by not stopping at branches that are function calls and stepping into and them out of each one
Currently when we single step over a source line, we run and stop at every branch in the source line range. We can reduce the number of times we stop when stepping over by figuring out if any of these branches are function calls, and if so, ignore these branches. Since we are stepping over we can safely ignore these calls since they will return to the next instruction. Currently the step logic would stop at those branches (1st stop), single step into the branch (2nd stop), and then set a breakpoint at the return address (3rd stop), and then continue.

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

llvm-svn: 360375
2019-05-09 20:39:34 +00:00
Stella Stamenova dde1d9a6b7 Fix TestVSCode_attach on Linux
The test is failing sometimes because the debugger is failing to attach for lack of permissions. The fix is to call lldb_enable_attach inside the inferior main function

llvm-svn: 360371
2019-05-09 19:49:26 +00:00
Stella Stamenova bc9e086693 Use UNSUPPORTED: system-windows instead of REQUIRES: nowindows or UNSUPPORTED: windows. nowindows is not currently defined and windows does not cover all cases. system-windows is also consistent with how other platforms are used.
llvm-svn: 360368
2019-05-09 19:40:21 +00:00
Jorge Gorbe Moya adf427b82d [lldb] build.py: fix behavior when passing --compiler=/path/to/compiler
All the other paths in the find_toolchain function return a tuple
(detected_toolchain_type, compiler_path), but when the parameter to
--compiler is not one of the predefined names it only returns the
detected toolchain type, which causes an error when trying to unpack the
result.

This patch changes it to return also the compiler path passed as a
parameter.

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

llvm-svn: 360355
2019-05-09 16:47:07 +00:00
Stefan Granitz f0ee69f75d [JITLoaderGDB] Set eTypeJIT for objects read from JIT descriptors
Summary:
First part of a fix for JITed code debugging. This has been a regression from 5.0 to 6.0 and it's is still reproducible on current master: https://bugs.llvm.org/show_bug.cgi?id=36209

The address of the breakpoint site is corrupt: the 0x4 value we end up with, looks like an offset on a zero base address. When we parse the ELF section headers from the JIT descriptor, the load address for the text section we find in `header.sh_addr` is correct.

The bug manifests in `VMAddressProvider::GetVMRange(const ELFSectionHeader &)` (follow it from `ObjectFileELF::CreateSections()`). Here we think the object type was `eTypeObjectFile` and unleash some extra logic [1] which essentially overwrites the address with a zero value.

The object type is deduced from the ELF header's `e_type` in `ObjectFileELF::CalculateType()`. It never returns `eTypeJIT`, because the ELF header has no representation for it [2]. Instead the in-memory ELF object states `ET_REL`, which leads to `eTypeObjectFile`. This is what we get from `lli` at least since 3.x. (Might it be better to write `ET_EXEC` on the JIT side instead? In fact, relocations were already applied at this point, so "Relocatable" is not quite exact.)

So, this patch proposes to set `eTypeJIT` explicitly whenever we read from a JIT descriptor. In `ObjectFileELF::CreateSections()` we can then call `GetType()`, which returns the explicit value or otherwise falls back to `CalculateType()`.

LLDB then sets the breakpoint successfully. Next step: debug info.
```
Process 1056 stopped
* thread #1, name = 'lli', stop reason = breakpoint 1.2
    frame #0: 0x00007ffff7ff7000 JIT(0x3ba2030)`jitbp()
JIT(0x3ba2030)`jitbp:
->  0x7ffff7ff7000 <+0>:  pushq  %rbp
    0x7ffff7ff7001 <+1>:  movq   %rsp, %rbp
    0x7ffff7ff7004 <+4>:  movabsq $0x7ffff7ff6000, %rdi     ; imm = 0x7FFFF7FF6000
    0x7ffff7ff700e <+14>: movabsq $0x7ffff6697e80, %rcx     ; imm = 0x7FFFF6697E80
```

[1] It was first introduced with https://reviews.llvm.org/D38142#change-lF6csxV8HdlL, which has also been the original breaking change. The code has changed a lot since then.

[2] ELF object types: https://github.com/llvm/llvm-project/blob/2d2277f5/llvm/include/llvm/BinaryFormat/ELF.h#L110

Reviewers: labath, JDevlieghere, bkoropoff, clayborg, espindola, alexshap, stella.stamenova

Reviewed By: labath, clayborg

Subscribers: probinson, emaste, aprantl, arichardson, MaskRay, AlexDenisov, yurydelendik, lldb-commits

Tags: #lldb

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

llvm-svn: 360354
2019-05-09 16:40:57 +00:00
Richard Smith 36851a66c8 Fix up lldb after clang r360311.
Patch by Tyker!

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

llvm-svn: 360312
2019-05-09 04:40:57 +00:00
Jim Ingham 2dda1269ab Fix the output file dependency for Options.inc.
The script phase to do Options.td -> Options.inc was
wrong (missing the "include" directory) so the rule didn't
get run when Options.td changed.

llvm-svn: 360304
2019-05-09 01:43:27 +00:00
Jonas Devlieghere fad8fb8032 [Reproducers] Fix reproducer unittest
I think the recent change to flush the SB API recording uncovered a real
issue on the Windows bot. Although I couldn't make much sense of the
error message "unknown file: error: SEH exception with code 0x3221225477
thrown in the test body.", it prompted me to look at the test. In the
unit test we were recording during replay, which is obviously not
correct. I think we didn't see this issue before because we flushed once
after the recording was done. This patch unsets the recording  logic
during the replay part of the test.

Hopefully this fixed the Windows bot.

llvm-svn: 360298
2019-05-08 22:59:35 +00:00
Greg Clayton 5f8e88cd69 Fix bug in ArchSpec::MergeFrom
Previous ArchSpec tests didn't catch this bug since we never tested just the OS being out of date. Fixed the bug and covered this with a test that would catch this.

This was found when trying to load a core file where the core file was an ELF file with just the e_machine for architeture and where the ELF header had no OS set in the OSABI field of the e_ident. It wasn't merging the architecture with the target architecture correctly.

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

llvm-svn: 360292
2019-05-08 22:03:22 +00:00
Jonas Devlieghere a1d0efa2e3 [Reproducers] Flush files to disk periodically
Periodically flush some of the data to disk. Although not perfect, this
helps when the debugger crashes.

llvm-svn: 360286
2019-05-08 21:07:19 +00:00
Jonas Devlieghere da2a317644 [Reproducers] Fix unitialized pointer
The FileCollector pointer in the FileSystem class wasn't initialized to
nullptr during replay.

llvm-svn: 360285
2019-05-08 21:07:15 +00:00
Jonas Devlieghere 9f15718b3d [Docs] list command: lldb run <args>
The run command is only an abbreviation for the more verbose process
launch -- <args> but it works just as with GDB and therefore should be
mentioned in the GDB to LLDB command map.

For educational purposes I've not listed it as the first option on the
LLDB side so that new LLDB user can, if they want, also know what the
"native" way is for LLDB.

Here's the help documentation for the run command in lldb which gives
proof:

> (lldb) help run
>      Launch the executable in the debugger.
>
> Syntax: run [<run-args>]
>
> Command Options Usage:
>   run [<run-args>]
>
> 'run' is an abbreviation for 'process launch -c /bin/sh --'

Patch by: Konrad Kleine

Differential revision: https://reviews.llvm.org/D61483

llvm-svn: 360269
2019-05-08 16:31:47 +00:00
Pavel Labath 2841e6edc8 [DWARF] Centralize user_id <-> DWARFDIE conversions
Summary:
The logic for translating a user_id into a DWARFDIE was replicated in
several places. This removes that redundancy and settles on a single
implementation in SymbolFileDWARF.

The reason for choosing that instead of DIERef was that we were
always immediately converting the returned DIERef into a DWARFDIE
anyway, which meant that one had to specify the SymbolFileDWARF argument
twice (once to get the DIERef, and once to get the actual DIE). Also,
passing a higher-level object (SymbolFileDWARF) into a lower-level one
(DIERef) seemed like a less intuitive arrangement than doing things the
other way around.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: tberghammer, jankratochvil, lldb-commits

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

llvm-svn: 360246
2019-05-08 11:43:05 +00:00
Jonas Devlieghere 46d318c2b5 [Docs] Fix incorrect heading and update titles.
This patch fixes two incorrect headings in source.rst which caused it to
show up on the homepage. I also updated the titles to have more sensible
links there.

llvm-svn: 360219
2019-05-08 01:51:26 +00:00
Jonas Devlieghere da9a274a60 [Docs] Re-order homepage: Download -> Build -> Test
I also reformatted some paragraphs to 80 cols.

llvm-svn: 360218
2019-05-08 01:38:12 +00:00
Jonas Devlieghere c0b48ab631 Propagate command interpreter errors from lldlbinit
This patch ensures that we propagate errors coming from the lldbinit
file trough the command/script interpreter. Before, if you did something
like command script import syntax_error.py, and the python file
contained a syntax error, lldb wouldn't tell you about it. This changes
with the current patch: errors are now propagated by default.

PS: Jim authored this change and I added testing.

Differential revision: https://reviews.llvm.org/D61579

llvm-svn: 360216
2019-05-08 01:23:47 +00:00
Jonas Devlieghere f496ee1f7e [Docs] Add timestamp
llvm-svn: 360209
2019-05-07 23:14:06 +00:00
Alex Langford 8b6071f561 [Expression] Remove unused dependency
lldbExpression was linking against lldbPluginExpressionParserClang, and
lldbPluginExpressionParserClang was linking against lldbExpression.
There's no reason lldbExpression should need anything from
lldbPluginExpressionParserClang, so let's remove that dependency.

llvm-svn: 360208
2019-05-07 23:11:05 +00:00
Alex Langford b2fa002c83 [Core] Remove unused dependencies
llvm-svn: 360193
2019-05-07 21:34:44 +00:00
Pavel Labath f3e81aee0b Disable eh-frame-dwarf-unwind.test on windows
It fails on the windows bot. Disable until I can figure out what's the
reason.

llvm-svn: 360182
2019-05-07 19:24:28 +00:00
Alex Langford fb381607f0 [Host] Clean up dependencies of HostMacOSXObjCXX
llvm-svn: 360178
2019-05-07 18:08:06 +00:00
Jonas Devlieghere 7ffd963834 [Driver] Add command line option to allow loading local lldbinit file.
This patch adds a command line flag that allows lldb to load local
lldbinit files.

Differential revision: https://reviews.llvm.org/D61578

llvm-svn: 360172
2019-05-07 16:57:17 +00:00
Pavel Labath 7ff0c0ddd3 Fixup r360161
Remove SymbolVendorMacOSX from the test, as this plugin is not available
on non-mac platforms, and it does not seem to be necessary anyway.

Declare inlined-functions.yaml as an input of the test in cmake.

llvm-svn: 360169
2019-05-07 16:13:10 +00:00
Pavel Labath fe71b92e0a Make eh-frame-dwarf-unwind.test run on non-linux platforms
This was meant to be a part of r360158, but I forgot to squash the
commits before pushing.

llvm-svn: 360168
2019-05-07 16:13:05 +00:00
Pavel Labath 0ff89dacaf PostfixExpression: Use signed integers in IntegerNode
Summary:
This is necessary to support parsing expressions like ".cfa -16 + ^", as
that format is used in breakpad STACK CFI expressions.

Since the PDB expressions use the same parser, this change will affect
them too, but I don't believe that should be a problem in practice. If
PDBs do contain the negative values, it's very likely that they are
intended to be parsed the same way, and if they don't, then it doesn't
matter.

In case that we do ever need to handle this differently, we can always
make the parser behavior customizable, or just use a different parser.

To make sure that the integer size is big enough for everyone, I switch
from using a (unsigned) 32-bit integer to a 64-bit (signed) one.

Reviewers: amccarth, clayborg, aleksandr.urakov

Subscribers: markmentovai, lldb-commits

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

llvm-svn: 360166
2019-05-07 15:58:20 +00:00
Greg Clayton eeed7ee2cc Added missing files from 360071.
llvm-svn: 360161
2019-05-07 15:37:28 +00:00
Pavel Labath 95e72765c1 RegisterContextLLDB: Push CFA value on DWARF stack when evaluating register expressions
Summary:
This behavior is specified in the Section 6.4.2.3 (Register Rule
instructions) of the DWARF4 spec. We were not doing that, which meant
that any register rule which was relying on the cfa value being there
was not evaluated correctly (it was aborted due to "out of bounds"
access).

I'm not sure how come this wasn't noticed before, but I guess this has
something to do with the fact that dwarf unwind expressions are not used
very often, and when they are, the situation is so complicated that the
CFA is of no use. I noticed this when I started emitting dwarf
expressions for the unwind information present in breakpad symbol files.

Reviewers: jasonmolenda, clayborg

Subscribers: aprantl, lldb-commits

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

llvm-svn: 360158
2019-05-07 15:27:35 +00:00
Michal Gorny 96a8241084 [lldb] [lit] Update constants in write Register tests
Update the constants used for XMM/YMM/ZMM registers to match read tests.

llvm-svn: 360154
2019-05-07 14:35:59 +00:00
Michal Gorny 25f6462976 [lldb] [lit] Fix Register tests to reference arrays via %0 and %1
Fix Register tests to reference memory access to arrays via %0 and %1,
rather than via referencing %rax and %rbx directly.  This fixes test
build failures on 32-bit x86.

llvm-svn: 360148
2019-05-07 14:02:11 +00:00
Krasimir Georgiev 435e76a558 [lldb] Add MacroQualified switch cases for r360109
Summary:
r360109 added a new enum case, causing lldb build to fail with several errors like:
lldb/source/Symbol/ClangASTContext.cpp:4342:11: error: enumeration value 'MacroQualified' not handled in switch [-Werror,-Wswitch]
  switch (qual_type->getTypeClass()) {
          ^
This adds the missing switch cases.
I'm not an lldb maintainer and just used my best judgement that it's probably expected that we break in these cases. Feel free to ping / revert / fix this change if this behavior is not appropriate.

Reviewers: gribozavr

Reviewed By: gribozavr

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

llvm-svn: 360146
2019-05-07 13:59:30 +00:00
Alex Langford 6bc219e6bf [Breakpoint] Remove unused dependency
The CPlusPlus Language plugin is unused in lldbBreakpoint. We should just remove
it.

A great follow up to this change would be to remove the dependency on the ObjC
language plugin, but that is actually used and requires some refactoring.

llvm-svn: 360105
2019-05-07 01:03:40 +00:00
Jonas Devlieghere 214de0f8ee [Docs] Add remote.html redirect
Add a redirect for the old remote.html page and sort the pages to make
dding redirects easier in the future.

llvm-svn: 360083
2019-05-06 21:28:01 +00:00
Jonas Devlieghere 60b240edb4 [CMake] Remove lldbPluginSymbolVendorMacOSX to fix CMake build
This should fix check-lldb-unit on the bots.

llvm-svn: 360079
2019-05-06 21:17:50 +00:00
Jonas Devlieghere 0e971965ec [CMake] Remove inlined-functions.yaml
llvm-svn: 360078
2019-05-06 21:02:03 +00:00
Jonas Devlieghere 2edcad7b59 [Driver] Change the way we deal with local lldbinit files.
Currently we have special handling for local lldbinit files in the
driver. At the same time, we have an SB API named
`SourceInitFileInCurrentWorkingDirectory` that does the same thing.

This patch removes the special handling from the driver and uses the API
instead. In addition to the obvious advantages of having one canonical
way of doing things and removing code duplication, this change also
means that the code path is the same for global and local lldb init
files.

Differential revision: https://reviews.llvm.org/D61577

llvm-svn: 360077
2019-05-06 20:45:31 +00:00
Reid Kleckner d9923bb2dd Fix the cmake build by removing non-existant source file
llvm-svn: 360076
2019-05-06 20:36:58 +00:00
Greg Clayton dab6189a59 Revert xcode scheme changes that I didn't mean to check in.
llvm-svn: 360072
2019-05-06 20:03:30 +00:00
Greg Clayton 8a7779209d Include inlined functions when figuring out a contiguous address range
Checking this in for Antonio Afonso:

This diff changes the function LineEntry::GetSameLineContiguousAddressRange so that it also includes function calls that were inlined at the same line of code.

My motivation is to decrease the step over time of lines that heavly rely on inlined functions. I have multiple examples in the code base I work that makes a step over stop 20 or mote times internally. This can easly had up to step overs that take >500ms which I was able to lower to 25ms with this new strategy.

The reason the current code is not extending the address range beyond an inlined function is because when we resolve the symbol at the next address of the line entry we will get the entry line corresponding to where the original code for the inline function lives, making us barely extend the range. This then will end up on a step over having to stop multiple times everytime there's an inlined function.

To check if the range is an inlined function at that line I also get the block associated with the next address and check if there is a parent block with a call site at the line we're trying to extend.

To check this I created a new function in Block called GetContainingInlinedBlockWithCallSite that does exactly that. I also added a new function to Declaration for convinence of checking file/line named CompareFileAndLine.

To avoid potential issues when extending an address range I added an Extend function that extends the range by the AddressRange given as an argument. This function returns true to indicate sucess when the rage was agumented, false otherwise (e.g.: the ranges are not connected). The reason I do is to make sure that we're not just blindly extending complete_line_range by whatever GetByteSize() we got. If for some reason the ranges are not connected or overlap, or even 0, this could be an issue.

I also added a unit tests for this change and include the instructions on the test itself on how to generate the yaml file I use for testing.


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

llvm-svn: 360071
2019-05-06 20:01:21 +00:00
Saleem Abdulrasool e24d8c55d5 Initialization: move InstructionEmulation to full initialization
The debug server does not need to use the instruction emulation. This
helps reduce the size of the final lldb-server binary by another ~100K
(~1% savings).

llvm-svn: 360067
2019-05-06 19:38:24 +00:00
Michal Gorny acbaa496ec [lldb] [lit] Use more readable consts and arrays in register read tests
Replace the constants used for r8/mm/xmm/ymm/zmm tests with something
more readable to ease debugging in case of failures (0x00 0x01 ...).
While at it, put the constants in array and copy them from memory
to simplify inline asm.

The original constants grew out of necessity.  The xmm constants were
'weird' because they were intended to be different from mm constants
(as that was necessary to catch NetBSD implementation bug).  The ymm
constants were made even weirded to not even partially collide with
other xmm registers (not saying it made sense, just how it was done).
Then, zmm constants were once again designed to avoid accidental
collisions with xmm and ymm constants, and at the same the 16 extra
registers required even more shuffling.

The new constants are meant to be more user-readable, so that a mistake
could be easily spotted.  All of xmm, ymm and zmm tests use a sequence
of {0x00 0x01 0x02 ...}, shifted by 1 for every register.  This should
provide enough uniquity, and space for future increase in number of
registers.  Since mm and r8..r15 are printed as uint64_t rather than
byte-by-byte, they use 0x000102...  As a result, on x86 endianness takes
care of making mm different than xmm.

The use of arrays is something I had to learn for zmm write tests.  It
avoids having to specify all the input values separately, and makes
GCC happy about zmm-read test (it was rejected previously because of
hitting a limit of 30 constraints).

llvm-svn: 360041
2019-05-06 13:06:43 +00:00
Jan Kratochvil 4ce1c3c3ff Merge GetCompileUnitAtOffset + GetCompileUnitContainingDIEOffset
These two methods are very similar and various refactorizations need to modify
both similar ways.

One could also just remove GetCompileUnitAtOffset and make
GetCompileUnitContainingDIEOffset to also accept offset of the CU itself
(currently it accepts only DIE offsets after the CU header).
But that would be less safe regarding some internal sanity checking.

Further code refactorization has been suggested by Pavel Labath.

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

llvm-svn: 360038
2019-05-06 12:01:38 +00:00
Hans Wennborg d2b9fc88c8 Revert r359949 "[clang] adding explicit(bool) from c++2a"
This caused Clang to start erroring on the following:

  struct S {
    template <typename = int> explicit S();
  };

  struct T : S {};

  struct U : T {
    U();
  };
  U::U() {}

  $ clang -c /tmp/x.cc
  /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T'
  U::U() {}
     ^
  /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted
    because base class 'S' has no default constructor
  struct T : S {};
             ^
  1 error generated.

See discussion on the cfe-commits email thread.

This also reverts the follow-ups r359966 and r359968.

> this patch adds support for the explicit bool specifier.
>
> Changes:
> - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
> - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
> - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
> - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
> - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
> - Test for Semantic and Serialization were added.
>
> This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
> Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.
>
> Patch by Tyker
>
> Differential Revision: https://reviews.llvm.org/D60934

llvm-svn: 360024
2019-05-06 09:51:10 +00:00
Pavel Labath 2a0cfcce6a [DWARF] Reimplement/simplify DWARFUnit::GetID
Summary:
The implementation of GetID used a relatively complicated algorithm,
which returned some kind of an offset of the unit in some file
(depending on the debug info flavour). The only thing this ID was used
for was to enable subseqent retrieval of the unit from the SymbolFile.

This can be made simpler if we just make the "ID" of the unit an index
into the list of the units belonging to the symbol file. We already
support indexed access to the units, so each unit already has a well
"index" -- this just makes it accessible from within the unit.

To make the distincion between "id" and "offset" clearer (and help catch
any misuses), I also rename DWARFDebugInfo::GetCompileUnit (which
accesses by offset) into DWARFDebugInfo::GetCompileUnitAtOffset.

On its own, this only brings a minor simplification, but it enables
further simplifications in the DIERef class (coming in a follow-up
patch).

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: arphaman, jdoerfert, lldb-commits, tberghammer, jankratochvil

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

llvm-svn: 360014
2019-05-06 07:45:28 +00:00
Jonas Devlieghere 693551d767 [test] Remove randomness
This particular test fails once every so many runs on GreenDragon. Given
that the randomness in the inferior isn't critical to the test, I
removed it in the hopes that it is the cause of the flakiness.

llvm-svn: 359992
2019-05-05 18:54:16 +00:00
Michal Gorny 60211cb872 [lldb] [lit] Simplify general-purpose register tests
Use output constraints for specific general-purpose registers in order
to simplify the tests.  They save us from having to manually put
the values in correct registers, and reduce the number of registers
needed as a result.

llvm-svn: 359978
2019-05-05 12:06:32 +00:00
Michal Gorny dca69eb29c [lldb] [lit] Fix more filename mismatches in Register tests
llvm-svn: 359977
2019-05-05 12:06:22 +00:00
Nicolas Lesser 9c32fa1b1f [lldb] Fix buildbot failure due to clang AST change.
In r359949 several AST node constructors were modified without the
corresponding change in lldb, which caused build failures.

llvm-svn: 359966
2019-05-04 10:21:50 +00:00
Saleem Abdulrasool 5a36558c5b ExpressionParser: only force link MCJIT when needed
This was added to support FreeBSD.  The inclusion of this header increases the
size of `lldb-server` due to MCJIT being forcefully preserved.  Conditionalise
the inclusion to shared builds of LLVM which will allow for MCJIT to be stripped
if unnecessary when performing static linking of tools.  This shaves off ~28% of
the binary size for lldb-server when linked with gold using
`-ffunction-sections` and `-fdata-sections`.

llvm-svn: 359944
2019-05-03 23:19:27 +00:00
Raphael Isemann 090a5b29b8 Fixed some minor style issues in rLLDB359921 [NFC]
Ran clang-format on the added test file and use the new StringRef
comparison over the temporary ConstStrings. Also aligned the
end of one of the code string literals.

llvm-svn: 359931
2019-05-03 21:01:45 +00:00
Jonas Devlieghere 94f3568633 [test] Make check more strict
Before this change the test would always pass if the path to the test
contained the number 11 in it. Thanks to Ted for pointing this out.

llvm-svn: 359930
2019-05-03 20:58:56 +00:00
Jonas Devlieghere e078c9507c [lldb] Remove the 'www' folder.
Now that the new website is live and everything is generated from the
repository, we don't need the www folder anymore.

llvm-svn: 359929
2019-05-03 20:42:45 +00:00
Jonas Devlieghere e5f7d601ee [Alias] Add 're' alias for register
This patch makes `re` an alias for `register`. Currently `re<TAB>` gives
you the choice between `register` and `reproducer`. Given that you use
`register` a lot more often, it should win for the common substring.

Differential revision: https://reviews.llvm.org/D61469

llvm-svn: 359927
2019-05-03 20:37:09 +00:00
Jonas Devlieghere c1e2c5340b Make lldb-mi optional and change how we deal with missing tools in lit
We don't need the variables in lit, we can use the capabilities to check
if the utility exists.

Differential revision: https://reviews.llvm.org/D61533

llvm-svn: 359926
2019-05-03 20:33:58 +00:00
Adrian Prantl 80b047ef66 Supply a default implementation of IsRuntimeSupportValue.
Thanks to Pavel for pointing this out.

llvm-svn: 359925
2019-05-03 20:28:19 +00:00
Shafik Yaghmour e5cbe78259 Fix for ambiguous lookup in expressions between local variable and namespace
Summary:
In an Objective-C context a local variable and namespace can cause an ambiguous name lookup when used in an expression. The solution involves mimicking the existing C++ solution which is to add local using declarations for local variables. This causes a different type of lookup to be used which eliminates the namespace during acceptable results filtering.

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

llvm-svn: 359921
2019-05-03 19:59:22 +00:00
Raphael Isemann 1756630dfa C.128 override, virtual keyword handling
Summary:
According to [C128] "Virtual functions should specify exactly one
of `virtual`, `override`, or `final`", I've added override where a
virtual function is overriden but the explicit `override` keyword
was missing. Whenever both `virtual` and `override` were specified,
I removed `virtual`. As C.128 puts it:

> [...] writing more than one of these three is both redundant and
> a potential source of errors.

I anticipate a discussion about whether or not to add `override` to
destructors but I went for it because of an example in [ISOCPP1000].
Let me repeat the comment for you here:

Consider this code:

```
    struct Base {
      virtual ~Base(){}
    };

    struct SubClass : Base {
      ~SubClass() {
        std::cout << "It works!\n";
      }
    };

    int main() {
      std::unique_ptr<Base> ptr = std::make_unique<SubClass>();
    }
```

If for some odd reason somebody removes the `virtual` keyword from the
`Base` struct, the code will no longer print `It works!`. So adding
`override` to destructors actively protects us from accidentally
breaking our code at runtime.

[C128]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final
[ISOCPP1000]: https://github.com/isocpp/CppCoreGuidelines/issues/1000#issuecomment-476951555

Reviewers: teemperor, JDevlieghere, davide, shafik

Reviewed By: teemperor

Subscribers: kwk, arphaman, kadircet, lldb-commits

Tags: #lldb

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

llvm-svn: 359868
2019-05-03 10:03:28 +00:00
Pavel Labath d214898f1f Split TestVLA into two and XFAIL one part
The part which checks whether vla_expr shows up in the variable list
does not pass on non-darwin platforms. Add the appropriate decorator.

llvm-svn: 359867
2019-05-03 08:06:28 +00:00
Pavel Labath 759ab93e04 Revert "Initialization: move InstructionEmulation to full initialization"
This change is bogus. lldb-server definitely uses instruction emulation
on some architectures.

llvm-svn: 359862
2019-05-03 07:11:43 +00:00
Jonas Devlieghere 973d66eefc [Reproducers] Improve reproducer help
Extend the documentation for the reproducer command.

llvm-svn: 359848
2019-05-03 00:10:31 +00:00
Jason Molenda c9f44cd4b6 RegisterContextLLDB::GetFullUnwindPlanForFrame has four verbose
logging messages that are written the same, making it difficult to
know for certain which code path was taken based on a logfile.  Add
some words to make each unique.

Right now the ordering for finding a FullUnwindPlan (ignoring
fallback unwind plan logic) is

1. If this is a _sigtramp like function, try eh_frame which is
   hand written on darwin systems to account for finding the
   saved register context correctly.

2. Ask the DynamicLoader if eh_frame should be preferred for
   this frame.  Some binaries on the system may have hand-written
   eh_frame and the DynamicLoader is the source for this.  (primarily
   this is for hand-written assembly in the objc runtime, and we tell
   lldb to trust that for functions in libobjc.dylib.)

3. if 0th frame, use GetUnwindPlanAtNonCallSite plan.

4. GetUnwindPlanAtCallSite {for 0th or any other}

5. GetUnwindPlanAtNonCallSite {now for non-0th frames, only if not from a compiler? hm.}

6. GetUnwindPlanArchitectureDefaultAtFunctionEntry if we're on the first instruction

7. Architectural default unwind plan ABI::CreateDefaultUnwindPlan


I'm moving #6 -- DefaultAtFunctionEntry -- up to between #3 and #4,
where we're already doing things specific to the zeroth frame.  If
we're on the zeroth frame and the GetUnwindPlanAtNonCallSite plan
has failed for some reason, and we're on the first instruction, we
should definitely use DefaultAtFunctionEntry instead of any other
unwind plan.  If we're trying to step out of some rando function
on the system that we couldn't assembly instruction inspect, this
is sufficient for us to step out of it.

llvm-svn: 359847
2019-05-02 23:49:56 +00:00
Adrian Prantl a0ac5afb0a Fix tests on non-Darwin platforms.
llvm-svn: 359846
2019-05-02 23:49:55 +00:00
Jason Molenda 3af3900ee7 Upstreaming an apple local patch by Frederic Riss.
lldb has an expression that runs in the inferior process to collect
the isa values and hash of the class names for classes in the
system's shared cache.  In recent OSes, swift classes are in this
table and the function the jitted expression calls returns demangled
names.  We need to compute the hashes based on the mangled names.
So for these names, return a hash value of 0 which indicates that
lldb should read the class name directly out of the runtime tables
and compute the hash itself.

When this patch is absent, the lldb+swift testsuite has many failures
on a recent macOS system; there isn't a direct non-swift way to
test for this being correct.

<rdar://problem/47935062>

llvm-svn: 359843
2019-05-02 23:14:26 +00:00
Adrian Prantl 1db0f0ca98 Hide runtime support values such as clang's __vla_expr from frame variable
by respecting the "artificial" attribute on variables. Function
arguments that are artificial and useful to end-users are being
whitelisted by the language runtime.

<rdar://problem/45322477>

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

llvm-svn: 359841
2019-05-02 23:07:23 +00:00
Saleem Abdulrasool ec2801a176 Initialization: move InstructionEmulation to full initialization
The debug server does not need to use the instruction emulation.  This helps
reduce the size of the final lldb-server binary by another ~100K (~1% savings).

llvm-svn: 359832
2019-05-02 21:49:29 +00:00
Saleem Abdulrasool d179ce99d6 Initialization: correct macro usage
`_MSC_VER` indiciates that you are building with MSVC, not that you are building
for Windows.  Use `_WIN32` (which identifies Win32 and Win64).

llvm-svn: 359817
2019-05-02 19:25:18 +00:00
Saleem Abdulrasool 509c884048 gdb-remote: fix the build on Windows
Windows does not have a definition for `mode_t`.  Include the appropriate
header.

llvm-svn: 359816
2019-05-02 19:09:58 +00:00
Raphael Isemann 21db1440f9 Remove unnecessary check in SymbolFileDWARF::ParseImportedModules
Summary:
This check seems unnecessary as we already assert the same condition above and also access `sc.comp_unit`
before this check.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: jdoerfert, lldb-commits

Tags: #lldb

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

llvm-svn: 359813
2019-05-02 18:26:58 +00:00
Jonas Devlieghere 0682fc5e5f Disable TestArgumentPassingRestrictions for clang < 7
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/

llvm-svn: 359812
2019-05-02 18:26:46 +00:00
Saleem Abdulrasool bd689b9c6b gdb-remote: reduce some inclusion of Target/Process.h
Reduce the inclusion of Target/Process.h to help isolate why Process is being
preserved during the build of `lldb-server`.

llvm-svn: 359811
2019-05-02 18:15:03 +00:00
Saleem Abdulrasool c7c3cf685d Initialization: remove ObjectContainer from Common
This restructures the initialization path to move the ObjectContainer
initialization into the *full* initialization path. This is not needed
for the lldb-server initialization path. This helps strip off ~1MiB
from the binary.

llvm-svn: 359810
2019-05-02 18:11:44 +00:00
Jonas Devlieghere 291a0b89fa [test] TestSharedPtr -> TestSharedPtrDbgInfoContent
Two tests cannot share the same name, because they will generate an
identical trace file. When that happens, this can lead to a race
condition where dotest fails when trying to move both files into the
trace directory, because the file has already been moved. Additionally,
the trace will have been overwritten by the test that finishes last.

llvm-svn: 359807
2019-05-02 17:35:18 +00:00
Michal Gorny 2f6c579ecb [lldb] [lit] Add write tests for AVX-512 registers (zmm, xmm15+, ymm15+)
Differential Revision: https://reviews.llvm.org/D61439

llvm-svn: 359797
2019-05-02 16:10:35 +00:00
Pavel Labath 5c4f031d71 Reinstate xfail-darwin in x86-64-ymm-write.test
It turns out writing into ymm registers really does not work there.

llvm-svn: 359795
2019-05-02 15:38:09 +00:00
Pavel Labath 58aa22f4e1 Fix the compile RUN line in x86-64-ymm-write.test
Optimistically assuming this was the result of the darwin failure too,
so removing the XFAIL there.

llvm-svn: 359794
2019-05-02 15:16:01 +00:00
Michal Gorny 8d8c7e9e75 [lldb] [lit] Mark x86-64-ymm-write XFAIL on Darwin
llvm-svn: 359787
2019-05-02 14:03:42 +00:00
Michal Gorny 4d738566d6 [lldb] [lit] Use LLDB-like output for XMM registers in write tests
llvm-svn: 359784
2019-05-02 12:55:54 +00:00
Michal Gorny 72d3ca957c [lldb] [lit] Introduce tests for writing YMM registers
Differential Revision: https://reviews.llvm.org/D61431

llvm-svn: 359783
2019-05-02 12:55:44 +00:00
Michal Gorny 8120b7ac07 [lldb] [lit] Split 'register read' tests between zmm*, xmm16+, ymm16+
Since Darwin target implements support for zmm* registers without
matching support for the respectively added xmm* and ymm* registers,
split the tests for each register group.  To reduce code duplication,
the tests are using the same source file (which sets more registers
than necessary but that should not cause any harm).

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

llvm-svn: 359780
2019-05-02 11:26:30 +00:00
Raphael Isemann 9a0acdf65e Add std::stack and std::queue support to CxxModuleHandler
Reviewers: aprantl, shafik

Reviewed By: aprantl, shafik

Subscribers: lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

llvm-svn: 359779
2019-05-02 11:25:50 +00:00
Raphael Isemann 3356c32098 Rename Minion to ASTImporterDelegate
Summary:
I think there universal agreement that Minion isn't the best name for this class. This patch renames the class
 to ASTImporterDelegate to better reflect it's goal of monitoring and extending the ASTImporter.

Reviewers: aprantl, shafik, martong, a.sidorin, davide

Reviewed By: aprantl, shafik, davide

Subscribers: rnkovacs, davide, abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 359777
2019-05-02 10:58:33 +00:00
Raphael Isemann 71569d0d52 Inject only relevant local variables in the expression evaluation context
Summary:
In r259902, LLDB started injecting all the locals in every expression
evaluation. This fixed a bunch of issues, but also caused others, mostly
performance regressions on some codebases. The regressions were bad
enough that we added a setting in r274783 to control the behavior and
we have been shipping with the setting off to avoid the perf regressions.

This patch changes the logic injecting the local variables to only inject
the ones present in the expression typed by the user. The approach is
fairly simple and just scans the typed expression for every local name.
Hopefully this gives us the best of both world as it just realizes the
types of the variables really used by the expression.

Landing this requires the 2 other issues I pointed out today to be addressed
but I wanted to gather comments right away.

Original patch by Frédéric Riss!

Reviewers: jingham, clayborg, friss, shafik

Reviewed By: jingham, clayborg

Subscribers: teemperor, labath, lldb-commits

Tags: #lldb

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

llvm-svn: 359773
2019-05-02 10:12:56 +00:00
Pavel Labath c19311185f Fix MSVC build
Address an ambiguity between lldb_private::Thread and
llvm::minidump::Thread. Follow-up to llvm r359762 (which introduced the
second type).

llvm-svn: 359765
2019-05-02 08:52:06 +00:00
Jim Ingham e91ad7d290 Mention the thread-format & frame-format settings in help.
You can only find out about this useful customization by browsing
the settings list output or the llvm.org web pages.  Mention it
in the help for thread list, thread backtrace & _regex_bt commands
to make it more discoverable.

llvm-svn: 359752
2019-05-02 02:14:08 +00:00
Jonas Devlieghere 84bed67a5c [test] Convert TestWatchpointSetErrorCases.py to lit
This test is flaky on GreenDragon. Since it was a pexpect test and
straightforward enough to convert, I went ahead and converted it to a
lit test.

Differential revision: https://reviews.llvm.org/D61414

llvm-svn: 359751
2019-05-02 01:54:05 +00:00
Jonas Devlieghere 1c19b74cef [CommandObjectCommands] Honor stop-command-source-on-error
This patch ensures that we honor the stop-command-source-on-error
setting from `command source`. The problem is that we didn't
differentiate between the boolean value being true or false, or not
being set. For the latter scenario, we should calculate the value in the
command interpreter based on the global options.

Differential revision: https://reviews.llvm.org/D61406

llvm-svn: 359750
2019-05-02 01:54:02 +00:00
Alex Langford d6b469dd05 [CMake] Remove EmulateInstructionMIPS dependency on Interpreter
llvm-svn: 359748
2019-05-02 01:10:38 +00:00
Saleem Abdulrasool dc476df585 lldb-server: remove link against lldbInterpreter
This dependency is unused. Remove the extraneous link.

llvm-svn: 359738
2019-05-01 23:06:45 +00:00
Shafik Yaghmour 2097b1f84d Set a CXXRecordDecl to not be passed in registers if DW_CC_pass_by_reference when loading from DWARF
Summary:
This will fix a bug where during expression parsing we are not setting a CXXRecordDecl to not be passed in registers and the resulting code generation is wrong.
The DWARF attribute DW_CC_pass_by_reference tells us that we should not be passing in registers i.e. RAA_Indirect.
This change depends this clang change which fixes the fact that the ASTImporter does not copy RecordDeclBits for CXXRecordDecl: https://reviews.llvm.org/D61140

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

llvm-svn: 359732
2019-05-01 22:23:06 +00:00
Alex Langford 4e7104bd63 [lldb-server] Remove lldb-server's dependency on Core
No need to directly link against Core, as lldb-server doesn't directly
use it.

llvm-svn: 359730
2019-05-01 21:41:40 +00:00
Jonas Devlieghere 5833bb280f Disable queues_with_libBacktraceRecording
After multiple attempts from both Fred and Adrian, this variant of the
test is still flaky on GreenDragon. This commit disables it while we
continue investigate.

llvm-svn: 359724
2019-05-01 20:37:05 +00:00
Shafik Yaghmour c3dd67204c Disabling test in TestClassTemplateParameterPack.py until we do template lookup correctly
Summary:
Some tests currently only work because we are pulling all the local variables when we are evaluating an expression. This will soon
change and these test are working but for the wrong reasons. The details can be found in the discussion here:
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html

Differential Review:  https://reviews.llvm.org/D61266

llvm-svn: 359699
2019-05-01 16:39:31 +00:00
Michal Gorny 9779908494 [lldb] [lit] Add write tests for r8-r15 & xmm8-xmm15 registers
Differential Revision: https://reviews.llvm.org/D61303

llvm-svn: 359682
2019-05-01 13:55:23 +00:00
Michal Gorny b268a2a4af [lldb] [lit] Add write tests for MM/XMM registers
Differential Revision: https://reviews.llvm.org/D61303

llvm-svn: 359681
2019-05-01 13:55:13 +00:00
Raphael Isemann 290be2a3b7 Fix build URL in new LLDB website
Summary:
After the LLDB website was migrated to be generated by Sphinx the build.html file lives in another location.

See http://lists.llvm.org/pipermail/lldb-dev/2019-April/014992.html.

Reviewers: teemperor

Reviewed By: teemperor

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 359665
2019-05-01 09:55:00 +00:00
Raphael Isemann c53f8db770 Removed unnecessary conversion to StringRef
llvm-svn: 359664
2019-05-01 09:49:07 +00:00
Alex Langford 10e4b860de [CMake] Correct lldbPluginProcessPOSIX dependencies
This plugin does not depend on lldbInterpreter. It only depends on
lldbUtility.

llvm-svn: 359645
2019-05-01 03:23:09 +00:00
Jonas Devlieghere 4e6fd3ba91 Add CxxModuleHandler to Xcode project
llvm-svn: 359593
2019-04-30 18:21:14 +00:00
Jonas Devlieghere 2795490b1a Sort Symbol/CMakeLists.txt
This makes resolving merge conflicts downstream a tad easier.

llvm-svn: 359577
2019-04-30 17:22:29 +00:00
Jonas Devlieghere 9fa970a27b XFAIL x86-64-zmm-read on Darwin
llvm-svn: 359575
2019-04-30 17:21:05 +00:00
Stella Stamenova be323ef571 Un-xfail the TestMiniDump tests on Windows
After Aaron's commit for ObjectFilePECOFF:: GetUUID, the tests are now passing

llvm-svn: 359573
2019-04-30 16:42:39 +00:00
Michal Gorny d14a0de9ad [lldb] [Process/NetBSD] Fix handling piod_len from PT_IO calls
Fix bugs in piod_len return value processing in ReadMemory()
and WriteMemory() methods.  In particular, add support for piod_len == 0
indicating EOF, and fix summing bytes_read/bytes_written when PT_IO does
partial reads/writes.

The EOF condition could happen if LLDB attempts to read past
vm.maxaddress, e.g. as a result of RBP containing large (invalid) value.
Previously, the 0 return caused the function to retry reading via PT_IO
indefinitely, effectively deadlooping lldb-server.

Partial reads probably did not occur in practice, yet they would cause
ReadMemory() to return incorrect bytes_read and/or overwrite previously
read data.

WriteMemory() suffered from analoguous problems.

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

llvm-svn: 359572
2019-04-30 16:30:32 +00:00
Pavel Labath 03db32b303 PostfixExpression: Introduce InitialValueNode
Summary:
This node represents can be used to refer to the initial value, which is
sometimes pushed onto the DWARF stack as the "input" to the DWARF
expression. The typical use case (and the reason why I'm introducing it)
is that the "Canonical Frame Address" is passed this way to the DWARF
expressions computing the values of registers during frame unwind.

The nodes are converted into dwarf by keeping track of DWARF stack depth
an any given point, and then copying the initial value from the bottom
of the stack via the DW_OP_pick opcode. This could be made more
efficient for simple expressions, but here I chose to start with the
most general implementation possible.

Reviewers: amccarth, clayborg, aleksandr.urakov

Subscribers: aprantl, jasonmolenda, lldb-commits, markmentovai

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

llvm-svn: 359560
2019-04-30 13:33:18 +00:00
Raphael Isemann 9a7ccd01b6 Sort containers alphabetically in CxxModuleHandler [NFC]
llvm-svn: 359546
2019-04-30 10:27:31 +00:00
Raphael Isemann f74a4c1f6d Instantiate 'std' templates explicitly in the expression evaluator
Summary:
This patch is a follow-up for D58125. It implements the manual instantiation and merging of 'std' templates like
`std::vector` and `std::shared_ptr` with information from the debug info AST. This (finally) allows using these classes
in the expression evaluator like every other class (i.e. things like `vec.size()` and shared_ptr debugging now works, yay!).

The main logic is the `CxxModuleHandler` which intercept the ASTImporter import process and replaces any `std` decls
by decls from the C++ module. The decls from the C++ module are "imported" by just deserializing them directly in
the expression evaluation context. This is mostly because we don't want to rely on the ASTImporter to correctly import
these declarations, but in the future we should also move to the ASTImporter for that.

This patch doesn't contain the automatic desugaring for result variables. This means that if you call for example
`size` of `std::vector` you maybe get some very verbose typedef'd type as the variable type, e.g.
`std::vector<int, std::allocator<int>>::value_type`.

This is not only unreadable, it also means that our ASTImporter has to import all these types and associated
decls into the persisent variable context. This currently usually leads to some assertion getting triggered
in Clang when the ASTImporter either makes a mistake during importing or our debug info AST is inconsitent.
The current workaround I use in the tests is to just cast the result to it's actual type (e.g. `size_t` or `int`) to prevent
the ASTImporter from having to handle all these complicated decls.

The automatic desugaring will be a future patch because I'm not happy yet with the current code for that and because
I anticipate that this will be a controversial patch.

Reviewers: aprantl, shafik, jingham, martong, serge-sans-paille

Reviewed By: martong

Subscribers: balazske, rnkovacs, mgorny, mgrang, abidh, jdoerfert, lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

llvm-svn: 359538
2019-04-30 08:41:35 +00:00
Aaron Smith b8d03935e9 [PECOFF] Implementation of ObjectFilePECOFF:: GetUUID()
Summary:
Provide an implementation of GetUUID() for remote debugging scenarios.

Return a PDB's GUID (or PDB70's Signature) as the UUID.

Reviewers: amccarth, labath

Reviewed By: labath

Subscribers: amccarth, clayborg, Hui, labath, lldb-commits

Tags: #lldb

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

llvm-svn: 359528
2019-04-30 01:41:33 +00:00
Jonas Devlieghere 58b166325c [lit] Check for the psutil module when setting a timeout
Apparently setting the per-test-timeout and not having the psutil
package constitutes to a fatal error. So only set the timeout when the
module is available.

llvm-svn: 359503
2019-04-29 21:03:39 +00:00
Jonas Devlieghere f3ac8712ff [lit] Fix the timeout.
The timeout wasn't working because it's a property of the lit
configuration, not of the configuration in lit.site.cfg. This sets the
property for the correct object.

llvm-svn: 359492
2019-04-29 19:55:49 +00:00
Alex Langford babcbaf971 [CMake] Fix subtle CMake bug
CMake specifies that the DEPENDS field of add_custom_target is for files
and output of add_custom_command. In order to add a target dependency,
add_dependencies should be used.

llvm-svn: 359490
2019-04-29 19:44:43 +00:00
Jonas Devlieghere f1ec0406f0 [test] Disable x86-64-gp-write on Darwin
llvm-svn: 359487
2019-04-29 19:39:09 +00:00
Adrian Prantl a93e77c1c7 Fix a stack-smasher in PlatformMacOSX::GetSDKDirectory()
GetSDKVersion expects the number of version fields not their byte size
and will happily overwrite later contents of the stack.

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

llvm-svn: 359471
2019-04-29 17:28:38 +00:00
Jonas Devlieghere 8c3513ffc4 [Docs] Generate the python reference without building all of LLDB
As discussed on the mailing list, we should be able to generate the
Python reference without building all of LLDB. To make that possible I
create a dummy python package, which is then parsed by epydoc. The
latter will complain that it couldn't import lldb, but that doesn't
matter as far as generation of the docs is concerned.

Differential revision: https://reviews.llvm.org/D61216

llvm-svn: 359465
2019-04-29 16:29:10 +00:00
Pavel Labath 0d339460f1 Remove XFAIL: windows from x86-64-gp-write.test
The typo fix in r359451 was enough to get it passing there.

llvm-svn: 359456
2019-04-29 15:16:26 +00:00
Pavel Labath 5e9f1d8d90 @skipIfLinux another batch of flaky lldb-mi tests
llvm-svn: 359452
2019-04-29 14:12:05 +00:00
Pavel Labath 1cf7db12e1 Fix a typo in x86-64-gp-write.test
The test was building the wrong inferior, causing failures.

llvm-svn: 359451
2019-04-29 14:04:41 +00:00