1 # Patch required for Solaris. |
|
2 # Will contribute upstream if possible; if so, may need to #ifdef SOLARIS. |
|
3 |
|
4 --- gdb-7.11-orig/gdb/procfs.c Tue Feb 9 19:19:39 2016 |
|
5 +++ gdb-7.11/gdb/procfs.c Thu Mar 10 13:12:47 2016 |
|
6 @@ -158,21 +158,34 @@ |
|
7 gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) |
|
8 { |
|
9 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); |
|
10 + const int sizeof_auxv_field = sizeof (void *); |
|
11 gdb_byte *ptr = *readptr; |
|
12 |
|
13 if (endptr == ptr) |
|
14 return 0; |
|
15 |
|
16 - if (endptr - ptr < 8 * 2) |
|
17 + if (endptr - ptr < sizeof_auxv_field * 2) |
|
18 return -1; |
|
19 |
|
20 - *typep = extract_unsigned_integer (ptr, 4, byte_order); |
|
21 - ptr += 8; |
|
22 + /* |
|
23 + * On 64 bit Solaris SPARC, i.e. big endian, the type will be in |
|
24 + * the left 4 bytes for 32 bit processes and the right 4 bytes |
|
25 + * for 64 bit processes. The padding is 0. |
|
26 + */ |
|
27 + if ((sizeof_auxv_field == 8) && (byte_order == BFD_ENDIAN_BIG)) { |
|
28 + if (*typep == 0) |
|
29 + *typep = extract_unsigned_integer (ptr + 4, 4, byte_order); |
|
30 + } else |
|
31 + *typep = extract_unsigned_integer (ptr, sizeof_auxv_field , byte_order); |
|
32 + |
|
33 + ptr += sizeof_auxv_field; |
|
34 + |
|
35 /* The size of data is always 64-bit. If the application is 32-bit, |
|
36 it will be zero extended, as expected. */ |
|
37 - *valp = extract_unsigned_integer (ptr, 8, byte_order); |
|
38 - ptr += 8; |
|
39 |
|
40 + *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order); |
|
41 + ptr += sizeof_auxv_field; |
|
42 + |
|
43 *readptr = ptr; |
|
44 return 1; |
|
45 } |
|
46 @@ -341,7 +354,7 @@ |
|
47 # define AS_PROC_NAME_FMT "/proc/%d/as" |
|
48 # define MAP_PROC_NAME_FMT "/proc/%d/map" |
|
49 # define STATUS_PROC_NAME_FMT "/proc/%d/status" |
|
50 -# define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus") |
|
51 +# define MAX_PROC_NAME_SIZE sizeof("/proc/012345679/lwp/0123456789/lstatus") |
|
52 # endif |
|
53 /* the name of the proc status struct depends on the implementation */ |
|
54 typedef pstatus_t gdb_prstatus_t; |
|
55 @@ -349,11 +362,11 @@ |
|
56 #else /* ! NEW_PROC_API */ |
|
57 /* format strings for /proc paths */ |
|
58 # ifndef CTL_PROC_NAME_FMT |
|
59 -# define MAIN_PROC_NAME_FMT "/proc/%05d" |
|
60 -# define CTL_PROC_NAME_FMT "/proc/%05d" |
|
61 -# define AS_PROC_NAME_FMT "/proc/%05d" |
|
62 -# define MAP_PROC_NAME_FMT "/proc/%05d" |
|
63 -# define STATUS_PROC_NAME_FMT "/proc/%05d" |
|
64 +# define MAIN_PROC_NAME_FMT "/proc/%06d" |
|
65 +# define CTL_PROC_NAME_FMT "/proc/%06d" |
|
66 +# define AS_PROC_NAME_FMT "/proc/%06d" |
|
67 +# define MAP_PROC_NAME_FMT "/proc/%06d" |
|
68 +# define STATUS_PROC_NAME_FMT "/proc/%06d" |
|
69 # define MAX_PROC_NAME_SIZE sizeof("/proc/ttttppppp") |
|
70 # endif |
|
71 /* The name of the proc status struct depends on the implementation. */ |
|