English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 09 August 2017, 09:12   #1
meynaf
68k wisdom
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon (France)
Age: 44
Posts: 2,327
Resurrect a crashed process

Hi all,

Sometimes a process crashes "cleanly" and does the usual suspend/reboot popup. There is no resource tracking and everything is left open : files, screens, etc. In theory you should just save what you can and then reboot, but the system isn't necessarily unstable at that point.
Most of my programs have internal resource tracking, so i've had the idea to use that to clear them up when something goes wrong -- this is useful for debugging.

The method is simple, i just run another program which finds the task structure, changes its program counter to point to clean-up code (which will restore normal stack pointer), sets some signals to wait and then Signal() it.

So far i've been only partially successful. The program is indeed closed and control is returned to the parent cli. Everything's fine if i just close that cli.

But if i try to reuse it, it will not work properly : behaves strangely with regard to multitasking and a second crash will directly call the guru.
I guess something's left in a bad state.

What Exec does to the task when suspending it ?
What to change in the Task or Process structure to make it clean again ?
meynaf is offline  
AdSense AdSense  
Old 09 August 2017, 17:39   #2
Cylon
Registered User

 
Join Date: Oct 2014
Location: Europe
Posts: 441
IMHO it has to reappear in the exec's task list, either in 'waiting' or 'running' state. This can only be done with createprocess(), i believe?
Cylon is offline  
Old 09 August 2017, 18:04   #3
meynaf
68k wisdom
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon (France)
Age: 44
Posts: 2,327
Such a task actually remains in 'waiting' list. Something like Wait(0) involved to freeze it permanently.
It doesn't get removed and therefore does not need to get added again ; trying this could well mess the task lists up.
meynaf is offline  
Old 09 August 2017, 18:41   #4
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 813
Not what you ask but I've the source code of never released software done by a friend who do stuff a bit like GOMF. It is doing ressource tracking etc and try to cleanly close a crashed prog. It surely could be improved.
Kamelito
kamelito is offline  
Old 09 August 2017, 19:13   #5
meynaf
68k wisdom
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon (France)
Age: 44
Posts: 2,327
Quote:
Originally Posted by kamelito View Post
Not what you ask but I've the source code of never released software done by a friend who do stuff a bit like GOMF. It is doing ressource tracking etc and try to cleanly close a crashed prog. It surely could be improved.
Kamelito
I need to be able to open some cli, run (from that cli) a program that crashes, close the program cleanly, and then be able to use that cli as if nothing had happened.
What is that 'never released software' able to do ?
meynaf is offline  
Old 09 August 2017, 20:07   #6
meynaf
68k wisdom
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon (France)
Age: 44
Posts: 2,327
Found something !
The OS changes tc_TrapCode to call the guru if the program crashes again. In addition, strange behavior of subsequent programs run from that cli seems to be linked to tc_TDNestCnt.
meynaf is offline  
Old 10 August 2017, 07:48   #7
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 813
It patches OS functions to be able to do ressources tracking and if a program crash try to safely close it and free the ressources that program

Programs like ARTM, Xoper and Scout could be analyzed, better have a look at Scout as the sources are available on Aminet.
Kamelito

Last edited by kamelito; 10 August 2017 at 08:04.
kamelito is offline  
Old 10 August 2017, 09:29   #8
meynaf
68k wisdom
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon (France)
Age: 44
Posts: 2,327
Ok but i don't want to patch the system. As i said my programs do that internally so it works everywhere.
meynaf is offline  
Old 10 August 2017, 12:32   #9
Cylon
Registered User

 
Join Date: Oct 2014
Location: Europe
Posts: 441
The source to Xoper ist also included in its archive, fully asm.
Cylon is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Winuae crashed kep support.WinUAE 1 24 January 2016 16:55
Workbench crashed Leandro Jardim support.WinUAE 2 31 May 2013 08:52
Amiga 2000 HD: Time to resurrect :) Analog-X64 support.Hardware 3 08 November 2012 15:41
Just decided to resurrect my Amiga500's ceedy support.Hardware 5 17 February 2011 21:51
Which gamemap should i process next...?? Joe Maroni HOL contributions 35 10 July 2008 05:36

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:43.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.12935 seconds with 13 queries