Commit Graph

18176 Commits

Author SHA1 Message Date
George Rimar e4dee2696e [LLDB] - Implement the support for the .debug_loclists section.
This implements the support for .debug_loclists section, which is
DWARF 5 version of .debug_loc.

Currently, clang is able to emit it with the use of D53365.

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

llvm-svn: 345016
2018-10-23 09:46:15 +00:00
Aleksandr Urakov 356aa4a98e [PDB] Improve performance of the PDB DIA plugin
Summary:
This patch improves performance of `SymbolFilePDB` on huge executables
in two ways:

- cache names of public symbols by address. When creating variables we are
  trying to get a mangled name for each one, and in `GetMangledForPDBData`
  we are enumerating all public symbols, which takes O(n) for each variable.
  With the cache we can retrieve a mangled name in O(log(n));

- cache section contributions. When parsing variables for context we are
  enumerating all variables and check if the current one is belonging
  to the current compiland. So we are retrieving a compiland ID
  for the variable. But in `PDBSymbolData::getCompilandId` for almost every
  variable we are enumerating all section contributions to check if the variable
  is belonging to it, and get a compiland ID from the section contribution
  if so. It takes O(n) for each variable, but with caching it takes about
  O(log(n)). I've placed the cache in `SymbolFilePDB` and have created
  `GetCompilandId` there. It actually duplicates `PDBSymbolData::getCompilandId`
  except for the cache part. Another option is to support caching
  in `PDBSymbolData::getCompilandId` and to place cache in `DIASession`, but it
  seems that the last one doesn't imply such functionality, because
  it's a lightweight wrapper over DIA and whole its state is only a COM pointer
  to the DIA session. Moreover, `PDBSymbolData::getCompilandId` is used only
  inside of `SymbolFilePDB`, so I think that it's not a bad place to do such
  things. With this patch `PDBSymbolData::getCompilandId` is not used at all.

This bottlenecks were found with profiling. I've discovered these on a simple
demo project of Unreal Engine (x86 executable ~72M, PDB ~82M).

This patch doesn't change external behavior of the plugin, so I think that
there's no need for additional testing (already existing tests should warn us
about regress, if any).

Reviewers: zturner, asmith, labath

Reviewed By: asmith

Subscribers: Hui, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 345013
2018-10-23 08:29:17 +00:00
Davide Italiano 70152d3288 [ValueObject] Stop assuming types are non-zero sized.
Some backends might violate this assumption. No test case
upstream unfortunately as this is not the case with C++,
but I'm going to add a test in swift language support.

<rdar://problem/40962410>

llvm-svn: 344982
2018-10-23 00:31:46 +00:00
Jonas Devlieghere a164b162a0 Fix typo in ASSERT_MODULE_LOCK macro definition
llvm-svn: 344979
2018-10-23 00:18:27 +00:00
Vedant Kumar 74533bd3b8 [DWARF] Use a function-local offset for AT_call_return_pc
Logs provided by @stella.stamenova indicate that on Linux, lldb adds a
spurious slide offset to the return PC it loads from AT_call_return_pc
attributes (see the list thread: "[PATCH] D50478: Add support for
artificial tail call frames").

This patch side-steps the issue by getting rid of the load address
calculation in lldb's CallEdge::GetReturnPCAddress.

The idea is to have the DWARF writer emit function-local offsets to the
instruction after a call. I.e. return-pc = label-after-call-insn -
function-entry. LLDB can simply add this offset to the base address of a
function to get the return PC.

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

llvm-svn: 344960
2018-10-22 21:44:21 +00:00
Jonas Devlieghere 4f78c4f67b [SymbolFile] Add the module lock where necessary and assert that we own it.
As discussed with Greg at the dev meeting, we need to ensure we have the
module lock in the SymbolFile. Usually the symbol file is accessed
through the symbol vendor which ensures that the necessary locks are
taken. However, there are a few methods that are accessed by the
expression parser and were lacking the lock.

This patch adds the locking where necessary and everywhere else asserts
that we actually already own the lock.

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

llvm-svn: 344945
2018-10-22 20:14:36 +00:00
Zachary Turner b96181c2bf Some cleanups to the native pdb plugin [NFC].
This is mostly some cleanup done in the process of implementing
some basic support for types.  I tried to split up the patch a
bit to get some of the NFC portion of the patch out into a separate
commit, and this is the result of that.  It moves some code around,
deletes some spurious namespace qualifications, removes some
unnecessary header includes, forward declarations, etc.

llvm-svn: 344913
2018-10-22 16:19:07 +00:00
Aaron Smith 80ed0fd6e0 [PDB] Test variadic function type in PDB
This adds back the test case reverted in commit: d260a269200824c5c1c8c6de531fd5aa63db9c35

llvm-svn: 344809
2018-10-19 19:30:59 +00:00
Aaron Smith c3d447fe26 [lldb] Add support in Status::AsCString to retrieve win32 system error strings
Reviewers: rnk, zturner, aleksandr.urakov

Subscribers: lldb-commits

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

llvm-svn: 344798
2018-10-19 18:58:24 +00:00
Stella Stamenova f6ec77b447 [lldbsuite, windows] Disable two tail call frames tests that fail on Windows
Summary: These tests fail on Windows because of known limitations (a.k.a. bugs) with the current implementation of GetFrameAtIndex

Reviewers: asmith, vsk

Reviewed By: vsk

Subscribers: abidh, lldb-commits

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

llvm-svn: 344788
2018-10-19 16:00:58 +00:00
Michal Gorny b1f4a4b61d [SymbolFileNativePDB] Fix missing linkage to DebugInfoCodeView
Differential Revision: https://reviews.llvm.org/D53402

llvm-svn: 344746
2018-10-18 15:39:22 +00:00
Stella Stamenova c3439b0995 [lldbsuite] Mark the TestScriptedResolver tests as XFAIL on Windows
Summary: They fail similarly to some of the other breakpoint tests on Windows, so I suspect the cause is the same. I've linked to the same bug.

Reviewers: asmith, zturner, jingham

Subscribers: abidh, lldb-commits

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

llvm-svn: 344744
2018-10-18 15:30:31 +00:00
Aleksandr Urakov 64c92df7cb [Windows] Fix threads comparison on Windows
Summary:
This patch makes Windows threads to compare by a thread ID, not by a handle.
It's because the same thread can have different handles on Windows
(for example, `GetCurrentThread` always returns the fake handle `-2`).
This leads to some incorrect behavior. For example, in `Process::GetRunLock`
always `m_public_run_lock` is returned without this patch.

Reviewers: zturner, clayborg, stella.stamenova

Reviewed By: stella.stamenova

Subscribers: stella.stamenova, lldb-commits

Tags: #lldb

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

llvm-svn: 344729
2018-10-18 07:52:56 +00:00
Krasimir Georgiev a35912da9f Revert "Return a named error in the result object of an expression with no result"
This reverts commit r344647.
This causes build failures with [-Werror, -Wswitch]. Some cases where the newly
introduced enum value is not handled in particular are in:
  lldb/source/Expression/REPL.cpp:350
  lldb/source/Interpreter/CommandInterpreter.cpp:1529
(maybe there could be more)

As I don't understand lldb to make sure the likely trivial fixes are
correct and also as they might need additional tests, leaving to the
author to resolve.

llvm-svn: 344722
2018-10-18 03:10:43 +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
Adrian Prantl af67fe6aef Delete commented-out code.
llvm-svn: 344648
2018-10-16 22:01:49 +00:00
Jim Ingham b1ecc3cac2 Return a named error in the result object of an expression with no result
Before we returned an error that was not exposed in the SB API and no useful
error message.  This change returns eExpressionProducedNoResult and an
appropriate error string.

<rdar://problem/44539514>

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

llvm-svn: 344647
2018-10-16 21:58:40 +00:00
Jason Molenda d33f6e73e1 Fixed an issue that a bot found with my changes
in r344626 & recommitting.  Original commit msg:


Simplify LocateDSYMInVincinityOfExecutable by moving
some redundant code into a separate function, 
LookForDsymNextToExecutablePath, and having that function
also look for .dSYM.yaa files in addition to .dSYM
bundles.

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

<rdar://problem/40406580> 

llvm-svn: 344646
2018-10-16 21:49:31 +00:00
Jan Kratochvil ea58c633e6 Code cleanup: Remove DWARFDebugInfoEntry::m_empty_children
It merges DWARFDebugInfoEntry's m_empty_children into m_has_children.
m_empty_children was implemented by rL144983.

As Greg confirmed m_has_children was used to represent what was in the DWARF in
the byte that follows the DW_TAG. m_empty_children was used for DIEs that said
they had children but actually only contain a single NULL tag. It is fine to
not differentiate between the two.

Also changed assert()->lldbassert() for m_abbr_idx 16-bit overflow check as
that could be a tough bug to catch if it ever happens.

I have checked all calls of HasChildren() that this change should not matter to
them. The code even wants to know if there are any children - it does not
matter how the children presence is coded in the binary.

Patch written based on suggestions by Greg Clayton.

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

llvm-svn: 344644
2018-10-16 20:49:15 +00:00
Jason Molenda b4285bcacc Revert r344626 while I address a testsuite failure from a bot.
llvm-svn: 344636
2018-10-16 18:25:46 +00:00
Jason Molenda 0128e7f540 Tiny testsuite tweaks. Don't run the apple simulator
tests when targetting a device.  Add an include to 
safe-to-call-func to work around a modules issue with
a certain combination of header files.  Add rules for
Darwin systems to ad-hoc codesign binaries that the
testsuite builds.

llvm-svn: 344635
2018-10-16 18:14:30 +00:00
Vedant Kumar 2493707818 Use a relaxed substring check for function names in a test
The TestTailCallFrameSBAPI.py test checks that function names in a
backtrace are equal to an expected value.

Use a relaxed substring check because function dislpay names are
platform-dependent. E.g we see "void sink(void)" on Windows, but "sink()" on
Darwin. This seems like a bug -- just work around it for now.

llvm-svn: 344634
2018-10-16 18:13:42 +00:00
Jason Molenda 696569d757 Don't run TestBreakpointIt.py on arm64 devices;
it is armv7 specific.

llvm-svn: 344633
2018-10-16 18:11:17 +00:00
Jason Molenda d3ff1ecfde For a built & test bot, add an environment variable PLATFORM_SDK_DIRECTORY,
which PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded
which examine for any additional SDK directories when it is
constructing its list.

<rdar://problem/42984340>
<rdar://problem/41351223>

llvm-svn: 344628
2018-10-16 17:31:33 +00:00
Jason Molenda 4503c514d9 Simplify LocateDSYMInVincinityOfExecutable by moving
some redundant code into a separate function, 
LookForDsymNextToExecutablePath, and having that function
also look for .dSYM.yaa files in addition to .dSYM
bundles.

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

<rdar://problem/40406580> 

llvm-svn: 344626
2018-10-16 17:26:04 +00:00
Stella Stamenova e05451b73b [lldbsuite] Fix the mac version decorator to work on non-mac platforms
Summary: On non-mac platforms, mac_ver returns an empty string which when converted to LooseVersion has no "version" property. This causes a failure when the decorator executes. Instead, check whether the value returned from mac_ver is an empty string and avoid the LooseVersion comparison.

Reviewers: labath, davide, asmith, shafik, jingham

Reviewed By: jingham

Subscribers: jingham, lldb-commits

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

llvm-svn: 344623
2018-10-16 17:13:45 +00:00
Jan Kratochvil faec6dd9a2 Fix: Assertion failed: (!m_first_die || m_first_die == m_die_array.front()), function ExtractDIEsRWLocked
xbolva00 bugreported $subj in: https://reviews.llvm.org/D46810#1247410
It can happen only from the line:
	m_die_array.back().SetEmptyChildren(true);

In the case DW_TAG_compile_unit has DW_CHILDREN_yes but there is only 0 (end of
list, no children present). Therefore the assertion can fortunately happen only
with a hand-crafted DWARF or with DWARF from some suboptimal compilers.

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

llvm-svn: 344605
2018-10-16 11:38:22 +00:00
Vedant Kumar b48515a44e Use assertEqual to improve test failure logging
Some tests in test/functionalities/tail_call_frames are failing on
non-Darwin platforms. Use assertEqual to improve logging on failure.

llvm-svn: 344581
2018-10-16 03:31:33 +00:00
Adrian Prantl 212e23d015 Convert code to use early exits in prepraration for future changes. (NFC)
llvm-svn: 344557
2018-10-15 21:35:45 +00:00
Stella Stamenova 7a8865cea8 [lldbsuite] Make the names of test classes unique
Summary:
If the names are not unique, the tests overwrite each other's results and logs. This also causes failures on platforms where the files are locked for writing.

The names of the class/test pairs *have to* always be unique. The easiest way to achieve that is to name each class differently (usually the same as the file name).

Reviewers: jasonmolenda, asmith

Subscribers: clayborg, nemanjai, kbarton, lldb-commits

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

llvm-svn: 344547
2018-10-15 19:51:21 +00:00
Stella Stamenova abe3c7d841 [lldbsuite] Disable Test128BitsInteger on Windows
Summary: This test is failing on Windows because lldb does not support JIT on Windows.

Reviewers: davide, asmith

Reviewed By: davide

Subscribers: lldb-commits

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

llvm-svn: 344543
2018-10-15 18:51:28 +00:00
Vadim Chugunov 74587a0e48 Fix double import of _lldb module.
Fix llvm.org/pr39054:
- Register _lldb as a built-in module during initialization of script interpreter,
- Reverse the order of imports in __init__.py: first try to import by absolute name, which will find the built-in module in the context of lldb (and other hosts that embed liblldb), then try relative import, in case the module is being imported from Python interpreter.

This works for SWIG>=3.0.11; before that, SWIG did not support custom module import code.

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

llvm-svn: 344474
2018-10-14 07:24:56 +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
Jim Ingham 16aec506ae Change the default handling for SIGPIPE to pass/,no-stop/no-notify.
Most of the time SIGPIPE is just annoying, and so we should
pass it on silently it by default.

<rdar://problem/39359145>

llvm-svn: 344418
2018-10-12 21:27:49 +00:00
Jason Molenda a84c7485cf Add NativePDB subdir again.
llvm-svn: 344414
2018-10-12 20:53:21 +00:00
Stella Stamenova 8003485cbf Fix failure in get_filecheck_path when filecheck is None
If the path was not specified (and it's None), lexists throws an exception rather than returning False. get_filecheck_path now checks whether filecheck is set before calling lexists

llvm-svn: 344410
2018-10-12 20:00:20 +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
Shafik Yaghmour 730985b1b3 Changing test names in TestDataFormatterLibcxxVariant.py and TestStdFunctionStepIntoCallable.py to be unique, NFC
llvm-svn: 344407
2018-10-12 19:46:17 +00:00
Vedant Kumar 8e2f09d615 [dotest] Make a missing FileCheck binary a warning, not an error
This allows bots which haven't updated to pass in --filecheck to
dotest.py to run more tests. FileCheck-dependent tests will continue to
fail.

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

llvm-svn: 344401
2018-10-12 19:29:59 +00:00
Jim Ingham 9082c1c0c1 Add "v" as well as "var" as an alias for "frame var".
<rdar://problem/40066460>

llvm-svn: 344397
2018-10-12 18:46:02 +00:00
Stella Stamenova 073d21fad0 [lldbsuite] Fix the filecheck functionality to work with Python 3
Summary: This is another string/byte conversion issue between Python 2 and 3. In Python 2, the subprocess communication expects a byte string, but in Python 3, it expects bytes. Since both versions are capable of using strings when universal_newlines is set to True AND filecheck operates on strings, force the use of strings.

Reviewers: zturner, asmith, vsk

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 344386
2018-10-12 17:56:01 +00:00
Shafik Yaghmour aa30268539 Adding support to step into the callable wrapped by libc++ std::function
rdar://problem/14365983

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

llvm-svn: 344371
2018-10-12 17:20:39 +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
Jason Molenda 74ccc7aed0 Remove references to source/Plugins/SymbolFile/NativePDB.
llvm-svn: 344323
2018-10-12 00:53:55 +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
Jason Molenda 25b3900f9f Fix this comment so it is consistent with all the others.
llvm-svn: 344277
2018-10-11 18:41:34 +00:00
Jason Molenda dcb3c28fd8 Don't mark an LC_BUILD_VERSION as giving us a
correct version if it has a major verison 0.

llvm-svn: 344275
2018-10-11 18:37:53 +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
Eric Liu 75f8c16e48 [lldb] Surpress copy-elison warning.
llvm-svn: 344252
2018-10-11 14:52:33 +00:00
Eric Liu 7d2f783e7d [lldb] rename MinOS::minor to MinOS::minor_version etc. NFC
The constructor initializer minor(...)/major(...) can be confused with system
macros `#define minor(...)` on some platforms.

llvm-svn: 344250
2018-10-11 14:44:12 +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 39965f5d78 [SymbolFileNativePDB] Fix compilation errors with gcc.
llvm-svn: 344173
2018-10-10 18:52:37 +00:00
Aaron Smith e303790430 [Windows] Fix a bug that causes lldb to freeze
Summary:
If the process exits before any initial stop then notify the debugger 
of the error otherwise WaitForDebuggerConnection() will be blocked.
An example of this issue is when a process fails to load a dependent DLL.

In addition to the fix, remove a duplicate call to FreeProcessHandles() in 
DebuggerThread::HandleExitProcessEvent() and use decimal format 
for all thread IDs.

Reviewers: rnk, zturner, aleksandr.urakov

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 344168
2018-10-10 18:30:32 +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 60b6f140cf [LLDB] - Simplify. NFC.
There are several places that call `FindRanges`,
all of them use `Slide` to adjust the ranges found
by the base address. 
All except one, which does the same manually in a loop.
Patch updates it to use `Slide` for consistency.

llvm-svn: 344122
2018-10-10 08:49:17 +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
Jim Ingham 285ae0c07b Add "var" and "vo" aliases for "frame variable" and "frame variable -O".
Differential Revision: https://reviews.llvm.org/D53010

llvm-svn: 344102
2018-10-10 00:51:30 +00:00
Vedant Kumar 4b36f7911d Add support for artificial tail call frames
This patch teaches lldb to detect when there are missing frames in a
backtrace due to a sequence of tail calls, and to fill in the backtrace
with artificial tail call frames when this happens. This is only done
when the execution history can be determined from the call graph and
from the return PC addresses of calls on the stack. Ambiguous sequences
of tail calls (e.g anything involving tail calls and recursion) are
detected and ignored.

Depends on D49887.

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

llvm-svn: 343900
2018-10-05 23:23:15 +00:00
Vedant Kumar 9d9c965544 Relax a data formatter test
Before inspecting the contents of a list, make sure that we've stepped
past the push_back() that inserts the element we're interested in.

llvm-svn: 343899
2018-10-05 23:14:13 +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
Bruce Mitchener 173946dca6 Fix typos.
Reviewers: lldb-commits

Subscribers: srhines, ki.stfu

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

llvm-svn: 343825
2018-10-04 22:33:39 +00:00
Brad Smith ceddf2385d The Python 3 part of the script was missed when adding OpenBSD support.
llvm-svn: 343810
2018-10-04 20:34:58 +00:00
Tatyana Krasnukha 320bf4157b Re-commit r343500 "Fix build with GCC < 5.0 (PR39131)"
Occasionally didn't commit actual fix the first time.

llvm-svn: 343769
2018-10-04 11:39:55 +00:00
Jan Kratochvil 0e99f561e1 Fix buildbot regression by rL339929: NameError: global name 'test_directory' is not defined
With buildbot slave under test - I get after rL339929:
http://lab.llvm.org:8014/builders/lldb-x86_64-fedora-28-cmake/builds/243/steps/test1/logs/stdio

  File "/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/scripts/../llvm/tools/lldb/test/dotest.py", line 7, in <module>
    lldbsuite.test.run_suite()
  File "/quad/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/llvm/tools/lldb/packages/Python/lldbsuite/test/dotest.py", line 1177, in run_suite
    configuration.results_formatter_object)
  File "/quad/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/llvm/tools/lldb/packages/Python/lldbsuite/test/dosep.py", line 1692, in main
    dst = core.replace(test_directory, "")[1:]
NameError: global name 'test_directory' is not defined

Patch by Vedant Kumar.

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

llvm-svn: 343726
2018-10-03 21:42:54 +00:00
Shafik Yaghmour d2fcbbab3a Adding skipIf to std::variant libc++ data-formatter test since get is not available before macOS 10.14
Patch by Shafik Yaghmour

llvm-svn: 343718
2018-10-03 20:52:56 +00:00
Adrian Prantl 1c8ed2081f Skip test with older versions of clang
llvm-svn: 343695
2018-10-03 16:24:14 +00:00
Pavel Labath aef7908f6e Pull FixupBreakpointPCAsNeeded into base class
Summary:
This function existed (with identical code) in both NativeProcessLinux
and NativeProcessNetBSD, and it is likely that it would be useful to any
future implementation of NativeProcessProtocol.

Therefore I move it to the base class.

Reviewers: krytarowski

Subscribers: lldb-commits

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

llvm-svn: 343683
2018-10-03 12:29:33 +00:00
Adrian Prantl be50052a2b Remove unnecessary field
llvm-svn: 343624
2018-10-02 20:14:12 +00:00
Adrian Prantl f796e763b2 DWARFExpression: Resolve file addresses in the linked module
This is a follow-up to https://reviews.llvm.org/D46362.

When evaluating a complex expression in DWARFExpression::Evaluate,
file addresses must be resolved to load addresses before we can
perform operations such as DW_OP_deref on them.

For this the address goes through three steps

1. Read the file address as stored in the DWARF
2. Link/relocate the file address (when reading from a .dSYM, this is a no-op)
3. Convert the file address to a load address.

D46362 implemented step (3) by resolving the file address using the
Module that the original DWARF came from. In the case of a dSYM that
is correct, but when reading from .o files, we need to look up
relocated/linked addresses, so the right place to look them up is the
current frame's module. This patch fixes that by setting the
expression's Module to point to the linked debugmap object.

A word a bout the unorthodox testcase: The motivating testcase for
this fix is in Swift, but I managed to hand-modify LLVM-IR for a
trivial C program to exhibit the same problem, so we can fix this in
llvm.org.

rdar://problem/44689915

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

llvm-svn: 343612
2018-10-02 17:50:42 +00:00
Tatyana Krasnukha f85f1408f6 Remove GetPythonDir declaration from HostInfoBase class
llvm-svn: 343609
2018-10-02 17:24:58 +00:00
Adrian Prantl 7fd4513920 Enable C++ tests to run in the -gmodules configuration on Darwin.
This addresses PR36048 (http://llvm.org/bugs/show_bug.cgi?id=36048)

rdar://problem/36776281

llvm-svn: 343545
2018-10-01 22:27:42 +00:00
Jonas Devlieghere 23b62aa6d4 Fix tests affected by printing change.
I forgot to update some tests that were affected by the escaping of
backticks in the format string, landed in r343471.

llvm-svn: 343502
2018-10-01 17:20:57 +00:00
Tatyana Krasnukha 0fff5a87ca Fix build with GCC < 5.0 (PR39131)
llvm-svn: 343500
2018-10-01 17:14:12 +00:00
Aaron Smith e7dbb93360 [lldb] Start a new line for the next output if there are no symbols in the current symtab
Summary:
If there is no newline the "lldb" prompt could be on the wrong line. To reproduce the missing newline you can do 'image dump smytab' on any binary.

Previously

Symtab, file = D:\upstream\build\Debug\bin\clang-diff.exe, num_symbols = 0(lldb)

Now

Symtab, file = D:\upstream\build\Debug\bin\clang-diff.exe, num_symbols = 0
(lldb)

Reviewers: zturner, aleksandr.urakov, lldb-commits

Subscribers: abidh

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

llvm-svn: 343497
2018-10-01 17:08:51 +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
Jonas Devlieghere e43be156eb Escape newlines in default disassembly format.
We can safely escape newlines in format strings because they will be
ignored by the format entity parser.

llvm-svn: 343470
2018-10-01 13:20:15 +00:00
Pavel Labath 5cd7be3c17 Fix NetBSD build for r343409
Forgot to remove the method declaration from the header.

llvm-svn: 343411
2018-09-30 16:12:09 +00:00
Pavel Labath 99f436b055 Pull GetSoftwareBreakpointPCOffset into base class
Summary:
This function encodes the knowledge of whether the PC points to the
breakpoint instruction of the one following it after the breakpoint is
"hit". This behavior mainly(*) depends on the architecture and not on the
OS, so it makes sense for it to be implemented in the base class, where
it can be shared between different implementations (Linux and NetBSD
atm).

(*) It is possible for an OS to expose a different API, perhaps by doing
some fixups in the kernel. In this case, the implementation can override
this function to implement custom behavior.

Reviewers: krytarowski, zturner

Subscribers: lldb-commits

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

llvm-svn: 343409
2018-09-30 15:58:52 +00:00
Davide Italiano e174746c5e [SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().
<rdar://problem/44875808>

llvm-svn: 343368
2018-09-28 23:27:54 +00:00
Tatyana Krasnukha c06db02748 [Driver] Remove unused declarations and "include" directives
llvm-svn: 343357
2018-09-28 19:58:03 +00:00
Tatyana Krasnukha 5ce9dc614d Clean-up usage of OptionDefinition arrays
Differential Revision: https://reviews.llvm.org/D52604

llvm-svn: 343348
2018-09-28 17:58:16 +00:00
Luke Cheeseman cea130b0e0 Revert r343318 together with llvm commit r343317
llvm-svn: 343342
2018-09-28 17:02:56 +00:00
Luke Cheeseman c564f5d4db Reapply the changes reverted by r343236
llvm-svn: 343318
2018-09-28 13:38:16 +00:00
Aleksandr Urakov ec97b523be [PDB] Handle `char` as a builtin type
Summary:
`char`, `signed char` and `unsigned char` are three different types,
and they are mangled differently:

```
void __declspec(dllexport) /* ?foo@@YAXD@Z */ foo(char c) { }
void __declspec(dllexport) /* ?foo@@YAXE@Z */ foo(unsigned char c) { }
void __declspec(dllexport) /* ?foo@@YAXC@Z */ foo(signed char c) { }
```

This commit separates `char` from `signed char` and `unsigned char`.

Reviewers: asmith, zturner, labath

Reviewed By: asmith, zturner

Subscribers: teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 343298
2018-09-28 07:59:49 +00:00
Aaron Smith 2fc9c3b05f [lldb] Remove an assertion in RichManglingContext::GetBufferRef() hit when debugging a native x86 Windows process
Summary: A RichManglingContext constructed with an invalid demangled name or with a demangled function name without any context will have an empty context. This triggers an assertion in RichManglingContext::GetBufferRef() when debugging a native Windows process on x86 when it shouldn't. Remove the assertion.

Reviewers: aleksandr.urakov, zturner, lldb-commits

Reviewed By: zturner

Subscribers: erik.pilkington

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

llvm-svn: 343292
2018-09-28 02:33:51 +00:00
Greg Clayton 141f208e12 Fixes for GDB remote packet disassembler:
- Add latency timings to GDB packet log summary if timestamps are on log
- Add the ability to plot the latencies for each packet type with --plot
- Don't crash the script when target xml register info is in wierd format

llvm-svn: 343243
2018-09-27 17:55:36 +00:00
Greg Clayton 95c23f6643 Add an interactive mode to BSD archive parser.
llvm-svn: 343242
2018-09-27 17:45:14 +00:00
Luke Cheeseman 66217a3bad Revert r343193 together with r343192
llvm-svn: 343236
2018-09-27 16:48:04 +00:00
Luke Cheeseman 1a7018f6f5 Update CallFrameString API to account for r343114
- CallFrameString now takes an Arch parameter to account for multiplexing
  overlapping CFI directives

llvm-svn: 343193
2018-09-27 10:42:14 +00:00
Raphael Isemann dababf70e2 Refactor ClangUserExpression::GetLanguageForExpr
Summary:
The `ClangUserExpression::GetLanguageForExpr` method is currently a big
source of sadness, as it's name implies that it's an accessor method, but it actually
is also initializing some variables that we need for parsing. This caused that we
currently call this getter just for it's side effects while ignoring it's return value,
which is confusing for the reader.

This patch renames it to `UpdateLanguageForExpr` and merges all calls to the
method into a single call in `ClangUserExpression::PrepareForParsing` (as calling
this method is anyway mandatory for parsing to succeed)

While looking at the code, I also found that we actually have two language
variables in this class hierarchy. The normal `Language` from the UserExpression
class and the `LanguageForExpr` that we implemented in this subclass. Both
don't seem to actually contain the same value, so we probably should look at this
next.

Reviewers: xbolva00

Reviewed By: xbolva00

Subscribers: lldb-commits

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

llvm-svn: 343191
2018-09-27 10:12:54 +00:00
Tatyana Krasnukha e40db05b27 Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef
Differential Revision: https://reviews.llvm.org/D52572

llvm-svn: 343181
2018-09-27 07:11:58 +00:00
Jonas Devlieghere 041e68fe1e [target] Fix typo and give bool a default value
This addresses Stella's review feedback in D51859.

llvm-svn: 343180
2018-09-27 06:59:15 +00:00
Fangrui Song 23a6119619 llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
The convenience wrapper in STLExtras is available since rL342102.

llvm-svn: 343164
2018-09-27 03:35:05 +00:00
Tatyana Krasnukha f929e2b073 Fix ProcessKDP after r343130
llvm-svn: 343141
2018-09-26 20:31:39 +00:00
Tatyana Krasnukha d286886e96 Fix OSX build after r343130
llvm-svn: 343134
2018-09-26 19:41:57 +00:00
Tatyana Krasnukha 8fe53c490a Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm::ArrayRef
Differential Revision: https://reviews.llvm.org/D49017

llvm-svn: 343130
2018-09-26 18:50:19 +00:00
Jonas Devlieghere 9123b7ebea [unittest] Fix NativeProcessProtocolTest.cpp (NFC)
Cast std::min's second argument to size_t to prevent conflicting types
for parameter deduction.

llvm-svn: 343087
2018-09-26 10:09:44 +00:00
Aleksandr Urakov bc4707cc17 [PDB] Restore the calling convention from PDB
Summary:
This patch implements restoring of the calling convention from PDB.
It is necessary for expressions evaluation, if we want to call a function
of the debuggee process with a calling convention other than ccall.

Reviewers: clayborg, zturner, labath, asmith

Reviewed By: clayborg

Subscribers: teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 343084
2018-09-26 09:03:34 +00:00
Pavel Labath 0ae4022aa0 Fix a memory read bug in lldb-server
NativeProcessProtocol::ReadMemoryWithoutTrap had a bug, where it failed
to properly remove inserted breakpoint opcodes if the memory read
partially overlapped the trap opcode. This could not happen on x86
because it has a one-byte breakpoint instruction, but it could happen on
arm, which has a 4-byte breakpoint instruction (in arm mode).

Since triggerring this condition would only be possible on an arm
machine (and even then it would be a bit tricky). I test this using a
NativeProcessProtocol unit test.

llvm-svn: 343076
2018-09-26 07:31:41 +00:00
Alexander Polyakov 24b6d3690c [lldb-mi] Fix bugs in target-select-so-path.test
Summary:
* This patch fixes hanging of the test in case of using python3, changes callback
  function that will be called if the timer ends, changes python interpreter to
  `%python` that is set up by llvm-lit.
* Also, the test didn't work properly since it didn't contain a call of
  filecheck_proc.communicate(), that means that filecheck didn't run and its
  return code was equal to 0 in all cases.

Reviewers: teemperor, labath, tatyana-krasnukha, aprantl

Reviewed By: teemperor, labath

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 343033
2018-09-25 21:49:33 +00:00
Jason Molenda a11b3fe26f Change the unwinder to not use a hard-coded limit on the
max number of stack frames to backtrace, make it a setting,
target.process.thread.max-backtrace-depth.
Add a test case for the setting.

<rdar://problem/28759559> 

llvm-svn: 343029
2018-09-25 21:01:54 +00:00
Vedant Kumar 75606b285c [lldbinline] Set directory attribute on test-specific classes
Set the "mydir" attribute of an inline test on the test-specific class,
instead of on the base InlineTest class.

This makes it possible to run dotest.py on a directory containing inline
tests. This wasn't really possible prior to this patch, because what
would happen is that one test would just run over and over again, even
though the test infrastructure would claim that different tests were
being run.

Example:

The test infrastructure claimed that all of these different tests were passing,
which couldn't be true --

$ ./bin/lldb-dotest /Users/vsk/src/tailcall/lldb/test/testcases/functionalities/tail_call_frames/ -G dwarf -t 2>&1 | grep PASS
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestDisambiguateTailCallSeq)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestArtificialFrameStepOutMessage)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestAmbiguousTailCallSeq1)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestDisambiguatePathsToCommonSink)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestDisambiguateCallSite)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestUnambiguousTailCalls)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestAmbiguousTailCallSeq2)
RESULT: PASSED (7 passes, 0 failures, 0 errors, 24 skipped, 0 expected failures, 0 unexpected successes)

... because it wasn't even looking at some of these tests:

$ ./bin/lldb-dotest /Users/vsk/src/tailcall/lldb/test/testcases/functionalities/tail_call_frames/ -G dwarf -t 2>&1 | grep "Change dir"
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2

E.g it was only building one of them:

$ ls lldb-test-build.noindex/functionalities/tail_call_frames/                        
ambiguous_tail_call_seq2

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

llvm-svn: 343023
2018-09-25 20:20:13 +00:00
Pavel Labath 7bfc416bfb XFAIL some tests in TestTargetCreateDeps on linux
On linux, we do not support automatic loading of dependent modules, so
the module list will always contain just one module (until the target is
launched).

llvm-svn: 343016
2018-09-25 19:52:04 +00:00
Tatyana Krasnukha 891d7504bb Replace boolean parameter with enum value according r342633
llvm-svn: 342998
2018-09-25 17:59:44 +00:00
Tatyana Krasnukha 4aa028b3aa [Swig] Merge typemaps with same bodies
Differential Revision: https://reviews.llvm.org/D52376

llvm-svn: 342959
2018-09-25 10:30:32 +00:00
Alexander Polyakov 42be321ca8 [lldb-mi] Fix hanging of target-select-so-path.test
Summary:
The target-select-so-path test might hang on
some platforms. The reason of that behavior
was in incorrect usage of Filecheck and lldb-mi
processes. Instead of redirecting lldb-mi's output
to Filecheck, we should run lldb-mi session,
finish the session, collect its output and then pass
it to Filecheck.
Also, this patch adds a timer to the test to prevent
it from hanging in the future.

Reviewers: tatyana-krasnukha, aprantl, teemperor

Reviewed By: tatyana-krasnukha, teemperor

Subscribers: apolyakov, aprantl, teemperor, ki.stfu, abidh, lldb-commits

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

llvm-svn: 342915
2018-09-24 19:10:48 +00:00
Pavel Labath 27104981ad Add NativeProcessProtocol unit tests
Summary:
NativeProcessProtocol is an abstract class, but it still contains a
significant amount of code. Some of that code is tested via tests of
specific derived classes, but these tests don't run everywhere, as they
are OS and arch-specific. They are also relatively high-level, which
means some functionalities (particularly the failure cases) are
hard/impossible to test.

In this approach, I replace the abstract methods with mocks, which
allows me to inject failures into the lowest levels of breakpoint
setting code and test the class behavior in this situation.

Reviewers: zturner, teemperor

Subscribers: mgorny, lldb-commits

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

llvm-svn: 342875
2018-09-24 12:11:04 +00:00
Raphael Isemann bfc5ef6c5b Change type of m_user_expression_start_pos to size_t
AbsPosToLineColumnPos is the only reader of m_user_expression_start_pos
and actually treats it like a size_t. Also the value we store in
m_user_expression_start_pos is originally a size_t, so it makes sense
to change the type of this variable to size_t.

llvm-svn: 342804
2018-09-22 13:33:08 +00:00
Tatyana Krasnukha 7aa9e7bc57 Move architecture-specific address adjustment to architecture plugins
Differential Revision: https://reviews.llvm.org/D48623

llvm-svn: 342762
2018-09-21 18:56:44 +00:00
Tatyana Krasnukha c4bc88b541 build: add libedit to include paths
Differential Revision: https://reviews.llvm.org/D51999

llvm-svn: 342757
2018-09-21 18:34:41 +00:00
Tatyana Krasnukha af2c73e13d Add dependency on llc required by find-variable-dwo test
llvm-svn: 342733
2018-09-21 13:40:22 +00:00
Tatyana Krasnukha ec9a6a2701 Skip test if gcc version is less than 7.1 since it doesn't support -gcolumn-info option
llvm-svn: 342732
2018-09-21 13:20:26 +00:00
Vedant Kumar f853c6e074 [lldbtest] Fix self.filecheck check file lookup
The 'test_filename' property in TestBase changes over time, so
attempting to find a check file relative to the directory containing
'test_filename' is flaky.

Use the absolute path of the check file as that's always correct (and
simpler). This relies on the test driver changing into the test
directory, which it seems we can safely assume.

As a drive-by, make self.filecheck respect the trace (-t) option.

llvm-svn: 342699
2018-09-20 23:56:39 +00:00
Tatyana Krasnukha d54ee88a75 Replace boolean parameter with enum value according r342633
llvm-svn: 342671
2018-09-20 17:57:24 +00:00
Shafik Yaghmour e23d0b636c Refactor FindVariable() core functionality into StackFrame out of SBFrame
rdar://problem/14365983

Patch by Shafik Yaghmour

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

llvm-svn: 342663
2018-09-20 17:06:34 +00:00
Jonas Devlieghere 26ba928214 [target] Change target create's behavior wrt loading dependent files.
When creating a target, lldb loads all dependent files (i.e. libs in
LC_LOAD_DYLIB for Mach-O). This can be confusing, especially when two
versions of the same library end up in the shared cache. It's possible
to change this behavior, by specifying  target create -d <target> these
dependents are not loaded.

This patch changes the default behavior to only load dependent files
only when the target is an executable. When creating a target for a
library, it is now no longer necessary to pass -d. The user can still
override this behavior by specifying the -d option to change this
behavior.

rdar://problem/43721382

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

llvm-svn: 342634
2018-09-20 09:09:13 +00:00
Jonas Devlieghere f9a07e9f8d [NFC] Turn "load dependent files" boolean into an enum
This is an NFC commit to refactor the "load dependent files" parameter
from a boolean to an enum value. We want to be able to specify a
default, in which case we decide whether or not to load the dependent
files based on whether the target is an executable or not (i.e. a
dylib).

This is a dependency for D51934.

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

llvm-svn: 342633
2018-09-20 09:09:05 +00:00
Shafik Yaghmour 8306f76e56 [DataFormatters] Add formatter for C++17 std::variant
rdar://problem/43691454

Patch by Shafik Yaghmour.

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

llvm-svn: 342563
2018-09-19 18:07:05 +00:00
Vedant Kumar 9b13bea61a Allow use of self.filecheck in LLDB tests (c.f self.expect)
Add a "filecheck" method to the LLDB test base. This allows test authors
to pattern match command output using FileCheck, making it possible to
write stricter tests than what `self.expect` allows.

For context (motivation, examples of stricter checking, etc), see the
lldb-dev thread: "Using FileCheck in lldb inline tests".

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

llvm-svn: 342508
2018-09-18 19:31:47 +00:00
Shafik Yaghmour 2ee93d28fd Revert "[DataFormatters] Add formatter for C++17 std::variant"
This reverts commit r342421.

Because it breaks build bot http://green.lab.llvm.org/green/job/lldb-cmake-clang-5.0.2//418/console

llvm-svn: 342424
2018-09-17 23:15:35 +00:00
Shafik Yaghmour 854a35092c [DataFormatters] Add formatter for C++17 std::variant
rdar://problem/43691454

Patch by Shafik Yaghmour.

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

llvm-svn: 342421
2018-09-17 22:10:44 +00:00
Jim Ingham 25256c7f09 Add docs for scripted breakpoint resolvers
Differential Revision: https://reviews.llvm.org/D52065

llvm-svn: 342419
2018-09-17 21:55:46 +00:00
Davide Italiano d405d2792d Revert "[IRInterpreter] Minor cleanups, add comments. NFCI."
This breaks buildbots.

llvm-svn: 342404
2018-09-17 18:14:38 +00:00
Raphael Isemann 9dd34c8385 Add descriptions to completed expressions
Summary:
Completing inside the expression command now uses the new description API
to also provide additional information to the user. For now this information
are the types of variables/fields and the signatures of completed function calls.

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 342385
2018-09-17 12:06:07 +00:00
Alexander Polyakov 1641556593 [lldb-mi] Correct regex in the symbol-list-lines test
Summary:
The test failed in case of compiling a test suite with
gcc (checked versions are 5.2.0 and 7.3.0) because it
adds one more line entry comparing to clang. It doesn't
break the test's logic, so I just added a regex that matches
this case.

Reviewers: tatyana-krasnukha, aprantl, clayborg

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 342329
2018-09-15 17:05:20 +00:00
Davide Italiano a64157f19f [IRInterpreter] Minor cleanups, add comments. NFCI.
llvm-svn: 342280
2018-09-14 20:48:34 +00:00
Alex Langford fde4cda9f7 Fix lldb-vscode README.md
Summary: The readme was missing "-" characters to enable links

Patch by Nathan Lanza <nathan@lanza.io>

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

llvm-svn: 342266
2018-09-14 19:41:20 +00:00
Davide Italiano 5f6789ef6e [IRInterpreter] Fall back to JIT with 128-bit values.
They're not that common, and falling back is definitely
better than throwing an error instead of the result. If we
feel motivated, we might end up implementing support for these,
but it's unclear whether it's worth the effort/complexity.

Fixes PR38925.

<rdar://problem/44436068>

llvm-svn: 342262
2018-09-14 18:55:31 +00:00
Jim Ingham 19a5f6202c Make the eSearchDepthFunction searches work, add tests
using the scripted breakpoint resolver.

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

llvm-svn: 342259
2018-09-14 18:41:40 +00:00
Aleksandr Urakov 2fa5c28339 [PDB] Use the raw PDB symbol interface more accurately
Summary:
This patch adds some symbol tag checks before using the `IPDBRawSymbol`
interface to improve safety and readability.

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 342208
2018-09-14 07:46:06 +00:00
Jim Ingham e19adf5470 svn add the new files...
I started from a clean slate to do the checkin, but forgot to svn add the new files.
Do that now.

Also add the one new source file to CMakeLists.txt

llvm-svn: 342190
2018-09-13 21:59:16 +00:00
Jim Ingham 2e9470402d Remember to sort the Xcode project file. NFC.
llvm-svn: 342188
2018-09-13 21:55:00 +00:00
Jim Ingham 3815e702e7 Add a "scripted" breakpoint type to lldb.
This change allows you to write a new breakpoint type where the
logic for setting breakpoints is determined by a Python callback
written using the SB API's.

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

llvm-svn: 342185
2018-09-13 21:35:32 +00:00
Raphael Isemann 7f88829cea Add support for descriptions with command completions.
Summary:
This patch adds a framework for adding descriptions to the command completions we provide.
It also adds descriptions for completed top-level commands so that we can test this code.

Completions are in general supposed to be displayed alongside the completion itself. The descriptions
can be used to provide additional information about the completion to the user. Examples for descriptions
are function signatures when completing function calls in the expression command or the binary name
when providing completion for a symbol.

There is still some boilerplate code from the old completion API left in LLDB (mostly because the respective
APIs are reused for non-completion related purposes, so the CompletionRequest doesn't make sense to be
used), so that's why I still had to change some function signatures. Also, as the old API only passes around a
list of matches, and the descriptions are for these functions just another list, I had to add some code that
essentially just ensures that both lists are always the same side (e.g. all the manual calls to
`descriptions->AddString(X)` below a `matches->AddString(Y)` call).

The initial command descriptions that come with this patch are just reusing the existing
short help that is already added in LLDB.

An example completion with descriptions looks like this:
```
(lldb) pl
Available completions:
        platform -- Commands to manage and create platforms.
        plugin   -- Commands for managing LLDB plugins.
```

Reviewers: #lldb, jingham

Reviewed By: #lldb, jingham

Subscribers: jingham, JDevlieghere, lldb-commits

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

llvm-svn: 342181
2018-09-13 21:26:00 +00:00
Pavel Labath 2ce2652716 NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base class
The two existing implementations have the function implemented
identically, and there's no reason to believe that this would be
different for other implementations.

llvm-svn: 342167
2018-09-13 20:17:40 +00:00
George Rimar c6c7bfc4d2 [LLDB] - Improved DWARF5 support.
This patch improves the support of DWARF5.
Particularly the reporting of source code locations.

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

llvm-svn: 342153
2018-09-13 17:06:47 +00:00
Jonas Devlieghere bf2d112c15 [DWARFExpression] Read literars as unsigned values.
After landing r341457, we started seeing a failure on the swift-lldb
bots. The change was correct and pretty straightforward, a DW_OP_constu
was replaced with DW_OP_lit23, the value remaining identical.

  0x000000f4: DW_TAG_variable
		DW_AT_location    (0x00000000
		  [0x0000000100000a51,  0x0000000100000d47): DW_OP_lit23, DW_OP_stack_value)
		DW_AT_name        ("number")

However, this broke LLDB.

  (Int) number = <extracting data from value failed>

The value was read correctly, but apparently the value's type was different.
When reading a constu it was reading a uint64 (m_type = e_ulonglong) while for
the literal, it got a signed int (m_type = e_sint). This change makes sure we
read the value as an unsigned.

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

llvm-svn: 342142
2018-09-13 15:18:39 +00:00
Raphael Isemann 7e9649b86f Remove byte counting from SourceManager [NFC]
Summary:
Similar to what we did in D50681, we now stop manually byte counting here
in the SourceManager.

Reviewers: #lldb, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: JDevlieghere, abidh, lldb-commits

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

llvm-svn: 342121
2018-09-13 09:19:40 +00:00
Jason Molenda 9d0f9ced40 Commit my attempt to test the change to ProcessGDBRemote
in r336956.  This test doesn't actually test the change
that was submitted by Venkata, but it's a good one to
add.

llvm-svn: 342085
2018-09-12 21:35:02 +00:00
David Bolvansky d75a8fff7f Do not create new terminals when launching process on Windows with --no-stdio
Summary: Partially fixes PR38222

Reviewers: teemperor, zturner, stella.stamenova

Reviewed By: zturner, stella.stamenova

Subscribers: JDevlieghere, clayborg, labath, abidh, lldb-commits

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

llvm-svn: 342075
2018-09-12 19:50:45 +00:00
Jason Molenda 956ff0f8bf If we fail to get an armv7em-- disassembler from llvm, skip the
tests and don't mark this as a failure.  This happens when we've
linked against an llvm without the ARM target built in.  Davide
added some cmake conditionals to avoid building this test when the
target was absent from llvm's build, but we're still finding some
bots that manage to get in this situation.

<rdar://problem/44270082> 

llvm-svn: 342072
2018-09-12 19:30:03 +00:00
Alex Langford aad4027dc3 Add compatibility version to liblldb in framework builds
Summary:
Building LLDB with xcodebuild sets the compatibility version of liblldb
in LLDB.framework. Building the framework with cmake does not set the
compatibility version, and so it defaults to 0.0.0. This is a discrepency in the
difference between the xcode build and the cmake build.

I tested this change by building without this patch. From the build tree I ran
`otool -L Library/Frameworks/LLDB.framework/Versions/A/LLDB` and got this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 0.0.0, current version 8.0.0)
```

Did the same with this patch and the output contained this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 1.0.0, current version 8.0.0)
```

Reviewers: clayborg, labath

Subscribers: mgorny, lldb-commits

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

llvm-svn: 342066
2018-09-12 18:10:22 +00:00
Pavel Labath d9a58f5af1 Fix two issues in PDBASTParser
- gcc warning about using binary or for or-ing two comparisons (a == b | a == c)
- llvm style prefers static functions to functions in an anonymous namespace

llvm-svn: 342051
2018-09-12 12:26:11 +00:00
Pavel Labath 7704473172 Move SafeMachO from Utility to Host
Summary:
One of the conclusions of the discussion on D49740 was that SafeMachO is better
off in the Host module (as that's the only place which should include
mach/machine.h, which is what this header is working around). Also, Utility,
which is the only module which cannot include Host, should not be doing
anything with object file formats.

This patch implements that move, and also removes any unneded includes of that
file.

I've verified that MacOS still compiles after this.

Reviewers: jingham, zturner, teemperor

Subscribers: fedor.sergeev, lldb-commits

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

llvm-svn: 342050
2018-09-12 12:26:05 +00:00
Benjamin Kramer 88e18a6201 Remove another unused mislayered include.
llvm-svn: 342047
2018-09-12 11:31:18 +00:00
Benjamin Kramer 197f241614 Remove unused include that's also a layering violation.
llvm-svn: 342046
2018-09-12 11:27:10 +00:00
Raphael Isemann cad7a46a23 Remove manual byte counting from internal Stream methods.
Summary:
This patch removes the manual byte counting in all internal Stream methods.
This is now done by the automatic byte counting provided by calling `GetWrittenBytes()`
before and after writing the data (which is automatically done for us by the `ByteDelta`
utility class).

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, labath, lldb-commits

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

llvm-svn: 342044
2018-09-12 10:20:41 +00:00
Raphael Isemann 10fb677285 Add a basic test for 'memory region'
Summary:
The 'memory region' command is at the moment not tested at all by our test suite.
This patch just adds a basic test that at least provides some basic testing.

Reviewers: #lldb, davide

Reviewed By: #lldb, davide

Subscribers: vsk, davide, lldb-commits

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

llvm-svn: 342042
2018-09-12 10:04:25 +00:00
Pavel Labath c9463097d9 Reduce alignment on struct XSAVE, fixing a gcc warning
The warning is about heap-allocating a struct with bigger alignment
requirements than the standard heap allocator provides.

AFAICT, all uses of the XSAVE struct are already heap-allocated, so this
high alignment does not actually have any effect and removing it should
be NFC.

I have also done some digging in the commit history. This alignment
requirement was since the XSAVE struct was introduced in r180572 when
adding AVX register support for linux. It does not mention the alignment
specifically, so I am guessing this was just put there because the
corresponging XSAVE cpu instruction requires its buffer to be 64-byte
aligned. However, LLDB will not be normally reading this struct via the
XSAVE instruction directly. Instead we will ask the kernel to copy the
buffer saved when suspeding the inferior. This should not require such
strict alignment (in fact, linux kernel will happily do this for any
alignment).

llvm-svn: 342029
2018-09-12 08:50:08 +00:00
Vedant Kumar a4529b00e4 [MIPS] Fix signed overflow in DADDIU emulation
This fixes a signed integer overflow diagnostic reported by ubsan.

rdar://44353380

llvm-svn: 342008
2018-09-11 23:04:05 +00:00
Shafik Yaghmour 443e20ba32 Refactoring std::function formatter to move core functionality into CPPLanguageRuntime
Patch by Shafik Yaghmour.

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

llvm-svn: 341991
2018-09-11 20:58:28 +00:00
Shafik Yaghmour e2da5c525e Remove undefined behavior around the use of StateType
rdar://problem/43530233

Patch by Shafik Yaghmour.

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

llvm-svn: 341957
2018-09-11 16:08:05 +00:00
Aleksandr Urakov 35725c9894 [PDB] Fix problems after rL341782
Summary:
This commit fixes following problems after rL341782:
- Broken SymbolFilePDBTests
- Warning on comparison of integers of different signs

Tags: #lldb

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

llvm-svn: 341942
2018-09-11 14:03:12 +00:00
Raphael Isemann 262dd8c9df Print the correct error when our DynamicCheckerFunctions fail to install
Summary:
The check is inverted here: If we have error messages, we should print those instead
of our default error message. But currently we print the default message when we
actually have a sensible error to print.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38383
Thanks Nat for the patch!

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 341940
2018-09-11 13:59:47 +00:00
Raphael Isemann b658f1df35 [NFC] Fix compiler warning in TestArmv7Disassembly.cpp
The warning is
    comparison of integers of different signs: 'const int' and 'const unsigned long'
and triggered by
    EXPECT_EQ (num_of_instructions, inst_list.GetSize());
as num_of_instructions is an int in this comparison (and the RHS is size_t).

llvm-svn: 341931
2018-09-11 12:45:22 +00:00
Shafik Yaghmour f4babefdf1 Undoing first commit which added a space to a comment
llvm-svn: 341881
2018-09-10 23:18:32 +00:00
Shafik Yaghmour 3875643928 First test commit into svn, adding space to comment
llvm-svn: 341879
2018-09-10 23:12:29 +00:00
Davide Italiano ae3f793e9e Rollback "Fix raw address breakpoints not resolving".
It broke a bunch of bots. Ted confirmed, but can't revert for
now so I'm reverting on his behalf.

llvm-svn: 341878
2018-09-10 23:09:09 +00:00
Ted Woodward 860bafa07d Fix raw address breakpoints not resolving
Summary: An address breakpoint of the form "b 0x1000" won't resolve if it's created while the process isn't running. This patch deletes Address::SectionWasDeleted, renames Address::SectionWasDeletedPrivate to SectionWasDeleted (and makes it public), and changes the section check in Breakpoint::ModulesChanged back to its original form

Reviewers: jingham, #lldb

Reviewed By: jingham

Subscribers: davide, lldb-commits

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

llvm-svn: 341849
2018-09-10 18:19:01 +00:00
Aleksandr Urakov 709426b33a [PDB] Restore AST from PDB symbols
Summary:
This patch adds an implementation of retrieving of declarations and declaration
contexts based on PDB symbols.

PDB has different type symbols for const-qualified types, and this
implementation ensures that only one declaration was created for both const
and non-const types, but creates different compiler types for them.

The implementation also processes the case when there are two symbols
corresponding to a variable. It's possible e.g. for class static variables,
they has one global symbol and one symbol belonging to a class.

PDB has no info about namespaces, so this implementation parses the full symbol
name and tries to figure out if the symbol belongs to namespace or not,
and then creates nested namespaces if necessary.

Reviewers: asmith, zturner, labath

Reviewed By: asmith

Subscribers: aleksandr.urakov, teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 341782
2018-09-10 08:08:43 +00:00
Pavel Labath 4f5450742e Speculative fix for NetBSD bot for r341758
llvm-svn: 341759
2018-09-09 08:42:00 +00:00
Pavel Labath f8b825f689 Re-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"
This recommits r341487, which was reverted due to failing tests with
clang. It turned out I had incorrectly expected that the literal arrays
passed to ArrayRef constructor will have static (permanent) storage.
This was only the case with gcc, while clang was constructing them on
stack, leading to dangling pointers when the function returns.

The fix is to explicitly assign static storage duration to the opcode
arrays.

llvm-svn: 341758
2018-09-09 06:01:12 +00:00
Pavel Labath 12286a2739 Revert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"
This reverts commit r341487. Jan Kratochvil reports it breaks LLDB when
compiling with clang.

llvm-svn: 341747
2018-09-08 10:33:14 +00:00
David Bolvansky 85dacd1116 Check if a terminal supports colors on Windows properly
Summary:
Previously we SetUseColor(true) wrongly when output was not a terminal so it broken some (not public) bots.

Thanks for issue report, @stella.stamenova

Reviewers: stella.stamenova, zturner

Reviewed By: stella.stamenova

Subscribers: abidh, lldb-commits, stella.stamenova

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

llvm-svn: 341746
2018-09-08 07:15:56 +00:00
Davide Italiano fc89d18bb1 [XCodeproj] Remove extra whitespace in SBAPI path.
llvm-svn: 341732
2018-09-07 23:49:05 +00:00
Davide Italiano 6af9fe07b9 [Disassembler] Run ARM-specific tests only if the ARM backend is built.
<rdar://problem/44239070>

llvm-svn: 341714
2018-09-07 21:36:21 +00:00
Jason Molenda 25a1525e7e Add the Disassembler unit test dir.
llvm-svn: 341696
2018-09-07 18:51:10 +00:00
Jim Ingham 4911d36aa6 NFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.
In a subsequent commit, I will need to expose the search depth
to the SB API's, so I'm moving this define into lldb-enumerations
where it will get added to the lldb module.

llvm-svn: 341690
2018-09-07 18:43:04 +00:00
Davide Italiano f06ffeee21 [Scalar] Commit the correct patch, forgot `git add`.
<rdar://problem/44229924>

llvm-svn: 341685
2018-09-07 18:22:27 +00:00
Jim Ingham effe60fdbd Add input files to the "prepare swig bindings" step.
This build phase had no inputs, so you always had to manually
delete LLDBWrapPython.cpp to get it to rebuild.  Add the correct
inputs.

llvm-svn: 341683
2018-09-07 18:10:26 +00:00
Davide Italiano 5ccc9df843 [Scalar] Fix undefined behaviour when converting double to long.
This showed up in an Ubsan build of lldb (inside the CFAbsoluteTime
data formatter). As we only care about the bit pattern, we just
round to the nearest double, and truncate to a size that fits
in ulonglong_t.

<rdar://problem/44229924>

llvm-svn: 341682
2018-09-07 18:03:43 +00:00
Alexander Polyakov 469304e8fb [ARC] Make char unsigned by default
Summary: This patch specifies 'char' default sign on ARC.

Reviewers: tatyana-krasnukha, clayborg

Reviewed By: tatyana-krasnukha, clayborg

Subscribers: clayborg, lldb-commits

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

llvm-svn: 341667
2018-09-07 14:45:32 +00:00
Jason Molenda 0dfb84ce9b Enable the fp-armv8 disassembler feature when disassembling Cortex-M
code.  This will enable disassembly of the optional subset of
neon that some Cortex cores support.  Add a unit test to check
that a few of these instructions disassemble as expected.

<rdar://problem/26674303> 

llvm-svn: 341623
2018-09-07 01:28:48 +00:00
Raphael Isemann ee65d57321 Reland [ClangUserExpression][NFC] Removed unused code
The GetLanguageForExpr has side effects, so we can't remove this
call without breaking the completion mechanism. However, we can
keep the change that gets rid of this unnecessary variable.

llvm-svn: 341535
2018-09-06 10:24:11 +00:00
Raphael Isemann 20c88ebf57 Revert "[ClangUserExpression][NFC] Removed unused code"
GetLanguageForExpr has side effects, so this actually breaks
the completion. Should fix TestExprCompletion.

llvm-svn: 341532
2018-09-06 09:42:44 +00:00
Jason Molenda b0d33e9b3c Re-instate a bit of code that was commented out in r188246 which
reads an ObjectFileMachO's string table in one chunk.  Originally
this was commented out because binaries in the system's shared cache
all share a mega-string table and so reading the entire mega-strtab
for each binary was a performance problem.

In the reinstated code, I add a check that the binary we're reading
from memory is not in the shared cache (there isn't a constant in
<mach-o/loader.h> for this bit yet; we hardcode the value in one
other place in ObjectFileMachO alread).  For binaries that we're
reading out of memory that are NOT in the shared cache, reading 
the string table in one chunk is a big performance improvement.

Also have debugserver send up the flags value for binaries in its
response to the jGetLoadedDynamicLibrariesInfos request.

NFC.

<rdar://problem/33604496> 

llvm-svn: 341511
2018-09-06 00:55:27 +00:00
Adrian Prantl 4954f6a565 Print column info in backtraces et al. if available
This patch allows LLDB to print column info in backtraces et al. if
available, which is useful when the backtrace contains a frame like
the following:

  f(can_crash(0), can_crash(1));

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

llvm-svn: 341506
2018-09-05 23:52:08 +00:00
David Bolvansky 8aa23614af Set Windows console mode to enable support for ansi escape codes
Summary:
Windows console now supports supports ANSI escape codes, but we need to enable it using SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING flag.

https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences.

Syntax hightlighting now works fine on Windows:
https://i.imgur.com/P0i04A7.png

Reviewers: JDevlieghere, teemperor, zturner

Reviewed By: zturner

Subscribers: abidh, lldb-commits

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

llvm-svn: 341497
2018-09-05 22:06:58 +00:00
Pavel Labath ef1b1b5d17 Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode
return the opcode as a Expected<ArrayRef> instead of a
Status+pointer+size combo.

I also move the linux implementation to the base class, as the trap
opcodes are likely to be the same for all/most implementations of the
class (except the arm one, where linux chooses a different opcode than
what the arm spec recommends, which I keep linux-specific).

llvm-svn: 341487
2018-09-05 18:08:56 +00:00
Tatyana Krasnukha bc555237a4 Hold GIL while allocating memory for PythonString.
Summary:
Swig wraps C++ code into SWIG_PYTHON_THREAD_BEGIN_ALLOW; ...  SWIG_PYTHON_THREAD_END_ALLOW;
Thus, LLDB crashes with "Fatal Python error: Python memory allocator called without holding the GIL" when calls an lldb_SB***___str__ function.

Reviewers: clayborg

Reviewed By: clayborg

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

llvm-svn: 341482
2018-09-05 17:07:29 +00:00
Raphael Isemann 23ee5cbd2c [www] Updated outdated download links [NFC]
Also added ubuntu and Arch Linux links.

llvm-svn: 341471
2018-09-05 14:27:48 +00:00
Frederic Riss 412f24dd2d Change TestCompletion to only ever look inside of BaseDir
TestCompletion was failing quite frequently on our Linux bots. Some tracing
revealed that when we are iterating BaseDir we are not getting all the entries.
More specifically, we are sometimes missing the entry corresponding to the
TestCompletion directory that the first test in DirCompletionAbsolute is
looking for. BaseDir is the directory where lit is creating all the temporary
files. The semantics of opendir/readdir are unclear when it comes to iterating
over a directory that changes contents, but it seems like on Linux you might
fail to list an entry even if it was there before opendir and is still present
throughout the iteration. Changing the test to only look inside of the test-
specific directory seems to fix the instability.

This commit also removes some assertions that were added to try to track down
this issue.

llvm-svn: 341425
2018-09-04 23:09:49 +00:00
David Bolvansky 4d46fde679 Terminate debugger if an assert was hit
Reviewers: JDevlieghere, teemperor, #lldb

Reviewed By: JDevlieghere

Subscribers: clayborg, lemo, lldb-commits

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

llvm-svn: 341387
2018-09-04 17:19:15 +00:00
David Bolvansky 52cadf0d2d [NFC] Fixed enum constant in boolean context error
Summary:
/home/xbolva00/LLVM/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:656:59: warning: enum constant in boolean context [-Wint-in-bool-context]
     if (mh.magic == llvm::MachO::MH_CIGAM || llvm::MachO::MH_MAGIC)
                                                           ^~~~~~~~
/home/xbolva00/LLVM/llvm/tools/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:658:62: warning: enum constant in boolean context [-Wint-in-bool-context]
     if (mh.magic == llvm::MachO::MH_CIGAM_64 || llvm::MachO::MH_MAGIC_64)

Reviewers: JDevlieghere, teemperor

Reviewed By: teemperor

Subscribers: abidh, lldb-commits

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

llvm-svn: 341340
2018-09-03 22:09:08 +00:00
David Bolvansky 122441d8fd [NFC] Use llvm_unreachable instead of lldb::assert
Summary: Fixes implicit fall through warnings

Reviewers: JDevlieghere, teemperor

Reviewed By: teemperor

Subscribers: lldb-commits

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

llvm-svn: 341339
2018-09-03 22:08:30 +00:00
David Bolvansky 7a213d2f9b [ClangUserExpression][NFC] Removed unused code
llvm-svn: 341334
2018-09-03 18:21:21 +00:00
David Bolvansky 26e97995c4 [PseudoTerminal][NFC] Use llvm errno helpers
Summary:
LLVM provide (str)errno helpers, so convert code to use it.

Also fixes warning:
/home/xbolva00/LLVM/llvm/tools/lldb/source/Host/common/PseudoTerminal.cpp:248:25: warning: ignoring return value of ‘char* strerror_r(int, char*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
             ::strerror_r(errno, error_str, error_len);

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: abidh, lldb-commits

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

llvm-svn: 341320
2018-09-03 14:59:57 +00:00
David Bolvansky aa75dd128c [Symtab][NFC] Added llvm_unreachable to supress compiler warning
Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 341315
2018-09-03 12:57:54 +00:00
Aleksandr Urakov e8fc05ce7d [DWARF] Fix dwarf5-index-is-used.cpp
Summary:
`dwarf5-index-is-used.cpp` have been failing after rL340206, because `clang`
have stopped to emit pubnames by default after that change. Current patch adds
`-gpubnames` option to the `clang` command line in the test to emit pubnames.

Reviewers: labath, dblaikie

Reviewed By: labath

Subscribers: clayborg, probinson, teemperor, lldb-commits, aprantl, JDevlieghere, abidh, stella.stamenova

Tags: #lldb

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

llvm-svn: 341296
2018-09-03 07:16:06 +00:00
Pavel Labath 89d2245a2a Ignore unicode decode errors in test suite's encoded_file class
These happen in a couple of tests when lldb tries to pretty print a
const char * variable in the inferior which points to garbage. Instead,
we have the python replace the invalid sequences with the unicode
replacement character.

llvm-svn: 341274
2018-09-01 12:15:46 +00:00
Frederic Riss 78a10a7a9b File completion bugfix
If you tried to complete somwthing like ~/., lldb would come up with a lot
of non-existent filenames by concatenating every exisitng file in the directory
with an initial '.'.

This was due to a workaround for an llvm::fs::path::filename behavior that
was not applied selectively enough.

llvm-svn: 341268
2018-08-31 23:03:28 +00:00
Pavel Labath 332447f4b4 Avoid using short identifiers in some tests
This applies the same workaround  as r321271 to other tests. The root
problem is that lldb finds an internal symbol with the same name in the
debug info of system libraries, and then fails to disambiguate between
the two.

llvm-svn: 341235
2018-08-31 18:25:01 +00:00
Frederic Riss 7f03f3d7f9 Fix a comment to use the correct variable name.
llvm-svn: 341233
2018-08-31 18:14:53 +00:00
Pavel Labath 8b0853a6da XFail one more VSCode test which fails under heavy load
llvm-svn: 341186
2018-08-31 08:31:27 +00:00
Pavel Labath d9e8c773de Fix a typo in mac SIP workaround
presumably the or subexpression was meant to be evaluated first. The way
it is now means that we apply the workaround for any python in `/usr`,
which matches pretty much every unix system.

llvm-svn: 341167
2018-08-31 06:01:02 +00:00
Pavel Labath e7ec083f19 Increase qHostInfo packet timeout
Host info computation can involve DNS traffic (to compute the remote
host name). On very unreliable networks (such as free WiFi on trains),
this can take several seconds to complete or timeout. Increase the
qHostInfo timeout to account for this.

llvm-svn: 341164
2018-08-31 05:34:03 +00:00
Pavel Labath d5fa57eb19 Silence some "control reaches end of non-void function" warnings with gcc
llvm-svn: 341163
2018-08-31 05:18:11 +00:00
Raphael Isemann 1f0b1027f1 Fixed missing sidebars on the website
We didn't mark these HTML files as executable, which means that
the SSI includes for including the sidebar didn't work.

llvm-svn: 341157
2018-08-31 02:07:05 +00:00
Raphael Isemann 960b133749 Fixed comment for UserExpression::Complete [NFC]
llvm-svn: 341126
2018-08-30 21:31:04 +00:00
Raphael Isemann c11a780ed6 Use a CompletionRequest in the expression command completion [NFC]
The patch was originally written before we had a CompletionRequest,
so it still used a StringList to pass back the completions to
the request.

llvm-svn: 341124
2018-08-30 21:26:32 +00:00
Raphael Isemann d424c2a8a1 Move NoBuiltin=true closer to the other LangOpts code [NFC]
llvm-svn: 341121
2018-08-30 20:56:58 +00:00
Raphael Isemann 20892fb4b0 Adjusting some comments in ClangExpressionParser.cpp
llvm-svn: 341112
2018-08-30 20:19:57 +00:00
Raphael Isemann b83f914b6e Added missing include to <cctype> for 'std::isalnum'
Should fix the failing Windows bots.

llvm-svn: 341109
2018-08-30 20:14:22 +00:00
Raphael Isemann 39ec6e7049 Fixed code style for the CodeCompletion members [NFC]
This code is in LLDB, so it should also follow the LLDB code style
and use the m_ prefix for members.

llvm-svn: 341105
2018-08-30 19:47:53 +00:00
Pavel Labath a95c33f600 Fix deadlock in gdb-client tests
Using a listen queue of length 0 caused a deadlock on my machine in the
gdb-client tests while attempting to establish the loopback socket
connection.

I am not sure if this is down to a different python or kernel version,
but in either case, having queue of length zero sounds like a bad idea,
so I'm bumping that to one (which also fixes the deadlock).

llvm-svn: 341096
2018-08-30 19:14:02 +00:00
Raphael Isemann 7fae4932ad Move Predicate.h from Host to Utility
Summary:
This class was initially in Host because its implementation used to be
very OS-specific. However, with C++11, it has become a very simple
std::condition_variable wrapper, with no host-specific code.

It is also a general purpose utility class, so it makes sense for it to
live in a place where it can be used by everyone.

This has no effect on the layering right now, but it enables me to later
move the Listener+Broadcaster+Event combo to a lower layer, which is
important, as these are used in a lot of places (notably for launching a
process in Host code).

Reviewers: jingham, zturner, teemperor

Reviewed By: zturner

Subscribers: xiaobai, mgorny, lldb-commits

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

llvm-svn: 341089
2018-08-30 17:51:10 +00:00
Raphael Isemann 7482973411 Added initial code completion support for the `expr` command
Summary:
This patch adds initial code completion support for the `expr` command.

We now have a completion handler in the expression CommandObject that
essentially just attempts to parse the given user expression with Clang with
an attached code completion consumer. We filter and prepare the
code completions provided by Clang and send them back to the completion
API.

The current completion is limited to variables that are in the current scope.
This includes local variables and all types used by local variables. We however
don't do any completion of symbols that are not used in the local scope (or
in some other way already in the ASTContext).

This is partly because there is not yet any code that manually searches for additiona
information in the debug information. Another cause is that for some reason the existing
code for loading these additional symbols when requested by Clang doesn't seem to work.
This will be fixed in a future patch.

Reviewers: jingham, teemperor

Reviewed By: teemperor

Subscribers: labath, aprantl, JDevlieghere, friss, lldb-commits

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

llvm-svn: 341086
2018-08-30 17:29:37 +00:00
Adrian Prantl 2305c049a3 Remove redundant initialization
llvm-svn: 341080
2018-08-30 15:39:08 +00:00
Adrian Prantl 431b158400 Support setting a breakpoint by FileSpec+Line+Column in the SBAPI.
This patch extends the SBAPI to allow for setting a breakpoint not
only at a specific line, but also at a specific (minimum) column. When
a column is specified, it will try to find an exact match or the
closest match on the same line that comes after the specified
location.

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

llvm-svn: 341078
2018-08-30 15:11:00 +00:00
Frederic Riss 0d0a5960a5 Provide a default implementation of TypeSystem::GetNumTemplateArguments
... and remove the dummy implementations from the languages that do not
support it.

llvm-svn: 341006
2018-08-30 00:37:23 +00:00
Raphael Isemann 207863261c Move the column marking functionality to the Highlighter framework
Summary:
The syntax highlighting feature so far is mutually exclusive with the lldb feature
that marks the current column in the line by underlining it via an ANSI color code.
Meaning that if you enable one, the other is automatically disabled by LLDB.

This was caused by the fact that both features inserted color codes into the the
source code and were likely to interfere with each other (which would result
in a broken source code printout to the user).

This patch moves the cursor code into the highlighting framework, which provides
the same feature to the user in normal non-C source code. For any source code
that is highlighted by Clang, we now also have cursor marking for the whole token
that is under the current source location. E.g., before we underlined only the '!' in the
expression '1 != 2', but now the whole token '!=' is underlined. The same for function
calls and so on. Below you can see two examples where we before only underlined
the first character of the token, but now underline the whole token.

{F7075400}
{F7075414}

It also simplifies the DisplaySourceLines method in the SourceManager as most of
the code in there was essentially just for getting this column marker to work as
a FormatEntity.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: lldb-commits

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

llvm-svn: 341003
2018-08-30 00:09:21 +00:00
Adrian Prantl 3dec0684c5 Refactor BreakpointResolver::SetSCMatchesByLine() to make it easier to
read/understand/maintain.

As a side-effect, this should also improve the performance by avoiding
costly vector element removals and switching from a std::map to a
SmallDenseSet.

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

llvm-svn: 340994
2018-08-29 23:16:42 +00:00
Raphael Isemann c01783a892 Don't cancel the current IOHandler when we push a handler for an utility function run.
Summary:
D48465 is currently blocked by the fact that tab-completing the first expression is deadlocking LLDB.

The reason for this deadlock is that when we push the ProcessIO handler for reading the Objective-C runtime
information from the executable (which is triggered when we parse the an expression for the first time),
the IOHandler can't be pushed as the Editline::Cancel method is deadlocking.

The deadlock in Editline is coming from the m_output_mutex, which is locked before we go into tab completion.
Even without this lock, calling Cancel on Editline will mean that Editline cleans up behind itself and deletes the
current user-input, which is screws up the console when we are tab-completing at the same time.

I think for now the most reasonable way of fixing this is to just not call Cancel on the current IOHandler when we push
the IOHandler for running an internal utility function.

As we can't really write unit tests for IOHandler itself (due to the hard dependency on an initialized Debugger including
all its global state) and Editline completion is currently also not really testable in an automatic fashion, the test for this has
to be that the expression command completion in D48465 doesn't fail when requesting completion the first time.

A more precise test plan for this is:

1. Apply D48465.
2. Start lldb and break in some function.
3. Type `expr foo` and press tab to request completion.
4. Without this patch, we deadlock and LLDB stops responding.

I'll provide an actual unit test for this once I got around and made the IOHandler code testable,
but for now unblocking D48465 is more critical.

Thanks to Jim for helping me debugging this.

Reviewers: jingham

Reviewed By: jingham

Subscribers: emaste, clayborg, abidh, lldb-commits

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

llvm-svn: 340988
2018-08-29 22:50:54 +00:00
Greg Clayton 77c57200f8 Don't include the Age in the UUID for CvRecordPdb70 UUID records in minidump files for Apple vendors.
The CvRecordPdb70 structure looks like:

struct CvRecordPdb70 {
  uint8_t Uuid[16];
  llvm::support::ulittle32_t Age;
  // char PDBFileName[];
};
We were including the "Age" in the UUID for Apple vedors which caused us to not be able to match the UUID to built binaries. The "Age" field is set to zero in breakpad minidump files for Apple targets. 

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

llvm-svn: 340966
2018-08-29 20:34:08 +00:00
Raphael Isemann a965d35154 Removed commented out includes [NFC]
llvm-svn: 340958
2018-08-29 19:55:33 +00:00
Aleksandr Urakov 398f81b3b4 [PDB] Resolve a symbol context block info correctly
Summary:
This patch allows to resolve a symbol context block info even if a function
info was not requested. Also it adds the correct resolving of nested blocks
(the previous implementation used function blocks instead of them).

Reviewers: zturner, asmith, labath

Reviewed By: asmith

Subscribers: lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 340901
2018-08-29 07:26:11 +00:00
Shoaib Meenai 1a890fcc72 [LLDB] Fix script to work with GNU sed
GNU sed and BSD sed have a different command-line syntax for in-place
editing, and the current form of the script would only work with BSD
sed. The easiest way to get cross-platform behavior is to specify a
backup suffix and then just delete the backup file at the end. (BSD sed
is the default on macOS, but it's possible to acquire GNU coreutils and
have your `sed` be GNU sed even on macOS; I'm aware it's not officially
supported in any capacity, but it's easy enough to support here.)

An alternative would be using `perl -p -i -e` instead of `sed -i`, but I
figured it was best to make the minimal working change.

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

llvm-svn: 340885
2018-08-28 23:47:22 +00:00
Frederic Riss ae6ca2fc3f Allow IRInterpreter to deal with non-power-of-2 sized types to support some bitfield accesses.
Summary:
For some bitfield patterns (like the one added by this commit), Clang will
generate non-regular data types like i24 or i48. This patch follows a
pretty naive approach of just bumping the type size to the next power of 2.
DataExtractor know how to deal with weird sizes. The operations on Scalar
do not know how to deal with those types though, so we have to legalize the
size when creating a Scalar.

Reviewers: jingham, clayborg

Subscribers: lldb-commits

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

llvm-svn: 340880
2018-08-28 22:50:01 +00:00
Jason Molenda f04833f9ee Remove unnecessary entitlement in debugserver for iOS.
<rdar://problem/43631901> 

llvm-svn: 340877
2018-08-28 22:28:34 +00:00
Raphael Isemann 691e92b573 [lldb] Fix lldb build on musl
Summary: limits.h is needed for getting PATH_MAX definition, this comes to fore
with musl libc where limits.h is not included indirectly via other system headers.

Patch by Khem Raj, thanks!

Reviewers: compnerd

Reviewed By: compnerd

Subscribers: llvm-commits

Tags: #lldb

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

llvm-svn: 340876
2018-08-28 22:17:28 +00:00
Pavel Labath 1f8639afa6 Respect platform sysroot when loading core files
Patch by Eugene Birukov <eugenebi@microsoft.com>
Differential Revision: https://reviews.llvm.org/D49685

llvm-svn: 340841
2018-08-28 16:32:46 +00:00
Raphael Isemann 4925421c00 Use a RAII guard to control access to DisassemblerLLVMC.
Summary:
This patch replaces the manual lock/unlock calls for gaining exclusive access to the disassembler with
a RAII-powered access scope. This should prevent that we somehow skip over these trailing Unlock calls
(e.g. with early returns).

We also have a second `GetDisasmToUse` method now that takes an already constructed access scope to
prevent deadlocks when we call this from other methods.

Reviewers: #lldb, davide, vsk

Reviewed By: #lldb, davide, vsk

Subscribers: davide, vsk, lldb-commits

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

llvm-svn: 340835
2018-08-28 15:31:01 +00:00
Adrian Prantl dfa7755c52 Make the DYLD_INSERT_LIBRARIES workaround for SIP more robut for the various configurations that bots are running
llvm-svn: 340792
2018-08-27 23:06:38 +00:00
Adrian Prantl 7e6ce43ef0 Add a mkdir -p to builddir into lldbtest.py
Based on how it is executed, it may not have been yet created.

llvm-svn: 340791
2018-08-27 23:06:37 +00:00
Adrian Prantl f05f93879b Fix typo
llvm-svn: 340779
2018-08-27 21:46:18 +00:00
Raphael Isemann 596709d8a8 Let the CompilerInstance create our clang ASTContext
Summary:
Now that we moved the BuiltinContext and SelectorTable to the
CompilerInstance, we can also get rid of manually creating our
own ASTContext, but just use the one from the CompilerInstance
(which will be created with the same settings).

Reviewers: vsk, aprantl, davide

Reviewed By: davide

Subscribers: lldb-commits

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

llvm-svn: 340748
2018-08-27 15:18:33 +00:00
Raphael Isemann eca9ce14d6 Disable use-color if the output stream is not a terminal with color support.
Summary:
LLDB currently only checks the output terminal for color support by looking
at the `TERM` environment variable and comparing it to `"dumb"`. This causes that
when running LLDB on a CI node, the syntax highlighter will not be deactivated by
LLDB and the output log is filled with color codes (unless the terminal emulator
actually exposes itself as dumb).

This patch now relies on the LLVM code for detecting color support which is more
reliable. We now also correctly actually initialize the `m_supports_colors` variable in `File`.
`m_supports_colors` was so far uninitialized, but the code path that uses `m_supports_colors`
was also dead so the sanitizers didn't sound an alarm.

The old check that compares `TERM` is not removed by this patch as the new LLVM code
doesn't seem to handle this case (and it's a good thing to check for "dumb" terminals).

Reviewers: aprantl, javed.absar

Reviewed By: aprantl

Subscribers: kristof.beyls, abidh, lldb-commits

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

llvm-svn: 340747
2018-08-27 15:16:25 +00:00
Frederic Riss 314614ad4f Disable exceptions for TestDataFormatterLibcxxOptional.py
On macOS, some of the <optional> APIs used by the test are available only
starting on macOS 10.14 when using exceptions. Build the test with
-fno-exceptions so that the test builds on older systems too.

rdar://problem/43700544

llvm-svn: 340676
2018-08-25 01:25:24 +00:00
Stella Stamenova 04acc99db8 [vscode] Skip some of the vscode tests on Linux and fix one
Summary: These are already skipped on Darwin because they cause build bot failures. Both on the build bots as well as in our testing we have seen a number of these tests fail and hang. This change skips the failing/hanging tests on Linux and also fixes one of the test - the test needs the thread library to build.

Reviewers: asmith, clayborg, aprantl

Subscribers: teemperor, lldb-commits

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

llvm-svn: 340658
2018-08-24 21:42:53 +00:00
Raphael Isemann 6328ccc14c Fixed windows bots that were failing because of PATH_MAX
As we only use PATH_MAX for an assert in a unit test that is supposed
to catch the random failures on the Swift CI bots, we might as well
just ifdef this assert out on Windows.

llvm-svn: 340652
2018-08-24 20:55:23 +00:00
Aleksandr Urakov 562811a86d [PDB] Make variables.test to pass using a 32-bit compiler too
Summary:
`variables.test` depends on mangled names, but the mangling depends
on the bitness. This patch specifies the bitness explicitly, so mangled names
doesn't differ when a 32-bit version of the compiler is used.

Reviewers: stella.stamenova, asmith

Reviewed By: stella.stamenova

Tags: #lldb

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

llvm-svn: 340597
2018-08-24 07:24:52 +00:00
Raphael Isemann 3e1c793e9d Add more pre-run asserts for the DirCompletionAbsolute test
Summary:
The DirCompletionAbsolute is still randomly failing on the nodes even after D50722, so this patch adds more asserts
that verify certain properties on which the actual completion implementation relies on.

The first assert checks that the directory we complete on actually exists. If the directory doesn't exist on the
next CI failure, this assert should catch it and we know that the 0 matches come from a missing base directory.

The second assert is just checking that we are below the PATH_MAX limit that the completion checks against.
This check could randomly fail if the temporary directories we generate are sometimes longer than PATH_MAX,
and the assert can tell us that this is the reason we failed (instead of the mysterious '0 matches').

(As a sidenote: We shouldn't be checking against PATH_MAX anyway in the code (as this is just wrong). Also
the disk completion API really needs a better error mechanism than returning 0 on both error or no-results.)

Reviewers: aprantl, friss

Reviewed By: aprantl

Subscribers: abidh

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

llvm-svn: 340589
2018-08-23 23:21:52 +00:00
Raphael Isemann d2b0862f7f Reuse the SelectorTable from Clang's Preprocessor
Summary:
At the moment we create our own SelectorTable even though the Preprocessor always
creates one for us that we can (and should) reuse.

Reviewers: vsk

Reviewed By: vsk

Subscribers: lldb-commits

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

llvm-svn: 340585
2018-08-23 22:40:54 +00:00
Leonard Mosescu 40b832ea08 Restrict the set of plugins used for ProcessMinidump
1. The dynamic loaders should not be needed for loading minidumps
and they may create problems (ex. the macOS loader resets the list of
loaded sections, which for minidumps are already set up during minidump loading)

2. In general, the extra plugins can do extraneous work which hurts performance
(ex. trying to set up implicit symbolic breakpoints, which in turn will trigger
extra debug information loading)

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

llvm-svn: 340578
2018-08-23 21:34:33 +00:00
Adrian Prantl 252ed741b2 Change xfail to skipIf. The exact condition is really difficult to get
right and doesn't add much signal.

llvm-svn: 340574
2018-08-23 21:08:30 +00:00
Adrian Prantl 4e3bd78a80 XFAIL test for older versions of clang
llvm-svn: 340573
2018-08-23 21:00:37 +00:00
Raphael Isemann 778b308eb9 Fix broken builtin functions in the expression command
Summary:
Calling any non-libc builtin function in the expression command currently just causes Clang
to state that the function is not known. The reason for this is that we actually never
initialize the list of builtin functions in the Builtin::Context.

This patch just calls the initializer for the builtins in the preprocessor. Also adds some tests
for the new builtins.

It also gets rid of the extra list of builtins in the ClangExpressionParser, as we can just reuse
the existing list in the Preprocessor for the ASTContext. Having just one list of builtins around
is also closer to the standard Clang behavior.

Reviewers: #lldb, vsk

Reviewed By: vsk

Subscribers: sgraenitz, clayborg, vsk, lldb-commits

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

llvm-svn: 340571
2018-08-23 20:40:45 +00:00
Walter Lee d0ddf313c5 Fix format string issue introduced in r340548
Make format string portable.

llvm-svn: 340562
2018-08-23 18:26:26 +00:00
Alex Langford 520201babb [cmake] Add option to skip building lldb-server
Summary:
There is currently a way to skip the debugserver build. See how the CMake
variables SKIP_DEBUGSERVER and LLDB_CODESIGN_IDENTITY are used if you're
interested in that.

This allows us to skip building lldb-server as well. There is another
debug server called ds2 that can be used with LLDB. If you choose to use
ds2, this flag is very useful because it can cut down the build time of LLDB.

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

llvm-svn: 340560
2018-08-23 18:05:45 +00:00
Adrian Prantl 6c7f5884d5 Fix check for dictionary entry
llvm-svn: 340557
2018-08-23 17:51:14 +00:00
Adrian Prantl 315334be05 XFAIL test for older versions of dsymutil
llvm-svn: 340550
2018-08-23 17:30:56 +00:00
Adrian Prantl 748310b193 lldbtest.py: Work around macOS SIP when testing ASANified builds.
llvm-svn: 340548
2018-08-23 17:19:08 +00:00
Adrian Prantl 6b58fa7120 Add libc++ data formatter for std::function
- Added LibcxxFunctionSummaryProvider
- Removed LibcxxFunctionFrontEnd
- Modified data formatter tests to test new summary functionality

Patch by Shafik Yaghmour!

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

llvm-svn: 340543
2018-08-23 17:02:39 +00:00
Stephane Sezer a8accca4f5 Add include directory for libxml on macOS
Summary:
Builds fail because libxml/xmlreader.h isn't found. Adding the include
directory to the include list fixes the issue. This is what we already do on
non-macOS platforms in the same file.

Reviewers: clayborg, xiaobai, lanza

Reviewed By: clayborg, lanza

Subscribers: mgorny

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

llvm-svn: 340460
2018-08-22 22:25:45 +00:00
Raphael Isemann b238b8dcf0 Add unit test for StringLexer
Reviewers: labath, #lldb

Reviewed By: labath

Subscribers: jloser, mgorny, lldb-commits

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

llvm-svn: 340448
2018-08-22 20:22:34 +00:00
Adrian Prantl 95f21584a9 lldbtest.py: Unconditionally set the clang module cache path.
This should fix the errors observable on the new lldb-cmake bot.

llvm-svn: 340293
2018-08-21 16:13:37 +00:00
Adrian Prantl cd9f68ec05 Makefile.rules: Use an absolute path to the module cache directory.
This change is NFC, but it makes it more obvious in log files what happened.

llvm-svn: 340286
2018-08-21 15:46:15 +00:00
Adrian Prantl 0e45df4c0e Reflow comments
llvm-svn: 340219
2018-08-20 22:00:32 +00:00