summaryrefslogtreecommitdiff
path: root/docs/users_guide/debugging.rst
Commit message (Collapse)AuthorAgeFilesLines
* Add new flag for unarised STG dumpsÖmer Sinan Ağacan2019-10-231-2/+8
| | | | | | | | | | | | | Previously -ddump-stg would dump pre and post-unarise STGs. Now we have a new flag for post-unarise STG and -ddump-stg only dumps coreToStg output. STG dump flags after this commit: - -ddump-stg: Dumps CoreToStg output - -ddump-stg-unarised: Unarise output - -ddump-stg-final: STG right before code gen (includes CSE and lambda lifting)
* users-guide: Fix links and formats for GHC 8.10Takenobu Tani2019-09-231-1/+1
| | | | | | This commit only fixes links and markdown syntax. [skip ci]
* Add a new flag -dno-typeable-binds for debuggingÖmer Sinan Ağacan2019-09-081-0/+12
| | | | | See the user manual entry -- this helps when debugging as generated Core gets smaller without these bindings.
* Change behaviour of -ddump-cmm-verbose to dump each Cmm pass output to a ↵nineonine2019-07-261-2/+9
| | | | separate file and add -ddump-cmm-verbose-by-proc to keep old behaviour (#16930)
* Add -ddump-stg-final to dump stg as it is used for codegen.klebinger.andreas@gmx.at2019-04-121-0/+5
| | | | | Intermediate STG does not contain free variables which can be useful sometimes. So adding a flag to dump that info.
* Fix #15953 by consistently using dumpIfSet_dyn to print debug outputChaitanya Koparkar2018-11-291-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | Summary: In some modules we directly dump the debugging output to STDOUT via 'putLogMsg', 'printInfoForUser' etc. However, if `-ddump-to-file` is enabled, that output should be written to a file. Easily fixed. Certain tests (T3017, Roles3, T12763 etc.) expect part of the output generated by `-ddump-types` to be in 'PprUser' style. However, generally we want all other debugging output to use 'PprDump' style. `traceTcRn` and `traceTcRnForUser` help us accomplish this. This patch also documents some missing flags in the users guide. Reviewers: RyanGlScott, bgamari, hvr Reviewed By: RyanGlScott Subscribers: rwbarton, carter GHC Trac Issues: #15953 Differential Revision: https://phabricator.haskell.org/D5382
* NCG: New code layout algorithm.Andreas Klebinger2018-11-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements a new code layout algorithm. It has been tested for x86 and is disabled on other platforms. Performance varies slightly be CPU/Machine but in general seems to be better by around 2%. Nofib shows only small differences of about +/- ~0.5% overall depending on flags/machine performance in other benchmarks improved significantly. Other benchmarks includes at least the benchmarks of: aeson, vector, megaparsec, attoparsec, containers, text and xeno. While the magnitude of gains differed three different CPUs where tested with all getting faster although to differing degrees. I tested: Sandy Bridge(Xeon), Haswell, Skylake * Library benchmark results summarized: * containers: ~1.5% faster * aeson: ~2% faster * megaparsec: ~2-5% faster * xml library benchmarks: 0.2%-1.1% faster * vector-benchmarks: 1-4% faster * text: 5.5% faster On average GHC compile times go down, as GHC compiled with the new layout is faster than the overhead introduced by using the new layout algorithm, Things this patch does: * Move code responsilbe for block layout in it's own module. * Move the NcgImpl Class into the NCGMonad module. * Extract a control flow graph from the input cmm. * Update this cfg to keep it in sync with changes during asm codegen. This has been tested on x64 but should work on x86. Other platforms still use the old codelayout. * Assign weights to the edges in the CFG based on type and limited static analysis which are then used for block layout. * Once we have the final code layout eliminate some redundant jumps. In particular turn a sequences of: jne .foo jmp .bar foo: into je bar foo: .. Test Plan: ci Reviewers: bgamari, jmct, jrtc27, simonmar, simonpj, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, trommler, jmct, carter, thomie, rwbarton GHC Trac Issues: #15124 Differential Revision: https://phabricator.haskell.org/D4726
* fix -ddump-asm descriptionAlp Mestanogullari2018-08-301-1/+1
| | | | | | | | | | | | | | Summary: It was missing some words. Test Plan: None (docs only) Reviewers: bgamari, monoidal Reviewed By: monoidal Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5102
* users guide: Mention -fprint-typechecker-elaboration in -ddump-tc docsBen Gamari2018-07-061-2/+5
| | | | | | | | | | Reviewers: mpickering Reviewed By: mpickering Subscribers: mpickering, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4898
* Add -ddump-rtti to user's guide and man pageÖmer Sinan Ağacan2018-06-291-0/+6
| | | | | | | | Reviewers: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4903
* Explain why opt-cmm is not dumped by ddump-cmm-verbose.klebinger.andreas@gmx.at2018-06-221-3/+5
| | | | | | | | | | | | | | | | | | We just update the docs to reflect the state of affairs. opt-cmm is run by the NCG backend so not always run. ddump-cmm-verbose only dumps passes of the cmm pipeline so it's not included there. [skip-ci] Test Plan: doc change Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4879
* Typofixes in docs and comments [ci skip]Gabor Greif2018-06-181-2/+2
|
* Fix documentation for `-dth-dec-file`Nathan Collins2018-06-151-3/+4
| | | | | The docs said that it took a file argument, as in `-dth-dec-file=<file>`, but it does not take a file argument!
* Document the fact that cmm dumps won't show unreachable blocks.klebinger.andreas@gmx.at2018-06-041-0/+3
| | | | | | | | | | Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4788
* Allow aligning of cmm procs at specific boundryklebinger.andreas@gmx.at2018-06-031-0/+11
| | | | | | | | | | | | | | | | | | | | Allows to align CmmProcs at the given boundries. It makes performance usually worse but can be helpful to limit the effect of a unrelated function B becoming faster/slower after changing function A. Test Plan: ci, using it. Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15148 Differential Revision: https://phabricator.haskell.org/D4706
* vectorise: Put it out of its miseryBen Gamari2018-06-021-13/+0
| | | | | | | | | | | | | | | | | | | | | Poor DPH and its vectoriser have long been languishing; sadly it seems there is little chance that the effort will be rekindled. Every few years we discuss what to do with this mass of code and at least once we have agreed that it should be archived on a branch and removed from `master`. Here we do just that, eliminating heaps of dead code in the process. Here we drop the ParallelArrays extension, the vectoriser, and the `vector` and `primitive` submodules. Test Plan: Validate Reviewers: simonpj, simonmar, hvr, goldfire, alanz Reviewed By: simonmar Subscribers: goldfire, rwbarton, thomie, mpickering, carter Differential Revision: https://phabricator.haskell.org/D4761
* users-guide: Fix various issues in debugging flags sectionBen Gamari2018-05-301-8/+6
| | | | | | | | | | Reviewers: ggreif Reviewed By: ggreif Subscribers: rwbarton, thomie, carter, ggreif Differential Revision: https://phabricator.haskell.org/D4750
* Typofix in manual [ci skip]Gabor Greif2018-05-291-1/+1
|
* Add new debugging flag -dinline-checkBen Gamari2018-03-251-0/+14
| | | | | | | | | | | | | | | | | | | | | | | This flag reports a summary of the inlining decision for identifiers prefixed by the flag's argument. For example, `-dinline-check foo` will report why definitions whose prefix is `foo` are inlined or not. Previously the only way to get this information was to pass a combination of `-dverbose-core2core` and `-ddump-inlinings`. This combination led to a log of 12 million lines in a module of about 200 lines I recently had to apply it to. This flag provides a much more direct way to find the occurence you care about. Reviewers: osa1, dfeuer, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4458
* Implement -dword-hex-literalsAndrew Martin2018-03-191-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Provide flag for showing showing Word# and Word64# as hexadecimal when dumping GHC core. The only affects Word, not Int, and it prefixes the hexadecimal with enough zeroes to make the total character count a power of two. For example: - 0x0C0C instead of 0xC0C - 0x00BA00BA instead of 0xBA00BA This also affects the presentation of Word# and Word64# in GHC's error messages. It is not expected that the flag will be used for this, but it is a side-effect worth noting. Test Plan: none Reviewers: bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, mpickering, rwbarton, thomie, carter, andrewthad GHC Trac Issues: #14872 Differential Revision: https://phabricator.haskell.org/D4465
* Introduce the flag -dsuppress-timestamps to avoid timestamps in dumps.Andreas Klebinger2018-02-251-1/+8
| | | | | | | | | | | | | | | | | This makes it easier to diff dumps which are otherwise identical. Also updated the description of -dsuppress-all as parts of these also apply to stages other than core. Test Plan: Looking at dump result. Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4429
* StgLint overhaulÖmer Sinan Ağacan2018-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove all type checks - Check two STG invariants (no unboxed let bindings, variables defined before used) and post-unarisation invariants. See the module header and #14787. This version validates with `-dstg-lint` added to `GhcStage2HcOpts` and `GhcLibHcOpts` and `EXTRA_HC_OPTS`. Unarise changes: - `unariseConArgBinder` and `unariseFunArgBinder` functions were almost the same; only difference was when unarising fun args we keep void args while in con args we drop them. A new function `unariseArgBinder` added with a `Bool` argument for whether we're unarising a con arg. `unariseConArgBinder` and `unariseFunArgBinder` are now defined as unariseConArgBinder = unarsieArgBinder True -- data con unariseFunArgBinder = unariseArgBinder False -- not data con - A bug in `unariseConArgBinder` and `unariseFunArgBinder` (which are just calls to `unariseArgBinder` now) that invalidated the post-unarise invariants when the argument has single type rep (i.e. `length (typePrimRep x) == 1`) fixed. This isn't a correctness issue (it's fine not to unarise if a variable is already represented as single value), but it triggers StgLint. Test Plan: - Pass testsuite with `-dstg-lint` [done] - Boot stage2 (including libraries) with `-dstg-lint` [done] Reviewers: simonpj, bgamari Reviewed By: bgamari Subscribers: duog, rwbarton, thomie, carter GHC Trac Issues: #14787 Differential Revision: https://phabricator.haskell.org/D4404
* Add -ddump-ds-preoptSimon Peyton Jones2018-02-011-3/+8
| | | | | | | | | | | | | This allows you to see the output immediately after desugaring but before any optimisation. I've wanted this for some time, but I was triggered into action by Trac #13032 comment:9. Interestingly, the change means that with -dcore-lint we will now Lint the output before the very simple optimiser; and this showed up Trac #14749. But that's not the fault of -ddump-ds-preopt!
* Rename -frule-check to -drule-check and documentMatthew Pickering2018-01-151-0/+13
| | | | | | | | | | Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4256
* Prevent "C--" translating to "C–" in the User's Guide.Steven Shaw2018-01-021-34/+34
| | | | i.e. escape "--" so that it doesn't translate to an "en dash".
* Document -ddump-timingsBen Gamari2017-11-161-0/+5
|
* Introduce -dsuppress-stg-free-vars flagBen Gamari2017-11-021-0/+12
| | | | | | | | | | | | | | This breaks out control over STG free variable list output from -dppr-debug into its own distinct flag. This makes it more discoverable and easier to change independently from other dump output. Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4140
* Add -falignment-sanitization flagBen Gamari2017-10-291-0/+7
| | | | | | | | | | | | | | | | | | | Here we add a flag to instruct the native code generator to add alignment checks in all info table dereferences. This is helpful in catching pointer tagging issues. Thanks to @jrtc27 for uncovering the tagging issues on Sparc which inspired this flag. Test Plan: Validate Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: rwbarton, trofi, thomie, jrtc27 Differential Revision: https://phabricator.haskell.org/D4101
* Manual: The -ddump-cmm-* flags had a wrong spelling in the manualJoachim Breitner2017-10-281-10/+22
|
* Fix grammaros in commentsGabor Greif2017-10-171-1/+1
|
* users-guide: Clarify -ddump-asm-regalloc-stages documentationBen Gamari2017-10-161-2/+4
| | | | [skip ci]
* users guide: Eliminate redundant :category: tags in debugging.rstBen Gamari2017-10-161-85/+4
| | | | The categories in this file are defined in flags.py.
* users-guide: Rework and finish debug flag documentationBen Gamari2017-10-161-267/+429
| | | | | | This documentation was incomplete and not terribly well organized. Given that I've spent a lot of time searching through this page, I figured it is perhaps worth it to clean it up a bit.
* DynFlags: Add inverse of -dno-debug-outputBen Gamari2017-08-221-0/+1
| | | | | | | | | | Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #14142 Differential Revision: https://phabricator.haskell.org/D3876
* users_guide: Convert mkUserGuidePart generation to a Sphinx extensionPatrick Dougherty2017-08-181-7/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes all dependencies the users guide had on `mkUserGuidePart`. The generation of the flag reference table and the various pieces of the man page is now entirely contained within the Spinx extension `flags.py`. You can see the man page generation on the orphan page https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghc.html The extension works by collecting all of the meta-data attached to the `ghc-flag` directives and then formatting and displaying it at `flag-print` directives. There is a single printing directive that can be customized with two options, what format to display (table, list, or block of flags) and an optional category to limit the output to (verbosity, warnings, codegen, etc.). New display formats can be added by creating a function `generate_flag_xxx` (where `xxx` is a description of the format) which takes a list of flags and a category and returns a new `xxx`. Then just add a reference in the dispatch table `handlers`. That display can now be run by passing `:type: xxx` to the `flag-print` directive. `flags.py` contains two maps of settings that can be adjusted. The first is a canonical list of flag categories, and the second sets default categories for files. The only functionality that Sphinx could not replace was the `what_glasgow_exts_does.gen.rst` file. `mkUserGuidePart` actually just reads the list of flags from `compiler/main/DynFlags.hs` which Sphinx cannot do. As the flag is deprecated, I added the list as a static file which can be updated manually. Additionally, this patch updates every single documented flag with the data from `mkUserGuidePart` to generate the reference table. Fixes #11654 and, incidentally, #12155. Reviewers: austin, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #11654, #12155 Differential Revision: https://phabricator.haskell.org/D3839
* users-guide: Standardize and repair all flag referencesPatrick Dougherty2017-07-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does three things: 1.) It simplifies the flag parsing code in `conf.py` to properly display flag definitions created by `.. (ghc|rts)-flag::`. Additionally, all flag references must include the associated arguments. Documentation has been added to `editing-guide.rst` to explain this. 2.) It normalizes all flag definitions to a similar format. Notably, all instances of `<>` have been replaced with `⟨⟩`. All references across the users guide have been updated to match. 3.) It fixes a couple issues with the flag reference table's generation code, which did not handle comma separated flags in the same cell and did not properly reference flags with arguments. Test Plan: `SPHINXOPTS = -n` to activate "nitpicky" mode, which reports all broken references. All remaining errors are references to flags without any documentation. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13980 Differential Revision: https://phabricator.haskell.org/D3778
* Introduce -fcatch-bottomsBen Gamari2017-07-201-0/+7
| | | | | | | | | | | | | | | This flag instructs the simplifier to emit ``error`` expressions in the continutation of empty case analyses (which should bottom and consequently not return). This is helpful when debugging demand analysis bugs which can sometimes manifest as segmentation faults. Test Plan: Validate Reviewers: simonpj, austin Subscribers: niteria, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3736
* Change -dppr-ticks to -dsuppress-ticksSimon Peyton Jones2017-02-201-4/+4
| | | | | | | | | | | | | | | | I spent about two hours today hunting fruitlessly for a simplifier bug (when fixing Trac #13255), only to find that it was caused by -ddump-X silently suppressing all ticks in Core. I think this has happened to me once before. So I've changed to make tick-printing on by default (like coercions, etc), with a flag -dsuppress-ticks (like -dsuppress-coercions) to suppress them. Blargh. -dppr-ticks is still there, but deprecated.
* Add dump flags for the renamed and typechecked hsSyn ASTsAlan Zimmerman2017-02-081-0/+8
| | | | | | | | | | | | | | | | | Summary: D2958 brought in the "dump-parsed-ast" functionality. Extend it to include "dump-rn-ast" and "dump-tc-ast" Test Plan: ./validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3107
* users-guide: Explain behavior of verbose-core2core + dump-inliningsBen Gamari2017-02-021-1/+3
|
* Add a flag to emit error messages as JSONMatthew Pickering2017-01-301-0/+6
| | | | | | | | | | | | | | | | | | | | | This patch adds the flag `-ddump-json` which dumps all the compiler output as a JSON array. This allows tooling to more easily parse GHC's output to display to users. The flag is currently experimental and will hopefully be refined for the next release. In particular I have avoided any changes which involve significant refactoring and provided what is easy given the current infrastructure. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: DanielG, gracjan, thomie Differential Revision: https://phabricator.haskell.org/D3010 GHC Trac Issues: #13190
* users-guide: Document -dppr-ticksBen Gamari2017-01-231-0/+5
|
* Add dump-parsed-ast flag and functionalityAlan Zimmerman2017-01-151-0/+4
| | | | | | | | | | | | | | | | | | Summary: This flag causes a dump of the ParsedSource as an AST in textual form, similar to the ghc-dump-tree on hackage. Test Plan: ./validate Reviewers: mpickering, bgamari, austin Reviewed By: mpickering Subscribers: nominolo, thomie Differential Revision: https://phabricator.haskell.org/D2958 GHC Trac Issues: #11140
* Add tracing infrastructure to pattern match checkerMatthew Pickering2016-11-061-0/+5
| | | | | | | | | | | | | | | | Summary: This is the start of some tracing infrastructure which I found useful when working through how the pattern match checker worked. It adds the flag -ddump-ec-trace in order to turn on the trace. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2658
* CodeGen: Way to dump cmm only once (#11717)Vladimir Trubilov2016-07-171-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | The `-ddump-cmm` put all stages of Cmm processing into one output. This patch changes its behavior and adds two more options to make Cmm dumping flexible. - `-ddump-cmm-from-stg` dumps only initial version of Cmm right after STG->Cmm codegen - `-ddump-cmm` dumps the final result of the Cmm pipeline processing - `-ddump-cmm-verbose` dumps intermediate output of each Cmm pipeline step - `-ddump-cmm-proc` and `-ddump-cmm-caf` seems were lost. Now enabled Test Plan: ./validate Reviewers: thomie, simonmar, austin, bgamari Reviewed By: thomie, simonmar Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2393 GHC Trac Issues: #11717
* ErrUtils: Add timings to compiler phasesBen Gamari2016-03-241-1/+9
| | | | | | | | | | | | | | | | | | | | | | | This adds timings and allocation figures to the compiler's output when run with `-v2` in an effort to ease performance analysis. Todo: * Documentation * Where else should we add these? * Perhaps we should remove some of the now-arguably-redundant `showPass` occurrences where they are * Must we force more? * Perhaps we should place this behind a `-ftimings` instead of `-v2` Test Plan: `ghc -v2 Test.hs`, look at the output Reviewers: hvr, goldfire, simonmar, austin Reviewed By: simonmar Subscribers: angerman, michalt, niteria, ezyang, thomie Differential Revision: https://phabricator.haskell.org/D1959
* Make warning names more consistentManav Rathi2016-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replace "Sigs" with "Signatures" in WarningFlag data constructors. - Replace "PatSyn" with "PatternSynonym" in WarningFlag data constructors. - Deprecate "missing-local-sigs" in favor of "missing-local-signatures". - Deprecate "missing-exported-sigs" in favor of "missing-exported-signatures". - Deprecate "missing-pat-syn-signatures" in favor of "missing-pattern-synonym-signatures". - Replace "ddump-strsigs" with "ddump-str-signatures" These complete the tasks that were explicitly mentioned in #11583 Test Plan: Executed `ghc --show-options` and verified that the flags were changed as expected. Reviewers: svenpanne, austin, bgamari Reviewed By: austin, bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D1939 GHC Trac Issues: #11583
* Docs: -keep-llvm-file(s)/-ddump-llvm imply -fllvmThomas Miedema2016-02-221-0/+2
| | | | This fixes #9917.
* Document -fllvm-fill-undef-with-garbageBen Gamari2016-01-271-0/+6
|
* user-guide: Use ghc-flag for dump formatting flagsBen Gamari2016-01-141-13/+9
| | | | And document -dth-dec-file. Not sure how these were missed.