Commit Graph

17214 Commits

Author SHA1 Message Date
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
Pavel Labath e222d92707 Predicate.h: remove unused functions
The functions are unused, their comments are out of date with the
implementation, and the implementation is out of date with the rest of the code
base (it uses seconds(0) to mean infinite wait, whereas elsewhere we use the
Timeout class).

llvm-svn: 331350
2018-05-02 13:14:18 +00:00
Richard Smith 51d12d8885 Update lldb to match clang r331244 (addition of char8_t).
Also fix misclassification of char16_t and char32_t: these are unsigned types,
not signed types.

llvm-svn: 331323
2018-05-02 02:43:22 +00:00
Jason Molenda b81afd6598 Fix the .experimental. settings feature so that we don't return an error
if an experimental setting has been removed/is missing.

Add tests for the .experimental. settings behaviors -- that they correctly
forward through to the real setting if it has become a real setting,
that they don't generate errors when a settig has been removed.

As Pavel notes in https://reviews.llvm.org/D45348, the way I'm suppressing
errors in the setting is not completely correct - if any of the setting
path components include "experimental", a missing setting would be declared
a non-error.  So

settings set target.experimental.setting-that-does-not-exist true

would not generate an error, which is correct.  But as Pavel notes, 

settings set setting-does-not-exist.experimental.run-stopped true

should generate an error because the unknown name occurs before the
"experimental".  The amount of change to do this correctly hasn't
thrilled me, so I'm leaving this as-is for now.

<rdar://problem/39223054> 
Differential Revision: https://reviews.llvm.org/D45348

llvm-svn: 331315
2018-05-01 22:49:01 +00:00
Jonas Devlieghere 5a3c9ee93d Revert "[lit] Replace generator expressions in lit.site.cfg"
Using GENERATE breaks generators that support multiple configurations,
e.g. MSVC. Reverting for now until we find a better solution.

llvm-svn: 331285
2018-05-01 17:08:09 +00:00
Jonas Devlieghere 42b8d26414 [lit] Replace generator expressions in lit.site.cfg
The lit site configuration for the test suite can contain generator
expressions such as $<TARGET_FILE:debugserver> that need to be
substituted.

llvm-svn: 331277
2018-05-01 16:19:48 +00:00
Adrian Prantl e757ddaf3d Remove redundant command.
llvm-svn: 331270
2018-05-01 15:38:01 +00:00
Pavel Labath c1a775419f Split TestGlobalVariables into two and xfail one of them for arm64 linux
Displaying of global pointer variables is not working on arm64 linux
(pr37301).

I've moved this part into a separate test, so it can be xfailed
separately. I then move the "show-variables-with-process-available"
check before the "show-all-variables" command to presrve the intent of
checking that global variable caching works correctly. (I've verified
that the new arrangement still fails when I revert the fix from
r331230.)

llvm-svn: 331250
2018-05-01 10:09:53 +00:00
Eugene Zemtsov 09a1a39874 Fix type_lookup test to make buildbots happy
llvm-svn: 331242
2018-05-01 03:06:05 +00:00
Jason Molenda 3678be89f7 Log to the process channel, not target twice.
llvm-svn: 331239
2018-05-01 00:42:17 +00:00
Jason Molenda c9f7939121 Add logging when ArchSpec::SetArchitecture is given a cputype and
cpusubtype that don't map to any known core definition.

<rdar://problem/39779398> 

llvm-svn: 331236
2018-05-01 00:05:54 +00:00
Adrian Prantl 03219f7f64 Refactor GetNextPersistentVariableName into a non-virtual method
that takes a prefix string. This simplifies the implementation and
allows plugins such as the Swift plugin to supply different prefixes
for return and error variables.

rdar://problem/39299889

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

llvm-svn: 331235
2018-04-30 23:59:17 +00:00
Adrian Prantl 5435f78046 Move the persistent variable counter into Target
so it can be shared across multiple language plugins.

In a multi-language project it is counterintuitive to have a result
variables reuse numbers just because they are using a different
language plugin in LLDB (but not for example, when they are
Objective-C versus C++, since they are both handled by Clang).

This is NFC on llvm.org except for the Go plugin.

rdar://problem/39299889

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

llvm-svn: 331234
2018-04-30 23:59:15 +00:00
Adrian Prantl ce05952943 Remove premature caching of the global variables list in CompileUnit.
This fixes a bug where

  (lldb) target var g_ptr

would populate the global variables list with exactly one entry
because SymbolFileDWARF::ParseVariables() was invoked with a list of
DIEs pre-filtered by name, such that a subsequent call to

  (lldb) fr var --show-globals

would only list that one variable, because CompileUnit::m_variables
was already initialized, fooling CompileUnit::GetVariableList().

CompileUnit::GetVariableList() grabs the *complete* list of variables
via (SymbolFileDWARF, ...)::ParseVariablesForContext and that still
calls CompileUnit::SetVariableList(variables) which acts as the
caching mechanism.

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

llvm-svn: 331230
2018-04-30 21:54:02 +00:00
Jan Kratochvil 32f2d0e564 Protect DWARFCompileUnit::m_die_array by a new mutex
Multiple DW_TAG_compile_unit being indexed in a multithreaded way can request
reading of the same DW_TAG_partial_unit.

Unfortunately one cannot detect DWZ file ahead of time to disable such locking
overhead as DWARFCompileUnit::Extract does not read the first DIE which is the
only place one could find early enough if the DWARF file is using any
DW_TAG_partial_unit.

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

llvm-svn: 331229
2018-04-30 21:37:30 +00:00
Greg Clayton c485f056b7 Fix expression parser to not accept any type whose basename matches for a type that must exist at root level
This patch fixes an issue where we weren't looking for exact matches in the expression parser and also fixed the type lookup logic in the Module.cpp. Tests added to make sure we don't regress.

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

llvm-svn: 331227
2018-04-30 21:06:30 +00:00
Adrian Prantl 05097246f3 Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.

FYI, the script I used was:

import textwrap
import commands
import os
import sys
import re
tmp = "%s.tmp"%sys.argv[1]
out = open(tmp, "w+")
with open(sys.argv[1], "r") as f:
  header = ""
  text = ""
  comment = re.compile(r'^( *//) ([^ ].*)$')
  special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$')
  for line in f:
      match = comment.match(line)
      if match and not special.match(match.group(2)):
          # skip intentionally short comments.
          if not text and len(match.group(2)) < 40:
              out.write(line)
              continue

          if text:
              text += " " + match.group(2)
          else:
              header = match.group(1)
              text = match.group(2)

          continue

      if text:
          filled = textwrap.wrap(text, width=(78-len(header)),
                                 break_long_words=False)
          for l in filled:
              out.write(header+" "+l+'\n')
              text = ""

      out.write(line)

os.rename(tmp, sys.argv[1])

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

llvm-svn: 331197
2018-04-30 16:49:04 +00:00
Jan Kratochvil 55c84b1a4e Match also DW_TAG_partial_unit when DW_TAG_compile_unit is matched
Code commonly checks if the parent DIE is DW_TAG_compile_unit.
But DW_TAG_partial_unit also acts as DW_TAG_compile_unit for DWZ
as DWZ is using DW_TAG_imported_unit only at the top unit level.

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

llvm-svn: 331194
2018-04-30 16:04:32 +00:00
Pavel Labath d2f36c864e llgs tests: Use noack-mode for communication to avoid pr37294
llvm-svn: 331180
2018-04-30 14:30:02 +00:00
Pavel Labath edb0127629 ObjectFileELF: Add support for arbitrarily named code sections
ObjectFileELF assumes that code section has ".text" name. There is an
exception for kalimba toolchain that can use arbitrary names, but other
toolchains also could use arbitrary names for code sections. For
example, corert uses separate section for compiled managed code. As lldb
doesn't recognize such section it leads to problem with breakpoints on
arm, because debugger cannot determine instruction set (arm/thumb) and
uses incorrect breakpoint opcode that breaks program execution.

This change allows debugger to correctly handle such code sections. We
assume that section is a code section if it has SHF_EXECINSTR flag set
and has SHT_PROGBITS type.

Patch by Konstantin Baladurin <k.baladurin@partner.samsung.com>.
Differential Revision: https://reviews.llvm.org/D44998

llvm-svn: 331173
2018-04-30 13:23:47 +00:00
Pavel Labath 410c5acf27 Fixup r331049 (FileSpec auto-normalization)
A typo in the patch (using syntax instead of m_syntax) resulted in the
normalization not working properly for windows filespecs when the syntax
was passed as host-native. This did not affect the unit tests, as all of
those pass an explicity syntax, but failed gloriously when running the
full test suite.

I also fix an expectation in an lldb-mi test, which was now failing
because it was expecting a path to be echoed verbatim, but we were now
normalizing it.

As a drive-by, this also fixes the default-in-fully-covered-switch
warning and removes an unused argument from the NeedsNormalization
function.

llvm-svn: 331172
2018-04-30 12:59:14 +00:00
Jan Kratochvil e4777a9df5 Support reading section ".gnu_debugaltlink"
Differential revision: https://reviews.llvm.org/D40468

llvm-svn: 331148
2018-04-29 19:47:48 +00:00
Greg Clayton 27a0e10a3e Fix build bots after r331049 broke them.
llvm-svn: 331082
2018-04-27 21:10:07 +00:00
Frederic Riss 60b94c296e [debugserver] Fix the G packet handling.
Of course r331004 needed a counterpart on the write side.

llvm-svn: 331073
2018-04-27 19:59:42 +00:00
Greg Clayton 776cd7ad44 Always normalize FileSpec paths.
Always normalizing lldb_private::FileSpec paths will help us get a consistent results from comparisons when setting breakpoints and when looking for source files. This also removes a lot of complexity from the comparison routines. Modified the DWARF line table parser to use the normalized compile unit directory if needed.

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

llvm-svn: 331049
2018-04-27 15:45:58 +00:00
Frederic Riss ffb8d8711c Mark test as @skipIfOutOfTreeDebugserver
This test will currently fail for people using the system debugserver.

llvm-svn: 331043
2018-04-27 15:30:09 +00:00
Jim Ingham 93979f67f8 Fix a thinko in the iteration over StructuredDataPlugin Create functions.
The code was grabbing the first plugin, and then never getting
another one.

<rdar://problem/39779438>

llvm-svn: 331012
2018-04-27 01:57:40 +00:00
Frederic Riss 34ec0bfb5e [debugserver] Fix handling of the 'g' packet
LLDB doesn't use this packet so we never hit this, but it looks like
some other projects talk to debugserver and are hitting an assert
(https://github.com/derekparker/delve/issues/1015).

We had an off by 1 in the accounting of the FPU structure sizes.
I added a test that basically just check that 'g' doesn't return
an error (currently it assert in debug builds). I didn't make
it an lldb-server test because it looks like lldb-server doesn't
implement the g packet.

llvm-svn: 331004
2018-04-27 00:09:04 +00:00
Frederic Riss 05e8bc85e6 [debugserver] Return 'ios' instead of 'iphoneos' for the ostype.
When I merged the 2 codepaths that return an OS type, I hade
checked that the places accepting 'iphoneos' would also accept
'ios', but then I got it backwards and return 'iphoneos'.

We use this value to build triples, and there 'iphoneos' is
invalid.

This also makes the test slightly simpler.

llvm-svn: 330877
2018-04-25 22:12:12 +00:00
Benjamin Kramer 0d97c225cd Fix -Wswitch warning after r330790.
source/Symbol/ClangASTContext.cpp:391:13: error: enumeration value 'HIP' not handled in switch [-Werror,-Wswitch]
    switch (IK.getLanguage()) {

llvm-svn: 330823
2018-04-25 13:22:47 +00:00
Aaron Smith ba48c9bde1 [lit, lldbsuite] Update the lldbsuite to correctly run tests on windows and windows server
Summary:
The new script to run the lldbtests as part of lit invokes each test by calling dotest.py, however, we cannot rely on the system to always correctly interpret the script as python causing the tests to be unresolved on windows (at least). To fix this, we need to make sure that the first parameter in the command line is the python executable itself.

In Makefile.rules, there are a number of windows specific definitions that rely on the HOST_OS being set as Windows_NT but the logic detecting the OS currently does not detect server versions of windows correctly. This change updates the logic to detect windows server as well.

Reviewers: asmith, labath, JDevlieghere, zturner

Reviewed By: JDevlieghere, zturner

Subscribers: zturner, llvm-commits

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

llvm-svn: 330740
2018-04-24 17:08:05 +00:00
Pavel Labath fdfeefd6c2 [dotest] Make the set of tests independent of the test configuration
Summary:
In the magic test duplicator, we were making the decision whether to
create a test variant based on the compiler and the target platform.
This meant that the set of known tests was different for each test
configuration.

This patch makes the set of generated test variants static and handles
the skipping via runtime checks instead. This is more consistent with
how we do other test-skipping decision (e.g. for libc++ tests), and
makes it easier to expose the full set of tests to lit, which now does
not need to know anything about what things can potentially cause tests
to appear or disappear.

Reviewers: JDevlieghere, aprantl

Subscribers: eraman, lldb-commits

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

llvm-svn: 330708
2018-04-24 10:51:44 +00:00
Davide Italiano e8643a0c91 [CMake] Add the missing `dsymutil` dependency when running tests.
llvm-svn: 330617
2018-04-23 17:06:55 +00:00
Pavel Labath 691d134805 llgs-tests: Increase packet time out
The default packet timeout of 1 second is a bit too small for these
tests, particularly as they are working in ack-mode, which means they
need to fit twice as many packets into the timeslot.

This does not seem to be a problem on the bots, but for some people
these tests are timing out regularly. I can't be sure increasing this
will solve their problem, but this does seem like a likely culprit.

llvm-svn: 330578
2018-04-23 11:22:44 +00:00
Jonas Devlieghere 0d5c5936cb [CMake] Gate 'dsymutil' dependency
Only add `dsymutil` as a test dependency when this is not a stand-alone
build (LLDB_BUILT_STANDALONE).

llvm-svn: 330568
2018-04-23 08:44:06 +00:00
Jonas Devlieghere 49f4aee0e3 [lit] Generate a single lit cfg file for tests that require dotest.py
The current way that the lit configuration is generated for the LLDB
tests that run using dotest causes cmake to fail when using a generator
which supports multiple configurations (such as Visual Studio). The
failure is because file GENERATE will create a file *per possible
configuration* resulting in the same lit configuration file being
overwritten multiple times.

To fix the issue, we need to create a single lit file that is agnostic
of the configurations and can be used for any configuration.

Patch by: Stella Stamenova

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

llvm-svn: 330518
2018-04-21 18:23:04 +00:00
Ed Maste eda6432de6 Temporarily skip Go TestExpressions on FreeBSD as it hangs
llvm.org/pr37194

llvm-svn: 330504
2018-04-21 13:59:07 +00:00
Ed Maste 592d29a3b9 FreeBSD: propagate error to user if memory access fails
Previously, an attempt to read an unreadable address reported zeros.
Now, if DoReadMemory or DoWriteMemory encounters error then return 0
(bytes read or written) so that the error is reported to the user.

llvm.org/pr37190

llvm-svn: 330500
2018-04-21 11:23:56 +00:00
Jim Ingham e477eb6680 Fix the Xcode gtest target for the move of FileSpecTest.cpp.
llvm-svn: 330460
2018-04-20 18:30:31 +00:00
Adrian Prantl 690c828b0b Fix a crash when resolving overloads of C++ virtual methods.
The isOverload() method needs to account for situations where the two
methods being compared don't have the same number of arguments.

rdar://problem/39542960

llvm-svn: 330450
2018-04-20 17:14:05 +00:00
Pavel Labath 0e0906c221 Move FileSpecTest to Utility
FileSpec class was moved to the Utility module a while ago, but the test
file was left behind. This corrects that.

llvm-svn: 330405
2018-04-20 08:27:27 +00:00
Davide Italiano 981ec1d199 [DWARFASTParserClang] Remove dead code. NFCI.
llvm-svn: 330385
2018-04-20 00:44:33 +00:00
Adrian McCarthy 4ee16bfff7 Fix narrowing warning by appending `f` to literal constant.
llvm-svn: 330354
2018-04-19 18:31:57 +00:00
Pavel Labath 5976f30821 Attempt to fix TestMiniDump on windows
It was failing because the modules names were coming out as
C:\Windows\System32/MSVCP120D.dll (last separator is a forward slash) on
windows.

There are two issues at play here:
- the first problem is that the paths in minidump were being parsed as a
  host path. This meant that on posix systems the whole path was
  interpreted as a file name.
- on windows the path was split into a directory-filename pair
  correctly, but then when it was reconsituted, the last separator ended
  up being a forward slash because SBFileSpec.fullpath was joining them
  with '/' unconditionally.

I fix the first issue by parsing the minidump paths according to the
path syntax of the host which produced the dump, which should make the
test behavior on posix&windows identical. The last path will still be a
forward slash because of the second issue. We should probably fix the
"fullpath" property to do something smarter in the future.

llvm-svn: 330314
2018-04-19 09:38:42 +00:00