Commit Graph

19074 Commits

Author SHA1 Message Date
Jonas Devlieghere 903a9c74f0 [Python] Remove readline module
Todd added this empty readline module to workaround an issue with an old
version of Python on Ubuntu in 2014 (18841). In the meantime, libedit
seems to have fixed the underlying issue, and indeed, I wasn't able to
reproduce this.

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

llvm-svn: 357277
2019-03-29 17:12:08 +00:00
Jim Ingham cdd4892f12 Use the multi-lockable form of std::lock for operator=
For = operators for lists that have mutexes, we were either
just taking the locks sequentially or hand-rolling a trick
to try to avoid lock inversion.  Use the std::lock mechanism
for this instead.

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

llvm-svn: 357276
2019-03-29 17:07:30 +00:00
Adrian Prantl 515d1306ff Don't abort() in lldb_assert and document why.
rdar://problem/49356014

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

llvm-svn: 357268
2019-03-29 16:12:27 +00:00
Shafik Yaghmour a1f1ff8896 Fix for regression test, since we rely on the formatter for std::vector in the test we need a libc++ category.
See differential https://reviews.llvm.org/D59847 for initial change that this fixes

llvm-svn: 357210
2019-03-28 20:25:57 +00:00
Jim Ingham 43aaafc0e1 Fix the swig typemap for "uint32_t *versions, uint32_t num_versions".
It was making a list of a certain size but not always filling in that
many elements, which would lead to a crash iterating over the list.

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

llvm-svn: 357207
2019-03-28 19:25:54 +00:00
Jonas Devlieghere c712bac78b [NFC] find_first_of/find_last_of -> find/rfind for single char.
For a single char argument, find_first_of is equal to find and
find_last_of is equal to rfind. While playing around with the plugin
stuff this caused an export failure because it always got inlined except
once, which resulted in an undefined symbol.

llvm-svn: 357198
2019-03-28 18:10:14 +00:00
Shafik Yaghmour 0f71a25e98 Regression test to ensure that we handling importing of std::vector of enums correctly
Summary:
https://reviews.llvm.org/D59845 added a fix for the IsStructuralMatch(...) specialization for EnumDecl this test should pass once this fix is committed.

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

llvm-svn: 357188
2019-03-28 17:22:13 +00:00
Jim Ingham 1432b9780b Copy the breakpoint site owner's collection so we can drop
the collection lock before we iterate over the owners calling ShouldStop.

BreakpointSite::ShouldStop can do a lot of work, and might by chance hit the same breakpoint
site again on another thread.  So instead of holding the site's owners lock
while iterating over them calling ShouldStop, I make a local copy of the list, drop the lock 
and then iterate over the copy calling BreakpointLocation::ShouldStop.

It's actually quite difficult to make this cause problems because usually all the
action happens on the private state thread, and the lock is recursive.

I have a report where some code hit the ASAN error breakpoint, went to 
compile the ASAN error gathering expression, in the course of compiling
that we went to fetch the ObjC runtime data, but the state of the program
was such that the ObjC runtime grubbing function triggered an ASAN error and 
we were executing that function on another thread.  

I couldn't figure out a way to reproduce that situation in a test.  But this is an 
NFC change anyway, it just makes the locking strategy more narrowly focused.

<rdar://problem/49074093>

llvm-svn: 357141
2019-03-28 01:51:33 +00:00
Davide Italiano 8ff45859c2 [Process] Reorder declarations and document ReadMemoryFromInferior.
llvm-svn: 357136
2019-03-28 00:07:33 +00:00
Davide Italiano 454e9428db [ObjectFileMachO] Remove another debugging aid.
Pointed out by Jason.

llvm-svn: 357135
2019-03-28 00:07:20 +00:00
Davide Italiano dfbcadf562 [ObjectFileMachO] Disable memory caching for savecore.
Summary:
It's not really useful, and largely increases the footprint.

<rdar://problem/49293525>

Reviewers: jasonmolenda

Subscribers: llvm-commits, lldb-commits

Tags: #llvm

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

llvm-svn: 357134
2019-03-28 00:07:07 +00:00
Nathan Lanza 50a1186381 Teach TypeSystem about PDBASTParser
Currently, only ClangASTContext knows about PDBASTParser. Eventually
we want the TypeSystem to have getters/setters for the base parser
and then have the TypeSystem subclasses know about the proper
PDBASTParser subclasses. This is similar to how DWARFASTParsers work.

llvm-svn: 357131
2019-03-27 23:00:47 +00:00
Jonas Devlieghere 9a6c757252 [Python] Remove unused includes
llvm-svn: 357126
2019-03-27 21:45:11 +00:00
Adrian Prantl 07b74c32b2 Add LLDB_LIBDIR_SUFFIX to Config.h to unbreak the Xcode project
llvm-svn: 357115
2019-03-27 19:22:55 +00:00
Nathan Lanza 1a0a24f110 Kill unused variable m_tu_decl_up in SymbolFilePDB
Summary:
An TranslationUnitDecl was being brought in from the clang::ASTContext
which required clang specific code to exist in SymbolFilePDB.
Since it was unused we can just get rid of it along with the clang
specific code.

Reviewers: rnk, zturner, compnerd

Reviewed By: compnerd

Subscribers: jdoerfert

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

llvm-svn: 357113
2019-03-27 19:15:13 +00:00
Jonas Devlieghere f8819bd510 [Platform] Remove Kalimba Platform
This patch removes the Kalimba platform. For more information please
refer to the corresponding thread on the mailing list.

http://lists.llvm.org/pipermail/lldb-dev/2019-March/014921.html

llvm-svn: 357086
2019-03-27 16:23:50 +00:00
Pavel Labath 9f1a7e559c Rename some variables in the std-module tests
They cause failures on some systems due to an unrelated bug (pr35043).
This works around that.

llvm-svn: 357080
2019-03-27 15:52:11 +00:00
Pavel Labath ee7ceacaca minidump: Add ability to attach (breakpad) symbol files to placeholder modules
This re-commits r354263, which was because it uncovered with handling of
modules with empty (zero) UUIDs. This would cause us to treat two
modules as intentical even though they were not. This caused an assert
in PlaceholderObjectFile::SetLoadAddress to fire, because we were trying
to load the module twice even though it was designed to be only loaded
at a specific address. (The same problem also existed with the previous
implementation, but it had no asserts to warn us about this.) These
issues have now been fixed in r356896.

windows bot. The issue there was that ObjectFilePECOFF vended its base
address through the incorrect interface. SymbolFilePDB depended on that,
which lead to assertion failures when SymbolFilePDB was attempting to
use the placeholder object files as a base. This has been fixed in
r354258

The original commit message was:

The reason this wasn't working was that ProcessMinidump was creating odd
object-file-less modules, and SymbolFileBreakpad required the module to
have an associated object file because it needed to get its base
address.

This fixes that by introducing a PlaceholderObjectFile to serve as a
dummy object file. The general idea for this is taken from D55142, but
I've reworked it a bit to avoid the need for the PlaceholderModule
class. Now that we have an object file, our modules are sufficiently
similar to regular modules that we can use the regular Module class
almost out of the box -- the only thing I needed to tweak was the
Module::CreateModuleFromObjectFile functon to set the module's FileSpec
in addition to it's architecture. This wasn't needed for ObjectFileJIT
(the other user of CreateModuleFromObjectFile), but it shouldn't hurt it
either, and the change seems like a straightforward extension of this
function.

Reviewers: clayborg, lemo, amccarth

Subscribers: lldb-commits

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

llvm-svn: 357060
2019-03-27 10:54:10 +00:00
Pavel Labath ab0f18076b Fix a "memset clearing an object of non-trivial type" warning in DWARFFormValue
This is diagnosed by gcc-8. The ValueType struct already has a default
constructor which performs zero-initialization, so we can just call that
instead of using memset.

llvm-svn: 357056
2019-03-27 10:02:36 +00:00
Pavel Labath cf6c19c2d3 Fix an out-of-bounds error in RegisterContextDarwin_arm64
Summary:
gcc diagnoses this as "array subscript 63 is above array bounds of
'RegisterContextDarwin_arm64::VReg [32]'".

The correct fix seems to be subtracting the fpu register base index, but
I have no way of verifying that this actually works.

Reviewers: jasonmolenda

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

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

llvm-svn: 357055
2019-03-27 09:39:46 +00:00
Nathan Lanza d0050d1b8b Get the lang from the CompileUnit for ParseCompileUnitFunctionForPDBFunc
Summary:
Instead of assuming that the language is C++ instead check the compunit
for the language it received from the debug info.

Subscribers: aprantl, jdoerfert

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

llvm-svn: 357044
2019-03-27 01:24:03 +00:00
Duncan P. N. Exon Smith 1da7eac87c Frontend: Remove CompilerInstance::VirtualFileSystem, NFC
Remove CompilerInstance::VirtualFileSystem and
CompilerInstance::setVirtualFileSystem, instead relying on the VFS in
the FileManager.  CompilerInstance and its clients already went to some
trouble to make these match.  Now they are guaranteed to match.

As part of this, I added a VFS parameter (defaults to nullptr) to
CompilerInstance::createFileManager, to avoid repeating construction
logic in clients that just wanted to customize the VFS.

https://reviews.llvm.org/D59377

llvm-svn: 357037
2019-03-26 22:18:52 +00:00
Jonas Devlieghere 05495c5d45 [Python] Remove dynamic indirection
Now that the Python plugin relies on the SWIG symbols, we no longer need
to dynamically resolve these functions.

llvm-svn: 357034
2019-03-26 21:57:02 +00:00
Alex Langford 982726ea01 [ExpressionParser] Add swift-lldb case for finding clang resource dir
Summary:
I'm adding this to reduce the difference between swift-lldb and
llvm.org's lldb.

Reviewers: aprantl, davide, compnerd, JDevlieghere, jingham

Subscribers: lldb-commits

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

llvm-svn: 357030
2019-03-26 21:00:42 +00:00
Jorge Gorbe Moya d7aba76783 Add lldb-vscode as a dependency of lldb tests.
Summary:
In the current state, 'ninja check-lldb' runs the lldb-vscode tests, but it
won't rebuild lldb-vscode if any of its sources has changed. This is very
confusing when you fix something and the tests keep failing, or vice versa.

Reviewers: clayborg

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 357016
2019-03-26 18:36:44 +00:00
Davide Italiano 5c4fad0c23 [ScriptInterpreterPython] Try to make the sanitizer bot green again.
Removing a use-after-free error.

llvm-svn: 357006
2019-03-26 16:43:58 +00:00
Serge Guelton 1a12dd70c0 python 2/3 compat: commands vs subprocess
Differential Revision: https://reviews.llvm.org/D59584

llvm-svn: 356995
2019-03-26 14:46:15 +00:00
Pavel Labath 9876addcf4 Remove the TypePair class
Summary:
After D59297, the TypePair class kind of lost its purpose as it was no
longer a "pair". This finishes the job started in that patch and deletes
the class altogether. All usages have been updated to use CompilerType
class directly.

Reviewers: clayborg, jingham, zturner

Subscribers: mehdi_amini, dexonsmith, jdoerfert, lldb-commits

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

llvm-svn: 356993
2019-03-26 13:35:54 +00:00
Pavel Labath f2ffb47ff2 Minidump: Use minidump types defined in llvm
This is the next step in moving the minidump parsing into llvm. I remove
the minidump structures already defined in the llvm Object library and
convert our parser to use those. NFC.

llvm-svn: 356992
2019-03-26 13:23:01 +00:00
Jonas Devlieghere 282890d711 [Python] Define empty SWIG wrapper for unit testin"
The python plugin uses wrappers generated by swig. For the symbols to be
available, we'd need to link against liblldb, which is not an option
because the symbols could conflict with the static library we are
testing. Instead we define the symbols ourselves in the unit test.

llvm-svn: 356971
2019-03-26 01:11:15 +00:00
Jonas Devlieghere 1d1f1ba3d2 [Python] Move SWIG wrapper dependency into the plugin
This should fix the Windows bot (fingers crossed).

llvm-svn: 356967
2019-03-25 23:36:12 +00:00
Michal Gorny c5d7bc86b8 [lldb] [Process/NetBSD] Use nullptr to fix template arg deduction
llvm-svn: 356960
2019-03-25 22:29:29 +00:00
Jonas Devlieghere e3959de268 [PythonTestSuite] Fix usage of InitializePrivate in PythonTestSuite
llvm-svn: 356950
2019-03-25 21:07:53 +00:00
Jonas Devlieghere b29d82ebaf [ScriptInterpreterPython] Make SWIG callback private (NFC)
With the initialization taking place inside the Python script
interpreter, these function no longer need to be public. The exception
is the g_swig_init_callback which is used from the RAII object.

llvm-svn: 356944
2019-03-25 20:39:08 +00:00
Jonas Devlieghere b01b10877d [ScriptInterpreterPython] Move SWIG initialization into the Python plugin (NFC)
Abstract initialization of the Python SWIG support in the Python plugin.

llvm-svn: 356942
2019-03-25 20:14:31 +00:00
Jonas Devlieghere 7d3225c4b4 [Args] Handle backticks to prevent crash.
Currently LLDB crashes when autocompleting a command that ends with a
backtick because the quote character wasn't handled. This fixes that and
adds a unit test for this function.

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

llvm-svn: 356927
2019-03-25 17:27:14 +00:00
Adrian Prantl 040f94cc7e Update the lldb driver to support the -O and -S options when passing --repl
At the moment when --repl is passed to lldb it silently ignores any
commands passed via the options below:

--one-line-before-file <command>
                     Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
--one-line <command>
                     Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
--source-before-file <file>
                     Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
--source <file>
                     Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
-O <value>           Alias for --one-line-before-file
-o <value>           Alias for --one-line
-S <value>           Alias for --source-before-file
-s <value>           Alias for --source

The -O and -S options are quite useful when writing tests for the REPL
though, e.g. to change settings prior to entering REPL mode. This
patch updates the driver to still respect the commands supplied via -O
and -S when passing --repl instead of silently ignoring them. As -s
and -o don't really make sense in REPL mode, commands supplied via
those options are still ignored, but the driver now emits a warning to
make that clear to the user.

Patch by Nathan Hawes!

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

llvm-svn: 356911
2019-03-25 15:38:18 +00:00
Serge Guelton 3a22c3cc2b Python 2/3 compat: StringIO
Differential Revision: https://reviews.llvm.org/D59582

llvm-svn: 356910
2019-03-25 15:23:34 +00:00
Serge Guelton 6ee3804613 Python 2/3 compat: tkinter
Differential Revision: https://reviews.llvm.org/D59586

llvm-svn: 356909
2019-03-25 15:22:41 +00:00
Serge Guelton 0bc1447845 Python 2/3 compat: str vs basestring
Differential Revision: https://reviews.llvm.org/D59589

llvm-svn: 356908
2019-03-25 15:21:29 +00:00
Serge Guelton b833c6af59 Python 2/3 compat: queue vs Queue
Differential Revision: https://reviews.llvm.org/D59590

llvm-svn: 356906
2019-03-25 15:14:56 +00:00
Serge Guelton cdfcbbd348 Python 2/3 compat: unichr vs chr
llvm-svn: 356904
2019-03-25 15:12:48 +00:00
Pavel Labath d2b4888867 Minidump: Use minidump constants defined in llvm
This patch begins the process of migrating the "minidump" plugin to the
minidump parser in llvm. The llvm parser is not fully finished yet, but
even now, a lot of things can be switched over. The gradual migration
process will allow us to easier detect if things break than doing a big
one-step migration. Doing it early will allow us to make sure that the
llvm parser fits the use case that we need in lldb.

In this patch I start with the various minidump constants, which have
their llvm equivalent. It doesn't contain any functional changes. The
diff just reflects the different naming of things in llvm.

llvm-svn: 356898
2019-03-25 14:09:27 +00:00
Pavel Labath 2ef15d82e9 Reapply minidump changes reverted in r356806
The changes were reverted due to ubsan errors (unaligned accesses). Here
I fix those errors by first copying the data into aligned storage.
Besides fixing alignment issues, this also fixes reading of minidump
strings on big-endian systems.

llvm-svn: 356896
2019-03-25 14:02:16 +00:00
Hafiz Abid Qadeer de9d736495 Fix a broken comment line. NFC.
Just checking that commit access is working after licensing changes.

llvm-svn: 356876
2019-03-25 09:41:49 +00:00
Jonas Devlieghere 528ce4dd98 [Reproducers] Fix GDB remote flakiness during replay
This fixes the flakiness of the GDB remote reproducer during replay. It
was caused by a combination sending one ACK to many from the replay
server and the code that "flushes" any queued GDB remote packets in
GDBRemoteCommunicationClient::HandshakeWithServer.

The spurious ACK was the result of combining both implicit and explicit
handling of ACKs in the replay server. The handshake consists of an ACK
followed by an QStartNoAckMode. As long as we haven't seen any
QStartNoAckMode, we were sending implicit acknowledgments. So the first
ACK got acknowledged twice, once implicitly, and once as part of the
replay.

The reason we didn't notice this was the code in HandshakeWithServer
that "waits for any responses that might have been queued up in the
remote GDB server and flush them all". A 10ms timeout is used to move on
when no packets are left. If the second ACK didn't make it within those
10ms, all packets were offset by one.

llvm-svn: 356825
2019-03-22 23:33:17 +00:00
Davide Italiano 4f9cb26063 [ScriptInterpreter] Remove a warning and reformat comments.
llvm-svn: 356819
2019-03-22 22:38:49 +00:00
Davide Italiano 386f00db75 [ScriptInterpreter] Make sure that PYTHONHOME is right.
Summary:
For the only version of Python actually supported on Darwin.

<rdar://problem/40961425>

Reviewers: jingham, friss, JDevlieghere, aprantl, jasonmolenda

Subscribers: jdoerfert, llvm-commits, lldb-commits

Tags: #llvm

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

llvm-svn: 356816
2019-03-22 22:19:57 +00:00
Jonas Devlieghere f261638c10 Revert minidump changes
This reverts the following two commits:

Revert "Extend r356573 (minidump UUID handling) to cover elf build-ids too"
Revert "Fix UUID decoding from minidump files"

Greg's original commit broke the sanitizer bot which has been red for
several days now.

http://green.lab.llvm.org/green/view/LLDB/job/lldb-sanitized/

llvm-svn: 356806
2019-03-22 20:46:46 +00:00
Pavel Labath 4c2ef9a02b Revert "Move the rest of the sections over to DWARFContext."
This reverts commit r356682 because it breaks the DWO flavours of some
tests:
    lldb-Suite :: lang/c/const_variables/TestConstVariables.py
    lldb-Suite :: lang/c/local_variables/TestLocalVariables.py
    lldb-Suite :: lang/c/vla/TestVLA.py

llvm-svn: 356773
2019-03-22 16:07:58 +00:00