summaryrefslogtreecommitdiff
path: root/gcc/jit/jit-result.c
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-09 17:01:04 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-09 17:01:04 +0000
commitdba7c78e09851314ee0b1632f3cabddbbaebc60d (patch)
tree6c908a45d62d11096d3b5ae2fb3675716fcbf926 /gcc/jit/jit-result.c
parent0375cff7152718692e3b0af90d944fb3393f0ae3 (diff)
downloadgcc-dba7c78e09851314ee0b1632f3cabddbbaebc60d.tar.gz
PR jit/64206: delay cleanup of tempdir if the user has requested debuginfo
gcc/jit/ChangeLog: PR jit/64206 * docs/internals/test-hello-world.exe.log.txt: Update, the log now shows tempdir creation/cleanup. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir to the list of subclasses in the comment. * jit-playback.c (gcc::jit::playback::context::context): Add a comment clarifying when the tempdir gets cleaned up. (gcc::jit::playback::context::compile): Pass the context's logger, if any, to the tempdir. (gcc::jit::playback::context::dlopen_built_dso): When creating the gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand over ownership of the tempdir to it. * jit-result.c: Include "jit-tempdir.h". (gcc::jit::result::result): Add tempdir param, saving it as m_tempdir. (gcc::jit::result::~result): Delete m_tempdir. * jit-result.h (gcc::jit::result::result): Add tempdir param. (gcc::jit::result::m_tempdir): New field. * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param; add JIT_LOG_SCOPE. (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit, and log m_path_template and m_path_tempdir. (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log entry/exit, and log the unlink and rmdir calls. * jit-tempdir.h: Include "jit-logging.h". (class gcc::jit::tempdir): Make this be a subclass of log_user. (gcc::jit::tempdir::tempdir): Add logger param. * notes.txt: Update to show the two possible places where the tempdir can be cleaned up. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219395 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jit/jit-result.c')
-rw-r--r--gcc/jit/jit-result.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/jit/jit-result.c b/gcc/jit/jit-result.c
index 67699e0b198..a9330e591c5 100644
--- a/gcc/jit/jit-result.c
+++ b/gcc/jit/jit-result.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "jit-common.h"
#include "jit-logging.h"
#include "jit-result.h"
+#include "jit-tempdir.h"
namespace gcc {
namespace jit {
@@ -32,9 +33,10 @@ namespace jit {
/* Constructor for gcc::jit::result. */
result::
-result(logger *logger, void *dso_handle) :
+result(logger *logger, void *dso_handle, tempdir *tempdir_) :
log_user (logger),
- m_dso_handle (dso_handle)
+ m_dso_handle (dso_handle),
+ m_tempdir (tempdir_)
{
JIT_LOG_SCOPE (get_logger ());
}
@@ -48,6 +50,13 @@ result::~result()
JIT_LOG_SCOPE (get_logger ());
dlclose (m_dso_handle);
+
+ /* Responsibility for cleaning up the tempdir (including "fake.so" within
+ the filesystem) might have been handed to us by the playback::context,
+ so that the cleanup can be delayed (see PR jit/64206).
+
+ If so, clean it up now. */
+ delete m_tempdir;
}
/* Attempt to locate the given function by name within the