Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Martin Baulig <martin@gnome.org>
Cc: gdb@sources.redhat.com
Subject: Re: Lifetime of local variables
Date: Tue, 16 Apr 2002 15:07:00 -0000	[thread overview]
Message-ID: <npd6wz1eof.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <86u1qghdp5.fsf@einstein.home-of-linux.org>


Martin Baulig <martin@gnome.org> writes:
> I was recently working a bit on debugging support for C# (using Mono)
> and I need a way to tell GDB about the lifetime of local variables. In
> C#, the JIT engine may decide to store two different variables at the
> same stack offset if they aren't used throughout the whole function.
> 
> Now I was wondering how to do this - DWARF 2 already has a
> `DW_AT_begin_scope' but unfortunately no `DW_AT_end_scope' - can we
> add this or something similar as a GNU extension ?

I'm going to weigh in here with the other folks:

- You should use Dwarf location lists to show where a variable is
  live, and where it lives when it's live.  They're designed for
  exactly this purpose.

- You should not emit debugging info for compiler-generated
  temporaries at all.  Those are more like registers or scratch stack
  slots than variables.
 
  Of course, Mono JIT implementers will want to examine the
  temporaries.  But it seems to me that GDB's support for printing
  machine registers and dumping stack frames should do the trick
  there.  Those are what the GCC people use.  Since the temporary
  variables' names are meaningless (right?), what's the difference
  between looking at a temporary and looking at a machine register?

  I'm a little leery of extending DW_AT_artificial's meaning to mark
  compiler-generated temporaries; those are different from things like
  `this', default constructors, and so on.
  
> After looking at the code, I found out that `struct symbol' contains a
> `ranges' field which seems to do exactly what I want - but this field
> isn't used anywhere.

That's deprecated; I really don't think we want to revive it.


      parent reply	other threads:[~2002-04-16 22:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-12 16:18 Martin Baulig
2002-04-12 16:42 ` Daniel Jacobowitz
2002-04-13  4:35   ` Martin Baulig
2002-04-13  5:08     ` Momchil Velikov
2002-04-13  5:42       ` Martin Baulig
2002-04-13 11:32     ` Daniel Jacobowitz
2002-04-13 12:53       ` Martin Baulig
2002-04-13 12:59         ` Daniel Jacobowitz
2002-04-13 13:10         ` Momchil Velikov
2002-04-16  5:56 ` Daniel Berlin
2002-04-16  6:15 ` Daniel Berlin
2002-04-16 15:07 ` Jim Blandy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=npd6wz1eof.fsf@zwingli.cygnus.com \
    --to=jimb@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=martin@gnome.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox