Commit Graph

184 Commits

Author SHA1 Message Date
OCHyams d77a572087 [DebugInfo][dexter] Tweak dexter test for merged values
Tweak dexter-tests/memvars/inline-escaping-function.c added in D94761
(b7e516202e) by adding a 'param' use after the merge point. The test XFAILS
with and without this change, but without it the test looks very similar to
memvars/unused-merged-value.c. The test now demonstrates the problem more
clearly.
2021-01-19 12:45:31 +00:00
OCHyams b7e516202e [DebugInfo][dexter] Add dexter tests for merged values
These dexter tests illustrate PR48719, the summary of which is:

Sometimes we insert dbg.values for merged values (PHIs) when promoting
variables, sometimes we don't. Sometimes there is no PHI because the merged
value is never used. It doesn't matter because LiveDebugValues understands these
merged values (implicit or otherwise) and correctly updates the debug
info. Importantly, these merged variable values (which may or may not exist as
PHIs, and may or not be represented with dbg.values) are //always// implicitly
defined by the combination of incoming edges and the incoming variable locations
along those edges by virtue of LiveDebugValues existing. Unfortunately, it is
possible to mess with the CFG and remove / move these edges before
LiveDebugValues runs. In this case our debug info model only works when the
merged value is tracked by a dbg.value. Currently, this is only done rigorously
for variables which are A) promoted in the first round of mem2reg and B) are
used after the merge point.

As an example, compile the following source with -O3 -g and step through with a
debugger. You will see parama=5 throughout the function fun which is incorrect -
we expect to see param=20 after the conditional assignment.

    __attribute__((optnone))
    void esc(int* p) {}

    __attribute__((optnone))
    void fluff() {}

    __attribute__((noinline))
    int fun(int parama, int paramb) {
      if (parama)
        parama = paramb;
      fluff();           // DexLabel('s0')
      esc(&parama);
      return 0;
    }

    int main() {
      return fun(5, 20);
    }

1. parama is escaped by esc(&parama) so it is not promoted by
   SROA/mem2reg (failing condition "A" above).
2. InstCombine's LowerDbgDeclare converts the dbg.declare to a set of
   dbg.values (tracking the stored SSA values).
3. InstCombine replaces the two stores to parama's alloca (the initial
   parameter register store in entry and the assignment in if.then) with a
   PHI+store in the common sucessor.
4. SimplifyCFG folds the blocks together and converts the PHI to a
   select.

The debug info is not updated to account for the merged value in the successor
prior to SimplifyCFG when it exists as a PHI, or during when it becomes a
select.

As with D89543, which added some dexter tests for escaped locals, the idea is
to build a set of source-level tests which highlights existing issues and
might be useful in evaluating a new debug info model.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D94761
2021-01-19 11:11:00 +00:00
Mehdi Amini 9e1aaa9943 Fix check-gdb-mlir-support build after MLIR API changed to take Context as first argument 2021-01-07 21:30:39 +00:00
Mehdi Amini 476db17dcb Fix include path for check-gdb-mlir-support to include the MLIR binary dir
This fixes a build failure:

fatal error: 'mlir/IR/BuiltinTypes.h.inc' file not found
2021-01-07 21:29:09 +00:00
Fangrui Song 25bf4a8f42 [debuginfo-test] Fix -Wunused-value 2021-01-06 20:39:07 -08:00
Krzysztof Parzyszek 1b404ad51e Include BuiltinAttributes.h in llvm-prettyprinters/gdb/mlir-support.cpp
This header was introduced in c7cae0e4fa.
2020-12-04 15:57:05 -06:00
River Riddle 09f7a55fad [mlir][Types][NFC] Move all of the builtin Type classes to BuiltinTypes.h
This is part of a larger refactoring the better congregates the builtin structures under the BuiltinDialect. This also removes the problematic "standard" naming that clashes with the "standard" dialect, which is not defined within IR/. A temporary forward is placed in StandardTypes.h to allow time for downstream users to replaced references.

Differential Revision: https://reviews.llvm.org/D92435
2020-12-03 18:02:10 -08:00
Moritz Sichert 5747380772 Added GDB pretty printer for StringMap
Reviewed By: csigg, dblaikie

Differential Revision: https://reviews.llvm.org/D91183
2020-11-18 16:33:34 -08:00
Jonas Devlieghere 2993850237 [debuginfo-tests] Skip optnone-loops.cpp on Darwin
This is failing on GreenDragon:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/24745/
2020-11-06 13:05:33 -08:00
Louis Dionne 08e6903eb4 [debuginfo-tests] NFC: Move test that was committed to the wrong location
Differential Revision: https://reviews.llvm.org/D90931
2020-11-06 08:23:34 -05:00
Nabeel Omer 3ebcef4b73 [Dexter] add visual studio 2019 debugger support
Adds visual studio debugger support to dexter via option --debugger vs2019

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

Author:    Nabeel Omer <nabeel.omer@sony.com>
2020-11-04 16:57:19 +00:00
Tom Weaver f2f4554f88 [debuginfo-tests][dexter] add requires lldb to two tests
both deferred_globals.cpp namespace.cpp require lldb in order to run and will
fail if it's not available.

add the required lines to the top of the tests.
2020-10-28 17:33:29 +00:00
Nabeel Omer afc44efc26 [debuginfo-tests][dexter] Add two new debug experience tests
deferred_globals.cpp: Verify that debug information for a local variable does
not hide a global definition that has the same name

namespace.cpp: Ensure that the debug information for a global variable
includes namespace information.

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

Author:    Nabeel Omer <nabeel.omer@sony.com>
2020-10-28 14:21:40 +00:00
OCHyams 66d03af88c [DebugInfo][dexter] Add dexter tests for escaped locals
Recently there has been renewed interest in improving debug-info for variables
that (partially or otherwise) live on the stack in optimised code.

At the moment instcombine speculates that stack slots are probably going to be
promoted to registers, and prepares the debug-info accordingly. It runs a
function called LowerDbgDeclare which converts dbg.declares to a set of
dbg.values after loads, and before stores and calls. Sometimes the stack
location remains (e.g. for escaped locals). If any dbg.values become undef
where the stack location is still valid we end up unnecessarily reducing
variable location coverage due to our inability to track multiple locations
simultaneously. There is a flag to disable this feature
(-instcombine-lower-dbg-declare=0), which prevents this conversion at the cost
of sometimes providing incorrect location info in the face of DSE, DCE, GVN,
CSE etc.

This has been discussed fairly extensively on PR34136.

The idea of these tests is to provide examples of situations that we should
consider when designing a new system, to aid discussions and eventually help
evaluate the implementation.

Dexter isn't ideal for observing specific optimisation behaviour. Writing an
exaustive test suite would be difficult, and the resultant suite would be
fragile. However, I think having some concrete executable examples is useful
at least as a reference.

Differential Revision: https://reviews.llvm.org/D89543
2020-10-26 10:57:36 +00:00
Nabeel Omer 7d8c19a4e9 [Dexter][NFC] Add Missing Commands to Commands.md Contents
NFC patch simply updates the commands.md documentation contents with missing
  links to the DexLimitSteps and DexLabel command documentation.

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

  Author:    Nabeel Omer <nabeel.omer@sony.com>
2020-10-19 16:38:49 +01:00
Christian Sigg e9b3884161 Add GDB prettyprinters for a few more MLIR types.
Reviewed By: dblaikie, jpienaar

Differential Revision: https://reviews.llvm.org/D87159
2020-09-30 21:22:47 +02:00
OCHyams 485e6db872 Revert "Adding GDB PrettyPrinter for mlir::Identifier."
This reverts commit 9e9e6e698d.

This commit is causing builds that include the 'debuginfo-tests' project to
fail.

Apple has a public bot which shows the failure:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/23667/console
2020-09-03 08:28:15 +01:00
Christian Sigg 9e9e6e698d Adding GDB PrettyPrinter for mlir::Identifier.
This is the first bit from D73546. Primarily setting up the corresponding test. Will add more pretty printers in a separate revision.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D86937
2020-09-03 08:18:09 +02:00
serge-sans-paille 515bc8c155 Harmonize Python shebang
Differential Revision: https://reviews.llvm.org/D83857
2020-07-16 21:53:45 +02:00
Fangrui Song ac567eec11 [CMake] Add check-debuginfo-* targets
* check-debuginfo-dexter runs lit tests under debuginfo-tests/dexter/
* check-debuginfo-llgdb-tests runs lit tests under debuginfo-tests/llgdb-tests/
* ...

Reviewed By: tbosch

Differential Revision: https://reviews.llvm.org/D82605
2020-06-26 11:18:18 -07:00
Fangrui Song 161ae1f398 [CMake] Add optional lldb dependency to DEBUGINFO_TEST_DEPS
if(TARGET asan) is still brittle as it depends on the order of
compiler-rt and debuginfo-tests in LLVM_ENABLE_PROJECTS.
2020-06-25 18:28:43 -07:00
Fangrui Song e477a5f6c8 [CMake] Add optional asan & safestack dependencies to DEBUGINFO_TEST_DEPS 2020-06-25 17:56:35 -07:00
Fangrui Song 40dd5cb110 [debuginfo-tests] Require "lldb" for some dexter tests 2020-06-25 17:35:01 -07:00
Fangrui Song ca8b7ef763 [CMake] Add llvm-config to DEBUGINFO_TEST_DEPS
Fix `fatal: Could not run process ['/path/to/build/./bin/llvm-config', '--build-mode']`
when running check-debuginfo in a fresh build directory.
2020-06-25 16:49:33 -07:00
Tobias Bosch 53d6bfef32 [Dexter] Add --source-dir-root flag
Summary:
This allows to run dexter tests with separately compiled
binaries that are specified via --binary if the source file
location changed between compilation and dexter test run.

Reviewers: TWeaver, jmorse, probinson, #debug-info

Reviewed By: jmorse

Subscribers: #debug-info, cmtice, llvm-commits

Tags: #llvm, #debug-info

Differential Revision: https://reviews.llvm.org/D81319
2020-06-18 09:29:08 -07:00
Mehdi Amini d31c9e5a46 Change filecheck default to dump input on failure
Having the input dumped on failure seems like a better
default: I debugged FileCheck tests for a while without knowing
about this option, which really helps to understand failures.

Remove `-dump-input-on-failure` and the environment variable
FILECHECK_DUMP_INPUT_ON_FAILURE which are now obsolete.

Differential Revision: https://reviews.llvm.org/D81422
2020-06-09 18:57:46 +00:00
Tom Weaver c6aa829644 [Dexter] Add DexLimitSteps command and ConditionalController
* Adds DexLimitSteps Command.
* Add ConditionalController, a new DebuggerController type.
* 5 regression tests
* documentation

* recommit, fixed accidental adding of unnecessary file

Reviewers: jmorse

Differential Revision: https://reviews.llvm.org/D79786
2020-06-05 12:53:56 +01:00
Tom Weaver 05eabb5204 Revert "[Dexter] Add DexLimitSteps command and ConditionalController"
This reverts commit 81e836a5a6.

Accidentally committed a diff file.
2020-06-03 12:28:26 +01:00
Tom Weaver 81e836a5a6 [Dexter] Add DexLimitSteps command and ConditionalController
* Adds DexLimitSteps Command.
  * Add ConditionalController, a new DebuggerController type.
  * 5 regression tests
  * documentation

  Reviewers: jmorse

  Differential Revision: https://reviews.llvm.org/D79786
2020-06-02 16:19:43 +01:00
Tom Weaver bf1cdc2c6c [Dexter] Add os.path.normcase(...) transform to test path early.
When passing a test path, if the path points directly at a file, then
  normcase would not be called on path.

  This would change the expected lower case drive path, on windows, to be
  uppercase. This patch simply calls normcase on the test path at the earliest
  point possible to avoid this issue.

  Reviewers: djtodoro, jmorse

  Differential Revision: https://reviews.llvm.org/D78633
2020-06-02 16:09:17 +01:00
Christian Sigg 104e38cf76 Only run pretty-printer tests for builds with debug-info.
Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: tbosch, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79897
2020-05-14 09:19:43 +02:00
Christopher Tetreault f829ba60da Ensure that CMake tries to find Python3 before processing
Summary:
It is possible that CMake tries to process debuginfo-tests before any
attempt to find Python3. Ensure that CMake attempts to find it before
complaining that it doesn't exist.

Reviewers: zturner, rnk, jmorse, chandlerc

Reviewed By: rnk

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79795
2020-05-13 13:56:48 -07:00
Jonas Devlieghere 7f84b6c1ba [debuginfo-tests] Update Python variable in lit.site.cfg.py 2020-04-30 10:51:45 -07:00
Jonas Devlieghere ba8163e629 [debuginfo-tests] Update Python CMake variable 2020-04-29 09:51:32 -07:00
Djordje Todorovic 871388e384 [dexter] Require python >= 3.6
The documentation says we need python >= 3.6. Running it with an older
version, we get verbose output from python interpreter.
This patch fixes that as:

  $ python2 dexter.py list-debuggers
  You need python 3.6 or later to run DExTer

Differential Revision: https://reviews.llvm.org/D78621
2020-04-23 11:46:10 +02:00
Tom Weaver b1097e29d3 [Dexter] Fix failing clang-opt-bisect sub tool test
Fixes a mismatch in expected arguments passed to run_debugger_subprocess

  Fix for:
    https://reviews.llvm.org/D76926
    rG9cf9710bb0d61cb5c27c6e780af6a182cb162bfb
2020-04-21 13:40:02 +01:00
Tom Weaver 9cf9710bb0 [Dexter][NFC] Add Debugger Controller To Dexter
Add DebuggerControllerBase and DefaultController to Dexter
  implements a new architecture that supports new and novel ways of running
  a debugger under dexter.
  Current implementation adds the original default behaviour via the new
  architecture via the DefaultController, this should have NFC.

Reviewers: Orlando

Differential Revision: https://reviews.llvm.org/D76926
2020-04-20 15:46:55 +01:00
Tom Weaver b6d2212f52 [Dexter] Add support for Windows to regression test suite.
This patch addresses the issue of the regression suite not running on windows
hardware. It changes the following things:

* add new dexter regression suite command to lit.cfg.py that makes use of the
  clang-cl_vs2015 and dbgend builder and debuggers.

* sprinkle the new regressionsuite command through the feature and tool tests
  that require them.

* mark certain problem tests on windows

* [revert fix] fixed darwin regression test failures by adding unsupported line
  for system-darwin to command tests.

There's a couple of tests that fail (or pass) in unexpected ways on Windows.

Problem tests are both the penalty and perfect expect_watch_type.cpp tests.
Type information reporting parity is not possible a this time in dexter due to
the nature of how different debuggers report type information back to their users.

reviewers: Orlando

Differential Revision: https://reviews.llvm.org/D76609
2020-03-31 10:18:12 +01:00
Davide Italiano 470e82cd06 Revert "[Dexter] Add support for Windows to regression test suite."
This reverts commit 89025da9f6 as
it breaks the lldb macOS bot.
2020-03-27 13:12:24 -07:00
Tom Weaver 89025da9f6 [Dexter] Add support for Windows to regression test suite.
This patch addresses the issue of the regression suite not running on windows hardware. It changes the following things:

add new dexter regression suite command to lit.cfg.py that makes use of the clang-cl_vs2015 and dbgend builder and debuggers.
sprinkle the new regression suite command through the feature and tool tests that require them.
mark certain problem tests on windows

There's a couple of tests that fail (or pass) in unexpected ways on Windows.

Problem tests are both the penalty and perfect expect_watch_type.cpp tests. Type information reporting parity is not possible a this time in dexter due to the nature of how different debuggers report type information back to their users.

reviewers: Orlando

Differential Revision: https://reviews.llvm.org/D76609
2020-03-27 18:15:17 +00:00
Tom Weaver 09f4bdc03f [DexTer] Add step.UNKNOWN check for NoneType line numbers.
Summary: It's possible for an instance of the visual studio debugger
to return a NoneType line number location when stepping during a
debugging session.

This patches teaches DexTer how to handle this particular case without
crashing out.

Reviewers: Orlando

Differential revision: https://reviews.llvm.org/D75992
2020-03-16 16:38:41 +00:00
Jonas Devlieghere 54146cbd32 [debuginfo-tests] Update test for double-dash long-option. 2020-03-15 20:56:33 -07:00
Christian Sigg f3ad6eb5d3 Change to individual pretty printer classes, remove generic `make_printer`.
Summary: Follow-up from D72589.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: merge_guards_bot, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73609
2020-03-11 15:04:03 +01:00
Pierre-vh b4b9fa5e11 [debuginfo-tests][dexter] Add --builder gcc support for POSIX
Differential Revision: https://reviews.llvm.org/D75339
2020-03-03 16:42:24 +00:00
Pierre-vh 527bd24c3b [debuginfo-tests][dexter] Add a test tool --calculate-average option
Differential Revision: https://reviews.llvm.org/D75235
2020-02-28 10:00:37 +00:00
Jeremy Morse 0a3b083791 [debuginfo-tests] Warn, not error, if we can't delete working directory
On Windows, an error running the debugger typically leaves a process
hanging around in the working directory. When Dexter exits, it can't then
delete the working directory and produces an exception, masking the problem
in the debugger. (This can be worked around by specifying --save-temps).
Rather than hard-erroring, print a warning when we can't delete the working
directory instead.

It'd be much better to improve our error handling, and make the
WorkingDirectory class aware that something's wrong when it enters exit.
However, this is something that's going to mask genuine errors and make
everyones lives harder right now, so I think this non-ideal fix is
important to get in first.

Differential Revision: https://reviews.llvm.org/D74548
2020-02-25 13:15:07 +00:00
Shoaib Meenai e34ddc09f4 [arcconfig] Delete subproject arcconfigs
From https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/:

> An .arcconfig file is a JSON file which you check into your project's root.

I've done some experimentation, and it looks like the subproject
.arcconfigs just get ignored, as the documentation says. Given that
we're fully on the monorepo now, it's safe to remove them.

Differential Revision: https://reviews.llvm.org/D74996
2020-02-24 16:20:36 -08:00
Jeremy Morse 5ee4a03bc9 [debuginfo-tests][Dexter] Fix some Windows-unfriendly Dexter behaviours
These are some minor things that I've run into on Windows, largely in
error handling paths:

 * Giving --lldb-executable on Windows triggers a "useless option" code
   path, which touches an attribute that only exists in the
   list_debuggers tool. Switch this to use hasattr, which will work in
   all subtools.
 * We were over-decoding some text reporting errors, but only in an
   exception path
 * The path to lldb on Windows needs to be quoted (even though dexter
   isn't making use of it).

Differential Revision: https://reviews.llvm.org/D74546
2020-02-13 14:24:33 +00:00
Jeremy Morse 26f6aa9e3b [debuginfo-tests] Fix Dexter process creation failure on Windows
When writing the Windows dbgeng driver for Dexter, I couldn't work out why it
would either launch a process and leave it free running, or if I started the
process suspended, never do anything with it. The result was a hack to create
and attach processes manually. This has been flaking out on Reids Windows
buildbot, and clearly wasn't a good solution.

Digging into this, it turns out that the "normal" cdb / windbg behaviour of
breaking whenever we attach to a process is not the default: it has to be
explicitly requested from the debug engine. This patch does so (by setting
DEBUG_ENGOPT_INITIAL_BREAK in the engine options), after which we can simply
call "CreateProcessAndAttach2" and everything automagically works.

No test for this behaviour: everything was just broken before.

Differential Revision: https://reviews.llvm.org/D74409
2020-02-13 12:46:32 +00:00
Adrian Prantl 248435e9c9 Replace CHECK-NEXT with CHECK-DAG. The order isn't relevant we just
want to make sure that all are present.
2020-02-07 15:09:44 -08:00