This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Don't allow setting register in non-innermost frame
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Doug Evans <dje at google dot com>, Yao Qi <yao at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Fri, 7 Sep 2012 18:45:44 +0200
- Subject: Re: [RFC] Don't allow setting register in non-innermost frame
- References: <1345170040-25959-1-git-send-email-yao@codesourcery.com> <CADPb22SGp-9TaoA3rNi_PJordCuv_bjwFQZiHvfjktHx3Y_krA@mail.gmail.com> <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