------- Comment #7 from wilson at specifix dot com  2005-12-06 03:03 -------
Subject: Re:   New: [2.95.2/3.3.3/4.0.0 Regression] g++ fails
 to emit debug information for SOME local variables in class member function
 that has templated local variables

schaudhu at blackrock dot com wrote:
> When trying to debug the following block of code, some of the function's local
> variables can not be displayed using display, print, or info scope 
> [function]. 
> Display and print will work after a certain point within the stack frame of 
> the
> function foo(), but long after the variables are initialized.  Please examine
> the following source code and output.

Part of the problem here is understanding what "scope" means.  The gdb 
command "info scope foo" will only print variables in the outer-most 
function scope for foo, i.e. variables whose scope starts at the 
beginning of the function.  In your testcase, mfact is defined part-way 
into the function.  Older gcc versions probably lie, and say that mfact 
has the same scope as foo.  Newer gcc versions try to emit accurate 
scope info, creating a lexical block to represent where mfact is live, 
even though there is no lexical block in the input.

So with gcc-4.x, info scope foo does not report mfact, and this is 
correct, because mfact is defined in a subscope.  If you try something 
like "info scope test.cc:37" then you will get all symbols you are 
expecting to see, as they are all live at this point.  So there is no 
gcc problem here, though one could perhaps argue that the gdb info scope 
command output is confusing and needs to be improved.

With gcc-3.3, things are a bit more confused.  The scope info changes 
depending on whether -DGOODDGB is defined, which seems wrong.  With it 
defined, rcode/n/mfacts all have function wide scope.  Without it 
defined, only mfacts has function scope.  The others, rcode/n/nfacts are 
all defined in a subscope.  I didn't look at why this happens.  This 
does appear to be a bug.

Oh, by the way, your g++ -DGOODDBG example is wrong.  You claim that a 
symbol is missing, but that symbol is excluded when -DGOODDBG is 
defined, so there is no problem there.

I tried gcc-3.4, and the scope info looks OK, i.e. roughly the same as 
gcc-4.0.

Based on the info you have provided, and the fact that we are no longer 
maintaining gcc-3.3, I don't see anything here to fix.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25234

Reply via email to