diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2011-05-05 02:46:38 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2011-05-05 02:46:38 +0000 |
| commit | 4f9c367f0b8be0d7075dfdff9ec358aeed797d48 (patch) | |
| tree | 6d90997f7bfafdaf6b0d25996cf5d47edd4d715e /llvm/runtime | |
| parent | 8f7770f8b4c4e330bbfecac1b2f43ea824ad6127 (diff) | |
| download | bcm5719-llvm-4f9c367f0b8be0d7075dfdff9ec358aeed797d48.tar.gz bcm5719-llvm-4f9c367f0b8be0d7075dfdff9ec358aeed797d48.zip | |
Update the gcov version used slightly, to make it stop causing modern gcov's to
crash.
llvm-svn: 130911
Diffstat (limited to 'llvm/runtime')
| -rw-r--r-- | llvm/runtime/libprofile/GCDAProfiling.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/runtime/libprofile/GCDAProfiling.c b/llvm/runtime/libprofile/GCDAProfiling.c index dcf57ab9edc..8ab42276003 100644 --- a/llvm/runtime/libprofile/GCDAProfiling.c +++ b/llvm/runtime/libprofile/GCDAProfiling.c @@ -48,6 +48,17 @@ static void write_int64(uint64_t i) { write_int32(hi); } +static uint32_t length_of_string(const char *s) { + return (strlen(s) + 5) / 4; +} + +static void write_string(const char *s) { + uint32_t len = length_of_string(s); + write_int32(len); + fwrite(s, strlen(s), 1, output_file); + fwrite("\0\0\0\0", 4 - (strlen(s) % 4), 1, output_file); +} + static char *mangle_filename(const char *orig_filename) { /* TODO: handle GCOV_PREFIX_STRIP */ const char *prefix; @@ -129,16 +140,18 @@ void llvm_gcda_increment_indirect_counter(uint32_t *predecessor, #endif } -void llvm_gcda_emit_function(uint32_t ident) { +void llvm_gcda_emit_function(uint32_t ident, const char *function_name) { #ifdef DEBUG_GCDAPROFILING printf("llvmgcda: function id=%x\n", ident); #endif /* function tag */ fwrite("\0\0\0\1", 4, 1, output_file); - write_int32(2); + write_int32(3 + 1 + length_of_string(function_name)); write_int32(ident); write_int32(0); + write_int32(0); + write_string(function_name); } void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) { |

