Danny Backx escreveu: > Pedro, > > Some time ago, you suggested I replaced the GCOV_CROSS_PREFIX > environment variable approach by a gcc command line option. > > Here's a proposed patch for that. Documentation (for the gcc/doc > directory) and ChangeLog are still missing. Also the old code is simply > #if'fed away, instead of deleting it. > > What do you think ? > >
It gives a me a bit the creeps to review gcc code, but looks good. Do you think this would make sense for other cross targets, and should be pushed upstream, or should we keep this as a local patch? Cheers, Pedro Alves > Danny > > ------------------------------------------------------------------------ > > Index: toplev.h > =================================================================== > --- toplev.h (revision 888) > +++ toplev.h (working copy) > @@ -132,6 +132,7 @@ > extern int flag_unswitch_loops; > extern int flag_cprop_registers; > extern int time_report; > +extern char *coverage_base; > > /* Things to do with target switches. */ > extern void print_version (FILE *, const char *); > Index: opts.c > =================================================================== > --- opts.c (revision 888) > +++ opts.c (working copy) > @@ -836,6 +836,10 @@ > fix_register (arg, 0, 0); > break; > > + case OPT_fcoverage_base_: > + coverage_base = xstrdup(arg); > + break; > + > case OPT_fdiagnostics_show_location_: > if (!strcmp (arg, "once")) > diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE; > Index: coverage.c > =================================================================== > --- coverage.c (revision 888) > +++ coverage.c (working copy) > @@ -89,6 +89,7 @@ > static char *bbg_file_name; > static unsigned bbg_file_opened; > static int bbg_function_announced; > +char *coverage_base = NULL; > > /* Name of the count data file. */ > static char *da_file_name; > @@ -776,7 +777,9 @@ > unsigned n_fns; > const struct function_list *fn; > tree string_type; > +#if USE_GCOV_PREFIX > char *gcov_cross_prefix; > +#endif > > /* Count the number of active counters. */ > for (n_ctr_types = 0, ix = 0; ix != GCOV_COUNTERS; ix++) > @@ -816,6 +819,14 @@ > /* > * Additional environment variable for cross-development. > */ > + if (coverage_base) > + { > + filename = concat (coverage_base, "/", da_file_name, NULL); > + filename_len = strlen (filename); > + filename_string = build_string (filename_len + 1, filename); > + } > + else > +#if USE_GCOV_PREFIX > if (gcov_cross_prefix = getenv ("GCOV_CROSS_PREFIX")) > { > filename = concat (gcov_cross_prefix, "/", da_file_name, NULL); > @@ -823,6 +834,7 @@ > filename_string = build_string (filename_len + 1, filename); > } > else > +#endif > { > filename = getpwd (); > filename = (filename && da_file_name[0] != '/' > Index: common.opt > =================================================================== > --- common.opt (revision 888) > +++ common.opt (working copy) > @@ -309,6 +309,10 @@ > Common Report Var(flag_no_common,0) > Do not put uninitialized globals in the common section > > +fcoverage-base= > +Common Joined Var(flag_coverage_base) > +Directory to put coverage analysis files in, for cross-compiler environments > + > fcprop-registers > Common Report Var(flag_cprop_registers) > Perform a register copy-propagation optimization pass > Index: libgcov.c > =================================================================== > --- libgcov.c (revision 888) > +++ libgcov.c (working copy) > @@ -322,8 +322,8 @@ > wchar_t x[256]; > int l = strlen(gi_filename); > l = (l < 256) ? l : 255; > - wcstombs(x, gi_filename, l); > - MessageBoxW(0, L"gcov_open", x, 0); > + mbstowcs(x, gi_filename, l); > + MessageBoxW(0, x, L"gcov_open couldn't open file", 0); > } > #endif > if (!gcov_open (gi_filename)) > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ------------------------------------------------------------------------ > > _______________________________________________ > Cegcc-devel mailing list > Cegcc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/cegcc-devel > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel