| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-g1 removes block information, but it turns out that procs can
refer to block information through parents.
Note [Splitting DebugBlocks] explains the parentage relationship.
Test Plan:
* ./validate
* added a new test
Reviewers: bgamari, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14894
Differential Revision: https://phabricator.haskell.org/D4496
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This switches the compiler/ component to get compiled with
-XNoImplicitPrelude and a `import GhcPrelude` is inserted in all
modules.
This is motivated by the upcoming "Prelude" re-export of
`Semigroup((<>))` which would cause lots of name clashes in every
modulewhich imports also `Outputable`
Reviewers: austin, goldfire, bgamari, alanz, simonmar
Reviewed By: bgamari
Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari
Differential Revision: https://phabricator.haskell.org/D3989
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This copies the subset of Hoopl's functionality needed by GHC to
`cmm/Hoopl` and removes the dependency on the Hoopl package.
The main motivation for this change is the confusing/noisy interface
between GHC and Hoopl:
- Hoopl has `Label` which is GHC's `BlockId` but different than
GHC's `CLabel`
- Hoopl has `Unique` which is different than GHC's `Unique`
- Hoopl has `Unique{Map,Set}` which are different than GHC's
`Uniq{FM,Set}`
- GHC has its own specialized copy of `Dataflow`, so `cmm/Hoopl` is
needed just to filter the exposed functions (filter out some of the
Hoopl's and add the GHC ones)
With this change, we'll be able to simplify this significantly.
It'll also be much easier to do invasive changes (Hoopl is a public
package on Hackage with users that depend on the current behavior)
This should introduce no changes in functionality - it merely
copies the relevant code.
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate
Reviewers: austin, bgamari, simonmar
Reviewed By: bgamari, simonmar
Subscribers: simonpj, kavon, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3616
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
And use to mark `stg_stack_underflow_frame`, which we are unable to
determine a caller from.
To simplify parsing at the moment we steal the `return` keyword to
indicate an undefined unwind value. Perhaps this should be revisited.
Reviewers: scpmw, simonmar, austin, erikd
Subscribers: dfeuer, thomie
Differential Revision: https://phabricator.haskell.org/D2738
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As discussed in D1532, Trac Trac #11337, and Trac Trac #11338, the stack
unwinding information produced by GHC is currently quite approximate.
Essentially we assume that register values do not change at all within a
basic block. While this is somewhat true in normal Haskell code, blocks
containing foreign calls often break this assumption. This results in
unreliable call stacks, especially in the code containing foreign calls.
This is worse than it sounds as unreliable unwinding information can at
times result in segmentation faults.
This patch set attempts to improve this situation by tracking unwinding
information with finer granularity. By dispensing with the assumption of
one unwinding table per block, we allow the compiler to accurately
represent the areas surrounding foreign calls.
Towards this end we generalize the representation of unwind information
in the backend in three ways,
* Multiple CmmUnwind nodes can occur per block
* CmmUnwind nodes can now carry unwind information for multiple
registers (while not strictly necessary; this makes emitting
unwinding information a bit more convenient in the compiler)
* The NCG backend is given an opportunity to modify the unwinding
records since it may need to make adjustments due to, for instance,
native calling convention requirements for foreign calls (see
#11353).
This sets the stage for resolving #11337 and #11338.
Test Plan: Validate
Reviewers: scpmw, simonmar, austin, erikd
Subscribers: qnikst, thomie
Differential Revision: https://phabricator.haskell.org/D2741
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In the past the canonical way for constructing an SDoc string literal was the
composition `ptext . sLit`. But for some time now we have function `text` that
does the same. Plus it has some rules that optimize its runtime behaviour.
This patch takes all uses of `ptext . sLit` in the compiler and replaces them
with calls to `text`. The main benefits of this patch are clener (shorter) code
and less dependencies between module, because many modules now do not need to
import `FastString`. I don't expect any performance benefits - we mostly use
SDocs to report errors and it seems there is little to be gained here.
Test Plan: ./validate
Reviewers: bgamari, austin, goldfire, hvr, alanz
Subscribers: goldfire, thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1784
|
|
|
|
|
|
|
|
| |
In order to accomplish this we need to ensure that emit DIEs for all
DebugBlocks, even those that have been optimized out, lest we end up
with undefined symbols of parents at link time.
Differential Revision: https://phabricator.haskell.org/D1279
|
|
|
|
| |
Differential Revision: https://phabricator.haskell.org/D1387
|
|
|
|
|
|
|
|
|
| |
We now only strip block information from DebugBlocks when compiling with
`-g1`, intended to be used when only minimal debug information is
desired. `-g2` is assumed when `-g` is passed without any integer
argument.
Differential Revision: https://phabricator.haskell.org/D1281
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a flag -split-sections that does similar things to
-split-objs, but using sections in single object files instead of
relying on the Satanic Splitter and other abominations. This is very
similar to the GCC flags -ffunction-sections and -fdata-sections.
The --gc-sections linker flag, which allows unused sections to actually
be removed, is added to all link commands (if the linker supports it) so
that space savings from having base compiled with sections can be
realized.
Supported both in LLVM and the native code-gen, in theory for all
architectures, but really tested on x86 only.
In the GHC build, a new SplitSections variable enables -split-sections
for relevant parts of the build.
Test Plan: validate with both settings of SplitSections
Reviewers: dterei, Phyx, austin, simonmar, thomie, bgamari
Reviewed By: simonmar, thomie, bgamari
Subscribers: hsyl20, erikd, kgardas, thomie
Differential Revision: https://phabricator.haskell.org/D1242
GHC Trac Issues: #8405
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Check with `readelf --debug-dump=ranges`
Reviewers: scpmw, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1174
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some libraries (e.g. elfutils) need these otherwise they ignore our
DWARF annotations.
Test Plan: Test with elfutils' `readelf --debug-dump=cu_index`
Reviewers: scpmw, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1173
|
|
|
|
|
|
|
| |
Fortunately this is relatively straightforward - all we need to do is
switch to a non-ELF-specific way of specifying object file sections and
make sure that section-relative addresses work correctly. This is enough
to make "gdb" work on MinGW builds.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While we want to reduce the amount of information generated into
debug_info, it really doesn't make sense to remove block information
for unwinding.
This is a simple oversight introduced in 4ab57024, which severly
reduces the usefulness of generated unwind data. Thanks to bitonic
for spotting this!
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D792
GHC Trac Issues: #10236
|
|
|
|
|
|
|
|
|
| |
- Don't bracket HsTick expression uneccessarily
- Generate debug information in UTF8
- Reduce amount of information generated - we do not currently need
block information, for example.
Special thanks to slyfox for the reports!
|
|
|
|
|
|
|
|
| |
- Make abbrev offset absolute on Non-Mac systems
- Add another termination byte at the end of the abbrev section
(readelf complains)
- Scope combination was wrong for the simpler cases
- Shouldn't have a "global/" in front of all scopes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tells debuggers such as GDB how to "unwind" a program state,
which allows them to walk the stack up.
Notes:
* The code is quite general, perhaps unnecessarily so. Unless we get
more unwind information, only the first case of pprSetUnwind will
get used - and pprUnwindExpr and pprUndefUnwind will never be
called. It just so happens that this is a point where we can get a
lot of features cheaply, even if we don't use them.
* When determining what location to show for a return address, most
debuggers check the map for "rip-1", assuming that's where the
"call" instruction is. For tables-next-to-code, that happens to
always be the end of an info table. We therefore cheat a bit here by
shifting .debug_frame information so it covers the end of the info
table, as well as generating a .loc directive for the info table
data.
Debuggers will still show the wrong label for the return address,
though. Haven't found a way around that one yet.
(From Phabricator D396)
|
|
This is where we actually make GHC emit DWARF code. The info section
contains all the general meta information bits as well as an entry for
every block of native code.
Notes:
* We need quite a few new labels in order to properly address starts
and ends of blocks.
* Thanks to Nathan Howell for taking the iniative to get our own Haskell
language ID for DWARF!
(From Phabricator D396)
|