aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.h
diff options
context:
space:
mode:
authorDmitriy Anisimkov <anisimko@adacore.com>2020-11-27 11:18:46 +0600
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-16 08:01:01 -0500
commitbe19b8662bd2601ea761fe5adec3a7ce3940dd7c (patch)
tree228046d486e5d591b85d7d4214d0e67395d6f75e /gcc/ada/adaint.h
parentc507c83b324582dc05db91d332b0de4b25c85c07 (diff)
downloadgcc-be19b8662bd2601ea761fe5adec3a7ce3940dd7c.zip
gcc-be19b8662bd2601ea761fe5adec3a7ce3940dd7c.tar.gz
gcc-be19b8662bd2601ea761fe5adec3a7ce3940dd7c.tar.bz2
[Ada] Fix gmem.out corruption by GNAT.Expect
gcc/ada/ * adaint.h (__gnat_in_child_after_fork): New flag to express child process side after fork call. * adaint.c (__gnat_portable_spawn): Set flag __gnat_in_child_after_fork. * expect.c (__gnat_expect_fork): Set __gnat_in_child_after_fork to one on child side. * libgnat/memtrack.adb (In_Child_After_Fork): Flag to disable memory tracking. (Allow_Trace): New routine defining if memory should be tracked. (Alloc, Realloc, Free): Use Allow_Trace in "if" condition instead of First_Call.
Diffstat (limited to 'gcc/ada/adaint.h')
-rw-r--r--gcc/ada/adaint.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 4f42f6c..85997b9 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -139,7 +139,15 @@ struct file_attributes {
* fit the above struct on any system)
*/
-extern int __gnat_max_path_len;
+extern int __gnat_max_path_len;
+extern int __gnat_in_child_after_fork;
+/* This flag expresses the state when the fork call just returned zero result,
+ * i.e. when the new born child process is created and the new executable is
+ * not loaded yet. It is used to e.g. disable tracing memory
+ * allocation/deallocation in memtrack.adb just after fork returns in the child
+ * process to avoid both parent and child writing to the same gmem.out file
+ * simultaneously */
+
extern OS_Time __gnat_current_time (void);
extern void __gnat_current_time_string (char *);
extern void __gnat_to_gm_time (OS_Time *, int *, int *,