From: Kamil Rytarowski <n54@gmx.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Correct decoding AUXV on NetBSD
Date: Sat, 14 Mar 2020 19:22:58 +0100 [thread overview]
Message-ID: <20200314182258.4277-1-n54@gmx.com> (raw)
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
next reply other threads:[~2020-03-14 18:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-14 18:22 Kamil Rytarowski [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200314182258.4277-1-n54@gmx.com \
--to=n54@gmx.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox