Commit Graph

17950 Commits

Author SHA1 Message Date
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