Commit Graph

191 Commits

Author SHA1 Message Date
Vedant Kumar b572f64212 [DebugInfo] LowerDbgDeclare: Add derefs when handling CallInst users
LowerDbgDeclare inserts a dbg.value before each use of an address
described by a dbg.declare. When inserting a dbg.value before a CallInst
use, however, it fails to append DW_OP_deref to the DIExpression.

The DW_OP_deref is needed to reflect the fact that a dbg.value describes
a source variable directly (as opposed to a dbg.declare, which relies on
pointer indirection).

This patch adds in the DW_OP_deref where needed. This results in the
correct values being shown during a debug session for a program compiled
with ASan and optimizations (see https://reviews.llvm.org/D49520). Note
that ConvertDebugDeclareToDebugValue is already correct -- no changes
there were needed.

One complication is that SelectionDAG is unable to distinguish between
direct and indirect frame-index (FRAMEIX) SDDbgValues. This patch also
fixes this long-standing issue in order to not regress integration tests
relying on the incorrect assumption that all frame-index SDDbgValues are
indirect. This is a necessary fix: the newly-added DW_OP_derefs cannot
be lowered properly otherwise. Basically the fix prevents a direct
SDDbgValue with DIExpression(DW_OP_deref) from being dereferenced twice
by a debugger. There were a handful of tests relying on this incorrect
"FRAMEIX => indirect" assumption which actually had incorrect
DW_AT_locations: these are all fixed up in this patch.

Testing:

- check-llvm, and an end-to-end test using lldb to debug an optimized
  program.
- Existing unit tests for DIExpression::appendToStack fully cover the
  new DIExpression::append utility.
- check-debuginfo (the debug info integration tests)

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

llvm-svn: 338069
2018-07-26 20:56:53 +00:00
Vedant Kumar d8aa717bf7 Revert "[CMake] Sort dependency list and add safestack to it"
This reverts commit r337412.

An Apple-internal bot cannot find the safestack dependency, and fails to
configure with this change.

llvm-svn: 337421
2018-07-18 20:10:43 +00:00
Vedant Kumar f3bc17cb57 [CMake] Sort dependency list and add safestack to it
The 'safestack.c' test requires safestack as a dependency.

llvm-svn: 337412
2018-07-18 18:17:39 +00:00
Ahmed Bougacha 3629e3a2a8 [debuginfo-tests] Always use the system python to invoke llgdb.py.
/usr/bin/env is recommended as a cross-platform way to find python. But:
- we're only using lldb on darwin, where we know python (or at least,
  the xcrun-style shortcut) is in /usr/bin/
- the python interpreter in LLDB comes from /S/L/F:
  $ otool -L Contents/SharedFrameworks/LLDB.framework/LLDB | grep Python
   /System/Library/Frameworks/Python.framework/Versions/2.7/Python

so when we use the lldb python module, it calls into the swig/python
support in the lldb framework, and if there's a mismatch between the
interpreter and the linked python, weird things occur.

In theory, I believe this should be done by:
- looking for the LLDB framework (llgdb.py does some of that)
- finding the binary inside the framework
- looking for the Python it was linked against (otool -L)
- finding the interpreter executable inside the Python.framework

But in practice, that's only different if we use a custom LLDB
framework/pythonpath when running these tests, and AFAIK nobody does
that right now, so the code would be dead anyway.

Don't pretend we can use any arbitrary python: just use the system one.

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

llvm-svn: 334369
2018-06-10 19:38:26 +00:00
Davide Italiano 58c707d1ad [Darwin] Specify DWARF 2/4 when running apple accelerator tests.
These sections will be retired. Also, explicitly list llvm-objdump
as a dependency. This should've been done in the previous commit,
but I failed to squash the two changes together.

Thanks to Adrian for pointing the first problem out in a comment.

llvm-svn: 326121
2018-02-26 20:56:45 +00:00
Davide Italiano 967cb19146 [Darwin] Add a test to make sure clang emits __apple accelerator tables.
llvm-svn: 325928
2018-02-23 18:04:55 +00:00
Don Hinton 3a58f6716c [debuginfo-tests] Support moving debuginfo-tests to llvm/projects
Summary:
Add cmake and lit files needed to run these tests as an
external project.  Also, copy test_debuginfo.pl from llvm/utils since
it's only used here.  The copy in llvm/utils must be maintained as
long as bots continue to include debuginfo-tests in clang/test.

This patch depends on clang patch https://reviews.llvm.org/D41055.

Reviewers: zturner, aprantl

Reviewed By: aprantl

Subscribers: mgorny, llvm-commits, JDevlieghere

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

llvm-svn: 320495
2017-12-12 16:54:20 +00:00
Adrian Prantl a0de3a8d0a Revert "Temporarily pin tests to DWARF v2 until a more recent version of LLDB"
This reverts commit 319790.

We worked around the bug in LLVM instead.

llvm-svn: 320076
2017-12-07 19:40:31 +00:00
Adrian Prantl 6e9ea3f55a Temporarily pin tests to DWARF v2 until a more recent version of LLDB
is available on green dragon.

llvm-svn: 319790
2017-12-05 16:58:09 +00:00
Zachary Turner 79708b54f2 Re-revert "Refactor debuginfo-tests."
This is still breaking greendragon.

At this point I give up until someone can fix the greendragon
bots, and I will probably abandon this effort in favor of using
a private github repository.

llvm-svn: 318722
2017-11-21 01:20:28 +00:00
Zachary Turner 8b6ef88e7e Resubmit "Refactor debuginfo-tests" again.
This was reverted due to the tests being run twice on some
build bots.  Each run had a slightly different configuration
due to the way in which it was being invoked.  This fixes
the problem (albeit in a somewhat hacky way).  Hopefully in
the future we can get rid of the workflow of running
debuginfo-tests as part of clang, and then this hack can
go away.

llvm-svn: 318697
2017-11-20 21:41:36 +00:00
Zachary Turner b5c237ec3d Re-revert "Refactor debuginfo-tests"
This is still broken because it causes certain tests to be
run twice with slightly different configurations, which is
wrong in some cases.

You can observe this by running:

  ninja -nv check-all | grep debuginfo-tests

And seeing that it passes clang/test and clang/test/debuginfo-tests
to lit, which causes it to run debuginfo-tests twice.  The fix is
going to involve either:

  a) figuring out that we're running in this "deprecated" configuration,
     and then deleting the clang/test/debuginfo-tests path, which should
     cause it to behave identically to before, or:
  b) make lit smart enough that it doesn't descend into a sub-suite if
     that sub-suite already has a lit.cfg file.

llvm-svn: 318486
2017-11-17 00:41:18 +00:00
Zachary Turner 5e420717a1 Resubmit "Refactor debuginfo-tests"
This was reverted due to some failures on specific darwin buildbots,
the issue being that the new lit configuration was not setting the
SDKROOT environment variable.  We've tested a fix locally and confirmed
that it works, so this patch resubmits everything with the fix
applied.

llvm-svn: 318435
2017-11-16 18:26:20 +00:00
Zachary Turner faf04a09f6 Revert "Update test_debuginfo.pl script to point to new tree location."
This reverts the aforementioned patch and 2 subsequent follow-ups,
as some buildbots are still failing 2 tests because of it.
Investigation is ongoing into the cause of the failures.

llvm-svn: 318112
2017-11-13 23:33:29 +00:00
Zachary Turner 0f2ce11df7 [debuginfo-tests] Make debuginfo-tests work in a standard configuration.
Previously, debuginfo-tests was expected to be checked out into
clang/test and then the tests would automatically run as part of
check-clang.  This is not a standard workflow for handling
external projects, and it brings with it some serious drawbacks
such as the inability to depend on things other than clang, which
we will need going forward.

The goal of this patch is to migrate towards a more standard
workflow.  To ease the transition for build bot maintainers,
this patch tries not to break the existing workflow, but instead
simply deprecate it to give maintainers a chance to update
the build infrastructure.

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

llvm-svn: 317925
2017-11-10 20:57:57 +00:00
Mike Edwards 4a34338204 Revert r313600 due to bot failures on Green Dragon.
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA_check/35585/

llvm-svn: 313634
2017-09-19 14:51:37 +00:00
Hans Wennborg bae0d20015 Drop -O1 case from nrvo-string.cpp
It relied on r313400 which was reverted in r313589.

llvm-svn: 313600
2017-09-18 23:54:43 +00:00
Reid Kleckner 496ecab2ba [debuginfo-tests] Add string NRVO test for PR34513
It should pass in -O0 and -O1 after r313400 and r313399.

llvm-svn: 313401
2017-09-15 21:59:39 +00:00
Paul Robinson aa117bf551 Restrict debuginfo-tests to native configurations.
llvm-svn: 312803
2017-09-08 17:10:48 +00:00
Reid Kleckner a6fc06babc Fix debuginfo-tests with GDB on Linux
Summary:
Split asan.c into asan.c and asan-blocks.c, which will be
darwin-specific. I suspect we could make it pass on Linux by adding
cmake to build BlocksRuntime from compiler-rt, but I'm not shaving that
yak yet.

asan.c and safestack.c: GDB and LLDB appear to print aggregates
differently today. Print individual elements instead of the entire
aggregate.

dbg-arg.c: GDB doesn't appear to print leading zeros when printing
pointers.

stack-var.c: Add the optnone attribute so that LLVM won't optimize away
this no-op function call. This should be a cross-platform failure
observable on Mac, so this is surprising.

Reviewers: aprantl, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 312265
2017-08-31 18:16:55 +00:00
Adrian Prantl efd2b8f824 Add a test for PR33166.
This tests optimized code where a variable is allocated on the
stack for some part of the function.

llvm-svn: 303903
2017-05-25 19:33:16 +00:00
Adrian Prantl 18c18deb77 Add additional CHECKs to safestack.c.
llvm-svn: 300469
2017-04-17 17:57:05 +00:00
Adrian Prantl 7b2bf89ebe Revert "Revert "Add a test for debug info with the safestack sanitizer enabled.""
This reapplies commit r299730 with an additional REQUIRES line.

llvm-svn: 300468
2017-04-17 17:57:03 +00:00
Adrian Prantl c26059f831 Revert "Revert "Add a test for __block variables + asan.""
This reapplies commit r300228.

llvm-svn: 300467
2017-04-17 17:57:01 +00:00
Adrian Prantl 67caa192df Revert "Revert "Add an end-to-end testcase for address sanitizer.""
This reapplies r299731 and adds an appropriate REQUIRES line.

llvm-svn: 300466
2017-04-17 17:56:59 +00:00
Ahmed Bougacha 27d260baec Revert "Add a test for debug info with the safestack sanitizer enabled."
This reverts commit r299730.

It's causing failures on a bot because of missing compiler-rt:
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_check

llvm-svn: 300460
2017-04-17 16:59:29 +00:00
Ahmed Bougacha 0f36aacc46 Revert "Add an end-to-end testcase for address sanitizer."
This reverts commit r299731.

It's causing failures on a bot because of missing compiler-rt:
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_check

llvm-svn: 300459
2017-04-17 16:59:27 +00:00
Ahmed Bougacha 559d04d4c3 Revert "Add a test for __block variables + asan."
This reverts commit r300228.

It's causing failures on a bot because of missing compiler-rt:
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_check

llvm-svn: 300458
2017-04-17 16:59:25 +00:00
Adrian Prantl 4ae261bcf7 Add a test for __block variables + asan.
llvm-svn: 300228
2017-04-13 18:06:59 +00:00
Adrian Prantl 5dcbbbc1c6 Add an end-to-end testcase for address sanitizer.
llvm-svn: 299731
2017-04-06 23:36:44 +00:00
Adrian Prantl 37b72b428a Add a test for debug info with the safestack sanitizer enabled.
llvm-svn: 299730
2017-04-06 23:30:51 +00:00
Adrian Prantl 469e119a6f Add DEBUGGER and CHECKs back to dbg-arg.c
When this testcase was migrated from IR to source the DEBUGGER
commands were not migrated together with the rest of the testcase. It
was also compiling without debug info.

Make the testcase slightly less useless by adding them back in :-)

llvm-svn: 299673
2017-04-06 17:59:50 +00:00
Adrian Prantl 7e8f2ae649 Add a testcase for variable-length arrays.
VLAs are special-cased in the frontend. This testcase ensures that the
contract between clang and llvm won't be accidentally broken by future
refactorings.

llvm-svn: 299668
2017-04-06 17:40:31 +00:00
Filipe Cabecinhas 090a237f29 New round of fixes for "Always compile debuginfo-tests for the host triple"
clang tests were breaking, at least when compiling clang only, from an
installed llvm. Make the lit.cfg script deal with the case when we don't
have a host_triple available.

llvm-svn: 220152
2014-10-18 23:47:59 +00:00
Filipe Cabecinhas 63f2c2cb65 Always compile debuginfo-tests for the host triple
Since these tests expect a working debugger, always compile them for the
host triple, assuming a working debugger is present.

This enables us to compile and run them, even when clang is, by default,
a cross-compiler (but can still target the host).

llvm-svn: 219992
2014-10-16 23:43:34 +00:00
Adrian Prantl 17a0011082 cleanup comments and remove an obsolete workaround
llvm-svn: 219623
2014-10-13 18:04:10 +00:00
Adrian Prantl 971ad5925c Address review comments from Justin Bogner.
- raise without arguments is preserving the backtrace
- move the call to terminate lldb to the exit handler

llvm-svn: 219618
2014-10-13 16:34:31 +00:00
Adrian Prantl 32cac2e062 Properly shutdown lldb by invoking SBDebugger_Terminate()
rdar://problem/18577039

llvm-svn: 219451
2014-10-09 22:16:46 +00:00
Adrian Prantl 8bcc993e27 relax testcase for LLDB output format compatibility.
llvm-svn: 204280
2014-03-19 23:06:18 +00:00
Adrian Prantl 5876656c5e Revert "xfail a test on darwin because some of the public buildbots are stuck on"
This reverts commit 203504. We decided that it is better to disable this test on a per-buildbot basis in zorg rather than everywhere on Darwin.

llvm-svn: 203627
2014-03-11 23:49:31 +00:00
Adrian Prantl de93b01a16 xfail a test on darwin because some of the public buildbots are stuck on
older versions of LLDB.

llvm-svn: 203504
2014-03-10 22:30:45 +00:00
Adrian Prantl cece9ccaf1 Revert "Experimentally enable --verify-debug-info on some testcases and see if"
Some of the buildbots need to be upgraded to a more recen version of
dwarfdump first.

Reverting for now.

llvm-svn: 203338
2014-03-08 02:46:36 +00:00
Adrian Prantl f3c43d14d9 Experimentally enable --verify-debug-info on some testcases and see if
the buildbots can take it.

llvm-svn: 203327
2014-03-08 01:23:49 +00:00
Adrian Prantl 8b466d5474 Add back the original version of the test, too. (as XFAILed on Darwin)
llvm-svn: 203326
2014-03-08 01:21:37 +00:00
Adrian Prantl 32347758b3 Work around a bug in LLDB (it finds the wrong "C", rdar://problem/14933867)
and enable this test on Darwin.

llvm-svn: 203324
2014-03-08 01:03:55 +00:00
Adrian Prantl eace60b161 Relax testcase: Newer versions of LLDB don't necessarily print the "{".
llvm-svn: 202415
2014-02-27 17:51:50 +00:00
Adrian Prantl 11f0d2ce92 Relax testcase: Newer versions of LLDB don't necessarily print the "{" either.
llvm-svn: 202319
2014-02-27 00:02:40 +00:00
Adrian Prantl 75c4779943 Add a fallback path for buildbots temporarily stuck on really old
versions of LLDB.

llvm-svn: 201828
2014-02-21 00:17:02 +00:00
Adrian Prantl 5cd2f3ee95 Relax testcases. LLDB starts counting at $0.
llvm-svn: 201806
2014-02-20 19:51:07 +00:00
Adrian Prantl d913c86b93 don't use CHECK-NEXT because it may be on the same line.
llvm-svn: 190969
2013-09-18 23:01:54 +00:00
Adrian Prantl 7f6f3bb86b Massage those regexps to work with both lldb and gdb.
llvm-svn: 190967
2013-09-18 22:56:35 +00:00
Adrian Prantl ee30f63cc1 Auto-detect the architecture of the executable instead of using the arch of
the kernel.

llvm-svn: 190256
2013-09-07 20:04:29 +00:00
Adrian Prantl 002c2a8ece Set the architecture when creating a target.
llvm-svn: 190252
2013-09-07 17:14:37 +00:00
Adrian Prantl 5ef1c861dd Use a more backwards-compatible method for evaluating expressions and add
more explanatory error messages.

llvm-svn: 190215
2013-09-06 22:33:52 +00:00
Adrian Prantl 888e023e0d Add an lldb wrapper script that implements gdb-compatible commands on top
of lldb. This will be the new default method for executing the tests in
this repository on Darwin.
There is also a related patch for llvm/utils/test_debuginfo.pl coming.

I also relaxed some of the checks to work with both gdb's and lldb's
output.

llvm-svn: 190185
2013-09-06 18:10:44 +00:00
Adrian Prantl f88c554b10 fix typos
llvm-svn: 190184
2013-09-06 18:10:42 +00:00
Eric Christopher 8b6f708cda Only fail this on darwin since most other platforms should have a newer
gdb.

llvm-svn: 189920
2013-09-04 05:06:10 +00:00
Michael Gottesman 9672fcf1e5 XFAILed the static-member.cpp test since we no longer support emitting debug info that support what Eric calls "the member hack".
llvm-svn: 189915
2013-09-04 04:44:05 +00:00
David Blaikie 86feadcc76 Now that we get non-trivial value parameters locations correct, un-XFAIL these tests.
llvm-svn: 184372
2013-06-19 22:07:11 +00:00
David Blaikie fbbb8f32b0 We've got the type right, which has broken these tests - but now we need to get the location information correct that the type was papering over
llvm-svn: 183576
2013-06-07 22:09:23 +00:00
David Blaikie 7e138ff572 Remove IR scenario tests.
These are a burden to maintain & use hand crafted IR to test particular DWARF
generation cases in LLVM. If someone thinks there's high value coverage here
they can rephrase these as IR+dwarfdump tests in the LLVM regression suite so
they'll be portable/easily executed by all developers.

llvm-svn: 177182
2013-03-15 20:52:10 +00:00
David Blaikie cebc623798 Migrate dbg-arg.ll to a C file test to be resilient to IR changes.
llvm-svn: 176964
2013-03-13 18:46:28 +00:00
Eric Christopher 5724ee9765 Harden this test a bit to work on the mac with ancient gdbs.
llvm-svn: 172752
2013-01-17 20:09:50 +00:00
Eric Christopher 2ccf3a291d Add a test for static member debug information.
Part of PR14471.

Patch by Paul Robinson.

llvm-svn: 172589
2013-01-16 01:22:09 +00:00
Argyrios Kyrtzidis 8f68817738 XTARGET was removed, update debug-info tests.
llvm-svn: 166362
2012-10-20 01:38:50 +00:00
Eric Christopher 118c1961ae Fix this for gdb 7.4.
Patch by Andy Gibbs.

llvm-svn: 160639
2012-07-23 19:41:58 +00:00
Eric Christopher cc389be552 Fix this for buggy gdb behavior alongside the change
to clang that omits debug information for non-user-defined
methods.

llvm-svn: 158008
2012-06-05 18:16:03 +00:00
Eric Christopher e6a602dfab Revert previous patch as the corresponding clang patch was reverted.
gdb's tests are too dependent upon order in debug info.

llvm-svn: 149050
2012-01-26 07:01:33 +00:00
Eric Christopher 7b878febf1 Reverse the order that these are expected for clang change. Should
be no functional change (the offsets in AT_data_member_location are still
correct). If the gdb testsuite itself needs changing then I'll revert this
and the clang patch.

llvm-svn: 149026
2012-01-26 02:33:53 +00:00
Devang Patel ce04aa5a2c Testcase for r133065
llvm-svn: 133066
2011-06-15 17:57:23 +00:00
Devang Patel 2d1d1f4942 New test case for r132949.
llvm-svn: 132950
2011-06-13 23:16:05 +00:00
Devang Patel 30a67a14e5 Remove working directory path from intermediate files. They are not checked in the output anyway.
llvm-svn: 132375
2011-05-31 23:57:48 +00:00
Eli Friedman 8f630d9ffc Fix tests broken by r132257.
llvm-svn: 132277
2011-05-29 03:51:55 +00:00
Renato Golin 161505f480 adding XFAIL and XTARGET to those that require Darwin host
llvm-svn: 132257
2011-05-28 14:03:16 +00:00
Douglas Gregor 097984480d Clang is now correctly marking this as a class, so update the test case accordingly
llvm-svn: 131797
2011-05-21 18:17:06 +00:00
Devang Patel cef3760460 Test case for r131441.
llvm-svn: 131442
2011-05-17 00:20:50 +00:00
Devang Patel 539cde8bce Test case for r131422.
llvm-svn: 131423
2011-05-16 21:25:49 +00:00
Devang Patel 4a14cd9cf9 Test case for r130373.
llvm-svn: 130374
2011-04-28 02:23:17 +00:00
Devang Patel 443e46f16d Silence return-type warning.
llvm-svn: 130349
2011-04-28 00:02:06 +00:00
Devang Patel 90955228bb These tests are x86_64 specific.
llvm-svn: 128421
2011-03-28 20:00:34 +00:00
Devang Patel 2b54299705 Test case for r128150.
llvm-svn: 128151
2011-03-23 16:30:03 +00:00
Devang Patel d9bc8e0817 test case for r125249.
llvm-svn: 125250
2011-02-10 00:41:14 +00:00
Devang Patel d3a7ee6bfc Test case for r125142.
llvm-svn: 125144
2011-02-09 00:37:52 +00:00
Devang Patel 00c84fd125 Test case for r123199.
llvm-svn: 123200
2011-01-11 00:31:01 +00:00
Devang Patel 13bcf4d131 Zap white spaces, test commit email.
llvm-svn: 118690
2010-11-10 18:11:11 +00:00
Devang Patel c8effb80cb testcase commit for upcoming fix.
llvm-svn: 114476
2010-09-21 20:51:54 +00:00
Devang Patel 5fd13063a4 test case for r113843.
llvm-svn: 113844
2010-09-14 20:29:59 +00:00
Devang Patel 59c97b50ae Import debug info tests.
llvm-svn: 113804
2010-09-13 22:47:46 +00:00
Devang Patel 056959a6c0 remove these tests
llvm-svn: 113803
2010-09-13 22:44:41 +00:00
Devang Patel 64e5efb650 add more tests.
llvm-svn: 113801
2010-09-13 22:36:20 +00:00
Devang Patel bf3b62d356 Add README.txt and very first test case.
llvm-svn: 113797
2010-09-13 22:25:34 +00:00