From e5e563e46e1d5dcdcb40d78086741e8519e865a6 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sun, 4 May 2008 09:28:27 +0000 Subject: 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. --- gdb/auxv.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'gdb/auxv.c') 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 -- cgit v1.2.1