Hey Marc (and other Gambit folks, I realized this would be good for the gambit list too),
Your remote debugger is awesome. However, it travels further into the land of Gambit IO than I know. I'm having one problem with it (I got the latest version of it).
I found a rather concise example of the problem. It seems that when two errors happen close enough in time, one remote debugger pops open with the correct error, and another pops open with this error:
*** ERROR IN rdi-open-client, "Users/james/projects/scheme/gambit-iphone-example/lib/util/remote-debugger/rdi.scm"@108.5 -- Broken pipe (force-output '#<input-output-port #3 (tcp-client "localhost" 20000)>)
You can get it to do this by just doing this in the debugee:
(thread-start! (make-thread (lambda () (/ 1 0))))
(thread-start! (make-thread (lambda () (/ 1 0))))
Would you mind looking at it?
As a separate subject, as I was integrating the remote debugger with my iphone app, I realized I can not only have access to the debugger from the iphone, but I can also fire up a main REPL and interactively develop from my main computer on the iphone! That is very cool.
Now, I can't call (##repl-debug-main) in the primordial thread, as your proof of concept does, because the main thread is the program which needs to continue executing. So, my first attempt fired up the REPL from a child thread instead:
(thread-start! (make-thread (lambda () (##repl-debug-main))))
Do you see any problems with this? This seems to work fine (a real Gambit REPL pops open in an xterm when the app start in the iphone simulator). This got me thinking too: what is the relationship between stdin and stdout and the main REPL? It seems that standard output is somehow redirected to this REPL. Rather, if I call DISPLAY on any other thread it somehow appears in my above REPL. How is that so?
Thanks, James http://jlongster.com/
Afficher les réponses par date
I forgot to mention that the first problem must be a timing issue also because if you sleep the primordial thread between thread creation, it works:
(thread-start! (make-thread (lambda () (/ 1 0))))
(thread-sleep! 1)
(thread-start! (make-thread (lambda () (/ 1 0))))
On Wed, Jul 1, 2009 at 12:07 AM, James Longlongster@gmail.com wrote:
Hey Marc (and other Gambit folks, I realized this would be good for the gambit list too),
Your remote debugger is awesome. However, it travels further into the land of Gambit IO than I know. I'm having one problem with it (I got the latest version of it).
I found a rather concise example of the problem. It seems that when two errors happen close enough in time, one remote debugger pops open with the correct error, and another pops open with this error:
*** ERROR IN rdi-open-client, "Users/james/projects/scheme/gambit-iphone-example/lib/util/remote-debugger/rdi.scm"@108.5 -- Broken pipe (force-output '#<input-output-port #3 (tcp-client "localhost" 20000)>)
You can get it to do this by just doing this in the debugee:
(thread-start! (make-thread (lambda () (/ 1 0))))
(thread-start! (make-thread (lambda () (/ 1 0))))
Would you mind looking at it?
As a separate subject, as I was integrating the remote debugger with my iphone app, I realized I can not only have access to the debugger from the iphone, but I can also fire up a main REPL and interactively develop from my main computer on the iphone! That is very cool.
Now, I can't call (##repl-debug-main) in the primordial thread, as your proof of concept does, because the main thread is the program which needs to continue executing. So, my first attempt fired up the REPL from a child thread instead:
(thread-start! (make-thread (lambda () (##repl-debug-main))))
Do you see any problems with this? This seems to work fine (a real Gambit REPL pops open in an xterm when the app start in the iphone simulator). This got me thinking too: what is the relationship between stdin and stdout and the main REPL? It seems that standard output is somehow redirected to this REPL. Rather, if I call DISPLAY on any other thread it somehow appears in my above REPL. How is that so?
Thanks, James http://jlongster.com/
On 1-Jul-09, at 12:07 AM, James Long wrote:
Hey Marc (and other Gambit folks, I realized this would be good for the gambit list too),
Your remote debugger is awesome. However, it travels further into the land of Gambit IO than I know. I'm having one problem with it (I got the latest version of it).
I found a rather concise example of the problem. It seems that when two errors happen close enough in time, one remote debugger pops open with the correct error, and another pops open with this error:
*** ERROR IN rdi-open-client, "Users/james/projects/scheme/gambit-iphone-example/lib/util/remote- debugger/rdi.scm"@108.5 -- Broken pipe (force-output '#<input-output-port #3 (tcp-client "localhost" 20000)>)
You can get it to do this by just doing this in the debugee:
(thread-start! (make-thread (lambda () (/ 1 0))))
(thread-start! (make-thread (lambda () (/ 1 0))))
Would you mind looking at it?
I couldn't reproduce this on Mac OS X. It looks like a race condition.
As a separate subject, as I was integrating the remote debugger with my iphone app, I realized I can not only have access to the debugger from the iphone, but I can also fire up a main REPL and interactively develop from my main computer on the iphone! That is very cool.
It puts the "remote" in "remote debugger"!
Now, I can't call (##repl-debug-main) in the primordial thread, as your proof of concept does, because the main thread is the program which needs to continue executing. So, my first attempt fired up the REPL from a child thread instead:
(thread-start! (make-thread (lambda () (##repl-debug-main))))
Do you see any problems with this? This seems to work fine (a real Gambit REPL pops open in an xterm when the app start in the iphone simulator). This got me thinking too: what is the relationship between stdin and stdout and the main REPL? It seems that standard output is somehow redirected to this REPL. Rather, if I call DISPLAY on any other thread it somehow appears in my above REPL. How is that so?
There are several ports that have a similarity with the concepts of "standard input" and "standard output". Here is a breakdown:
##stdin-port actual standard input of the process ##stdout-port actual standard output of the process (current-input-port) current input port (current-output-port) current output port (repl-input-port) this thread's REPL input port (repl-output-port) this thread's REPL output port (console-port) the console's bidirectional port
The REPL input/output ports are normally connected to the console (/ dev/tty on Unix, a Windows console on Windows, etc). When a thread calls (##repl-debug-main) the parameter objects current-input-port and current-output-port are dynamically bound to the REPL input/output ports, for the duration of the REPL. This explains why a (display "foo") will output to the console (because the port parameter of display defaults to (current-output-port) as requested by the Scheme standard). Note that when a thread is created with make-thread it inherits the current-input-port and current-output-port bindings of the parent thread, that's why display's output will go to the REPL of the thread that called ##repl-debug-main, if the thread is a descendant of that thread.
Note that the default port for "pp" is the repl-output-port. This is consistent with pp's debugging purpose. So I suggest you try to limit yourself to using pp, or explicitly pass (repl-output-port) to the output procedure you are using when debugging.
Marc
On 1-Jul-09, at 12:07 AM, James Long wrote:
I found a rather concise example of the problem. It seems that when two errors happen close enough in time, one remote debugger pops open with the correct error, and another pops open with this error:
*** ERROR IN rdi-open-client, "Users/james/projects/scheme/gambit-iphone-example/lib/util/remote- debugger/rdi.scm"@108.5 -- Broken pipe (force-output '#<input-output-port #3 (tcp-client "localhost" 20000)>)
You can get it to do this by just doing this in the debugee:
(thread-start! (make-thread (lambda () (/ 1 0))))
(thread-start! (make-thread (lambda () (/ 1 0))))
Would you mind looking at it?
Please give the usual contextual information (uname -a and gsi -v).
Marc
On Thu, Jul 2, 2009 at 2:40 PM, Marc Feeleyfeeley@iro.umontreal.ca wrote:
Please give the usual contextual information (uname -a and gsi -v).
james% uname -a Darwin james.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
james% gsi -v v4.4.4 20090611032636 i386-apple-darwin9.6.0 "./configure --enable-gcc-opts --enable-symlinks --prefix=/usr/local"
This issue is caused by something else. I just tested it in a separate project (all it had was my test code), ran it from my terminal and it worked as expected. For some reason, the error occurs only in the context of my iphone app, so there's something strange going on there. I'll look into it soon and get back to you.
Thanks - James
On 2-Jul-09, at 3:29 PM, James Long wrote:
On Thu, Jul 2, 2009 at 2:40 PM, Marc Feeleyfeeley@iro.umontreal.ca wrote:
Please give the usual contextual information (uname -a and gsi -v).
james% uname -a Darwin james.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
james% gsi -v v4.4.4 20090611032636 i386-apple-darwin9.6.0 "./configure --enable-gcc-opts --enable-symlinks --prefix=/usr/local"
This issue is caused by something else. I just tested it in a separate project (all it had was my test code), ran it from my terminal and it worked as expected. For some reason, the error occurs only in the context of my iphone app, so there's something strange going on there. I'll look into it soon and get back to you.
Thanks - James
Hmmm. Could it be that the iPhone's TCP stack has some limitation on the number of open connections? The "Broken pipe" error normally happens when the peer shuts-down the receiving end of the connection (i.e. the peer, which seems to be the debuggee here, does a close- input-port or close-port).
Marc
On Thu, Jul 2, 2009 at 3:55 PM, Marc Feeleyfeeley@iro.umontreal.ca wrote:
Hmmm. Could it be that the iPhone's TCP stack has some limitation on the number of open connections? The "Broken pipe" error normally happens when the peer shuts-down the receiving end of the connection (i.e. the peer, which seems to be the debuggee here, does a close-input-port or close-port).
Marc
I don't think that's the case, since I can (thread-sleep! 1) after creating the main REPL and it works fine. I still haven't figured it out, but I could spend more time on it...
I don't want to seem like I keep marketing my blog or anything, but this might be helpful to some people. I just wrote a post about using Marc's remote debugger on the iPhone:
http://jlongster.com/blog/2009/07/5/remotely-debugging-iphone-scheme/
On Jul 6, 2009, at 6:22 PM, James Long wrote:
I don't want to seem like I keep marketing my blog or anything, but this might be helpful to some people. I just wrote a post about using Marc's remote debugger on the iPhone:
http://jlongster.com/blog/2009/07/5/remotely-debugging-iphone-scheme/
Keep plugging your blog if you write Gambit posts---this stuff is cool!
Brad