Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: gdb/nacl-tdep.c

Issue 10700182: Dumb change to support x86_64-nacl (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 #include "defs.h" 20 #include "defs.h"
21 #include "amd64-linux-tdep.h" 21 #include "amd64-linux-tdep.h"
22 #include "i386-linux-tdep.h" 22 #include "i386-linux-tdep.h"
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"
29 #include "osabi.h"
28 30
29 static void 31 static void
30 nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 32 nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
31 { 33 {
32 /* NaCl uses SVR4-style shared libraries. */ 34 /* NaCl uses SVR4-style shared libraries. */
33 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); 35 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
34 set_solib_svr4_map_so_name (gdbarch, nacl_manifest_find); 36 set_solib_svr4_map_so_name (gdbarch, nacl_manifest_find);
35 set_gdbarch_process_record (gdbarch, i386_process_record); 37 set_gdbarch_process_record (gdbarch, i386_process_record);
36 } 38 }
37 39
38 static void 40 static void
39 i386_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 41 i386_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
40 { 42 {
41 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 43 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
42 linux_init_abi (info, gdbarch); 44 linux_init_abi (info, gdbarch);
43 i386_elf_init_abi (info, gdbarch); 45 i386_elf_init_abi (info, gdbarch);
44 tdep->tdesc = tdesc_i386_linux; 46 tdep->tdesc = tdesc_i386_linux;
45 set_solib_svr4_fetch_link_map_offsets (gdbarch, 47 set_solib_svr4_fetch_link_map_offsets (gdbarch,
46 svr4_ilp32_fetch_link_map_offsets); 48 svr4_ilp32_fetch_link_map_offsets);
47 nacl_init_abi (info, gdbarch); 49 nacl_init_abi (info, gdbarch);
48 } 50 }
49 51
52 static CORE_ADDR
53 amd64_nacl_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val)
54 {
55 return val & 0xffffffffUL;
56 }
57
58 static CORE_ADDR
59 amd64_nacl_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
60 {
61 CORE_ADDR pc;
62 pc = frame_unwind_register_unsigned (this_frame, gdbarch_pc_regnum (gdbarch));
63 return amd64_nacl_addr_bits_remove (gdbarch, pc);
64 }
65
66 static CORE_ADDR
67 amd64_nacl_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
68 {
69 CORE_ADDR sp;
70 sp = frame_unwind_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
71 return amd64_nacl_addr_bits_remove (gdbarch, sp);
72 }
73
50 static void 74 static void
51 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 75 amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
52 { 76 {
53 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
54 linux_init_abi (info, gdbarch); 78 linux_init_abi (info, gdbarch);
55 amd64_init_abi (info, gdbarch); 79 amd64_init_abi (info, gdbarch);
56 tdep->tdesc = tdesc_amd64_linux; 80 tdep->tdesc = tdesc_amd64_linux;
57 set_solib_svr4_fetch_link_map_offsets (gdbarch, 81 set_solib_svr4_fetch_link_map_offsets (gdbarch,
58 svr4_lp64_fetch_link_map_offsets); 82 svr4_lp64_fetch_link_map_offsets);
59 nacl_init_abi (info, gdbarch); 83 nacl_init_abi (info, gdbarch);
84 set_gdbarch_addr_bits_remove (gdbarch, amd64_nacl_addr_bits_remove);
85 set_gdbarch_unwind_pc (gdbarch, amd64_nacl_unwind_pc);
86 set_gdbarch_unwind_sp (gdbarch, amd64_nacl_unwind_sp);
60 } 87 }
61 88
62 /* Provide a prototype to silence -Wmissing-prototypes. */ 89 /* Provide a prototype to silence -Wmissing-prototypes. */
63 extern void _initialize_nacl_tdep (void); 90 extern void _initialize_nacl_tdep (void);
64 91
65 void 92 void
66 _initialize_nacl_tdep (void) 93 _initialize_nacl_tdep (void)
67 { 94 {
68 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, 95 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
69 GDB_OSABI_NACL, amd64_nacl_init_abi); 96 GDB_OSABI_NACL, amd64_nacl_init_abi);
70 97
71 gdbarch_register_osabi (bfd_arch_i386, 0, 98 gdbarch_register_osabi (bfd_arch_i386, 0,
72 GDB_OSABI_NACL, i386_nacl_init_abi); 99 GDB_OSABI_NACL, i386_nacl_init_abi);
73 } 100 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698