Commit Graph

17603 Commits

Author SHA1 Message Date
Jim Ingham d7e126c491 Use the API's to get the TargetSP.
llvm-svn: 335690
2018-06-26 23:54:50 +00:00
Jim Ingham b87b9e6a83 The Process class ivar ivar was changed to a weak pointer, but was still _sp.
Fix that to _wp.

llvm-svn: 335689
2018-06-26 23:38:58 +00:00
Jim Ingham d6cbdc3767 This is not a debug info sensitive test.
llvm-svn: 335688
2018-06-26 23:31:44 +00:00
Jim Ingham 504be79168 Reverting r335656, SWIG doesn't like "enum class".
llvm-svn: 335659
2018-06-26 20:40:29 +00:00
Tatyana Krasnukha b76dcd17d1 Amend "Change AddressClass type from 'enum' to 'enum class'".
r335599 changes usages of AddressClass, but doesn't change the type itself.

llvm-svn: 335656
2018-06-26 20:08:05 +00:00
Pavel Labath 2f93fd1f50 Represent invalid UUIDs as UUIDs with length zero
Summary:
During the previous attempt to generalize the UUID class, it was
suggested that we represent invalid UUIDs as length zero (previously, we
used an all-zero UUID for that). This meant that some valid build-ids
could not be represented (it's possible however unlikely that a checksum of
some file would be zero) and complicated adding support for variable
length build-ids (should a 16-byte empty UUID compare equal to a 20-byte
empty UUID?).

This patch resolves these issues by introducing a canonical
representation for an invalid UUID. The slight complication here is that
some clients (MachO) actually use the all-zero notation to mean "no UUID
has been set". To keep this use case working (while making it very
explicit about which construction semantices are wanted), replaced the
UUID constructors and the SetBytes functions with named factory methods.
- "fromData" creates a UUID from the given data, and it treats all bytes
  equally.
- "fromOptionalData" first checks the data contents - if all bytes are
  zero, it treats this as an invalid/empty UUID.

Reviewers: clayborg, sas, lemo, davide, espindola

Subscribers: emaste, lldb-commits, arichardson

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

llvm-svn: 335612
2018-06-26 15:12:20 +00:00
Tatyana Krasnukha 04803b3ef2 Change AddressClass type from 'enum' to 'enum class'.
If we have a function with signature f(addr_t, AddressClass), it is easy to muddle up the order of arguments without any warnings from compiler. 'enum class' prevents passing integer in place of AddressClass and vice versa.

llvm-svn: 335599
2018-06-26 13:06:54 +00:00
Jason Molenda 32a914256e A little cleanup in ObjectFileMachO::GetSDKVersion.
This method does one of two things:

1. finds a minimum os deployment version # in a Mach-O load
command and saves the three parts in the m_sdk_version, or

2. finds no valid min os version # load command, pushes a 
sentinel value on the m_sdk_version vector so we don't search
the same load commands multiple times.

There was a little bug when we found a load command with 
a version of 0.0.0 - the method would not add anything to
the m_sdk_version vector but would declare that a success.
It would not push the sentinel value to the vector.
There was code later in the method which assumed that
the vector always had a sentinel value, at least, and that
code could crash when this method was called back when
evaluating a Swift expression.  (these version #'s are 
fetched lazily so it wouldn't happen when the object file
was parsed, only when doing an expression that needed
the version #).

<rdar://problem/41372699> 

llvm-svn: 335556
2018-06-25 23:45:39 +00:00
Alexander Polyakov 32447ff5b9 Fix windows build for r335541.
I didn't include <functional> header and used std::function.

llvm-svn: 335552
2018-06-25 23:29:52 +00:00
Alexander Polyakov 9bca7483a5 Implement new methods for handling an error in MI commands.
Summary:
The new methods take SBError object and call handler,
specified by user, depending on SBError status.

Reviewers: aprantl, clayborg, labath

Reviewed By: aprantl, clayborg

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 335541
2018-06-25 22:01:44 +00:00
David Carlier 1c79e4e959 [LLDB] Select helper sign comparison fix
The constant could be unsigned thus explicit cast to silent compilation warnings

Reviewers: aprantl

Reviewed By: aprantl

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

llvm-svn: 335489
2018-06-25 16:10:20 +00:00
Pavel Labath f104d6b224 Fix TestThreadExit for gcc&libc++ combo
pseudo_barrier_wait() begins by decrementing an atomic variable. Since
these are always_inline in libc++, there is no line table anchor to
break on before we decrement it. This meant that on gcc we stopped after
the variable has been decremented, which meant that thread2 could have
exited, violating the test setup. On clang this wasn't a problem
because it generated some line table entries for the do{}while(0) loop
in the macro, so we still ended up stopping, before we touched the
variable.

I fix this by adding a dummy statement before the pseudo_barrier_wait()
command and setting the breakpoint there.

llvm-svn: 335476
2018-06-25 14:28:38 +00:00
Jonas Devlieghere c1cc3173d3 Revert "[FileSpec] Always normalize"
This reverts r335432 because remove_dots() is expensive and measuring
its impact showed an observable performance regression
(https://reviews.llvm.org/D45977#1078510).

llvm-svn: 335448
2018-06-25 10:11:53 +00:00
Jonas Devlieghere 4c92584eb2 [FileSpec] Always normalize
Removing redundant components from the path seems pretty harmless.
Rather than checking whether this is necessary and then actually doing
so, always invoke remove_dots to start with a normalized path.

llvm-svn: 335432
2018-06-24 13:31:44 +00:00
Jan Kratochvil 8fbb1fc229 Make testcase classnames unique
Filenames with test results contain only the class name which makes it more
difficult to find it if the same class name is present in multiple *.py files.

packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
-class ReturnValueTestCase(TestBase):
+class StepAvoidsNoDebugTestCase(TestBase):
as ReturnValueTestCase is already present in:
packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py

packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
-class CreateDuringStepTestCase(TestBase):
+class CrashDuringStepTestCase(TestBase):
as CreateDuringStepTestCase is already present in:
packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py

packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
-class TestCStepping(TestBase):
+class StepUntilTestCase(TestBase):
as TestCStepping is already present in:
packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py

llvm-svn: 335431
2018-06-24 10:36:44 +00:00
Jonas Devlieghere 24bd63c462 [FileSpec] Refactor append and prepend implemenetations. NFC
Replaces custom implementations of append and prepend with calls to
llvm's path library. This is part of a series of patches (started in
D48084) to delegate common operations to llvm::sys::path.

llvm-svn: 335430
2018-06-24 10:18:01 +00:00
Greg Clayton ef115de629 Update cmdtemplate.py to use best pratices.
Fixes include:
- fix all lint errors
- add code that will automatically register and LLDB command classes by detecting the classes and any classes that have a "register_lldb_command" function
  - automatically fill in the correct module name when registering commands
  - automatically fill in the class name when registering command

llvm-svn: 335401
2018-06-22 23:34:24 +00:00
Adrian Prantl 56a196c020 Mark this test as no debuginfo
llvm-svn: 335386
2018-06-22 20:26:53 +00:00
Pavel Labath 733ad45b9f Android.rules: Use libc++ by default
libstdc++ will soon be dropped from the android NDK. This patch makes
sure we are prepared for that by using libc++ in tests by default (i.e.,
except for libstdc++ data formatter tests).

Only a couple of small tweaks were needed to make this work:
- Add the libc++ include paths to CXXFLAGS only. This was necessary to
  make the tests compile with -fmodules. The modules tests have been
  disabled, but this way, they will be ready for them if they are
  enabled.
- in one test I had to add an explicit std::string copy to make sure the
  copy constructor is there for the expression evaluator to find it.

llvm-svn: 335344
2018-06-22 13:13:29 +00:00
Tatyana Krasnukha a0fa299d68 ResolveAddress: check returned value of resolving functions.
llvm-svn: 335341
2018-06-22 12:24:57 +00:00
Frederic Riss adc94a8846 Remove dead code
Our DWARF parsing code had a workaorund for Objective-C "self" not
being marked as artifial by the compiler. Clang has been doing this
since 2010, so let's just drop the workaround.

llvm-svn: 335313
2018-06-22 00:22:50 +00:00
Tatyana Krasnukha be73fd6b5d Remove duplicated check and shared_ptr copying.
llvm-svn: 335273
2018-06-21 19:19:57 +00:00
Jonas Devlieghere 702e140d68 [DataFormatter] Add CFDictionary data formatter
Add data formatter for NSCFDictionary/CFDictionaryRef.

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

llvm-svn: 335271
2018-06-21 19:13:47 +00:00
Greg Clayton 59a1be3acf Fix an issue where DW_OP_deref might be dereferencing a file address. Convert the file address to a load address so this works.
https://bugs.llvm.org/show_bug.cgi?id=36871

llvm-svn: 335263
2018-06-21 17:58:06 +00:00
Pavel Labath d68983e3d5 Partially revert r335236
Jim pointed out that XCode has build configurations that build without
python and removing the ifdefs around the python code breaks them.

This reverts the #ifdef part of the above patch, while keeping the cmake
parts.

llvm-svn: 335260
2018-06-21 17:36:32 +00:00
Pavel Labath 9092cc96d4 Fix macos build for r335244
I've made the code accept only 16 byte UUIDs, which is technically not
NFC (previously it would also accept 20 byte ones, but use only the
first 16 bytes), but this should be more correct as mac UUIDs are always
16 byte long.

llvm-svn: 335247
2018-06-21 15:40:33 +00:00
Pavel Labath a174bcbf03 Remove UUID::SetFromCString
Replace uses with SetFromStringRef. NFC.

llvm-svn: 335246
2018-06-21 15:24:39 +00:00
Pavel Labath 470b286ee5 Modernize UUID class
Instead of a separate GetBytes + GetByteSize methods I introduce a
single GetBytes method returning an ArrayRef.

This is NFC cleanup now, but it should make handling arbitrarily-sized
UUIDs cleaner, should we choose to go that way. I also took the
opportunity to add some unit tests for this class.

llvm-svn: 335244
2018-06-21 15:07:43 +00:00
Pavel Labath bcadb5a3d1 ScriptInterpreterPython cleanup
Instead of #ifdef-ing the contents of all files in the plugin for all
non-python builds, just disable the plugin at the cmake level. Also,
remove spurious extra linking of the Python plugin in liblldb. This
plugin is already included as a part of LLDB_ALL_PLUGINS variable.

llvm-svn: 335236
2018-06-21 14:09:15 +00:00
Pavel Labath 30f2e61b97 Disable gmodules tests on linux
These tests are extremely environment-dependent. if the environment is
not module-enabled (which is the likely scenario), they won't test
anything. If one happens to have a module-enabled libc++, then the he
will start running into problems.

The first one is that the debug info in pcm file contains relocations
that ObjectFileELF doesn't handle (particularly on non-x86
architectures), but even after that is resolved, it seems we still are
unable to pull debug info out of the pcm file. I've filed pr37893 to
track that, and I am disabling gmodules tests on linux until these
issues are resolved.

llvm-svn: 335235
2018-06-21 13:55:19 +00:00
Alexander Polyakov 859f54b3f8 Improve SBThread's stepping API using SBError parameter.
Summary: The new methods will allow to get error messages from stepping API.

Reviewers: aprantl, clayborg, labath, jingham

Reviewed By: aprantl, clayborg, jingham

Subscribers: apolyakov, labath, jingham, clayborg, lemo, lldb-commits

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

llvm-svn: 335180
2018-06-20 21:43:16 +00:00
Pavel Labath fbb142852c Remove some instances of manual UUID pretty-printing
Identical functionality is already offered by the UUID::getAsString
method.

llvm-svn: 335163
2018-06-20 20:13:04 +00:00
Pavel Labath 0583d7a56c Make test sources compatible with android+libcxx+modules
In a modules build, android is very picky about which symbols are
visible after including libc++ headers (e.g. <cstdio> defines only
std::printf and not ::printf).

This consolidates the tests where this was an issue to always include
the <c???> version of the headers and prefixes the symbols with std:: as
necessary.

Apart from that, there is no functional change in the tests.

llvm-svn: 335149
2018-06-20 17:32:48 +00:00
Pavel Labath 13c07c62d1 Make sure TestNumThreads works with libc++
The problem was that with libc++ the std::unique_lock declaration was
completely inlined, so there was no line table entry in the main.cpp
file to set a breakpoint on. Therefore, the breakpoint got moved to the
next line, but that meant the test would deadlock as the thread would
stop with the lock already held.

I fix that issue by adding a dummy statement before the std::unique_lock
line to anchor the breakpoint.

I think this should fix the issue because of which this test was
disabled on darwin, but someone should verify that before enabling it.

llvm-svn: 335132
2018-06-20 14:54:34 +00:00
Pavel Labath c7c9d76187 IRInterpreter: fix sign extension of small types (pr37840)
Sign-extension of small types (e.g. short) was not handled correctly.
The reason for that was that when we were assigning the a value to the
Scalar object, we would accidentally promote the type to int (even
though the assignment code in AssignTypeToMatch tried to cast the value
to the appropriate type, it would still invoke the "int" version of
operator=). Instead, I use the APInt version of operator=, where the
bitwidth is specified explicitly. Among other things, this allows us to
fold the individual size cases into one.

llvm-svn: 335114
2018-06-20 10:45:29 +00:00
Pavel Labath 031c748bdb Fix compilation with mingw-w64 (pr37873)
llvm-svn: 335112
2018-06-20 09:53:30 +00:00
Pavel Labath af8b24fa41 Fix windows build broken by r335104
lldb-python.h needs to be included first to work around some
incompatibilities between windows and python headers.

llvm-svn: 335106
2018-06-20 09:00:30 +00:00
Pavel Labath 2df331b0f7 Remove dependency from Host to python
Summary:
The only reason python was used in the Host module was to compute the
python path. I resolve this the same way as D47384 did for clang, by
moving the path computation into the python plugin and modifying
SBHostOS class to call into this module for ePathTypePythonDir.

Reviewers: zturner, jingham, davide

Subscribers: mgorny, lldb-commits

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

llvm-svn: 335104
2018-06-20 08:35:45 +00:00
Pavel Labath 16662f3c6e BreakpointIDList: Use llvm::ArrayRef instead of pointer+length pair
NFC

llvm-svn: 335102
2018-06-20 08:12:50 +00:00
Jason Molenda 85afc93f8a Correct the pathname that PlatformDarwinKernel::ExamineKextForMatchingUUID
passes to the recursive search function so we only recursively
search the kext bundle directory, instead of its parent directory.

<rdar://problem/41227170> 

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

llvm-svn: 335079
2018-06-19 21:39:10 +00:00
Raphael Isemann 1246890964 Refactor OnExit utility class in ClangUserExpression
Summary:
OnExit ensures we call `ResetDeclMap` before this method ends. However,
we also have a few manual calls to ResetDeclMap in there that are actually unnecessary
because of this (calling the method multiple times has no effect). This patch also moves
the class out of the method that we can reuse it for the upcoming method that handles
parsing for completion.

Subscribers: lldb-commits

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

llvm-svn: 335078
2018-06-19 21:25:59 +00:00
Pavel Labath 61547259de Scalar: Use llvm integer conversion functions
StringConvert was the only non-Utility dependency of this class. Getting
rid of it means it will be easy to move this class to a lower layer.

While I was in there, I also added a couple of unit tests for the Scalar
string conversion function.

llvm-svn: 335060
2018-06-19 17:24:03 +00:00
Pavel Labath 60f028ff03 Replace HostInfo::GetLLDBPath with specific functions
Summary:
Instead of a function taking an enum value determining which path to
return, we now have a suite of functions, each returning a single path
kind. This makes it easy to move the python-path function into a
specific plugin in a follow-up commit.

All the users of GetLLDBPath were converted to call specific functions
instead. Most of them were hard-coding the enum value anyway, so this
conversion was simple. The only exception was SBHostOS, which I've
changed to use a switch on the incoming enum value.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 335052
2018-06-19 15:09:07 +00:00
Pavel Labath 7bbedb8023 Make TestCommandScript.py NO_DEBUG_INFO_TESTCASE
llvm-svn: 335051
2018-06-19 15:07:22 +00:00
Pavel Labath 8779968805 Attempt to fix windows build broken by r334968
The issue was that there was no dependency from lldb-suite target to liblldb in
the no-framework scenario. This caused the finish-swig target to be executed
prematurely and fail (because it cannot copy liblldb to the python folder). On
other platforms this did not matter because there just creates a symlink.

The extra lldb-suite -> liblldb edge should fix this. Technically, I could add
this just to the !framework case as the framework target will take care of the
transitive dep, but it seemed more clear to make the dep unconditional.

llvm-svn: 335047
2018-06-19 14:23:31 +00:00
Alex Langford f66a36d2dc Fix up Info.plist when building LLDB.framework with CMake
Summary:
We weren't using the Info.plist template in resources previously.
When using that template, some of the key's values weren't being populated
because some variables were not being defined. In one case, CMake didn't
like the substring expansion syntax of CFBundleIdentifier so I got rid of that.

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

llvm-svn: 335014
2018-06-19 02:59:30 +00:00
Jason Molenda 87f0f95e4c Some NFC changes to how we scan of kexts & kernels in memory in the
DynamicLoaderDarwinKernel plugin.  Created a new function ReadMachHeader
and instead of reading through the target cached memory reader,
start by reading only a mach header sized chunk of memory, then
check it for a valid mach-o magic # and use the size of the load
commands to pre-fetch the entire load commands of the kext which
is the only thing we're going to read, instead of letting the generic
mach-o parser read it in 512 byte chunks.

Functionally this is doing exactly the same thing as before, but by
cutting down on the # of packets going back and forth, even on a 
local connection it's close to a quarter faster than it was before.

<rdar://problem/38570146> 

llvm-svn: 334995
2018-06-18 23:30:03 +00:00
Raphael Isemann 4621e0b058 Fixed file completion for paths that start with '~'.
We didn't add the remaining path behind the '~' to the completion string,
causing it to just complete directories inside the user home directory. This
patch just adds the directory of the remaining path if there is one.

Fixes rdar://problem/40147002

llvm-svn: 334978
2018-06-18 20:11:38 +00:00
Alex Langford 27510c18ad Introduce lldb-framework CMake target and centralize its logic
Summary:
In this patch I aim to do the following:

1) Create an lldb-framework target that acts as the target that handles generating LLDB.framework. Previously, liblldb acted as the target for generating the framework in addition to generating the actual lldb library. This made the target feel overloaded.
2) Centralize framework generation as much as it makes sense to do so.
3) Create a target lldb-suite, which depends on every tool and library that makes liblldb fully functional. One result of having this target is it makes tracking dependencies much clearer.

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

llvm-svn: 334968
2018-06-18 18:27:16 +00:00
Pavel Labath 6682979c04 Fix macosx build broken by the VersionTuple refactor
I actually did check that macos builds before committing, but this error
was in conditionally compiled code that did not seem to be used on my
machine.

I also fix a typo in the previous speculative NetBSD patch.

llvm-svn: 334955
2018-06-18 16:10:20 +00:00
Pavel Labath 76ba497177 Fix netbsd build broken by r334950
This also includes one more build fix for windows.

llvm-svn: 334953
2018-06-18 15:44:36 +00:00
Pavel Labath 9d4758ecdd Attempt to fix windows&freebsd builds broken by r334950
llvm-svn: 334952
2018-06-18 15:29:42 +00:00
Pavel Labath 2272c4811f Use llvm::VersionTuple instead of manual version marshalling
Summary:
This has multiple advantages:
- we need only one function argument/instance variable instead of three
- no need to default initialize variables
- no custom parsing code
- VersionTuple has comparison operators, which makes version comparisons much
  simpler

Reviewers: zturner, friss, clayborg, jingham

Subscribers: emaste, lldb-commits

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

llvm-svn: 334950
2018-06-18 15:02:23 +00:00
Frederic Riss 49c9d8b849 Fix the 'tb' alias command
No idea when this broke or if it ever worked. Added a small test
for one-shot breakpoints while I was there.

llvm-svn: 334921
2018-06-18 04:34:33 +00:00
Jason Molenda 94405ddb95 Sort the files in the PBXBuildFile and PBXFileReference sections
of debugserver's xcode project file to reduce automerger issues
with the github swift repository of lldb where the order of these
entries has drifted significantly over the years.

llvm-svn: 334873
2018-06-15 23:32:37 +00:00
Jason Molenda 6d722ca828 Sort the files in the PBXBuildFile and PBXFileReference
sections of lldb's xcode project file to reduce automerger
issues with the github swift repository of lldb where 
the order of these entries has drifted significantly
over the years.

llvm-svn: 334872
2018-06-15 23:29:32 +00:00
Frederic Riss ecba8846aa Fix TestExec after r334783
The second makefile that was added has implicit rules which meant
that secondprog.cpp would be built once into a secondprog binary,
but it would also be compiled as a.out overwriting the main binary.
This lead to spurious failures.

This commit simplifies the Makefile to build only once with the correct
executable name.

llvm-svn: 334861
2018-06-15 20:36:03 +00:00
Alexander Polyakov 56d9aa26ab Revert "[lldb-mi] Add overload method for setting an error"
Summary: This reverts commit r334245 because it duplicates
functionality of Status::AsCString used in SBError.

Reviewers: aprantl, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, ki.stfu

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

llvm-svn: 334860
2018-06-15 20:20:39 +00:00
Frederic Riss 9745a0adb2 Add support for PLATFORM_*SIMULATOR
The toolchain in Xcode 10 uses a new LC_BUILD_VERSION entry to identify
simulator binaries. Add support for reading those to debugserver.

The exisitng test testing that code is currently failling when run
with Xcode 10, no need for a new test.

llvm-svn: 334784
2018-06-15 02:50:45 +00:00
Jason Molenda 52560ba105 Change TestExec.py from creating an i386+x86_64 fat binary
on darwin systems and re-execing itself, to creating two
separate test programs; lldb runs the first program and it
exec's the second.  

Support for compiling for i386 is going away.

llvm-svn: 334783
2018-06-15 00:55:53 +00:00
Frederic Riss 2153c42358 Add an entitlement to debugserver
On macOS 10.14, debugserver needs to have an entitlement do be
allowed to debug processes. Adding this to both the Xcode and
cmake build system. This shouldn't have any impact on previous
OSs.

llvm-svn: 334772
2018-06-14 21:17:59 +00:00
Benjamin Kramer 8ec242f895 One ShortFract ought to be enough for everyone.
llvm-svn: 334755
2018-06-14 19:20:48 +00:00
Fangrui Song a5e59c5481 Add remaining fixed-point types and saturated equivalents to fix -Wswitch of r334718
llvm-svn: 334745
2018-06-14 18:19:40 +00:00
Frederic Riss a051c7a2f6 Add a script to setup codesigning on macOS.
I've been using this script on a couple machines and it seems to work
so I'm putting it out there, maybe other people will find it useful.
It is strongly inspired from a similar script in the delve project.

llvm-svn: 334743
2018-06-14 18:04:13 +00:00
Pavel Labath 234c681686 DebugNamesDWARFIndex: fix handling of compressed sections
This fixes a silly bug where we were accidentally freeing the memory
used to store the decompressed .debug_names data. I had actually
considered this scenario when writing the class and put appropriate
precautions in place -- I just failed to wire it all up correctly.

This was only an issue for compressed sections because in case of
uncompressed ones we would access the data straight out of the mmapped
object file.

llvm-svn: 334717
2018-06-14 14:41:30 +00:00
Pavel Labath 2e6384038c Fix PathMappingListTest on windows
r334615 changed the the value of FileSpec.IsRelative("/") for windows
path syntax. We previously considered it absolute but now it is
considered relative (I guess because it's interpretation depends on the
current drive).

This cause a failure in PathMappingList test, which assumed that "/"
will not get remapped as it is an absolute path. As this is no longer
true on windows, I replace "/" with a really absolute path.

llvm-svn: 334702
2018-06-14 10:31:06 +00:00
Pavel Labath 9cf22d03dd Fix includes in PlatformAppleSimulator.h
This unbreaks the cmake build. Other plugins also use the include paths
starting with Plugins/..., so I am hoping this will work for the xcode build
too.

llvm-svn: 334697
2018-06-14 09:08:54 +00:00
Jason Molenda 8f4edde9aa fix cmake include path.
llvm-svn: 334680
2018-06-14 01:29:18 +00:00
Jonas Devlieghere 87fb24dd4b [FileSpec] Make style argument mandatory for SetFile. NFC
Update SetFile uses in the unittests.

llvm-svn: 334668
2018-06-13 22:54:52 +00:00
Jason Molenda 4c53fffff9 Move the header file to be in the same new place as the .mm file.
llvm-svn: 334667
2018-06-13 22:37:01 +00:00
Jason Molenda 4c2418c1ce Fix group entry.
llvm-svn: 334666
2018-06-13 22:33:27 +00:00
Jonas Devlieghere dd2f78e34c [FileSpec] Make style argument mandatory for SetFile. NFC
Fix SetFile uses in hosts that I missed in r334663.

llvm-svn: 334664
2018-06-13 22:23:48 +00:00
Jonas Devlieghere 937348cd13 [FileSpec] Make style argument mandatory for SetFile. NFC
SetFile has an optional style argument which defaulted to the native
style. This patch makes that argument mandatory so clients of the
FileSpec class are forced to think about the correct syntax.

At the same time this introduces a (protected) convenience method to
update the file from within the FileSpec class that keeps the current
style.

These two changes together prevent a potential pitfall where the style
might be forgotten, leading to the path being updated and the style
unintentionally being changed to the host style.

llvm-svn: 334663
2018-06-13 22:08:14 +00:00
Jason Molenda 07570f55e4 Fix macos xcode build.
llvm-svn: 334662
2018-06-13 22:05:38 +00:00
Stella Stamenova 9d6fabf9e3 [lit] Split test_set_working_dir TestProcessLaunch into two tests and fix it on Windows
Summary:
test_set_working_dir was testing two scenario: failure to set the working dir because of a non existent directory and succeeding to set the working directory. Since the negative case fails on both Linux and Windows, the positive case was never tested. I split the test into two which allows us to always run both the negative and positive cases. The positive case now succeeds on Linux and the negative case still fails.
During the investigation, it turned out that lldbtest.py will try to execute a process launch command up to 3 times if the command failed. This means that we could be covering up intermittent failures by running any test that does process launch multiple times without ever realizing it. I've changed the counter to 1 (though it can still be overwritten with the environment variable).
This change also fixes both the positive and negative cases on Windows. There were a few issues:
1) In ProcessLauncherWindows::LaunchProcess, the error was not retrieved until CloseHandle was possibly called. Since CloseHandle is also a system API, its success would overwrite any existing error that could be retrieved using GetLastError. So by the time the error was retrieved, it was now a success.
2) In DebuggerThread::StopDebugging TerminateProcess was called on the process handle regardless of whether it was a valid handle. This was causing the process to crash when the handle was LLDB_INVALID_PROCESS (0xFFFFFFFF).
3) In ProcessWindows::DoLaunch we need to check that the working directory exists before launching the process to have the same behavior as other platforms which first check the directory and then launch process. This way we also control the exact error string.

Reviewers: labath, zturner, asmith, jingham

Reviewed By: labath

Subscribers: llvm-commits

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

llvm-svn: 334642
2018-06-13 19:02:44 +00:00
Jonas Devlieghere 20b051ba41 [ObjC] Add dataformatter for NSDecimalNumber
This patch adds a data formatter for NSDecimalNumber. The latter is a
Foundation object used for representing and performing arithmetic on
base-10 numbers that bridges to Decimal.

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

llvm-svn: 334638
2018-06-13 18:47:04 +00:00
Jonas Devlieghere cb38fd644e [ObjC] Use llvm::StringRef in summary providers
Replace const char pointers with llvm::StringRef and use its equality
operator for string comparisons.

llvm-svn: 334631
2018-06-13 18:15:14 +00:00
Jonas Devlieghere 9c1a645adc [FileSpec] Simplify getting extension and stem.
As noted by Pavel on lldb-commits, we don't need the temp path, we can
just pass the filename directly into extension() and path().

llvm-svn: 334618
2018-06-13 16:36:07 +00:00
Jonas Devlieghere ad8d48f903 [FileSpec] Delegate common operations to llvm::sys::path
With the recent changes in FileSpec to use LLVM's path style, it is
possible to delegate a bunch of common path operations to LLVM's path
helpers. This means we only have to maintain a single implementation and
at the same time can benefit from the efforts made by the rest of the
LLVM community.

This is part one of a set of patches. There was no obvious way to split
this so I just worked from top to bottom.

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

llvm-svn: 334615
2018-06-13 16:23:21 +00:00
Adrian Prantl 4e8be2c98e Fix/unify the spelling of Objective-C.
llvm-svn: 334614
2018-06-13 16:21:24 +00:00
Raphael Isemann 2c77eefe85 Add modules support for lldb headers in include/
Summary:
This patch adds a modulemap which allows compiling the lldb headers into C++ modules
(for example in builds with LLVM_ENABLE_MODULES=On).

Even though most of the affected code has been cleaned up to work with the more strict
C++ module semantics, there are still some workarounds left in the current modulemap
(the most obvious one is the big `lldb` wrapper module).

It also moves the Obj-C++ files in lldb to their own subdirectories. This was necessary
because we need to filter out the modules flags for this code.

Note: With the latest clang and libstdc++ it seems necessary to have a STL C++ module
to get a working LLVM_ENABLE_MODULES build for lldb. Otherwise clang will falsely
detect ODR violations in the textually included STL code inside the lldb modules.

Reviewers: aprantl, bruno

Reviewed By: aprantl, bruno

Subscribers: mgorny, yamaguchi, v.g.vassilev, lldb-commits

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

llvm-svn: 334611
2018-06-13 15:50:45 +00:00
Raphael Isemann 5714504ab2 Disable warnings for the generated LLDB wrapper source
Summary:
This source files emits all kind of compiler warnings on different platforms. As the source code
in the file is generated and we therefore can't actually fix the warnings, we might as well disable
them.

Reviewers: aprantl, davide

Reviewed By: davide

Subscribers: davide, mgorny, lldb-commits

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

llvm-svn: 334557
2018-06-12 22:51:20 +00:00
Raphael Isemann cfbb354457 Added modulemap for lldb-mi
Summary: This patch allows building a C++ module for the lldb-mi headers.

Reviewers: bruno, aprantl

Reviewed By: aprantl

Subscribers: lldb-commits, ki.stfu

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

llvm-svn: 334549
2018-06-12 21:22:52 +00:00
Zachary Turner 08426e1f9f Refactor ExecuteAndWait to take StringRefs.
This simplifies some code which had StringRefs to begin with, and
makes other code more complicated which had const char* to begin
with.

In the end, I think this makes for a more idiomatic and platform
agnostic API.  Not all platforms launch process with null terminated
c-string arrays for the environment pointer and argv, but the api
was designed that way because it allowed easy pass-through for
posix-based platforms.  There's a little additional overhead now
since on posix based platforms we'll be takign StringRefs which
were constructed from null terminated strings and then copying
them to null terminate them again, but from a readability and
usability standpoint of the API user, I think this API signature
is strictly better.

llvm-svn: 334518
2018-06-12 17:43:52 +00:00
Pavel Labath 0e33a0cd58 DebugNamesDWARFIndex: Implement DWARFDeclContext variant of GetTypes method
This method is used to find complete definitions of a type when one
parses a compile unit with only forward declaration available.

Since it is only accessed from DWARFASTParserClang, it was not
possible/easy to trigger this codepath from lldb-test. Therefore, I
adapt add a debug-names variant to an existing dotest test to cover this
scenario.

llvm-svn: 334516
2018-06-12 16:50:01 +00:00
Pavel Labath 38d9ff7a8a Fix build error introduced in r334498
Some gcc versions (circa 4.9) do not accept initializing Expected
objects containing a reference to a function from a function.

Change the Expected object to contain function pointers to work around
this.

llvm-svn: 334501
2018-06-12 13:26:43 +00:00
Pavel Labath dc4bd2e441 DWARFDebugNames: Implement last GetGlobalVariables overload
This function implements the search for all global variables within a
given compilation unit.

llvm-svn: 334500
2018-06-12 13:11:25 +00:00
Pavel Labath e6954cb2a1 lldb-test symbols: Add -file argument and the ability to dump global variables in a file
The motivation for this is to be able to Dwarf index ability to look up
variables within a given compilation unit. It also fits in with the
patch in progress at D47939, which will add the ability to look up
funtions using file+line pairs.

The verification of which lldb-test options can be used together was
getting a bit unwieldy, so I moved the logic out into a separate
function.

llvm-svn: 334498
2018-06-12 12:57:36 +00:00
Pavel Labath 023bdc6148 lit/SymbolFile/DWARF: Simplify test RUN lines
Use -mllvm compiler argument to enable DWARF v5 accelerator tables
instead of piping the IR through llc.

llvm-svn: 334496
2018-06-12 12:43:55 +00:00
Jonas Devlieghere 9deaf68ed1 Exempt some compilers from new static variable test.
Apparently some compilers generate incomplete debug information which
caused the updated test to fail. Therefore I've extracted the new check
into a separate test case with the necessary decorators.

llvm-svn: 334456
2018-06-12 00:15:59 +00:00
Jonas Devlieghere 48f0c26902 [Test] Update static variable test.
Before Pavel's change in r334181, we were printing too many global
variables. This patch updates the test suite to ensure we don't regress
again in the future.

rdar://problem/29180927

llvm-svn: 334454
2018-06-11 23:26:15 +00:00
Jason Molenda 808490138b Document how lldb uses the DBGSourcePathRemapping
source path remapping src/dest path pairs with
respect to the DBGVersion number in the plist.

llvm-svn: 334442
2018-06-11 21:36:40 +00:00
Jason Molenda c710f5d40a Add DebugNamesDWARFIndex.cpp.
llvm-svn: 334441
2018-06-11 21:35:36 +00:00
Leonard Mosescu e1bb51789d Add a new SBTarget::LoadCore() overload which surfaces errors if the load fails
There was no way to find out what's wrong if SBProcess SBTarget::LoadCore(const char *core_file) failed. 
Additionally, the implementation was unconditionally setting sb_process, so it wasn't even possible to check if the return SBProcess is valid.

This change adds a new overload which surfaces the errors and also returns a valid SBProcess only if the core load succeeds:

SBProcess SBTarget::LoadCore(const char *core_file, SBError &error);

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

llvm-svn: 334439
2018-06-11 21:19:26 +00:00
Pavel Labath cb512a3072 Fix tuple getter in std unique pointer pretty-printer
Summary: Check case when _M_t child member is not present.

Reviewers: labath, tberghammer

Reviewed By: labath, tberghammer

Differential Revision: https://reviews.llvm.org/D47932
Patch by Aleksandr Urakov <aleksandr.urakov@jetbrains.com>.

llvm-svn: 334411
2018-06-11 14:52:52 +00:00
Pavel Labath 08dae4bb3c DWARFDebugNames: Fix lookup in dwo files
The getDIESectionOffset function is not correct for split dwarf files
(and will probably be removed in D48009).

This patch implements correct section offset computation for split and
non-split compile units -- we first need to check if the referenced unit
is a skeleton unit, and if it is, we add the die offset to the full unit
base offset (as the full unit is the one which contains the die).

llvm-svn: 334402
2018-06-11 13:22:31 +00:00
Pavel Labath d8c6290ba4 Move VersionTuple from clang/Basic to llvm/Support
Summary:
This kind of functionality is useful to other project apart from clang.
LLDB works with version numbers a lot, but it does not have a convenient
abstraction for this. Moving this class to a lower level library allows
it to be freely used within LLDB.

Since this class is used in a lot of places in clang, and it used to be
in the clang namespace, it seemed appropriate to add it to the list of
adopted classes in LLVM.h to avoid prefixing all uses with "llvm::".

Also, I didn't find any tests specific for this class, so I wrote a
couple of quick ones for the more interesting bits of functionality.

Reviewers: zturner, erik.pilkington

Subscribers: mgorny, cfe-commits, llvm-commits

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

llvm-svn: 334399
2018-06-11 10:28:04 +00:00
Pavel Labath dee4930110 Editline: make #include <codecvt> conditional
My previous patch made this include unconditional. However, it seems it
is not available everywhere. This patch makes us include it only in
configurations we really need it, which should be enough to unblock the
bots.

llvm-svn: 334397
2018-06-11 09:32:58 +00:00
Pavel Labath 3351381165 [cmake] Detect presence of wide-char libedit at build time
Summary:
Instead of hardcoding a list of platforms where libedit is known to have
wide char support we detect this in cmake. The main motivation for this
is attempting to improve compatibility with different versions of
libedit, as the interface of non-wide-char functions varies slightly
between versions.

Reviewers: krytarowski, uweigand, jankratochvil, timshen, beanz

Subscribers: mgorny, lldb-commits

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

llvm-svn: 334393
2018-06-11 09:14:26 +00:00
Alexander Polyakov 4a60320a20 [lldb-mi] Re-implement MI -exec-step command.
Summary: Now -exec-step uses SB API instead of HandleCommand hack.

Reviewers: aprantl, clayborg, labath, stella.stamenova

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 334364
2018-06-10 14:58:29 +00:00
Alexander Polyakov 44a060f8d6 [lldb, lldb-mi] Re-implement MI -exec-continue command.
Summary: Now -exec-continue command uses SB API to resume target's process.

Reviewers: aprantl, clayborg, labath

Reviewed By: clayborg

Subscribers: apolyakov, labath, ki.stfu, llvm-commits, lldb-commits

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

llvm-svn: 334350
2018-06-09 15:11:37 +00:00
Alex Langford 6500c693a5 Remove more dead code from NativeProcessLinux
This should have been removed in r334333.

llvm-svn: 334336
2018-06-08 22:28:41 +00:00
Alex Langford bd620effc8 Delete dead code in NativeProcessLinux
As far as I can tell, this code has always been guarded by `#if 0`. If
this is useful code, it can be added back.

llvm-svn: 334333
2018-06-08 22:14:29 +00:00
Alex Langford 9391061fd7 Delete some dead code
llvm-svn: 334320
2018-06-08 21:13:26 +00:00
Tatyana Krasnukha 74fd1a6587 Fix DynamicRegisterInfo copying/moving issue.
Summary:
Default copy/move constructors and assignment operators leave wrong m_sets[i].registers pointers.

Made the class movable and non-copyable (it's difficult to imagine when it needs to be copied).

Reviewers: clayborg

Reviewed By: clayborg

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

llvm-svn: 334282
2018-06-08 11:28:15 +00:00
Pavel Labath 982241097c Fix TestMiExec.py
r334215 changed the error message the tool prints for invalid thread
arguments to -exec-next command. This adjust the test to match that.

llvm-svn: 334279
2018-06-08 10:39:55 +00:00
Pavel Labath a3ee1e7f92 DebugNamesDWARFIndex: Implement regex version of the GetFunctions method
This also fixes a bug where SymbolFileDWARF was returning the same
function multiple times - this can happen if both mangled and demangled
names match the regex. Other lookup lookup functions had code to handle
this case, but it was forgotten here.

llvm-svn: 334277
2018-06-08 10:31:55 +00:00
Pavel Labath 257ff33989 DebugNamesDWARFIndex: Implement GetFunctions method
Summary:
This patch implements the non-regex variant of GetFunctions. To share
more code with the Apple implementation, I've extracted the common
filtering code from that class into a utility function on the DWARFIndex
base class.

The new implementation also searching the accelerator table multiple
times -- previously it could happen that the apple table would return
the same die more than once if one specified multiple search flags in
name_type_mask. This way, I separate table iteration from filtering, and
so we can be sure each die is inserted at most once.

Reviewers: clayborg, JDevlieghere

Subscribers: aprantl, lldb-commits

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

llvm-svn: 334273
2018-06-08 09:10:31 +00:00
Aaron Smith 010edd37f8 PDB support of function-level linking and splitted functions
Summary:
The patch adds support of splitted functions (when MSVC is used with PGO) and function-level linking feature.

SymbolFilePDB::ParseCompileUnitLineTable function relies on fact that ranges of compiled source files in the binary are continuous and don't intersect each other. The function creates LineSequence for each file and inserts it into LineTable, and implementation of last one relies on continuity of the sequence. But it's not always true when function-level linking enabled, e.g. in added input test file test-pdb-function-level-linking.exe there is xstring's std__basic_string_char_std__char_traits_char__std__allocator_char_____max_size (.00454820) between test-pdb-function-level-linking.cpp's foo (.00454770) and main (.004548F0).

To fix the problem this patch renews the sequence on each address gap.

Reviewers: asmith, zturner

Reviewed By: asmith

Subscribers: aleksandr.urakov, labath, mgorny, lldb-commits

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

llvm-svn: 334260
2018-06-08 02:45:25 +00:00
Raphael Isemann e535c14452 Added missing include to LoadedModuleInfoList.h
Subscribers: lldb-commits

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

llvm-svn: 334259
2018-06-08 02:00:27 +00:00
Alexander Polyakov f0f5175518 [lldb-mi] Add overloaded method for setting an error.
Reviewers: aprantl, clayborg

Reviewed By: clayborg

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 334245
2018-06-07 23:03:49 +00:00
Alex Langford 372e3d3e12 Remove commented out line from top-level CMakeLists.txt
llvm-svn: 334225
2018-06-07 20:17:46 +00:00
Zachary Turner 1f67a3cba9 [FileSystem] Split up the OpenFlags enumeration.
This breaks the OpenFlags enumeration into two separate
enumerations: OpenFlags and CreationDisposition.  The first
controls the behavior of the API depending on whether or not
the target file already exists, and is not a flags-based
enum.  The second controls more flags-like values.

This yields a more easy to understand API, while also allowing
flags to be passed to the openForRead api, where most of the
values didn't make sense before.  This also makes the apis more
testable as it becomes easy to enumerate all the configurations
which make sense, so I've added many new tests to exercise all
the different values.

llvm-svn: 334221
2018-06-07 19:58:58 +00:00
Alex Langford 05c10d0def Check for process_vm_readv using CheckSymbolExists
Instead of checking if code compiles, I think it is a better to check
if the symbol exists. This is simpler and should do the same thing.

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

llvm-svn: 334219
2018-06-07 19:53:25 +00:00
Alexander Polyakov 2b08ca76df [lldb-mi] Re-implement MI -exec-next command.
Summary: Now -exec-next command uses SB API for stepping over.

Reviewers: aprantl, clayborg, stella.stamenova, labath

Reviewed By: aprantl, clayborg, labath

Subscribers: labath, ki.stfu, lldb-commits

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

llvm-svn: 334215
2018-06-07 19:09:01 +00:00
Stella Stamenova c3bc63e54b [lit, windows] Disable a number of tests that are failing on Windows
Summary: They all correspond to bugs that are already logged and I've added the appropriate (or most appropriate) bug numbers. This leaves only a handful of failing tests.

Reviewers: asmith, zturner, labath

Reviewed By: zturner

Subscribers: eraman, llvm-commits

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

llvm-svn: 334210
2018-06-07 17:49:22 +00:00
Jonas Devlieghere e6f3ecd52c [Platform] Accept arbitrary kext variants
When loading kexts in PlatformDarwinKernel, we use the BundleID as the
filename to to create shared modules. In GetSharedModule we call
ExamineKextForMatchingUUID for any BundleID it finds that is a match, to
see if the UUID is also a match. Until now we were using
Host::ResolveExecutableInBundle which calls a CoreFoundation API to
obtain the executable. However, it's possible that the executable has a
variant suffix (e.g. foo_development) and these files were ignored.

This patch replaces that call with logic that looks for all the binaries
in the bundle. Because of the way ExamineKextForMatchingUUID works, it's
fine to try to load executables that are not valid and we can just
iterate over the list until we found a match.

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

llvm-svn: 334205
2018-06-07 16:10:42 +00:00
Pavel Labath d44638eb2b DIERef: move trivial constructors into the header
This enables more inlining/optimization opportunities for a fairly
critical class.

NFCI

llvm-svn: 334198
2018-06-07 14:03:30 +00:00
Pavel Labath 6938969223 DebugNamesDWARFIndex: Add type lookup suport
This implements just one of the GetTypes overloads. The other is not
testable from lldb-test so I'm leaving it unimplemented until I figure
out what to do with testing.

llvm-svn: 334190
2018-06-07 12:26:18 +00:00
Pavel Labath 6675e652a3 DebugNamesDWARFIndex: add namespace lookup support
llvm-svn: 334186
2018-06-07 10:56:16 +00:00
Pavel Labath 452bd87cc4 DebugNamesDWARFIndex: Add support for partial indexes
Summary:
It possible that a single module has indexed and non-indexed compile
units. In this case, we can use the fast indexed lookup for the first
ones and fall back to the manual index for the others.

This patch implements this functionality by adding a units_to_avoid
argument to the ManualDWARFIndex constructor. Any units present in that
list will be ignored for the purposes of manual index. Individual
DebugNamesDWARFIndex then always consult both the manual fallback index
as well as the index in the .debug_names section.

Reviewers: JDevlieghere, clayborg

Subscribers: aprantl, lldb-commits

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

llvm-svn: 334185
2018-06-07 10:35:28 +00:00
Pavel Labath e1d18758eb DebugNamesDWARFIndex: Add ability to lookup variables
Summary:
This patch adds the ability to lookup variables to the DWARF v5 index
class.

During review we discovered an inconsistency between how the existing
two indexes handle looking up qualified names of the variables:
- manual index would return a value if the input string exactly matched
  the demangled name of some variable.
- apple index ignored the context and returned any variable with the
  same base name.

So, this patch also rectifies that situation:
- it removes all context handling from the index classes. The
  GetGlobalVariables functions now just take a base name. For manual
  index, this meant we can stop putting demangled names into the
  variable index (this matches the behavior for functions).
- context extraction is put into SymbolFileDWARF, so that it is common
  to all indexes.
- additional filtering based on the context is also done in
  SymbolFileDWARF. This is done via a simple substring search, which is
  not ideal, but it matches what we are doing for functions (cf.
  Module::LookupInfo::Prune).

Reviewers: clayborg, JDevlieghere

Subscribers: aprantl, lldb-commits

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

llvm-svn: 334181
2018-06-07 10:04:44 +00:00
David Carlier 58d05a4d5f [LLDB] Unit tests / typo fix
removing unnecessary comma.

llvm-svn: 334177
2018-06-07 08:58:34 +00:00
Pavel Labath 9337b41cb5 [DWARF] Add (empty) DebugNamesDWARFIndex class and a setting to control its use
Summary:
This patch adds the skeleton for implementing the DWARF v5 name index
class. All of the methods are stubbed out and will be implemented in
subsequent patches. The interesting part of the patch is the addition of
a "ignore-file-indexes" setting to the dwarf plugin which enables a
user to force using manual indexing path in lldb (for example as a
debugging aid). I have also added a test that verifies that file indexes
are used by default.

Reviewers: JDevlieghere, clayborg, jingham

Subscribers: mgorny, mehdi_amini, aprantl, lldb-commits

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

llvm-svn: 334088
2018-06-06 11:35:23 +00:00
Michal Gorny 6dde836844 [lit] Do not run Python tests w/ LLDB_DISABLE_PYTHON
Skip all Python-based tests as unsupported when LLDB_DISABLE_PYTHON is
enabled.  Otherwise, those tests simply fail being unable to import lldb
module.

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

llvm-svn: 334080
2018-06-06 09:44:14 +00:00
Pavel Labath 5583ec4218 Revert "PDB support of function-level linking and splitted functions"
This reverts commit r334030 because it adds a broken test.

llvm-svn: 334076
2018-06-06 09:16:00 +00:00
Aaron Smith a642f8f343 PDB support of function-level linking and splitted functions
Summary:
The patch adds support of splitted functions (when MSVC is used with PGO) and function-level linking feature.

SymbolFilePDB::ParseCompileUnitLineTable function relies on fact that ranges of compiled source files in the binary are continuous and don't intersect each other. The function creates LineSequence for each file and inserts it into LineTable, and implementation of last one relies on continuity of the sequence. But it's not always true when function-level linking enabled, e.g. in added input test file test-pdb-function-level-linking.exe there is xstring's std__basic_string_char_std__char_traits_char__std__allocator_char_____max_size (.00454820) between test-pdb-function-level-linking.cpp's foo (.00454770) and main (.004548F0).

To fix the problem this patch renews the sequence on each address gap.

Reviewers: asmith, zturner

Reviewed By: asmith

Subscribers: mgorny, lldb-commits

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

llvm-svn: 334030
2018-06-05 17:19:21 +00:00
Stella Stamenova f2c14af389 [lit, pdb] Fix func-symbols.test (on Windows)
Summary: This test was failing sporadically on windows because the order in which the symbols are generated was different between builds. To fix the test, we need to run FileCheck twice - once for each set of symbols we want to verify. The test only runs on Windows.

Reviewers: asmith, zturner, labath

Subscribers: stella.stamenova, llvm-commits

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

llvm-svn: 334025
2018-06-05 16:20:36 +00:00
Pavel Labath 6de9c79e71 DWARFIndex: more GetFunctions cleanup
This applies similar simplification as r334004, only it touches the
regex version of the method.

llvm-svn: 334012
2018-06-05 12:13:22 +00:00
Pavel Labath 663773857f dotest: make inline tests compatible with -f
Summary:
This is split off from D47265 where I needed to be able to invoke every test
with -f. That patch is kinda dead now, but this part seems like a good
cleanup anyway.

The problem with inline tests was in the way we were adding methods to
the class, which left them with an incorrect __name__ property. This
prevented dotest from finding them with -f.

I fix this with (what I think is) the correct way of dynamically
creating classes -- passing the list of methods during type construction
instead of fixing up the class afterwards. Among other things this has
the advantage of not needing to do anything special for debug info
variants. As our test method will be visible to the metaclass, it will
automagically do the multiplication for us.

Reviewers: JDevlieghere, aprantl, tberghammer

Subscribers: eraman, lldb-commits

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

llvm-svn: 334009
2018-06-05 10:58:44 +00:00
Pavel Labath df4ca0eeda Fix windows build broken by r334004
The problem was a link error due to a missing =0 on an abstract method.
Interestingly, this was not a problem for clang/linux.

llvm-svn: 334006
2018-06-05 10:49:56 +00:00
Pavel Labath 5af11ab259 DWARFIndex: simplify GetFunctions methods
Now that Apple index determines method-ness straight from the debug
info, we don't need to resolve the functions into SymbolContexts inside
the Index classes. This removes the need for callback arguments and
allows us to pull the common parts out of the two implementations of
these functions back into the SymbolFileDWARF class.

Reviewers: JDevlieghere, clayborg

Subscribers: aprantl, lldb-commits

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

llvm-svn: 334004
2018-06-05 10:33:56 +00:00
Pavel Labath 4e34bfcbeb Really fix ClangParserTest
It turns out the test needs a fixture after all (to initialize HostInfo), so
provide one that does that.

llvm-svn: 334003
2018-06-05 10:29:48 +00:00
Ilya Biryukov fc48ac61fa Silence unhandled enums warning in ClangASTContext::GetEncoding
The warning started firing after r333923, which added new builtin
types (fixed point types) into clang.
This patch merely silences the warning to unblock our integrate, does
not aim to support the new types in lldb.

llvm-svn: 333999
2018-06-05 10:07:07 +00:00
Pavel Labath 3489b1adb3 Fixup r333987
- add #include <atomic> (fixes windows build)
- remove std::move (fixes "using move prevents copy ellision" warnings)

llvm-svn: 333996
2018-06-05 09:56:14 +00:00
Pavel Labath 8d1421d317 Fix ClangParserTest.cpp
The test does not use a test fixture, so it needs to be declared with
the TEST macro.

llvm-svn: 333992
2018-06-05 09:33:26 +00:00
Jan Kratochvil c8e357f796 Protect DWARFCompileUnit::m_die_array by new mutexes
If BuildAddressRangeTable called ExtractDIEsIfNeeded(false), then another
thread started processing data from m_die_array and then the first thread
called final ClearDIEs() the second thread would crash.

It is also required without multithreaded debugger using DW_TAG_partial_unit
for DWZ.

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

llvm-svn: 333987
2018-06-05 08:52:18 +00:00
Jonas Devlieghere a54df26ace Fix Expression unittests on Darwin
Fixes the Expression unittests on Darwin after r333933 was landed.

llvm-svn: 333974
2018-06-05 00:32:41 +00:00
Jim Ingham 34b6798ee2 Add ClangHost.cpp to the Xcode project.
Also add an include that was needed for the if APPLE branch
of the function.

llvm-svn: 333971
2018-06-05 00:19:03 +00:00
Alex Langford 59ad87821a Change SWIG output directory when building LLDB.framework with CMake
Instead of assuming that SWIG generated files (e.g. lldb.py) will live
in scripts, we should set it to $LLDB_PYTHON_TARGET_DIR. This variable is set to
scripts, except when building LLDB.framework when it is set to
LLDB_FRAMEWORK_DIR.

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

llvm-svn: 333968
2018-06-04 23:47:36 +00:00
Alexander Polyakov aa65168419 [lldb, lldb-mi] Enable lldb-mi -break-insert test on Windows.
Summary:
The default name for a compiler output on Linux is `a.out`,
while on Windows it's `a.exe`. But if we add option `-o a.exe`,
the compiler will create the executable `a.exe` on the both systems.

Reviewers: aprantl, stella.stamenova

Reviewed By: stella.stamenova

Subscribers: ki.stfu, llvm-commits, lldb-commits

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

llvm-svn: 333963
2018-06-04 22:39:40 +00:00
Zachary Turner bdf089246e Remove dependency from Host to clang.
Host depended on clang because HostInfo had a function to get
the directory where clang was installed.  We move this over to
the clang expression parser plugin where it's more at home.

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

llvm-svn: 333933
2018-06-04 17:41:00 +00:00
Vedant Kumar c418b5cc25 [IRMemoryMap] Use labels in the "malloc" and "free" lldb-test commands
Change the syntax of the malloc and free commands in lldb-test's
ir-memory-map subcommand to:

  <malloc> ::= <label> = malloc <size> <alignment>

  <free> ::= free <label>

This should make it easier to read and extend tests in the future, e.g
to test IRMemoryMap::WriteMemory or double-free behavior.

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

llvm-svn: 333930
2018-06-04 17:11:15 +00:00
David Carlier 04bea33e8c [LLDB] Unit tests basic support for OpenBSD
OpenBSD python module.

llvm-svn: 333889
2018-06-04 11:59:18 +00:00
David Carlier 15aefbd3f6 [LLDB] Unit tests basic support for OpenBSD
Add OpenBSD python module in order to support unit tests.

Reviewers: labath, zturner

Reviewed By: labath

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

llvm-svn: 333888
2018-06-04 11:57:12 +00:00
Pavel Labath 3ca31ba75a AppleDWARFIndex: Get function method-ness directly from debug info
Summary:
When searching for methods only, we need to do extra work to make sure
the functions we get from the apple tables are indeed methods.
Previously we were resolving the DIE into a SymbolContext and then
checked whether the enclosing CompilerDeclContext is a
class (or struct, or union).

This patch changes that to operate on the debug info directly. This
should be:
- simpler
- faster
- more consistent with the ManualDWARFIndex (which does the same check,
  only at indexing time).

What we lose this ways is for the language plugin to have a say in what
it considers to be a "class", but that's probably more flexibility than
we need (and if we really wanted to do that in the future, we could
implement a more direct way to consult the plugin about this).

This also fixes the find-method-local-struct test, which was failing
because we were not able to construct a CompilerDeclContext for a local
struct correctly.

As a drive-by, I rename the DWARFDIE's IsStructClassOrUnion method to
match the name on the CompilerDeclContext class.

Reviewers: clayborg, JDevlieghere

Subscribers: aprantl, lldb-commits

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

llvm-svn: 333878
2018-06-04 09:05:27 +00:00
Saleem Abdulrasool 23d66ae1e4 Python: adjust the include directories
Restructure the include search order to adjust for libedit.  This
ensures that the variables are not unused if they are not defined.

llvm-svn: 333863
2018-06-04 02:08:12 +00:00
Alexander Polyakov cc92f5038e [lldb, lldm-mi] Fix hanging of -exec-run command.
Summary: -exec-run command hanged in case of invalid or dummy target.

Reviewers: aprantl, stella.stamenova

Reviewed By: aprantl

Subscribers: ki.stfu, llvm-commits, lldb-commits

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

llvm-svn: 333844
2018-06-03 15:15:23 +00:00
Alexander Polyakov 2c5a424150 Test commit. Fix typo in comment.
llvm-svn: 333837
2018-06-03 12:41:00 +00:00
James Y Knight 7177528783 Fix silly error introduced after testing in r333813.
Oops.

llvm-svn: 333816
2018-06-02 04:00:16 +00:00