Debugging a plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging a plugin

Bob.Cowdery
Debugging a plugin

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.



Reply | Threaded
Open this post in threaded view
|

Re: Debugging a plugin

David T. Lewis
On Wed, Feb 01, 2006 at 02:22:34PM -0000, [hidden email] 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


Reply | Threaded
Open this post in threaded view
|

RE: Debugging a plugin

Bob.Cowdery
In reply to this post by Bob.Cowdery
David

I tried a few more things and it's clear I have a problem somewhere. If
I use the original plugin it does load it and tells me this:

OSProcess versionInformation #('OSProcess version 4.0' 'CommandShell
version 3.0.2' 'Squeak3.7 of ''4 September 2004'' [latest update: #5989]
with Win32OSProcessPlugin version 4.0 using concrete class
Win32OSProcessPluginNoThisSessionAvailable installed with OSProcess
version 4.0, running on NT Win32 VM with installed plugin
Win32OSProcessPlugin 17 July 2003 (e) version 3.0.6 (plugin does not
match class in image)')

If I use the new one you sent me it does not load it and tells me this:

OSProcess versionInformation #('OSProcess version 4.0' 'CommandShell
version 3.0.2' 'Squeak3.7 of ''4 September 2004'' [latest update: #5989]
with Win32OSProcessPlugin version 4.0 using concrete class
Win32OSProcessPluginNoThisSessionAvailable installed with OSProcess
version 4.0, running on NT Win32 VM with installed plugin
(OSProcessPlugin installed module not accessible)')

I may have messed up as I did build the 3.7 source when I was compiling
the plugin. I actually didn't need to and don't do that anymore but it
looks like I could have the 3.7 VM and the 3.8 image running. Don't know
if that could do strange things.

Bob

On Wed, Feb 01, 2006 at 02:22:34PM -0000, [hidden email]
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

*** 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.

Reply | Threaded
Open this post in threaded view
|

Re: Debugging a plugin

David T. Lewis
On Wed, Feb 01, 2006 at 08:37:43PM -0000, Cowdery, Bob [UK] wrote:

> David
>
> I tried a few more things and it's clear I have a problem somewhere. If
> I use the original plugin it does load it and tells me this:
>
> OSProcess versionInformation #('OSProcess version 4.0' 'CommandShell
> version 3.0.2' 'Squeak3.7 of ''4 September 2004'' [latest update: #5989]
> with Win32OSProcessPlugin version 4.0 using concrete class
> Win32OSProcessPluginNoThisSessionAvailable installed with OSProcess
> version 4.0, running on NT Win32 VM with installed plugin
> Win32OSProcessPlugin 17 July 2003 (e) version 3.0.6 (plugin does not
> match class in image)')

OK, so that's working fine. But I don't think that OSPP 3.0.6 had the
Win32 console and stdout primitives.

> If I use the new one you sent me it does not load it and tells me this:
>
> OSProcess versionInformation #('OSProcess version 4.0' 'CommandShell
> version 3.0.2' 'Squeak3.7 of ''4 September 2004'' [latest update: #5989]
> with Win32OSProcessPlugin version 4.0 using concrete class
> Win32OSProcessPluginNoThisSessionAvailable installed with OSProcess
> version 4.0, running on NT Win32 VM with installed plugin
> (OSProcessPlugin installed module not accessible)')

Oops, I sent you a dll that does not work. Sorry about that. The dll
that I sent you was probably built on a newer Squeak source/VMMaker
than you are using. Mea culpa.

> I may have messed up as I did build the 3.7 source when I was compiling
> the plugin. I actually didn't need to and don't do that anymore but it
> looks like I could have the 3.7 VM and the 3.8 image running. Don't know
> if that could do strange things.

As long as you are building a VM anyway, the easiest thing to do is
just install OSProcessPlugin from SqueakMap and build it as an external
plugin along with whatever else you are doing. The 3.7 source should
be perfectly OK. I tried to make OSPP and OSProcess backward compatible,
and although I didn't really test much on Windows I think it will be
fine on 3.7.

Dave