components/gdb/patches/gdb.auxv.c.patch
changeset 243 34b34302cac9
equal deleted inserted replaced
242:8dc587754833 243:34b34302cac9
       
     1 --- gdb-6.8.orig/gdb/auxv.c	Wed Jan 16 08:27:37 2008
       
     2 +++ gdb-6.8-64/gdb/auxv.c	Tue Aug 31 14:41:16 2010
       
     3 @@ -82,7 +82,15 @@
       
     4  target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
       
     5  		   gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
       
     6  {
       
     7 -  const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
       
     8 + 
       
     9 +  /*
       
    10 +   * Solaris pads out the auxv for 32 bit process to 64 bits when
       
    11 +   * being read by a 64 bit process.  Use the native pointer size
       
    12 +   * in gdb itself to determine the auxv field size.	
       
    13 +   *
       
    14 +   * const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
       
    15 +   */
       
    16 +  const int sizeof_auxv_field = sizeof (void *);
       
    17    gdb_byte *ptr = *readptr;
       
    18  
       
    19    if (endptr == ptr)
       
    20 @@ -91,7 +99,20 @@
       
    21    if (endptr - ptr < sizeof_auxv_field * 2)
       
    22      return -1;
       
    23  
       
    24 -  *typep = extract_unsigned_integer (ptr, sizeof_auxv_field);
       
    25 +  if (sizeof_auxv_field == 8 && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) {
       
    26 +    /*
       
    27 +     * On 64 bit Solaris SPARC, i.e. big endian, the type will be in
       
    28 +     * the left 4 bytes for 32 bit processes and the right 4 bytes
       
    29 +     * for 64 bit processes.  The padding is 0.
       
    30 +     */
       
    31 +    *typep = extract_unsigned_integer (ptr, 4);
       
    32 +    if (*typep == 0) *typep = extract_unsigned_integer (ptr + 4, 4);
       
    33 +  } else {
       
    34 +    /*
       
    35 +     * Nothing special needs to be done on 32 bit or little endian systems.
       
    36 +     */
       
    37 +    *typep = extract_unsigned_integer (ptr, sizeof_auxv_field);
       
    38 +  }
       
    39    ptr += sizeof_auxv_field;
       
    40    *valp = extract_unsigned_integer (ptr, sizeof_auxv_field);
       
    41    ptr += sizeof_auxv_field;