Commit Graph

19011 Commits

Author SHA1 Message Date
Jason Molenda 9d760a0a76 Change the logging on ptrace(PT_KILL) in MachProcess::Kill to log
if LOG_PROCESS is enabled or if there was an error making that call.

<rdar://problem/49036508> 

llvm-svn: 356626
2019-03-20 22:59:16 +00:00
Jason Molenda db5edebea2 Update DWARF files.
llvm-svn: 356625
2019-03-20 22:57:33 +00:00
Zachary Turner 6e66512758 Introduce DWARFContext.
LLVM's DWARF parsing library has a class called DWARFContext which holds
all of the various DWARF data sections and lots of other information.
LLDB's on the other hand stores all of this directly in SymbolFileDWARF
/ SymbolFileDWARFDwo and passes this interface around through the
parsing library. Obviously this is incompatible with a world where the
low level interface does not depend on the high level interface, so we
need to move towards a model similar to LLVM's - i.e. all of the context
needed for low level parsing should be in a single class, and that class
gets passed around.

This patch is a small incremental step towards achieving this. The
interface and internals deviate from LLVM's for technical reasons, but
the high level idea is the same. The goal is, eventually, to remove all
occurrences of SymbolFileDWARF from the low level parsing code.

For now I've chosen a very simple section - the .debug_aranges section
to move into DWARFContext while leaving everything else unchanged. In
the short term this is a bit confusing because now the information you
need might come from either of 2 different locations. But it's a huge
refactor to do this all at once and runs a much higher risk of breaking
things. So I think it would be wise to do this in very small pieces.

TL;DR - No functional change

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

llvm-svn: 356612
2019-03-20 20:49:25 +00:00
Raphael Isemann 5e3a7698e8 Remove the unused return value in ASTImporter::Imported [NFC]
Summary:
`ASTImporter::Imported` currently returns a Decl, but that return value is not used by the ASTImporter (or anywhere else)
nor is it documented.

Reviewers: balazske, martong, a.sidorin, shafik

Reviewed By: balazske, martong

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

llvm-svn: 356592
2019-03-20 19:00:25 +00:00
Greg Clayton 621e8b4387 Fix UUID decoding from minidump files
This patch fixes:

UUIDs now don't include the age field from a PDB70 when the age is zero. Prior to this they would incorrectly contain the zero age which stopped us from being able to match up the UUID with real files.
UUIDs for Apple targets get the first 32 bit value and next two 16 bit values swapped. Breakpad incorrectly swaps these values when it creates darwin minidump files, so this must be undone so we can match up symbol files with the minidump modules.
UUIDs that are all zeroes are treated as invalid UUIDs. Breakpad will always save out a UUID, even if one wasn't available. This caused all files that have UUID values of zero to be uniqued to the first module that had a zero UUID. We now don't fill in the UUID if it is all zeroes.
Added tests for PDB70 and ELF build ID based CvRecords.

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

llvm-svn: 356573
2019-03-20 16:50:17 +00:00
Zachary Turner 611d1f98c5 Delete more dead code.
All of this is code that is unreferenced.  Removing as much of
this as possible makes it more easy to determine what functionality
is missing and/or shared between LLVM and LLDB's DWARF interfaces.

llvm-svn: 356509
2019-03-19 20:08:56 +00:00
Zachary Turner 2face4f68b Remove some dead DWARF enum -> string conversion functions.
llvm-svn: 356495
2019-03-19 18:32:43 +00:00
Zachary Turner aea0985814 Delete dead code.
Most of these are Dump functions that are never called, but there
is one instance of entire unused classes (DWARFDebugMacinfo and
DWARFDebugMacinfoEntry) which are also unreferenced in the codebase).

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

llvm-svn: 356490
2019-03-19 18:06:32 +00:00
Davide Italiano 60be633a47 [ScriptInterpreterPython] Remove dead code.
llvm-svn: 356487
2019-03-19 17:35:40 +00:00
Davide Italiano b137c3570a [StackFrameRecognizer] Remove unneeded LLDB_DISABLE_PYTHON.
llvm-svn: 356486
2019-03-19 17:35:37 +00:00
Michal Gorny ae211ece6a [lldb] [Reproducer] Move SBRegistry registration into declaring files
Move SBRegistry method registrations from SBReproducer.cpp into files
declaring the individual APIs, in order to reduce the memory consumption
during build and improve maintainability.  The current humongous
SBRegistry constructor exhausts all memory on a NetBSD system with 4G
RAM + 4G swap, therefore making it impossible to build LLDB.

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

llvm-svn: 356481
2019-03-19 17:13:13 +00:00
Zachary Turner 66158c00f9 Remove a couple of log statements.
These log statements have questionable value, and hinder the effort
of separating the high and low level DWARF parsing interfaces inside
of LLDB.  Removing them for now, and if/when we need such log statements
again in the future, we can add them back (if possible) or introduce a
mechanism for logging from the low-level interface in such a way that it
isn't coupled to the high level interface.

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

llvm-svn: 356469
2019-03-19 16:26:08 +00:00
Adrian Prantl da8c0e4a3c Improve error handling for Clang module imports.
rdar://problem/48883558

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

llvm-svn: 356462
2019-03-19 15:38:26 +00:00
Pavel Labath 06453b0619 Fix a "memset clearing an object of non-trivial type" warning in EmulateInstruction
This is a new warning which started appearing as of gcc-8. The Opcode
class has a non-trivial constructor, so the idea of the warning is that
code should use that to initialize the object instead of using memset
(which can perturb class invariants set up by the constructor). In this
case, the Opcode default constructor was already clearing the object's
fields so we can just drop the memset call.

While I'm touching the EmulateInstruction constructor, I also move the
initialization of other members into the class declaration.

llvm-svn: 356459
2019-03-19 15:05:55 +00:00
Jason Molenda 2d5e7adf26 A target definition file that may work for
Aarch32 Cortex-M target processor debugging.

<rdar://problem/48448564> 

llvm-svn: 356416
2019-03-18 21:39:54 +00:00
Alex Langford b4a3b29d16 [CMake] Set LLVM_DEFAULT_EXTERNAL_LIT in standalone build correctly on windows
LLVM installed llvm-lit with a .py suffix on windows. Let's match that
behavior here.

llvm-svn: 356412
2019-03-18 21:32:31 +00:00
Davide Italiano 65dc65216e [API] Remove unneded LLDB_DISABLE_PYTHON markers.
llvm-svn: 356401
2019-03-18 20:02:27 +00:00
Pavel Labath 0e5012eac3 Skip TestVSCode_setFunctionBreakpoints on linux
Test hangs under heavy load.

llvm-svn: 356379
2019-03-18 16:04:53 +00:00
Pavel Labath 370e5dbacd Fix some "variable 'foo' set but not used" warnings
gcc-8 diagnoses these.

llvm-svn: 356378
2019-03-18 16:04:46 +00:00
Pavel Labath 22457e66c5 Fix libstdc++ data formatters for python3
Use floor-division for consistentcy across python versions. This fixes a
couple of libstdc++ data formatter tests.

llvm-svn: 356377
2019-03-18 15:42:08 +00:00
Pavel Labath 58e9ef139d Fix TestCommandScriptImmediateOutput for python3
s/iteritems/items

llvm-svn: 356370
2019-03-18 14:13:12 +00:00
Pavel Labath f92ddfed5a Fix "type qualifiers ignored on cast result type" warnings
These warnings start to get emitted with gcc-8.

llvm-svn: 356362
2019-03-18 10:50:46 +00:00
Pavel Labath dec963921b Reinitialize UnwindTable when the SymbolFile changes
Summary:
This is a preparatory step to enable adding of unwind plans by symbol
file plugins.

Although at the surface it seems that currently symbol files have
nothing to do with unwinding, this isn't entirely correct even now. The
mere act of adding a symbol file can have the effect of making more
sections (typically .debug_frame) available to the unwinding machinery,
so that it can have more unwind strategies to choose from.

Up until now, we've had a bug, which went largely unnoticed, where
unwind info in the manually added symbols files (target symbols add) was
being ignored during unwinding. Reinitializing the UnwindTable fixes
that bug too.

Reviewers: clayborg, jasonmolenda, alexshap

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 356361
2019-03-18 10:45:02 +00:00
Zachary Turner 98661d0221 Abbreviation declarations are required to have non-null tags.
Treat a null tag as an error.

llvm-svn: 356284
2019-03-15 18:00:43 +00:00
Zachary Turner 1cbbab9277 Return Error and Expected from more DWARF interfaces.
This continues the work of introducing Error and Expected into
the DWARF parsing interfaces, this time for the DWARFCompileUnit
and DWARFDebugAranges classes.

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

llvm-svn: 356278
2019-03-15 17:32:05 +00:00
Adrian Prantl 2ebbb88960 Implement a better way of not passing the sanitizer environment on to tests.
rdar://problem/48889580

llvm-svn: 356275
2019-03-15 17:22:00 +00:00
Davide Italiano bbcda82e21 [DataFormatters] Remove LLDB_DISABLE_PYTHON from TypeCategory.
llvm-svn: 356271
2019-03-15 16:55:51 +00:00
Pavel Labath 1de5a2ef96 Fix a typo in FindLibEdit.cmake
The package name is LibEdit, so we should use that name in the call to
find_package_handle_standard_args. Failing to do so results in the
standard_args (such as the one telling us whether REQUIRED was used in
the find_package invocation) not being handled.

llvm-svn: 356263
2019-03-15 14:03:52 +00:00
Pavel Labath a933d6c7c0 Delete type_sp member from TypePair
Summary:
As discussed in the review of D59217, this member is unnecessary since
always the first thing we do is convert it to a CompilerType.

This opens up possibilities for further cleanups (e.g. the whole
TypePair class now loses purpose, since we can just pass around
CompilerType everywhere), but I did not want to do that yet, because I
am not sure if this will not introduce breakages in some of the
platforms/configurations that I am not testing on.

Reviewers: clayborg, zturner, jingham

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 356262
2019-03-15 14:02:35 +00:00
Jorge Gorbe Moya 717b1c804b [lldb-vscode] Fix dangling pointer in request_evaluate.
SBError::GetCString() returns a pointer to a string owned by the SBError
object. The code here was calling GetCString on a temporary and using
the returned pointer after the temporary was destroyed.

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

llvm-svn: 356227
2019-03-15 01:46:50 +00:00
Davide Italiano 71560b5e2b [DataFormatters] Remove LLDB_DISABLE_PYTHON from FormatManager.
And DataVisualization. One step closer.

llvm-svn: 356225
2019-03-15 00:45:57 +00:00
Davide Italiano 3772796aaa [ObjCLanguage] Remove LLDB_DISABLE_PYTHON markers from the formatters.
llvm-svn: 356210
2019-03-14 22:12:59 +00:00
Zachary Turner bb26a7eb11 Return llvm::Error and llvm::Expected from DWARF parsing code.
The goal here is to improve our error handling and error recovery while
parsing DWARF, while at the same time getting us closer to being able to
merge LLDB's DWARF parser with LLVM's. To this end, I've udpated several
of the low-level parsing functions in LLDB to return llvm::Error and
llvm::Expected.

For now, this only updates LLDB parsing functions and not LLVM. In some
ways, this actually gets us *farther* from parity with the two
interfaces, because prior to this patch, at least the parsing interfaces
were the same (i.e. they all just returned bools, and now with this
patch they're diverging). But, I chose to do this for two primary
reasons.

LLDB has error logging code engrained deep within some of its parsing
functions. We don't want to lose this logging information, but obviously
LLVM has no logging mechanism at all. So if we're to merge the
interfaces, we have to find a way to still allow LLDB to properly report
parsing errors while not having the reporting code be inside of LLVM.
LLDB (and indeed, LLVM) overload the meaning of the false return value
from all of these extraction functions to mean both "We reached the null
entry at the end of a list of items, therefore everything was
successful" as well as "something bad and unrecoverable happened during
parsing". So you would have a lot code that would do something like:
while (foo.extract(...)) {
  ...
}

But when the loop stops, why did it stop? Did it stop because it
finished parsing, or because there was an error? Because of this, in
some cases we don't always know whether it is ok to proceed, or how to
proceed, but we were doing it anyway.

In this patch, I solve the second problem by introducing an
enumeration called DWARFEnumState which has two values MoreItems and
Complete. Both of these indicate success, but the latter indicates
that we reached the null entry. Then, I return this value instead of
bool, and convey parsing failure separately.

To solve the first problem (and convey parsing failure) these
functions now return either llvm::Error or llvm::Expected<DWARFEnumState>.
Having this extra bit of information allows us to properly convey all 3 of
"error, bail out", "success, call this function again", and "success,
don't call this function again".

In subsequent patches I plan to extend this pattern to the rest of the
parsing interfaces, which will ultimately get all of the log statements
and error reporting out of the low level parsing code and into the high
level parsing code (e.g. SymbolFileDWARF, DWARFASTParserClang, etc).

Eventually, these same changes will have to be backported to LLVM's
DWARF parser, but diverging in the short term is the easiest way to
converge in the long term.

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

llvm-svn: 356190
2019-03-14 19:05:55 +00:00
Davide Italiano 1dbbf2de33 [DataFormatters] Delete unused code. Not even exposed in the API.
I stumbled upon this while removing LLDB_DISABLE_PYTHON when
not needed.

llvm-svn: 356176
2019-03-14 17:41:29 +00:00
Raphael Isemann d63c1dbd4b Safer casting in ClangExpressionParser code completion
Summary:
Makes the code a bit safer in the unlikely situation that we don't get a ClangUserExpression
when doing code completion.

Reviewers: aprantl, jingham

Reviewed By: aprantl

Subscribers: labath, jdoerfert, lldb-commits

Tags: #lldb

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

llvm-svn: 356174
2019-03-14 17:39:39 +00:00
Davide Italiano f6a84ed30b [Python] Start eradicating unneeded LLDB_DISABLE_PYTHON guards.
While we don't have a bot, I'm testing by hand that this configuration
compiles. We'll probably set up one once I'm done flensing.

llvm-svn: 356171
2019-03-14 17:23:08 +00:00
Jonas Devlieghere fa3f6401da [Reproducers] Fix data race found by tsan
This fixes a data race uncovered by tsan during destruction of the
GDBRemoteReplay server. The solution is to lock the thread state mutex
when receiving packets.

llvm-svn: 356168
2019-03-14 17:19:34 +00:00
Adrian Prantl ac093d61c4 Fix a double-overrelease in the TestDataFormatterObjC test program.
llvm-svn: 356160
2019-03-14 15:58:21 +00:00
Adrian Prantl 23b37bf362 Make sure that a sanitizer LLDB's environment doesn't get passed on
to test binaries.

llvm-svn: 356113
2019-03-14 00:46:15 +00:00
Jorge Gorbe Moya d383a342aa [lldb-vscode] Don't try to launch an invalid program.
If an invalid program is specified, lldb-vscode will send back a
response with "success" = false, but then will continue executing the
rest of request_launch(), try to launch the program anyway and try to
send another response (possibly using the `response` object after it was
moved).

This change adds a return statement so we stop executing the handler
after producing the first failing response.

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

llvm-svn: 356110
2019-03-13 23:50:35 +00:00
Jason Molenda 97866d74db Reorder the operations in
DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule a
bit so that we only read the binaries out of memory once we've
determined that we can find a real binary on the local system.  

Previously, lldb would read all of the kext binaries out of memory
and then determine if it had the local copy.  The kext table gives
us most the information we need (address, name, uuid) so lldb only
needs the actual in-memory load commands when it comes time to set
the section load addresses.  Delay reading until that point for all
the kexts.

NFC; doing the operations in a different order.


<rdar://problem/41181173> 

llvm-svn: 356108
2019-03-13 23:34:20 +00:00
Davide Italiano 9e75a08409 [Python] Fix TestDataFormatterSmartArray to work across python versions.
Python 3 default encoding is utf-8, so taking random bytes and
interpreting them as a string might result in invalid unicode sequences.
As the only thing we care about here is that the formatter shows the
elements of the underyling array, relax the string matching (this is
good enough as all the elements are distinct so they resolve to different
strings).

llvm-svn: 356096
2019-03-13 20:04:34 +00:00
Adrian Prantl 7e34d78da1 Fix an invalid static cast in ClangExpressionParser.cpp
This was found by the green dragon sanitizer bot.

rdar://problem/48536644

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

llvm-svn: 356090
2019-03-13 19:46:30 +00:00
Alex Langford be9f3b636e [ExpressionParser] Restore removed intance of FileSystem::Resolve while resolving clang resource dir
I committed a change that removed this line, but I meant to restore it
befor committing.

llvm-svn: 356079
2019-03-13 18:51:22 +00:00
Jason Molenda 6a5fa552c7 Update.
llvm-svn: 356073
2019-03-13 18:24:42 +00:00
Stella Stamenova 823d9f3cdf [lldbsuite] Un-xfail TestPyObjSynthProvider on Windows
One of Davide's changes yesterday fixed the behavior on Windows, so the test is now passing.

llvm-svn: 356065
2019-03-13 16:53:53 +00:00
Adrian Prantl 81d03f3a8f Make sure FileSystem::Resolve preserves the path/file distinction.
This should finally fix TestPaths.py.

llvm-svn: 356057
2019-03-13 15:54:18 +00:00
Pavel Labath 01b595c0cb Fix/unify SBType comparison
Summary:
In my next step at cleaning up modify-python-lldb.py, I started focusing
on equality comparison. To my surprise, I found out that both python and
c++ versions of the SBType class implement equality comparison, but each
one does it differently. While the python version was implemented in
terms of type name equality, the C++ one used a deep comparison on the
underlying objects.

Removing the python version caused one test to fail (TestTypeList). This
happened because the c++ version of operator== boiled down to
TypePair::operator==, which contains two items: the compiler_type and
type_sp. In this case, the compiler_type was identical, but one of the
objects had the type_sp field unset.

I tried fixing the code so that both objects keep their type_sp member,
but it wasn't easy, because there are so many operations which just work
with the CompilerType types, and so any operation on the SBType (the
test in question was doing GetPointeeType on the type of one variable
and expecting it to match the type of another variable), cause that
second member to be lost.

So instead, here I relax the equality comparison on the TypePair
class. Now, this class ignores the type_sp for the purposes of
comparison, and uses the CompilerType only. This seems reasonable, as
each TypeSP is able to convert itself to a CompilerType.

Reviewers: clayborg, aprantl, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 356048
2019-03-13 13:45:14 +00:00
Davide Italiano 0b29af0f7c [TestBatchMode] We already log this output to a file.
llvm-svn: 356003
2019-03-13 02:47:51 +00:00
Davide Italiano cd49351212 [testsuite] Remove other traces broken in python 3.
They can be reinstated in case somebody needs to debug
this test in the future.

llvm-svn: 356002
2019-03-13 02:44:32 +00:00