[Haskell-cafe] Debugging with gdb?
Svante Signell
svante.signell at telia.com
Wed Apr 13 10:10:15 CEST 2011
Max and Tim,
Thank you for your replies, continuation below.
On Wed, 2011-04-13 at 08:27 +0100, Max Bolingbroke wrote:
> On 13 April 2011 07:59, Svante Signell <svante.signell at telia.com> wrote:
> > As I don't know anything about Haskell, can I make a stupid question: Is
> > there any method to create debug symbols for a Haskell program, and is
> > it possible to debug with gdb?
>
> You cannot create debug symbols. Things that are possible:
>
> 1. You may use the -debug flag to GHC to link with the debug RTS,
> which has full debugging information for GDB. Note that this only lets
> you debug the *RTS*, not any of the code you wrote
>
> 2. Use GDB to debug your Haskell code without giving it any symbols
> or understanding of the Haskell calling conventions. This is very
> difficult. Information on this is on the GHC wiki:
> http://hackage.haskell.org/trac/ghc/wiki/Debugging/CompiledCode?redirectedfrom=DebuggingGhcCrashes
>
> 3. Use the GHCi debugger, which does actually work surprisingly well:
> http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/ghci-debugger.html
The problem is that I'm trying to bootstrap ghc to 6.10.1 using 6.8.2
under Debian GNU/Hurd. Yes, I know these packages are old but so far we
only have a working 6.8.2 version and 6.10.1 is the latest version not
requiring 6.10 to bootstrap. Cross-compiling is another, not yet tested,
alternative. The problem is that the configure step hangs when compiling
the random library, and I've tried a lot of settings, the hang is at the
same place. A stripped down call is:
cd libraries/random:
../cabal-bin /usr/bin/ghc6 ../bootstrapping.conf configure --verbose=3
--with-compiler =../../ghc/stage1-inplace/ghc
--with-hc-pkg=../../utils/ghc-pkg/install-inplace/bin/ghc-pkg
Configuring random-1.0.0.1...
Creating dist (and its parents)
("../../ghc/stage1-inplace/ghc",["--numeric-version"])
../../ghc/stage1-inplace/ghc is version 6.10.1
("../../utils/ghc-pkg/install-inplace/bin/ghc-pkg",["--version"])
../../utils/ghc-pkg/install-inplace/bin/ghc-pkg is version 6.10.1
("../../ghc/stage1-inplace/ghc",["--supported-languages"])
Reading installed packages...
("../../utils/ghc-pkg/install-inplace/bin/ghc-pkg",["dump","--global"])
^C <- hang here!
The last part of the gdb backtrace shows:
#5 0x011d4ce0 in __libc_read (fd=DWARF-2 expression error: DW_OP_reg
operations must be used either alone or in conjuction with DW_OP_piece
or DW_OP_bit_piece.
) at ../sysdeps/mach/hurd/read.c:27
#6 0x084919c8 in s9qJ_ret ()
#7 0x0861f842 in StgRun ()
#8 0x087c44e0 in ?? ()
I assume the calling program is cabal-bin, but no debug symbols are
available. (I have debug versions of libc/gnumach/hurd installed).
Setting a breakpoint in the calling program does not seem to be
possible. Any hints?
More information about the Haskell-Cafe
mailing list