gdb: update store_integer's comment
Commit Message
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.
---
gdb/extract-store-integer.c | 4 ++--
gdb/extract-store-integer.h | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
Comments
On 5/4/26 3:16 AM, 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.
> ---
> gdb/extract-store-integer.c | 4 ++--
> gdb/extract-store-integer.h | 3 ++-
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/extract-store-integer.c b/gdb/extract-store-integer.c
> index a7bce99362d..66ddae33aa8 100644
> --- a/gdb/extract-store-integer.c
> +++ b/gdb/extract-store-integer.c
> @@ -129,8 +129,8 @@ 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. */
> +/* Take a host-format integer VAL and store it as a target-format
> + integer at DST. */
> template<typename T, typename>
> void
> store_integer (gdb::array_view<gdb_byte> dst, enum bfd_endian byte_order,
This one should be "See extract-store-integer.h.", since we have a
declaration for this in the header.
> diff --git a/gdb/extract-store-integer.h b/gdb/extract-store-integer.h
> index 76dfd49d62a..16a6a852bf7 100644
> --- a/gdb/extract-store-integer.h
> +++ b/gdb/extract-store-integer.h
> @@ -57,7 +57,8 @@ 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. */
Since it's a short and simple comment, my preference would be to put a
specific comment on all the variants. This makes the comments more
useful, especially when you hover over a function call in an IDE.
Simon
@@ -129,8 +129,8 @@ 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. */
+/* Take a host-format integer VAL and store it as a target-format
+ integer at DST. */
template<typename T, typename>
void
store_integer (gdb::array_view<gdb_byte> dst, enum bfd_endian byte_order,
@@ -57,7 +57,8 @@ 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. */
template<typename T, typename = RequireLongest<T>>
extern void store_integer (gdb::array_view<gdb_byte> dst,