Commit Graph

75 Commits

Author SHA1 Message Date
Guozhi Wei
e5244706ec [dexter-tests] Add attribute optnone to main function
The test case optnone-simple-functions.cpp is expected to be compiled
unoptimized even under -O2 because of attribute optnone. But this attribute is
missed for main function, and caused the fail in
https://lab.llvm.org/buildbot/#/builders/217/builds/14046 when it triggered
optimizations. This patch fixes that by adding attribute optnone to main
function.

Differential Revision: https://reviews.llvm.org/D136778
2022-10-26 20:57:49 +00:00
Jonas Devlieghere
2234f582c9
[dexter] Temporary disable optnone-simple-functions
D136396 broke optnone-simple-functions. Temporary disabling the test to
unblock the bot until the Sony folks can have a look.

https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/47878/
2022-10-26 13:14:44 -07:00
OCHyams
251e614019 [Dexter] Ignore step information in __libc_start_call_main
The test dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp
was failing on a machine because __libc_start_call_main was not identified as a
"frame below main" (a frame we don't want to gather information from), causing
dexter to count one more step than expected in the test.

Add __libc_start_call_main to the list of "frames below main". There may
be a more robust way of doing this but this is a pragmatic solution we can
use for now.
2022-10-12 12:21:56 +01:00
Pavel Samolysov
1c530500ab [Pipelines] Introduce DAE after ArgumentPromotion
The ArgumentPromotion pass uses Mem2Reg promotion at the end to cutting
down generated `alloca` instructions as well as meaningless `store`s and
this behavior can leave unused (dead) arguments. To eliminate the dead
arguments and therefore let the DeadCodeElimination remove becoming dead
inserted `GEP`s as well as `load`s and `cast`s in the callers, the
DeadArgumentElimination pass should be run after the ArgumentPromotion
one.

Differential Revision: https://reviews.llvm.org/D128830
2022-09-22 15:33:46 -07:00
Adrian Prantl
5203168f91 Revert "[debuginfo-tests] Un-XFAIL no passing unused-merged-value.c test"
This reverts commit 96f00f63b2 because D128830 has been reverted.
2022-09-02 08:47:37 -07:00
Michael Buch
96f00f63b2 [debuginfo-tests] Un-XFAIL no passing unused-merged-value.c test
This test would previously expect one of the parameters to have
an incorrect DW_AT_location. Stepping through `fun` with a debugger
would then no reflect updates to one of the parameters.

With a recent change to Clang's DeadArgumentEliminationPass
(see `879f5118fc74657e4a5c4eff6810098e1eed75ac`) the generated
DWARF does not contain a location for `parama`, and stepping through
the function with `lldb` works as expected.

Differential Revision: https://reviews.llvm.org/D132664
2022-08-25 16:43:40 +01:00
Felipe de Azevedo Piovezan
920e2e8271 [cross-project] Disable debug-types-section tests on Apple systems
The -fdebug-types-section flag is not supported on Apple platforms.

Reviewed By: Michael137

Differential Revision: https://reviews.llvm.org/D132410
2022-08-24 07:31:29 -04:00
Shafik Yaghmour
b364535304 [Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values
DR2338 clarified that it was undefined behavior to set the value outside the
range of the enumerations values for an enum without a fixed underlying type.

We should diagnose this with a constant expression context.

Differential Revision: https://reviews.llvm.org/D130058
2022-07-28 15:27:50 -07:00
Arthur Eubanks
f6a7d7e45f [cross-project-tests] Add split-file as dependency
simplified_template_names_noncanonical_type_units.cpp uses split-file.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D130656
2022-07-27 12:44:12 -07:00
David Blaikie
63f4cfe267 Pretty printer test fixes 2022-07-12 19:29:38 +00:00
David Blaikie
4ca2058552 Add missing include for std::size_t 2022-07-12 01:41:10 +00:00
spupyrev
b444358126 Revert "Rebase: [Facebook] Add clang driver options to test debug info and BOLT"
This reverts commit f921985a29.
2022-07-11 09:50:46 -07:00
Amir Ayupov
f921985a29 Rebase: [Facebook] Add clang driver options to test debug info and BOLT
Summary:
This is an essential piece of infrastructure for us to be
continuously testing debug info with BOLT. We can't only make changes
to a test repo because we need to change debuginfo tests to call BOLT,
hence, this diff needs to sit in our opensource repo. But when upstreaming
to LLVM, this should be kept BOLT-only outside of LLVM. When upstreaming,
we need to git diff and check all folders that are being modified by our
commits and discard this one (and leave as an internal diff).

To test BOLT in debuginfo tests, configure it with -DLLVM_TEST_BOLT=ON.
Then run check-lldb and check-debuginfo.

Manual rebase conflict history:
https://phabricator.intern.facebook.com/D29205224
https://phabricator.intern.facebook.com/D29564078
https://phabricator.intern.facebook.com/D33289118
https://phabricator.intern.facebook.com/D34957174

Test Plan:
tested locally
Configured with:
-DLLVM_ENABLE_PROJECTS="clang;lld;lldb;compiler-rt;bolt;debuginfo-tests"
-DLLVM_TEST_BOLT=ON
Ran test suite with:
ninja check-debuginfo
ninja check-lldb

Reviewers: #llvm-bolt

Subscribers: ayermolo, phabricatorlinter

Differential Revision: https://phabricator.intern.facebook.com/D35317341

Tasks: T92898286
2022-07-11 09:31:51 -07:00
Stephen Tozer
6bc2ad235a [Dexter] Remove debugger-dependent test from windows
One of the tests added in the recent floating point patch involves
string comparison against the debugger output; as DbgEng and LLDB have
different output, the test cannot pass against both of them, so disable
it on windows.
2022-06-13 19:27:34 +01:00
Stephen Tozer
ec7c959671 [Dexter] Fix incorrect test expectations for floating point tests
A pair of tests had incorrect expectations set, one being an off-by-one
error and the other using decimal points in the expect that lldb omits.
2022-06-13 19:07:18 +01:00
Stephen Tozer
30bb659c6f [Dexter] Allow Dexter watch commands to specify a range of acceptable FP values
This patch adds an optional argument to DexExpectWatchBase, float_range,
which defines a +- acceptance range for expected floating point values.
If passed, this assumes every expected value to be a floating point
value, and an exception will be thrown if this is not the case.

Differential Revision: https://reviews.llvm.org/D124511
2022-06-13 14:44:28 +01:00
Stephen Tozer
b03451bb9a [Dexter] Use PurePath to compare paths in Dexter commands
Prior to this patch, when comparing the paths of source files in Dexter
commands, we would use os.samefile. This function performs actual file
operations and requires the files to exist on the current system; this
is suitable when running the test for the first time, but renders the
DextIR output files non-portable, and unusable if the source files no
longer exist in their original location.

Differential Revision: https://reviews.llvm.org/D127099
2022-06-08 16:28:27 +01:00
Stephen Tozer
2a156f6058 [Dexter] Catch value error when encountering invalid address
The DexDeclareAddress command checks the value of a variable at a
certain point in the debugged program, and saves that value to be used
in other commands. If the value at that point is not a valid address
however, it currently causes an error in Dexter when we try to cast it -
this is fixed in this patch by catching the error and leaving the
address value unresolved.

Differential Revision: https://reviews.llvm.org/D127101
2022-06-08 16:05:29 +01:00
Vitaly Buka
d33c36235d [lit] Fix setup of sanitizer environment
Not all options were propageted into tests.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D122869
2022-05-19 19:24:16 -07:00
Aaron Ballman
ef50d817b6 Speculatively fix build bots
This should address build failures found in:

https://lab.llvm.org/buildbot/#/builders/217/builds/3610
https://lab.llvm.org/buildbot/#/builders/215/builds/4609
https://lab.llvm.org/buildbot/#/builders/68/builds/31012
2022-04-20 11:48:06 -04:00
Stephen Tozer
1c8366f9f2 [Dexter] Collate penalties of the same type into a single line for each
Currently in Dexter, every step at which a DexExpectWatchValue/Type does
not have the correct value is printed on a separate line. This patch
reduces the size of the text output by instead printing each incorrect
result (i.e. each incorrect value seen, 'Variable optimized out', and so
on) on its own line, alongside a list of the steps at which that result
was seen. This makes for much less spam in the output when watches are
missing or wrong for many steps.

Differential Revision: https://reviews.llvm.org/D120716
2022-04-11 17:01:40 +01:00
David Blaikie
1cee3d9db7 DebugInfo: Consider the type of NTTP when simplifying template names
Since the NTTP may need to be cast to the type when rebuilding the name,
check that the type can be rebuilt when determining whether a template
name can be simplified.
2022-04-08 00:00:46 +00:00
David Blaikie
a5032b2633 DebugInfo: Don't allow type units to references types in the CU
We could only do this in limited ways (since we emit the TUs first, we
can't use ref_addr (& we can't use that in Split DWARF either) - so we
had to synthesize declarations into the TUs) and they were ambiguous in
some cases (if the CU type had internal linkage, parsing the TU would
require knowing which CU was referencing the TU to know which type the
declaration was for, which seems not-ideal). So to avoid all that, let's
just not reference types defined in the CU from TUs - instead moving the
TU type into the CU (recursively).

This does increase debug info size (by pulling more things out of type
units, into the compile unit) - about 2% of uncompressed dwp file size
for clang -O0 -g -gsplit-dwarf. (5% .debug_info.dwo section size
increase in the .dwp)
2022-03-25 23:49:03 +00:00
David Blaikie
7b498beef0 DebugInfo: Classify noreturn function types as non-reconstructible
This information isn't preserved in the DWARF description of function
types (though probably should be - it's preserved on the function
declarations/definitions themselves through the DW_AT_noreturn attribute
- but we should move or also include that in the subroutine type itself
too - but for now, with it not being there, the DWARF is lossy and
can't be reconstructed)
2022-03-24 18:53:14 +00:00
David Blaikie
4841dab4af llvm-dwarfdump: Including calling convention attribute in pretty printed type names 2022-03-22 19:19:54 +00:00
Thomas Lively
7062094bbc [WebAssembly] Add end-to-end codegen tests for wasm_simd128.h
Add a test checking that each SIMD intrinsic produces the expected instruction.
Since this test spans both clang and LLVM, place it in a new
intrinsic-header-tests subdirectory of cross-project-tests.

This revives D101684 now that cross-project-tests exists. In practice, the tests
of lowering from wasm_simd128.h to LLVM IR were not as useful as this end-to-end
test.

Updates the version check of gdb in cross-project-tests/lit.cfg.py so that
unexpected version formats do not prevent the new tests from running.

Depends on D121661.

Differential Revision: https://reviews.llvm.org/D121662
2022-03-17 15:22:17 -07:00
Sam McCall
75acad41bc Use lit_config.substitute instead of foo % lit_config.params everywhere
This mechanically applies the same changes from D121427 everywhere.

Differential Revision: https://reviews.llvm.org/D121746
2022-03-16 09:57:41 +01:00
Petr Hosek
0c0f6cfb7b [CMake] Rename TARGET_TRIPLE to LLVM_TARGET_TRIPLE
This clarifies that this is an LLVM specific variable and avoids
potential conflicts with other projects.

Differential Revision: https://reviews.llvm.org/D119918
2022-03-11 15:43:01 -08:00
gbtozers
b3f1480204 [Dexter] Optimize breakpoint deletion in Visual Studio
Breakpoint deletion in visual studio is currently implemented by
iterating over the breakpoints we want to delete, for each of which we
iterate over the complete set of breakpoints in the debugger instance
until we find the one we wish to delete. Ideally we would resolve this
by directly deleting each breakpoint by some ID rather than searching
through the full breakpoint list for them, but in the absence of such a
feature in VS we can instead invert the loop to improve performance.

This patch changes breakpoint deletion to iterate over the complete list
of breakpoints, deleting breakpoints that match the breakpoints we
expect to delete by checking set membership. This represents a
worst-case improvement from O(nm) to O(n), for 'm' breakpoints being
deleted out of 'n' total. In practise this is almost exactly 'm'-times
faster, as when we delete multiple breakpoints they are typically
adjacent in the full breakpoint list.

Differential Revision: https://reviews.llvm.org/D120658
2022-03-01 13:13:38 +00:00
David Blaikie
d7c4f7f147 DebugInfo: fix a couple of spurious spaces in simplified template name rebuilding 2022-02-16 11:33:41 -08:00
David Blaikie
9980a3f831 DebugInfo: Disable simplified template names for -gmlt and below
Since -gmlt doesn't carry any type information necessary to rebuild
template names.
2022-02-15 11:58:40 -08:00
David Blaikie
1ea326634b DebugInfo: Don't simplify template names using _BitInt(N)
_BitInt(N) only encodes the byte size in DWARF, not the bit size, so
can't be reconstituted.
2022-02-15 11:58:40 -08:00
OCHyams
2bd62e0b04 [dexter] Don't generate results files by default
Dexter saves various files to a new results directory each time it is run
(including when it's run by lit tests) and there isn't a way to opt-out. This
patch reconfigures the behaviour to be opt-in by removing the default
`--results-directory` location. Now results are only saved if
`--results-directory` is specified.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D119545
2022-02-11 15:45:43 +00:00
David Blaikie
389f67b35b DebugInfo: Don't simplify names referencing local enums
Due to the way type units work, this would lead to a declaration in a
type unit of a local type in a CU - which is ambiguous. Rather than
trying to resolve that relative to the CU that references the type unit,
let's just not try to simplify these names.

Longer term this should be fixed by not putting the template
instantiation in a type unit to begin with - since it references an
internal linkage type, it can't legitimately be duplicated/in more than
one translation unit, so skip the type unit overhead. (but the right fix
for that is to move type unit management into a DICompositeType flag
(dropping the "identifier" field is not a perfect solution since it
breaks LLVM IR linking decl/def merging during IR linking))
2022-02-10 15:51:47 -08:00
David Blaikie
f3a2cfc103 DebugInfo: Don't simplify any template referencing a lambda
Lambda names aren't entirely canonical (as demonstrated by the
cross-project-test added here) at the moment (we should fix that for a
bunch of reasons) - even if the template referencing them is
non-simplified, other names referencing /that/ template can't be
simplified either because type units might cause a different template to
be picked up that would conflict with the expected name.

(other than for roundtripping precision, it'd be OK to simplify types
that reference types that reference lambdas - but best be consistent
between the roundtrip/verify mode and the actual simplified template
names mode)
2022-02-10 14:56:54 -08:00
OCHyams
48326df4b5 [cross-project-tests] REQUIRES: system-darwin in llgdb-tests/asan-deque.cpp
Some configurations of gdb pretty print std::deque and some don't. Make
this test run only on system-darwin (which uses lldb instead), otherwise
it will fail on some non-darwin machines and not others.
2022-02-10 13:53:52 +00:00
OCHyams
ac0f32970d [cross-project-tests] Add REQUIRES: compiler-rt to tests that use asan
And XFAIL debuginfo-tests/llgdb-tests/asan-deque.cpp on !system-darwin.
On non-darwin systems these tests use gdb and this one fails because gdb
doesn't pretty-print std::deque (the elements of the deque are not printed so
the CHECK lines fail).

Differential Revision: https://reviews.llvm.org/D118760
2022-02-10 10:48:03 +00:00
OCHyams
00b2a9c9da [cross-project-tests] Make GDB version string parsing more robust
Follow up to D118468 (5257efdc5b).

When built from source, gdb's version string looks like this:

    GNU gdb (GDB) 9.2
    ...

But for installed versions it looks different. E.g.

    GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
    ...

Use a regex rather than str.parition in the version string parsing in order to
handle this case too.
2022-02-09 11:45:39 +00:00
OCHyams
5257efdc5b [cross-project-tests] XFAIL llgdb-tests when gdb can't read clang's DWARF
Tests in the `cross-project-tests/debuginfo-tests/llgdb-tests` directory run
gdb on non-darwin platforms. gdb versions less than 10.1 cannot parse the DWARF
v5 emitted by clang, and DWARF v5 is now the default, so these tests fail on
Linux with gdb versions less than 10.1. This patch lets us XFAIL the tests
under these conditions.

Add `gdb-clang-incompatibility` to the `available_features` in
`cross-project-tests/lit.cfg.py` when clang's default DWARF version is 5 or
greater and the gdb (if found) version is less than 10.1.

Discourse discussion:
https://llvm.discourse.group/t/gdb-10-1-cant-read-clangs-dwarf-v5/6035

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D118468
2022-02-09 10:53:35 +00:00
OCHyams
de3f81557a [Dexter] Remove false requirement of lldb for dexter regression tests on Windows
Not quite NFC because a little work was required to configure some tests to run
on Windows at all.

Before this patch on Windows:

    $ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
       Unsupported: 49
       Passed     : 23

After this patch on Windows:

    $ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
       Unsupported      : 27
       Passed           : 39
       Expectedly failed:  6

There are 3 main changes here. The first is to add a few more substitutions in
cross-project-tests/lit.cfg.py so that tests need to use specific flags can
still use the dexter regression test defaults for the native platform. These
are:

     %dexter_regression_test_debugger
     %dexter_regression_test_builder
     %dexter_regression_test_cflags
     %dexter_regression_test_ldflags

Tests that now use these options and therefore can be run on Windows too
(though the second is still failing for unknown reasons):

    cross-project-tests/debuginfo-tests/dexte/feature_tests
        /subtools/clang-opt-bisect/clang-opt-bisect.cpp
        /subtools/test/source-root-dir.cpp

The second change is to remove spurious `REQUIRES: system-linux, lldb` and
`UNSUPPORTED: system-windows` directives, and make changes to lit.local.cfg
files that have the same effect. I've also added comments to the genuine
REQUIRES, UNSUPPORTED, and XFAIL directives so it's easier to understand
requirements at a glance. The most common reason for a test to not be supported
on Windows is that it uses DexLimitSteps, DexDeclareAddress, or DexCommandLine,
none of which are supported in the dbgeng driver.

There are two failures on Windows that were previously hidden, which I've
XFAILed:

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/dex_finish_test/default_conditional.cpp
        /commands/perfect/dex_finish_test/default_conditional_hit_count.cpp

And two that were easy to fix:

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/dex_finish_test/default_simple.cpp
        /commands/perfect/dex_finish_test/default_hit_count.cpp

Lastly, I've set three directories as unsupported.

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/limit_steps
        /commands/perfect/dex_declare_address
        /commands/perfect/dex_declare_file

The first two are unsupported on Windows because they contains tests for the
DexLimitSteps and DexDeclareAddress commands which aren't supported in the
dbgeng driver. The third is unsupported on all platforms as the tests involve
invoking clang directly, which isn't currently a supported way of building
tests for dexter in lit (it can cause problems for cross compilers that can
target the host, as the tests use the default triple and linker, which may
be aligned for the default target, not host).

Tested on Windows and Linux.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D118048
2022-01-26 11:33:50 +00:00
River Riddle
56f62fbf73 [mlir] Finish removing Identifier from the C++ API
There have been a few API pieces remaining to allow for a smooth transition for
downstream users, but these have been up for a few months now. After this only
the C API will have reference to "Identifier", but those will be reworked in a followup.

The main updates are:
* Identifier -> StringAttr
* StringAttr::get requires the context as the first parameter
  - i.e. `Identifier::get("...", ctx)` -> `StringAttr::get(ctx, "...")`

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116626
2022-01-12 11:58:23 -08:00
Jeremy Morse
0f92c113a3 [Dexter] Allow DexUnreachable in supplementary .dex files
DexUnreachable is a useful tool for specifying that lines shouldn't be
stepped on. Right now they have to be placed in the source file; lets allow
them to be placed instead in a detached .dex file, by adding on_line and
line-range keyword arguments to the command.

Differential Revision: https://reviews.llvm.org/D115449
2022-01-10 16:22:53 +00:00
Jeremy Morse
3a094d8b27 [Dexter] Allow tests to specify command line options
This patch adds a "DexCommandLine" command, allowing dexter tests to
specify what command line options the test should be started with. I've
also plumbed it through into the debuggers.

This eases the matter of pointing Dexter at larger tests, or controlling
different paths through a single binary from a Dexter test.

Differential Revision: https://reviews.llvm.org/D115330
2022-01-10 11:30:06 +00:00
Christian Sigg
fb4869e26c Fix GDB printers test
- Prevent symbols from being stripped so that it can run with 'RelWithDebInfo'.
- Adjust llvm-support CHECKs after code changes.
- Polish mlir-support CHECKs as suggested in https://reviews.llvm.org/D116646.

Differential Revision: https://reviews.llvm.org/D116837
2022-01-08 08:35:51 +01:00
Christian Sigg
635f8f3c95 Update mlir GDB printers
Update prettyprinters.py to match MLIR changes.

This has gone unnoticed because no build bot is running tests with debug info.

I will look into what we can do about this separately. There is
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/,
from Apple. The Debug Info tests are failing despite the green result.

See https://github.com/llvm/llvm-project/issues/48872.

Note: the llvm-support.gdb test only works with Debug,
but not RelWithDebInfo because some checked symbols are stripped.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D116646
2022-01-06 22:20:25 +01:00
David Blaikie
06c154602e DebugInfo: Rebuild varargs function types correctly
Improves llvm-dwarfdump output and for simplified template names roundtripping.
2022-01-05 20:29:29 -08:00
Mehdi Amini
eec312ee7f Fix build of llvm-prettyprinters/gdb/mlir-support.cpp test
This is just fixing the build itself, the test won't pass right now.
2021-12-29 23:09:22 +00:00
OCHyams
18ee898cfa [Dexter] Remove the Windows dependency on lld from CMake
Currently, lld is marked as a dependency on Windows in
cross-project-tests/CMakeLists.txt which means CMake will fail if lld isn't
enabled. The idea of the cross-project-tests is that tests that don't have
their dependencies met should just be unsupported.

Remove the depenency from the CMake step and check whether Dexter's
platform-specific dependencies have been met in
cross-project-tests/lit.cfg.py. If the dependencies are met then add 'dexter'
to the available_features, otherwise don't and the dexter tests will be
"UNSUPPORTED".

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D115872
2021-12-16 13:43:04 +00:00
Tom Weaver
7c781621f8 [dexter] Fix source-root-dir unittests on Windows
These tests were spuriously failing on Windows due to path separators getting
flipped from `/` to `\\`  in various parts of dexter:

test_add_breakpoint_with_source_root_dir
test_get_step_info
test_get_step_info_no_source_root_dir

Tested on Windows and Linux.

Patch written by @TWeaver.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D115338
2021-12-08 15:43:02 +00:00
Stephen Tozer
f0eef1d212 [Dexter] Fix address_printing test by requiring lldb
Fixes a failure on the llvm-clang-x86_64-sie-ubuntu-fast buildbot caused
by the test requiring lldb (with the standard dexter lit config), but
not including a "Requires: lldb" clause.
2021-12-01 14:05:46 +00:00