Commit Graph

18122 Commits

Author SHA1 Message Date
Alexander Kornienko 87ab8f316f Fix an unused variable warning. NFC
llvm-svn: 346651
2018-11-12 13:41:42 +00:00
Jonas Devlieghere ceff6644bb Remove header grouping comments.
This patch removes the comments grouping header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

llvm-svn: 346626
2018-11-11 23:17:06 +00:00
Jonas Devlieghere 672d2c1255 Remove comments after header includes.
This patch removes the comments following the header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

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

llvm-svn: 346625
2018-11-11 23:16:43 +00:00
Jonas Devlieghere f8d480b12c Add missing include
llvm-svn: 346599
2018-11-10 22:54:44 +00:00
Jonas Devlieghere 1cc0714c68 Extract construction of DataBufferLLVM into FileSystem
This moves construction of data buffers into the FileSystem class. Like
some of the previous refactorings we don't translate the path yet
because the functionality hasn't been landed in LLVM yet.

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

llvm-svn: 346598
2018-11-10 22:44:06 +00:00
Jason Molenda ff6a4edc26 Unbreak the linux bot from the previous commit. Fred needed to use
some of the macros from mach/exc_resource.h to decode EXC_RESOURCE,
but that header doesn't exist on non-apple platforms and
StopInfoMachException.cpp needs to build on those systems.
EXC_RESOURCE won't be decoded when lldb is built on non-darwin systems.

llvm-svn: 346573
2018-11-10 00:25:45 +00:00
Adrian Prantl 2ddb2652d9 Add extra diagnostics to test
llvm-svn: 346572
2018-11-10 00:16:39 +00:00
Jason Molenda a9796ede39 Enable listening for EXC_RESOURCE events, and format mach
event as a thread stop reason if we receive one, using 
some macros to decode the payload.  

Patch originally written by Fred Riss, with a few small changes
by myself.

Writing a test for this is a little tricky because the 
mach exception data interpretation relies on header macros
or function calls - it may change over time and writing
a gdb_remote_client test for this would break as older 
encoding interpretation is changed.  I'll tak with Fred
about this more, but neither of us has been thrilled with
the kind of tests we could write for it.

<rdar://problem/13097323>, <rdar://problem/40144456> 

llvm-svn: 346571
2018-11-10 00:14:14 +00:00
Jason Molenda c0e793d654 Work with a gdb-remote target that doesn't handle the
qWatchpointSupportInfo packet correctly.  

In GDBRemoteCommunicationClient::GetWatchpointSupportInfo,
if the response to qWatchpointSupportInfo does not
include the 'num' field, then we did not get an answer
we understood, mark this target as not supporting that
packet.

In Target.cpp, rename the very confusingly named
CheckIfWatchpointsExhausted to CheckIfWatchpointsSupported,
and check the error status returned by 
Process::GetWatchpointSupportInfo.  If we cannot determine
what the number of supported watchpoints are, assume that
they will work.  We'll handle the failure
later when we try to create/enable the watchpoint if the
Z2 packet isn't supported.

Add a gdb_remote_client test case.

<rdar://problem/42621432> 

llvm-svn: 346561
2018-11-09 22:33:26 +00:00
Jason Molenda a1050973ed Remove llvm include from debugserver, change
LLVM_FALLTHROUGH's to [[clang::fallthrough]] -
debugserver is only ever compiled on darwin
systems with clang.

llvm-svn: 346553
2018-11-09 20:31:41 +00:00
Adrian Prantl 567906d8c7 Add missing include
llvm-svn: 346527
2018-11-09 17:58:05 +00:00
Adrian Prantl 69cf5571e3 Add missing include
llvm-svn: 346525
2018-11-09 17:44:20 +00:00
Adrian Prantl 96d37cf537 Annotate switch with LLVM_FALLTHROUGH
llvm-svn: 346519
2018-11-09 17:11:17 +00:00
Zachary Turner 12abab5717 [NativePDB] Fix completion of enum types.
This was originally submitted in a patch which fixed two unrelated
bugs at the same time.  This portion of the fix was reverted because
it broke several other things.  However, the fix employed originally
was totally wrong, and attempted to change something in the ValueObject
printer when actually the bug was in the NativePDB plugin.  We need
to mark forward enum decls as having external storage, otherwise
we won't be asked to complete them when the time comes.  This patch
implements the proper fix, and updates tests accordingly.

llvm-svn: 346517
2018-11-09 17:08:26 +00:00
Zachary Turner d2ee4c6ddb [NativePDB] Add support for bitfield records.
Bitfields are represented as LF_MEMBER records whose TypeIndex
points to an LF_BITFIELD record that describes the bit width,
bit offset, and underlying type of the bitfield.  All we need to
do is resolve these when resolving record types.

llvm-svn: 346511
2018-11-09 16:29:19 +00:00
Zachary Turner 9cad24a7ee Resubmit "Fix bug in PE/COFF plugin."
The original commit was actually 2 unrelated bug fixes, but it turns
out the second bug fix wasn't quite correct, so the entire patch was
reverted.  Resubmitting this half of the patch by itself, then will
follow up with a new patch which fixes the rest of the issue in a
more appropriate way.

llvm-svn: 346505
2018-11-09 16:06:44 +00:00
Kadir Cetinkaya f3cae3ab4c revert rL346478
Summary:

Reviewers:

Subscribers:

llvm-svn: 346502
2018-11-09 15:18:02 +00:00
Kadir Cetinkaya ff653da67a [lldb] Fix signature in test to match rL346453
llvm-svn: 346478
2018-11-09 09:00:12 +00:00
Jonas Devlieghere 72787ac661 Revert "[FileSystem] Make use of FS in TildeExpressionResolver"
The whole point of this change was making it possible to resolve paths
without depending on the FileSystem, which is not what I did here. Not
sure what I was thinking...

llvm-svn: 346466
2018-11-09 01:59:28 +00:00
Zachary Turner eb98774299 Fix a test whose output changed.
A previous commit fixed an issue with our AST generation where
we were outputting enum decls incorrectly.  But we forgot to
update the test output.  This patch updates the test output
accordingly.

llvm-svn: 346459
2018-11-09 01:09:10 +00:00
Jonas Devlieghere 9560f353ed [FileSystem] Make use of FS in TildeExpressionResolver
In order to call real_path from the TildeExpressionResolver we need
access to the FileSystem. Since the resolver lives under utility we have
to pass in the FS.

llvm-svn: 346457
2018-11-09 00:50:50 +00:00
Adrian Prantl e884ccb1cb Fix CMake build when building with -fmodules-local-submodule-visibility.
llvm-svn: 346456
2018-11-09 00:49:18 +00:00
Jonas Devlieghere 7010ef34d5 Update FileSpec constructor signature
llvm-svn: 346449
2018-11-08 23:21:00 +00:00
Davide Italiano ca591dea10 Revert "Fix bug in PE/COFF plugin and ValueObjectVariable."
It breaks some tests on MacOS.

llvm-svn: 346444
2018-11-08 22:47:40 +00:00
Jason Molenda 0585921b7f Change $CURRENT_ARCH settings in xcode project file to hardcoded
"x86_64" - used for finding the llvm build directory.  Newer
Xcodes do not define CURRENT_ARCH.

llvm-svn: 346443
2018-11-08 22:41:19 +00:00
Jorge Gorbe Moya a6e6c18ade [lldb] Silence unhandled enums warning.
The warning was introduced by r346392, which introduces new builtin
types (to support cl_intel_device_side_avc_motion_estimation OpenCL
extension).

Note that this patch only inserts empty cases to silence the warning and
unblock our integrate, does not aim to add support for the new types in
lldb.

llvm-svn: 346441
2018-11-08 22:04:58 +00:00
Jorge Gorbe Moya d17315d898 [lldb] Fix initialization order warnings.
Moved the declaration of m_kind below the declaration of cvclass,
cvunion and cvenum. This order is necessary because in one of the
constructors the initialization of m_kind depends on the value of
cvclass.

third_party/llvm/llvm/tools/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp:50:7: error: field 'cvclass' will be initialized after field 'm_kind' [-Werror,-Wreorder]
    : cvclass(std::move(c)),
      ^
third_party/llvm/llvm/tools/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp:51:14: error: field 'cvclass' is uninitialized when used here [-Werror,-Wuninitialized]
      m_kind(cvclass.Kind == TypeRecordKind::Struct ? Struct : Class) {}

llvm-svn: 346435
2018-11-08 19:57:59 +00:00
Zachary Turner 91dbd52890 Fix bug in PE/COFF plugin and ValueObjectVariable.
There are two bugs here.  The first is that MSVC and clang-cl
emit their bss section under the name '.data' instead of '.bss'
but with the size and file offset set to 0.  ObjectFilePECOFF
didn't handle this, and would only recognize a section as bss
if it was actually called '.bss'.  The effect of this is that
if we tried to print the value of a variable that lived in BSS
we would fail.

The second bug is that ValueObjectVariable was only returning
the forward type, which is insufficient to print the value of an
enum.  So we bump this up to the layout type.

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

llvm-svn: 346430
2018-11-08 18:50:31 +00:00
Zachary Turner 056e4ab497 [NativePDB] Higher fidelity reconstruction of AST from Debug Info.
In order to accurately put a type into the correct location in the AST
we construct from debug info, we need to be able to determine what
DeclContext (namespace, global, nested class, etc) that it goes into.
PDB doesn't contain this mapping.  It does, however, contain the reverse
mapping.  That is, for a given class type T, you can determine all
classes Q1, Q2, ..., Qn that are nested inside of T.  We need to know,
for a given class type Q, what type T is it nested inside of.

This patch builds this map as a pre-processing step when we first
load the PDB by scanning every type.  Initial tests show that while
this can be slow in debug builds of LLDB, it is quite fast in release
builds (less than 2 seconds for a ~1GB PDB, and it only needs to happen
once).

Furthermore, having this pre-processing step in place allows us to
repurpose it for building up other kinds of indexing to it down the
line.  For the time being, this gives us very accurate reconstruction
of the DeclContext hierarchy.

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

llvm-svn: 346429
2018-11-08 18:50:11 +00:00
Shafik Yaghmour 8c5ec1ff46 Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter.
rdar://problem/43822994

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

llvm-svn: 346428
2018-11-08 18:42:00 +00:00
Jonas Devlieghere 3a58d89819 [FileSystem] Add convenience method to check for directories.
Replace calls to LLVM's is_directory with calls to LLDB's FileSytem
class. For this I introduced a new convenience method that, like the
other methods, takes either a path or filespec. This still uses the LLVM
functions under the hood.

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

llvm-svn: 346375
2018-11-08 00:14:50 +00:00
Jason Molenda 36a4272428 Re-commit regularization of the lldb-gtest-build target.
llvm-svn: 346347
2018-11-07 19:28:03 +00:00
Nathan Lanza 067cc509d0 Adjust some id bit shifts to fit inside 32 bit integers
Summary:
The DAP on vscode uses a JavaScript `number` for identifiers while the
Visual Studio version uses a C# `Int` for identifiers. lldb-vscode is
bit shifting identifiers 32 bits and then bitwise ORing another 32 bit
identifier into a 64 bit id to form a unique ID. Change this to
a a partitioning of the 32 bits that makes sense for the data types.

Reviewers: clayborg

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

llvm-svn: 346346
2018-11-07 19:27:36 +00:00
Jason Molenda 37b102d2fa Revert r346285 until I can make it work correctly
the way the bots build lldb.

llvm-svn: 346342
2018-11-07 18:38:15 +00:00
Eric Christopher c7f57aa885 Add a break to avoid an unannotated fall-through.
llvm-svn: 346294
2018-11-07 05:17:31 +00:00
Jason Molenda 6b3954da01 Standardize the OTHER_LDFLAGS for the lldb-gtest-build target.
llvm-svn: 346285
2018-11-07 01:19:52 +00:00
Jason Molenda b1abf9e670 Compiler warning pointed out a mistake - fix it.
llvm-svn: 346283
2018-11-07 00:25:02 +00:00
Nathan Lanza 5652cd3fe9 Remove working directory for debugserver code signing target
Summary:
LLVM puts output binaries in
`${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin`. This chunk of
code left out the `${CMAKE_CFG_INTDIR}`. Ultimately, the code signing target
does not need a working directory anyways, so it's safe to just remove it.

Reviewers: sas, xiaobai, beanz

Reviewed By: beanz

Subscribers: mgorny

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

llvm-svn: 346281
2018-11-06 23:54:52 +00:00
Jason Molenda 8fcf0a74af Add MSVCUndecoratedNameParser.cpp.
llvm-svn: 346278
2018-11-06 23:01:42 +00:00
Davide Italiano 05620d8e13 [ObjectFile] Prefer reinterpret_cast<>
llvm-svn: 346247
2018-11-06 17:42:14 +00:00
Davide Italiano b37f1ec861 [ObjectFileELF] Fix misaligned read/writes caught by UBSan.
llvm-svn: 346244
2018-11-06 17:11:34 +00:00
Pavel Labath e0d2733bf6 CPlusPlusLanguage: Use new demangler API to implement type substitution
Summary:
Now that llvm demangler supports more generic customization, we can
implement type substitution directly on top of this API. This will allow
us to remove the specialized hooks which were added to the demangler to
support this use case.

Reviewers: sgraenitz, erik.pilkington, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 346233
2018-11-06 15:41:37 +00:00
Benjamin Kramer 98d9647d55 Add parens to silence warning
MSVCUndecoratedNameParser.cpp:25:36: warning: '&&' within '||' [-Wlogical-op-parentheses]

llvm-svn: 346220
2018-11-06 10:13:37 +00:00
Aleksandr Urakov c1e530ee92 [PDB] Introduce `MSVCUndecoratedNameParser`
This patch introduces the simple MSVCUndecoratedNameParser. It is needed for
parsing names of PDB symbols corresponding to template instantiations. For
example, for the name `operator<<A>'::`2'::B::operator> we can't just split the
name with :: (as it is implemented for now) to retrieve its scopes. This parser
processes such names in a more correct way.

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

llvm-svn: 346213
2018-11-06 08:02:55 +00:00
Davide Italiano 62d2f76a45 [TestVLA] Fix a python decorator.
llvm-svn: 346186
2018-11-06 00:18:17 +00:00
Nathan Lanza 8b73fa61d1 Adjust the comment section of CreateSource to account for lines longer than 60
Summary:
On rare occasions, the address, instruction and arguments of a line of
assembly in the CreateSource printout would reach > 60 characters. The
function would integer overflow and try to indent a line by `0xfff...`.

Change the calculated offset to be the maximum of 60 or
`line_strm.str().size()`

Reviewers: clayborg, xiaobai

Reviewed By: clayborg

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

llvm-svn: 346179
2018-11-05 22:55:30 +00:00
Nathan Lanza c61ee1bd04 Set stdout/stdin to binary mode on Windows
Summary:
A file opened in text mode on Windows will have `\n` automatically changed to `13,10` while Darwin and Linux leave it as `10`.

Set the file to binary mode to avoid this automatic conversion so that Darwin, Linux and Windows have equivalent treatment of `\r`.

Reviewers: clayborg, xiaobai

Reviewed By: clayborg

Subscribers: emaste, ki.stfu, mgorny, eraman, JDevlieghere, mgrang

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

llvm-svn: 346174
2018-11-05 22:25:00 +00:00
Adrian Prantl 005d3dee4d Skip this test on older versions of clang.
llvm-svn: 346172
2018-11-05 22:19:22 +00:00
Nathan Lanza 6868d2dd65 Add a relocation to ObjectFileELF::ApplyRelocations and a test
Summary:
pcm files can end up being processed by lldb with relocations to be
made for the .debug_info section. When a R_AARCH64_ABS64 relocation
was required lldb would hit an `assert(false)` and die.

Add R_AARCH64_ABS64 relocations to the S+A 64 bit width code path. Add
a test for R_AARCH64_ABS64 and R_AARCH64_ABS32 .rela.debug_info
relocations in a pcm file.

Reviewers: sas, xiaobai, davide, javed.absar, espindola

Reviewed By: davide

Subscribers: labath, zturner, emaste, mgorny, arichardson, kristof.beyls

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

llvm-svn: 346171
2018-11-05 22:18:00 +00:00
Adrian Prantl eca07c592a Fix (and improve) the support for C99 variable length array types
Clang recently improved its DWARF support for C VLA types. The DWARF
now looks like this:

0x00000051:         DW_TAG_variable [4]
                     DW_AT_location( fbreg -32 )
                     DW_AT_name( "__vla_expr" )
                     DW_AT_type( {0x000000d3} ( long unsigned int ) )
                     DW_AT_artificial( true )
...
0x000000da:     DW_TAG_array_type [10] *
                 DW_AT_type( {0x000000cc} ( int ) )

0x000000df:         DW_TAG_subrange_type [11]
                     DW_AT_type( {0x000000e9} ( __ARRAY_SIZE_TYPE__ ) )
                     DW_AT_count( {0x00000051} )

Without this patch LLDB will naively interpret the DIE offset 0x51 as
the static size of the array, which is clearly wrong.  This patch
extends ValueObject::GetNumChildren to query the dynamic properties of
incomplete array types.

See the testcase for an example:

   4   int foo(int a) {
   5   	     int vla[a];
   6   	       for (int i = 0; i < a; ++i)
   7   	           vla[i] = i;
   8
-> 9            pause(); // break here
   10  		return vla[a-1];
   11   }

(lldb) fr v vla
(int []) vla = ([0] = 0, [1] = 1, [2] = 2, [3] = 3)
(lldb) quit

rdar://problem/21814005

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

llvm-svn: 346165
2018-11-05 20:49:07 +00:00