Commit Graph

19986 Commits

Author SHA1 Message Date
Shafik Yaghmour
fa5c340ea1 Fix ClangASTContext::CreateParameterDeclaration to not call addDecl
Summary:
The change https://reviews.llvm.org/D55575 modified ClangASTContext::CreateParameterDeclaration to call decl_ctx->addDecl(decl); this caused a regression since the existing code in DWARFASTParserClang::ParseChildParameters is called with the containing DeclContext. So when end up with cases where we are parsing a parameter for a member function and the parameter is added to the CXXRecordDecl as opposed to the CXXMethodDecl. This example is given in the regression test TestBreakpointInMemberFuncWNonPrimitiveParams.py which without this fix in a modules build leads to assert on setting a breakpoint in a member function with non primitive parameters. This scenario would be common when debugging LLDB or clang.

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

llvm-svn: 367726
2019-08-02 21:41:50 +00:00
Joseph Tremoulet
9826486325 Use rip-relative addressing in asm test
The absolute form is an error when targeting Darwin.

llvm-svn: 367706
2019-08-02 19:06:15 +00:00
Shafik Yaghmour
c5d4014535 [Formatters] Temporarily disable libc++ std::function formatter due to performance issue
Summary: We have been seeing increased reports of performance issue around large project and formatting std::function variables especially in functions signatures in back traces. There are some possible fixes but exploring those fixes may take time and it is better to temporarily disable the formatter due to its impact and re-enable it once we have a fix.

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

llvm-svn: 367701
2019-08-02 18:16:04 +00:00
Joseph Tremoulet
31e6dbe1c6 Fix PC adjustment in StackFrame::GetSymbolContext
Summary:
Update StackFrame::GetSymbolContext to mirror the logic in
RegisterContextLLDB::InitializeNonZerothFrame that knows not to do the
pc decrement when the given frame is a signal trap handler frame or the
parent of one, because the pc may not follow a call in these frames.
Accomplish this by adding a behaves_like_zeroth_frame field to
lldb_private::StackFrame, set to true for the zeroth frame, for
signal handler frames, and for parents of signal handler frames.

Also add logic to propagate the signal handler flag from UnwindPlan to
the FrameType on the RegisterContextLLDB it generates, and factor out a
helper to resolve symbol and address range for an Address now that we
need to invoke it in four places.

Reviewers: jasonmolenda, clayborg, jfb

Reviewed By: jasonmolenda

Subscribers: labath, dexonsmith, lldb-commits

Tags: #lldb

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

llvm-svn: 367691
2019-08-02 16:53:42 +00:00
Pavel Labath
23f70e8359 SymbolVendor: Introduce Module::GetSymbolFile
Summary:
This is the next step in avoiding funneling all SymbolFile calls through
the SymbolVendor. Right now, it is just a convenience function, but it
allows us to update all calls to SymbolVendor functions to access the
SymbolFile directly. Once all call sites have been updated, we can
remove the GetSymbolVendor member function.

This patch just updates the calls to GetSymbolVendor, which were calling
it just so they could fetch the underlying symbol file. Other calls will
be done in follow-ups.

Reviewers: JDevlieghere, clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 367664
2019-08-02 08:16:35 +00:00
Raphael Isemann
9eedbc4f26 [lldb][NFC] Remove unused imports in python tests
llvm-svn: 367663
2019-08-02 08:06:22 +00:00
Jonas Devlieghere
e063eccc19 Format OptionEnumValueElement (NFC)
Reformat OptionEnumValueElement to make it easier to distinguish between
its fields. This also removes the need to disable clang-format for these
arrays.

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

llvm-svn: 367638
2019-08-02 00:18:44 +00:00
Harlan Haskins
84586c1423 [clang] Change FileManager to use llvm::ErrorOr instead of null on failure
Summary:
Currently, clang's FileManager uses NULL as an indicator that a particular file
did not exist, but would not propagate errors like permission issues. Instead,
teach FileManager to use llvm::ErrorOr internally and return rich errors for
failures.

Reviewers: arphaman, bruno, martong, shafik

Subscribers: nemanjai, kbarton, MaskRay, jkorous, dexonsmith, kadircet, jsji, cfe-commits, lldb-commits

Tags: #clang, #lldb

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

llvm-svn: 367618
2019-08-01 21:32:04 +00:00
Jonas Devlieghere
52f12f63f4 Fix skipIfSanitized decorator on macOS
For security reasons, DYLD_INSERT_LIBRARIES is not propagated to a child
process. This breaks the skipIfSanitized decorator, which checks for the
environment variable being set. Instead, always set the ASAN_OPTIONS and
make the decorator check for that.

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

llvm-svn: 367595
2019-08-01 18:35:40 +00:00
Adrian McCarthy
5f5379d076 Fix TestThreadSpecificBreakpoint on Windows
This test was frequently hanging on Windows, causing a timeout after
10 minutes.  The short delay (100 microsecond) in the sample program
could cause a deadlock in the Windows thread pool, as I've explained
in the test program's comments.

Now that it doesn't hang, it passes reliably, so I've removed the
Windows-specific XFAIL.

I've tried to clarify the comments in TestThreadSpecificGBreakpoint.py
by eliminating some redundancy and typos, and I simplified away a
couple unnecessary assignments.

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

llvm-svn: 367573
2019-08-01 14:49:54 +00:00
Pavel Labath
eb1ea481a2 Add llvm-dwarfdump to the list of test dependencies
It is used by SymbolFile/DWARF/debug-types-dwo-cross-reference.cpp

llvm-svn: 367554
2019-08-01 12:50:25 +00:00
Fangrui Song
caf03a41f3 [lit] Use ld.lld -z separate-code to work around a debug_line parsing bug
The issue was exposed by D64903/r367537.
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/7321/

In these tests, .debug_str immediately follows .text.
The last section of last RX PT_LOAD was originally padded with trap
instructions and .debug_str started at a new page (actually
common-page-size). Now, .debug_str immediately follows .test.
Add -z separate-code to use the old layout.

llvm-svn: 367549
2019-08-01 12:34:43 +00:00
Raphael Isemann
0a39368b6c [lldb][NFC] Make ClangDiagnostic::m_fixit_vec private
llvm-svn: 367542
2019-08-01 11:05:47 +00:00
Stefan Granitz
3fe3529955 [lldb][docs] Update landing page for monorepo
Summary: Following up from D65330, here's an update for the landing page.

Reviewers: jryans, clayborg, amccarth, labath

Reviewed By: jryans, amccarth, labath

Subscribers: arphaman, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 367539
2019-08-01 10:33:54 +00:00
Stefan Granitz
ed38be87fc [lldb][CMake] Avoid 'Autogenerate scheme' dialogs in Xcode projects
Summary:
Supported in CMake 3.9 and higher: https://cmake.org/cmake/help/v3.9/variable/CMAKE_XCODE_GENERATE_SCHEME.html
Older versions will just report it as unused in the end of the configuration process.

Reviewers: jingham, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 367538
2019-08-01 10:33:44 +00:00
Jonas Devlieghere
70df51b8a9 [Reproducers] Force replay in synchronous mode.
Replaying a reproducer in asynchronous mode never makes sense. This
patch disables asynchronous mode during replay.

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

llvm-svn: 367494
2019-07-31 23:34:45 +00:00
Jonas Devlieghere
970a57907e [GDBRemote] Reflow comments and improve docs.
Improved the GDB client base documentation while I was reading through
it. Looks like it got messed up during the automatic comment reflow a
while ago.

llvm-svn: 367481
2019-07-31 20:47:44 +00:00
Alex Langford
70402bfc46 [API] Remove use of ClangASTContext from SBTarget
Summary:
The methods to find types in a Target aren't clang specific and are
pretty generalizable to type systems. Additionally, to support some of
the use cases in SBTarget, I've added a "GetScratchTypeSystems" method
to Target to support getting all type systems for a target we are
debugging.

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

llvm-svn: 367480
2019-07-31 20:47:38 +00:00
Jonas Devlieghere
35e6f7550c [CommandCompletions] Remove commented out code.
We use version control here.

llvm-svn: 367459
2019-07-31 18:09:26 +00:00
Jonas Devlieghere
07b1a2b9ae Fix completion for functions in anonymous namespaces
I was going through some of the old bugs and came across PR21069 which I
was able to reproduce. The issue is that we match the regex `^foo`
against the `DW_AT_name` in the DWARF, which for our anonymous function
is indeed `foo`. However, when we get the function name from the symbol
context, the result is `(anonymous namespace)::foo()`. This throws off
completions, which assumes that it's appending to whatever is already
present on the input, resulting in a bogus
`b fooonymous\ namespace)::foo()`.

Bug report: https://llvm.org/PR21069

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

llvm-svn: 367455
2019-07-31 17:58:00 +00:00
Greg Clayton
af44f18ad6 Don't crash when pass by value struct has no definition.
llvm-svn: 367441
2019-07-31 16:24:55 +00:00
Raphael Isemann
c8c5226145 [lldb][NFC] Check in completion crash test case
llvm-svn: 367420
2019-07-31 12:15:21 +00:00
Pavel Labath
a9d58436af Fix issues with inferior stdout coming out of order
Summary:
We've had a bug where two pieces of code, executing on two threads were
attempting to write inferior output simultaneously. The first one was in
Debugger::HandleProcessEvent, which handled the cases where stdout was
coming while the process was running. The second was in
CommandInterpreter::IOHandlerInputComplete, which was ensuring that any
output is printed before the command which caused process to run
terminates.

Both of these things make sense, but the fact they were implemented as
two independent functions without any synchronization meant that race
conditions could occur (e.g. both threads call process->GetSTDOUT, get
two chunks of data, but then end up calling stream->Write in opposite
order). This was most apparent in situations where a process quickly
writes a bunch of output and then exits (as all our register tests do).

This patch adds a mutex to ensure that stdout forwarding happens
atomically. It also refactors a code somewhat in order to reduce code
duplication.

Reviewers: clayborg, jingham

Subscribers: jfb, mgorny, lldb-commits

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

llvm-svn: 367418
2019-07-31 12:06:50 +00:00
Raphael Isemann
005eff04cc [lldb][NFC] Check in another crashing test case
llvm-svn: 367416
2019-07-31 12:06:22 +00:00
Tatyana Krasnukha
e98b4188dc [ProcessWindows] Choose a register context file by preprocessor
Replaced Cmake option based check with the preprocessor macro as CMAKE_SYSTEM_PROCESSOR doesn't work as expected on Windows.

Fixes llvm.org/pr42724

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

llvm-svn: 367414
2019-07-31 12:00:30 +00:00
Pavel Labath
e84f78412b Add llvm-style RTTI to ObjectFile hierarchy
Summary:
On the heels of D62934, this patch uses the same approach to introduce
llvm RTTI support to the ObjectFile hierarchy. It also replaces the
existing uses of GetPluginName doing run-time type checks with
llvm::dyn_cast and friends.

This formally introduces new dependencies from some other plugins to
ObjectFile plugins. However, I believe this is fine because:
- these dependencies were already kind of there, and the only reason
  we could get away with not modeling them explicitly was because the
  code was relying on magically knowing what will GetPluginName() return
  for a particular kind of object files.
- the dependencies themselves are logical (it makes sense for
  SymbolVendorELF to depend on ObjectFileELF), or at least don't
  actively get in the way (the JitLoaderGDB->MachO thing).
- they don't introduce any new dependency loops as ObjectFile plugins
  don't depend on any other plugins

Reviewers: xiaobai, JDevlieghere, espindola

Subscribers: emaste, mgorny, arichardson, MaskRay, lldb-commits

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

llvm-svn: 367413
2019-07-31 11:57:34 +00:00
Raphael Isemann
525d27006d [lldb][NFC] Check in completion crash test in lambda
llvm-svn: 367411
2019-07-31 11:33:16 +00:00
Pavel Labath
3a3ca963be Add missing includes to SymbolFilePDBTests
These became needed after r367368.

llvm-svn: 367410
2019-07-31 11:31:05 +00:00
Stefan Granitz
a60966daa2 [lldb][docs] Add CMake version notes for -B flag
The original documentation update was reviewed with D65330

llvm-svn: 367407
2019-07-31 10:31:57 +00:00
Pavel Labath
d2deeb4490 SymbolVendor: Remove the object file member variable
Summary:
The last responsibility of the SymbolVendor was to hold an owning
reference to the object file (in case symbols are being read from a
different file than the main module). As SymbolFile classes already hold
a non-owning reference to the object file, we can easily remove this
responsibility of the SymbolVendor by making the SymbolFile reference
owning.

Reviewers: JDevlieghere, clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 367392
2019-07-31 08:25:25 +00:00
Richard Trieu
33cdbff2a7 Change '|' to '&' in conditional.
Bitwise-or with a non-zero constant will always evaluate to true.  Switch to
bitwise-and which will only evalute to true if the specified bit is set in the
other operand.

llvm-svn: 367386
2019-07-31 04:41:05 +00:00
Jonas Devlieghere
b22860da61 [CompletionRequest] Remove unimplemented members.
Completion requests have two fields that are essentially unimplemented:
`m_match_start_point` and `m_max_return_elements`. This would've been
okay, if it wasn't for the fact that this caused a bunch of useless
parameters to be passed around. Occasionally there would be a comment or
assert saying that they are not supported. This patch removes them.

llvm-svn: 367385
2019-07-31 03:48:29 +00:00
Jonas Devlieghere
175f093090 [StringList] Change LongestCommonPrefix API
When investigating a completion bug I got confused by the API.
LongestCommonPrefix finds the longest common prefix of the strings in
the string list. Instead of returning that string through an output
argument, just return it by value.

llvm-svn: 367384
2019-07-31 03:26:10 +00:00
Jonas Devlieghere
be019c7a1f [TableGen] Move helpers into LLDBTableGenUtils.
Instead of polluting the LLDBTableGenBackends header with helpers used
by both emitters, move them into a separate files.

llvm-svn: 367377
2019-07-31 00:47:00 +00:00
Jonas Devlieghere
f63054f400 [TableGen] Include vector
Fixes "no member named 'vector' in namespace 'std'" compile error.

llvm-svn: 367375
2019-07-31 00:20:55 +00:00
Alex Langford
c1210c7e96 [SymbolFilePDB] Fix windows bots after rL367360
SymbolFilePDB tests were using GetTypeSystemForLanguage but weren't
changed to accomodate the use of an llvm::Expected. I adjusted them
accordingly.

llvm-svn: 367368
2019-07-30 23:48:03 +00:00
Jonas Devlieghere
310f6b89b1 [TableGen] Reuse typedef across emitters (NFC)
This moves the std::map typedef into the header so it can be reused by
all the emitter implementations.

llvm-svn: 367363
2019-07-30 22:50:37 +00:00
Alex Langford
0e252e38ef [Symbol] Use llvm::Expected when getting TypeSystems
Summary:
This commit achieves the following:
- Functions used to return a `TypeSystem *` return an
  `llvm::Expected<TypeSystem *>` now. This means that the result of a call
  is always checked, forcing clients to move more carefully.
- `TypeSystemMap::GetTypeSystemForLanguage` will either return an Error or a
  non-null pointer to a TypeSystem.

Reviewers: JDevlieghere, davide, compnerd

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 367360
2019-07-30 22:12:34 +00:00
Alex Langford
0723173114 [SymbolFile] SymbolFileDWARF::ParseLineTable should lock its module
As of svn rL367298, SymbolFileDWARF locks the module in many cases where
it needs to parse some aspect of the DWARF symbol file.
SymbolFileDWARF::ParseLineTable needs to lock the module because
SymbolVendor::ParseLineTable no longer locks it.

llvm-svn: 367358
2019-07-30 21:22:17 +00:00
Jonas Devlieghere
130ec06843 [Reproducers] Fix incorrect help message
The help message mentioned the `log` command (probably because I copied
it from there originally).

llvm-svn: 367338
2019-07-30 18:06:38 +00:00
Jonas Devlieghere
d3ae0bc310 [dotest] Remove multiprocessing
Now that the Xcode project is removed, I want to focus on dotest as a
test framework, and remove its driver capabilities for which we already
rely on llvm's lit. Removing multiprocessing is the first step in that
direction.

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

llvm-svn: 367331
2019-07-30 16:42:47 +00:00
Raphael Isemann
0b99518097 [lldb][NFC] Fix import-std-module tests that relied on fix-its to pass
These tests currently pass, but they rely on fix-its in our expression
parser to pass because they have some typos.

llvm-svn: 367309
2019-07-30 13:11:59 +00:00
Raphael Isemann
e010f6bab3 [lldb] Fix crash when tab-completing in multi-line expr
Summary:
Tab completing inside the multiline expression command can cause LLDB to crash. The easiest way
to do this is to go inside a frame with at least one local variable and then try to complete:

    (lldb) expr
    1. a[tab]

Reason for this was some mixup when we calculate the cursor position. Obviously we should calculate
the offset inside the string by doing 'end - start', but we are doing 'start - end' (which causes the offset to
become -1 which will lead to some out-of-bounds reading).

Fixes rdar://51754005

I don't see any way to test this as the *multiline* expression completion is completely untested at the moment
and I don't think we have any existing code for testing infrastructure for it.

Reviewers: shafik, davide, labath

Reviewed By: labath

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

Tags: #lldb

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

llvm-svn: 367308
2019-07-30 12:31:24 +00:00
Raphael Isemann
3e85b6f3bd [lldb][NFC] Check in crashing test case
llvm-svn: 367307
2019-07-30 12:20:03 +00:00
Stefan Granitz
39fba29861 [lldb][docs] Update documentation for monorepo and CMake caches
Summary: The lldb build system made good progress in the last months, but documentation was still lacking behind. Here's a patch to catch up.

Reviewers: JDevlieghere, jingham, labath, stella.stamenova, teemperor, jryans, kastiglione, xiaobai, compnerd, zturner

Reviewed By: labath, stella.stamenova, jryans

Subscribers: clayborg, amccarth, friss, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 367302
2019-07-30 10:21:28 +00:00
Pavel Labath
5c43ffd614 PECOFF: Fix a "memset clearing an object of non-trivial type" warning
This time, the warning pointed to an actual problem, because the
coff_opt_header structure contained a std::vector. I guess this happened
to work because the all-zero state was a valid representation of an
empty vector, but its not a good idea to rely on that.

I remove the memset, and have the structure clear its members in the
constructor instead.

llvm-svn: 367299
2019-07-30 08:42:42 +00:00
Pavel Labath
656ddeb2b7 SymbolVendor: Move locking into the Symbol Files
Summary:
The last bit of functionality in SymbolVendor passthrough functions is
the locking the module mutex. While it may be nice doing the locking in
a central place, we weren't really succesful in doing that right now,
because some SymbolFile function could still be called without going
through the SymbolVendor. This meant in SymbolFileDWARF (the only
battle-tested symbol file implementation) roughly a half of the
functions was taking additional locks and another half was asserting
that the lock is already held. By making the SymbolFile responsible for
locking, we can at least make the situation in SymbolFileDWARF more
consistent.

Reviewers: clayborg, JDevlieghere, jingham, jdoerfert

Subscribers: aprantl, lldb-commits

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

llvm-svn: 367298
2019-07-30 08:20:05 +00:00
Michal Gorny
89a214eaf1 [lldb] [test/lldb-vscode] Use realpath to match vscode behavior
Compare the directory paths returned by lldb-vscode against realpaths
rather than apparent paths.  This matches lldb-vscode behavior
and therefore fixes test failures when one of the parent directories
of the source tree is a symlink.

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

llvm-svn: 367291
2019-07-30 07:47:22 +00:00
Michal Gorny
71e32aca46 [lldb] [test/lldb-vscode] Use os.path.dirname() [NFC]
Replace os.path.split()[0] with os.path.dirname().  Suggested by Pavel
Labath in D65432.

llvm-svn: 367290
2019-07-30 07:47:16 +00:00
Michal Gorny
f9108f76fa [lldb] [test] Mark newly running test XFAIL on NetBSD
The test was not previously run due to decorator bug (fixed in r366903).
It is not a regression and is probably related to the other failing
test, so just disable it.

llvm-svn: 367285
2019-07-30 06:12:03 +00:00