This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Symbol debug information


On Sun, Aug 18, 2002 at 06:32:57PM +0100, Paul Brook wrote:
> > Function level variables are output when we output debug info for the
> > function_decl.
> >
> > This, in turn, is called from rest_of_decl_compilation, which is called
> > from various places in c-decl.c, ada/utils.c, etc.
> >
> >
> > Make sure it's getting called.
> > If it is, then make sure the VAR_DECL's have TREE_USED set.
> > In particular, make sure the ones you want output aren't
> > "DECL_EXTERNAL (decl) && !TREE_USED (decl))".
> 
> It turns out I was forgetting to set the SCOPE_STMT_BLOCK for the outermost 
> block.  Thanks anyway.

Hmm... I had the same problem in my front end. I have just traced source
of it. The problem is that expand_expr() doesn't emit
NOTE_INSN_BLOCK_{BEG,END} pairs for BIND_EXPR, then reorder_blocks()
removes all blocks but the outermost one, and finally dwarf2out
cannot output debug info for variables in all but outermost block.

I guess The Right Thing is make expand_expr() emit notes for blocks,
so peaople who don't do expand_*() on their own could get debugging
information for local variables.

I did a grep -r BIND_EXPR to find out whatever some front ends use it,
and it turns out to be used in two places. One if c++ front end, where
it is used for controller variable (whatever might it be :-), but with
block (2nd operand) set to NULL. The other place is f/com.c, where
it is used after block_beg/end notes has been emitted. So making
expand_expr() emit it unconditinally would cause problems with g77.

Therefore my suggestion is to make it output it only if
cfun->x_whole_function_mode, so g77 won't be hurt, and BIND_EXPR will
behave correctly.

One more drawback is that identify_block() seems to assume there is at
least one less BEG/END pair of notes then blocks. There is also check
whatever there is exactly that much of them, but it's disabled and
labeled "bug in other part of compiler". Fortunetely in
whole-function-mode all blocks are identified and identify_blocks() is
not called.

My question is: am I right? BIND_EXPR should emit these notes? If so
I'll provide a patch.

-- 
: Michal Moskal ::::: malekith/at/pld-linux.org :  GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::: Wroclaw University, CS Dept :  {E-,w}-- {b++,e}>+++ h


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]