Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v2] gdb: update store_integer's comment
@ 2026-05-05  6:38 Markus Metzger
  2026-05-05 16:05 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Metzger @ 2026-05-05  6:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tankut Baris Aktemur, Simon Marchi

From: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>

The comment of store_integer seems slightly outdated and does not
refer to the variants that take an array view.  Update the comment.

CC: Simon Marchi <simark@simark.ca>
---
 gdb/extract-store-integer.c |  3 +--
 gdb/extract-store-integer.h | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gdb/extract-store-integer.c b/gdb/extract-store-integer.c
index a7bce99362d..6749c46fb6b 100644
--- a/gdb/extract-store-integer.c
+++ b/gdb/extract-store-integer.c
@@ -129,8 +129,7 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
   return gdbarch_pointer_to_address (type->arch (), type, buf);
 }
 
-/* All 'store' functions accept a host-format integer and store a
-   target-format integer at ADDR which is LEN bytes long.  */
+/* See extract-store-integer.h.  */
 template<typename T, typename>
 void
 store_integer (gdb::array_view<gdb_byte> dst, enum bfd_endian byte_order,
diff --git a/gdb/extract-store-integer.h b/gdb/extract-store-integer.h
index 76dfd49d62a..49799bb0953 100644
--- a/gdb/extract-store-integer.h
+++ b/gdb/extract-store-integer.h
@@ -57,12 +57,17 @@ extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
 					struct type *type);
 
 /* All 'store' functions accept a host-format integer and store a
-   target-format integer at ADDR which is LEN bytes long.  */
+   target-format integer, either at DST, which contains its size,
+   or at ADDR, which is LEN bytes long.  */
 
+/* Take a host-format integer VAL and store it as a target-format
+   integer at DST.  */
 template<typename T, typename = RequireLongest<T>>
 extern void store_integer (gdb::array_view<gdb_byte> dst,
 			   bfd_endian byte_order, T val);
 
+/* Take a host-format integer VAL and store it as a target-format integer
+   at ADDR which is LEN bytes long.  */
 template<typename T>
 static inline void
 store_integer (gdb_byte *addr, int len, bfd_endian byte_order, T val)
@@ -70,6 +75,8 @@ store_integer (gdb_byte *addr, int len, bfd_endian byte_order, T val)
   return store_integer (gdb::make_array_view (addr, len), byte_order, val);
 }
 
+/* Take a host-format signed integer VAL and store it as a target-format
+   integer at DST.  */
 static inline void
 store_signed_integer (gdb::array_view<gdb_byte> dst, bfd_endian byte_order,
 		      LONGEST val)
@@ -77,6 +84,8 @@ store_signed_integer (gdb::array_view<gdb_byte> dst, bfd_endian byte_order,
   return store_integer (dst, byte_order, val);
 }
 
+/* Take a host-format signed integer VAL and store it as a target-format
+   integer at ADDR which is LEN bytes long.  */
 static inline void
 store_signed_integer (gdb_byte *addr, int len, bfd_endian byte_order,
 		      LONGEST val)
@@ -85,6 +94,8 @@ store_signed_integer (gdb_byte *addr, int len, bfd_endian byte_order,
 			       val);
 }
 
+/* Take a host-format unsigned integer VAL and store it as a target-format
+   integer at DST.  */
 static inline void
 store_unsigned_integer (gdb::array_view<gdb_byte> dst, bfd_endian byte_order,
 			ULONGEST val)
@@ -92,6 +103,8 @@ store_unsigned_integer (gdb::array_view<gdb_byte> dst, bfd_endian byte_order,
   return store_integer (dst, byte_order, val);
 }
 
+/* Take a host-format unsigned integer VAL and store it as a target-format
+   integer at ADDR which is LEN bytes long.  */
 static inline void
 store_unsigned_integer (gdb_byte *addr, int len, bfd_endian byte_order,
 			ULONGEST val)
-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] gdb: update store_integer's comment
  2026-05-05  6:38 [PATCH v2] gdb: update store_integer's comment Markus Metzger
@ 2026-05-05 16:05 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2026-05-05 16:05 UTC (permalink / raw)
  To: Markus Metzger, gdb-patches; +Cc: Tankut Baris Aktemur



On 2026-05-05 02:38, Markus Metzger wrote:
> From: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
> 
> The comment of store_integer seems slightly outdated and does not
> refer to the variants that take an array view.  Update the comment.
> 
> CC: Simon Marchi <simark@simark.ca>
> ---
>  gdb/extract-store-integer.c |  3 +--
>  gdb/extract-store-integer.h | 15 ++++++++++++++-
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/extract-store-integer.c b/gdb/extract-store-integer.c
> index a7bce99362d..6749c46fb6b 100644
> --- a/gdb/extract-store-integer.c
> +++ b/gdb/extract-store-integer.c
> @@ -129,8 +129,7 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
>    return gdbarch_pointer_to_address (type->arch (), type, buf);
>  }
>  
> -/* All 'store' functions accept a host-format integer and store a
> -   target-format integer at ADDR which is LEN bytes long.  */
> +/* See extract-store-integer.h.  */
>  template<typename T, typename>
>  void
>  store_integer (gdb::array_view<gdb_byte> dst, enum bfd_endian byte_order,
> diff --git a/gdb/extract-store-integer.h b/gdb/extract-store-integer.h
> index 76dfd49d62a..49799bb0953 100644
> --- a/gdb/extract-store-integer.h
> +++ b/gdb/extract-store-integer.h
> @@ -57,12 +57,17 @@ extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
>  					struct type *type);
>  
>  /* All 'store' functions accept a host-format integer and store a
> -   target-format integer at ADDR which is LEN bytes long.  */
> +   target-format integer, either at DST, which contains its size,
> +   or at ADDR, which is LEN bytes long.  */

I'd remove this "All ..." comment, the comment on each function is clear
enough.

>  
> +/* Take a host-format integer VAL and store it as a target-format
> +   integer at DST.  */

I'd use a definite form ("Take host-format integer VAL..." or "Take the host-format
integer VAL...").  We don't take about any integer, we talk about VAL
specifically.

Add an empty line between comments and functions.

With those fixed:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-05 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-05  6:38 [PATCH v2] gdb: update store_integer's comment Markus Metzger
2026-05-05 16:05 ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox