Skip to content

Trying out bytecode artefacts#337

Draft
Saizan wants to merge 1 commit into
masterfrom
artefacts
Draft

Trying out bytecode artefacts#337
Saizan wants to merge 1 commit into
masterfrom
artefacts

Conversation

@Saizan

@Saizan Saizan commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

added test/golden/artefacts with a simple exe depending on lib project to try them out.

We set these flags to have bytecode libs and .gbc files.
-- cabal.project

packages: .
library-bytecode: True
package artefacts
  ghc-options: -fbyte-code-and-object-code -fwrite-byte-code -fwrite-interface 

@Saizan

Saizan commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

AFAICT both hdb and ghc --interactive

  1. pick up on previously generated .gbc files and can work with breakpoints in those files.
  2. refuse to set breakpoints in bytecode libraries because :break/break looks for modules in the HUG.

[1]

host:~/haskell-debugger/test/golden/artefacts$ cabal repl app/Main.hs
Resolving dependencies...
Build profile: -w ghc-10.1.20260617 -O1
In order, the following will be built (use -v for more details):
 - artefacts-0.1.0.0 (lib) (first run)
 - artefacts-0.1.0.0 (interactive) (exe:e) (first run)
Configuring library for artefacts-0.1.0.0...
Preprocessing library for artefacts-0.1.0.0...
Building library for artefacts-0.1.0.0...
[1 of 1] Compiling MyLib            ( lib/MyLib.hs, dist-newstyle/build/x86_64-linux/ghc-10.1.20260617/artefacts-0.1.0.0/build/MyLib.o, dist-newstyle/build/x86_64-linux/ghc-10.1.20260617/artefacts-0.1.0.0/build/MyLib.dyn_o, dist-newstyle/build/x86_64-linux/ghc-10.1.20260617/artefacts-0.1.0.0/build/MyLib.gbc )
Configuring executable 'e' for artefacts-0.1.0.0...
Preprocessing executable 'e' for artefacts-0.1.0.0...
GHCi, version 10.1.20260617: https://www.haskell.org/ghc/  :? for help
Using language edition: Haskell2010
[1 of 2] Compiling Main             ( app/Main.hs, dist-newstyle/build/x86_64-linux/ghc-10.1.20260617/artefacts-0.1.0.0/x/e/build/e/e-tmp/Main.gbc )[artefacts-0.1.0.0-inplace-e]
Ok, one module loaded.
ghci> 
Leaving GHCi.
host:~/haskell-debugger/test/golden/artefacts$ cabal repl app/Main.hs
Build profile: -w ghc-10.1.20260617 -O1
In order, the following will be built (use -v for more details):
 - artefacts-0.1.0.0 (interactive) (exe:e) (first run)
Preprocessing executable 'e' for artefacts-0.1.0.0...
GHCi, version 10.1.20260617: https://www.haskell.org/ghc/  :? for help
Using language edition: Haskell2010
Ok, one module loaded.
ghci> :break Main 8
Breakpoint 0 activated at app/Main.hs:8:3-7
ghci> main
Stopped in Main.main, app/Main.hs:8:3-7
_result :: IO () = _
x :: String = _
[app/Main.hs:8:3-7] ghci> 

[2]

ghci> :break lib/MyLib.hs 3
Cannot set breakpoint on ‘lib/MyLib.hs’: ‘lib/MyLib’ not in scope
ghci> :break MyLib 3
module 'MyLib' is from another package;
this command requires an interpreted module
ghci> 

@Saizan

Saizan commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

Panic with object-code + byte-code + break-points

$ ghci -iapp -ilib -fobject-code -fbyte-code-and-object-code -fbreak-points -outputdir=dump app/Main.hs
GHCi, version 10.1.20260617: https://www.haskell.org/ghc/ :? for help
Using default language edition: GHC2024
[1 of 3] Compiling MyLib ( lib/MyLib.hs, dump/MyLib.o, lib/MyLib.gbc )[main]
[2 of 3] Compiling Main ( app/Main.hs, dump/Main.o, app/Main.gbc )[main]
Ok, two modules loaded.
ghci> :break app/Main.hs 8
Cannot set breakpoint on ‘app/Main.hs’: ‘app/Main’ not in scope
ghci> :break Main 8
panic! (the 'impossible' happened)
GHC version 10.1.20260617:
getTickArray

Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug

ghci>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant