OLD | NEW |
1 /* Target-dependent code for NaCl. | 1 /* Target-dependent code for NaCl. |
2 | 2 |
3 Copyright (C) 2001, 2003-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2001, 2003-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "linux-tdep.h" | 23 #include "linux-tdep.h" |
24 #include "amd64-tdep.h" | 24 #include "amd64-tdep.h" |
25 #include "nacl-manifest.h" | 25 #include "nacl-manifest.h" |
26 #include "symtab.h" | 26 #include "symtab.h" |
27 #include "solib-svr4.h" | 27 #include "solib-svr4.h" |
28 #include "frame.h" | 28 #include "frame.h" |
29 #include "osabi.h" | 29 #include "osabi.h" |
30 #include "disasm.h" | 30 #include "disasm.h" |
31 #include "breakpoint.h" | 31 #include "breakpoint.h" |
32 #include "target.h" | 32 #include "target.h" |
| 33 #include "elf-bfd.h" |
| 34 |
| 35 static enum gdb_osabi |
| 36 nacl_osabi_sniffer (bfd *abfd) |
| 37 { |
| 38 /* WARNING! This way of checking for NaCl OS ABI is deprecated. |
| 39 See http://code.google.com/p/nativeclient/issues/detail?id=2971 */ |
| 40 if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && |
| 41 elf_elfheader (abfd)->e_ident[EI_OSABI] == 123) |
| 42 return GDB_OSABI_NACL; |
| 43 |
| 44 return GDB_OSABI_UNKNOWN; |
| 45 } |
33 | 46 |
34 static void | 47 static void |
35 nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | 48 nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) |
36 { | 49 { |
37 /* NaCl uses SVR4-style shared libraries. */ | 50 /* NaCl uses SVR4-style shared libraries. */ |
38 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); | 51 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); |
39 set_solib_svr4_map_so_name (gdbarch, nacl_manifest_find); | 52 set_solib_svr4_map_so_name (gdbarch, nacl_manifest_find); |
40 set_gdbarch_process_record (gdbarch, i386_process_record); | 53 set_gdbarch_process_record (gdbarch, i386_process_record); |
41 } | 54 } |
42 | 55 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return 1; | 159 return 1; |
147 } | 160 } |
148 | 161 |
149 return 0; | 162 return 0; |
150 } | 163 } |
151 | 164 |
152 static void | 165 static void |
153 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | 166 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) |
154 { | 167 { |
155 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 168 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 169 |
156 linux_init_abi (info, gdbarch); | 170 linux_init_abi (info, gdbarch); |
157 amd64_init_abi (info, gdbarch); | 171 amd64_init_abi (info, gdbarch); |
158 tdep->tdesc = tdesc_amd64_linux; | 172 tdep->tdesc = tdesc_amd64_linux; |
159 set_solib_svr4_fetch_link_map_offsets (gdbarch, | 173 set_solib_svr4_fetch_link_map_offsets (gdbarch, |
160 amd64_nacl_fetch_link_map_offsets); | 174 amd64_nacl_fetch_link_map_offsets); |
161 nacl_init_abi (info, gdbarch); | 175 nacl_init_abi (info, gdbarch); |
162 | 176 |
163 /* NaCl data model. | 177 /* NaCl data model. |
164 | 178 |
165 WARNING! This might confuse a lot of code, as it uses | 179 WARNING! This might confuse a lot of code, as it uses |
(...skipping 20 matching lines...) Expand all Loading... |
186 amd64_nacl_adjust_breakpoint_address); | 200 amd64_nacl_adjust_breakpoint_address); |
187 set_gdbarch_software_single_step (gdbarch, amd64_nacl_software_single_step); | 201 set_gdbarch_software_single_step (gdbarch, amd64_nacl_software_single_step); |
188 } | 202 } |
189 | 203 |
190 /* Provide a prototype to silence -Wmissing-prototypes. */ | 204 /* Provide a prototype to silence -Wmissing-prototypes. */ |
191 extern void _initialize_nacl_tdep (void); | 205 extern void _initialize_nacl_tdep (void); |
192 | 206 |
193 void | 207 void |
194 _initialize_nacl_tdep (void) | 208 _initialize_nacl_tdep (void) |
195 { | 209 { |
| 210 gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour, |
| 211 nacl_osabi_sniffer); |
| 212 |
196 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, | 213 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, |
197 GDB_OSABI_NACL, amd64_nacl_init_abi); | 214 GDB_OSABI_NACL, amd64_nacl_init_abi); |
198 | 215 |
199 gdbarch_register_osabi (bfd_arch_i386, 0, | 216 gdbarch_register_osabi (bfd_arch_i386, 0, |
200 GDB_OSABI_NACL, i386_nacl_init_abi); | 217 GDB_OSABI_NACL, i386_nacl_init_abi); |
201 } | 218 } |
OLD | NEW |