From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1246 invoked by alias); 27 Nov 2013 18:35:56 -0000 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 Received: (qmail 1232 invoked by uid 89); 27 Nov 2013 18:35:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Nov 2013 18:34:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rARIYk3h008005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Nov 2013 13:34:46 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rARIYhJj021761 for ; Wed, 27 Nov 2013 13:34:45 -0500 Message-ID: <52963B43.70207@redhat.com> Date: Wed, 27 Nov 2013 18:53:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [pushed] Fix type of not saved registers. (was: Re: [PATCH 2/2] Make "set debug frame 1" output print instead of .) References: <5208D50F.8020109@broadcom.com> <1385574760-26557-1-git-send-email-palves@redhat.com> <1385574760-26557-3-git-send-email-palves@redhat.com> <5296365E.3010602@redhat.com> In-Reply-To: <5296365E.3010602@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-11/txt/msg00856.txt.bz2 On 11/27/2013 06:13 PM, Pedro Alves wrote: > On 11/27/2013 05:52 PM, Pedro Alves wrote: >> struct value * >> frame_unwind_got_optimized (struct frame_info *frame, int regnum) >> { >> - struct gdbarch *gdbarch = frame_unwind_arch (frame); >> - struct type *reg_type = register_type (gdbarch, regnum); > > Oh, wait. Given multi-arch, the arch of FRAME might be different > from the prev frame's arch, and therefore the type of register > REGNUM should be retrieved from the unwound arch. > >> + struct value *val; >> >> - return allocate_optimized_out_value (reg_type); >> + val = value_of_register_lazy (frame, regnum); > > This is using the type of REGNUM in FRAME. I'll fix this > in a moment... Done. ----------- Fix type of not saved registers. value_of_register_lazy uses the type of REGNUM in FRAME, but given multi-arch, the arch of FRAME might be different from the previous frame's arch, and therefore the type of register REGNUM should be retrieved from the unwound arch. This used to be correct before the previous change. Tested on x86_64 Fedora 17. gdb/ 2013-11-27 Pedro Alves * frame-unwind.c (frame_unwind_got_optimized): Use the type of the register in the previous frame's arch. --- gdb/ChangeLog | 5 +++++ gdb/frame-unwind.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a2da98f..00369e9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-11-27 Pedro Alves + * frame-unwind.c (frame_unwind_got_optimized): Use the type of the + register in the previous frame's arch. + +2013-11-27 Pedro Alves + * frame-unwind.c (frame_unwind_got_optimized): Return an lval_register value instead of a not_lval value. diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index 68879f3..a731b33 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -161,11 +161,18 @@ default_frame_unwind_stop_reason (struct frame_info *this_frame, struct value * frame_unwind_got_optimized (struct frame_info *frame, int regnum) { + struct gdbarch *gdbarch = frame_unwind_arch (frame); + struct type *type = register_type (gdbarch, regnum); struct value *val; - val = value_of_register_lazy (frame, regnum); + /* Return an lval_register value, so that we print it as + "". */ + val = allocate_value_lazy (type); set_value_lazy (val, 0); set_value_optimized_out (val, 1); + VALUE_LVAL (val) = lval_register; + VALUE_REGNUM (val) = regnum; + VALUE_FRAME_ID (val) = get_frame_id (frame); return val; }