diff options
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-profile.c | 6 | ||||
-rw-r--r-- | elf/sprof.c | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/elf/dl-profile.c b/elf/dl-profile.c index 19d1865c25..05b5c28fcb 100644 --- a/elf/dl-profile.c +++ b/elf/dl-profile.c @@ -260,7 +260,11 @@ _dl_start_profile (struct link_map *map, const char *output_dir) *(int32_t *) hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER); *(int32_t *) hist_hdr.prof_rate = __profile_frequency (); if (sizeof (hist_hdr.dimen) >= sizeof ("seconds")) - memcpy (hist_hdr.dimen, "seconds", sizeof ("seconds")); + { + memcpy (hist_hdr.dimen, "seconds", sizeof ("seconds")); + memset (hist_hdr.dimen + sizeof ("seconds"), '\0', + sizeof (hist_hdr.dimen) - sizeof ("seconds")); + } else strncpy (hist_hdr.dimen, "seconds", sizeof (hist_hdr.dimen)); hist_hdr.dimen_abbrev = 's'; diff --git a/elf/sprof.c b/elf/sprof.c index 7d7fd9f978..3424282044 100644 --- a/elf/sprof.c +++ b/elf/sprof.c @@ -752,9 +752,21 @@ load_profdata (const char *name, struct shobj *shobj) sizeof (struct gmon_hist_hdr)) != 0 || narcsp[-1] != GMON_TAG_CG_ARC) { - free (result); error (0, 0, _("`%s' is no correct profile data file for `%s'"), name, shobj->name); + if (do_test) + { + if (memcmp (addr, &gmon_hdr, sizeof (struct gmon_hdr)) != 0) + puts ("gmon_hdr differs"); + if (*(uint32_t *) result->hist != GMON_TAG_TIME_HIST) + puts ("result->hist differs"); + if (memcmp (result->hist_hdr, &hist_hdr, + sizeof (struct gmon_hist_hdr)) != 0) + puts ("hist_hdr differs"); + if (narcsp[-1] != GMON_TAG_CG_ARC) + puts ("narcsp[-1] differs"); + } + free (result); munmap (addr, st.st_size); return NULL; } |