summaryrefslogtreecommitdiff
path: root/lib/profile/GCDAProfiling.c
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-02-28 07:00:13 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-02-28 07:00:13 +0000
commit58c400c58019070045e548bb5173b22af092f314 (patch)
tree18f2180878e0e8baf8f3151bca2144cbf2db61f8 /lib/profile/GCDAProfiling.c
parentb9e1319f97a9d9c2d13090e162e66ebdfbb419dd (diff)
Holy macaroons, somebody made a copy of llvm/runtime/profile/GCDAProfiling.c,
didn't delete the original, and now they've diverged. I have no idea what's going on. Apply my patch in r176173 to this one too, this one looks newer? git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@176236 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/GCDAProfiling.c')
-rw-r--r--lib/profile/GCDAProfiling.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index 7c52a1740..96e9fc2b7 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -207,18 +207,23 @@ void llvm_gcda_increment_indirect_counter(uint32_t *predecessor,
}
void llvm_gcda_emit_function(uint32_t ident, const char *function_name) {
+ uint32_t len = 3;
#ifdef DEBUG_GCDAPROFILING
- fprintf(stderr, "llvmgcda: function id=0x%08x\n", ident);
+ fprintf(stderr, "llvmgcda: function id=0x%08x name=%s\n", ident,
+ function_name ? function_name : "NULL");
#endif
if (!output_file) return;
- /* function tag */
+ /* function tag */
fwrite("\0\0\0\1", 4, 1, output_file);
- write_int32(3 + 1 + length_of_string(function_name));
+ if (function_name)
+ len += 1 + length_of_string(function_name);
+ write_int32(len);
write_int32(ident);
write_int32(0);
write_int32(0);
- write_string(function_name);
+ if (function_name)
+ write_string(function_name);
}
void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) {