Commit Graph

19190 Commits

Author SHA1 Message Date
Aleksandr Urakov ee12a75e38 [NativePDB] Add anonymous namespaces support
Summary:
This patch adds anonymous namespaces support to the native PDB plugin.

I had to reference from the main function variables of the types that are inside
of the anonymous namespace to include them in debug info. Without the references
they are not included. I think it's because they are static, then are visible
only in the current translation unit, so they are not needed without any
references to them.

There is also the problem case with variables of types that are nested in
template structs. For now I've left FIXME in the test because this case is not
related to the change.

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

Reviewed By: amccarth

Subscribers: zloyrobot, aprantl, teemperor, lldb-commits, leonid.mashinskiy

Tags: #lldb

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

llvm-svn: 358873
2019-04-22 07:14:40 +00:00
Pavel Labath f6e8063145 Minidump: yamlify module-related unit tests
The tests reading the untouched module list are now not using any lldb
code (as module list loading lives in llvm now), so they can be removed.
The "filtering" of the module list remains (and probably will remain) an
lldb concept, so I keep those tests, but replace the checked-in binaries
with their yaml equivalents.

The binaries which are no longer referenced by any tests have been
removed.

llvm-svn: 358850
2019-04-21 13:12:40 +00:00
Pavel Labath d50ec8ef5c @skipIfLinux flaky lldb-mi tests
llvm-svn: 358848
2019-04-21 13:02:49 +00:00
Pavel Labath e8687e6ee1 Make TestVSCode_step pass reliably
Summary:
The test was failing occasionally (1% of runs or so), because of
unpredictable timings between the two threads spawned by the test. If
the second thread hit the breakpoint right as we were stepping out of
the function on the first thread, we would still be stuck at the inner
frame when the process stopped.

This would cause errors like:
    File "/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm/tools/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py", line 67, in test_step
      self.assertEqual(x1, x3, 'verify step out variable')
  AssertionError: 2 != 1 : verify step out variable

AFAICT, lldb-vscode is doing the right thing here, and the problem is
that the test is not taking this sequence of events into account. Since
the test is about testing stepping, it does not seem necessary to have
threads in the inferior at all, so I just rewrite the test to execute
the code we're supposed to step through directly on the main thread.

Reviewers: clayborg, jgorbe

Subscribers: jfb, lldb-commits

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

llvm-svn: 358847
2019-04-21 13:02:41 +00:00
Pavel Labath 27e9d982eb modify-python-lldb.py: Remove docstring formatting code
The strings have been already cleaned up in r358683, so this code is not
doing anything anymore.

While comparing the outputs before and after removing the formatting
code, I've found a couple of docstrings that managed to escape my perl
script in r358683, so I format them manually with this patch.

llvm-svn: 358846
2019-04-21 12:48:53 +00:00
Jonas Devlieghere d600e6fa85 [Tests] Split float test into float and doubles
As I was waiting for the test suite to complete at 99% I noticed this
test taking quite a bit of time. Since it's easy to split I just went
ahead and did so.

llvm-svn: 358792
2019-04-19 22:37:55 +00:00
Jonas Devlieghere f7f03622ec [Docs] Add more info about building the docs
Including the C++ and Python reference.

llvm-svn: 358777
2019-04-19 19:03:58 +00:00
Jim Ingham d42b381445 This test doesn't need to be run for all debug formats.
llvm-svn: 358776
2019-04-19 18:46:56 +00:00
Jonas Devlieghere 52cf94090f [Docs] Make Doxygen functional
This fixes the doxygen configuration to be functional again. I removed
the customer header and footer, as well as the no-longer-existent style
sheet. I also widened the scope of the documentation, from just the
public API to include the private interfaces as well.

llvm-svn: 358773
2019-04-19 18:02:35 +00:00
Davide Italiano 185de8eeaa [Python] Simplify the code. NFCI.
llvm-svn: 358721
2019-04-18 23:24:54 +00:00
Davide Italiano 085626a873 [crashlog] Strip trailing `\n` from check_output return.
Generally having spurious `\n` doesn't matter, but here the
returning string is a command which is executed, so  we want
to strip it. Pointed out by Jason.

llvm-svn: 358717
2019-04-18 21:32:36 +00:00
Sam McCall 3a75330f57 [CodeComplete] Remove obsolete isOutputBinary().
Summary:
It's never set to true. Its only effect would be to set stdout to binary mode.
Hopefully we have better ways of doing this by now :-)

Reviewers: hokein

Subscribers: jkorous, arphaman, kadircet, llvm-commits

Tags: #llvm

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

llvm-svn: 358696
2019-04-18 17:35:55 +00:00
Jonas Devlieghere f2293a95de [Docs] Add LLDB bots
llvm-svn: 358693
2019-04-18 17:31:20 +00:00
Stefan Granitz 31d0ce005c [CMake] Emit LLDB.framework.dSYM to avoid potential name collision with driver's lldb.dSYM
Summary:
Emit framework's dSYM bundle as LLDB.framework.dSYM instead of LLDB.dSYM, because the latter could conflict with the driver's lldb.dSYM when emitted in the same directory on case-insensitive file systems.
Requires https://reviews.llvm.org/D60862

Reviewers: friss, beanz, bogner

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 358686
2019-04-18 16:37:22 +00:00
Pavel Labath eba97426d4 Clean up docstrings in swig interface files
Summary:
This patch removes the "//----" frames and "///" leading lines from
docstring comments.  We already have code doing transformations like this in
modify-python-lldb.py, but that's a script I'd like to remove. Instead
of running these transformations everytime we run swig, we can just
perform equivalent on its input once.

This patch can be reproduced (e.g. for downstream merges) with the
following "sweet" perl command:

  perl -i -p -e 'BEGIN{ $/ = undef;} s:(" *\n) *//-----*\n:\1:gs; s:^(     *)/// ?:\1:gsm; s:^ *//------*\n( *\n)?( *"):\2:gsm; s: *$::gsm; s:\n *"\):"):gsm' scripts/interface/*.i

This command produces nearly equivalent python files to those produced
by the relevant code in modify-python-lldb.py. The only difference I
noticed is that here I am slightly more agressive in removing trailing
newlines from docstring comments (the python script seems to leave
newlines in class-level docstrings).

Reviewers: amccarth, clayborg, jingham, aprantl

Subscribers: lldb-commits

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

llvm-svn: 358683
2019-04-18 16:23:33 +00:00
Michal Gorny 36d6bf8841 [lldb] [test] Mark three more tests flakey/xfail on NetBSD
llvm-svn: 358660
2019-04-18 12:31:48 +00:00
Jonas Devlieghere ea6037d84e [Shell] Simplify Extracting Python Version
Instead of parsing the Python version with a fairly convoluted regex,
just print the major and minor version and call it a day.

llvm-svn: 358635
2019-04-18 01:37:19 +00:00
Kuba Mracek e5e9a6be6a [lldb] Don't filter variable list when doing a lookup by mangled name in SymbolFileDWARF::FindGlobalVariables
Differential Revision: https://reviews.llvm.org/D60737

llvm-svn: 358629
2019-04-18 00:15:44 +00:00
Davide Italiano 5f4c6dcc11 [Cmake] Add missing dependency for running tests.
This is needed now that we marked lldb-test as EXCLUDE_ALL, to
make sure `ninja lldb-test-deps` doesn't fail.

llvm-svn: 358625
2019-04-17 23:43:01 +00:00
Davide Italiano e3b5eba1ba [crashlog] Use the right path for dsymforUUID and remove an unnecessary import.
<rdar://problem/49925960>

llvm-svn: 358615
2019-04-17 21:51:55 +00:00
Frederic Riss 8ecb7bbe2b [CMake] Remove Apple-specific version logic.
We were using the LLDB-Info.plist as the canonical holder of the
version number, but there is really no good reason to do this. If
anything the plist should be generated using the information provided
to CMake.

For now just remove the logic extracting the version from the plist
and rely on LLDB_VERSION_STRING.

llvm-svn: 358604
2019-04-17 18:23:22 +00:00
Aaron Smith b8ec7eee81 Clear the output string passed to GetHostName()
LLVM's wchar to UTF8 conversion routine expects an empty string to store the output.
GetHostName() on Windows is sometimes called with a non-empty string which triggers
an assert. The simple fix is to clear the output string before the conversion.

llvm-svn: 358550
2019-04-17 03:13:06 +00:00
Davide Italiano b2930b8631 [tools] Only build lldb-test when needed.
llvm-svn: 358533
2019-04-16 21:56:07 +00:00
Alex Langford 7603bd52e3 [Process] Fix linux arm64 single step compilation failure
This was updated in r356703 to use llvm::sys::RetryAfterSignal, which
comes from llvm/Support/Errno.h. The header wasn't added, so it fails if
you compile for arm64/aarch64.

llvm-svn: 358530
2019-04-16 21:21:28 +00:00
Davide Italiano 6df6895d90 [tools] Make vscode and lldb-instr optional.
Summary:
Saves some build times, and they're not part of the usual
developer workflow.

Reviewers: JDevlieghere, friss

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 358528
2019-04-16 21:15:28 +00:00
Frederic Riss b47d356093 [debugserver] Relax the codesigning identity check
In an effort to help new LLDB developers, we added checks and messaging around
the selection of your codesigning identity on macOS. While helpful, it is not
actually correct. It's perfectly valid to codesign with an identity that is
not named lldb_codesign. Currently this fails the build.

This patch keeps a warning that informs developers how to setup lldb_codesign
and how to pass it to cmake, but it allows the build to proceed with a
different identity.

llvm-svn: 358525
2019-04-16 20:54:42 +00:00
Pavel Labath 9e31584e78 Fix symtab-macho.test broken by r358500
Put the correct UUID string into the breakpad file.

llvm-svn: 358508
2019-04-16 16:57:41 +00:00
Pavel Labath 025b9d0f2e Breakpad: Match the new UUID algorithm in minidumps
D59433 and D60501 changed the way UUIDs are computed from minidump
files. This was done to synchronize the U(G)UID representation with the
native tools of given platforms, but it created a mismatch between
minidumps and breakpad files.

This updates the breakpad algorithm to match the one found in minidumps,
and also adds a couple of tests which should fail if these two ever get
out of sync. Incidentally, this means that the module id in the breakpad
files is almost identical to our notion of UUIDs, so the computation
algorithm can be somewhat simplified.

llvm-svn: 358500
2019-04-16 14:51:47 +00:00
Pavel Labath fea82638b5 test/PECOFF: Remove REQUIRES: system-windows
These tests run fine on non-windows platforms too. Instead I add
REQUIRES: lld, as that is what they really require.

llvm-svn: 358499
2019-04-16 14:51:27 +00:00
Raphael Isemann bef588ce11 Fix typo in ArmUnwindInfo::GetUnwindPlan
Summary:
As reported in LLVM bug 41486, the check `(byte1 & 0xf8) == 0xc0` is wrong. We want to check for `11010nnn`,
so the proper value we want to compare against is `0xd0` (`0xc0` would check for the value `11000nnn` which we
already checked for above as described in the bug report).

Reviewers: #lldb, jasonmolenda

Reviewed By: #lldb, jasonmolenda

Subscribers: jasonmolenda, javed.absar, kristof.beyls, lldb-commits

Tags: #lldb

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

llvm-svn: 358479
2019-04-16 08:06:56 +00:00
Raphael Isemann 376230c9ef Correctly check if a warning message lacks a trailing new line
Summary: Fixes LLVM bug 41489.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 358477
2019-04-16 07:48:11 +00:00
Shafik Yaghmour e4b19c9c28 [ASTImporter] Regression test to ensure that we handling importing of anonymous enums correctly
Summary:
https://reviews.llvm.org/D51633 added error handling in the ASTImporter.cpp which uncovered an underlying bug in which we used the wrong name when handling naming conflicts. This could cause a segmentation fault when attempting to cast an int to an enum during expression parsing.

This test should pass once https://reviews.llvm.org/D59665 is committed.

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

llvm-svn: 358462
2019-04-15 23:05:45 +00:00
Raphael Isemann 12886f04ea Prevent unnecessary conversion from StringRef to C-string [NFC]
There is an alternative method to GetConstCStringWithLength that
takes a StringRef. GetConstCStringWithLength also calls this
method in the end, so directly calling the StringRef saves
us from a unnecessary conversion to a C-string.

llvm-svn: 358357
2019-04-14 14:01:49 +00:00
Michal Gorny fb70bc65fe [lldb] [lit/SymbolFile] Avoid -nostdlib in target-symbols-add-unwind.test
Do not use -nostdlib in target-symbols-add-unwind.test.  NetBSD uses
startup files to provide obligatory ELF notes in executables,
and therefore using -nostdlib requires providing specially tailored
input.  Otherwise, kernel rejects the result as invalid executable.

The replacement was suggested by Pavel Labath.

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

llvm-svn: 358329
2019-04-13 09:49:39 +00:00
Pavel Labath ce0a88a5e1 Fix compiler warning introduced by r358261
Add a virtual destructor to the class with virtual methods.

llvm-svn: 358284
2019-04-12 13:48:01 +00:00
Pavel Labath 539b7e65b4 Make TestPrintStackTraces deterministic
This test contained an incredibly complicated inferior, but in reality,
all it was testing was that we can backtrace up to main and see main's
arguments.

However, the way this was implemented (setting a breakpoint on a
separate thread) meant that each time the test would run, it would stop
in a different location on the main thread. Most of the time this
location would be deep in some libc function, which meant that the
success of this test depended on our ability to backtrace out of a
random function of the c library that the user happens to have
installed.

This makes the test unpredictable. Backtracing out of a libc function is
an important functionality, but this is not the way to test it. Often it
is not even our fault that we cannot backtrace out because the C library
contains a lot of assembly routines that may not have correct unwind
info associated with them.

For this reason the test has accumulated numerous @expectedFail/Flaky
decorators. In this patch, I replace the inferior with one that does not
depend on libc functions. Instead I create a couple of stack frames of
user code, and have the test verify that. I also simplify the test by
using lldbutil.run_to_source_breakpoint.

llvm-svn: 358266
2019-04-12 08:02:28 +00:00
Aaron Smith 4b0931bc17 [lldb-server] Update tests to use std::thread/mutex for all platforms
Summary:
Some cleanup suggested when bringing up lldb-server on Windows. 
Thanks to Hui Huang for the patch.

Reviewers: zturner, labath, jfb, Hui

Reviewed By: labath

Subscribers: clayborg, dexonsmith, lldb-commits

Tags: #lldb

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

llvm-svn: 358265
2019-04-12 07:48:49 +00:00
Pavel Labath 85ce053d7e PDBFPO: Improvements to the AST visitor
Summary:
This patch attempts to solve two issues made this code hard to follow
for me.

The first issue was that a lot of what these visitors do is mutate the
AST. The visitor pattern is not particularly good for that because by
the time you have performed the dynamic type dispatch, it's too late to
go back to the parent node, and change its pointer. The previous code
dealt with that relatively elegantly, but it still meant that one had to
perform manual type checks, which is what the visitor pattern is
supposed to avoid.

The second issue was not being able to return values from the Visit
functions, which meant that one had to store function results in member
variables (a common problem with visitor patterns).

Here, I solve both problems by making the visitor use a type switch
instead of going through double dispatch on the visited object.  This
allows one to parameterize the visitor based on the return type and pass
function results as function results. The mutation is fascilitated by
having each Visit function take two arguments -- a reference to the
object itself (with the correct dynamic type), and a reference to the
parent's pointer to this object.

Although this wasn't my explicit goal here, the fact that we're not
using virtual dispatch anymore  allows us to make the AST nodes
trivially destructible, which is a good thing, since we were not
destroying them anyway.

Reviewers: aleksandr.urakov, amccarth

Subscribers: lldb-commits

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

llvm-svn: 358261
2019-04-12 07:19:00 +00:00
Fangrui Song 35861f216b [IRMemoryMap] Fix -Wimplicit-fallthrough in -DLLVM_ENABLE_ASSERTIONS=off build
llvm-svn: 358249
2019-04-12 02:38:17 +00:00
Michal Gorny a318a7f665 [lldb] [lit/Register] XFAIL on Darwin
llvm-svn: 358224
2019-04-11 20:44:40 +00:00
Jonas Devlieghere bb6e3f6be7 [test] Fix & re-enable CommandScriptImmediateOutputFile on Windows
Apparently the shlex module produces garbage on Windows. I've added a
hand rolled split instead that should suffice for this test.

llvm-svn: 358216
2019-04-11 19:36:53 +00:00
Jonas Devlieghere 1fefee6a6e [test] Disable CommandScriptImmediateOutputFile on Windows
Somehow the path gets messed up. The command looks correct, but the
python path is not.

(lldb) mywrite
E:\build_slave\lldb-x64-windows-ninja\build\tools\lldb\lit\Commands\
  CommandScriptImmediateOutput\Output\
  CommandScriptImmediateOutputFile.test.tmp.read.txt r

No such file or directory:
'E:build_slavelldb-x64-windows-ninjabuildtoolslldblitCommands
  CommandScriptImmediateOutputOutput
  CommandScriptImmediateOutputFile.test.tmp.read.txt'

Maybe the shlex module is escaping it?

llvm-svn: 358213
2019-04-11 19:18:40 +00:00
Michal Gorny b971b59709 [lldb] [lit/Register] Mark x86-mm-xmm-read XFAIL on Windows
llvm-svn: 358188
2019-04-11 16:06:14 +00:00
Michal Gorny 53373432cf [lldb] [lit/Register] Fix test to use %clangxx
llvm-svn: 358184
2019-04-11 15:13:17 +00:00
Jonas Devlieghere d843da6218 [test] Convert CommandScriptImmediateOutput from pexpect to lit
This converts the CommandScriptImmediateOutput test from a python test
using pexpect to a lit test.

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

llvm-svn: 358180
2019-04-11 15:03:07 +00:00
Michal Gorny 40733618bd [lldb] [Process/NetBSD] Fix wrongly mapping mm* registers
Fix mistake that mapped mm* registers into the space for xmm* registers,
rather than the one shared with st* registers.  In other words,
'register read mmN' now correctly shows the mmN register rather than
part of xmmN.

Includes a minimal lit regression test.

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

llvm-svn: 358178
2019-04-11 14:58:48 +00:00
Pavel Labath 71b88b91f7 Minidump: extend UUID byte-swapping to windows platform
Summary:
D59433 added code to swap bytes UUIDs coming from minidump files, but
only enabled it for apple platforms. Based on my research, I believe
this is the correct thing to do for windows as well, as the natural way
of printing U(G)UIDs on this platforms is to print the first three
components as (4 or 2)-byte integers printed in natural (big-endian)
order. This makes the UUID string coming out of lldb match the strings
produced by other windows tools.

The decision to byte-swap the age field is somewhat arbitrary, because
the age field is usually printed separately from the file GUID (and
often in decimal). However, for our purposes (telling whether two files
are identical), including it in the UUID is correct, and printing it in
big-endian makes it easier to recognize the age value.

This also makes the UUIDs generated here (almost) match up with the
UUIDs computed for breakpad symbol files
(BreakpadRecords.cpp:parseModuleId), which already implemented the
byte-swapping. The "almost" is here because ObjectFileBreakpad does not
swap the age field, but I'll fix that in a follow-up.

There is no UUID support in ObjectFileCOFF at the moment, but ideally
the algorithms used here and in ObjectFileCOFF should be in sync so that
object file matching works correctly.

Reviewers: clayborg, amccarth, markmentovai, asmith

Subscribers: lldb-commits

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

llvm-svn: 358169
2019-04-11 14:14:07 +00:00
Adrian Prantl 3cc634d093 Fix undefined behavior in DWARFASTParser::ParseChildArrayInfo()
PR40827: https://bugs.llvm.org/show_bug.cgi?id=40827
<rdar://problem/48729057>

llvm-svn: 358137
2019-04-10 21:18:44 +00:00
Jonas Devlieghere 8b3af63b89 [NFC] Remove ASCII lines from comments
A lot of comments in LLDB are surrounded by an ASCII line to delimit the
begging and end of the comment.

Its use is not really consistent across the code base, sometimes the
lines are longer, sometimes they are shorter and sometimes they are
omitted. Furthermore, it looks kind of weird with the 80 column limit,
where the comment actually extends past the line, but not by much.
Furthermore, when /// is used for Doxygen comments, it looks
particularly odd. And when // is used, it incorrectly gives the
impression that it's actually a Doxygen comment.

I assume these lines were added to improve distinguishing between
comments and code. However, given that todays editors and IDEs do a
great job at highlighting comments, I think it's worth to drop this for
the sake of consistency. The alternative is fixing all the
inconsistencies, which would create a lot more churn.

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

llvm-svn: 358135
2019-04-10 20:48:55 +00:00
Jonas Devlieghere 6a7412a893 [testsuite] Split Obj-C foundation test
TestObjCMethods2.py was the third-longest running test on Darwin. By
splitting it up, lit can exploit parallelism to reduce the total wall
clock time.

llvm-svn: 358088
2019-04-10 14:30:00 +00:00