Commit Graph

17257 Commits

Author SHA1 Message Date
Adrian Prantl 7341691502 Fix check for verbose logging.
Thanks to Pavel for pointing this out!

llvm-svn: 328557
2018-03-26 17:40:44 +00:00
Pavel Labath 9a652a84b1 Fix TestDisassembleBreakpoint broken by r328488
The first issue was that the test was capturing the "before" disassembly
before launching, and the "after" after. This is a problem because some
of the disassembly will change after we know the load address (e.g. PCs
in call instructions). I fix this by capturing both disassemblies with
the process running.

The second issue was that the refactor in r328488 accidentaly changed
the meaning of the test, as it was no longer disassembling the function
which contained the breakpoint.

While inside, I also modernize the test to use
lldbutil.run_to_source_breakpoint and prevent debug-info replication.

llvm-svn: 328504
2018-03-26 15:17:58 +00:00
Pavel Labath 22dccd008e Make @skipUnlessSupportedTypeAttribute windows-compatible
- close_fds is not compatible with stdin/out redirection on windows. I
  just remove it, as this is not required for correct operation.
- the command string was assuming a posix shell. I rewrite the Popen
  invocation to avoid the need for passing the arguments through a shell.

llvm-svn: 328489
2018-03-26 12:47:40 +00:00
Pavel Labath d5ee7ab47e Add and fix some tests for PPC64
Summary:
TestExprsChar.py
Char is unsigned char by default in PowerPC.

TestDisassembleBreakpoint.py
Modify disassemble testcase to consider multiple architectures.

TestThreadJump.py
Jumping directly to the return line on PowerPC architecture dos not
means returning the value that is seen on the code. The last test fails,
because it needs the execution of some assembly in the beginning of the
function. Avoiding this test for this architecture.

TestEhFrameUnwind.py
Implement func for ppc64le test case.

TestWatchLocation.py
TestStepOverWatchpoint.py
PowerPC currently supports only one H/W watchpoint.

TestDisassembleRawData.py
Add PowerPC opcode and instruction for disassemble testcase.

Reviewers: labath

Reviewed By: labath

Subscribers: davide, labath, alexandreyy, lldb-commits, luporl, lbianc

Differential Revision: https://reviews.llvm.org/D44472
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>.

llvm-svn: 328488
2018-03-26 12:42:07 +00:00
Pavel Labath 5af3fb2b94 [LLDB][PPC64] Fix TestGdbRemoteAuxvSupport
Summary: PPC64's auxvec has a special key that must be ignored.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43771
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 328486
2018-03-26 12:00:52 +00:00
Pavel Labath a057877a2e Add a test for setting the load address of a module with differing physical/virtual addresses
Summary:
First attempt at landing D42145 was reverted because it caused test
failures on some android devices. It turned out this was because these
devices had vdso modules with differing physical and virtual addresses.
This was not caught earlier because all of the modules in our tests
either lack physical addresses or have them identical to virtual ones.

In the discussion on the patch, we came to the conclusion that in the
scenario where we are merely setting a load address of a module (for
example from a dynamic loader plugin), we should always use virtual
addresses (i.e., preserve status quo). This patch adds a test to make
sure we don't regress in that direction.

Reviewers: owenpshaw

Subscribers: lldb-commits

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

llvm-svn: 328485
2018-03-26 11:45:32 +00:00
Jim Ingham df9f50d23c Add support for __attribute__(trivial_abi).
<rdar://problem/36035075>, <rdar://problem/36035039>

llvm-svn: 328389
2018-03-23 23:44:52 +00:00
Jason Molenda 953d843dfb Remove CommandObjectStats.cpp & CleanUpTest.cpp from
installing in the man page directory.

llvm-svn: 328383
2018-03-23 23:32:16 +00:00
Jason Molenda 2582b9675b Put CommandObjectStats.cpp in lldb-core target, remove CommandObjectStats.h from targets.
llvm-svn: 328382
2018-03-23 22:50:23 +00:00
Davide Italiano 10166c7468 [Commands] Add a (currently empty) `stats` command.
This one will be used to print statistics about lldb sessions
(including, e.g. number of expression evaluation succeeded or
failed). I decided to commit the skeleton first so that we have
a clean reference on how a command should be implemented.
My future commits are going to populate this command and test
it.

<rdar://problem/36555975>

llvm-svn: 328378
2018-03-23 21:55:48 +00:00
Jason Molenda 379128d3f2 Change the darwin-debug target to build the standard
archs.

llvm-svn: 328374
2018-03-23 21:37:19 +00:00
Davide Italiano fce6277b93 [CMakeLists] Update file list after recent changes.
llvm-svn: 328373
2018-03-23 21:21:17 +00:00
Davide Italiano 88ad88667c [Commands] Remove dead code for unused `args` command.
It wasn't even registered.

(lldb) apropos args
No commands found pertaining to 'args'. Try 'help' to see
a complete list of debugger commands.

llvm-svn: 328370
2018-03-23 21:04:34 +00:00
Davide Italiano fd679c0e22 [Command] Remove dead code for the syntax command.
I'm going to add a new commend so I figured I could do
some spring cleaning.

llvm-svn: 328368
2018-03-23 20:58:05 +00:00
Adrian Prantl 6b2d5950d3 Log ObjC Runtime messages only in verbose mode
llvm-svn: 328365
2018-03-23 20:17:39 +00:00
Davide Italiano 7bbfd8a5b9 [CommandObjectFrame] Remove dead code.
llvm-svn: 328278
2018-03-23 00:14:41 +00:00
Aaron Smith 308e39ca8d [SymbolFilePDB] Use section contributions as another way to determine the compiland
Some PDB Symbols don't have line information. Use the section contributions to determine their compiland. 
This is useful to determine the parent compiland for PDBSymbolTypeData, i.e. variables.

llvm-svn: 328232
2018-03-22 19:26:33 +00:00
Aaron Smith d5a925f42b [SymbolFilePDB] Ignore compiler generated functions when creating the LLDB type from a PDB
llvm-svn: 328230
2018-03-22 19:21:34 +00:00
Aaron Smith c8316ed266 [SymbolFilePDB] Run clang-format; NFC
llvm-svn: 328176
2018-03-22 03:44:51 +00:00
Pavel Labath 292178e104 Last batch of test-tree cleaning changes
- postmortem tests: make sure the core files are created in the build
  folder
- TestSourceManager: copy the .c file into the build dir before
  modifying it
- TestLogging: create log files in the build folder

After these changes I get a clean test run (on linux) even if I set the
source tree to be read only. It's possible some of the skipped/xfailed
tests are still creating files in the source tree, but at the moment, I
don't have plans to go hunting for those.

llvm-svn: 328106
2018-03-21 15:29:32 +00:00
Jonas Devlieghere ecc8aee652 [dotest] Use subprocess.call to forward arguments in wrapper
As suggested by Pavel on lldb-commits. Originally I picked os.system
because it was so much more simple than the subprocess module, but that
no longer holds true after yesterday's hack in r328020. This is what it
should've been in the first place.

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

llvm-svn: 328089
2018-03-21 11:13:56 +00:00
Pavel Labath 03a77e9a39 Fix crash exposed by r328025
The issue was that the ASTDumper was being passed a null pointer
(because we did not create any declaration for the operator==).  The
crash was in logging code, so it only manifested it self if you ran the
tests with logging enabled (like our bots do).

Given that this is logging code and the rest of the debugger is fine
with the declaration being null, I just make sure the logging code can
handle it as well. Right now I just do the null check in
ClangExpressionDeclMap, but if the ASTDumper class is meant to be a
debugging/logging aid, then it might be a good idea move the check
inside the class itself.

llvm-svn: 328088
2018-03-21 11:10:57 +00:00
Pavel Labath 95f7572c6f Fix TestOperatorOverload for 32-bit builds
- use more goodies from Makefile.rules to correctly build a 32-bit
binary.
- avoid hardcoding typeof(nil) in the test.

This should partially fix the linux bot. There is still one assertion
failure remaining, which I'll have to investigate separately, as I am
not experiencing it locally.

llvm-svn: 328083
2018-03-21 09:43:50 +00:00
Davide Italiano ff092f51b8 [Testsuite] Modernize this test to be run out-of-tree.
New tests should run the make syntax voodoo $@ and $<
instead of hardcoding the names. We should also document
how to write one, it's on my list.

llvm-svn: 328062
2018-03-20 23:47:47 +00:00
Davide Italiano 7e3ef4df2d [ExpressionParser] Re-implement r327356 in a less disruptive way.
Instead of applying the sledgehammer of refusing to insert any
C++ symbol in the ASTContext, try to validate the decl if what
we have is an operator. There was other code in lldb which was
responsible for this, just not really exposed (or used) in this
codepath. Also, add a better/more comprehensive test.

<rdar://problem/35645893>

llvm-svn: 328025
2018-03-20 19:46:32 +00:00
Jonas Devlieghere 410c6c8fd5 [lldb-dotest] Wrap arguments in single quotes
If we don't wrap arguments to the wrapper in single quotes, combined
arguments, for example for -E, don't reach dotest.py as a unit but as
separate arguments, causing the latter to fail.

llvm-svn: 328020
2018-03-20 19:18:11 +00:00
Davide Italiano 9362753a69 [TestExpr] Fix a typo in a test, unbreaking the lldb Mac OS X bot.
llvm-svn: 328013
2018-03-20 18:32:47 +00:00
Pavel Labath 9af71b3875 Move StringExtractorGDBRemote.h to the include folder
While trying to use this header I noticed that it is not in the include
folder. Move it to there and update all #includes to reference that file
correctly.

llvm-svn: 327996
2018-03-20 16:14:00 +00:00
Pavel Labath f7174ef573 [LLDB] Fix TestTargetXMLArch's expected arch
Summary:
When running on an architecture other than x86_64, the
target.ConnectRemote() part of the test may add platform information to
the target triple.

It was observed that this happens at Process::CompleteAttach() method,
after the platform_sp->IsCompatibleArchitecture() check fails.
This method then calls platform_sp->GetPlatformForArchitecture(), that
on a Linux machine ends up returning a generic Linux platform, that then
ends up getting added to the original target architecture.

Reviewers: clayborg, labath, jasonmolenda

Reviewed By: labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D44022
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 327981
2018-03-20 13:46:05 +00:00
Pavel Labath e92ecd3196 Fix some tests for PPC64le architecture
Summary:
- Fix test jump for powerpc64le
  Jumping directly to the return line on power architecture dos not means
  returning the value that is seen on the code. The last test fails, because
  it needs the execution of some assembly in the beginning of the function.
  Avoiding this test for this architecture.

- Avoid evaluate environ variable name on Linux
  On Linux the Symbol environ conflicts with another variable, then in
  order to avoid it, this test was moved into a specific test, which is not
  supported if the OS is Linux.

- Added PPC64le as MIPS behavior
  Checking the disassembler output, on PPC64le machines behaves as MPIS.
  Added method to identify PPC64le architecture and checking it when
  disassembling instructions in the test case.

Reviewers: labath

Reviewed By: labath

Subscribers: clayborg, labath, luporl, alexandreyy, sdardis, ki.stfu, arichardson

Differential Revision: https://reviews.llvm.org/D44101
Patch by Leonardo Bianconi <leonardo.bianconi@eldorado.org.br>.

llvm-svn: 327977
2018-03-20 12:46:33 +00:00
Pavel Labath 16064d354a Re-land: [lldb] Use vFlash commands when writing to target's flash memory regions
The difference between this and the previous patch is that now we use
ELF physical addresses only for loading objects into the target (and the
rest of the module load address logic still uses virtual addresses).

Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region.  A bare metal target may have this kind of setup.

- Update ObjectFileELF to set load addresses using physical addresses.  A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region

Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: llvm-commits, arichardson, emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw <llvm@owenpshaw.net>.

llvm-svn: 327970
2018-03-20 11:56:24 +00:00
Jim Ingham f27d705d15 Add a suggestion to convert dotest tests to use run_to_source_breakpoint.
llvm-svn: 327941
2018-03-20 02:15:23 +00:00
Aaron Smith a3a8cc80b3 [SymbolFilePDB] Simplify code with newer methods
llvm-svn: 327927
2018-03-20 00:34:18 +00:00
Aaron Smith 487b0c6b66 [SymbolFilePDB] Simplify getting the source file path
Summary: Replace SymbolFilePDB::GetSourceFileNameForPDBCompiland() with PDBSymbolCompiland::getSourceFileFullPath().

Reviewers: zturner, rnk, lldb-commits

Subscribers: llvm-commits

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

llvm-svn: 327925
2018-03-20 00:18:22 +00:00
Jim Ingham e7bd1ac5aa Modernize a test.
llvm-svn: 327924
2018-03-19 23:15:06 +00:00
Jason Molenda f92817ab23 Rename remotectl_com.apple.internal.xpc.remote.debugserver.plist
to com.apple.internal.xpc.remote.debugserver.plist, not sure where
that remotectl_ prefix came from.

<rdar://problem/36751222> 

llvm-svn: 327922
2018-03-19 23:07:31 +00:00
Jason Molenda 695b211ce6 I didn't see that SocketAddress.cpp was already being pulled
in to debugserver; my re-addition resulted in duplicated
symbols.  Remove my added SocketAddress.cpp, and change the
original one to also be included for the debugserver-mini target.

llvm-svn: 327918
2018-03-19 22:55:19 +00:00
Jason Molenda cd063214b0 Add the ios-mini target to the top-level xcodeproj, which builds
the debugserver-mini target in debugserver.  Add a new plist
which needs to be installed for debugserver-mini.
<rdar://problem/36751222> 

llvm-svn: 327915
2018-03-19 22:04:45 +00:00
Jason Molenda ba9355b373 Add DWARFUnit.cpp to the correct target.
llvm-svn: 327913
2018-03-19 21:55:48 +00:00
Aaron Smith e664b5dc9d [SymbolFilePDB] Remove a few null pointer checks by passing ref
Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327908
2018-03-19 21:14:19 +00:00
Vedant Kumar 1d2bd15821 [test] Skip flaky tests in TestMiSyntax on Darwin
These tests tend to time out locally and on our bots.

llvm-svn: 327906
2018-03-19 20:50:50 +00:00
Vedant Kumar 206f29b804 [test] Skip flaky TestThreadStates tests on Darwin
These tests do not pass/fail consistently, so just skip them.

This is llvm.org/pr15824 & rdar://problem/28557237.

llvm-svn: 327905
2018-03-19 20:50:49 +00:00
Davide Italiano aae2c047d6 [ClangASTContext] Remove dead code. NFCI.
llvm-svn: 327893
2018-03-19 19:35:20 +00:00
Vedant Kumar a6137e2b23 Xcode: Include DWARFUnit.{h,cpp} in the build
This should address a bot failure due to r327809.

llvm-svn: 327865
2018-03-19 16:24:58 +00:00
Jan Kratochvil c4d65751df Move the codebase to use: DWARFCompileUnit -> DWARFUnit
Now the codebase can use the DWARFUnit superclass. It will make it later
seamlessly work also with DWARFPartialUnit for DWZ.

This patch is only a search-and-replace easily undone, nothing interesting
in it.

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

llvm-svn: 327810
2018-03-18 20:11:02 +00:00
Jan Kratochvil 2ccddfe3c6 DWARFUnit split out of DWARFCompileUnit
DW_TAG_partial_unit for DWZ can be then presented by DWARFPartialUnit also
inherited from DWARFUnit.

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

llvm-svn: 327809
2018-03-18 20:09:02 +00:00
Frederic Riss b6073eb6e1 Fix the Windows build after r327750
llvm-svn: 327753
2018-03-16 22:19:58 +00:00
Frederic Riss cce4af160c [DWARFASTParserClang] Complete external record types before using them as a decl context.
Summary:
When in a gmodules-like debugging scenario, you can have a parent decl context
that gets imported from an external AST. When this happens, we must be careful
to complete this type before adding children to it, otherwise it sometimes
results in a crash.

Reviewers: clayborg, jingham

Subscribers: aprantl, JDevlieghere, lldb-commits

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

llvm-svn: 327750
2018-03-16 22:12:22 +00:00
Vedant Kumar 5ba2fe3720 Skip TestThreadSpecificBpPlusCondition on Darwin due to timeouts
Bot failure: https://ci.swift.org/job/oss-lldb-incremental-osx/1104/

llvm-svn: 327731
2018-03-16 19:33:39 +00:00
Adrian Prantl f546d943f6 Remove -gmodules restriction from test
llvm-svn: 327729
2018-03-16 18:21:48 +00:00
Pavel Labath 63047d05c0 [dotest] Clean up test folder clean-up
Summary:
This patch implements a unified way of cleaning the build folder of each
test. This is done by completely removing the build folder before each
test, in the respective setUp() method. Previously, we were using a
combination of several methods, each with it's own drawbacks:
- nuking the entire build tree before running dotest: the issue here is
  that this did not take place if you ran dotest manually
- running "make clean" before the main "make" target: this relied on the
  clean command being correctly implemented. This was usually true, but
  not always.
- for files which were not produced by make, each python file was
  responsible for ensuring their deleting, using a variety of methods.

With this approach, the previous methods become redundant. I remove the
first two, since they are centralized. For the other various bits of
clean-up code in python files, I indend to delete it when I come
across it.

Reviewers: aprantl

Subscribers: emaste, ki.stfu, mgorny, eraman, lldb-commits

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

llvm-svn: 327703
2018-03-16 12:04:46 +00:00
Vedant Kumar 80a0f020fa Skip more lldb-mi tests which time out on Darwin
Bot failure: https://ci.swift.org/job/oss-lldb-incremental-osx/1097/testReport/junit/TestMiTarget/MiTargetTestCase/test_lldbmi_target_attach_wait_for/

llvm-svn: 327692
2018-03-16 04:11:03 +00:00
Vedant Kumar 51bc20527b [cmake] Copy system debugserver from the right place when only CommandLineTools
are installed

Instead of building debugserver when building lldb, I'd rather pass
LLDB_CODESIGN_IDENTITY="" to cmake and use the one already on my system.
However, on one of my machines I only have the CommandLineTools installed, and
so the hardcoded path to the system debugserver does not work for me.
Additionally, we should verify the LLDB framework exists on the machine before
trying to set the path to debugserver. This allows us to warn the user at
configure time that a system debugserver can't be found if they choose not to
build it themselves.

Patch by Alex Langford!

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

llvm-svn: 327691
2018-03-16 03:31:16 +00:00
Adrian Prantl 96cf00d01d Split skipIf decorator, the condition is supposed to be OR
llvm-svn: 327644
2018-03-15 17:07:05 +00:00
Pavel Labath 28d3e1ac41 [dotest] remove confirm_directory_exclusivity remnants
llvm-svn: 327643
2018-03-15 16:52:37 +00:00
Pavel Labath 0428ddd7fc Fix TestProcessLaunch breakage on MacOS
This test started failing after r327625. The cause seems difference in the
treatment of relative --stdin paths between MacOS (debugserver?) and linux
(lldb-server?). Linux treats this as relative to the debuggers PWD, while MacOS
as relative to (I think) the future PWD of the launched process.

This fixes the issue by using absolute paths, which should work everywhere, but
we should probably unify this path handling as well. I'll ask around about what
is the expected behavior here.

llvm-svn: 327633
2018-03-15 15:21:54 +00:00
Pavel Labath 107052ff9d Next batch of test-tree-cleaning changes
Summary:
The changes here fall into several categories.

- some tests were redirecting inferior stdout/err to a file. For these I
  make sure we use an absolute path for the file. I also create a
  lldbutil.read_file_on_target helper function to encapsulate the
  differences between reading a file locally and remotely.
- some tests were redirecting the pexpect I/O into a file. For these I
  use a python StringIO object to avoid creating a file altogether.
- the TestSettings inferior was creating a file. Here, I make sure the
  inferior is launched with pwd=build-dir so that the files end up
  created there.
- lldb-mi --log (used by some tests) creates a log file in PWD without
  the ability say differently. To make this work I make sure to run
  lldb-mi with PWD=build_dir. This in turn necessitated a couple of
  changes in other lldb-mi tests, which were using relative paths to
  access the source tree.

Reviewers: aprantl

Subscribers: ki.stfu, mehdi_amini, lldb-commits

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

llvm-svn: 327625
2018-03-15 13:47:09 +00:00
Pavel Labath 3662da80de @skipUnlessDarwin TestTargetSourceMap
Our MachO parser works only on darwin.

llvm-svn: 327611
2018-03-15 09:16:15 +00:00
Greg Clayton 9cc222c80d Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly
When using:

(lldb) settings set target.source-map ./ /path/to/source
LLDB would fail to set a source file and line breakpoint with:

(lldb) breakpoint set --file /path/to/source/main.c --line 2
Because code in the target was undoing the remapping of "/path/to/source/main.c" to "./main.c" and then it would resolve this path, which would append the current working directory to the path. We don't want to resolve paths that we unmap.

Test case added.

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

llvm-svn: 327600
2018-03-15 05:13:15 +00:00
Vedant Kumar 9a5466fd9a [test] cmake: Ensure liblldb builds before tests run
Without liblldb as a test dependency, tests which link it in from an
lldb framework (via Base.buildDriver()) won't work.

llvm-svn: 327595
2018-03-15 01:09:13 +00:00
Davide Italiano b84d653e9b [Dictionary] Rewrite the test added in r327587 as an inline test.
Until we have a better story for putting commands and check lines
in the same file (they're currently ignored), it seems that inline
tests are actually more concise and easier to understand.
Too bad we have still some python boilerplate, but that's not
really substantial so we can live with it.

Thanks to Fred for pointing out and Jim for explaining me how
to use the inline test format.

<rdar://problem/34806516>

llvm-svn: 327592
2018-03-15 00:07:05 +00:00
Davide Italiano 8f2e86da36 [DataFormatters] Implement summary for __NSDictionary0.
Before the patch:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x0000000100304420

After:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x0000000100304420 0 key/value pairs

There's nothing much else we can do, as this is always empty by
definition.

<rdar://problem/34806516>

llvm-svn: 327587
2018-03-14 23:09:36 +00:00
Vedant Kumar 5df2db1216 [test] Skip more lldb-mi tests which occasionally time out on Darwin
llvm-svn: 327586
2018-03-14 22:52:32 +00:00
Vedant Kumar ffc71c0a19 [test] Skip some lldb-mi tests which time out on Darwin
These don't always timeout, but it's inconvenient when they do.

llvm-svn: 327568
2018-03-14 20:32:10 +00:00
Vedant Kumar bee500becb [test] Delete some xfailed lldb-mi tests
This is a first pass at removing some lldb-mi tests which have been
xfailed and unmaintained for a while. We have open PRs for most of these
tests already. I've opened up the following additional PRs:

  llvm.org/PR36739 - lldb-mi driver exits properly
  llvm.org/PR36740 - lldb-mi -gdb-set and -gdb-show
  llvm.org/PR36741 - lldb-mi -symbol-xxx

The motivation here is to address timeout and pexpect-related issues in
the test suite. This was discussed on lldb-dev in the thread: "increase
timeout for tests?".

After this change, the lldb-mi tests seem to be in better health (on
Darwin at least). I consistently get:

$ ./bin/llvm-dotest -p TestMi
===================
Test Result Summary
===================
Test Methods:        101
Reruns:                0
Success:              88
Expected Failure:      0
Failure:               0
Error:                 0
Exceptional Exit:      0
Unexpected Success:    0
Skip:                 13
Timeout:               0
Expected Timeout:      0

llvm-svn: 327552
2018-03-14 18:37:13 +00:00
Tatyana Krasnukha 706a8095b3 Use GetItemAtIndexAsString overload for ConstString and move set rather than copy.
llvm-svn: 327549
2018-03-14 18:29:41 +00:00
Tatyana Krasnukha d37339d25b Reuse IsEmpty for ConstString::operator bool().
llvm-svn: 327548
2018-03-14 18:29:33 +00:00
Jonas Devlieghere 22af9c63f3 [dotest] Rename llvm-dotest -> lldb-dotest and make it a custom target
This renames llvm-dotest to lldb-dotest and makes it a custom target so
you can run `ninja lldb-dotest` to rebuild whatever is necessary before
rerunning the tests.

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

llvm-svn: 327519
2018-03-14 15:36:32 +00:00
Jonas Devlieghere 81ccb97024 [test] Disable TestMachCore everywhere except on Darwin
Apparently the parser is wrapped inside ifdef's so the logic isn't
available on non-Darwin platforms.

Should fix build bot failure:
  http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463

llvm-svn: 327512
2018-03-14 14:16:23 +00:00
Jonas Devlieghere 25486b7512 Update selected thread after loading mach core
The OS plugins might have updated the thread list after a core file has
been loaded. The physical thread in the core file may no longer be the
one that should be selected. Hence we should run the thread selection
logic after loading the core.

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

llvm-svn: 327501
2018-03-14 11:50:10 +00:00
Pavel Labath 10ef313678 [cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)
Summary:
To make this build work, I needed to add detection code for the pthread
library. This is necessary, because we have direct calls to these
libraries (instead of going through llvm) and in the standalone build we
cannot rely on llvm to detect these for us. In a standalone non-dylib
build this was accidentaly working because these libraries were pulled
in as an interface dependency of the .a files, but in a dylib build
these are no longer part of the link interface, and so we need to add
them explicitly.

Reviewers: krytarowski, zturner

Subscribers: lldb-commits, mgorny

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

llvm-svn: 327490
2018-03-14 10:08:21 +00:00
Pavel Labath 5a48f95a0f Skip TestWatchedVarHitWhenInScope.py everywhere
The expression-hits tracking logic is not available on any platform. The
reason this tests happens to pass on some platforms is that the test is
written poorly -- it relies on the fact that post-main cleanup code will
write to the stack memory once occupied by the watched variable, but
this is not the case everywhere (e.g. linux glibc does not seem to do
this, but android's bionic library does).

llvm-svn: 327483
2018-03-14 09:13:33 +00:00
Aaron Smith 66b84079f9 [SymbolFilePDB] Rewrite ParseTypes method
Summary:
The types for the compiland's children are parsed when parsing types for a PDB compiland. Global types also need to be parsed but unfortunately PDBs do not have compiland information about each global type. So we parse them all on the first call to ParseTypes.

If a sc.function is provided then parse the types for that function. Otherwise parse the types for the overall sc.comp_unit.

The ParseTypes method can be very slow if a program has a long list of compile units containing needed modules. Debugging clang-cl with lldb will show the problem.



Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327473
2018-03-14 04:05:27 +00:00
Vedant Kumar 48ffd5cc6e [test] Replace some references to Apple-internal bugs
This removes around 10 references to Apple-internal radars. I've filed
fresh bugs on bugs.llvm.org as appropriate for open issues.

llvm-svn: 327463
2018-03-13 23:37:11 +00:00
Jim Ingham ca38766c9c Add a missing return in SBPlatform::IsConnected and test
for the behavior - using the fact that the Host platform
is always present & connected.

llvm-svn: 327448
2018-03-13 21:06:05 +00:00
Davide Italiano 5bcb9d7211 [DataFormatter] Remove dead code for the NSDictionary formatter.
I'm going to make changes in this area soon, so I figured I
could clean things a bit while I was around.

llvm-svn: 327445
2018-03-13 20:26:38 +00:00
Pavel Labath f9841cec26 include locale.h in IOHandler.cpp
This is needed for the setlocale() call, and it seems that it is not
transitively pulled in for some build configurations.

llvm-svn: 327413
2018-03-13 15:55:00 +00:00
Pavel Labath cd3cbd4c1f Fix clang-3.8 build
clang-3.8 complains that constructor for '...' must explicitly
initialize the const member. Newer clangs and gcc seem to be fine with
this, but explicitly initializing the member does not hurt.

llvm-svn: 327380
2018-03-13 09:46:10 +00:00
Pavel Labath 01961c4b1a Fix linux s390x build (pr36694)
llvm-svn: 327379
2018-03-13 09:46:00 +00:00
Davide Italiano d5bbaa6688 [ExpressionParser] Fix crash when evaluating invalid expresssions.
Typical example, illformed comparisons (operator== where LHS and
RHS are not compatible). If a symbol matched `operator==` in any
of the object files lldb inserted a generic function declaration
in the ASTContext on which Sema operates. Maintaining the AST
context invariants is fairly tricky and sometimes resulted in
crashes inside clang (or assertions hit).

The real reason why this feature exists in the first place is
that of allowing users to do something like:
(lldb) call printf("patatino")

even if the debug informations for printf() is not available.
Eventually, we might reconsider this feature in its
entirety, but for now we can't remove it as it would break
a bunch of users. Instead, try to limit it to non-C++ symbols,
where getting the invariants right is hopefully easier.

Now you can't do in lldb anymore
(lldb) call _Zsomethingsomething(1,2,3)

but that doesn't seem to be such a big loss.

<rdar://problem/35645893>

llvm-svn: 327356
2018-03-13 01:40:00 +00:00
Davide Italiano 65c3ccc65a [lit] `llvm-mc` is now a dependency to run tests.
llvm-svn: 327350
2018-03-12 23:42:37 +00:00
Jim Ingham 08581263dc Re-add change for https://reviews.llvm.org/D42582 with added directories.
llvm-svn: 327331
2018-03-12 21:17:04 +00:00
Adrian Prantl 1cc1c5f298 Introduce a setting to disable Spotlight while running the test suite
This is a more principled approach to disabling Spotlight .dSYM
lookups while running the testsuite, most importantly it also works
for the LIT-based tests, which I overlooked in my initial fix
(renaming the test build dir to lldb-tests.noindex).

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

llvm-svn: 327330
2018-03-12 20:52:36 +00:00
Vedant Kumar d1faa56f3d Revert "Improve prologue handling to support functions with multiple entry points."
This reverts commit r327318. It breaks the Xcode and CMake Darwin
builders:

clang: error: no such file or directory:
'.../source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp'
clang: error: no input files

More details are in https://reviews.llvm.org/D42582.

llvm-svn: 327327
2018-03-12 20:35:33 +00:00
Jim Ingham 467b50057a Improve prologue handling to support functions with multiple entry points.
https://reviews.llvm.org/D42582

Patch from Leandro Lupori.

llvm-svn: 327318
2018-03-12 19:21:59 +00:00
Mandeep Singh Grang 4ccea6230b [lldb] Unbreak lldb builds due to r327219
Summary:
r327219 adds wrappers to sort which shuffle the container before sorting.
This causes lldb bots to break as the call to sort is now ambiguous:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/20725/steps/ninja%20build%20local/logs/stdio

So we need use llvm::sort instead of sort to avoid ambiguity with std::sort.

Note: This patch is just to unbreak the bots. I plan to have subsequent patches which will convert all
calls to std::sort to llvm::sort.

Reviewers: RKSimon, k8stone, jingham, labath, zturner

Subscribers: andreadb, lldb-commits

Tags: #lldb

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

llvm-svn: 327224
2018-03-10 21:13:55 +00:00
Adrian Prantl 3cd29bcfe2 Rename clang.modules-cache-path to symbols.clang-modules-cache-path
I want to extend the properties on ModuleList to also contain other
more general settings and renaming the settings category to symbols
seems to be the least bad of choices.

llvm-svn: 327193
2018-03-10 01:11:25 +00:00
Aaron Smith dee18b82c2 [SymbolFilePDB] Keep searching until the file name is found for the pdb compiland
Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327162
2018-03-09 18:50:19 +00:00
Pavel Labath ef624fecdd Make TestCompletion work on windows
The test I added in r327110 is failing on windows because of "import
pexpect". However, this import is no longer necessary as these tests
don't use pexpect anymore.

In fact, it seems that all TestCompletion tests are passing on windows
after this, so I enable all of them.

llvm-svn: 327133
2018-03-09 14:32:16 +00:00
Pavel Labath 3ef4eebc27 [elf] Remove one copy of the section merging code
Summary:
Besides being superfluous, this double merging was actually wrong and
causing some sections to be added twice. The reason for that was that
the code assumes section IDs are unique in the section list, but this is
only true if all sections in the list come from the same object file.

Reviewers: fjricci, jankratochvil

Subscribers: emaste, lldb-commits, arichardson

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

llvm-svn: 327123
2018-03-09 12:30:09 +00:00
Pavel Labath 5f56fca4e1 Move option parsing out of the Args class
Summary:
The args class is used in plenty of places (a lot of them in the lower lldb
layers) for representing a list of arguments, and most of these places don't
care about option parsing. Moving the option parsing out of the class removes
the largest external dependency (there are a couple more, but these are in
static functions), and brings us closer to being able to move it to the
Utility module).

The new home for these functions is the Options class, which was already used
as an argument to the parse calls, so this just inverts the dependency between
the two.

The functions are themselves are mainly just copied -- the biggest functional
change I've made to them is to avoid modifying the input Args argument (getopt
likes to permute the argument vector), as it was weird to have another class
reorder the entries in Args class. So now the functions don't modify the input
arguments, and (for those where it makes sense) return a new Args vector
instead. I've also made the addition of a "fake arg0" (required for getopt
compatibility) an implementation detail rather than a part of interface.

While doing that I noticed that ParseForCompletion function was recording the
option indexes in the shuffled vector, but then the consumer was looking up the
entries in the unshuffled one. This manifested itself as us not being able to
complete "watchpoint set variable foo --" (because getopt would move "foo" to
the end). Surprisingly all other completions (e.g. "watchpoint set variable foo
--w") were not affected by this. However, I couldn't find a comprehensive test
for command argument completion, so I consolidated the existing tests and added
a bunch of new ones.

Reviewers: davide, jingham, zturner

Subscribers: lldb-commits

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

llvm-svn: 327110
2018-03-09 10:39:40 +00:00
Jason Molenda 250524f7ed I added CFLAGS etc to one part of the project file I should not have.
llvm-svn: 327097
2018-03-09 01:43:18 +00:00
Jason Molenda 4b7ea1f33c More cleanups of debugserver project file and the libpmenergy/libpmsample
stuff.  Activate it when an internal SDK is selected.  Update the name of
the LDFLAGS to match the rest of the settings.  Update the default arch for 
ios builds.

llvm-svn: 327095
2018-03-09 01:37:37 +00:00
Vedant Kumar e96dc75339 [test] Skip a test which sporadically fails in its dsym variant
There is a mailing list discussion re: r325927 about why this test fails
in the dsym variant. I've marked it skipped for now, until the issue is
resolved.

llvm-svn: 327089
2018-03-09 00:34:43 +00:00
Jason Molenda fc7321197e Remove unneeded per-arch sdk specifications from debugserver xcode project file.
llvm-svn: 327088
2018-03-09 00:32:56 +00:00
Jason Molenda c13a14ac26 Remove the explicit dependency on libpmenergy and libpmsample.
llvm-svn: 327087
2018-03-09 00:28:51 +00:00
Jason Molenda a608510b13 Fixed two more sdk inconsistencies with the pmenergy stuff.
llvm-svn: 327085
2018-03-09 00:23:29 +00:00
Jason Molenda 917f5b9944 Three little cleanups in the debugserver xcode project file.
1. Link against libpmenergy and pmsample unconditionally.  It is available on 
macOS 10.10 ("Yosemite") and newer.  We're already linking against libcompression
unconditionally which is only available on macOS 10.11 & newer.

2. Change a few "sdk=macosx.internal"'s to sdk=macosx.

3. Clean up a few places where libcompression was being enabled inconsistently.


Note: the -DLLDB_ENERGY define is only set when building against the macosx.internal
SDK; it includes a header file that is not public.  We link against the dylibs
unconditionally for simplicity.

llvm-svn: 327084
2018-03-09 00:17:22 +00:00
Vedant Kumar 45ae11cd80 [test] Skip a test when using an out-of-tree debugserver
The test "test_fp_special_purpose_register_read" in TestRegisters.py
fails on Darwin machines configured to use an out-of-tree debugserver.

The error message is: 'register read ftag' returns expected result, got
'ftag = 0x80'. This indicates that the debugserver in use is too old.

This commit introduces a decorator which can be used to skip tests which
rely on having a just-built debugserver. This resolves the issue:

$ ./bin/llvm-dotest -p TestRegisters.py -v
  1 out of 617 test suites processed - TestRegisters.py
  Test Methods:          7
  Success:               6
  Skip:                  1
...

llvm-svn: 327052
2018-03-08 19:46:39 +00:00
Pavel Labath b312b13960 Fix std unique pointer pretty-printer for new stl versions
Summary: The unique pointer layout was changed in libstdc++ 6.0.23.

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: luporl, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D44015
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>.

llvm-svn: 327017
2018-03-08 16:03:09 +00:00
Pavel Labath 6bf2a8ea70 Install lldb's SB headers (pr36630)
These were removed in r309021 in what looks like an accidentally
committed change. This brings them back.

I also rename the header component to lldb-headers (instead of
lldb_headers) to match the llvm style and add a special
install-lldb-headers target, which installs just the headers.

llvm-svn: 327016
2018-03-08 15:52:46 +00:00
Pavel Labath b9923f049e [LLDB][PPC64] Fix single step and LldbGdbServer tests
Summary:
On PPC64, the tested functions were being entered through their local entry point, while the tests expected the program to stop at the function start address, that, for PPC64, corresponds to the global entry point.

To fix the issue, the test program was modified to call the functions to be tested through function pointers, which, on PPC64, force the calls through the global entry point, while not affecting the test on other platforms.

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43768
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 327013
2018-03-08 15:41:13 +00:00
Davide Italiano c0311fe19b [lldbtestsuite] llvm-objcopy is now required to run the lit tests.
There's now a test using llvm-objcopy in lit/.
This doesn't fail on the bot(s) because `llvm-objcopy` is probably
already available there, but if you get a fresh checkout and run
`ninja check-lldb` you'll observe the failure as it's not tracking
the dependency correctly. This fixes the problem on my machine,
and probably everywhere else.

llvm-svn: 326919
2018-03-07 18:06:12 +00:00
Aaron Smith 2a989f36ca [SymbolFilePDB] Add missing Char16 and Char32 types in a few places
Reviewers: zturner, rnk, lldb-commits

Subscribers: clayborg, llvm-commits

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

llvm-svn: 326875
2018-03-07 05:43:05 +00:00
Aaron Smith f76fe6825c [SymbolFilePDB] Minor cleanup
Summary:
 - Remove unused code

- Adding `break` statement conditionally

- Ignore empty strings in FindTypeByName

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 326870
2018-03-07 03:16:50 +00:00
Aaron Smith a0db2eb096 [SymbolFilePDB] Add support for CVR pointer type qualifier
Summary:
- Complete element type of PDBSymbolTypeArray.

- Add a test to check types of multi-dimensional array and pointers with CVR.

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 326859
2018-03-07 00:39:25 +00:00
Aaron Smith 7abdf2d24f [SymbolFilePDB] Get line number for PDBSymbolTypeEnum
Reviewers: zturner, lldb-commits, rnk

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 326858
2018-03-07 00:35:27 +00:00
Jason Molenda 702895989a the thread id is easier to read in base16.
llvm-svn: 326849
2018-03-06 23:33:02 +00:00
Adrian Prantl bff272faa9 Add test for lldb-mi interpreter
Test that "lldb-mi --interpreter" can interpret "target list" CLI command.

Patch by Alex Polyakov!

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

llvm-svn: 326847
2018-03-06 23:25:04 +00:00
Pavel Labath 96979ceecb Rewrite TestTargetSymbolsBuildidCase to be more focused
Summary:
The test was failing in remote debugging scenario with windows as a host
as cmd.exe is not able to parse the complicated shell commands in the
Makefile.

The test seemed like a perfect candidate for a more focused testing
approach, so I have rewritten in on top of lldb-test's module-sections
functionality. The slight gotcha there was that the
Module::GetSectionList does not include the sections from the symbol
file until someone manually calls Module::GetSymbolVendor. Normally,
this is not an issue, because someone will have initialized the symbol
vendor by the time anyone starts looking at the sections. However, when
all one this is dump the section list, we run into this problem.

I've tried making this behavior more automatic, but it turns out it's
not that easy, so for now, I just manually initialize the Symbol Vendor
before dumping out the sections in lldb-test.

Reviewers: jankratochvil

Subscribers: lldb-commits

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

llvm-svn: 326805
2018-03-06 15:56:20 +00:00
Pavel Labath b417eeaeb5 ObjectFileMachO: split CreateSections mega-function into more manageable chunks
Summary:
In an effort to understand the function's operation, I've split it into logical
pieces. Parsing of a single segment is moved to a separate function (and the
parsing state that is carried from one segment to another is explicitly
captured in the SegmentParsingContext object). I've also extracted some pieces
of code which were already standalone (validation of the segment load command,
determining the section type, determining segment permissions) into
separate functions.

Parsing of a single section within the segment should probably also be a
separate function, but I've left that for a separate patch.

This patch is intended to be NFC.

Reviewers: clayborg, davide

Subscribers: lldb-commits

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

llvm-svn: 326791
2018-03-06 13:53:26 +00:00
Pavel Labath 408b0f53b4 HostThreadPosix::Cancel: remove android-specific implementation
Noone is calling this function on android, so we can just use the
generic llvm_unreachable "implementation".

llvm-svn: 326777
2018-03-06 12:46:05 +00:00
Pavel Labath 5e5dd70674 [LLDB][PPC64] Fixed issues with expedited registers
Summary:
- reg_nums were missing the end marker entry
- marked FP test to be skipped for ppc64

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: alexandreyy, lbianc, nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D43767
Patch by Leandro Lupori <leandro.lupori@gmail.com>

llvm-svn: 326775
2018-03-06 11:54:41 +00:00
Jason Molenda a1bd9508e0 Upstreaming avx512 register support in debugserver. These changes
were originally written by Chris Bieneman, they've undergone a
number of changes since then.

Also including the debugserver bridgeos support, another arm
environment that runs Darwin akin to ios.  These codepaths are
activated when running in a bridgeos environment which we're not
set up to test today.

There's additional (small) lldb changes to handle bridgeos binaries
that still need to be merged up.

Tested on a darwin system with avx512 hardware and without.

<rdar://problem/36424951> 

llvm-svn: 326756
2018-03-06 00:27:41 +00:00
Adrian Prantl 39e54cb7b7 LLDBStandalone.cmake: set path to llvm-lit inside of llvm build dir
llvm-svn: 326754
2018-03-05 23:57:46 +00:00
Adrian Prantl 39c71a7bcb Fix the install location of LLDBWrapPython.cpp when building
LLDB.framework to point to the build directory where it is expected by
the top-level CMakeLists.txt.

This should be a no-op in any other configurations.

rdar://problem/38005302

llvm-svn: 326743
2018-03-05 21:08:42 +00:00
Vedant Kumar 2ddfe5c9c3 [test] Skip pexpect-based lldb-mi tests on Darwin
These tests fail with a relatively frequently on Darwin machines with
errors such as:

  File ".../lldb/third_party/Python/module/pexpect-2.4/pexpect.py", line 1444, in expect_loop
    raise EOF(str(e) + '\n' + str(self))
EOF: End Of File (EOF) in read_nonblocking(). Empty string style platform.

The unpredictable failures make these tests noisy.

rdar://37046976

llvm-svn: 326739
2018-03-05 20:16:52 +00:00
Raphael Isemann 1fe3ee18b4 Including <functional> for std::bind
Differential Revision: https://reviews.llvm.org/D44099

llvm-svn: 326727
2018-03-05 17:54:23 +00:00
Jonas Devlieghere a52cb80db6 [test] Add dotest wrapper
This adds a wrapper around dotest, similar to llvm-lit in llvm. The
wrapper is created in the binary directory, next to LLDB and allows you
to invoke dotest without having to pass any of the configuration
arguments yourself. I think this could also be useful for re-running a
particular test case when it fails, as an alternative to "Command
Invoked".

The motivation for this is that I'd like to replace the driver part of
dotest with lit. As a first step, I'd like to have lit invoke dotest,
which would just run the complete test suite, completely identical to
what the CMake target does today. Once this is in place, we can have lit
run dotest for the different test directories, and ultimately once per
python file. Along the way we can strip out driver functionality from
dotest where appropriate.

https://reviews.llvm.org/D44002

llvm-svn: 326687
2018-03-05 10:03:44 +00:00
Pavel Labath cdf7a9f16d llgs-tests: use the auto-parsing form of SendMessage for sending the continue packets
llvm-svn: 326671
2018-03-04 02:12:18 +00:00
Pavel Labath f90054dd90 ObjectFileMachO: use early return to remove one nesting level from CreateSections()
NFCI

llvm-svn: 326667
2018-03-03 22:07:47 +00:00
Adrian Prantl f318ddc93e Mark ObjC testcase as skipUnlessDarwin and fix a typo in test function.
llvm-svn: 326640
2018-03-02 23:57:09 +00:00
Adrian Prantl beb6025361 Don't compile testcase with clang modules enabled.
It isn't actually necessary for what we are testing here and should
fix the test on the Linux bots.

llvm-svn: 326634
2018-03-02 23:15:04 +00:00
Adrian Prantl 235354be57 Make the clang module cache setting available without a target
It turns out that setting the clang module cache after LLDB has a
Target can be too late. In particular, the Swift language plugin needs
to know the setting without having access to a Target. This patch
moves the setting into the *LLDB* module cache, where it is a global
setting that is available before any Target is created and more
importantly, is shared between all Targets.

rdar://problem/37944432

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

llvm-svn: 326628
2018-03-02 22:42:44 +00:00
Jonas Devlieghere 3a9d431386 [testsuite] Remove workaround for categories and inline tests.
Adding categories to inline tests does not work because the attribute
is set at the function level. For methods, this means it applies to all
instances of that particular class. While this is what we want in most
cases, it's not for inline tests, where different instances correspond
to different tests.

With the workaround in place, assigning a category to one test resulted
in the category applied to *all* inline tests.

This patch removes the workaround and throws an exception with an
informative error message, to prevent this from happening in the future.

llvm-svn: 326552
2018-03-02 10:38:11 +00:00
Pavel Labath 4c693a894f Speed up TestWatchpointMultipleThreads
Summary:
The inferior was sleeping before doing any interesting work. I remove that
to make the test faster.

While looking at the purpose of the test (to check that watchpoints are
propagated to all existing threads - r140757) I noticed that the test has
diverged from the original intention and now it creates the threads *after* the
watchpoint is set (this probably happened during the std::thread refactor).
After some discussion, we decided both scenarios make sense, so I modify the
test to test both.

The watchpoint propagation functionality is not really debug info depenent, so
I also stop replication of this test. This brings the test's time from ~108s
down to 4s.

Reviewers: davide, jingham

Subscribers: aprantl, lldb-commits

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

llvm-svn: 326514
2018-03-02 00:17:05 +00:00
Pavel Labath e1463ef4d3 Make TestDynamicValueSameBase gcc-compatible
gcc will say that the type of "this" is "T * const", clang "T *".
Compare the unqualified type names to erase the difference between the
two, as the constness is not a part of this test.

FWIW, I think that the gcc behavior makes more sense here.

llvm-svn: 326449
2018-03-01 16:56:28 +00:00
Tatyana Krasnukha 0a6b8b6630 Make Finalize tolerant of empty register sets.
llvm-svn: 326437
2018-03-01 14:36:42 +00:00
Vedant Kumar a32e84133a [test] Restore cleanup behavior in TestQuoting.py
Before the change to compile tests out-of-tree, the cleanup classmethod
in TestQuoting.py would remove a temp file. After the change it threw an
exception due to a malformed call to getBuildArtifact().

Bring back the old behavior.

llvm-svn: 326414
2018-03-01 03:03:38 +00:00
Jim Ingham 06292869cd We were getting the wrong dynamic type if there were two classes with the same basename.
There's a bug in FindTypes, it ignores the exact flag if you pass a name that doesn't begin with
:: and pass eTypeClassAny for the type.

In this case we always know that the name we get from the vtable name is absolute so we can
work around the bug by prepending the "::".  This doesn't fix the FindTypes bug.

<rdar://problem/38010986>

llvm-svn: 326412
2018-03-01 02:44:34 +00:00
Jason Molenda f50299fb87 Add another entitlement that we need for debugserver.
<rdar://problem/29855293> 

llvm-svn: 326399
2018-03-01 01:04:07 +00:00
Jim Ingham 1584f9eddd Fix up the gtest targets for changes in the UnwindAssembly tests.
llvm-svn: 326378
2018-02-28 22:41:11 +00:00
Han Ming Ong 4142369204 Add ability to collect memory limit.
Reviewer: Jason Molenda

<rdar://problem/37686560>

llvm-svn: 326374
2018-02-28 22:18:45 +00:00
Pavel Labath 2b2d728c7b Adapt some tests to work with PPC64le architecture
Summary: Merge branch 'master' into adaptPPC64tests

Reviewers: clayborg, alexandreyy, labath

Reviewed By: clayborg, alexandreyy

Subscribers: luporl, lbianc, alexandreyy, lldb-commits

Differential Revision: https://reviews.llvm.org/D42917
Patch by Ana Julia Caetano <ana.caetano@eldorado.org.br>.

llvm-svn: 326369
2018-02-28 20:57:26 +00:00
Pavel Labath ec03d7e3ba Revert "[lldb] Use vFlash commands when writing to target's flash memory regions"
This reverts commit r326261 as it introduces inconsistencies in the
handling of load addresses for ObjectFileELF -- some parts of the class
use physical addresses, and some use virtual. This has manifested itself
as us not being able to set the load address of the vdso "module" on
android.

llvm-svn: 326367
2018-02-28 20:42:29 +00:00
Jason Molenda 27fe9364f8 Add EmulateInstructionPPC64.cpp to xcode project file.
llvm-svn: 326302
2018-02-28 04:11:37 +00:00
Pavel Labath 9bdd03f7da Fix lldbinline tests for remote targets
r326140 exposed the fact that we are not actually running inline tests on
remote targets. The tests fail to launch the inferior in the first place
because they passed an invalid working directory to the launch function.

This should fix that.

llvm-svn: 326264
2018-02-27 22:45:49 +00:00
Pavel Labath 029fb69372 [lldb] Use vFlash commands when writing to target's flash memory regions
Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region.  A bare metal target may have this kind of setup.

- Update ObjectFileELF to set load addresses using physical addresses.  A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region

Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: arichardson, emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw <llvm@owenpshaw.net>

llvm-svn: 326261
2018-02-27 22:14:33 +00:00
Pavel Labath a535a7a2a0 [LLDB] Initial version of PPC64 InstEmulation
Summary: Supports common prologue/epilogue instructions.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: davide, anajuliapc, alexandreyy, lbianc, nemanjai, mgorny, kbarton

Differential Revision: https://reviews.llvm.org/D43345
Author: Leandro Lupori <leandro.lupori@gmail.com>

llvm-svn: 326224
2018-02-27 18:42:46 +00:00
Pavel Labath b2f9bb9e54 Move TestGdbRemoteExitCode next to the other llgs tests
This test contained a copy of the inferior used by most of llgs test.
This was done to enable better paralelization, but now it's irrelevant.

llvm-svn: 326218
2018-02-27 18:07:53 +00:00
Han Ming Ong 28efd27fe2 Removed accidentally committed code from previous commit.
llvm-svn: 326214
2018-02-27 18:02:15 +00:00
Han Ming Ong 83d178de9f Got rid of weak imports of libpenergy and libpsample because we are already requiring a modern macOS (at least 10.11)
Reviewer: Jason Molenda
llvm-svn: 326213
2018-02-27 17:53:38 +00:00
Ed Maste 883b6ee70a Mark test_*int*_t_dwarf as failing on FreeBSD
Further investigation required; tests will be enabled on the buildbot
worker soon. Marking failing tests for now in order to start with a
green buildbot while investigation takes place.

This is a recommit of r326134, with the required import added.

llvm.org/pr36527

llvm-svn: 326166
2018-02-27 02:54:17 +00:00
Pavel Labath de872a697a Move "concurrent events" tests back into one folder
These tests all test very similar things, and use the same inferior.
They were only placed in separate folders to achieve better
paralelization. Now that we paralelize at a file level, this is no
longer relevant, and we can put them together again.

llvm-svn: 326159
2018-02-27 02:01:30 +00:00
Adrian Prantl 87a000dae3 Add a sanity check for inline testcases.
When writing an inline test, there is no way to make sure that any of
the inline commands are actually executed, so this patch adds a sanity
check that at least one breakpoint was hit. This avoids a test with no
breakpoints being hit passing.

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

llvm-svn: 326140
2018-02-26 22:40:20 +00:00
Ed Maste 6ebb0792b0 Revert r326134 due to broken buildbot
llvm-svn: 326139
2018-02-26 22:36:41 +00:00
Ed Maste 24f9794d78 Mark test_*int*_t_dwarf as failing on FreeBSD
Further investigation required; tests will be enabled on the buildbot
worker soon. Marking failing tests for now in order to start with a
green buildbot while investigation takes place.

llvm.org/pr36527

llvm-svn: 326134
2018-02-26 22:12:24 +00:00
Adrian McCarthy 00cc735a6f Partial fix for TestConflictingSymbol.py on Windows
Without this fix, the test ERRORs because the link of the inferior fails. This
patch adds the LLDB_TEST_API macro where needed and uses the new -2 magic
value for num_expected_locations to account for lazy-loading of module symbols
on Windows.

With this fix, the test itself still fails:  conflicting_symbol isn't in the
debug info nor the export table, and Windows binaries don't have an equivalent
of the ELF .symtab.  We need to understand why the test works to keep the
symbol out of the debug info.  In the mean time, having the test fail at this
point is a better indication of the remaining problem than a build error.

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

llvm-svn: 326130
2018-02-26 21:22:39 +00:00
Pavel Labath 7c94582f90 Add "lldb-test breakpoint" command and convert the case-sensitivity test to use it
Summary:
The command takes two input arguments: a module to use as a debug target
and a file containing a list of commands. The command will execute each
of the breakpoint commands in the file and dump the breakpoint state
after each one.

The commands are expected to be breakpoint set/remove/etc. commands, but
I explicitly allow any lldb command here, so you can do things like
change setting which impact breakpoint resolution, etc. There is also a
"-persistent" flag, which causes lldb-test to *not* automatically clear
the breakpoint list after each command. Right now I don't use it, but
the idea behind it was that it could be used to test more complex
combinations of breakpoint commands (set+modify, set+disable, etc.).

Right now the command prints out only the basic breakpoint state, but
more information can be easily added there.  To enable easy matching of
the "at least one breakpoint location found" state, the command
explicitly prints out the string "At least one breakpoint location.".

To enable testing of breakpoints set with an absolute paths, I add the
ability to perform rudimentary substitutions on the commands: right now
the string %p is replaced by the directory which contains the command
file (so, under normal circumstances, this will perform the same
substitution as lit would do for %p).

I use this command to rewrite the TestBreakpointCaseSensitivity test --
the test was checking about a dozen breakpoint commands, but it was
launching a new process for each one, so it took about 90 seconds to
run. The new test takes about 0.3 seconds for me, which is approximately
a 300x speedup.

Reviewers: davide, zturner, jingham

Subscribers: luporl, lldb-commits

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

llvm-svn: 326112
2018-02-26 18:50:16 +00:00
Adrian McCarthy 69d7434745 Fix tabs/spaces indentation problem in TestUnicodeSymbols.py
Differential Revision: https://reviews.llvm.org/D43705

llvm-svn: 326095
2018-02-26 15:53:31 +00:00
Jonas Devlieghere 560ce2c70f Re-land: "[Support] Replace HashString with djbHash."
This patch removes the HashString function from StringExtraces and
replaces its uses with calls to djbHash from DJB.h.

This change is *almost* NFC. While the algorithm is identical, the
djbHash implementation in StringExtras used 0 as its default seed while
the implementation in DJB uses 5381. The latter has been shown to result
in less collisions and improved avalanching and is used by the DWARF
accelerator tables.

Because some test were implicitly relying on the hash order, I've
reverted to using zero as a seed for the following two files:

  lld/include/lld/Core/SymbolTable.h
  llvm/lib/Support/StringMap.cpp

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

llvm-svn: 326091
2018-02-26 15:16:42 +00:00
Jonas Devlieghere 370bf3ef49 Revert "[Support] Replace HashString with djbHash."
It looks like some of our tests depend on the ordering of hashed values.
I'm reverting my changes while I try to reproduce and fix this locally.

Failing builds:

  lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/18388
  lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/6743
  lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/15607

llvm-svn: 326082
2018-02-26 12:05:18 +00:00
Jonas Devlieghere b9ad175935 [Support] Replace HashString with djbHash.
This removes the HashString function from StringExtraces and replaces
its uses with calls to djbHash from DJB.h

This is *almost* NFC. While the algorithm is identical, the djbHash
implementation in StringExtras used 0 as its seed while the
implementation in DJB uses 5381. The latter has been shown to result in
less collisions and improved avalanching.

https://reviews.llvm.org/D43615
(cherry picked from commit 77f7f965bc9499a9ae768a296ca5a1f7347d1d2c)

llvm-svn: 326081
2018-02-26 11:30:13 +00:00
Vedant Kumar d4e2dabbbb Delete dead code in MachVMMemory.cpp, NFC
This addresses a compiler warning.

llvm-svn: 326002
2018-02-24 00:17:05 +00:00
Vedant Kumar f6769ae176 [unittests] Disable lldb-server tests if an external debug server is in use
The lldb-server unit tests don't test the right thing when the debug
server in use is copied from somewhere else. This can lead to spurious
test failures.

Disable these unit tests when an external debug server is in use.

Fixes llvm.org/PR36494.

llvm-svn: 326001
2018-02-24 00:17:04 +00:00
Vedant Kumar c79333413a Fix a compiler warning in ModuleCacheTest.cpp, NFC
llvm-svn: 325974
2018-02-23 23:18:27 +00:00
Vedant Kumar ebc6bc8188 [Utility] Simplify and generalize the CleanUp helper, NFC
Removing the template arguments and most of the mutating methods from
CleanUp makes it easier to understand and reuse.

In its present state, CleanUp would be too cumbersome to adapt to cases
where multiple objects need to be released. Take for example this change
in swift-lldb:

  https://github.com/apple/swift-lldb/pull/334/files#diff-6f474df750f75c8ba675f2a8408a5629R219

This change is simple to express with the new CleanUp, but not so simple
with the old version.

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

llvm-svn: 325964
2018-02-23 22:08:38 +00:00
Jim Ingham e8b072d9e4 Fix breakpoint thread name conditionals after breakpoint options refactor.
PR36435

llvm-svn: 325958
2018-02-23 21:10:42 +00:00
Pavel Labath b39fca958d Replace HashStringUsingDJB with llvm::djbHash
Summary:
The llvm function is equivalent to this one. Where possible I tried to
replace const char* with llvm::StringRef to avoid extra strlen
computations. In most places, I was able to track the c string back to
the ConstString it was created from.

I also create a test that verifies we are able to lookup names with
unicode characters, as a bug in the llvm compiler (it accidentally used
a different hash function) meant this was not working until recently.

This also removes the unused ExportTable class.

Reviewers: aprantl, davide

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 325927
2018-02-23 17:49:26 +00:00
Frederic Riss 0fda3a8721 Fix TestMultithreaded when there's no debugserver specified
r325858 was bogus and would error out with a KeyError when --server
was not passed to dotest.py.

llvm-svn: 325862
2018-02-23 05:29:27 +00:00
Frederic Riss 0fd6a530a0 Fix TestUbsanBasic
Summary:
Potentially due to the recent testuite refactorings, this test now reports
a full absolute path but expect just the filename. For some reason this
test is skipped on GreenDragon so we've never seen the issue.

Reviewers: vsk

Subscribers: kubamracek, lldb-commits

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

llvm-svn: 325859
2018-02-23 05:03:10 +00:00
Frederic Riss 8492f2081d Fix TestMultithreaded when specifying an alternative debugserver.
Summary:
This test launches a helper that uses the debugserver. The environment
variable sepcifying the debug server wasn't passed to this helper, thus
it was using the default one.

Subscribers: lldb-commits

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

llvm-svn: 325858
2018-02-23 05:03:09 +00:00
Ed Maste 7129ae39bd remove FreeBSD xfail from lit TestCallStdStringFunction
This test is consistently reporting unexpected pass for me, and the
expectedFailure decorator was removed from the legacy test in r310626.
Apply the same change to the lit version of this test.

Will investigate further if this fails once the new buildbot is running
tests.

llvm.org/pr17807

llvm-svn: 325856
2018-02-23 02:50:07 +00:00
Davide Italiano f2ff789e99 [testsuite] Throw away test/debug_info/apple_types.
This test was only testing that clang produced the correct informations
for __apple accelerated tables. So, it's a clang test. Also, it
doesn't require any debugger intervention, the object file can
be analyzed statically with a dumper. Also, the input program
was highly verbose (unnecessarily).

r325850 commits a clang test instead, so it's time to retire this.

llvm-svn: 325851
2018-02-23 01:33:20 +00:00
Vedant Kumar 1c3b05ad79 Delete some unused #includes of CleanUp.h, NFC
llvm-svn: 325847
2018-02-23 00:29:40 +00:00
Vedant Kumar 6d2b435d80 [ObjC] Fix the NSConcreteData formatter and test it
The length field of an NSConcreteData lives one word past the start of
the object, not two.

llvm-svn: 325841
2018-02-22 23:48:21 +00:00
Adrian McCarthy 7de450033b Fix TestMoveNearest on Windows
The header file for the DLL tried to declare inline functions and a local
function as dllexport which broke the compile and link.  Removing the bad
declarations solves the problem, and the test passes on Windows now.

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

llvm-svn: 325836
2018-02-22 22:47:47 +00:00
Adrian McCarthy 3db5d7e124 Fix TestSBData.py on Windows
Ensure that the test data is an array of bytes rather than a string that gets
encoded differently between Python 2 and Python 3.

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

llvm-svn: 325835
2018-02-22 22:47:14 +00:00
Pavel Labath a3952ea70b [LLDB][PPC64] Fixed next blocked forever at same line
Summary:
The PC corresponding to the breakpoint was being calculated wrongly,
which was causing LLDB to never go past the first breakpoint, when
there was a second one adjacent to it.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: anajuliapc, alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43344
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 325728
2018-02-21 21:56:18 +00:00
Davide Italiano fb92f4e4c4 [testsuite] Run lit tests as part of `check-lldb`.
Also, fix a missing dependency, as lit requires llvm-config
to run. This is becoming more and more important as we
write more FileCheck style tests.

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

llvm-svn: 325719
2018-02-21 21:10:44 +00:00
Davide Italiano feb4b896b6 [testsuite/decorators] Get rid of some `expectFlakey` variants.
These seem to be pretty much dead.

llvm-svn: 325708
2018-02-21 19:18:49 +00:00
Adrian McCarthy 25727a458c Fix TestBreakpointInGlobalConstructor for Windows
Summary:
This test was failing on Windows because it expected the breakpoint in the
dynamic library to be resolved before the process is launched.  Since the DLL
isn't loaded until the process is launched this didn't work.

The fix creates a special value (-2) for num_expected_locations that ignores
the actual number of breakpoint locations found.

Reviewers: jasonmolenda

Subscribers: sanjoy, lldb-commits

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

llvm-svn: 325704
2018-02-21 18:08:23 +00:00
Pavel Labath 44499631a8 Fix remote tests broken by r325690
The patch added an extra argument to the append_to_process_working_directory
function. I have somehow missed updating this test, and it did not show up
because the code was only run in remote mode.

llvm-svn: 325702
2018-02-21 17:55:22 +00:00
Pavel Labath 9391d98e7b llgs-tests: Fix r325511 for debugserver
Debugserver sends the thread-pcs field with leading zeroes omitted. Teach
parseRegisterValue to pad these as necessary.

llvm-svn: 325701
2018-02-21 17:38:38 +00:00
Pavel Labath f3a9ab07aa Fix a couple of more tests to not create files in the source tree
Summary:
These were not being flaky, but they're still making the tree dirty.

These tests were using lldbutil.append_to_process_working_directory to
derive the file path so I fix them by modifying the function to return
the build directory for local tests.

Technically, now the path returned by this function does not point to
the process working directory for local tests, but I think it makes
sense to keep the function name, as I think we should move towards
launching the process in the build directory (and I intend to change
this for the handful of inferiors that actually care about their PWD,
for example because they need to create files there).

Reviewers: davide, aprantl

Subscribers: lldb-commits

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

llvm-svn: 325690
2018-02-21 15:33:53 +00:00
Frederic Riss 9c4db3bc2b Fix TestAppleTypesIsProduced after r324226
This test was accessing self.debug_info, which doesn't exist anymore. For
some reason the macOS bots are skipping this test because they think the
compiler is not clang. We'll look into this separately.

llvm-svn: 325666
2018-02-21 06:20:03 +00:00
Aaron Smith 07482d32e7 [lit] Update how clang and other binaries are found in per-configuration directories
Summary:
This is modeled after the clang and llvm lit tests.

Several properties have CMAKE_CFG_INTDIR as part of the path - this works correctly when the cmake generator only supports one configuration which is known at configuration time, but it does not work correctly when the cmake generator supports multiple configurations (for example, VS). 

For VS, CMAKE_CFG_INTDIR ends up set as $Configuration and then it is never updated correctly. Instead, the lit configuration can use a property that can be overwritten at run time. AddLLVM does that for several properties (such as LLVM_TOOLS_DIR). 

This change is also removing properties from the lit/CMakeLists.txt that are actually set during the call to configure_lit_site_cfg

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits, labath, stella.stamenova, mgorny, hintonda

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

llvm-svn: 325652
2018-02-21 00:05:51 +00:00
Pavel Labath a9f8b0d1a9 Avoid dirtying the source tree in breakpoint command tests
Summary:
The paralelization patch exposed a bunch of cases where we were still
touching the source tree (as these tests were now stepping on each
others toes and being flaky).

This patch removes such issues from breakpoint command tests. Since the
only reason they were creating files was to indirectly test whether the
breakpoint commands got executed (and plumbing the full build tree path
to all places that needed it would be messy) I decided to modify the
tests to check for a different side effect instead: modification of a
global variable. This also makes the code simpler as checking the value
of the global variable is easier, and there is nothing to clean up.

As the tests aren't really doing anything debug-info related, I took the
opportunity to also mark them as NO_DEBUG_INFO_TESTCASEs.

Reviewers: jingham, aprantl

Subscribers: lldb-commits

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

llvm-svn: 325570
2018-02-20 10:24:37 +00:00
Jonas Devlieghere 65d2d5bad4 Handle typeof() expressions
Before this patch, LLDB was not able to evaluate expressions that
resulted in a value with a typeof- or decltype-type. This patch fixes
that.

Before:
  (lldb) p int i; __typeof__(i) j = 1; j
  (typeof (i)) $0 =

After:
  (lldb) p int i; __typeof__(i) j = 1; j
  (typeof (i)) $0 = 1

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

rdar://37461520

llvm-svn: 325568
2018-02-20 10:15:08 +00:00
Pavel Labath 37a35d3395 Two more dosep-paralellization fallout fixes
The first issue is about the flaky test rerun logic. This was grouping
tests by subdir and passing them into walk_and_invoke in the incorrect
form. This part can be just deleted as its not needed anymore.

The second problem (which I noticed while investigating the first one)
was that the "-p" switch was not working in multiprocessing mode. This
happened because we were returning None from process_file instead of a
tuple full of empty values for tests that did not match the -p regex.

Both of these would be caught earlier if python was a more strongly
typed language. :/

llvm-svn: 325519
2018-02-19 17:23:13 +00:00
Pavel Labath 9a9556f07d Fix TestStopReplyContainsThreadPcs on 32-bit x86 (pr36013)
Summary:
The issue was that we were parsing the registers into 64-bit integers
and the calling swapByteOrder without regard for the actual size of the
register. This switches the test to use the RegisterValue class which
tracks the register size, and knows how to initialize itself from a
piece of memory (so we don't need to swap byte order ourselves).

Reviewers: eugene, davide

Subscribers: lldb-commits

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

llvm-svn: 325511
2018-02-19 15:42:48 +00:00
Pavel Labath f1389e9201 Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
Summary:
This adds a SBDebugger::GetBuildConfiguration static function, which
returns a SBStructuredData describing the the build parameters of
liblldb. Right now, it just contains one entry: whether we were built
with XML support.

I use the new functionality to skip a test which requires XML support,
but concievably the new function could be useful to other liblldb
clients as well (making sure the library supports the feature they are
about to use).

Reviewers: zturner, jingham, clayborg, davide

Subscribers: lldb-commits

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

llvm-svn: 325504
2018-02-19 15:06:28 +00:00
Pavel Labath d6f903f05c Make gdb-client tests generate binaries in the build tree
These were missed in the great refactor because they were added
concurrently with it. Since we started running tests in a more parallel
fashion they started to be flaky. This should fix it.

Now that we are no longer polluting the source tree, I also delete the
bit of custom cleanup code specific to these tests.

llvm-svn: 325495
2018-02-19 13:53:12 +00:00
Don Hinton b308571916 Add DEBUGSERVER_PATH to the cache so it'll be available for tests.
This fixed a problem caused by r325442.

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

llvm-svn: 325452
2018-02-17 23:06:15 +00:00
Don Hinton d8a6b90e83 [cmake] Fix LLDB_CODESIGN_IDENTITY logic.
Summary:
Consolidate LLDB_CODESIGN_IDENTITY logic in one place and use
SKIP_DEBUGSERVER, which can be set independently, to control
codesigning targets.

Currently, running cmake the first time in a clean directory, without
passing -DLLDB_CODESIGN_IDENTITY='', fails.  However, subsequent runs
succeed.  That's because LLDB_CODESIGN_IDENTITY gets added to the
CACHE after the initial test.  To fix that, the default value must be
set before it's tested.

Here's the error produced on the first run:

CMake Error at tools/lldb/tools/debugserver/source/CMakeLists.txt:215 (add_custom_command):
  No TARGET 'debugserver' has been created in this directory.

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

llvm-svn: 325442
2018-02-17 19:17:21 +00:00
Pavel Labath 1c7211d754 Shorten socket names in TestPlatformProcessConnect
The test was generating long unix socket names, and the addition of a
new folder in the previous patch pushed it over the limit (although
linux has a fairly generous limit for path names, this does not apply to
unix sockets).

Modify the test to use a shorter name instead.

llvm-svn: 325340
2018-02-16 12:57:35 +00:00
Jonas Devlieghere 1a584e898b Re-enable lang/objc/modules/TestObjCModules
The reason this test was disabled is no longer relevant. However, it
didn't turn into an unexpected success because of a syntax error in the
test itself. This commit fixes that and re-enables the test.

llvm-svn: 325339
2018-02-16 12:33:10 +00:00
Pavel Labath e627d1653e Fix paralelization of remote tests
Since we now can run multiple tests from the same directory at once, we
need to include the test name in the remote test directory instead.

I'm not sure if the test_number in the remote path is necessary anymore
(or even if it was ever necessary), but I choose to leave it in for now.

llvm-svn: 325334
2018-02-16 11:39:38 +00:00
Pavel Labath 686b27b55a [lldb][PPC64] Fixed vector and struct return value
Summary:
The PowerPC64 ABI plugin was modified to:

- properly handle vector type return values
- implement support for struct/class return values

A refactoring in the code that handles return values was also performed, to make it possible to handle structs without repeating (when possible) code that handles its fields.

There was also an issue with CreateInstance(), that only created an instance in the first time it was called and then cached it in a static var. When restarting a process under LLDB's control, the ABI's process weak pointer would become null, and using it would result in a segmentation fault. This issue became more evident after the latest changes to PPC64 plugin, that now uses the process pointer to get the target byte order, making LLDB to seg fault when restarting a program. This was fixed by making CreateInstance() to always create a new ABI instance.

All of LLDB's ReturnValue tests are passing for PPC64le now. It should work for PPC64be too, although this was not tested.

Reviewers: labath, clayborg

Reviewed By: labath

Subscribers: lbianc, anajuliapc, llvm-commits, alexandreyy, nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D42468
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 325324
2018-02-16 09:29:41 +00:00
Pavel Labath 42a1619262 [dosep] Run tests in a more parallel fashion
Summary:
Due to in-tree builds, we were parallelizing the tests at the directory
level. Now that the tests are built out-of-tree, we can remove this
limitation and paralelize at file level instead.

This decreases test suite time by about 10% for me, which is not
world-shattering, but it makes the code slightly simpler and will also
allow us to merge tests which were artificially spread over multiple
folders (TestConcurrentEvents...) to work-around this limitation.

To make this work, I've also needed to include the test file name in the
build directory name, as just the test method name is not unique enough
(plenty of tests have a test method called "test" or similar).

While doing this, I've found a couple of tests that are taking waaay longer then
they ought to (TestBreakpointCaseSensitivity -- 90 seconds), which I plan to
look into in the future.

Reviewers: aprantl

Subscribers: lldb-commits

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

llvm-svn: 325322
2018-02-16 09:21:11 +00:00
Pavel Labath 23c0cce597 @skipIfRemote TestTargetXMLArch
The test does not actually connect to any remote targets.

llvm-svn: 325250
2018-02-15 15:24:32 +00:00
Adrian McCarthy 1e368d1558 Supply missing break in case statement.
Summary:
All the tests pass without hitting the situation mentioned in the FIXME, so,
per Aaron Smith's suggestion, this case will now return unconditionally.

Subscribers: sanjoy, mgorny, JDevlieghere

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

llvm-svn: 325188
2018-02-14 23:16:36 +00:00
Pavel Labath ec303134ef Remove vestigial remnants of the test crash info hook
llvm-svn: 325137
2018-02-14 16:08:26 +00:00
Vedant Kumar 361b5e1169 [cmake] Darwin: Copy in the system debugserver if needed
This makes the built debugger functional on Darwin when compiling
without code signing (as documented in docs/code-signing.txt).

llvm-svn: 325068
2018-02-13 23:05:46 +00:00
Jim Ingham 78ffed02d8 Remove the pubnames support from the Xcode project.
llvm-svn: 324930
2018-02-12 20:25:37 +00:00
Adrian McCarthy fbfdd53ad1 Remove dead code for handling DWARF pubnames
Summary:
LLDB doesn't use this code, the code has no tests, and the code does suspicious
things like hashing pointers to strings instead of the strings themselves.

Subscribers: sanjoy, mgorny, JDevlieghere

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

llvm-svn: 324925
2018-02-12 19:19:04 +00:00
Davide Italiano 1ecd449814 [testsuite] Reintroduce test to check leaking.
It wasn't python leaking, it was lldb. Thanks to Pavel for the
explanation. Pointy-hat to me.

llvm-svn: 324919
2018-02-12 18:06:34 +00:00
Pavel Labath ca4eddee0d Skip TestTargetXMLArch on non-darwin OSs
This test uses XML packets, but libxml is an optional dependency of
lldb, and this test fails if it is not present.

I'm leaving this enabled on mac, as thats the only platform that's
likely to have libxml always available, but ideally we should have a way
to skip this based on build configuration. I'll see if I can whip
something like that up soon, but for the time being, this unblocks the
buildbots.

llvm-svn: 324870
2018-02-12 09:46:06 +00:00
Jason Molenda 0df8935c23 Looks like this fails when built i386 on linux bots, possible target
arch incompat with spec in file so it's rejected and the test fails.
will look into this later, will be a test case issue not a test issue;
test case may only be valid when lldb is built for/running on an x86_64
system.

llvm-svn: 324795
2018-02-10 01:57:33 +00:00
Jason Molenda 62f395e32e Add test case for x86_64 architecture recognition in the
target.xml packet if it is included.

llvm-svn: 324792
2018-02-10 01:13:34 +00:00