diff options
author | Dmitriy Anisimkov <anisimko@adacore.com> | 2020-11-27 11:18:46 +0600 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-12-16 08:01:01 -0500 |
commit | be19b8662bd2601ea761fe5adec3a7ce3940dd7c (patch) | |
tree | 228046d486e5d591b85d7d4214d0e67395d6f75e /gcc/ada/expect.c | |
parent | c507c83b324582dc05db91d332b0de4b25c85c07 (diff) | |
download | gcc-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/expect.c')
-rw-r--r-- | gcc/ada/expect.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/expect.c b/gcc/ada/expect.c index 718886d..30c5b8e 100644 --- a/gcc/ada/expect.c +++ b/gcc/ada/expect.c @@ -39,6 +39,7 @@ #include "system.h" #endif +#include "adaint.h" #include <sys/types.h> #ifdef __MINGW32__ @@ -78,7 +79,6 @@ #include <process.h> #include <signal.h> #include <io.h> -#include "adaint.h" #include "mingw32.h" int @@ -360,7 +360,11 @@ __gnat_pipe (int *fd) int __gnat_expect_fork (void) { - return fork (); + int pid = fork(); + if (pid == 0) { + __gnat_in_child_after_fork = 1; + } + return pid; } void |