Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Doug Evans <dje@google.com>, Yao Qi <yao@codesourcery.com>,
	       gdb-patches@sourceware.org
Subject: Re: [RFC] Don't allow setting register in non-innermost frame
Date: Fri, 07 Sep 2012 16:46:00 -0000	[thread overview]
Message-ID: <20120907164544.GA18234@host2.jankratochvil.net> (raw)
In-Reply-To: <87hartpodt.fsf@fleche.redhat.com>

On Thu, 23 Aug 2012 18:24:46 +0200, Tom Tromey wrote:
> >>>>> "Doug" == Doug Evans <dje@google.com> writes:
> Doug> I *could* accept a warning when changing a register in a non-innermost
> Doug> frame, fwiw.
> 
> That would be ok by me.

I do not find correct even the warning.

It is absolutely normal user operation:

volatile int v = 42;
void __attribute__ ((noinline, noclone))
f (void)
{
  v++;
}
int
main (void)
{
  int i = v;
  f ();
  return i;
}
gcc-4.7.1-5.fc18.x86_64
gcc -Wall -g -O2
readelf -wio
 <2><61>: Abbrev Number: 4 (DW_TAG_variable)
    <62>   DW_AT_name        : i
    <6a>   DW_AT_location    : 0x0      (location list)
    Offset   Begin    End      Expression
    00000000 0000000000400407 000000000040040f (DW_OP_reg3 (rbx))
    00000000 000000000040040f 0000000000400410 (DW_OP_reg0 (rax))
    00000000 <End of list>

(gdb) b f
Breakpoint 1 at 0x400500: file 70.c, line 5.
(gdb) run
Breakpoint 1, f () at 70.c:5
(gdb) up
#1  0x000000000040040c in main () at 70.c:11
11	  f ();
(gdb) set variable i=20
warning: Assigning to register in non-innermost frame.

Why?

I would find correct to print such warning for:
	(gdb) set $rbx=20
There it should happen only if user has explicitly specified the register
itself.

Also I would find more appropriate to call 'query' in such case but that is
a nitpick.


Thanks,
Jan


  parent reply	other threads:[~2012-09-07 16:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17  2:21 Yao Qi
2012-08-20 20:19 ` Doug Evans
2012-08-21  3:27   ` Yao Qi
2012-08-23 16:25   ` Tom Tromey
2012-08-29  9:51     ` Yao Qi
2012-09-04 22:37       ` dje
2012-09-07 10:01         ` Yao Qi
2012-09-07 10:11           ` Eli Zaretskii
2012-09-07 10:21             ` Yao Qi
2012-09-07 11:27               ` Eli Zaretskii
2012-09-07 13:14                 ` Yao Qi
2012-09-07 14:32                   ` Eli Zaretskii
2012-09-07 16:46     ` Jan Kratochvil [this message]
2012-09-09  2:31       ` Yao Qi
2012-09-10  2:02       ` Yao Qi
2012-09-10  7:47         ` Jan Kratochvil
2012-09-10 19:43           ` Jan Kratochvil
2012-09-11 17:12         ` Tom Tromey
2012-09-11 17:19           ` Jan Kratochvil
2012-09-11 17:23             ` Tom Tromey
2012-09-12  0:51           ` Yao Qi
2012-09-12 13:19             ` Jan Kratochvil

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=20120907164544.GA18234@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    --cc=yao@codesourcery.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