[haskeline] #105: Segfault on getInputLine and getInputChar
haskeline
haskeline at projects.haskell.org
Thu Apr 1 15:30:11 EDT 2010
#105: Segfault on getInputLine and getInputChar
---------------------+------------------------------------------------------
Reporter: syfran | Owner:
Type: defect | Status: new
Priority: major | Milestone: 0.6.2
Version: | Resolution:
Keywords: segfault |
---------------------+------------------------------------------------------
Old description:
> Haskeline gives a seg fault when getInputLine or getInputChar is called.
>
> {{{
> import System.Console.Haskeline
> main = runInputT defaultSettings $ getInputLine "$$" >> outputStrLn
> "Hello World" :: IO ()
> }}}
>
> This just outputs "Segmentation Fault" when compiled and run (or just
> quits if run with runghc)
>
> On the other hand,
> {{{
> import System.Console.Haskeline
> main= runInputT defaultSettings $ outputStrLn "Hello World" :: IO ()
> }}}
> will output "Hello World" as expected.
>
> System Info--
> OS: Gentoo Linux
> Arch: amd64
> ghc version: 6.10.4
> haskeline version: 0.6.2.2
>
> If it helps heres the result of gdb where on the above example:
> {{{
> gdb ./Tests
> GNU gdb (Gentoo 7.1 p1) 7.1
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-pc-linux-gnu".
> For bug reporting instructions, please see:
> <http://bugs.gentoo.org/>...
> Reading symbols from /home/syfran/haskelineTests/Tests...(no debugging
> symbols found)...done.
> (gdb) run
> Starting program: /home/syfran/haskelineTests/Tests
> [Thread debugging using libthread_db enabled]
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000535362 in base_ForeignziCziString_zdwa_info ()
> (gdb) where
> #0 0x0000000000535362 in base_ForeignziCziString_zdwa_info ()
> #1 0x0000000000000000 in ?? ()
> (gdb)
> }}}
>
> Let me know if you need anything else.
New description:
Haskeline gives a seg fault when getInputLine or getInputChar is called.
{{{
import System.Console.Haskeline
main = runInputT defaultSettings $ getInputLine "$$" >> outputStrLn "Hello
World" :: IO ()
}}}
This just outputs "Segmentation Fault" when compiled and run (or just
quits if run with runghc)
On the other hand,
{{{
import System.Console.Haskeline
main= runInputT defaultSettings $ outputStrLn "Hello World" :: IO ()
}}}
will output "Hello World" as expected.
System Info--
OS: Gentoo Linux
Arch: amd64
ghc version: 6.10.4
haskeline version: 0.6.2.2
If it helps heres the result of gdb where on the above example:
{{{
gdb ./Tests
GNU gdb (Gentoo 7.1 p1) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /home/syfran/haskelineTests/Tests...(no debugging
symbols found)...done.
(gdb) run
Starting program: /home/syfran/haskelineTests/Tests
[Thread debugging using libthread_db enabled]
Program received signal SIGSEGV, Segmentation fault.
0x0000000000535362 in base_ForeignziCziString_zdwa_info ()
(gdb) where
#0 0x0000000000535362 in base_ForeignziCziString_zdwa_info ()
#1 0x0000000000000000 in ?? ()
(gdb)
}}}
Let me know if you need anything else.
Comment (by syfran):
Both methods cause the program to work as expected (just out of
curiousity, how does this change how the program functions?)
Not sure if it still helps still but the gdb disassemble of the segfault
shows
{{{
=> 0x00000000006adea1 <+33>: movsbq (%r14),%rax
}}}
with r14 containing 0
being the segfault line (after the function has been called ~21 times)
I could post the whole disassemble, if you need it.
Thanks a lot for helping out here, not being able to use ghci getting to
be a pain.
--
Ticket URL: <http://trac.haskell.org/haskeline/ticket/105#comment:3>
haskeline <http://example.org/>
My example project
More information about the Haskeline
mailing list