|
1 --- gdb-7.6/bfd/elf32-i386.c 2013-02-20 19:02:29.000000000 -0800 |
|
2 +++ gdb-7.6/bfd/elf32-i386.c 2013-10-08 09:04:26.769608447 -0700 |
|
3 @@ -434,6 +434,45 @@ |
|
4 offset = 28; |
|
5 size = bfd_get_32 (abfd, note->descdata + 8); |
|
6 } |
|
7 + else if (note->namesz == 5 && strncmp (note->namedata, "CORE", 4) == 0) |
|
8 + { |
|
9 + if (note->descsz == 432) /* sizeof(prstatus_t) Solaris Intel 32 */ |
|
10 + { |
|
11 + /* pr_cursig */ |
|
12 + elf_tdata (abfd)->core->signal = |
|
13 + bfd_get_16 (abfd, note->descdata + 136); |
|
14 + |
|
15 + /* pr_pid */ |
|
16 + elf_tdata (abfd)->core->pid = |
|
17 + bfd_get_32 (abfd, note->descdata + 216); |
|
18 + |
|
19 + /* pr_lwpid */ |
|
20 + elf_tdata (abfd)->core->lwpid = |
|
21 + bfd_get_32 (abfd, note->descdata + 308); |
|
22 + |
|
23 + /* pr_reg */ |
|
24 + offset = 356; |
|
25 + size = 76; |
|
26 + } |
|
27 + else if (note->descsz == 824) /* sizeof(prstatus_t) Solaris Intel 64 */ |
|
28 + { |
|
29 + /* pr_cursig */ |
|
30 + elf_tdata (abfd)->core->signal = |
|
31 + bfd_get_16 (abfd, note->descdata + 264); |
|
32 + |
|
33 + /* pr_pid */ |
|
34 + elf_tdata (abfd)->core->pid = |
|
35 + bfd_get_32 (abfd, note->descdata + 360); |
|
36 + |
|
37 + /* pr_lwpid */ |
|
38 + elf_tdata (abfd)->core->lwpid = |
|
39 + bfd_get_32 (abfd, note->descdata + 520); |
|
40 + |
|
41 + /* pr_reg */ |
|
42 + offset = 600; |
|
43 + size = 224; |
|
44 + } |
|
45 + } |
|
46 else |
|
47 { |
|
48 switch (note->descsz) |
|
49 @@ -476,6 +515,31 @@ |
|
50 elf_tdata (abfd)->core->command |
|
51 = _bfd_elfcore_strndup (abfd, note->descdata + 25, 81); |
|
52 } |
|
53 + else if (note->namesz == 5 && strncmp (note->namedata, "CORE", 4) == 0) |
|
54 + { |
|
55 + switch (note->descsz) |
|
56 + { |
|
57 + default: |
|
58 + return FALSE; |
|
59 + break; |
|
60 + case 260: /* sizeof(prpsinfo_t) on 32-bit Solaris */ |
|
61 + elf_tdata (abfd)->core->pid = |
|
62 + bfd_get_32 (abfd, note->descdata + 16); |
|
63 + elf_tdata (abfd)->core->program = |
|
64 + _bfd_elfcore_strndup (abfd, note->descdata + 84, 16); |
|
65 + elf_tdata (abfd)->core->command = |
|
66 + _bfd_elfcore_strndup (abfd, note->descdata + 100, 80); |
|
67 + break; |
|
68 + case 328: /* sizeof(prpsinfo_t) on 64-bit Solaris */ |
|
69 + elf_tdata (abfd)->core->pid = |
|
70 + bfd_get_32 (abfd, note->descdata + 16); |
|
71 + elf_tdata (abfd)->core->program = |
|
72 + _bfd_elfcore_strndup (abfd, note->descdata + 120, 16); |
|
73 + elf_tdata (abfd)->core->command = |
|
74 + _bfd_elfcore_strndup (abfd, note->descdata + 136, 80); |
|
75 + break; |
|
76 + } |
|
77 + } |
|
78 else |
|
79 { |
|
80 switch (note->descsz) |
|
81 @@ -507,6 +571,83 @@ |
|
82 return TRUE; |
|
83 } |
|
84 |
|
85 +static bfd_boolean |
|
86 +elf_i386_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) |
|
87 +{ |
|
88 + asection *sect; |
|
89 + char reg2_section_name[16]; |
|
90 + size_t gregset_size; |
|
91 + size_t fpregset_size; |
|
92 + |
|
93 + /* Solaris */ |
|
94 + if (note->namesz == 5 && strncmp (note->namedata, "CORE", 4) == 0) |
|
95 + { |
|
96 + switch (note->descsz) |
|
97 + { |
|
98 + default: |
|
99 + return FALSE; |
|
100 + break; |
|
101 + case 800: /* sizeof(lwpstatus_t) on Intel 32-bit */ |
|
102 + gregset_size = 76; |
|
103 + fpregset_size = 380; |
|
104 + |
|
105 + (void) snprintf (reg2_section_name, 16, "%s/%i", ".reg2", 1); |
|
106 + sect = bfd_get_section_by_name (abfd, reg2_section_name); |
|
107 + if (sect != NULL) |
|
108 + { |
|
109 + sect->size = fpregset_size; |
|
110 + sect->filepos = note->descpos + 420; |
|
111 + sect->alignment_power = 2; |
|
112 + } |
|
113 + else |
|
114 + return _bfd_elfcore_make_pseudosection (abfd, reg2_section_name, |
|
115 + fpregset_size, note->descpos + 420); |
|
116 + |
|
117 + sect = bfd_get_section_by_name (abfd, ".reg"); |
|
118 + if (sect != NULL) |
|
119 + { |
|
120 + sect->size = gregset_size; |
|
121 + sect->filepos = note->descpos + 344; |
|
122 + sect->alignment_power = 2; |
|
123 + } |
|
124 + else |
|
125 + return _bfd_elfcore_make_pseudosection (abfd, ".reg", |
|
126 + gregset_size, note->descpos + 344); |
|
127 + break; |
|
128 + case 1296: /* sizeof(lwpstatus_t) on Intel 64-bit */ |
|
129 + gregset_size = 224; |
|
130 + fpregset_size = 528; |
|
131 + |
|
132 + (void) snprintf (reg2_section_name, 16, "%s/%i", ".reg2", 1); |
|
133 + sect = bfd_get_section_by_name (abfd, reg2_section_name); |
|
134 + if (sect != NULL) |
|
135 + { |
|
136 + sect->size = fpregset_size; |
|
137 + sect->filepos = note->descpos + 420; |
|
138 + sect->alignment_power = 2; |
|
139 + } |
|
140 + else |
|
141 + return _bfd_elfcore_make_pseudosection (abfd, reg2_section_name, |
|
142 + fpregset_size, note->descpos + 420); |
|
143 + |
|
144 + sect = bfd_get_section_by_name (abfd, ".reg"); |
|
145 + if (sect != NULL) |
|
146 + { |
|
147 + sect->size = gregset_size; |
|
148 + sect->filepos = note->descpos + 344; |
|
149 + sect->alignment_power = 2; |
|
150 + } |
|
151 + else |
|
152 + return _bfd_elfcore_make_pseudosection (abfd, ".reg", |
|
153 + gregset_size, note->descpos + 344); |
|
154 + break; |
|
155 + } |
|
156 + } |
|
157 + return TRUE; |
|
158 +} |
|
159 + |
|
160 + |
|
161 + |
|
162 /* Functions for the i386 ELF linker. |
|
163 |
|
164 In order to gain some understanding of code in this file without |
|
165 @@ -5053,6 +5194,7 @@ |
|
166 #define elf_backend_gc_mark_hook elf_i386_gc_mark_hook |
|
167 #define elf_backend_gc_sweep_hook elf_i386_gc_sweep_hook |
|
168 #define elf_backend_grok_prstatus elf_i386_grok_prstatus |
|
169 +#define elf_backend_grok_lwpstatus elf_i386_grok_lwpstatus |
|
170 #define elf_backend_grok_psinfo elf_i386_grok_psinfo |
|
171 #define elf_backend_reloc_type_class elf_i386_reloc_type_class |
|
172 #define elf_backend_relocate_section elf_i386_relocate_section |