Commit r1066661: "Make it possible to run kdevelop in gdb again"

Vladimir Prus ghost at cs.msu.su
Tue Dec 29 13:30:17 UTC 2009


On Tuesday 29 December 2009 03:26:12 David Nolden wrote:

> Am Dienstag 29 Dezember 2009 01:01:20 schrieb Andreas Pakulat:
> > On 28.12.09 20:57:08, David Nolden wrote:
> > > Am Montag 28 Dezember 2009 19:53:47 schrieb Andreas Pakulat:
> > > > But then I can try to debug problems with the session-specific duchain
> > > > directory.
> > > >
> > > > I'm starting to think that having the duchain in static code loaded
> > > > before everything else is the real problem here. If that wasn't the
> > > > case we wouldn't need this obscure env var and any extra process.
> > >
> > > That would also mean that one couldn't use "IndexedIdentifier",
> > > "IndexedString", and all such duchain types statically, which would be a
> > > significant limitation for such cosmetic reasons.
> > 
> > Can you explain in more detail what limitation that is? I still can't
> > see why we need all these things set up even before main() is entered,
> > there's no code using any of these classes until at least the Core is
> > created. So Core::initialize() should be early enough for the creation
> > and initialization of the DUChain no?
> 
> In the duchain library itself, in language-plugins, etc., there is many places 
> where such objects are used as global statics, for example 'IndexedIdentifier 
> globalImportIdentifier("import{....}");' or similar. When these objects are 
> initialized, the duchain must already be initialized as well.
> 
> And it is very convenient code-wise to do this, as else, all these places 
> would require explicit initialization in an "init()" like fashion, which is 
> ugly, as it requires additional code to do the initialization, instead of just 
> relying on the standard c++ initialization of global statics.

I think you're trading one ugliness for a worse ugliness. Surely, you can either:

- make 'globalImportIdentifier' into a function that would construct the instance
of the first call
- add a custom class named IndexedIdentifierDelayedCreation that would remember the
  string passed in construct, and have

	  operator IndexedIdentifier()

   that would construct and return the needed instance.
- store everything in a temporary data structure, connect it to the real du store
when it becomes available

- Volodya





More information about the KDevelop-devel mailing list