Commit Graph

560 Commits

Author SHA1 Message Date
Chaoren Lin e8c6840c71 XFail TestBitfields.py Python API tests.
Summary:
Started failing after rL267895.
Possibly related to http://llvm.org/pr27510.

Reviewers: labath, tfiala

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D19680

llvm-svn: 267923
2016-04-28 19:40:19 +00:00
Kuba Brecka bcdce3fd85 Provide location information (file name, line number) in TSan reports about global variables.
llvm-svn: 267894
2016-04-28 15:27:10 +00:00
Pavel Labath f726c346ea Remote flaky decorator from TestSignalsAPI on linux
The test seems to pass now, and the test does not seem to be doing anything unusual, so I don't
expect it to cause problems.

llvm-svn: 267867
2016-04-28 10:42:47 +00:00
Pavel Labath 35e9ea3812 Revert "Fixed a bug where const this would cause parser errors about $__lldb_expr."
This reverts commit r267833 as it breaks the build. It looks like some work in progress got
committed together with the actual fix, but I'm not sure which one is which, so I'll revert the
whole patch and let author resumbit it after fixing the build error.

llvm-svn: 267861
2016-04-28 08:16:19 +00:00
Sean Callanan 8bdcd52251 Fixed a bug where const this would cause parser errors about $__lldb_expr.
In templated const functions, trying to run an expression would produce the
error

error: out-of-line definition of '$__lldb_expr' does not match any declaration in 'foo'
member declaration does not match because it is const qualified
error: 1 error parsing expression

which is no good.  It turned out we don't actually need to worry about "const,"
we just need to be consistent about the declaration of the expression and the
FunctionDecl we inject into the class for "this."

Also added a test case.

<rdar://problem/24985958>

llvm-svn: 267833
2016-04-28 01:36:21 +00:00
Adrian McCarthy 37d3fac3a7 XFail TestIRInterpreter on Windows
There's an open bug with calling functions in the inferior.  And Windows doesn't have the POSIX function getpid().

Differential Revision: http://reviews.llvm.org/D19626

llvm-svn: 267800
2016-04-27 21:53:19 +00:00
Sean Callanan cac9b70692 Added a testcase for the IR interpreter, ensuring that it behaves like the JIT.
<rdar://problem/25785338>

llvm-svn: 267768
2016-04-27 19:37:42 +00:00
Kuba Brecka 3f61a183a8 Decorate TSan tests with "@skipUnlessThreadSanitizer" which skips the tests if the selected compiler can't compile with "-fsanitize=thread".
llvm-svn: 267726
2016-04-27 15:26:27 +00:00
Pavel Labath e0ee7c608a Remove flaky decorator from three tests on linux
The flakyness is no longer reproducible, and the tests seem to be passing reliably now.

llvm-svn: 267704
2016-04-27 12:43:37 +00:00
Adrian McCarthy fd5c9be4bb Fix TestRegisterVariables.py on Windows
Use __attribute__((regparm(x))) to ensure the compiler enregisters at least some arguments when calling functions.

Differential Revision: http://reviews.llvm.org/D19548

llvm-svn: 267616
2016-04-26 22:25:40 +00:00
Adrian McCarthy d285007720 Fix send and receive of ACK byte in test infrastructure for Python 3.5
Python 3.5 is pickier about the distinction between chars and bytes (and strings and bytearrays) than Python 2.7.

Differential Revision: http://reviews.llvm.org/D19510

llvm-svn: 267562
2016-04-26 15:15:29 +00:00
Pavel Labath a24427533f Bump up timeout in TestCallWithTimeout
Expression very rarely (linux buildbot, build 13907) completed before we managed to interrupt it.

llvm-svn: 267554
2016-04-26 13:37:24 +00:00
Chaoren Lin f91daff9e6 Fix TestGetVariables.py.
Reviewers: sivachandra, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D19511

llvm-svn: 267492
2016-04-25 23:29:53 +00:00
Greg Clayton a32532bfa5 Fix StackFrame::GetVariables(...) function that was broken by 261858 when lambda functions were added to Block::AppendBlockVariables(). The Stackframe::GetVariables(...) function should get all variables regardless if they are in scope.
This wasn't caught by the test suite so I added a test for it.

llvm-svn: 267478
2016-04-25 21:54:10 +00:00
Francis Ricci cef04a25f6 Store absolute path for lldb executable in dotest.py
Summary:
lldb-server tests are currently being skipped on the
check-lldb target. This is because we get the path of
lldb-server by modifying the path to the lldb executable.
However, by this point, we've changed directories, and a
relative path to the build/bin directory will no longer point
to the location of lldb-server.

Storing an absolute path solves this issue.

Reviewers: vharron, zturner, tfiala, labath

Subscribers: labath, lldb-commits, sas

Differential Revision: http://reviews.llvm.org/D19082

llvm-svn: 267463
2016-04-25 20:36:22 +00:00
Francis Ricci d60d96ffae Add missing qRegisterInfo option to gdbremote testcase
Summary:
"gcc" is equivalent to "ehframe" in ProcessGDBRemote, but
only "ehframe" was a valid response in the test suite.

Reviewers: tfiala, jasonmolenda, clayborg

Subscribers: lldb-commits, sas

Differential Revision: http://reviews.llvm.org/D18807

llvm-svn: 267459
2016-04-25 20:24:30 +00:00
Todd Fiala 6d547205f0 skip TestBitfields.py on OS X
tracked by:
https://llvm.org/bugs/show_bug.cgi?id=27515

llvm-svn: 267421
2016-04-25 15:48:34 +00:00
Pavel Labath 73151ff298 Skip TestBitfileds on linux
Test added in r267248 exposed a bug in handling of dwarf produced by clang>=3.9, which causes a
crash during expression evaluation. Skip the test until this is sorted out.

llvm-svn: 267407
2016-04-25 14:00:23 +00:00
Pavel Labath 3c924653c1 Remove flaky decorator from two tests on linux
The flakyness is no longer reproducible, and the tests seem to be passing reliably now.

llvm-svn: 267392
2016-04-25 10:32:23 +00:00
Enrico Granata 520a422bd8 Add a --element-count option to the expression command
This option evaluates an expression and, if the result is of pointer type, treats it as if it was an array of that many elements and displays such elements

This has a couple subtle points but is mostly as straightforward as it sounds

Add a parray N <expr> alias for this new mode

Also, extend the --object-description mode to do the moral equivalent of the above but display each element in --object-description mode
Add a poarray N <expr> alias for this

llvm-svn: 267372
2016-04-25 00:52:47 +00:00
Greg Clayton cae0855a62 DWARF layout for bitfields is wrong when the bit offset is negative.
Some older versions of clang emitted bit offsets that were negative and these bitfields would have their bitfield-ness stripped off and it would cause a clang assertion in clang assertions were enabled. I updated the bitfield C test to make sure we don't regress.

<rdar://problem/21082998> 

llvm-svn: 267248
2016-04-22 23:14:35 +00:00
Kuba Brecka 5b31c423a0 Renumber ThreadSanitizer-provided thread IDs to match LLDB thread numbers.
llvm-svn: 267133
2016-04-22 10:40:14 +00:00
Kate Stone 7cc41e02c1 Removed extraneous print() in decorator for enabling module debugging
llvm-svn: 266924
2016-04-20 21:59:43 +00:00
Enrico Granata 612917c784 Fix a bug where LLDB would crash if 'apropos <anything>' was used after spawning an inferior process
llvm-svn: 266911
2016-04-20 20:48:05 +00:00
Todd Fiala 49d3c15c3e test infra: move test event-related handling into its own package
This change moves all the test event handling and its related
ResultsFormatter classes out of the packages/Python/lldbsuite/test dir
into a packages/Python/lldbsuite/test_event package. Formatters are
moved into a sub-package under that.

I am limiting the scope of this change to just the motion and a few
minor issues caught by a static Python checker (e.g. removing unused
import statements).

This is a pre-step for adding package-level tests to the test event
system. I also intend to simplify test event results formatter selection
after I make sure this doesn't break anybody.

See:
http://reviews.llvm.org/D19288

Reviewed by:
Pavel Labath

llvm-svn: 266885
2016-04-20 16:27:27 +00:00
Tamas Berghammer 1a8b821099 Fix xfail for test_tilde_home_directory on windows
llvm-svn: 266867
2016-04-20 09:54:47 +00:00
Greg Clayton f258bf9017 llvm::sys::path::home_directory() relies on having "HOME" set in the environment and that might not always be set. Our FileSpec class uses this function to resolve any paths that start with "~/" on systems that support home directories as '~'. I have modified FileSpec::ResolveUsername (llvm::SmallVectorImpl<char> &path) to deal with the cases where llvm::sys::path::home_directory() returns false by digging a little further on unix systems and setting "HOME" in the environment so that subsequent calls to llvm::sys::path::home_directory() will succeed.
I also added a test to ensure we don't regress.

<rdar://problem/25342377> 

llvm-svn: 266832
2016-04-19 23:04:35 +00:00
Kate Stone 317871d793 Eliminate circular dependency introduced between lldbtest.py and decorators.py
llvm-svn: 266815
2016-04-19 20:45:47 +00:00
Kate Stone 8410ddd8b6 Adds a test to detect when clang omits specialized generic types from debug information when using precompiled headers and -gmodules.
llvm-svn: 266791
2016-04-19 18:20:11 +00:00
Pavel Labath 79b25d5ea4 Fix typo in TestSourceManager.py
llvm-svn: 266725
2016-04-19 09:31:14 +00:00
Todd Fiala ca5793ea5c test infra cleanup: convert test_runner lib into package
Also does the following:
* adopts PEP8 naming convention for OptionalWith class (now
  optional_with).
* moves test_runner/lldb_utils.py to lldbsuite/support/optional_with.py.
* packages tests in a subpackage of test_runner per recommendations in
  http://the-hitchhikers-guide-to-packaging.readthedocs.org/en/latest/creation.html

Tests can be run from within pacakges/Python/lldbsuite/test via this
command:

  python -m unittest discover test_runner

The primary cleanup this allows is avoiding the need to muck with the
PYTHONPATH variable from within the source files.  This also aids some
of the static code checkers as they don't need to run code to determine
the proper python path.

llvm-svn: 266710
2016-04-19 04:20:35 +00:00
Todd Fiala dad52cee4b ensure lldbinline remembers .py extension
This ensure lldbinline.test_file paths are tracked as .py
files rather than .pyc files.

Also, this change adds an assert to the test infrastructure
if a filename that is not ending in .py is attempted to be
added to the test events infrastructure where we track test
results.

See:
http://reviews.llvm.org/D19215

Earlier revision reviewed by:
Pavel Labath

llvm-svn: 266664
2016-04-18 20:26:56 +00:00
Todd Fiala 430309f13a fix a race is the LLDB test suite results collection
The race boiled down to this:

If a test worker queue is able to run the test inferior and
clean up before the dosep.py listener socket is spun up, and
the worker queue is the last one (as would be the case when
there's only one test rerunning in the rerun queue), then
the test suite will exit the main loop before having a chance
to process any test events coming from the test inferior or
the worker queue job control.

I found this race to be far more likely on fast hardware.
Our Linux CI is one such example.  While it will show
up primarily during meta test events generated by
a worker thread when a test inferior times out or
exits with an exceptional exit (e.g. seg fault), it only
requires that the OS takes longer to hook up the
listener socket than it takes for the final test inferior
and worker thread to shut down.

See:
http://reviews.llvm.org/D19214

reviewed by:
Pavel Labath

llvm-svn: 266624
2016-04-18 16:09:21 +00:00
Pavel Labath 8222151a7e Fixup r266327
Fix XFAILed tests in TestThreadStates for the new signature of wait_for_running_event.

llvm-svn: 266598
2016-04-18 11:01:41 +00:00
Mohit K. Bhakkad 76a7ca0f67 [LLDB][MIPS] Fix TestConcurrentEvents
Patch by Nitesh Jain

Reviewers: clayborg
Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar
Differential Revision: http://reviews.llvm.org/D18389

llvm-svn: 266589
2016-04-18 05:27:42 +00:00
Pavel Labath 5c17454cd6 Make destructor breakpoint location test more resilient
Summary:
The original breakpoint location test was failing for linux, because the compilers here tend to
merge the full-object and subobject destructors even at -O0 (as a result, we are getting only 2
breakpoint locations, and not 4 as the test expected. The fixup in r266164 substantially weakened
the test, as it now did not check whether both kinds of destructors were being found.

Because of these contraints, I have altered the logic of the test. It sets the
breakpoint by name, and then independently verifies that the breakpoint is set on the correct
demangled symbol name (which is not very meaningful since both kinds of destructors demangle to
the same name) *and* the correct symbol address (which is obtained by looking up the mangled
symbol name).

Reviewers: clayborg

Subscribers: ovyalov, zturner, lldb-commits

Differential Revision: http://reviews.llvm.org/D19052

llvm-svn: 266416
2016-04-15 09:11:22 +00:00
Sean Callanan 91de55f161 Blocks are only reliably supported on Darwin. Disable the test otherwise.
llvm-svn: 266400
2016-04-15 00:44:59 +00:00
Sean Callanan 812e559589 Added a testcase for defining and using lambdas in the expression parser.
<rdar://problem/25739133>

llvm-svn: 266397
2016-04-15 00:26:32 +00:00
Sean Callanan 5d7ddfda2d Added a testcase for defining and using a block in the expression parser.
<rdar://problem/25738696>

llvm-svn: 266389
2016-04-15 00:05:50 +00:00
Ulrich Weigand 4f42310dfb Disable LinuxCoreTestCase.test_s390x
This seems to hang on non-s390x hosts.  Disable for now to get the build
bots going again.

llvm-svn: 266343
2016-04-14 17:36:41 +00:00
Pavel Labath 7e49e3d97c [test] make expect_state_changes actually expect *only* them
The android dirty stderr problem has uncovered an issue where lldbutil.expect_state_changes was
reading events other than state change events, which resulted in general confusion. Make it more
strict to accept *only* state changes.

llvm-svn: 266327
2016-04-14 15:52:58 +00:00
Pavel Labath e6961d0306 [test] Relax stderr expectations on targets with chatty output
Summary:
On some android targets, a binary can produce additional garbage (e.g. warning messages from the
dynamic linker) on the standard error, which confuses some tests. This relaxes the stderr
expectations for targets known for their chattyness.

Reviewers: tfiala, ovyalov

Subscribers: tberghammer, danalbert, srhines, lldb-commits

Differential Revision: http://reviews.llvm.org/D19114

llvm-svn: 266326
2016-04-14 15:52:53 +00:00
Ulrich Weigand 7e8de59b90 Fix test cases for big-endian systems
A number of test cases were failing on big-endian systems simply due to
byte order assumptions in the tests themselves, and no underlying bug
in LLDB.

These two test cases:
  tools/lldb-server/lldbgdbserverutils.py
  python_api/process/TestProcessAPI.py
actually check for big-endian target byte order, but contain Python errors
in the corresponding code paths.

These test cases:
  functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
  functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
  functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
  lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
  python_api/sbdata/TestSBData.py  (first change)
could be fixed to check for big-endian target byte order and update the
expected result strings accordingly.  For the two synthetic tests, I've
also updated the source to make sure the fake_a value is always nonzero
on both big- and little-endian platforms.

These test case:
  python_api/sbdata/TestSBData.py  (second change)
  functionalities/memory/cache/TestMemoryCache.py
simply accessed memory with the wrong size, which wasn't noticed on LE
but fails on BE.

Differential Revision: http://reviews.llvm.org/D18985

llvm-svn: 266315
2016-04-14 14:35:02 +00:00
Ulrich Weigand 377e4213e1 Fixes for platforms that default to unsigned char
This fixes several test case failure on s390x caused by the fact that
on this platform, the default "char" type is unsigned.

- In ClangASTContext::GetBuiltinTypeForEncodingAndBitSize we should return
  an explicit *signed* char type for encoding eEncodingSint and bit size 8,
  instead of the default platform char type (which may be unsigned).
  This fix matches existing code in ClangASTContext::GetIntTypeFromBitSize,
  and fixes the TestClangASTContext.TestBuiltinTypeForEncodingAndBitSize
  unit test case.

- The test/expression_command/char/TestExprsChar.py test case is known to
  fail on platforms defaulting to unsigned char (pr23069), and just needs
  to be xfailed on s390x like on arm.

- The test/functionalities/watchpoint/watchpoint_on_vectors/main.c test
  case defines a vector of "char" and implicitly assumes to be signed.
  Use an explicit "signed char" instead.

Differential Revision: http://reviews.llvm.org/D18979

llvm-svn: 266309
2016-04-14 14:30:12 +00:00
Ulrich Weigand bb00d0b6b2 Support Linux on SystemZ as platform
This patch adds support for Linux on SystemZ:
- A new ArchSpec value of eCore_s390x_generic
- A new directory Plugins/ABI/SysV-s390x providing an ABI implementation
- Register context support
- Native Linux support including watchpoint support
- ELF core file support
- Misc. support throughout the code base (e.g. breakpoint opcodes)
- Test case updates to support the platform

This should provide complete support for debugging the SystemZ platform.
Not yet supported are optional features like transaction support (zEC12)
or SIMD vector support (z13).

There is no instruction emulation, since our ABI requires that all code
provide correct DWARF CFI at all PC locations in .eh_frame to support
unwinding (i.e. -fasynchronous-unwind-tables is on by default).

The implementation follows existing platforms in a mostly straightforward
manner.  A couple of things that are different:

- We do not use PTRACE_PEEKUSER / PTRACE_POKEUSER to access single registers,
  since some registers (access register) reside at offsets in the user area
  that are multiples of 4, but the PTRACE_PEEKUSER interface only allows
  accessing aligned 8-byte blocks in the user area.  Instead, we use a s390
  specific ptrace interface PTRACE_PEEKUSR_AREA / PTRACE_POKEUSR_AREA that
  allows accessing a whole block of the user area in one go, so in effect
  allowing to treat parts of the user area as register sets.

- SystemZ hardware does not provide any means to implement read watchpoints,
  only write watchpoints.  In fact, we can only support a *single* write
  watchpoint (but this can span a range of arbitrary size).  In LLDB this
  means we support only a single watchpoint.  I've set all test cases that
  require read watchpoints (or multiple watchpoints) to expected failure
  on the platform.  [ Note that there were two test cases that install
  a read/write watchpoint even though they nowhere rely on the "read"
  property.  I've changed those to simply use plain write watchpoints. ]

Differential Revision: http://reviews.llvm.org/D18978

llvm-svn: 266308
2016-04-14 14:28:34 +00:00
Pavel Labath 9fb77fcfef Fix test rerun logic
result_formatter used inspect.getfile() to get the python file name, which returned "*.pyc" if
the bytecode file was present. This resulted in files being displayed with the wrong extension,
and more critically, would confuse the rerun logic because it would try to rerun the pyc file
(which resulted in an empty rerun list as unittest refused to run those).

Fix: use inspect.getsourcefile() instead.

I am not sure why does was not an issue before. I can only assume that some system update
tricked python into producing bytecode files more aggressively.

llvm-svn: 266192
2016-04-13 12:05:48 +00:00
Oleksiy Vyalov 939b084bd7 Attempt to fix TestCPPBreakpointLocations on Linux/Android.
llvm-svn: 266164
2016-04-13 04:21:05 +00:00
Adrian McCarthy 0a385532dd Fix breakpoint_set_restart test for Windows
When run with the multiprocess test runner, the getchar() trick doesn't work, so ninja check-lldb would fail on this test, but running the test directly worked fine.

Differential Revision: http://reviews.llvm.org/D19035

llvm-svn: 266145
2016-04-12 22:45:03 +00:00
Greg Clayton 08f5674bfe Fixed being able to set breakpoints on destructors when we don't fully specify the demangled name. So all of the following now work:
(lldb) b ~Foo
(lldb) b Foo::~Foo
(lldb) b Bar::Foo::~Foo

Improved out C++ breakpoint locations tests as well to cover this issue.

<rdar://problem/25577252>

llvm-svn: 266139
2016-04-12 22:02:37 +00:00
Jim Ingham ff7ac6a7b9 Breakpoint conditions were making result variables, which they should not do.
The result variables aren't useful, and if you have a breakpoint on a
common function you can generate a lot of these.  So I changed the
code that checks the condition to set ResultVariableIsInternal in the
EvaluateExpressionOptions that we pass to the execution.
Unfortunately, the check for this variable was done in the wrong place
(the static UserExpression::Evaluate) which is not how breakpoint
conditions execute expressions (UserExpression::Execute).  So I moved
the check to UserExpression::Execute (which Evaluate also calls) and made the
overridden method DoExecute.

llvm-svn: 266093
2016-04-12 17:17:35 +00:00