Commit 19926161 by Nathan Sidwell

libgcov.h: Move renaming of entry points to lib gcov specific portion.

	libgcc/
	* libgcov.h: Move renaming of entry points to lib gcov specific
	portion.
	(gcov_do_dump): New rename.
	(gcov_rewrite): Remove inline, make HIDDEN.
	* libgcov-driver.c (gcov_clear, gcov_exit): Remove declarations.
	(gcov_exit_compute_summary): Rename to ...
	(compute_summary): ... here.  Add LIST argument.
	(gcov_exit_merge_gcda): Rename to ...
	(merge_one_data): ... here.
	(gcov_exit_write_gcda): Rename to ...
	(write_one_data): ... here.
	(gcov_exit_merge_summary): Rename to ...
	(merge_summary): Add RUN_COUNTED argument.
	(gcov_exit_dump_gcov): Rename to ...
	(dump_one_gcov): Add RUN_COUNTED argument.
	(gcov_do_dump): New function, broken out of ...
	(gcov_exit): ... here.  Call it.

	gcc/
	* gcov-io.c (gcov_var): Make hidden.
	* gcov-tool.c (gcov_list, gcov_exit): Remove declarations.
	(gcov_do_dump): Declare.
	(gcov_output_files): Call gcov_do_dump, not gcov_exit).

From-SVN: r213188
parent 3808a9c7
2014-07-29 Nathan Sidwell <nathan@acm.org>
* gcov-io.c (gcov_var): Make hidden.
* gcov-tool.c (gcov_list, gcov_exit): Remove declarations.
(gcov_do_dump): Declare.
(gcov_output_files): Call gcov_do_dump, not gcov_exit).
2014-07-29 Martin Jambor <mjambor@suse.cz> 2014-07-29 Martin Jambor <mjambor@suse.cz>
* tree-sra.c (sra_modify_constructor_assign): Change type of stmt * tree-sra.c (sra_modify_constructor_assign): Change type of stmt
...@@ -25,8 +32,8 @@ ...@@ -25,8 +32,8 @@
(walk_ssa_copies): Break out from ... (walk_ssa_copies): Break out from ...
(get_polymorphic_call_info): ... here; set speculative context (get_polymorphic_call_info): ... here; set speculative context
before giving up. before giving up.
* ipa-prop.c (ipa_write_indirect_edge_info, ipa_read_indirect_edge_info): * ipa-prop.c (ipa_write_indirect_edge_info,
Stream speculative context. ipa_read_indirect_edge_info): Stream speculative context.
* ipa-utils.h (ipa_polymorphic_call_context): Add speculative info * ipa-utils.h (ipa_polymorphic_call_context): Add speculative info
(SPECULATIVE_OFFSET, SPECULATIVE_OUTER_TYPE, (SPECULATIVE_OFFSET, SPECULATIVE_OUTER_TYPE,
SPECULATIVE_MAYBE_DERIVED_TYPE). SPECULATIVE_MAYBE_DERIVED_TYPE).
...@@ -41,7 +48,7 @@ ...@@ -41,7 +48,7 @@
2014-07-28 Trevor Saunders <tsaunders@mozilla.com> 2014-07-28 Trevor Saunders <tsaunders@mozilla.com>
* config/i386/i386.c (ix86_return_in_memory): replace one * config/i386/i386.c (ix86_return_in_memory): Replace one
ATTRIBUTE_UNUSED where the attribute can actually sometimes be unused. ATTRIBUTE_UNUSED where the attribute can actually sometimes be unused.
2014-07-28 Marek Polacek <polacek@redhat.com> 2014-07-28 Marek Polacek <polacek@redhat.com>
......
...@@ -39,7 +39,7 @@ static void gcov_allocate (unsigned); ...@@ -39,7 +39,7 @@ static void gcov_allocate (unsigned);
/* Optimum number of gcov_unsigned_t's read from or written to disk. */ /* Optimum number of gcov_unsigned_t's read from or written to disk. */
#define GCOV_BLOCK_SIZE (1 << 10) #define GCOV_BLOCK_SIZE (1 << 10)
GCOV_LINKAGE struct gcov_var GCOV_LINKAGE ATTRIBUTE_HIDDEN struct gcov_var
{ {
FILE *file; FILE *file;
gcov_position_t start; /* Position of first byte of block */ gcov_position_t start; /* Position of first byte of block */
......
...@@ -38,13 +38,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -38,13 +38,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <ftw.h> #include <ftw.h>
#include <getopt.h> #include <getopt.h>
extern struct gcov_info *gcov_list;
extern int gcov_profile_merge (struct gcov_info*, struct gcov_info*, int, int); extern int gcov_profile_merge (struct gcov_info*, struct gcov_info*, int, int);
extern int gcov_profile_normalize (struct gcov_info*, gcov_type); extern int gcov_profile_normalize (struct gcov_info*, gcov_type);
extern int gcov_profile_scale (struct gcov_info*, float, int, int); extern int gcov_profile_scale (struct gcov_info*, float, int, int);
extern struct gcov_info* gcov_read_profile_dir (const char*, int); extern struct gcov_info* gcov_read_profile_dir (const char*, int);
extern void gcov_exit (void); extern void gcov_do_dump (struct gcov_info *, int);
extern void gcov_set_verbose (void); extern void gcov_set_verbose (void);
/* Set to verbose output mode. */ /* Set to verbose output mode. */
...@@ -110,8 +108,7 @@ gcov_output_files (const char *out, struct gcov_info *profile) ...@@ -110,8 +108,7 @@ gcov_output_files (const char *out, struct gcov_info *profile)
if (ret) if (ret)
fatal_error ("Cannot change directory to %s", out); fatal_error ("Cannot change directory to %s", out);
gcov_list = profile; gcov_do_dump (profile, 0);
gcov_exit ();
ret = chdir (pwd); ret = chdir (pwd);
if (ret) if (ret)
......
2014-07-29 Nathan Sidwell <nathan@acm.org>
* libgcov.h: Move renaming of entry points to lib gcov specific
portion.
(gcov_do_dump): New rename.
(gcov_rewrite): Remove inline, make HIDDEN.
* libgcov-driver.c (gcov_clear, gcov_exit): Remove declarations.
(gcov_exit_compute_summary): Rename to ...
(compute_summary): ... here. Add LIST argument.
(gcov_exit_merge_gcda): Rename to ...
(merge_one_data): ... here.
(gcov_exit_write_gcda): Rename to ...
(write_one_data): ... here.
(gcov_exit_merge_summary): Rename to ...
(merge_summary): Add RUN_COUNTED argument.
(gcov_exit_dump_gcov): Rename to ...
(dump_one_gcov): Add RUN_COUNTED argument.
(gcov_do_dump): New function, broken out of ...
(gcov_exit): ... here. Call it.
2014-07-27 Anthony Green <green@moxielogic.com> 2014-07-27 Anthony Green <green@moxielogic.com>
* config.host: Add moxiebox configuration suppport. * config.host: Add moxiebox configuration suppport.
......
...@@ -48,10 +48,6 @@ static int gcov_error (const char *, ...); ...@@ -48,10 +48,6 @@ static int gcov_error (const char *, ...);
#include "gcov-io.c" #include "gcov-io.c"
/* The following functions can be called from outside of this file. */
extern void gcov_clear (void) ATTRIBUTE_HIDDEN;
extern void gcov_exit (void) ATTRIBUTE_HIDDEN;
struct gcov_fn_buffer struct gcov_fn_buffer
{ {
struct gcov_fn_buffer *next; struct gcov_fn_buffer *next;
...@@ -293,8 +289,8 @@ static int run_accounted = 0; ...@@ -293,8 +289,8 @@ static int run_accounted = 0;
Also determines the longest filename length of the info files. */ Also determines the longest filename length of the info files. */
static gcov_unsigned_t static gcov_unsigned_t
gcov_exit_compute_summary (struct gcov_summary *this_prg, compute_summary (struct gcov_info *list, struct gcov_summary *this_prg,
size_t *max_length) size_t *max_length)
{ {
struct gcov_info *gi_ptr; struct gcov_info *gi_ptr;
const struct gcov_fn_info *gfi_ptr; const struct gcov_fn_info *gfi_ptr;
...@@ -308,7 +304,7 @@ gcov_exit_compute_summary (struct gcov_summary *this_prg, ...@@ -308,7 +304,7 @@ gcov_exit_compute_summary (struct gcov_summary *this_prg,
/* Find the totals for this execution. */ /* Find the totals for this execution. */
memset (this_prg, 0, sizeof (*this_prg)); memset (this_prg, 0, sizeof (*this_prg));
*max_length = 0; *max_length = 0;
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next) for (gi_ptr = list; gi_ptr; gi_ptr = gi_ptr->next)
{ {
size_t len = strlen (gi_ptr->filename); size_t len = strlen (gi_ptr->filename);
if (len > *max_length) if (len > *max_length)
...@@ -362,13 +358,13 @@ gcov_exit_compute_summary (struct gcov_summary *this_prg, ...@@ -362,13 +358,13 @@ gcov_exit_compute_summary (struct gcov_summary *this_prg,
Return -1 on error. In this case, caller will goto read_fatal. */ Return -1 on error. In this case, caller will goto read_fatal. */
static int static int
gcov_exit_merge_gcda (const char *filename, merge_one_data (const char *filename,
struct gcov_info *gi_ptr, struct gcov_info *gi_ptr,
struct gcov_summary *prg_p, struct gcov_summary *prg_p,
struct gcov_summary *this_prg, struct gcov_summary *this_prg,
gcov_position_t *summary_pos_p, gcov_position_t *summary_pos_p,
gcov_position_t *eof_pos_p, gcov_position_t *eof_pos_p,
gcov_unsigned_t crc32) gcov_unsigned_t crc32)
{ {
gcov_unsigned_t tag, length; gcov_unsigned_t tag, length;
unsigned t_ix; unsigned t_ix;
...@@ -512,10 +508,10 @@ read_error: ...@@ -512,10 +508,10 @@ read_error:
We will write the file starting from SUMMAY_POS. */ We will write the file starting from SUMMAY_POS. */
static void static void
gcov_exit_write_gcda (const struct gcov_info *gi_ptr, write_one_data (const struct gcov_info *gi_ptr,
const struct gcov_summary *prg_p, const struct gcov_summary *prg_p,
const gcov_position_t eof_pos, const gcov_position_t eof_pos,
const gcov_position_t summary_pos) const gcov_position_t summary_pos)
{ {
unsigned f_ix; unsigned f_ix;
struct gcov_summary_buffer *next_sum_buffer; struct gcov_summary_buffer *next_sum_buffer;
...@@ -607,10 +603,10 @@ gcov_exit_write_gcda (const struct gcov_info *gi_ptr, ...@@ -607,10 +603,10 @@ gcov_exit_write_gcda (const struct gcov_info *gi_ptr,
Return -1 on error. Return 0 on success. */ Return -1 on error. Return 0 on success. */
static int static int
gcov_exit_merge_summary (const char *filename, merge_summary (const char *filename, int run_counted,
const struct gcov_info *gi_ptr, struct gcov_summary *prg, const struct gcov_info *gi_ptr, struct gcov_summary *prg,
struct gcov_summary *this_prg, gcov_unsigned_t crc32, struct gcov_summary *this_prg, gcov_unsigned_t crc32,
struct gcov_summary *all_prg __attribute__ ((unused))) struct gcov_summary *all_prg __attribute__ ((unused)))
{ {
struct gcov_ctr_summary *cs_prg, *cs_tprg; struct gcov_ctr_summary *cs_prg, *cs_tprg;
unsigned t_ix; unsigned t_ix;
...@@ -629,7 +625,7 @@ gcov_exit_merge_summary (const char *filename, ...@@ -629,7 +625,7 @@ gcov_exit_merge_summary (const char *filename,
{ {
int first = !cs_prg->runs; int first = !cs_prg->runs;
if (!run_accounted) if (!run_counted)
cs_prg->runs++; cs_prg->runs++;
if (first) if (first)
cs_prg->num = cs_tprg->num; cs_prg->num = cs_tprg->num;
...@@ -691,9 +687,10 @@ gcov_exit_merge_summary (const char *filename, ...@@ -691,9 +687,10 @@ gcov_exit_merge_summary (const char *filename,
summaries separate. */ summaries separate. */
static void static void
gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf, dump_one_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf,
gcov_unsigned_t crc32, struct gcov_summary *all_prg, unsigned run_counted,
struct gcov_summary *this_prg) gcov_unsigned_t crc32, struct gcov_summary *all_prg,
struct gcov_summary *this_prg)
{ {
struct gcov_summary prg; /* summary for this object over all program. */ struct gcov_summary prg; /* summary for this object over all program. */
int error; int error;
...@@ -717,8 +714,8 @@ gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf, ...@@ -717,8 +714,8 @@ gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf,
gcov_error ("profiling:%s:Not a gcov data file\n", gf->filename); gcov_error ("profiling:%s:Not a gcov data file\n", gf->filename);
goto read_fatal; goto read_fatal;
} }
error = gcov_exit_merge_gcda (gf->filename, gi_ptr, &prg, this_prg, error = merge_one_data (gf->filename, gi_ptr, &prg, this_prg,
&summary_pos, &eof_pos, crc32); &summary_pos, &eof_pos, crc32);
if (error == -1) if (error == -1)
goto read_fatal; goto read_fatal;
} }
...@@ -731,12 +728,12 @@ gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf, ...@@ -731,12 +728,12 @@ gcov_exit_dump_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf,
summary_pos = eof_pos; summary_pos = eof_pos;
} }
error = gcov_exit_merge_summary (gf->filename, gi_ptr, &prg, this_prg, error = merge_summary (gf->filename, run_counted, gi_ptr, &prg, this_prg,
crc32, all_prg); crc32, all_prg);
if (error == -1) if (error == -1)
goto read_fatal; goto read_fatal;
gcov_exit_write_gcda (gi_ptr, &prg, eof_pos, summary_pos); write_one_data (gi_ptr, &prg, eof_pos, summary_pos);
/* fall through */ /* fall through */
read_fatal:; read_fatal:;
...@@ -755,8 +752,8 @@ read_fatal:; ...@@ -755,8 +752,8 @@ read_fatal:;
summary and then traverses gcov_list list and dumps the gcov_info summary and then traverses gcov_list list and dumps the gcov_info
objects one by one. */ objects one by one. */
void void ATTRIBUTE_HIDDEN
gcov_exit (void) gcov_do_dump (struct gcov_info *list, int run_counted)
{ {
struct gcov_info *gi_ptr; struct gcov_info *gi_ptr;
struct gcov_filename gf; struct gcov_filename gf;
...@@ -764,14 +761,7 @@ gcov_exit (void) ...@@ -764,14 +761,7 @@ gcov_exit (void)
struct gcov_summary all_prg; struct gcov_summary all_prg;
struct gcov_summary this_prg; struct gcov_summary this_prg;
/* Prevent the counters from being dumped a second time on exit when the crc32 = compute_summary (list, &this_prg, &gf.max_length);
application already wrote out the profile using __gcov_dump(). */
if (gcov_dump_complete)
return;
gcov_dump_complete = 1;
crc32 = gcov_exit_compute_summary (&this_prg, &gf.max_length);
allocate_filename_struct (&gf); allocate_filename_struct (&gf);
#if !GCOV_LOCKED #if !GCOV_LOCKED
...@@ -779,13 +769,27 @@ gcov_exit (void) ...@@ -779,13 +769,27 @@ gcov_exit (void)
#endif #endif
/* Now merge each file. */ /* Now merge each file. */
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next) for (gi_ptr = list; gi_ptr; gi_ptr = gi_ptr->next)
gcov_exit_dump_gcov (gi_ptr, &gf, crc32, &all_prg, &this_prg); dump_one_gcov (gi_ptr, &gf, run_counted, crc32, &all_prg, &this_prg);
run_accounted = 1;
free (gf.filename); free (gf.filename);
} }
void
gcov_exit (void)
{
/* Prevent the counters from being dumped a second time on exit when the
application already wrote out the profile using __gcov_dump(). */
if (gcov_dump_complete)
return;
gcov_dump_complete = 1;
gcov_do_dump (gcov_list, run_accounted);
run_accounted = 1;
}
/* Reset all counters to zero. */ /* Reset all counters to zero. */
void void
......
...@@ -83,6 +83,25 @@ typedef unsigned gcov_type_unsigned __attribute__ ((mode (QI))); ...@@ -83,6 +83,25 @@ typedef unsigned gcov_type_unsigned __attribute__ ((mode (QI)));
#define GCOV_LOCKED 0 #define GCOV_LOCKED 0
#endif #endif
/* In libgcov we need these functions to be extern, so prefix them with
__gcov. In libgcov they must also be hidden so that the instance in
the executable is not also used in a DSO. */
#define gcov_var __gcov_var
#define gcov_open __gcov_open
#define gcov_close __gcov_close
#define gcov_write_tag_length __gcov_write_tag_length
#define gcov_position __gcov_position
#define gcov_seek __gcov_seek
#define gcov_rewrite __gcov_rewrite
#define gcov_is_error __gcov_is_error
#define gcov_write_unsigned __gcov_write_unsigned
#define gcov_write_counter __gcov_write_counter
#define gcov_write_summary __gcov_write_summary
#define gcov_read_unsigned __gcov_read_unsigned
#define gcov_read_counter __gcov_read_counter
#define gcov_read_summary __gcov_read_summary
#define gcov_do_dump __gcov_do_dump
#else /* IN_GCOV_TOOL */ #else /* IN_GCOV_TOOL */
/* About the host. */ /* About the host. */
/* This path will be compiled for the host and linked into /* This path will be compiled for the host and linked into
...@@ -126,24 +145,6 @@ extern struct gcov_info *gcov_list; ...@@ -126,24 +145,6 @@ extern struct gcov_info *gcov_list;
#endif #endif
#endif #endif
/* In libgcov we need these functions to be extern, so prefix them with
__gcov. In libgcov they must also be hidden so that the instance in
the executable is not also used in a DSO. */
#define gcov_var __gcov_var
#define gcov_open __gcov_open
#define gcov_close __gcov_close
#define gcov_write_tag_length __gcov_write_tag_length
#define gcov_position __gcov_position
#define gcov_seek __gcov_seek
#define gcov_rewrite __gcov_rewrite
#define gcov_is_error __gcov_is_error
#define gcov_write_unsigned __gcov_write_unsigned
#define gcov_write_counter __gcov_write_counter
#define gcov_write_summary __gcov_write_summary
#define gcov_read_unsigned __gcov_read_unsigned
#define gcov_read_counter __gcov_read_counter
#define gcov_read_summary __gcov_read_summary
/* Poison these, so they don't accidentally slip in. */ /* Poison these, so they don't accidentally slip in. */
#pragma GCC poison gcov_write_string gcov_write_tag gcov_write_length #pragma GCC poison gcov_write_string gcov_write_tag gcov_write_length
#pragma GCC poison gcov_time gcov_magic #pragma GCC poison gcov_time gcov_magic
...@@ -265,7 +266,7 @@ GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/, ...@@ -265,7 +266,7 @@ GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/,
const struct gcov_summary *) const struct gcov_summary *)
ATTRIBUTE_HIDDEN; ATTRIBUTE_HIDDEN;
GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/) ATTRIBUTE_HIDDEN; GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/) ATTRIBUTE_HIDDEN;
GCOV_LINKAGE inline void gcov_rewrite (void); GCOV_LINKAGE void gcov_rewrite (void) ATTRIBUTE_HIDDEN;
/* "Counts" stored in gcda files can be a real counter value, or /* "Counts" stored in gcda files can be a real counter value, or
an target address. When differentiate these two types because an target address. When differentiate these two types because
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment