extern int gcov_profile_normalize (struct gcov_info*, gcov_type);
extern int gcov_profile_scale (struct gcov_info*, float, int, int);
extern struct gcov_info* gcov_read_profile_dir (const char*, int);
-extern void gcov_do_dump (struct gcov_info *, int);
+extern void gcov_do_dump (struct gcov_info *, int, int);
extern const char *gcov_get_filename (struct gcov_info *list);
extern void gcov_set_verbose (void);
fatal_error (input_location, "output file %s already exists in folder %s",
filename, out);
- gcov_do_dump (profile, 0);
+ gcov_do_dump (profile, 0, 0);
ret = chdir (pwd);
if (ret)
static int
gcov_exit_open_gcda_file (struct gcov_info *gi_ptr,
- struct gcov_filename *gf)
+ struct gcov_filename *gf,
+ int mode)
{
int append_slash = 0;
const char *fname = gi_ptr->filename;
gf->filename = replace_filename_variables (gf->filename);
- if (!gcov_open (gf->filename, 0))
+ if (!gcov_open (gf->filename, mode))
{
/* Open failed likely due to missed directory.
Create directory and retry to open file. */
fprintf (stderr, "profiling:%s:Skip\n", gf->filename);
return -1;
}
- if (!gcov_open (gf->filename, 0))
+ if (!gcov_open (gf->filename, mode))
{
fprintf (stderr, "profiling:%s:Cannot open\n", gf->filename);
return -1;
static void
dump_one_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf,
unsigned run_counted ATTRIBUTE_UNUSED,
- gcov_type run_max ATTRIBUTE_UNUSED)
+ gcov_type run_max ATTRIBUTE_UNUSED, int mode)
{
struct gcov_summary summary = {};
int error;
gcov_unsigned_t tag;
fn_buffer = 0;
- error = gcov_exit_open_gcda_file (gi_ptr, gf);
+ error = gcov_exit_open_gcda_file (gi_ptr, gf, mode);
if (error == -1)
return;
/* Dump all the coverage counts for the program. It first computes program
summary and then traverses gcov_list list and dumps the gcov_info
- objects one by one. */
+ objects one by one. Use MODE to open files. */
#if !IN_GCOV_TOOL
static
#endif
void
-gcov_do_dump (struct gcov_info *list, int run_counted)
+gcov_do_dump (struct gcov_info *list, int run_counted, int mode)
{
struct gcov_info *gi_ptr;
struct gcov_filename gf;
/* Now merge each file. */
for (gi_ptr = list; gi_ptr; gi_ptr = gi_ptr->next)
{
- dump_one_gcov (gi_ptr, &gf, run_counted, run_max);
+ dump_one_gcov (gi_ptr, &gf, run_counted, run_max, mode);
free (gf.filename);
}
if (root->dumped)
return;
- gcov_do_dump (root->list, root->run_counted);
+ gcov_do_dump (root->list, root->run_counted, 0);
root->dumped = 1;
root->run_counted = 1;