[3/5] Introduce get_value_arch

Message ID 1437072684-26565-3-git-send-email-simon.marchi@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi July 16, 2015, 6:51 p.m. UTC
  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(+)
  

Comments

Pedro Alves July 24, 2015, 11:27 a.m. UTC | #1
On 07/16/2015 07:51 PM, Simon Marchi wrote:
> 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.

LGTM, with:

> ---
>  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;
>  };
>  

Missing "/* See foo.h.  */ breadcrumb.

> +struct gdbarch *
> +get_value_arch (const struct value *value)
> +{
> +  return get_type_arch (value_type (value));
> +}
> +

Thanks,
  

Patch

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).  */