Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
	Tom Tromey <tromey@redhat.com>
Subject: Re: [patch] Fix internal error on optimized-out values (regression by me)
Date: Mon, 10 Oct 2011 21:40:00 -0000	[thread overview]
Message-ID: <201110102240.28440.pedro@codesourcery.com> (raw)
In-Reply-To: <20111010205407.GA5193@host1.jankratochvil.net>

On Monday 10 October 2011 21:54:08, Jan Kratochvil wrote:
> On Mon, 03 Oct 2011 21:34:16 +0200, Tom Tromey wrote:
> > >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> > 
> > Jan> ((struct) <optimized out>).field should be IMO still <optimized
> > Jan> out>; just it became internal-error now.
> > 
> > Maybe I am misunderstanding what you are saying -- I think this should
> > also throw.  I think the rule should be that any attempt to access any
> > "invalid" contents of a value, for purposes of computation, should throw
> > an exception.
> 
> Here is problematic the term "for purposes of computation".
> 
> I agree that any computation with content of <optimized out> must throw.
> 
> But here the content is not interpreted in any way.  Only a smaller subset of
> it is used.
> 
> 
> But I do not have any argument why the former <optimized out> value is better
> than this "value has been optimized out", unaware if there is a precedent for
> either way in current codebase.  Changed it as you suggest.

IMO, this is just like "p s.f", printing <unavailable> when the whole 
of `s' is unavailable.  From the unavailable.exp test:

print globalstruct.memberf
$7 = <unavailable>
(gdb) PASS: gdb.trace/unavailable.exp: collect globals: print globalstruct.memberf
print globalstruct.memberd
print globalstruct
$9 = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}

It just happens that today, we only support either wholy
optimized-out values, or wholly not optimized-out values.  A
compiler can flatten out structures and optimize out just some
unused fields (of local vars, most usefully).  When
we get to support that, it'll follow naturally that a single
optimized out flag per value isn't sufficient, and that
((struct) <optimized out>).field will need to be able to
be <optimized out>.

-- 
Pedro Alves


  reply	other threads:[~2011-10-10 21:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-26 19:26 Jan Kratochvil
2011-09-27 13:41 ` Jan Kratochvil
2011-10-03 19:34   ` Tom Tromey
2011-10-10 20:54     ` Jan Kratochvil
2011-10-10 21:40       ` Pedro Alves [this message]
2011-10-11 17:33         ` Tom Tromey
2011-10-12 20:11           ` Jan Kratochvil
2011-10-13 15:18             ` Tom Tromey
2011-10-13 16:36               ` Jan Kratochvil
2011-10-12 20:33         ` Jan Kratochvil
2011-10-13 15:27           ` Pedro Alves

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=201110102240.28440.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=tromey@redhat.com \
    /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