From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28469 invoked by alias); 7 Sep 2012 16:46:15 -0000 Received: (qmail 28451 invoked by uid 22791); 7 Sep 2012 16:46:11 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Sep 2012 16:45:52 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q87Gjn47025092 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Sep 2012 12:45:49 -0400 Received: from host2.jankratochvil.net (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q87GjjMs010960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 7 Sep 2012 12:45:48 -0400 Date: Fri, 07 Sep 2012 16:46:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: Doug Evans , Yao Qi , gdb-patches@sourceware.org Subject: Re: [RFC] Don't allow setting register in non-innermost frame Message-ID: <20120907164544.GA18234@host2.jankratochvil.net> References: <1345170040-25959-1-git-send-email-yao@codesourcery.com> <87hartpodt.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87hartpodt.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00069.txt.bz2 On Thu, 23 Aug 2012 18:24:46 +0200, Tom Tromey wrote: > >>>>> "Doug" == Doug Evans 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 (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