From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30373 invoked by alias); 25 Nov 2016 10:07:05 -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 30243 invoked by uid 89); 25 Nov 2016 10:07:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=longest, 2437, LONGEST, CORE_ADDR X-HELO: mail-pg0-f66.google.com Received: from mail-pg0-f66.google.com (HELO mail-pg0-f66.google.com) (74.125.83.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 Nov 2016 10:06:55 +0000 Received: by mail-pg0-f66.google.com with SMTP id x23so5214070pgx.3 for ; Fri, 25 Nov 2016 02:06:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=XpBsKK7CQ73fIVs00IMt1/TuK37kFVtCMZ/Gb3okxeU=; b=bupIrq3o9GhnQFbGurRnIE5i/WIOcu1vKeHv//r1BLcn4iHMWrH4HqXx9qmjCJR6Ss DguSVTmT963CxSonatTN5lU0DNUNT/i47b9udxYFKunIsJAW7SosO6twTfhfoBUjVtvt PajFU0ZQp7YFoQdi2sK/iXDJj3ennULcO66myN2elEmjcegSATso29rpLlRNPb+RDE5o ADVFv5520TtGQ7IV9ioBhf/isfyJSx/TfWHP5/o5AWPsFn5elGuUTasHEtqNsSWktVBL aSsyRa71RwmV84tHzPCdACewtHuimcvj+hWbDcmO6SpDbPzLa5Z/1oC3MjFrzTbCtlsA C+1g== X-Gm-Message-State: AKaTC03D6kccIUheeLQYVQ4tV5+6+Mximkgp29I3F96Lb1io5oDHpLvg5X2Sf4vh0nUOlQ== X-Received: by 10.99.251.69 with SMTP id w5mr12782161pgj.124.1480068413861; Fri, 25 Nov 2016 02:06:53 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id 13sm66563287pfz.30.2016.11.25.02.06.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 02:06:53 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 2/3] Adjust Value.location for lval_register Date: Fri, 25 Nov 2016 10:07:00 -0000 Message-Id: <1480068407-22616-3-git-send-email-yao.qi@linaro.org> In-Reply-To: <1480068407-22616-1-git-send-email-yao.qi@linaro.org> References: <20161123125000.DBC6D10FB47@oc8523832656.ibm.com> <1480068407-22616-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00794.txt.bz2 value.regnum and value.next_frame_id are only used for lval_register, so this patch moves them to union value.location. As a result, when we copy value, only copy location, don't need to copy regnum and next_frame_id. gdb: 2016-11-23 Yao Qi * valops.c (value_slice): Don't set frame id of slice. * value.c (struct value) : Move them to... (struct value) : ... here. Update comments. (allocate_value_lazy): Don't set frame id and regnum. (deprecated_value_next_frame_id_hack): Adjust. (deprecated_value_regnum_hack): Adjust. (value_copy): Don't copy frame id and regnu. (value_primitive_field): Likewise. (value_from_component): Likewise. --- gdb/valops.c | 1 - gdb/value.c | 40 +++++++++++++++------------------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/gdb/valops.c b/gdb/valops.c index 8a45641..3a7550d 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3827,7 +3827,6 @@ value_slice (struct value *array, int lowbound, int length) } set_value_component_location (slice, array); - VALUE_NEXT_FRAME_ID (slice) = VALUE_NEXT_FRAME_ID (array); set_value_offset (slice, value_offset (array) + offset); } diff --git a/gdb/value.c b/gdb/value.c index 8d33501..eff5462 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -205,17 +205,23 @@ struct value /* If the value has been released. */ unsigned int released : 1; - /* Register number if the value is from a register. */ - short regnum; - /* Location of value (if lval). */ union { - /* If lval == lval_memory, this is the address in the inferior. - If lval == lval_register, this is the byte offset into the - registers structure. */ + /* If lval == lval_memory, this is the address in the inferior */ CORE_ADDR address; + /*If lval == lval_register, the value is from a register. */ + struct + { + /* Register number. */ + short regnum; + /* Frame ID of "next" frame to which a register value is relative. + If the register value is found relative to frame F, then the + frame id of F->next will be stored in next_frame_id. */ + struct frame_id next_frame_id; + } reg; + /* Pointer to internal variable. */ struct internalvar *internalvar; @@ -237,9 +243,7 @@ struct value /* Describes offset of a value within lval of a structure in target addressable memory units. If lval == lval_memory, this is an offset to - the address. If lval == lval_register, this is a further offset from - location.address within the registers structure. Note also the member - embedded_offset below. */ + the address. Note also the member embedded_offset below. */ LONGEST offset; /* Only used for bitfields; number of bits contained in them. */ @@ -262,12 +266,6 @@ struct value bitfields. */ struct value *parent; - /* Frame ID of "next" frame to which a register value is relative. A - register value is indicated when the lval enum (above) is set to - lval_register. So, if the register value is found relative to frame F, - then the frame id of F->next will be stored in next_frame_id. */ - struct frame_id next_frame_id; - /* Type of the value. */ struct type *type; @@ -945,11 +943,9 @@ allocate_value_lazy (struct type *type) val->enclosing_type = type; VALUE_LVAL (val) = not_lval; val->location.address = 0; - VALUE_NEXT_FRAME_ID (val) = null_frame_id; val->offset = 0; val->bitpos = 0; val->bitsize = 0; - VALUE_REGNUM (val) = -1; val->lazy = 1; val->embedded_offset = 0; val->pointed_to_offset = 0; @@ -1586,13 +1582,13 @@ deprecated_value_internalvar_hack (struct value *value) struct frame_id * deprecated_value_next_frame_id_hack (struct value *value) { - return &value->next_frame_id; + return &value->location.reg.next_frame_id; } short * deprecated_value_regnum_hack (struct value *value) { - return &value->regnum; + return &value->location.reg.regnum; } int @@ -1788,8 +1784,6 @@ value_copy (struct value *arg) val->offset = arg->offset; val->bitpos = arg->bitpos; val->bitsize = arg->bitsize; - VALUE_NEXT_FRAME_ID (val) = VALUE_NEXT_FRAME_ID (arg); - VALUE_REGNUM (val) = VALUE_REGNUM (arg); val->lazy = arg->lazy; val->embedded_offset = value_embedded_offset (arg); val->pointed_to_offset = arg->pointed_to_offset; @@ -3229,8 +3223,6 @@ value_primitive_field (struct value *arg1, LONGEST offset, + value_embedded_offset (arg1)); } set_value_component_location (v, arg1); - VALUE_REGNUM (v) = VALUE_REGNUM (arg1); - VALUE_NEXT_FRAME_ID (v) = VALUE_NEXT_FRAME_ID (arg1); return v; } @@ -3814,8 +3806,6 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset) } v->offset = value_offset (whole) + offset + value_embedded_offset (whole); set_value_component_location (v, whole); - VALUE_REGNUM (v) = VALUE_REGNUM (whole); - VALUE_NEXT_FRAME_ID (v) = VALUE_NEXT_FRAME_ID (whole); return v; } -- 1.9.1