Commit Graph

191 Commits

Author SHA1 Message Date
George Rimar 004bcb78ed [LLDB] - Recommit r346848 "[LLDB] - Support the single file split DWARF.".
Test cases were updated to not use the local compilation dir which
is different between development pc and build bots.

Original commit message:

[LLDB] - Support the single file split DWARF.

DWARF5 spec describes a single file split dwarf case
(when .dwo sections are in the .o files).

Problem is that LLDB does not work correctly in that case.
The issue is that, for example, both .debug_info and .debug_info.dwo
has the same type: eSectionTypeDWARFDebugInfo. And when code searches
section by type it might find the regular debug section
and not the .dwo one.

The patch fixes that. With it, LLDB is able to work with
output compiled with -gsplit-dwarf=single flag correctly.

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

llvm-svn: 346855
2018-11-14 13:01:15 +00:00
George Rimar 7cdb22b1ef Revert r346848 "[LLDB] - Support the single file split DWARF."
It broke BB:
http://green.lab.llvm.org/green/job/lldb-cmake/12522/testReport/junit/LLDB/Breakpoint/single_file_split_dwarf_test/

llvm-svn: 346853
2018-11-14 12:04:31 +00:00
Pavel Labath 18e9864501 Fix a crash when parsing incorrect DWARF
Summary:
While parsing a childless compile unit DIE we could crash if the DIE was
followed by any extra data (such as a superfluous end-of-children
marker). This happened because the break-on-depth=0 check was performed
only when parsing the null DIE, which was not correct because with a
childless root DIE, we could reach the end of the unit without ever
encountering the null DIE.

If the compile unit contribution ended directly after the CU DIE,
everything would be fine as we would terminate parsing due to reaching
EOF. However, if the contribution contained extra data (perhaps a
superfluous end-of-children marker), we would crash because we would
treat that data as the begging of another compile unit.

This fixes the crash by moving the depth=0 check to a more generic
place, and also adds a regression test.

Reviewers: clayborg, jankratochvil, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 346849
2018-11-14 11:12:40 +00:00
George Rimar 98963db57d [LLDB] - Support the single file split DWARF.
DWARF5 spec describes a single file split dwarf case
(when .dwo sections are in the .o files).

Problem is that LLDB does not work correctly in that case.
The issue is that, for example, both .debug_info and .debug_info.dwo
has the same type: eSectionTypeDWARFDebugInfo. And when code searches
section by type it might find the regular debug section
and not the .dwo one.

The patch fixes that. With it, LLDB is able to work with
output compiled with -gsplit-dwarf=single flag correctly.

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

llvm-svn: 346848
2018-11-14 10:35:14 +00:00
Adrian Prantl 874e32dcf2 Fix a bug in the parsing of the LC_BUILD_VERSION Mach-O load command.
LC_BUILD_VERSION records are of variable length. The original code
would use uninitialized memory when the size of a record was exactly 24.

rdar://problem/46032185

llvm-svn: 346812
2018-11-13 23:14:37 +00:00
Zachary Turner 2af3416618 [NativePDB] Add support for S_CONSTANT records.
clang-cl does not emit these, but MSVC does, so we need to be able to
handle them.

Because clang-cl does not generate them, it was a bit hard to write a
test. So what I had to do was get an PDB file with some S_CONSTANT
records in using cl and link, dump it using llvm-pdbutil dump -globals
-sym-data to get the bytes of the records, generate the same object file
using clang-cl but with -S to emit an assembly file, and replace all the
S_LDATA32 records with the bytes of the S_CONSTANT records. This way, we
can compile the file using llvm-mc and link it with lld-link.

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

llvm-svn: 346787
2018-11-13 20:07:57 +00:00
Zachary Turner 03a24052f3 [NativePDB] Improved support for nested type reconstruction.
In a previous patch, we pre-processed the TPI stream in order to build
the reverse mapping from nested type -> parent type so that we could
accurately reconstruct a DeclContext hierarchy.

However, there were some issues. An LF_NESTTYPE record is really just a
typedef, so although it happens to be used to indicate the name of the
nested type and referring to the global record which defines the type,
it is also used for every other kind of nested typedef. When we rebuild
the DeclContext hierarchy, we want it to be as accurate as possible,
which means that if we have something like:

  struct A {
    struct B {};
    using C = B;
  };

We don't want to create two CXXRecordDecls in the AST each with the
exact same definition. We just want to create one for B and then
define C as an alias to B. Previously, however, it would not be able
to distinguish between the two cases and it would treat A::B and
A::C as being two classes each with separate definitions. We address
the first half of improving the pre-processing logic so that only
actual definitions are treated this way.

Later, in a followup patch, we can handle the case of nested
typedefs since we're already going to be enumerating the field list
anyway and this patch introduces the general framework for
distinguishing between the two cases.

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

llvm-svn: 346786
2018-11-13 20:07:32 +00:00
Aleksandr Urakov 63e4ebccfc [PDB] Fix `vbases.test` requirement
Differential revision: https://reviews.llvm.org/D53506

llvm-svn: 346672
2018-11-12 16:45:55 +00:00
Aleksandr Urakov 1dc51db757 [ClangASTContext] Extract VTable pointers from C++ objects
This patch processes the case of retrieving a virtual base when the object is
already read from the debuggee memory.

To achieve that ValueObject::GetCPPVTableAddress was removed and was
reimplemented in ClangASTContext (because access to the process is needed to
retrieve the VTable pointer in general, and because this is the only place that
used old version of ValueObject::GetCPPVTableAddress).

This patch allows to use real object's VTable instead of searching virtual bases
by offsets restored by MicrosoftRecordLayoutBuilder. PDB has no enough info to
restore VBase offsets properly, so we have to read real VTable instead.

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

llvm-svn: 346669
2018-11-12 16:23:50 +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
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
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
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
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
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
Zachary Turner 40d95a27a2 Make sure to have lit load the configured site config first.
For the lldb unit test suite, we forgot to add the mapping from
site config to main config, so when it found the main config in
the source tree, it wasn't going and loading the configured version
in the build tree first, so the required properties weren't getting
set up properly.

llvm-svn: 346057
2018-11-03 00:06:37 +00:00
Zachary Turner 53793e4d8e Fix the lit test suite.
This change was accidentally missed from the original changeset.

llvm-svn: 346046
2018-11-02 22:02:09 +00:00
Zachary Turner 66f7b435ed Fix a bug in the lit test suite generation.
I'm not sure why this has to be CMAKE_CURRENT_SOURCE_DIR, but
it causes all kinds of strange cmake generation errors when it's
the binary dir.

llvm-svn: 346035
2018-11-02 19:55:15 +00:00
Zachary Turner b6355cc561 Refactor the lit configuration files
A year or so ago, I re-wrote most of the lit infrastructure in LLVM so
that it wasn't so boilerplate-y. I added lots of common helper type
stuff, simplifed usage patterns, and made the code more elegant and
maintainable.

We migrated to this in LLVM, clang, and lld's lit files, but not in
LLDBs. This started to bite me recently, as the 4 most recent times I
tried to run the lit test suite in LLDB on a fresh checkout the first
thing that would happen is that python would just start crashing with
unhelpful backtraces and I would have to spend time investigating.

You can reproduce this today by doing a fresh cmake generation, doing
ninja lldb and then python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile at
which point you'll get a segfault that tells you nothing about what your
problem is.

I started trying to fix the issues with bandaids, but it became clear
that the proper solution was to just bring in the work I did in the rest
of the projects. The side benefit of this is that the lit configuration
files become much cleaner and more understandable as a result.

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

llvm-svn: 346008
2018-11-02 17:49:01 +00:00
Aleksandr Urakov 86746bd1a8 [NativePDB] Make tests work on x86 too
Summary:
This patch fixes the NativePDB tests to make them work from x86 command line too

Reviewers: zturner, stella.stamenova

Subscribers: aleksandr.urakov, teemperor, lldb-commits

Tags: #lldb

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

llvm-svn: 345974
2018-11-02 14:15:29 +00:00
George Rimar 5497f6580e [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.
This adds support for DW_RLE_base_addressx, DW_RLE_startx_endx,
DW_RLE_startx_length, DW_FORM_rnglistx.

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

llvm-svn: 345958
2018-11-02 09:03:25 +00:00
Zachary Turner 544a66d8bb [NativePDB] Get LLDB types from PDB function types.
This adds basic support for getting function signature types
into LLDB's type system, including into clang's AST.  There are
a few edge cases which are not correctly handled, mostly dealing
with nested classes, but this isn't specific to functions and
apply equally to variable types.  Note that no attempt has been
made yet to deal with member function types, which will happen
in subsequent patches.

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

llvm-svn: 345848
2018-11-01 16:37:29 +00:00
Aleksandr Urakov 9d5b2d4adc [Windows] A basic implementation of memory allocations in a debuggee process
Summary:
This patch adds a basic implementation of `DoAllocateMemory` and
`DoDeallocateMemory` for Windows processes. For now it considers only the
executable permission (and always allows reads and writes).

Reviewers: zturner, asmith, stella.stamenova, labath, clayborg

Reviewed By: zturner

Subscribers: Hui, vsk, jingham, aleksandr.urakov, clayborg, abidh, teemperor, lldb-commits

Tags: #lldb

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

llvm-svn: 345815
2018-11-01 08:54:38 +00:00
George Rimar c3e5dec0b0 [LLDB] - Add support for DW_FORM_addrx[1-4]? forms.
This adds the support for DW_FORM_addrx, DW_FORM_addrx1, 
DW_FORM_addrx2, DW_FORM_addrx3, DW_FORM_addrx4 forms.

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

llvm-svn: 345706
2018-10-31 10:14:03 +00:00
Zachary Turner 511bff21b4 [NativePDB] Add support for dumping global variables of class type.
Previous patches added support for dumping global variables of
primitive types, so we now do the same for class types.

For the most part, everything just worked, there was only one
minor bug needing fixed, which was that for variables of modified
types (e.g. const, volatile, etc) we can't resolve the forward
decl in CreateAndCacheType because the PdbSymUid must point to the
LF_MODIFIER which must point to the forward decl.  So when it comes
time to call CompleteType, an assert was firing because we expected
to get a class, struct, union, or enum, but we were getting an
LF_MODIFIER instead.

The other issue is that one the newly added tests is for an array
member, which was not yet supported, so we add support for that
now in this patch.

There's probably room for other interesting layout test cases
here, but this at least should test the basics.

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

llvm-svn: 345629
2018-10-30 18:57:08 +00:00
Marc-Andre Laperle d8e14a5901 [lldb-mi] Implement -gdb-set breakpoint pending on/off
Summary:
This allows creating pending breakpoint automatically when a location is not found.
This is used by some front-ends instead of doing "-break-insert -f" every time.

See also https://sourceware.org/gdb/onlinedocs/gdb/Set-Breaks.html

Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>

Subscribers: MaskRay, llvm-commits, lldb-commits, ki.stfu

Tags: #lldb

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

llvm-svn: 345563
2018-10-30 03:10:41 +00:00
Jonas Devlieghere 20d5a86793 Fix and rename broken test for `settings write`.
I committed this test without updating the old `settings export` to
settings write. Since the functionality was renamed I also renamed the
test case.

llvm-svn: 345435
2018-10-26 23:01:25 +00:00
Zachary Turner 9f727950a5 [NativePDB] Add the ability to dump dump global variables.
LLDB has the ability to display global variables, even without a running
process, via the target variable command. This is because global
variables are linker initialized, so their values are embedded directly
into the executables. This gives us great power for testing native PDB
functionality in a cross-platform manner, because we don't actually need
a running process. We can just create a target using an EXE file, and
display global variables. And global variables can have arbitrarily
complex types, so in theory we can fully exercise the type system,
record layout, and data formatters for native PDB files and PE/COFF
executables on any host platform, as long as our type does not require a
dynamic initializer.

This patch adds basic support for finding variables by name, and adds an
exhaustive test for fundamental data types and pointers / references to
fundamental data types.

Subsequent patches will extend this to typedefs, classes, pointers to
functions, and other cases.

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

llvm-svn: 345373
2018-10-26 09:06:38 +00:00
Jonas Devlieghere b76e25a26d Add functionality to export settings
For the reproducer feature I need to be able to export and import the
current LLDB configuration. To realize this I've extended the existing
functionality to print settings. With the help of a new formatting
option, we can now write the settings and their values to a file
structured as regular commands.

Concretely the functionality works as follows:

  (lldb) settings export -f /path/to/file

This file contains a bunch of settings set commands, followed by the
setting's name and value.

  ...
  settings set use-external-editor false
  settings set use-color true
  settings set auto-one-line-summaries true
  settings set auto-indent true
  ...

You can import the settings again by either sourcing the file or using
the settings read command.

  (lldb) settings read -f /path/to/file

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

llvm-svn: 345346
2018-10-26 00:00:17 +00:00
George Rimar 7e7f9c1008 Recommit r345127 "[LLDB] - Add support for DW_RLE_base_address and DW_RLE_offset_pair entries (.debug_rnglists)"
With the fix: do not forget to hanlde the DW_RLE_start_end, which seems was
omited/forgotten/removed by mistake.

Original commit message:

The patch implements the support for DW_RLE_base_address and DW_RLE_offset_pair
.debug_rnglists entries

Differential revision: https://reviews.llvm.org/D53140
----
Added : /lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml
Added : /lldb/trunk/lit/Breakpoint/debug_rnglist_offset_pair.test
Modified : /lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
Modified : /lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
Modified : /lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
Modified : /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified : /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

llvm-svn: 345251
2018-10-25 10:25:45 +00:00
Jonas Devlieghere 9c6c201b58 [Settings] Add -force flag to "settings set"
The -force option allows you to pass an empty value to settings set to
reset the value to its default. This means that the following operations
are equivalent:

  settings set -f <setting>
  settings clear <setting>

The motivation for this change is the ability to export and import
settings from LLDB. Because of the way the dumpers work, we don't know
whether a value is going to be the default or not. Hence we cannot use
settings clear and use settings set -f, potentially providing an empty
value.

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

llvm-svn: 345207
2018-10-24 22:04:20 +00:00
George Rimar 8c58a6e7d6 Revert rL345127: [LLDB] - Add support for DW_RLE_base_address and DW_RLE_offset_pair entries
It broke BB:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/11671/consoleFull#434797663d489585b-5106-414a-ac11-3ff90657619c

llvm-svn: 345157
2018-10-24 16:21:56 +00:00
George Rimar e6f7b0b558 [LLDB] - Add support for DW_RLE_base_address and DW_RLE_offset_pair entries (.debug_rnglists)
The patch implements the support for DW_RLE_base_address and DW_RLE_offset_pair
.debug_rnglists entries

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

llvm-svn: 345127
2018-10-24 09:56:20 +00:00
Zachary Turner 2f7efbc9ce [NativePDB] Add basic support for tag types to the native pdb plugin.
This adds support to LLDB for named types (class, struct, union, and
enum).  This is true cross platform support, and hits the PDB file
directly without a dependency on Windows.  Tests are added which
compile a program with certain interesting types and then use
load the target in LLDB and use "type lookup -- <TypeName>" to
dump the layout of the type in LLDB without a running process.

Currently only fields are parsed -- we do not parse methods.  Also
we don't deal with bitfields or virtual bases correctly.  Those
will make good followups.

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

llvm-svn: 345047
2018-10-23 16:37:53 +00:00
George Rimar 1d478900a0 [LLDB] - Add support for DW_RLE_start_end entries (.debug_rnglists)
DWARF5 describes DW_RLE_start_end as:

This is a form of bounded range entry that has two target address operands.
Each operand is the same size as used in DW_FORM_addr. These indicate
the starting and ending addresses, respectively, that define the address range
for which the following location is valid.

The patch implements the support.

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

llvm-svn: 344674
2018-10-17 07:37:26 +00:00
Zachary Turner 71f484c967 Add REQUIRES: lld to SymbolFileNativePDB tests.
llvm-svn: 344431
2018-10-12 23:07:32 +00:00
Zachary Turner 8040eea9cb Try to fix some failures on MacOSX with the NativePDB patch.
This adds -- before any filenames, so that /U doesn't get interpreted
as a command line.

It also adds better error checking, so that we don't get assertions
on the failure path when a file fails to parse as a PDB.

llvm-svn: 344429
2018-10-12 22:57:40 +00:00
Zachary Turner 307f5ae898 Resubmit "Add SymbolFileNativePDB plugin."
This was originally reverted due to some test failures on
Linux.  Those problems turned out to require several additional
patches to lld and clang in order to fix, which have since been
submitted.  This patch is resubmitted unchanged.  All tests now
pass on both Linux and Windows.

llvm-svn: 344409
2018-10-12 19:47:13 +00:00
George Rimar 230adfa96c [LLDB] - Add support for DW_FORM_implicit_const.
LLDB does not support this DWARF5 form atm.
At least gcc emits it in some cases when doing optimization
for abbreviations.

As far I can tell, clang does not support it yet, though
the rest LLVM code already knows about it.

The patch adds the support.

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

llvm-svn: 344328
2018-10-12 09:46:15 +00:00
Zachary Turner e8a6c3eb96 Revert SymbolFileNativePDB plugin.
This was originally causing some test failures on non-Windows
platforms, which required fixes in the compiler and linker.  After
those fixes, however, other tests started failing.  Reverting
temporarily until I can address everything.

llvm-svn: 344279
2018-10-11 18:45:44 +00:00
Zachary Turner e502f8b315 Better support for POSIX paths in PDBs.
While it doesn't make a *ton* of sense for POSIX paths to be
in PDBs, it's possible to occur in real scenarios involving
cross compilation.

The tools need to be able to handle this, because certain types
of debugging scenarios are possible without a running process
and so don't necessarily require you to be on a Windows system.
These include post-mortem debugging and binary forensics (e.g.
using a debugger to disassemble functions and examine symbols
without running the process).

There's changes in clang, LLD, and lldb in this patch.  After
this the cross-platform disassembly and source-list tests pass
on Linux.

Furthermore, the behavior of LLD can now be summarized by a much
simpler rule than before: Unless you specify /pdbsourcepath and
/pdbaltpath, the PDB ends up with paths that are valid within
the context of the machine that the link is performed on.

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

llvm-svn: 344269
2018-10-11 18:01:55 +00:00
Jason Molenda 32762fd29d Upstreaming the BridgeOS device support and the
LC_BUILD_VERSION load command handling - this
commit is a combination of patches by Adrian
Prantl and myself.  llvm::Triple::BridgeOS 
isn't defined yet, so all references to that
are currently commented out.  

Also update Xcode project file to build the 
NativePDB etc plugins.

<rdar://problem/43353615> 

llvm-svn: 344209
2018-10-11 00:28:35 +00:00
Zachary Turner 72148edc36 Create a SymbolFile plugin for cross-platform PDB access.
The existing SymbolFilePDB only works on Windows, as it is written
against a closed-source Microsoft SDK that ships with their debugging
tools.

There are several reasons we want to bypass this and go straight to the
bits of the PDB, but just to list a few:

More room for optimization. We can't see inside the implementation of
the Microsoft SDK, so we don't always know if we're doing things in the
most efficient way possible. For example, setting a breakpoint on main
of a big program currently takes several seconds. With the
implementation here, the time is unnoticeable.
We want to be able to symbolize Windows minidumps even if not on
Windows. Someone should be able to debug Windows minidumps as if they
were on Windows, given that no running process is necessary.
This patch is a very crude first attempt at filling out some of the
basic pieces.

I've implemented FindFunctions, ParseCompileUnitLineTable, and
ResolveSymbolContext for a limited subset of possible parameter values,
which is just enough to get it to display something nice for the
breakpoint location.

I've added several tests exercising this functionality which are limited
enough to work on all platforms but still exercise this functionality.
I'll try to add as many tests of this nature as I can, but at some
point we'll need a live process.

For now, this plugin is enabled always on non-Windows, and by setting
the environment variable LLDB_USE_NATIVE_PDB_READER=1 on Windows.
Eventually, once it's at parity with the Windows implementation, we'll
delete the Windows DIA-based implementation.

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

llvm-svn: 344154
2018-10-10 16:39:07 +00:00
George Rimar 6e357123ed [LLDB] - Add basic support for .debug_rnglists section (DWARF5)
This adds a basic support of the .debug_rnglists section.
Only the DW_RLE_start_length and DW_RLE_end_of_list entries are supported.

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

llvm-svn: 344119
2018-10-10 08:11:15 +00:00
Stefan Granitz 21d1754f7c TestMultilineExpr: validate evaluation for expressions that span multiple lines
Summary:
When LLDB successfully parses a command (like "expression" in this case) and determines incomplete input, the user can continue typing on multiple lines (in this case "2+3"). This should provide the correct result.
Note that LLDB reverts input from the additional lines, so they are not present in the output.

Reviewers: vsk, davide, aprantl

Subscribers: lldb-commits

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

llvm-svn: 343860
2018-10-05 16:49:53 +00:00
Stefan Granitz c678ed774d Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
Summary:
Add settings to control command echoing:
```
(lldb) settings set interpreter.echo-commands true
(lldb) settings set interpreter.echo-comment-commands true
```

Both settings default to true, which keeps LLDB's existing behavior in non-interactive mode (echo all command inputs to the output).

So far the only way to change this behavior was the `--source-quietly` flag, which disables all output including evaluation results.
Now `echo-commands` allows to turn off echoing for commands, while evaluation results are still printed. No effect if `--source-quietly` was present.
`echo-comment-commands` allows to turn off echoing for commands in case they are pure comment lines. No effect if `echo-commands` is false.

Note that the behavior does not change immediately! The new settings take effect only with the next command source.

LLDB lit test are the main motivation for this feature. So far incoming `#CHECK` line have always been echoed to the output and so they could never fail. Now we can disable it in lit-lldb-init.
Todos: Finish test for this feature. Add to lit-lldb-init. Check for failing lit tests.

Reviewers: aprantl, jasonmolenda, JDevlieghere

Subscribers: friss, lldb-commits

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

llvm-svn: 343859
2018-10-05 16:49:47 +00:00
Jonas Devlieghere 64011593dc [Interpreter] Escape backticks when dumping format entities.
Currently we reject our own default disassembly-format string because it
contains two backticks which causes everything in between to be
interpreter as an expression by the command interpreter. This patch
fixes that by escaping backticks when dumping format strings.

llvm-svn: 343471
2018-10-01 13:22:24 +00:00