This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Introduce get_value_arch
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 28 Jul 2015 15:03:18 -0000
- Subject: [binutils-gdb] Introduce get_value_arch
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e512cdbdffafefa63baeb835ba6636fcef56e17d
commit e512cdbdffafefa63baeb835ba6636fcef56e17d
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Tue Jul 28 11:01:50 2015 -0400
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.
Diff:
---
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 <simon.marchi@ericsson.com>
+ * value.c (get_value_arch): New function.
+ * value.h (get_value_arch): New declaration.
+
+2015-07-28 Simon Marchi <simon.marchi@ericsson.com>
+
* value.c (struct value): Update comments.
2015-07-28 Simon Marchi <simon.marchi@ericsson.com>
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). */