Re: [Haskell-cafe] Debugging with gdb?

2011-04-13 Thread Svante Signell
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  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?


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Debugging with gdb?

2011-04-13 Thread Svante Signell
Hi,

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?

Thanks!


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghc6: Re: Update: ... compiling ghc6

2011-04-12 Thread Svante Signell
On Mon, 2011-04-11 at 00:42 +0200, Svante Signell wrote:
> Addressing both Haskell and Hurd people here. Any hints by anyone?
> 
> On Wed, 2011-04-06 at 09:30 +0200, Svante Signell wrote:
> ...
> > #5  0x011d3ce0 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 ?? ()
> 
> Looking into this further, this looks like an error. What does it mean?
> from eglibc-2.11.2/sysdeps/mach/hurd/read.c
> 
> /* Read NBYTES into BUF from FD.  Return the number read or -1.  */
> ssize_t
> __libc_read (int fd, void *buf, size_t nbytes)
> {
>   error_t err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf,
> &nbytes, -1));
>   return err ? __hurd_dfail (fd, err) : nbytes;
> }

Could not find any reference to __libc_read in either gnumach or hurd
code. The only place was in the binary file
hurd-20110319/ext2fs/ext2fs.static, but I assume this comes from a
linkage with libc. Is the calling function in the Haskell cabal-bin
binary linked with libc0.3 (and other libs)? How to enable debugging for
Haskell binaries with gdb?


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ghc6: Re: Update: ... compiling ghc6

2011-04-10 Thread Svante Signell
Addressing both Haskell and Hurd people here. Any hints by anyone?

On Wed, 2011-04-06 at 09:30 +0200, Svante Signell wrote:
...
> #5  0x011d3ce0 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 ?? ()

Looking into this further, this looks like an error. What does it mean?
from eglibc-2.11.2/sysdeps/mach/hurd/read.c

/* Read NBYTES into BUF from FD.  Return the number read or -1.  */
ssize_t
__libc_read (int fd, void *buf, size_t nbytes)
{
  error_t err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf,
&nbytes, -1));
  return err ? __hurd_dfail (fd, err) : nbytes;
}


The call is from the haskell binary cabal-bin but I don't have any debug
info from that executable. Anybody fluent in Haskell? 

(How to get debug info in Haskell with gdb?)

Below is the (stripped-down) call and the source code cabal-bin.hs:
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


module Main (main) where

import Control.Monad
import Data.Maybe
import Distribution.PackageDescription
import Distribution.PackageDescription.Parse
import Distribution.Simple
import Distribution.Simple.Utils
import Distribution.Verbosity
import System.Directory
import System.Environment
import System.FilePath

import qualified Distribution.Make   as Make
import qualified Distribution.Simple as Simple

setupProg :: FilePath
setupProg = "./Setup"

main :: IO ()
main = do
unprocessedArgs <- getArgs
let verbosity = verbose
case unprocessedArgs of
ghc : packageConf : args ->
doit verbosity ghc packageConf args
_ -> die "Bad args"

doit :: Verbosity -> FilePath -> FilePath -> [String] -> IO ()
doit verbosity ghc packageConf args = do
exists <- doesFileExist setupProg
if exists then rawSystemExit verbosity setupProg args
  else do
gpdFile <- defaultPackageDesc verbosity
gpd <- readPackageDescription verbosity gpdFile
let pd = packageDescription gpd
case buildType pd of
  Just Simple-> Simple.defaultMainArgs args
  Just Make  -> Make.defaultMainArgs   args
  Just Configure -> defaultMainWithHooksArgs autoconfUserHooks args
_ | packageName pd == PackageName "Cabal" ->
  -- Cabal is special...*sigh*
 Simple.defaultMainArgsargs
  | otherwise  -> runSetup verbosity ghc packageConf   args

runSetup :: Verbosity -> FilePath -> FilePath -> [String] -> IO ()
runSetup verbosity ghc packageConf args = do
-- Don't bother building Setup if we are cleaning. If we need to
-- build Setup in order to build, and Setup isn't built already,
-- then there shouldn't be anything to clean anyway.
unless cleaning $
rawSystemExit verbosity ghc ["-package-conf", packageConf,
 "--make", "Setup", "-o", "Setup"]
rawSystemExit verbosity "./Setup" args
  where cleaning = case args of
   "clean" : _ -> True
   _ -> False




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problems porting ghc6-6.10.1 to GNU/Hurd using 6.8.2

2011-04-05 Thread Svante Signell
On Tue, 2011-04-05 at 09:43 +0200, Svante Signell wrote:
> Hi,
> 
> I'm currently trying to upgrade Debian GNU/Hurd ghc6.8.2 to 6.10.1 (and
> further from there, due to requirements of ghc and haddock versions),
> and get stuck on configuring the random-1.0.0.1 library in stage1. I
> have tried versions of ghc6 are 6.10.1+dfsg1-1 to 6.10.1+dfsg1-5 (the
> latest not requiring ghc6.10 due to haddock 2.4.2). The commands are
> shown below: (added the -verbose=3 parameter)
...
> Output:
> ===
> 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"])
> 
> Hangs here!
> 
> Running manually works OK!!
> $pwd/utils/ghc-pkg/install-inplace/bin/ghc-pkg --global-conf 
> $pwd/inplace-datadir/./package.conf "dump" "--global"
> 
> Gives a lot of output here...
> 
> Below is the ghc-pkg script:
> 
> cat $pwd/utils/ghc-pkg/install-inplace/bin/ghc-pkg
> PKGCONF=$pwd/inplace-datadir/./package.conf
> exec $pwd/utils/ghc-pkg/install-inplace/libexec/ghc-pkg --global-conf 
> $PKGCONF ${1+"$@"}
> 
> I've tried changing the shell from dash to bash but no changes. I also
> tried to escape some of the variables in the gkc-pkg shell script but
> without any luck.
> 
> Anybody can help me here??

Any pointers, or ideas how to make some progress. Other mailing lists?
It hangs at the same place independent of settings. like splitobjs,
profile or not, etc.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Problems porting ghc6-6.10.1 to GNU/Hurd using 6.8.2

2011-04-05 Thread Svante Signell
Hi,

I'm currently trying to upgrade Debian GNU/Hurd ghc6.8.2 to 6.10.1 (and
further from there, due to requirements of ghc and haddock versions),
and get stuck on configuring the random-1.0.0.1 library in stage1. I
have tried versions of ghc6 are 6.10.1+dfsg1-1 to 6.10.1+dfsg1-5 (the
latest not requiring ghc6.10 due to haddock 2.4.2). The commands are
shown below: (added the -verbose=3 parameter)

cd ghc6-6.10.1+dfsg1/libraries

(sorry for the missing \ due to cut-and-paste to the mailer)

( cd random && /home/srs/DEBs/ghc/ghc6-6.10.1+dfsg1/libraries/cabal-bin
--verbose=3 /usr/bin/ghc6 /home/srs/DEBs/ghc/ghc6-6.10.1
+dfsg1/libraries/bootstrapping.conf configure --verbose=3
--prefix=/NONEXISTENT --bindir=/NONEXISTENT --libdir=/NONEXISTENT
--libexecdir=/NONEXISTENT --datadir=/NONEXISTENT --docdir=/NONEXISTENT
--haddockdir=/NONEXISTENT --htmldir=/NONEXISTENT
--with-compiler=/home/srs/DEBs/ghc/ghc6-6.10.1
+dfsg1/ghc/stage1-inplace/ghc
--with-hc-pkg=/home/srs/DEBs/ghc/ghc6-6.10.1
+dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg   --libsubdir='$pkgid'
--with-gcc=gcc --with-ld=/usr/bin/ld  --with-hscolour=/usr/bin/HsColour
--with-alex=/usr/bin/alex --with-happy=/usr/bin/happy
--configure-option='--build'  --configure-option='i486-gnu'
--configure-option='--prefix=/usr'
--configure-option='--with-ghc=/usr/bin/ghc6'
--configure-option='build_alias=i486-gnu'  --configure-option='CFLAGS=-g
-O2'  --configure-option='LDFLAGS='  --configure-option='CPPFLAGS='
--configure-option=--with-cc=gcc
--with-hsc2hs=/home/srs/DEBs/ghc/ghc6-6.10.1
+dfsg1/utils/hsc2hs/install-inplace/bin/hsc2hs
--haddock-options="--use-contents=../index.html
--use-index=../doc-index.html"  --enable-library-profiling
--enable-split-objs ) && touch
stamp/configure.library.build-profiling-splitting.random || touch
random/unbuildable

Output:
===
Creating dist (and its parents)
("/home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/ghc/stage1-inplace/ghc",["--numeric-version"])
/home/srs/DEBs/ghc/ghc6-6.10.1+dfsg1/ghc/stage1-inplace/ghc is version
6.10.1
("/home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg",["--version"])
/home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg
is version 6.10.1
("/home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/ghc/stage1-inplace/ghc",["--supported-languages"])
Reading installed packages...
("/home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg",["dump","--global"])

Hangs here!

Running manually works OK!!
/home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg "dump" "--global"

Gives a lot of output here...

Below is the ghc-pkg script:

cat /home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg
PKGCONF=/home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/inplace-datadir/./package.conf
exec /home/srs/DEBs/ghc/ghc6-6.10.1\
+dfsg1/utils/ghc-pkg/install-inplace/libexec/ghc-pkg --global-conf\
$PKGCONF ${1+"$@"}

I've tried changing the shell from dash to bash but no changes. I also
tried to escape some of the variables in the gkc-pkg shell script but
without any luck.

Anybody can help me here??




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe