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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 static CORE_ADDR | 66 static CORE_ADDR |
67 amd64_nacl_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame) | 67 amd64_nacl_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame) |
68 { | 68 { |
69 CORE_ADDR sp; | 69 CORE_ADDR sp; |
70 sp = frame_unwind_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch)); | 70 sp = frame_unwind_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch)); |
71 return amd64_nacl_addr_bits_remove (gdbarch, sp); | 71 return amd64_nacl_addr_bits_remove (gdbarch, sp); |
72 } | 72 } |
73 | 73 |
| 74 struct link_map_offsets * |
| 75 amd64_nacl_fetch_link_map_offsets (void) |
| 76 { |
| 77 static struct link_map_offsets lmo; |
| 78 static struct link_map_offsets *lmp = NULL; |
| 79 |
| 80 if (lmp == NULL) |
| 81 { |
| 82 lmp = &lmo; |
| 83 |
| 84 lmo.r_version_offset = 0; |
| 85 lmo.r_version_size = 4; |
| 86 lmo.r_map_offset = 4; |
| 87 lmo.r_brk_offset = 8; |
| 88 /* Dynamic linker is in the normal list of shared objects. */ |
| 89 lmo.r_ldsomap_offset = -1; |
| 90 |
| 91 lmo.link_map_size = 24; |
| 92 lmo.l_addr_offset = 0; |
| 93 lmo.l_name_offset = 8; |
| 94 lmo.l_ld_offset = 12; |
| 95 lmo.l_next_offset = 16; |
| 96 lmo.l_prev_offset = 20; |
| 97 } |
| 98 |
| 99 return lmp; |
| 100 } |
| 101 |
74 static void | 102 static void |
75 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | 103 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) |
76 { | 104 { |
77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 105 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
78 linux_init_abi (info, gdbarch); | 106 linux_init_abi (info, gdbarch); |
79 amd64_init_abi (info, gdbarch); | 107 amd64_init_abi (info, gdbarch); |
80 tdep->tdesc = tdesc_amd64_linux; | 108 tdep->tdesc = tdesc_amd64_linux; |
81 set_solib_svr4_fetch_link_map_offsets (gdbarch, | 109 set_solib_svr4_fetch_link_map_offsets (gdbarch, |
82 » » » » » svr4_lp64_fetch_link_map_offsets); | 110 » » » » » amd64_nacl_fetch_link_map_offsets); |
83 nacl_init_abi (info, gdbarch); | 111 nacl_init_abi (info, gdbarch); |
84 | 112 |
85 /* NaCl data model. | 113 /* NaCl data model. |
86 | 114 |
87 WARNING! This might confuse a lot of code, as it uses | 115 WARNING! This might confuse a lot of code, as it uses |
88 if (set_gdbarch_ptr_bit (gdbarch) == <bits>) | 116 if (set_gdbarch_ptr_bit (gdbarch) == <bits>) |
89 to distinguish between i386 and x86_64 (lame!). Luckily, most of that | 117 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. | 118 code is about native debugging and syscalls, so it is not used for NaCl. |
91 | 119 |
92 TODO(eaeltsin): find better way to distinguish between i386 and x86_64! */ | 120 TODO(eaeltsin): find better way to distinguish between i386 and x86_64! */ |
(...skipping 16 matching lines...) Expand all Loading... |
109 | 137 |
110 void | 138 void |
111 _initialize_nacl_tdep (void) | 139 _initialize_nacl_tdep (void) |
112 { | 140 { |
113 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, | 141 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, |
114 GDB_OSABI_NACL, amd64_nacl_init_abi); | 142 GDB_OSABI_NACL, amd64_nacl_init_abi); |
115 | 143 |
116 gdbarch_register_osabi (bfd_arch_i386, 0, | 144 gdbarch_register_osabi (bfd_arch_i386, 0, |
117 GDB_OSABI_NACL, i386_nacl_init_abi); | 145 GDB_OSABI_NACL, i386_nacl_init_abi); |
118 } | 146 } |
OLD | NEW |