Hi
Can anyone enlighten me on the best approach to debug a plugin under Windows. The code essentially works in its native form but as a plugin doesn't do what it should, but doesn't crash or throw exceptions either. I would settle for getting hold of stdout/stderr but I can't get OSProcess to hook these and I read it doesn't yet support hooking the standard streams in Windows. I am using Dev-C++ to build the plugin and have tried pointing that at Squeak but it won't play.
Thanks for any assistance
Bob *** Confidentiality Notice *** Proprietary/Confidential Information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply email.
On Tue, Jan 31, 2006 at 10:25:04PM -0000, Cowdery, Bob [UK] wrote:
Hi
Can anyone enlighten me on the best approach to debug a plugin under Windows. The code essentially works in its native form but as a plugin doesn't do what it should, but doesn't crash or throw exceptions either. I would settle for getting hold of stdout/stderr but I can't get OSProcess to hook these and I read it doesn't yet support hooking the standard streams in Windows. I am using Dev-C++ to build the plugin and have tried pointing that at Squeak but it won't play.
I definitely don't know the best approach so hopefully someone will give you better answers, but in the mean time...
A crude but effective way is to manually put printf() in the generated plugin, followed by (don't forget this) fflush(stdout). Ugly but it works. On Unix, you can just run the VM under gdb and put breakpoints in your plugin methods, works fine. This may also work on Windows with Cygwin, although I have not tried it.
I don't know that it will help with debugging plugins, but I'm attaching a compiled OSProcess plugin (version 4.0) for Windows that may work for you. I don't know how portable Windows dll's are, but I compiled this on a fairly recent W2k box, so hopefully it is usable. This allows you do to for example:
"Open a console window with stdin, stdout, and stderr streams attached." OSProcess thisOSProcess openConsole.
"Write to the standard output stream, displayed on the console" OSProcess thisOSProcess stdOut nextPutAll: 'this is the standard output stream'; nextPut: Character lf.
"Handy debugging messages for Smalltalk process debugging" OSProcess debugMessage: 'hello world'. OSProcess trace. OSProcess trace: 'hello world'.
"Close the console window" OSProcess thisOSProcess closeConsole.
squeak-dev@lists.squeakfoundation.org