--- gdb-7.6/gdb/procfs.c 2012-12-31 22:32:49.000000000 -0800
+++ gdb-7.6/gdb/procfs.c 2013-08-15 00:05:56.550245791 -0700
@@ -159,20 +159,33 @@
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+ const int sizeof_auxv_field = sizeof (void *);
gdb_byte *ptr = *readptr;
if (endptr == ptr)
return 0;
- if (endptr - ptr < 8 * 2)
+ if (endptr - ptr < sizeof_auxv_field * 2)
return -1;
- *typep = extract_unsigned_integer (ptr, 4, byte_order);
- ptr += 8;
+ /*
+ * On 64 bit Solaris SPARC, i.e. big endian, the type will be in
+ * the left 4 bytes for 32 bit processes and the right 4 bytes
+ * for 64 bit processes. The padding is 0.
+ */
+ if ((sizeof_auxv_field == 8) && (byte_order == BFD_ENDIAN_BIG)) {
+ if (*typep == 0)
+ *typep = extract_unsigned_integer (ptr + 4, 4, byte_order);
+ } else
+ *typep = extract_unsigned_integer (ptr, sizeof_auxv_field , byte_order);
+
+ ptr += sizeof_auxv_field;
+
/* 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, byte_order);
- ptr += 8;
+
+ *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
+ ptr += sizeof_auxv_field;
*readptr = ptr;
return 1;
@@ -347,7 +360,7 @@
# define AS_PROC_NAME_FMT "/proc/%d/as"
# define MAP_PROC_NAME_FMT "/proc/%d/map"
# define STATUS_PROC_NAME_FMT "/proc/%d/status"
-# define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus")
+# define MAX_PROC_NAME_SIZE sizeof("/proc/012345679/lwp/0123456789/lstatus")
# endif
/* the name of the proc status struct depends on the implementation */
typedef pstatus_t gdb_prstatus_t;
@@ -355,11 +368,11 @@
#else /* ! NEW_PROC_API */
/* format strings for /proc paths */
# ifndef CTL_PROC_NAME_FMT
-# define MAIN_PROC_NAME_FMT "/proc/%05d"
-# define CTL_PROC_NAME_FMT "/proc/%05d"
-# define AS_PROC_NAME_FMT "/proc/%05d"
-# define MAP_PROC_NAME_FMT "/proc/%05d"
-# define STATUS_PROC_NAME_FMT "/proc/%05d"
+# define MAIN_PROC_NAME_FMT "/proc/%06d"
+# define CTL_PROC_NAME_FMT "/proc/%06d"
+# define AS_PROC_NAME_FMT "/proc/%06d"
+# define MAP_PROC_NAME_FMT "/proc/%06d"
+# define STATUS_PROC_NAME_FMT "/proc/%06d"
# define MAX_PROC_NAME_SIZE sizeof("/proc/ttttppppp")
# endif
/* The name of the proc status struct depends on the implementation. */