Assuming you already know what ghc-debug
is about, and want to use it to debug the ghc
program itself.
A recent ghc-debug
checkout is required, since it contains important fixes not release on Hackage yet.
Apply the following patch:
diff --git a/compiler/GHC/SysTools/Terminal.hs b/compiler/GHC/SysTools/Terminal.hs | |
index a3f60e24363..809079b4aea 100644 | |
--- a/compiler/GHC/SysTools/Terminal.hs | |
+++ b/compiler/GHC/SysTools/Terminal.hs | |
@@ -20,10 +20,10 @@ import System.IO.Unsafe | |
#if defined(mingw32_HOST_OS) && !defined(WINAPI) | |
# if defined(i386_HOST_ARCH) | |
# define WINAPI stdcall | |
-# elif defined(x86_64_HOST_ARCH) | |
+# elif defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH) |
{-# LANGUAGE MagicHash #-} | |
{-# LANGUAGE UnboxedTuples #-} | |
{-# OPTIONS_GHC -feager-blackholing #-} | |
module Spark | |
( spark, | |
sparkST, | |
sparkList, | |
) | |
where |
-Wimplicit | |
-include | |
rts/include/ghcversion.h | |
-Irts/include | |
-I_build/stage1/rts/build | |
-I_build/stage1/rts/build/include | |
-Irts/include | |
-I_build/stage1/rts/build | |
-Irts | |
-I_build/stage1/rts/build |
diff --git a/Makefile b/Makefile | |
index 18d664f..6e59274 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -51,8 +51,8 @@ default: build | |
@echo "Use -fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION)" | |
check: | |
- CC="clang --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot -fno-strict-aliasing -msimd128 -mnontrapping-fptoint -msign-ext -mbulk-memory -mmutable-globals -mmultivalue -mreference-types -Xclang -target-abi -Xclang experimental-mv" \ | |
- CXX="clang++ --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot -fno-exceptions -fno-exceptions -fno-strict-aliasing -msimd128 -mnontrapping-fptoint -msign-ext -mbulk-memory -mmutable-globals -mmultivalue -mreference-types -Xclang -target-abi -Xclang experimental-mv" \ |
#!/bin/sh | |
git update-ref -d refs/notes/perf | |
git notes prune | |
rmdir .git/logs/refs/notes |
allow-newer: | |
all:Cabal, | |
all:Cabal-syntax, | |
all:array, | |
all:base, | |
all:binary, | |
all:bytestring, | |
all:containers, | |
all:deepseq, | |
all:directory, |
#!/usr/bin/env bash | |
set -euo pipefail | |
apt update | |
apt install -y automake build-essential curl git gnupg libffi-dev libncurses-dev libgmp-dev python3 libdw-dev | |
curl -f -L --retry 5 https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm-snapshot.gpg | |
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/bullseye llvm-toolchain-bullseye main" >> /etc/apt/sources.list.d/llvm-toolchain.list | |
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/bullseye llvm-toolchain-bullseye-18 main" >> /etc/apt/sources.list.d/llvm-toolchain.list |
Wrong exit code for T24171()(expected 0 , actual 2 ) | |
Stderr run ( T24171 ): | |
main: internal error: LDV_recordDead: Failed to find counter for closure 0x42004fd028 | |
(GHC version 9.9.20240111 for x86_64_unknown_linux) | |
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug | |
gmake[1]: *** [Makefile:8: build_and_run] Aborted (core dumped) | |
gmake: *** [Makefile:5: clean_build_and_run] Error 2 | |
*** unexpected failure for T24171(normal) |
Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts and experience preferred (super rare at this point).