Commit Graph

17257 Commits

Author SHA1 Message Date
Pavel Labath 245dd2e0c7 Reapply "Remove Process references from the Host module"
This re-lands r332250/D46395, after fixing Mac build errors.

llvm-svn: 332353
2018-05-15 13:42:26 +00:00
Stella Stamenova ad9b697898 [lit] Fix several tests that fail when using Python 3 or on Windows
Summary:
1) In logtest.cpp, the name of the file that is reported is not always capitalized, so split the comparison to validate the file (case insensitive) and function (case sensitive) separately
2) Update the gdb remote client tests to work with Python 3. In Python 3, socket sends/receives data as bytes rather than byte strings. This also updates the usage of .hex() - this is no longer available in Python 3, so use hexlify instead

Reviewers: asmith, labath, zturner

Reviewed By: labath

Subscribers: llvm-commits

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

llvm-svn: 332293
2018-05-14 21:04:24 +00:00
Pavel Labath 4f107ba20e Revert "Remove Process references from the Host module"
The first fix wasn't enough, there is still a missing
ProcessInstanceInfo include in Host.mm. I won't be able to test a fix
before leaving work, so I am reverting both commits.

This reverts commit r332250 and the subsequent fix attempt.

llvm-svn: 332261
2018-05-14 16:54:53 +00:00
Pavel Labath 4a20f3b3f9 Fix macosx build broken by r332250
llvm-svn: 332255
2018-05-14 16:01:49 +00:00
Pavel Labath 58b54894c7 Remove Process references from the Host module
The Process class was only being referenced because of the last-ditch
effort in the process launchers to set a process death callback in case
one isn't set already.

Although launching a process for debugging is the most important kind of
"launch" we are doing, it is by far not the only one, so assuming this
particular callback is the one to be used is not a good idea (besides
breaking layering). Instead of assuming a particular exit callback, I
change the launcher code to require the callback to be set by the user (and fix
up the two call sites which did not set the callback already).

Reviewers: jingham, davide

Subscribers: lldb-commits

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

llvm-svn: 332250
2018-05-14 15:13:13 +00:00
Pavel Labath 2cb7cf8e87 FileSpec: Remove PathSyntax enum and use llvm version instead
Summary:
The llvm version of the enum has the same enumerators, with stlightly
different names, so this is mostly just a search&replace exercise. One
concrete benefit of this is that we can remove the function for
converting between the two enums.

To avoid typing llvm::sys::path::Style::windows everywhere I import the
enum into the FileSpec class, so it can be referenced as
FileSpec::Style::windows.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 332247
2018-05-14 14:52:47 +00:00
Jan Kratochvil 2e5be0cb6f Use const_iterator in DWARFUnit
Function DWARFUnit::GetDIE is using m_die_array only for reading so it can use
DWARFDebugInfoEntry::const_iterator.

llvm-svn: 332201
2018-05-13 19:04:17 +00:00
Jan Kratochvil 03aff468c9 Revert "Protect DWARFCompileUnit::m_die_array by a new mutex"
Pavel Labath found this patch is incomplete and racy.  I think there needs to
be some more mutexes even before considering DW_TAG_partial_unit.

This reverts commit 331229 which was: https://reviews.llvm.org/D40470

llvm-svn: 332200
2018-05-13 18:38:28 +00:00
Davide Italiano 1e6a01fc87 Revert "[LLDB] Support GNU-style compressed debug sections (.zdebug)"
This reverts commit r332162 as it breaks the bots (Ubuntu 14.04)
with the following message:

Build Command Output:
objcopy: option '--compress-debug-sections' doesn't allow an argument

llvm-svn: 332165
2018-05-12 01:25:48 +00:00
Davide Italiano 8b99865034 [LanguageRuntime/ObjC] Turn off ISA logging once and for all.
On behalf of Jim, who's out today.

llvm-svn: 332163
2018-05-12 00:33:12 +00:00
Davide Italiano 56ab68f323 [LLDB] Support GNU-style compressed debug sections (.zdebug)
Patch by Erik Welander!

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

llvm-svn: 332162
2018-05-12 00:29:25 +00:00
Adrian Prantl 66a0b77493 Conditionally compile a Darwin-only test.
llvm-svn: 332140
2018-05-11 21:05:32 +00:00
Adrian Prantl 3a380fb2ff Yet another follow-up to r332111. This also handles the case where an
LLDB.framework is built inside the LLDB build directory (but not
inside an Xcode installation).

llvm-svn: 332126
2018-05-11 19:29:25 +00:00
Adrian Prantl 5103e48bad Fix a regression in r332111. The LLDB.framework path component is not
usually the last component.

llvm-svn: 332120
2018-05-11 19:00:58 +00:00
Frederic Riss d10d3795f7 Add a lock to PlatformPOSIX::DoLoadImage
Summary:
Multiple threads could be calling into DoLoadImage concurrently,
only one should be allowed to create the UtilityFunction.

Reviewers: jingham

Subscribers: emaste, lldb-commits

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

llvm-svn: 332115
2018-05-11 18:21:11 +00:00
Adrian Prantl 7d46f0e4c2 HostInfoMacOSX: Share the clang resource directory with Swift.
Inside Xcode and in Xcode toolchains LLDB is always in lockstep
with the Swift compiler, so it can reuse its Clang resource
directory. This allows LLDB and the Swift compiler to share the
same Clang module cache.

rdar://problem/40039633

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

llvm-svn: 332111
2018-05-11 17:54:09 +00:00
Pavel Labath e7306b105e Remove custom path manipulation functions from FileSpec
Summary:
now that llvm supports host-agnostic path manipulation functions (and
most of their kinks have been ironed out), we can remove our copies of
the path parsing functions in favour of the llvm ones.

This should be NFC except for the slight difference in handling of the
"//" path, which is now normalized to "/" (this only applies to the
literal "//" path; "//net" and friends still get to keep the two
slashes).

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 332088
2018-05-11 11:55:34 +00:00
Adrian Prantl 9702c963ab Retrieve the deployment target when retrieving an object file's triple.
Getting the deployment target can be significant information when
rebuilding clang modules since availability information could depend
on it.

rdar://problem/40039633

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

llvm-svn: 332067
2018-05-11 00:41:20 +00:00
Greg Clayton 19e9884609 Fix the code that gets the Xcode path. After path normalization this could was failing.
This meant if the "debugserver" binary was removed from the LLDB.framework, lldb wouldn't be able to find debugserver.

llvm-svn: 332050
2018-05-10 22:09:01 +00:00
Pavel Labath 60851ec87f Fix one more RunShellcommand occurence in mac code
llvm-svn: 331977
2018-05-10 12:02:24 +00:00
Pavel Labath 70f4eaf699 Fix windows&mac builds broken by r331970 (RunShellCommand/Timeout) refactor
llvm-svn: 331974
2018-05-10 11:27:43 +00:00
Pavel Labath 19dd1a0ea6 Convert all RunShellCommand functions to use the Timeout class
this completes the Timeout migration started in r331880 with the
Predicate class.

llvm-svn: 331970
2018-05-10 10:46:03 +00:00
Pavel Labath 4865ff1e18 CPlusPlusLanguage: Add unit tests for the FindAlternateFunctionManglings method
I was considering modifying this function, so I wrote some tests to make
sure I don't regress its behavior. I am not sure if I will actually
proceed with the modifications, but the tests seem useful nonetheless.

llvm-svn: 331966
2018-05-10 08:59:17 +00:00
Stella Stamenova 42ba76c9f6 [cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple configurations
Summary: The current setup for the unit tests only works correctly when the generator does not support multiple configurations. When the generator supports multiple configurations, the inputs are not copied to the correct per-configuration directory. This change sets up the build to copy the inputs in each configuration directory.

Reviewers: labath, asmith, zturner

Reviewed By: labath

Subscribers: mgorny, llvm-commits

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

llvm-svn: 331914
2018-05-09 19:58:51 +00:00
Greg Clayton f56c30d13b General cleanup to minimize the .debug_types patch
This cleanup is designed to make the https://reviews.llvm.org/D32167 patch smaller and easier to read.

Cleanup in this patch:

Allow DWARFUnit subclasses to hand out the data that should be used when decoding data for a DIE. The information might be in .debug_info or could be in .debug_types. There is a new virtual function on DWARFUnit that each subclass must override:

virtual const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different data to be used when decoding the DIE information.

Add a new pure virtual function to get the size of the DWARF unit header:

virtual uint32_t DWARFUnit::GetHeaderByteSize() const = 0;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different offsets where the first DIE starts when decoding DIE information from the unit.

Added a new function to DWARFDataExtractor to get the size of an offset:

size_t DWARFDataExtractor::GetDWARFSizeOfOffset() const;
Removed dead dumping and parsing code in the DWARFDebugInfo class.
Inlined a bunch of calls in DWARFUnit for accessors that were just returning integer member variables.
Renamed DWARFUnit::Size() to DWARFUnit::GetHeaderByteSize() as it clearly states what it is doing and makes more sense.

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

llvm-svn: 331892
2018-05-09 16:42:53 +00:00
Stella Stamenova 8a36cb3bb2 [lit, lldbsuite] Add a bug reference to the failing TestLinuxCore and fix an undefined property in dotest.py
Summary:
1) In TestLinuxCore rather than skipping the tests on Windows, mark them as expected failures and add a bug reference
2) In dotest.py replace the undefined property in the exceptions with the actual property causing the exception

Reviewers: asmith, labath, zturner

Reviewed By: labath, zturner

Subscribers: llvm-commits

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

llvm-svn: 331886
2018-05-09 15:35:19 +00:00
Pavel Labath 4b13033149 Fix Windows build for the Predicate.h refactor in r331880
llvm-svn: 331882
2018-05-09 14:49:43 +00:00
Pavel Labath 3879fe0099 Modernize and clean-up the Predicate class
Summary:
The comments on this class were out of date with the implementation, and
the implementation itself was inconsistent with our usage of the Timeout
class (I started converting everything to use this class back in D27136,
but I missed this one). I avoid duplicating the waiting logic by
introducing a templated WaitFor function, and make other functions
delegate to that. This function can be also used as a replacement for
the unused WaitForBitToBeSet functions I removed, if it turns out to be
necessary.

As this changes the meaning of a "zero" timeout, I tracked down all the
callers of these functions and updated them accordingly. Propagating the
changes to all the callers of RunShellCommand was a bit too much for
this patch, so I stopped there and will continue that in a follow-up
patch.

I also add some basic unittests for the functions I modified.

Reviewers: jingham, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 331880
2018-05-09 14:29:30 +00:00
Pavel Labath 80d48155cf [DWARF] Align non-accelerated function fullname searching with the apple-tables path
Summary:
Before this patch the two paths were doing very different things
- the apple path searched the .apple_names section, which contained
  mangled names, as well as basenames of all functions. It returned any
  name it found.
- the non-accelerated path looked in the "full name" index we built
  ourselves, which contained mangled as well as demangled names of all
  functions (but no basenames). Then however, if it did not find a match
  it did an extra search in the basename index, with some special
  handling for anonymous namespaces.

This aligns the two paths by changing the non-accelerated path to return
the same results as in the apple-tables one. In pratice, this means we
will search in both the "basename", "method" and "fullname" indexes (in
the manual indexes these are separate indexes. This means the function
will return some slightly inappropriate results (e.g. bar::baz::foo when
one asks for a "full name" foo), but this can be handled by additional
filtering, independently indexing method. I've also stopped inserting
demangled names into the "fullname" index, as that is inconsistent with
the apple path.

Reviewers: clayborg, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 331855
2018-05-09 08:21:25 +00:00
Greg Clayton 2550ca1e93 Add support to object files for accessing the .debug_types section
In an effort to make the .debug_types patch smaller, breaking out the part that reads the .debug_types from object files into a separate patch

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

llvm-svn: 331777
2018-05-08 17:19:24 +00:00
Jonas Devlieghere e6effb199c [test] Re-enable TestUnicodeSymbols
Re-enable TestUnicodeSymbols now that we use the in-tree dsymutil. This
was disabled because the hashing of unicode symbols was out of sync
between llvm (dsymutil) and lldb.

llvm-svn: 331764
2018-05-08 13:28:34 +00:00
Frederic Riss 1739b7d076 Really test type lookup in TestCppTypeLookup.py
Summary:
... and fix one bug found this way. Currently, the test works not because
types are looked up correctly, but because by injecting local variables
we also materialize the types for Clang. If we disable the local variable
injection, then one check fails.

The reason of the failure is that FindTypes is run with max_matches==1
and this value is passed down to the symbol lookup functions. When the
search is performed only on the basename (like it's the case for an
entity defined in the root namespace), then the search will stop after
having found one match on the basename. But that match might be in a
namespace, we were really just looking up the basename in the accelerator
tables.

The solution is to not pass max_matches down, but to search without a
limit and let RemoveMismatchedTypes do its job afterwards. Note the
patch includes 2 hunks with the same change, but only the latter is
tested. I couldn't find a way to create a testcase for the other
branch of the if ('image lookup -t' allows me to get there, but it
only ever returns one type anyway).

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 331719
2018-05-08 03:08:46 +00:00
Stella Stamenova 8380d12a6e [lit, lldbsuite] Fixes for several tests LLDB tests for Python 3 or Windows
Summary:
In decorators.py, when opening streams, open them in text mode. In Py3, if they are not opened in text mode, the data is also expected to be binary, but we always use text data.
In TestLinuxCore, skip the tests that are not applicable on Windows
In the python api main.c, update the code to be compilable on Windows

Reviewers: asmith, zturner

Reviewed By: zturner

Subscribers: zturner

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

llvm-svn: 331686
2018-05-07 21:57:00 +00:00
Stella Stamenova 88ce10b77d Test Commit: fix a comment to be grammatically correct
llvm-svn: 331679
2018-05-07 21:19:14 +00:00
Greg Clayton d68dbd5ad6 Fix "file ./a.out" and file "../a.out" so that is works after recent FileSpec normalization path changes.
Test coming soon, but I want to unbreak people.

llvm-svn: 331637
2018-05-07 14:21:04 +00:00
Jim Ingham 0fd685353d Add children and child[N] properties to SBValue.i.
Also fixed some bad formatting in SBValue.i.

llvm-svn: 331501
2018-05-04 01:31:47 +00:00
Jason Molenda 07580ffe47 The on-ios-device command line lldb has an optimization where
when it and the inferior process both have the same shared cache
(a conglomeration of all libraries at the same fixed address for
all processes), lldb will read data out of its own memory to speed
things up.  The shared cache has a UUID, so lldb currently checks
that the UUID of its own shared cache matches that of the inferior.

This change adds one refinement to that -- it checks that the UUID
is the same and that the base address of the shared cache is the
same.  And only uses its local shared cache if they are both identical.

This involved using a different style of SPI with dyld to get lldb's
shared cache load address, but it's not especially difficult.

One unattractive part of the change is that I'm using the real
underlying types of task_t and kern_return_t instead of picking
them up from mach/mach.h.  The defines that get picked up there (a
lot from machine.h but others too) conflict with llvm/Support/MachO.h
even when I have mach.h included before our SafeMachO.h which
undefines most of the defines before including llvm/Support/MachO.h.
I'll need to augment the #undefs in SafeMachO.h to get this to
compile cleanly, but that'll be another day.

<rdar://problem/39868238> 

llvm-svn: 331497
2018-05-04 00:59:37 +00:00
Adrian Prantl b51804e0d8 DWARFExpression: Convert file addresses to load addresses early on.
This is a change that only affects Swift and is NFC for the language
plugins on llvm.org. In Swift, we can have global variables with a
location such as DW_OP_addr <addr> DW_OP_deref. The DWARF expression
evaluator doesn't know how to apply a DW_OP_deref to a file address,
but at the very end we convert the file address into a load address.

This patch moves the file->load address conversion to right after the
result of the DW_OP_addr is pushed onto the stack so that a subsequent
DW_OP_deref (and potentially other operations) can be interpreted.

rdar://problem/39767528

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

llvm-svn: 331492
2018-05-03 23:32:47 +00:00
Adrian Prantl b78a577179 Revert "DWARFExpression: Convert file addresses to load addresses early on."
This reverts commit 331462 while investigating bot breakage.

llvm-svn: 331480
2018-05-03 20:19:39 +00:00
Adrian Prantl 88fc73d544 Add back condition that was accidentally removed in r331462.
This should make the bots much happier.

llvm-svn: 331479
2018-05-03 20:13:58 +00:00
Jonas Devlieghere 52721286b2 [CMake] Unify and relayer testing
This patch restructures part of LLDB's testing configuration:

1. I moved the test dependencies up the chain so every dotest dependency
   becomes a lit dependency as well. It wouldn't make sense for dotest to
   have other dependencies when it's being run by lit. Lit on the other
   hand can still specify extra dependencies.

2. I replaced as much generator expressions with variables as possible.
   This is consistent with the rest of LLVM and doesn't break generators
   that support multiple targets (MSVC, Xcode). This wasn't a problem
   before, but now we need to expand the dotest arguments in the lit
   configuration and there's only one test suite even with multiple
   targets.

3. I moved lldb-dotest into it's own directory under utils since there's
   no need anymore for it to located under `test/`.

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

llvm-svn: 331463
2018-05-03 16:54:10 +00:00
Adrian Prantl c42fa4be1f DWARFExpression: Convert file addresses to load addresses early on.
This is a change that only affects Swift and is NFC for the language
plugins on llvm.org. In Swift, we can have global variables with a
location such as DW_OP_addr <addr> DW_OP_deref. The DWARF expression
evaluator doesn't know how to apply a DW_OP_deref to a file address,
but at the very end we convert the file address into a load address.

This patch moves the file->load address conversion to right after the
result of the DW_OP_addr is pushed onto the stack so that a subsequent
DW_OP_deref (and potentially other operations) can be interpreted.

rdar://problem/39767528

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

llvm-svn: 331462
2018-05-03 16:51:37 +00:00
Pavel Labath 38d67db39c Remove the timed_out out-argument from Predicate::WaitForValueEqualTo
The function can only return in one of two ways: the Predicate value is
successfully set within the allotted time, or it isn't (the wait times
out). These states can be represented in the return value, and the extra
arg adds no value.

llvm-svn: 331458
2018-05-03 15:33:41 +00:00
Pavel Labath 90b0a53499 lldb-test symbols: Add ability to do name-based lookup
Summary:
lldb-test already had the ability to dump all symbol information in a
module. This is interesting, but it can be too verbose, and it also does
not use the same APIs that lldb uses to query symbol information. The
last part is interesting to me now, because I am about to add DWARF v5
debug_names support, which needs to implement these APIs.

This patch adds a set of arguments to lldb-test, which modify it's
behavior from dumping all symbols to dumping only the requested
information:
- --find={function,namespace,type,variable} - search for the given
  kind of objects.

- --name - the name to search for.

- --regex - whether to treat the "name" as a regular expression. This is
  not available for all lookup types (we do not have the required APIs
  for namespaces and types).

- --context - specifies the context, which can be used to restrict the
  search. This argument takes a variable name (which must be defined and
  be unique), and we then use the context that this variable is defined
  in as the search context.

- --function-flags={auto,full,base,method,selector} - a set of flags to
  further restrict the search for function symbols.

Together, these flags and their combinations cover the main SymbolFile
entry points which I will need to modify for the accelerator table
support, and so I plan to do most of the regression testing this way.
(I've also found this a useful tool for exploration of what the given
APIs are supposed to do.)

I add a couple of tests to demonstrate the usage of the usage of the
various options, and also an xfailed test which demonstrates a bug I
found while playing with this. The only requirement for these tests is
the presence of lld -- the should run on any platform which is able to
build lldb.

These tests use c++ code as input, but this isn't a requirement. It is also
possible to use IR, assembly or json to create the test module.

Reviewers: davide, zturner, asmith, JDevlieghere, clayborg, alexshap

Subscribers: mgorny, aprantl, lldb-commits

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

llvm-svn: 331447
2018-05-03 10:57:16 +00:00
Davide Italiano 1f6277eb4d [NSDictionary] Simplify the formatter. NFCI.
llvm-svn: 331415
2018-05-02 23:36:07 +00:00
Richard Smith fbe748ae86 Use conventional spelling of always-failing assert.
Fixes -Wstring-conversion warning that was breaking -Werror builds.

llvm-svn: 331406
2018-05-02 22:21:11 +00:00
Leonard Mosescu 9fecd37220 Use the UUID from the minidump's CodeView Record for placeholder modules
This change adds support for two types of Minidump CodeView records:

PDB70 (reference: https://crashpad.chromium.org/doxygen/structcrashpad_1_1CodeViewRecordPDB70.html)
This is by far the most common record type.

ELF BuildID (found in Breakpad/Crashpad generated minidumps)
This would set a proper UUID for placeholder modules, in turn enabling
an accurate match with local module images.

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

llvm-svn: 331394
2018-05-02 20:06:17 +00:00
Adrian Prantl 6e9f77126b Silence compiler warning.
llvm-svn: 331375
2018-05-02 17:11:43 +00:00
Pavel Labath 47776cbd2c Fix gdb-remote qMemoryRegionInfo unit tests for xml-enabled builds
In case we are building with xml enabled, the GetMemoryRegionInfo
function will send extra packets to query te extended memory map, which
the tests were not expecting.

Add an expectation for this to the test. Right now, it's just a basic
one which pretends we don't support the extension, however, it would be
also interesting the add a test which verifies the extension-enabled
case.

I also noticed that the test does a pretty lousy job of validating the
returned memory region info, so I add a couple of extra assertions to
improve that.

llvm-svn: 331374
2018-05-02 17:00:33 +00:00
Adrian Prantl d8f460e864 Enable AUTOBRIEF in doxygen configuration.
This brings the LLDB configuration closer to LLVM's and removes visual
clutter in the source code by removing the @brief commands from
comments.

This patch also reflows the paragraphs in all doxygen comments.

See also https://reviews.llvm.org/D46290.

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

llvm-svn: 331373
2018-05-02 16:55:16 +00:00