aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/libprofile/GCDAProfiling.c
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-05-25 00:55:38 +0000
committerBill Wendling <isanbard@gmail.com>2012-05-25 00:55:38 +0000
commit717f7fa12a7a2ec076c138122bef9006b6b54487 (patch)
treef218b161ba3b470c805d7a876aae4f30eeebba5c /runtime/libprofile/GCDAProfiling.c
parentd5ce3ffa67698b9d21f58011f370a210a214d301 (diff)
downloadexternal_llvm-717f7fa12a7a2ec076c138122bef9006b6b54487.zip
external_llvm-717f7fa12a7a2ec076c138122bef9006b6b54487.tar.gz
external_llvm-717f7fa12a7a2ec076c138122bef9006b6b54487.tar.bz2
Don't call exit from a runtime.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime/libprofile/GCDAProfiling.c')
-rw-r--r--runtime/libprofile/GCDAProfiling.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/libprofile/GCDAProfiling.c b/runtime/libprofile/GCDAProfiling.c
index 3a48bb2..568b2b0 100644
--- a/runtime/libprofile/GCDAProfiling.c
+++ b/runtime/libprofile/GCDAProfiling.c
@@ -121,7 +121,7 @@ void llvm_gcda_start_file(const char *orig_filename) {
fprintf(stderr, "LLVM profiling runtime: while opening '%s': ",
cptr ? cptr + 1 : orig_filename);
perror("");
- exit(1);
+ return;
}
}
@@ -167,6 +167,7 @@ void llvm_gcda_emit_function(uint32_t ident, const char *function_name) {
#ifdef DEBUG_GCDAPROFILING
printf("llvmgcda: function id=%x\n", ident);
#endif
+ if (!output_file) return;
/* function tag */
fwrite("\0\0\0\1", 4, 1, output_file);
@@ -179,7 +180,9 @@ void llvm_gcda_emit_function(uint32_t ident, const char *function_name) {
void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) {
uint32_t i;
- /* counter #1 (arcs) tag */
+
+ /* Counter #1 (arcs) tag */
+ if (!output_file) return;
fwrite("\0\0\xa1\1", 4, 1, output_file);
write_int32(num_counters * 2);
for (i = 0; i < num_counters; ++i) {
@@ -196,6 +199,7 @@ void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) {
void llvm_gcda_end_file() {
/* Write out EOF record. */
+ if (!output_file) return;
fwrite("\0\0\0\0\0\0\0\0", 8, 1, output_file);
fclose(output_file);
output_file = NULL;