This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [4.1 patch] relocate profile data file


Grigory Zagorodnev wrote:
Nathan,
Thank you for the feedback. We'll update the patch with respect to your notes.


 > It's not safe to save getenv return values like this.  If the
 > program calls putenv, the storage can get reallocated or blown
 > away.  You'll need to refetch it for each call to gcov_exit.

In this case we also need to getenv in gcov_version, which deals with relocated pathname as well.
just pass full the filename in.  When called from gcov_init, just use
the hardwired path -- afterall we're not looking at the disk at that
point.

 > have the full pathname available in gcov_exit and you won't
 > have to alter those error message calls.

gcov_exit operates on the list of registered object files in the loop, so we shall reallocate placeholder for the full pathname on each step. That is impossible for alloca allocated memory. Thus prefix and filename are glueing in its calees - printf, gcov_open, create_file_directory.

good point. How about remembering the longest file name in gcov_init, and then having a single alloca for that + strlen(prefix) in gcov_exit?

 > Have you thought about specifying the prefix and strip to
 > the compiler and gcov itself, so you don't need to move the
 > data files after they've been created?

Yes. We thought in this way and will possibly come up with the patch later.
great!

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]