 |
Forums |
Admin Start New Thread
| Message: 9762 |
 |
BY: David Langston (dklangst) DATE: 2006-05-24 05:35 SUBJECT: RE: Debugging rails apps mitchell and all,
I have been able to get mr_guid (and the ruby debugger) to do a partial job of web app debugging. one of the problems outlined at the start of this thread is the repeated halting of the debugger when running the webrick server. this is seemingly due to code in that server and rails (as well as nitro, another ruby web framework similar to rails) that causes exceptions that are trapped by the debugger. the default state of the debugger (inherited from the standard ruby debugger) is to trap all "StandardError" exceptions.
This can be 'fixed' by changing line 99 in gdebug.rb to
@catch = nil (rather than @catch = "StandardError")...
regarding the comment in that first message that webrick goes away and never comes back to the debugger, that is simply the fact that unless a breakpoint is set, webrick will run thru a monitor loop forever, awaiting http requests. That is normal behavior. therefore it is essential, that a breakpoint be set somewhere in the code that responds to an http request so that the ensuing code can be stepped thru.
lastly, (and again it may be the behavior of the std Ruby debugger that is inherited) it seems that breakpoints cannot be set once the debugger is running, unless halted at a break... this even further reinforces the last point that a breakpoint must be set in the http response code before starting or continuing into the server code or you won't be able to stop it other than aborting the debugger and app.
One more observation, if you stop the debugger and then exit, it seems that the webrick server does not terminate. So keep your eye on the process list 'cause you may occassionally need to kill off an orphaned ruby process...
hope this helps get us all to a cleaner debug situation,
rgds,
Dave Langston
| |
Thread View
Post a followup to this message
|
 |