summaryrefslogtreecommitdiff
path: root/gdb/auxv.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-05-04 09:28:27 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-05-04 09:28:27 +0000
commite5e563e46e1d5dcdcb40d78086741e8519e865a6 (patch)
tree9ccc3d9335405b6278954128e4db4c1caccafab5 /gdb/auxv.c
parent3b1b1d73c10de7143a19d460cabb0543891513be (diff)
downloadgdb-e5e563e46e1d5dcdcb40d78086741e8519e865a6.tar.gz
Fix auxv data parsing on 64-bit solaris
* target.h (struct target_ops): New field to_auxv_parse. * auxv.c (default_auxv_parse): New, renamed from previous target_auxv_parse. (target_auxv_parse): Try to call target method. Fallback to default_auxv_parse if not found. * procfs.c (procfs_auxv_parse): New. (init_procfs_ops): On Solaris, in 64-bit mode, install procfs_auxv_parse.
Diffstat (limited to 'gdb/auxv.c')
-rw-r--r--gdb/auxv.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gdb/auxv.c b/gdb/auxv.c
index d1d93e78400..292a0d6fa71 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -79,7 +79,7 @@ procfs_xfer_auxv (struct target_ops *ops,
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
int
-target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
+default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
@@ -100,6 +100,22 @@ target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
return 1;
}
+/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
+ Return 0 if *READPTR is already at the end of the buffer.
+ Return -1 if there is insufficient buffer for a whole entry.
+ Return 1 if an entry was read into *TYPEP and *VALP. */
+int
+target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
+ gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+{
+ struct target_ops *t;
+ for (t = ops; t != NULL; t = t->beneath)
+ if (t->to_auxv_parse != NULL)
+ return t->to_auxv_parse (t, readptr, endptr, typep, valp);
+
+ return default_auxv_parse (ops, readptr, endptr, typep, valp);
+}
+
/* Extract the auxiliary vector entry with a_type matching MATCH.
Return zero if no such entry was found, or -1 if there was
an error getting the information. On success, return 1 after