Commit Graph

16 Commits

Author SHA1 Message Date
Felipe de Azevedo Piovezan
f7f869c88d [DebugInfo] Don't inherit debug location of previous instruction
Prior to this commit, when lowering SIL instructions that should are
"hidden" for the purposes of debugging, the compiler just attaches the
location of the previous instruction in the name of keeping a simpler
line table.

However, this is wrong for many reasons. One such reason is this: at the
start of a basic block, inheriting the previous debug location will
almost certainly cause the instruction to have a random location in the
code, as it will depend on whatever BB was visited previously.

Other examples can be seen in the tests affect by this commit, which
changes lowering to use Line 0 instead of the line number of the
previous instruction.

CodeView doesn't handle line 0 the same way DWARF does, so this commit
preserves the old behavior for the CodeView path.

The test changes here are effectively undoing some of the diffs from
158772c2ab.

rdar://139826231&110187845
2024-11-18 10:23:41 -08:00
Adrian Prantl
aab0cb09cc Root the virtual <compiler-generated> file in the root directory.
Using CWD gives a false sense of accuracy.

rdar://124233848
2024-03-12 16:57:04 -07:00
Allan Shortlidge
79c1e94b4a Revert "Disable several Backtracing tests on Linux AArch64."
This reverts commit 0ceff1ba2d.
2023-06-13 22:53:20 -07:00
Allan Shortlidge
0ceff1ba2d Disable several Backtracing tests on Linux AArch64. 2023-06-13 18:41:15 -07:00
Alastair Houghton
210ca2a067 [Backtracing][Tests] Fix tests to redirect output from stderr.
Some of the backtracing tests expected output on stdout.

rdar://110371557
2023-06-07 13:55:15 +01:00
Alastair Houghton
ee5596428f [Backtracing][Linux] Enable Linux backtracing, add tests.
Turn on the Linux backtracing implementation and update the tests.

rdar://101623265
2023-06-07 09:08:18 +01:00
Adrian Prantl
158772c2ab Rebase SILScope generation on top of ASTScope.
This patch replaces the stateful generation of SILScope information in
SILGenFunction with data derived from the ASTScope hierarchy, which should be
100% in sync with the scopes needed for local variables. The goal is to
eliminate the surprising effects that the stack of cleanup operations can have
on the current state of SILBuilder leading to a fully deterministic (in the
sense of: predictible by a human) association of SILDebugScopes with
SILInstructions. The patch also eliminates the need to many workarounds. There
are still some accomodations for several Sema transformation passes such as
ResultBuilders, which don't correctly update the source locations when moving
around nodes. If these were implemented as macros, this problem would disappear.

This necessary rewrite of the macro scope handling included in this patch also
adds proper support nested macro expansions.

This fixes

rdar://88274783

and either fixes or at least partially addresses the following:

rdar://89252827
rdar://105186946
rdar://105757810
rdar://105997826
rdar://105102288
2023-04-04 15:20:11 -07:00
Alastair Houghton
3e78f840f6 [Backtracing][Tests] Disable crashing tests under ASAN.
If ASAN is enabled, it will catch the crashes and the backtracing code
won't, so in that case the tests will fail.  Fix by disabling them for
ASAN.

rdar://107129465
2023-03-23 12:09:21 +00:00
Alastair Houghton
43375e7a23 [Backtracing] Fix out-of-process async backtraces.
These weren't working correctly because I made the unwinder call
`_swift_task_getCurrent()`, but of course when out-of-process, it calls
that in `swift-backtrace`, which is wrong.  Remove that for now.

While I'm here, I also tweaked the formatting slightly, and I noticed
that we were saying that all thunks were also system functions, which
seemed unnecessary and odd.

Plus there were a couple of extra system functions I added to make the
async crash backtraces nicer in friendly mode.

rdar://106363539
2023-03-08 09:35:18 +00:00
Alastair Houghton
2043498a39 [Backtracing] Don't run tests when testing OS stdlib.
We need a symbol from the standard library that isn't in the older
versions of the stdlib.

rdar://106293913
2023-03-07 14:42:28 +00:00
Alastair Houghton
106dd1956e [Backtracing] Fix test failures.
I'd inserted an extra line, which upset the line numbers in the backtracing
tests.

Also tweak the Python build script tests slightly so they work.

rdar://106234311
2023-03-06 11:28:16 +00:00
Alastair Houghton
1258d45152 [Backtracing] Build work.
Additional shimming required for some builds, as well as a few other build
related tweaks.

rdar://106234311
2023-03-04 15:46:30 +00:00
Alastair Houghton
eac93f9d2a [Backtracing][Tests] Apparently we don't see the dyld frame in CI.
For some reason we don't see the dyld frames in CI.  That's fine, don't
check for them.

Also turn NotImportedByDefault off for Windows as it needs a better
shell than the support provided there.
2023-03-04 08:00:09 +00:00
Alastair Houghton
43ac069ad0 [Backtracing] Add control over symbol caching.
Some symbolication frameworks have a symbol cache; we probably don't want
to use that for test cases, to avoid running into problems where the cache
holds stale information.

rdar://105409147
2023-03-04 08:00:09 +00:00
Alastair Houghton
f15011f4d0 [Backtracing] Tweak output slightly.
Fixed the colours so that they work with all of the default Terminal
presets.  Also changed things so that when colour is off, we only use
ASCII characters in our source code displays.

rdar://105452194
2023-03-04 08:00:09 +00:00
Alastair Houghton
65a6aae04e [Backtracing] Add swift-backtrace to the build.
This is Swift's external backtracer.  It's written in Swift, and it's
responsible for generating nice backtraces when Swift programs crash.
It makes use of the new `_Backtracing` library, which is also (mostly,
aside from some assembly language) implemented in Swift.

rdar://103442000
2023-03-04 08:00:09 +00:00