Detecting binary out-of-dateness

Vladimir Prus ghost at cs.msu.su
Fri Aug 19 14:50:09 UTC 2005


On Friday 19 August 2005 16:08, Matt Rogers wrote:

> > Actually, I'm looking at http://bugs.kde.org/show_bug.cgi?id=59735
> > (should warn about unsaved documents or out of date binaries before
> > starting debugging) and have some questions about KDevelop core.
> >
> > The bug says that the "run debugger" command should rebuild the project
> > when the binary is out of date. However, it's not obvious how to detect
> > this.
>
> this is handled by the build system in general.

Yes, but running "make" on large project (like kdevelop) will take quite some 
time.

> > 1. Always running build can be slow. ("make install" in
> > languages/cpp/debugger
> >
> > 2. Always asking a user is terrible idea.
> >
> > 3. To detect if application is possible out of date, I need to compare
> > the time when "build" command was last run with the last time a file was
> > saved. I can detect file saves with KDevPartController's signals
> > savedFile and fileDirty, but I also need to detect the last time when the
> > project was build, so that's the reason for my question.
>
> if there was a file saved, then you should just rebuild. that's basically
> what make does anyways (notice that you can do "touch <file>" where <file>
> is a source code file and make will happily rebuild things. It may be a bit
> different with other build systems, but this simple hack should take care
> of things.

Are you sure that will be enough. Consider that user edits a file, saves it, 
rebuilds the project and only then started debugger. It's clearly better to 
not invoke build again, but for that we need to detect when build command is 
invoked.

Yes, it's possible to uncondionally build project if any files were saved 
since the last invocation of *debugger*, but it will lead to extra rebuilds, 
until users learn the invoking debugger rebuilds things ;-)

BTW, do you think that
- running of build system
- saving of currently opened but unsaved files

should be unconditional, or the user should get a dialog asking about it?

Thanks,
Volodya











More information about the KDevelop-devel mailing list