Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,842
    • Issues 4,842
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 457
    • Merge requests 457
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Wiki
  • debugging

Last edited by Sylvain Henry Dec 02, 2021
Page history New page

debugging

Debugging

This part of the wiki collects all the information related to debugging GHC. That includes debugging the compiler itself, the libraries, the runtime system, the code generator, or the build system.

  • If you're debugging a compiler panic or some problem in GHC itself, then go to Debugging/Compiler

  • If the compiled program crashes or panics, then go to Debugging/CompiledCode

  • For debugging the runtime system, see Debugging/RuntimeSystem

  • For debugging when running under GHCi, see Commentary/Compiler/Backends/GHCi

  • Performance debugging.

    • Debugging/ProfilingGhc: Profiling the compiler itself.
    • Debugging/TickyTicky: for debugging performance-related issues in compiled code. Typically for performance debugging of the Simplifier and Core-level optimisations.
    • Debugging/CacheGrind: Identify hot spots with instruction counts per line of GHC source code.
    • Debugging/LowLevelProfiling: way to investigate low-level performance, typically for performance debugging of the code generator or RTS.
    • Debugging/CabalTest: the "Cabal test" for comparing performance of GHC builds
  • Build failures. If you're trying to debug a build failure, then you probably want to look at

    • Building/Troubleshooting: Fixing common problems in a GHC build
    • Building/Modifying: Debugging the build system
  • Use count_lines to count the number of lines of code in the compiler

  • Use compareSizes to compare the sizes of corresponding .o or .hi files in two trees.

  • If know the last good commit, bisection may be useful to identify which commit introduced the bug.


compareSizes

The compareSizes program compares the sizes of corresponding files in two trees:

$ ./compareSizes --hi ~/ghc/darcs/ghc ~/ghc/6.12-branch/ghc
        Size | Change | Filename
      25644 | -0.99% | compiler/stage1/build/Demand.hi
      21103 | -0.98% | compiler/stage2/build/Demand.hi
     180044 | -0.98% | libraries/base/dist-install/build/GHC/Classes.hi
       6415 | -0.58% | .../Data/Array/Parallel/Prelude/Base/Tuple.hi
       6507 | -0.57% | .../Data/Array/Parallel/Prelude/Base/Tuple.hi
   [...]
       3264 |  3.16% | .../Parallel/Unlifted/Sequential/Flat/Enum.hi
      51389 |  3.30% | .../build/Language/Haskell/Extension.hi
       1415 | 72.18% | libraries/base/dist-install/build/Data/Tuple.hi
   28752162 | -0.00% | TOTAL

Flags:

  • --o to compare object files.
  • --hi to compare interface files [DEFAULT]

There's a hack to avoid descending into '*_split' directories.

The source for compareSizes is in $(TOP)/utils/compare_sizes.

Clone repository Edit sidebar

GHC Home
GHC User's Guide

Joining In

Newcomers info
Mailing Lists & IRC
The GHC Team

Documentation

GHC Status Info
Working conventions
Building Guide
Debugging
Commentary

Wiki

Title Index
Recent Changes