[patch] std::string::operator[] extension in debug mode

Gabriel Dos Reis gdr@integrable-solutions.net
Fri May 20 12:03:00 GMT 2005


Jonathan Wakely <cow@compsoc.man.ac.uk> writes:

| On Fri, May 20, 2005 at 02:32:46PM +0200, Gabriel Dos Reis wrote:
| 
| > Joe Buck <Joe.Buck@synopsys.COM> writes:
| > 
| > | On Thu, May 19, 2005 at 06:52:05PM -0500, Douglas Gregor wrote, to Gaby:
| > | > Of course I remember. I've reread this comment several times and I 
| > | > clearly don't understand what you meant:
| > | > 
| > | > 	"If the lib was not build with debug and user wants to use it as with
| > | > debug support, then user is in trouble he/she asked for."
| > | > 
| > | > And the point of my response to this comment was that there isn't 
| > | > supposed to be any such "trouble", and the point of this thread is that 
| > | > there is trouble and we need to fix that.
| > | 
| > | Agreed; forcing the user (or distros) to build the library twice to
| > | support debug mode is a non-starter.
| > 
| > I think something is missed here: the question is not to ask to the
| > use to build twice, but to build the library in a way that support the
| > debug mode -- for std::string.
| 
| This is something I only learnt about 10 mins ago, so I might have got
| completely the wrong idea, but ...
| 
| Could we use the linker DT_AUXILIARY feature to specify a debug-mode
| version of the stdlib?
| 
| If we added a -fstdc++debug compiler flag then it could pass an extra -l
| option to the linker, specifying a lib which would contain the debug-mode
| version of string::operator[] (and other affected functions) and the
| linker would prefer those versions over the ones in the standard .so
| 
| If the extra -l option is not given the auxiliary lib will not be used
| and the default symbols in the default .so will be used.
| 
| This could even be done without the new compiler flag, if the user
| supplies the extra lib on the command line, e.g. -lstdc++debugmode

Let me think more about your suggestion, but I wanted to point out
that whatever we do, requiring user to pass in another -lxxxx would
not fly.

| 
| For platforms without DT_AUXILIARY we just disable extern templates and
| risk ODRs.
| 
| jon

-- 
                                                       Gabriel Dos Reis 
                                           gdr@integrable-solutions.net



More information about the Libstdc++ mailing list