summaryrefslogtreecommitdiff
path: root/gdb/procfs.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/procfs.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/procfs.c')
-rw-r--r--gdb/procfs.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c
index f40b3883b4c..da9fd4cbbe4 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -152,6 +152,35 @@ static int procfs_can_use_hw_breakpoint (int, int, int);
struct target_ops procfs_ops; /* the target vector */
+#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
+/* When GDB is built as 64-bit application on Solaris, the auxv data is
+ presented in 64-bit format. We need to provide a custom parser to handle
+ that. */
+static int
+procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
+ gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+{
+ const int pointer_size = TYPE_LENGTH (builtin_type_void_data_ptr);
+ gdb_byte *ptr = *readptr;
+
+ if (endptr == ptr)
+ return 0;
+
+ if (endptr - ptr < 8 * 2)
+ return -1;
+
+ *typep = extract_unsigned_integer (ptr, 4);
+ ptr += 8;
+ /* The size of data is always 64-bit. If the application is 32-bit,
+ it will be zero extended, as expected. */
+ *valp = extract_unsigned_integer (ptr, 8);
+ ptr += 8;
+
+ *readptr = ptr;
+ return 1;
+}
+#endif
+
static void
init_procfs_ops (void)
{
@@ -200,6 +229,11 @@ init_procfs_ops (void)
procfs_ops.to_find_memory_regions = proc_find_memory_regions;
procfs_ops.to_make_corefile_notes = procfs_make_note_section;
procfs_ops.to_can_use_hw_breakpoint = procfs_can_use_hw_breakpoint;
+
+#if defined(PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
+ procfs_ops.to_auxv_parse = procfs_auxv_parse;
+#endif
+
procfs_ops.to_magic = OPS_MAGIC;
}