From patchwork Thu Jul 16 18:51: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: 7725 Received: (qmail 121867 invoked by alias); 16 Jul 2015 18:51:41 -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 121552 invoked by uid 89); 16 Jul 2015 18:51:40 -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: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 16 Jul 2015 18:51:39 +0000 Received: from EUSAAHC003.ericsson.se (Unknown_Domain [147.117.188.81]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 6B.63.07675.87597A55; Thu, 16 Jul 2015 13:28:56 +0200 (CEST) Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.81) with Microsoft SMTP Server (TLS) id 14.3.210.2; Thu, 16 Jul 2015 14:51:34 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 3/5] Introduce get_value_arch Date: Thu, 16 Jul 2015 14:51:22 -0400 Message-ID: <1437072684-26565-3-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1437072684-26565-1-git-send-email-simon.marchi@ericsson.com> References: <1437072684-26565-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes 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/value.c | 6 ++++++ gdb/value.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/gdb/value.c b/gdb/value.c index 6314036..af354de 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -340,6 +340,12 @@ struct value VEC(range_s) *optimized_out; }; +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..968882d 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 to 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). */