Deleting intermediate pdb files using Jam.

Added by Jamie Wither almost 7 years ago

Hello,

I'm trying change our jam files so that if an object file already has a pdb file, it gets deleted before the object is compiled (so that msvc is forced to recreate rather than attempt merging). Can anyone suggest how to do this? (I've tried adding actions into rule C._MultiCppCompile_PreCompile in c-vc.jam but I've not managed to get it working).

Thanks,
Jamie.


Replies (5)

RE: Deleting intermediate pdb files using Jam. - Added by Joshua Jensen almost 7 years ago

It appears the emails that inform me about postings on this forum got lost.

What pdbs per object file are you talking about?

-Josh

RE: Deleting intermediate pdb files using Jam. - Added by Jamie Wither almost 7 years ago

Thanks for responding, I appreciate you must be very busy!

We are compiling C++ using the /Zi compiler flag to cl.exe. This means that for each .obj file that is created debug information is added to (merged into) a corresponding vc.pdb (program database) file in the same location (automatically by the compiler). The only knowledge jam has of the pdb file is that it should clean it up (this is in the rule mentioned in c-vc.jam).

I'd like to change jam to delete this pdb file before compiling the .obj file, but only if the .obj needs re-compiling. This is because the merge process seems to be a bottleneck (on some PCs in our company) and I believe forcing the compiler to recreate the file from scratch will speed things up.

Any help/pointers much appreciated.

Thank you.

RE: Deleting intermediate pdb files using Jam. - Added by Jamie Wither almost 7 years ago

I may have solved the problem, though I've yet to test it thoroughly. I've made the following addition/changes to c.jam.

actions DeletePDBFile
{
    $(RM) $(2:\\C)
}

...

rule MultiCppCompile ...
{
     ...
     # Rest
     Depends $(_obj) : $(_src) ;

     # New code - to delete the pdb file if the obj will be recompiled
     _VCPDB = vc ;
     _VCPDB = $(_VCPDB:G=$(grist):S=.pdb) ;
     Depends $(_VCPDB) : $(_obj) ;
     DeletePDBFile $(_obj) : $(_VCPDB) ;

...

RE: Deleting intermediate pdb files using Jam. - Added by Joshua Jensen almost 7 years ago

When you use /Zi, the file represented by _VCPDB above is used to collect the debug information for 1 or more .obj files. There isn't a .pdb file per .obj.

If you delete the .pdb file before you build an .obj, you will lose the debug information attached to the other .obj files that were inserted into the .pdb.

How are you expecting this to work at your company? It sounds like you would be better suited by /Z7 with a final .pdb being generated at the link step, as is done in the shipping JamPlus.

Thanks.

Josh

RE: Deleting intermediate pdb files using Jam. - Added by Jamie Wither almost 7 years ago

Thanks Josh. Yes I came to realise this as I started testing. However it could still be useful in the case where we do lump builds (where we do have one pdb per obj file). We will probably switch to /Z7, but we have found some situations where debug infomation was not available using /Z7 where it was available using /Zi, so we hoped to avoid having to use it.

(1-5/5)