David Lewis wrote:
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.
Have lots of them, just can't get to them. If I run the VM under dev-C++ it starts but does not show itself. Not sure if I need to do something different or if it just don't work.
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:
Thanks, duly installed. Running XP here.
"Open a console window with stdin, stdout, and stderr streams attached." OSProcess thisOSProcess openConsole.
What console should this open. I don't get any console.
"Write to the standard output stream, displayed on the console" OSProcess thisOSProcess stdOut nextPutAll: 'this is the standard output stream'; nextPut: Character lf.
OSProcess thisOSProcess stdOut returns me nil.
"Handy debugging messages for Smalltalk process debugging" OSProcess debugMessage: 'hello world'. OSProcess trace. OSProcess trace: 'hello world'.
"Close the console window" OSProcess thisOSProcess closeConsole.
I have resorted to putting debug output to a file for now. At least I can now see my threads are dropping out. Probably take a while to find out why.
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 Wed, Feb 01, 2006 at 02:22:34PM -0000, Bob.Cowdery@CGI-Europe.com wrote:
David Lewis wrote:
"Open a console window with stdin, stdout, and stderr streams attached." OSProcess thisOSProcess openConsole.
What console should this open. I don't get any console.
It should open a separate Windows window (possibly hidden behind the Squeak window).
"Write to the standard output stream, displayed on the console" OSProcess thisOSProcess stdOut nextPutAll: 'this is the standard output stream'; nextPut: Character lf.
OSProcess thisOSProcess stdOut returns me nil.
Hmm, the plugin is not working then. I'm away from my Squeak computer so I can't help much at the moment, but the two things I would check are:
1) Plugin paths can be confusing. If you have an older copy of the OSPP plugin (as would have gotten whenever you installed OSProcess from SqueakMap), make sure you are not running that one instead of the more recent OSPP 4.0 that I sent to you. There is a #primitiveVersionString primitive in OSPP identifies the actual version of the plugin that you are running. I don't remember for sure, but I think I put a method in the OSPP source (download from SqueakMap) that calls the primitive, probably it's "OSProcessPlugin primVersionString" or something like that.
2) Are you building a VM from the latest SVN sources by any chance? If so, the #stdOut method won't work due to some recent security changes to the Windows FilePlugin. If that's the problem, you can probably just comment out the security checks in the Windows FilePlugin support code as a workaround (I don't have any better solution at the moment).
Dave
squeak-dev@lists.squeakfoundation.org