[3/5] Introduce get_value_arch

Message ID 55B6A6FA.4010104@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi July 27, 2015, 9:47 p.m. UTC
  On 15-07-24 07:27 AM, Pedro Alves wrote:
>> 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.

Done, updated version:

From 89ef69ae7265ae62b7c0faeb502021262c9d0103 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Fri, 3 Jul 2015 14:36:44 -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/value.c | 8 ++++++++
 gdb/value.h | 4 ++++
 2 files changed, 12 insertions(+)
  

Comments

Pedro Alves July 28, 2015, 10:25 a.m. UTC | #1
On 07/27/2015 10:47 PM, Simon Marchi wrote:
> On 15-07-24 07:27 AM, Pedro Alves wrote:
>>> 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.
> 
> Done, updated version:
> 
> From 89ef69ae7265ae62b7c0faeb502021262c9d0103 Mon Sep 17 00:00:00 2001
> From: Simon Marchi <simon.marchi@ericsson.com>
> Date: Fri, 3 Jul 2015 14:36:44 -0400
> Subject: [PATCH] Introduce get_value_arch
> 
> Similar to get_type_arch, used to get the gdbarch associated to a
> struct value.
> 

LGTM.

> > +/* Return the gdbarch associated to the value. */

(
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
  
Simon Marchi July 28, 2015, 2:56 p.m. UTC | #2
On 15-07-28 06:25 AM, Pedro Alves wrote:
>>> +/* Return the gdbarch associated to the value. */
> 
> (
> 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

Looks like you are right:
http://english.stackexchange.com/questions/78403/acceptable-uses-for-associated-with-or-associated-to
  

Patch

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