Skip to content

Commit

Permalink
Add some debug prints in C constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsmeding committed Oct 30, 2024
1 parent 58473eb commit 1de604e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cbits/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ double clock_gettime_monotonic_seconds()
#endif /* OS */


#include <stdio.h>

static double __program_epoch;

double clock_gettime_elapsed_seconds(void)
Expand All @@ -140,6 +142,7 @@ double clock_gettime_elapsed_seconds(void)

__attribute__((constructor)) void initialise_program_epoch(void)
{
printf("--- Entering initialise_program_epoch constructor ---\n");
__program_epoch = clock_gettime_monotonic_seconds();
}

2 changes: 2 additions & 0 deletions cbits/flags.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ static void parse_options(int argc, char *argv[])
*/
__attribute__((constructor)) void process_options(int argc, char *argv[])
{
printf("--- Entering process_options constructor ---\n");

/* Find the command line options which need to be processed. These will be
* between +ACC ... [-ACC] (similar to the Haskell RTS options).
*
Expand Down

0 comments on commit 1de604e

Please sign in to comment.