Log:
~/vis/test:$ gsi test.scm
"~\"GNU gdb 6.8-debian\\n\""
"~\"Copyright (C) 2008 Free Software Foundation, Inc.\\n\""
"~\"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\\n\""
"~\"This is free software: you are free to change and redistribute it.\\n\""
"~\"There is NO WARRANTY, to the extent permitted by law. Type \\\"show copying\\\"\\n\""
"~\"and \\\"show warranty\\\" for details.\\n\""
"~\"This GDB was configured as \\\"x86_64-linux-gnu\\\".\\n\""
"(gdb) "
~/vis/test:$ gsi test.scm
~/vis/test:$ gsi test.scm
~/vis/test:$ gsi test.scm
"~\"GNU gdb 6.8-debian\\n\""
"~\"Copyright (C) 2008 Free Software Foundation, Inc.\\n\""
"~\"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\\n\""
"~\"This is free software: you are free to change and redistribute it.\\n\""
"~\"There is NO WARRANTY, to the extent permitted by law. Type \\\"show copying\\\"\\n\""
"~\"and \\\"show warranty\\\" for details.\\n\""
"~\"This GDB was configured as \\\"x86_64-linux-gnu\\\".\\n\""
"(gdb) "
~/vis/test:$ gsi test.scm
"~\"GNU gdb 6.8-debian\\n\""
"~\"Copyright (C) 2008 Free Software Foundation, Inc.\\n\""
"~\"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\\n\""
"~\"This is free software: you are free to change and redistribute it.\\n\""
"~\"There is NO WARRANTY, to the extent permitted by law. Type \\\"show copying\\\"\\n\""
"~\"and \\\"show warranty\\\" for details.\\n\""
"~\"This GDB was configured as \\\"x86_64-linux-gnu\\\".\\n\""
"(gdb) "
~/vis/test:$ gsi test.scm
~/vis/test:$
Code:
~/vis/test:$ cat test.scm
(define p (open-process (list path: "gdb"
arguments: '("--interpreter=mi2"))))
(define (rr)
(if (char-ready? p) (pp (read-line p))))
(rr) (rr) (rr) (rr) (rr) (rr) (rr) (rr) (rr) (rr)
(rr) (rr) (rr) (rr) (rr) (rr) (rr) (rr) (rr) (rr)
Questions:
1) Why is this non-deterministic? (subject to how fast gdb prints out its data?)
2) How can I make it deterministic? (I'd prefer something better than "sleep for 0.5 seconds")
Thanks!