public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Correct decoding AUXV on NetBSD
@ 2020-03-14 18:22 Kamil Rytarowski
  2020-03-16 13:25 ` Tom Tromey
  2020-03-16 18:17 ` [PATCH v2] Add support for "info auxv" " Kamil Rytarowski
  0 siblings, 2 replies; 14+ messages in thread
From: Kamil Rytarowski @ 2020-03-14 18:22 UTC (permalink / raw)
  To: gdb-patches

The type field is always 32bit. The value field reflects the size of
the register/pointer.

gdb/ChangeLog:

	* auxv.c (default_auxv_parse): Add new variable sizeof_auxv_type
	and use it in extract_unsigned_integer().
---
 gdb/ChangeLog | 5 +++++
 gdb/auxv.c    | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 04db5e76734..5a2eb8e3416 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-14  Kamil Rytarowski  <n54@gmx.com>
+
+	* auxv.c (default_auxv_parse): Add new variable sizeof_auxv_type
+	and use it in extract_unsigned_integer().
+
 2020-03-14  Kamil Rytarowski  <n54@gmx.com>

 	* m68k-bsd-nat.c (fetch_registers): New variable lwp and pass
diff --git a/gdb/auxv.c b/gdb/auxv.c
index c13d7a22eb9..a035034a920 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -258,6 +258,11 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
 {
   const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch ())
 				/ TARGET_CHAR_BIT;
+#ifdef __NetBSD__
+  const int sizeof_auxv_type = sizeof(int32_t);
+#else
+  const int sizeof_auxv_type = sizeof_auxv_field;
+#endif
   const enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
   gdb_byte *ptr = *readptr;

@@ -267,7 +272,7 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
   if (endptr - ptr < sizeof_auxv_field * 2)
     return -1;

-  *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
+  *typep = extract_unsigned_integer (ptr, sizeof_auxv_type, byte_order);
   ptr += sizeof_auxv_field;
   *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
   ptr += sizeof_auxv_field;
--
2.25.0


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

end of thread, other threads:[~2020-03-29 22:10 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-14 18:22 [PATCH] Correct decoding AUXV on NetBSD Kamil Rytarowski
2020-03-16 13:25 ` Tom Tromey
2020-03-16 18:17   ` Kamil Rytarowski
2020-03-16 18:17 ` [PATCH v2] Add support for "info auxv" " Kamil Rytarowski
2020-03-19 13:11   ` Kamil Rytarowski
2020-03-20 15:43   ` Tom Tromey
2020-03-20 17:27     ` Kamil Rytarowski
2020-03-20 17:27   ` [PATCH v3] " Kamil Rytarowski
2020-03-26 23:26     ` Kamil Rytarowski
2020-03-27 16:31       ` John Baldwin
2020-03-27 17:04         ` Kamil Rytarowski
2020-03-27 19:22           ` John Baldwin
2020-03-29 20:35             ` Kamil Rytarowski
2020-03-29 22:10     ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).