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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 static void | 74 static void |
75 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | 75 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) |
76 { | 76 { |
77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
78 linux_init_abi (info, gdbarch); | 78 linux_init_abi (info, gdbarch); |
79 amd64_init_abi (info, gdbarch); | 79 amd64_init_abi (info, gdbarch); |
80 tdep->tdesc = tdesc_amd64_linux; | 80 tdep->tdesc = tdesc_amd64_linux; |
81 set_solib_svr4_fetch_link_map_offsets (gdbarch, | 81 set_solib_svr4_fetch_link_map_offsets (gdbarch, |
82 svr4_lp64_fetch_link_map_offsets); | 82 svr4_lp64_fetch_link_map_offsets); |
83 nacl_init_abi (info, gdbarch); | 83 nacl_init_abi (info, gdbarch); |
| 84 |
| 85 /* NaCl data model. |
| 86 |
| 87 WARNING! This might confuse a lot of code, as it uses |
| 88 if (set_gdbarch_ptr_bit (gdbarch) == <bits>) |
| 89 to distinguish between i386 and x86_64 (lame!). Luckily, most of that |
| 90 code is about native debugging and syscalls, so it is not used for NaCl. |
| 91 |
| 92 TODO(eaeltsin): find better way to distinguish between i386 and x86_64! */ |
| 93 set_gdbarch_long_bit (gdbarch, 32); |
| 94 set_gdbarch_ptr_bit (gdbarch, 32); |
| 95 |
| 96 /* TODO(eaeltsin): we might use address size instead of pointer size to |
| 97 distinguish between i386 and x86_64... At least address size is not |
| 98 a property of the data model. */ |
| 99 set_gdbarch_addr_bit (gdbarch, 64); |
| 100 |
| 101 /* How to extract addresses from registers. */ |
84 set_gdbarch_addr_bits_remove (gdbarch, amd64_nacl_addr_bits_remove); | 102 set_gdbarch_addr_bits_remove (gdbarch, amd64_nacl_addr_bits_remove); |
85 set_gdbarch_unwind_pc (gdbarch, amd64_nacl_unwind_pc); | 103 set_gdbarch_unwind_pc (gdbarch, amd64_nacl_unwind_pc); |
86 set_gdbarch_unwind_sp (gdbarch, amd64_nacl_unwind_sp); | 104 set_gdbarch_unwind_sp (gdbarch, amd64_nacl_unwind_sp); |
87 } | 105 } |
88 | 106 |
89 /* Provide a prototype to silence -Wmissing-prototypes. */ | 107 /* Provide a prototype to silence -Wmissing-prototypes. */ |
90 extern void _initialize_nacl_tdep (void); | 108 extern void _initialize_nacl_tdep (void); |
91 | 109 |
92 void | 110 void |
93 _initialize_nacl_tdep (void) | 111 _initialize_nacl_tdep (void) |
94 { | 112 { |
95 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, | 113 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, |
96 GDB_OSABI_NACL, amd64_nacl_init_abi); | 114 GDB_OSABI_NACL, amd64_nacl_init_abi); |
97 | 115 |
98 gdbarch_register_osabi (bfd_arch_i386, 0, | 116 gdbarch_register_osabi (bfd_arch_i386, 0, |
99 GDB_OSABI_NACL, i386_nacl_init_abi); | 117 GDB_OSABI_NACL, i386_nacl_init_abi); |
100 } | 118 } |
OLD | NEW |