[gambit-list] why is the following non-deterministic (and how can I make it

lowly coder lowlycoder at huoyanjinjing.com
Sat Mar 28 04:58:29 EDT 2009


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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090328/3b34597f/attachment.htm>


More information about the Gambit-list mailing list