public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Symbol debug information
@ 2002-08-17  9:40 Paul Brook
  2002-08-17 10:13 ` Daniel Berlin
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Brook @ 2002-08-17  9:40 UTC (permalink / raw)
  To: gcc

I'm currently working on the Fortran95 frontend for GCC 
(g95.sourceforge.net), and don't seem to be able to create debugging 
information for variables.

Line number information, and symbol information for function parameters 
works OK, just not VAR_DECLs.

Any idea what I might be missing/doing wrong? I'm creating DECL_STMT nodes, 
and calling pushdecl, is there anything else I need to do to tell the 
backend about the variable?

I'm using the tree-ssa branch and gdb 2.1.92-1 (RedHat).
The code tree is fed to the backend a function at a time using the C RTL 
expander (in c-semantics.c).

Paul Brook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Symbol debug information
  2002-08-17  9:40 Symbol debug information Paul Brook
@ 2002-08-17 10:13 ` Daniel Berlin
  2002-08-19 14:01   ` Paul Brook
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Berlin @ 2002-08-17 10:13 UTC (permalink / raw)
  To: Paul Brook; +Cc: gcc

yOn Sat, 17 Aug 2002, Paul Brook wrote:

> I'm currently working on the Fortran95 frontend for GCC 
> (g95.sourceforge.net), and don't seem to be able to create debugging 
> information for variables.
> 
> Line number information, and symbol information for function parameters 
> works OK, just not VAR_DECLs.

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))".
--Dan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Symbol debug information
  2002-08-17 10:13 ` Daniel Berlin
@ 2002-08-19 14:01   ` Paul Brook
  2002-08-21  4:34     ` Michal Moskal
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Brook @ 2002-08-19 14:01 UTC (permalink / raw)
  To: gcc

> 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.

Paul Brook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Symbol debug information
  2002-08-19 14:01   ` Paul Brook
@ 2002-08-21  4:34     ` Michal Moskal
  2002-08-21  4:35       ` Michal Moskal
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Moskal @ 2002-08-21  4:34 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Symbol debug information
  2002-08-21  4:34     ` Michal Moskal
@ 2002-08-21  4:35       ` Michal Moskal
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Moskal @ 2002-08-21  4:35 UTC (permalink / raw)
  To: gcc

On Wed, Aug 21, 2002 at 01:34:05PM +0200, Michal Moskal wrote:
> > 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.

Ah, forgot to say: that's not your problem if you are using
c-sementics.c to expand stuff.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-08-21  4:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-17  9:40 Symbol debug information Paul Brook
2002-08-17 10:13 ` Daniel Berlin
2002-08-19 14:01   ` Paul Brook
2002-08-21  4:34     ` Michal Moskal
2002-08-21  4:35       ` Michal Moskal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).