Open Debugger, Save and Quit

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

Open Debugger, Save and Quit

Sean P. DeNigris
Administrator
In a headless image, I'd like to do the following: if there's any error,
arrange to have a debugger open on the next (headful) launch, and then save
and quit.

I'm drawing a blank - how would I do that?

I explored various dead ends, the culmination of which was the
image-breaking:
actualWorkBlock on: Error do: [ [ Smalltalk snapshot: true andQuit: true ]
fork. Halt now ]

Thanks!



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

Ben Coman


On Wed, Nov 8, 2017 at 10:16 AM, Sean P. DeNigris <[hidden email]> wrote:
In a headless image, I'd like to do the following: if there's any error,
arrange to have a debugger open on the next (headful) launch, and then save
and quit.

I'm drawing a blank - how would I do that?

I explored various dead ends, the culmination of which was the
image-breaking:
actualWorkBlock on: Error do: [ [ Smalltalk snapshot: true andQuit: true ]
fork. Halt now ]

Thanks!

Sorry not a solution, but you sparked a side-thought...  To avoid sometimes being swamped by Pre-Debug windows.  Instead of an error bringing up an individual Pre-Debug window, we could have error go into a queue which a singleton Pre-Debug window could have a view into. This "Error Queue Viewer"  would have on row per error, and you click on a row to open a normal debugger, much like you click <Debug> button in the existing Pre-Debug window.  In a headless image, the Error Queue Viewer would not appear, but the error would keep being queued until the next time the Error Queue Viewer is manually opened.  The same error-queue might provide a similar interface point for Pharo Remote Tools, so you can see errors that occurred while you were not connected.

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

Richard Sargent
Administrator
Some of this can be seen in VA Smalltalk. Errors during start up are captured and can be debugged after the start up has completed. 

The idea of an Error Queue Viewer is a nice touch, along with the possibility of remote debugging. 



On Nov 7, 2017 6:55 PM, "Ben Coman" <[hidden email]> wrote:


On Wed, Nov 8, 2017 at 10:16 AM, Sean P. DeNigris <[hidden email]> wrote:
In a headless image, I'd like to do the following: if there's any error,
arrange to have a debugger open on the next (headful) launch, and then save
and quit.

I'm drawing a blank - how would I do that?

I explored various dead ends, the culmination of which was the
image-breaking:
actualWorkBlock on: Error do: [ [ Smalltalk snapshot: true andQuit: true ]
fork. Halt now ]

Thanks!

Sorry not a solution, but you sparked a side-thought...  To avoid sometimes being swamped by Pre-Debug windows.  Instead of an error bringing up an individual Pre-Debug window, we could have error go into a queue which a singleton Pre-Debug window could have a view into. This "Error Queue Viewer"  would have on row per error, and you click on a row to open a normal debugger, much like you click <Debug> button in the existing Pre-Debug window.  In a headless image, the Error Queue Viewer would not appear, but the error would keep being queued until the next time the Error Queue Viewer is manually opened.  The same error-queue might provide a similar interface point for Pharo Remote Tools, so you can see errors that occurred while you were not connected.

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

jtuchel
In reply to this post by Sean P. DeNigris
Sean,

I am not a regular Pharo user, so I have no code example for you. Just an idea: why not save an image copy instead of the image itself? Thus if an error occurs that might not happen at next startup (external dependencies etc.) , you could  restart the "real image" and still use the failed copies to analyse your startup problems.

I guess Pharo can do a "Save image as..." ?

Joachim

Am 08.11.2017 03:16 schrieb "Sean P. DeNigris" <[hidden email]>:

>
> In a headless image, I'd like to do the following: if there's any error,
> arrange to have a debugger open on the next (headful) launch, and then save
> and quit.
>
> I'm drawing a blank - how would I do that?
>
> I explored various dead ends, the culmination of which was the
> image-breaking:
> actualWorkBlock on: Error do: [ [ Smalltalk snapshot: true andQuit: true ]
> fork. Halt now ]
>
> Thanks!
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html 
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

Sean P. DeNigris
Administrator
In reply to this post by Sean P. DeNigris
Sean P. DeNigris wrote
> In a headless image, I'd like to do the following: if there's any error,
> arrange to have a debugger open on the next (headful) launch, and then
> save
> and quit.

Bump :) I can't believe no one knows how to do this!



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

Tim Mackinnon
Hi Sean - not sure if this is exactly what you are after, but there is a method in the debugger that is invoked when you need to debug, you can override this and Fuel out the debug context to a file (or I guess even a variable in the image if you are also saving the image when it gets an error). When the the image relaunches in a headful state you could check if that file exists (or variable is not null) and then open a debugger on the Fueled back in state?

Mariano’s article gave me all of the hints for doing something like this for PharoLamda - (although I am reading the file from S3 and then creating the debugger in a different image) - but I could imagine you doing this for what you want?

If you need specific code I can dig it out for you tonight.

Tim

> On 12 Nov 2017, at 23:15, Sean P. DeNigris <[hidden email]> wrote:
>
> Sean P. DeNigris wrote
>> In a headless image, I'd like to do the following: if there's any error,
>> arrange to have a debugger open on the next (headful) launch, and then
>> save
>> and quit.
>
> Bump :) I can't believe no one knows how to do this!
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>


Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

Sven Van Caekenberghe-2
I do something similar, in my WAHtmlHaltAndErrorHandler subclass

fuelOutException: exception
        | filename context |
        filename := 't3-seaside-exception-{1}.fuel' format: { ZTimestamp now format: '20010203T160506' }.
        context := exception signalerContext.
        [ FuelOutStackDebugAction serializeTestFailureContext: context toFileNamed: filename ]
                on: Error
                do: [ ]

But like Tim says, it works via a .fuel file, it does not change the image state. You then open the .fuel file in a similar image.

> On 13 Nov 2017, at 15:48, Tim Mackinnon <[hidden email]> wrote:
>
> Hi Sean - not sure if this is exactly what you are after, but there is a method in the debugger that is invoked when you need to debug, you can override this and Fuel out the debug context to a file (or I guess even a variable in the image if you are also saving the image when it gets an error). When the the image relaunches in a headful state you could check if that file exists (or variable is not null) and then open a debugger on the Fueled back in state?
>
> Mariano’s article gave me all of the hints for doing something like this for PharoLamda - (although I am reading the file from S3 and then creating the debugger in a different image) - but I could imagine you doing this for what you want?
>
> If you need specific code I can dig it out for you tonight.
>
> Tim
>
>> On 12 Nov 2017, at 23:15, Sean P. DeNigris <[hidden email]> wrote:
>>
>> Sean P. DeNigris wrote
>>> In a headless image, I'd like to do the following: if there's any error,
>>> arrange to have a debugger open on the next (headful) launch, and then
>>> save
>>> and quit.
>>
>> Bump :) I can't believe no one knows how to do this!
>>
>>
>>
>> -----
>> Cheers,
>> Sean
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

Sean P. DeNigris
Administrator
In reply to this post by Tim Mackinnon
Tim Mackinnon wrote
> you can override this and Fuel out the debug context to a file

Thanks, Tim! I do know about that, but I was thinking/hoping that maybe
there was a way to keep the debug context alive without fueling out…



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Open Debugger, Save and Quit

Guillermo Polito
Hi Sean,

You can always try:

exception freeze.
  freeze will copy the stack so it is usable in a posterior debug session even if the original contexts died.

exception debug.
  Opens a debugger :)

On Mon, Nov 13, 2017 at 5:20 PM, Sean P. DeNigris <[hidden email]> wrote:
Tim Mackinnon wrote
> you can override this and Fuel out the debug context to a file

Thanks, Tim! I do know about that, but I was thinking/hoping that maybe
there was a way to keep the debug context alive without fueling out…



--

   

Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - http://www.cnrs.fr


Web: http://guillep.github.io

Phone: +33 06 52 70 66 13