From 7abf2222bed225e8b39bc2256eebb29692a8fde9 Mon Sep 17 00:00:00 2001 From: Ronan Desplanques Date: Wed, 15 May 2024 14:35:59 +0200 Subject: ada: Add Dump_Buffers hooks for code coverage The purpose of this patch is to make it possible to set up code coverage for the GNAT front end in gnat1 using GNATcoverage. It is not obvious how to have GNATcoverage instrument gnat1's main function, and since the front end has a clear entry point (Gnat1drv), we add manual instrumentation annotations there. gcc/ada/ * gnat1drv.adb (Gnat1drv): Add coverage instrumentation annotations. --- gcc/ada/gnat1drv.adb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/ada') diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 754dab8..9743dfd 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -1526,6 +1526,8 @@ begin Check_Rep_Info; end if; + pragma Annotate (Xcov, Dump_Buffers); + return; end if; @@ -1679,6 +1681,8 @@ begin Atree.Print_Statistics; end if; + pragma Annotate (Xcov, Dump_Buffers); + -- The outer exception handler handles an unrecoverable error exception @@ -1693,6 +1697,9 @@ exception Set_Standard_Output; Source_Dump; Tree_Dump; + + pragma Annotate (Xcov, Dump_Buffers); + Exit_Program (E_Errors); end Gnat1drv; -- cgit v1.1