[Haskell-cafe] Re: New slogan for haskell.org
Stefan O'Rear
stefanor at cox.net
Thu Nov 29 18:31:33 EST 2007
On Thu, Nov 29, 2007 at 09:48:22AM +0100, apfelmus wrote:
> Well, I only remember that it took _me_ a page of C code :D Basically due
> to a hand-coded intset and user interaction (no REPL for C, after all).
In my C programming, I've taken to using gdb as a REPL:
stefan at stefans:/tmp$ vi foo.c
stefan at stefans:/tmp$ cat foo.c
int foo(int x) {
return x * x;
}
int main(){}
stefan at stefans:/tmp$ gcc foo.c
stefan at stefans:/tmp$ gdb -q ./a.out
Using host libthread_db library
"/lib/i686/cmov/libthread_db.so.1".
(gdb) b main
Breakpoint 1 at 0x804835e
(gdb) run
Starting program: /tmp/a.out
Failed to read a valid object file image from memory.
Breakpoint 1, 0x0804835e in main ()
(gdb) p foo(2)
$1 = 4
(gdb) p foo(10)
$2 = 100
(gdb) p foo(-1)
$3 = 1
(gdb) p foo(0)
$4 = 0
(gdb) p foo(2)+foo(4)
$5 = 20
(gdb) quit
The program is running. Exit anyway? (y or n) y
stefan at stefans:/tmp$
Makes most debugging tasks much easier.
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071129/2bfbcc60/attachment.bin
More information about the Haskell-Cafe
mailing list