FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Control de GPF
Posts: 145
Joined: Wed Nov 03, 2010 09:16 AM
Control de GPF
Posted: Thu May 14, 2015 08:03 AM

Hola a todos

Necesito controlar los errores GPF de tal manera que cuando se produzca alguno me dé tiempo de comunicar, a otra aplicación, que se ha producido un error.

¿Alguna sugerencia?

Un saludo

Paco García
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Control de GPF
Posted: Thu May 14, 2015 09:22 AM

Si supieramos que todos, o al menos la mayoria de los errores GPF generan una entrada en hb_out.log se podria hacer viendo/ comparando la fecha de ese fichero.

Si lo que quieres es, en general, controlar salidas anomalas del programa yo lo haria de otra forma.

Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: Control de GPF
Posted: Thu May 14, 2015 09:23 AM

Hola Paco,

Cuando se genera un GPF Harbour crea hb_out.log.

Luego, es cuestión de monitorizar con una aplicación/servicio externo si se ha generado tal archivo, o bien al comienzo de nuestra aplicación, etc.

Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 145
Joined: Wed Nov 03, 2010 09:16 AM
Re: Control de GPF
Posted: Thu May 14, 2015 11:05 AM

Me parece recordar que en algún momento he visto interceptar los gpfs desde fivewin pero no sé por donde empezar. ¿no os suena?

Paco García
Posts: 145
Joined: Wed Nov 03, 2010 09:16 AM
Re: Control de GPF
Posted: Thu May 14, 2015 11:07 AM
Este es el código. Lo acabo de encontrar. No sé si funcionará, voy a echarle un vistazo.
:-)

Code (fw): Select all Collapse
// Testing Windows ToolHelp.dll

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local aTimerInfo := TimerCount()

   // Determining how long an application has been running

   MsgInfo( "Milliseconds since this task started: " + Str( aTimerInfo[ 1 ] ) )
   MsgInfo( "Milliseconds since the VM started:" + Str( aTimerInfo[ 2 ] ) )

   // Controlling possible GPFs !!!

   InterruptRegister( { || ControlGPF() } )  // Setting our own GPF controller
   // Comment the above function and see the difference !

   __GenGPF()                                // Now we generate a GPF !!!

return nil

//----------------------------------------------------------------------------//

function ControlGPF()

   MsgAlert( "A GPF has occurred" + CRLF + "I am URGENTLY closing everything!" )

   // CLOSE ALL           --> Here we close all our files !!!

   MsgInfo( "We recommend reboot the computer, or at least exit Windows" )

   InterruptUnRegister()   // We release our GPF controller

   Eval( ErrorBlock(), _FWGenError( 5, "Undetermined GPF" ) )
                                   // you can use the FiveWin
                                   // Error SubSystem !!!

return nil
Paco García
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Control de GPF
Posted: Thu May 14, 2015 01:42 PM
pgfdz wrote:Este es el código. Lo acabo de encontrar. No sé si funcionará, voy a echarle un vistazo.
:-)

Code (fw): Select all Collapse
// Testing Windows ToolHelp.dll

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local aTimerInfo := TimerCount()

   // Determining how long an application has been running

   MsgInfo( "Milliseconds since this task started: " + Str( aTimerInfo[ 1 ] ) )
   MsgInfo( "Milliseconds since the VM started:" + Str( aTimerInfo[ 2 ] ) )

   // Controlling possible GPFs !!!

   InterruptRegister( { || ControlGPF() } )  // Setting our own GPF controller
   // Comment the above function and see the difference !

   __GenGPF()                                // Now we generate a GPF !!!

return nil

//----------------------------------------------------------------------------//

function ControlGPF()

   MsgAlert( "A GPF has occurred" + CRLF + "I am URGENTLY closing everything!" )

   // CLOSE ALL           --> Here we close all our files !!!

   MsgInfo( "We recommend reboot the computer, or at least exit Windows" )

   InterruptUnRegister()   // We release our GPF controller

   Eval( ErrorBlock(), _FWGenError( 5, "Undetermined GPF" ) )
                                   // you can use the FiveWin
                                   // Error SubSystem !!!

return nil



Code (fw): Select all Collapse
/*
Application
===========
   Path and name: C:\FWH1306\samples\TESTE.exe (32 bits)
   Size: 2,408,960 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150419)
   FiveWin  Version: FWHX 13.05
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 05/14/15, 10:32:35
   Error description: Error BASE/1068  Argument error: array access
   Args:
     [   1] = U   
     [   2] = N   2

Stack Calls
===========
   Called from: TESTE.prg => MAIN( 14 )
*/
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion