[Glass] Debugging a multiple process system ... ?

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Mon Jan 22 04:05:11 PST 2018

On Sun, Jan 21, 2018 at 1:35 PM, Dale Henrichs via Glass <
glass at lists.gemtalksystems.com> wrote:

> Marten,
> Did you know that you should be able to open a debugger on a continuation
> - it is possible with tODE and GemTools. I think that most folks find this
> a reasonable solution.
> That's what I do. I do it at Seaside error handler as well as in some
other error handlers (like background jobs).

What I do is basically:


[ self
codeThatCouldTriggerErrorAndIWantToSaveAContinuationForLaterDebugging ]
on: Error do: [ :ex |

    FaSmalltalkPlatform current saveExceptionContinuation: exception.


FaGemStonePlatform class >> saveExceptionContinuation: anException
  | continuation action |
  GRPlatform current canDebugInteractively
    ifTrue: [ anException pass ].
  GRPlatform current
    logError: anException description
    title: 'Continuation saved to object log'.
  action := [ :cont |
  continuation := cont.
  #'create' ] callCC.
  action == #'create'
    ifTrue: [
      | logEntry |
      logEntry := WAObjectLogEntry
        error: anException description
        continuation: continuation. "the continuation is not resumable"
      logEntry resumeContinuation.
      logEntry addToLog.
      ^ continuation ].
  action == #'debug'
    ifTrue: [ self halt ]

That uses Grease which I would expect you have it loaded. WAObjectLogEntry
is from Seaside but it's a very stupid subclass. so if you are not using
Seaside you could just copy that class and give it whatever name and put it
in your code.

Once the continuation has been created and stored in the ObjectLog all you
have to do is to connect with tODE and open a debugger on it.

BTW, be sure to cleanup the object log as continuations are heavy:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20180122/ee15bfe1/attachment.html>

More information about the Glass mailing list