From patchwork Tue Jul 28 15:06:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 7892 Received: (qmail 86078 invoked by alias); 28 Jul 2015 15:06:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 86065 invoked by uid 89); 28 Jul 2015 15:06:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 28 Jul 2015 15:06:25 +0000 Received: from EUSAAHC007.ericsson.se (Unknown_Domain [147.117.188.93]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 8C.73.12958.63E37B55; Tue, 28 Jul 2015 10:32:55 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.95) with Microsoft SMTP Server id 14.3.210.2; Tue, 28 Jul 2015 11:06:22 -0400 Message-ID: <55B79A6E.70308@ericsson.com> Date: Tue, 28 Jul 2015 11:06:22 -0400 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Pedro Alves , Subject: Re: [PATCH 3/5] Introduce get_value_arch References: <1437072684-26565-1-git-send-email-simon.marchi@ericsson.com> <1437072684-26565-3-git-send-email-simon.marchi@ericsson.com> <55B22112.5000703@redhat.com> <55B6A6FA.4010104@ericsson.com> <55B758AF.7050205@redhat.com> In-Reply-To: <55B758AF.7050205@redhat.com> X-IsSubscribed: yes On 15-07-28 06:25 AM, Pedro Alves wrote: > FWIW, to my non-native ears, "associated with" sounds more > natural. I'd write: > > /* Return the gdbarch associated with the value's type. */ > ) > > Thanks, > Pedro Alves Pushed version: From e512cdbdffafefa63baeb835ba6636fcef56e17d Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 28 Jul 2015 11:01:50 -0400 Subject: [PATCH] Introduce get_value_arch Similar to get_type_arch, used to get the gdbarch associated to a struct value. gdb/ChangeLog: * value.c (get_value_arch): New function. * value.h (get_value_arch): New declaration. --- gdb/ChangeLog | 5 +++++ gdb/value.c | 8 ++++++++ gdb/value.h | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1e83384..93e054b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2015-07-28 Simon Marchi + * value.c (get_value_arch): New function. + * value.h (get_value_arch): New declaration. + +2015-07-28 Simon Marchi + * value.c (struct value): Update comments. 2015-07-28 Simon Marchi diff --git a/gdb/value.c b/gdb/value.c index 7fb7e2b..0d540d5 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -340,6 +340,14 @@ struct value VEC(range_s) *optimized_out; }; +/* See value.h. */ + +struct gdbarch * +get_value_arch (const struct value *value) +{ + return get_type_arch (value_type (value)); +} + int value_bits_available (const struct value *value, int offset, int length) { diff --git a/gdb/value.h b/gdb/value.h index 7ff6aa8..e25f52b 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -99,6 +99,10 @@ struct value *value_next (struct value *); extern struct type *value_type (const struct value *); +/* Return the gdbarch associated with the value. */ + +extern struct gdbarch *get_value_arch (const struct value *value); + /* This is being used to change the type of an existing value, that code should instead be creating a new value with the changed type (but possibly shared content). */