Blady-Com / gnoga

gnoga - The GNU Omnificent GUI for Ada
GNU General Public License v3.0
12 stars 4 forks source link

Study the impact of integrating v22 exceptions and postmortem traces. #6

Open sowebio opened 9 months ago

sowebio commented 9 months ago

In addition to the usual trace, a v22 exception give some extra information like: exception time, program uptime, program & library names & versions, start & home directories and Ada and all languages memory allocation, current & maximum (peak) values. In addition, v22 closes open DB connections after the trace has been output.

I'm obviously open to extend this code to Mac OS with atos command...

-------------------------------------------------------------------------------------

Exception time         : 20230921-123354
Program uptime         :  0h0 0m0 0s
Program build DT stamp : build 2023-09-21 12:33:15
Program name & version : testgui v0.1
Library name & version : v22 v0.1
Start directory        : /home/sr/Sowebio/informatique/dev/gpl/github/v22/tests
Home directory         : /home/sr
Ada mem. alloc. (bytes): Ada Cur: [ 4132 ] Max: [ 4708 ]
All mem. alloc. (bytes): All Cur: [ 15204352 ] Max: [ 15204352 ]

raised V22.RAISE_EXCEPTION.V22_EXCEPTION_TEST : v22.adb:81
[./testgui]
0x496f9e v22__raise_exception at v22.adb:81
0x41c1b1 _ada_testgui at testgui.adb:830
0x488d8f main at b__testgui.adb:1173
[/lib/x86_64-linux-gnu/libc.so.6]
0x7fb0fee29d8e
0x7fb0fee29e3e
[./testgui]
0x415973 _start at ???
0xfffffffffffffffe

-------------------------------------------------------------------------------------

20230921-123354 - INIT    - MSG - testgui > Exception detected, finalize application

20230921-123354 - SQL T1  - MSG - Closing SQLITE database: v22_testapi_1
20230921-123354 - SQL T1  - MSG - Closing SQLITE database: v22_testapi_2
Blady-Com commented 5 months ago

User logging feature allows to customize exception logger, see changes for align.adb and add:

   overriding procedure Log
     (Object     :    User_Defined_Logging_Type;
      Message    : in String;
      Occurrence : in Ada.Exceptions.Exception_Occurrence);

with your own code inside Log body.