static void i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* GNU/Linux uses ELF. */ i386_elf_init_abi (info, gdbarch); /* We support the SSE registers on GNU/Linux. */ tdep->num_xmm_regs = I386_NUM_XREGS - 1; /* set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); */ /* Since we have the extra "orig_eax" register on GNU/Linux, we have to adjust a few things. */ set_gdbarch_write_pc (gdbarch, i386_linux_write_pc); set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1); set_gdbarch_register_name (gdbarch, i386_linux_register_name); set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4); tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */ tdep->sigcontext_addr = i386_linux_sigcontext_addr; tdep->sc_pc_offset = 14 * 4; /* From <asm/sigcontext.h>. */ tdep->sc_sp_offset = 7 * 4; /* When the i386 Linux kernel calls a signal handler, the return address points to a bit of code on the stack. This function is used to identify this bit of code as a signal trampoline in order to support backtracing through calls to signal handlers. */ set_gdbarch_pc_in_sigtramp (gdbarch, i386_linux_pc_in_sigtramp); set_solib_svr4_fetch_link_map_offsets (gdbarch, i386_linux_svr4_fetch_link_map_offsets); }
static void ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); linux_init_abi (info, gdbarch); /* Set the method of obtaining the sigcontext addresses at which registers are saved. */ tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address; /* Set the pc_in_sigtramp method. */ tdep->pc_in_sigtramp = ia64_linux_pc_in_sigtramp; set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc); set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); }
static void amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset; tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset); tdep->sizeof_gregset = 27 * 8; amd64_init_abi (info, gdbarch); tdep->sigtramp_p = amd64_linux_sigtramp_p; tdep->sigcontext_addr = amd64_linux_sigcontext_addr; tdep->sc_reg_offset = amd64_linux_sc_reg_offset; tdep->sc_num_regs = ARRAY_SIZE (amd64_linux_sc_reg_offset); /* GNU/Linux uses SVR4-style shared libraries. */ set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); /* Add the %orig_rax register used for syscall restarting. */ set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc); set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS); set_gdbarch_register_name (gdbarch, amd64_linux_register_name); set_gdbarch_register_type (gdbarch, amd64_linux_register_type); set_gdbarch_register_reggroup_p (gdbarch, amd64_linux_register_reggroup_p); /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); }
static struct gdbarch * m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; /* If there is already a candidate, use it. */ arches = gdbarch_list_lookup_by_info (arches, &info); if (arches != NULL) return arches->gdbarch; /* Allocate space for the new architecture. */ gdbarch = gdbarch_alloc (&info, NULL); /* There is no real `long double'. */ set_gdbarch_long_double_bit (gdbarch, 64); set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); set_gdbarch_num_regs (gdbarch, M88K_NUM_REGS); set_gdbarch_register_name (gdbarch, m88k_register_name); set_gdbarch_register_type (gdbarch, m88k_register_type); /* Register numbers of various important registers. */ set_gdbarch_sp_regnum (gdbarch, M88K_R31_REGNUM); set_gdbarch_pc_regnum (gdbarch, M88K_SXIP_REGNUM); /* Core file support. */ set_gdbarch_regset_from_core_section (gdbarch, m88k_regset_from_core_section); set_gdbarch_print_insn (gdbarch, print_insn_m88k); set_gdbarch_skip_prologue (gdbarch, m88k_skip_prologue); /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Call dummy code. */ set_gdbarch_push_dummy_call (gdbarch, m88k_push_dummy_call); set_gdbarch_dummy_id (gdbarch, m88k_dummy_id); /* Return value info. */ set_gdbarch_return_value (gdbarch, m88k_return_value); set_gdbarch_addr_bits_remove (gdbarch, m88k_addr_bits_remove); set_gdbarch_breakpoint_from_pc (gdbarch, m88k_breakpoint_from_pc); set_gdbarch_unwind_pc (gdbarch, m88k_unwind_pc); set_gdbarch_write_pc (gdbarch, m88k_write_pc); frame_base_set_default (gdbarch, &m88k_frame_base); frame_unwind_append_unwinder (gdbarch, &m88k_frame_unwind); return gdbarch; }
static struct gdbarch * moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; struct gdbarch_tdep *tdep; /* If there is already a candidate, use it. */ arches = gdbarch_list_lookup_by_info (arches, &info); if (arches != NULL) return arches->gdbarch; /* Allocate space for the new architecture. */ tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); set_gdbarch_read_pc (gdbarch, moxie_read_pc); set_gdbarch_write_pc (gdbarch, moxie_write_pc); set_gdbarch_unwind_sp (gdbarch, moxie_unwind_sp); set_gdbarch_num_regs (gdbarch, MOXIE_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, MOXIE_SP_REGNUM); set_gdbarch_register_name (gdbarch, moxie_register_name); set_gdbarch_register_type (gdbarch, moxie_register_type); set_gdbarch_return_value (gdbarch, moxie_return_value); set_gdbarch_skip_prologue (gdbarch, moxie_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, moxie_breakpoint_from_pc); set_gdbarch_frame_align (gdbarch, moxie_frame_align); frame_base_set_default (gdbarch, &moxie_frame_base); /* Methods for saving / extracting a dummy frame's ID. The ID's stack address must match the SP value returned by PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */ set_gdbarch_dummy_id (gdbarch, moxie_dummy_id); set_gdbarch_unwind_pc (gdbarch, moxie_unwind_pc); set_gdbarch_print_insn (gdbarch, print_insn_moxie); /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); /* Hook in the default unwinders. */ frame_unwind_append_unwinder (gdbarch, &moxie_frame_unwind); /* Support simple overlay manager. */ set_gdbarch_overlay_update (gdbarch, simple_overlay_update); return gdbarch; }
static void sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); linux_init_abi (info, gdbarch); tdep->gregset = &sparc64_linux_gregset; tdep->sizeof_gregset = 288; tdep->fpregset = &sparc64_linux_fpregset; tdep->sizeof_fpregset = 280; tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe); /* Hook in the DWARF CFI frame unwinder. */ dwarf2_append_unwinders (gdbarch); sparc64_init_abi (info, gdbarch); /* GNU/Linux has SVR4-style shared libraries... */ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); /* ...which means that we need some special handling when doing prologue analysis. */ tdep->plt_entry_size = 16; /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); /* Make sure we can single-step over signal return system calls. */ tdep->step_trap = sparc64_linux_step_trap; /* Make sure we can single-step over longjmp calls. */ set_gdbarch_get_longjmp_target (gdbarch, sparc64_linux_get_longjmp_target); set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc); /* Functions for 'catch syscall'. */ set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_SPARC64); set_gdbarch_get_syscall_number (gdbarch, sparc64_linux_get_syscall_number); set_gdbarch_handle_segmentation_fault (gdbarch, sparc64_linux_handle_segmentation_fault); }
static void ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); static const char *const stap_register_prefixes[] = { "r", NULL }; static const char *const stap_register_indirection_prefixes[] = { "[", NULL }; static const char *const stap_register_indirection_suffixes[] = { "]", NULL }; linux_init_abi (info, gdbarch); /* Set the method of obtaining the sigcontext addresses at which registers are saved. */ tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address; /* Set the pc_in_sigtramp method. */ tdep->pc_in_sigtramp = ia64_linux_pc_in_sigtramp; set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc); set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); /* Core file support. */ set_gdbarch_iterate_over_regset_sections (gdbarch, ia64_linux_iterate_over_regset_sections); /* SystemTap related. */ set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes); set_gdbarch_stap_register_indirection_prefixes (gdbarch, stap_register_indirection_prefixes); set_gdbarch_stap_register_indirection_suffixes (gdbarch, stap_register_indirection_suffixes); set_gdbarch_stap_gdb_register_prefix (gdbarch, "r"); set_gdbarch_stap_is_single_operand (gdbarch, ia64_linux_stap_is_single_operand); }
static void sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); tdep->gregset = regset_alloc (gdbarch, sparc64_linux_supply_core_gregset, sparc64_linux_collect_core_gregset); tdep->sizeof_gregset = 288; tdep->fpregset = regset_alloc (gdbarch, sparc64_linux_supply_core_fpregset, sparc64_linux_collect_core_fpregset); tdep->sizeof_fpregset = 280; tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe); /* Hook in the DWARF CFI frame unwinder. */ dwarf2_append_unwinders (gdbarch); sparc64_init_abi (info, gdbarch); /* GNU/Linux has SVR4-style shared libraries... */ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); /* ...which means that we need some special handling when doing prologue analysis. */ tdep->plt_entry_size = 16; /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); /* Make sure we can single-step over signal return system calls. */ tdep->step_trap = sparc64_linux_step_trap; set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc); }
static struct gdbarch * sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch_tdep *tdep; struct gdbarch *gdbarch; /* If there is already a candidate, use it. */ arches = gdbarch_list_lookup_by_info (arches, &info); if (arches != NULL) return arches->gdbarch; /* Allocate space for the new architecture. */ tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); tdep->pc_regnum = SPARC32_PC_REGNUM; tdep->npc_regnum = SPARC32_NPC_REGNUM; tdep->gregset = NULL; tdep->sizeof_gregset = 0; tdep->fpregset = NULL; tdep->sizeof_fpregset = 0; tdep->plt_entry_size = 0; tdep->step_trap = sparc_step_trap; set_gdbarch_long_double_bit (gdbarch, 128); set_gdbarch_long_double_format (gdbarch, &floatformat_sparc_quad); set_gdbarch_num_regs (gdbarch, SPARC32_NUM_REGS); set_gdbarch_register_name (gdbarch, sparc32_register_name); set_gdbarch_register_type (gdbarch, sparc32_register_type); set_gdbarch_num_pseudo_regs (gdbarch, SPARC32_NUM_PSEUDO_REGS); set_gdbarch_pseudo_register_read (gdbarch, sparc32_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, sparc32_pseudo_register_write); /* Register numbers of various important registers. */ set_gdbarch_sp_regnum (gdbarch, SPARC_SP_REGNUM); /* %sp */ set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM); /* %pc */ set_gdbarch_fp0_regnum (gdbarch, SPARC_F0_REGNUM); /* %f0 */ /* Call dummy code. */ set_gdbarch_call_dummy_location (gdbarch, ON_STACK); set_gdbarch_push_dummy_code (gdbarch, sparc32_push_dummy_code); set_gdbarch_push_dummy_call (gdbarch, sparc32_push_dummy_call); set_gdbarch_return_value (gdbarch, sparc32_return_value); set_gdbarch_stabs_argument_has_addr (gdbarch, sparc32_stabs_argument_has_addr); set_gdbarch_skip_prologue (gdbarch, sparc32_skip_prologue); /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, sparc_breakpoint_from_pc); set_gdbarch_frame_args_skip (gdbarch, 8); set_gdbarch_print_insn (gdbarch, print_insn_sparc); set_gdbarch_software_single_step (gdbarch, sparc_software_single_step); set_gdbarch_write_pc (gdbarch, sparc_write_pc); set_gdbarch_unwind_dummy_id (gdbarch, sparc_unwind_dummy_id); set_gdbarch_unwind_pc (gdbarch, sparc_unwind_pc); frame_base_set_default (gdbarch, &sparc32_frame_base); /* Hook in the DWARF CFI frame unwinder. */ dwarf2_frame_set_init_reg (gdbarch, sparc32_dwarf2_frame_init_reg); /* FIXME: kettenis/20050423: Don't enable the unwinder until the StackGhost issues have been resolved. */ /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); frame_unwind_append_sniffer (gdbarch, sparc32_frame_sniffer); /* If we have register sets, enable the generic core file support. */ if (tdep->gregset) set_gdbarch_regset_from_core_section (gdbarch, sparc_regset_from_core_section); return gdbarch; }
static void i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); const struct target_desc *tdesc = info.target_desc; struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info; const struct tdesc_feature *feature; int valid_p; gdb_assert (tdesc_data); linux_init_abi (info, gdbarch); /* GNU/Linux uses ELF. */ i386_elf_init_abi (info, gdbarch); /* Reserve a number for orig_eax. */ set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS); if (! tdesc_has_registers (tdesc)) tdesc = tdesc_i386_linux; tdep->tdesc = tdesc; feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux"); if (feature == NULL) return; valid_p = tdesc_numbered_register (feature, tdesc_data, I386_LINUX_ORIG_EAX_REGNUM, "orig_eax"); if (!valid_p) return; /* Add the %orig_eax register used for syscall restarting. */ set_gdbarch_write_pc (gdbarch, i386_linux_write_pc); tdep->register_reggroup_p = i386_linux_register_reggroup_p; tdep->gregset_reg_offset = i386_linux_gregset_reg_offset; tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset); tdep->sizeof_gregset = 17 * 4; tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */ tdep->sigtramp_p = i386_linux_sigtramp_p; tdep->sigcontext_addr = i386_linux_sigcontext_addr; tdep->sc_reg_offset = i386_linux_sc_reg_offset; tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset); tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; set_gdbarch_process_record (gdbarch, i386_process_record); set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal); /* Initialize the i386_linux_record_tdep. */ /* These values are the size of the type that will be used in a system call. They are obtained from Linux Kernel source. */ i386_linux_record_tdep.size_pointer = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; i386_linux_record_tdep.size__old_kernel_stat = 32; i386_linux_record_tdep.size_tms = 16; i386_linux_record_tdep.size_loff_t = 8; i386_linux_record_tdep.size_flock = 16; i386_linux_record_tdep.size_oldold_utsname = 45; i386_linux_record_tdep.size_ustat = 20; i386_linux_record_tdep.size_old_sigaction = 140; i386_linux_record_tdep.size_old_sigset_t = 128; i386_linux_record_tdep.size_rlimit = 8; i386_linux_record_tdep.size_rusage = 72; i386_linux_record_tdep.size_timeval = 8; i386_linux_record_tdep.size_timezone = 8; i386_linux_record_tdep.size_old_gid_t = 2; i386_linux_record_tdep.size_old_uid_t = 2; i386_linux_record_tdep.size_fd_set = 128; i386_linux_record_tdep.size_dirent = 268; i386_linux_record_tdep.size_dirent64 = 276; i386_linux_record_tdep.size_statfs = 64; i386_linux_record_tdep.size_statfs64 = 84; i386_linux_record_tdep.size_sockaddr = 16; i386_linux_record_tdep.size_int = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT; i386_linux_record_tdep.size_long = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; i386_linux_record_tdep.size_ulong = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; i386_linux_record_tdep.size_msghdr = 28; i386_linux_record_tdep.size_itimerval = 16; i386_linux_record_tdep.size_stat = 88; i386_linux_record_tdep.size_old_utsname = 325; i386_linux_record_tdep.size_sysinfo = 64; i386_linux_record_tdep.size_msqid_ds = 88; i386_linux_record_tdep.size_shmid_ds = 84; i386_linux_record_tdep.size_new_utsname = 390; i386_linux_record_tdep.size_timex = 128; i386_linux_record_tdep.size_mem_dqinfo = 24; i386_linux_record_tdep.size_if_dqblk = 68; i386_linux_record_tdep.size_fs_quota_stat = 68; i386_linux_record_tdep.size_timespec = 8; i386_linux_record_tdep.size_pollfd = 8; i386_linux_record_tdep.size_NFS_FHSIZE = 32; i386_linux_record_tdep.size_knfsd_fh = 132; i386_linux_record_tdep.size_TASK_COMM_LEN = 16; i386_linux_record_tdep.size_sigaction = 140; i386_linux_record_tdep.size_sigset_t = 8; i386_linux_record_tdep.size_siginfo_t = 128; i386_linux_record_tdep.size_cap_user_data_t = 12; i386_linux_record_tdep.size_stack_t = 12; i386_linux_record_tdep.size_off_t = i386_linux_record_tdep.size_long; i386_linux_record_tdep.size_stat64 = 96; i386_linux_record_tdep.size_gid_t = 2; i386_linux_record_tdep.size_uid_t = 2; i386_linux_record_tdep.size_PAGE_SIZE = 4096; i386_linux_record_tdep.size_flock64 = 24; i386_linux_record_tdep.size_user_desc = 16; i386_linux_record_tdep.size_io_event = 32; i386_linux_record_tdep.size_iocb = 64; i386_linux_record_tdep.size_epoll_event = 12; i386_linux_record_tdep.size_itimerspec = i386_linux_record_tdep.size_timespec * 2; i386_linux_record_tdep.size_mq_attr = 32; i386_linux_record_tdep.size_siginfo = 128; i386_linux_record_tdep.size_termios = 36; i386_linux_record_tdep.size_termios2 = 44; i386_linux_record_tdep.size_pid_t = 4; i386_linux_record_tdep.size_winsize = 8; i386_linux_record_tdep.size_serial_struct = 60; i386_linux_record_tdep.size_serial_icounter_struct = 80; i386_linux_record_tdep.size_hayes_esp_config = 12; i386_linux_record_tdep.size_size_t = 4; i386_linux_record_tdep.size_iovec = 8; /* These values are the second argument of system call "sys_ioctl". They are obtained from Linux Kernel source. */ i386_linux_record_tdep.ioctl_TCGETS = 0x5401; i386_linux_record_tdep.ioctl_TCSETS = 0x5402; i386_linux_record_tdep.ioctl_TCSETSW = 0x5403; i386_linux_record_tdep.ioctl_TCSETSF = 0x5404; i386_linux_record_tdep.ioctl_TCGETA = 0x5405; i386_linux_record_tdep.ioctl_TCSETA = 0x5406; i386_linux_record_tdep.ioctl_TCSETAW = 0x5407; i386_linux_record_tdep.ioctl_TCSETAF = 0x5408; i386_linux_record_tdep.ioctl_TCSBRK = 0x5409; i386_linux_record_tdep.ioctl_TCXONC = 0x540A; i386_linux_record_tdep.ioctl_TCFLSH = 0x540B; i386_linux_record_tdep.ioctl_TIOCEXCL = 0x540C; i386_linux_record_tdep.ioctl_TIOCNXCL = 0x540D; i386_linux_record_tdep.ioctl_TIOCSCTTY = 0x540E; i386_linux_record_tdep.ioctl_TIOCGPGRP = 0x540F; i386_linux_record_tdep.ioctl_TIOCSPGRP = 0x5410; i386_linux_record_tdep.ioctl_TIOCOUTQ = 0x5411; i386_linux_record_tdep.ioctl_TIOCSTI = 0x5412; i386_linux_record_tdep.ioctl_TIOCGWINSZ = 0x5413; i386_linux_record_tdep.ioctl_TIOCSWINSZ = 0x5414; i386_linux_record_tdep.ioctl_TIOCMGET = 0x5415; i386_linux_record_tdep.ioctl_TIOCMBIS = 0x5416; i386_linux_record_tdep.ioctl_TIOCMBIC = 0x5417; i386_linux_record_tdep.ioctl_TIOCMSET = 0x5418; i386_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419; i386_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541A; i386_linux_record_tdep.ioctl_FIONREAD = 0x541B; i386_linux_record_tdep.ioctl_TIOCINQ = i386_linux_record_tdep.ioctl_FIONREAD; i386_linux_record_tdep.ioctl_TIOCLINUX = 0x541C; i386_linux_record_tdep.ioctl_TIOCCONS = 0x541D; i386_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541E; i386_linux_record_tdep.ioctl_TIOCSSERIAL = 0x541F; i386_linux_record_tdep.ioctl_TIOCPKT = 0x5420; i386_linux_record_tdep.ioctl_FIONBIO = 0x5421; i386_linux_record_tdep.ioctl_TIOCNOTTY = 0x5422; i386_linux_record_tdep.ioctl_TIOCSETD = 0x5423; i386_linux_record_tdep.ioctl_TIOCGETD = 0x5424; i386_linux_record_tdep.ioctl_TCSBRKP = 0x5425; i386_linux_record_tdep.ioctl_TIOCTTYGSTRUCT = 0x5426; i386_linux_record_tdep.ioctl_TIOCSBRK = 0x5427; i386_linux_record_tdep.ioctl_TIOCCBRK = 0x5428; i386_linux_record_tdep.ioctl_TIOCGSID = 0x5429; i386_linux_record_tdep.ioctl_TCGETS2 = 0x802c542a; i386_linux_record_tdep.ioctl_TCSETS2 = 0x402c542b; i386_linux_record_tdep.ioctl_TCSETSW2 = 0x402c542c; i386_linux_record_tdep.ioctl_TCSETSF2 = 0x402c542d; i386_linux_record_tdep.ioctl_TIOCGPTN = 0x80045430; i386_linux_record_tdep.ioctl_TIOCSPTLCK = 0x40045431; i386_linux_record_tdep.ioctl_FIONCLEX = 0x5450; i386_linux_record_tdep.ioctl_FIOCLEX = 0x5451; i386_linux_record_tdep.ioctl_FIOASYNC = 0x5452; i386_linux_record_tdep.ioctl_TIOCSERCONFIG = 0x5453; i386_linux_record_tdep.ioctl_TIOCSERGWILD = 0x5454; i386_linux_record_tdep.ioctl_TIOCSERSWILD = 0x5455; i386_linux_record_tdep.ioctl_TIOCGLCKTRMIOS = 0x5456; i386_linux_record_tdep.ioctl_TIOCSLCKTRMIOS = 0x5457; i386_linux_record_tdep.ioctl_TIOCSERGSTRUCT = 0x5458; i386_linux_record_tdep.ioctl_TIOCSERGETLSR = 0x5459; i386_linux_record_tdep.ioctl_TIOCSERGETMULTI = 0x545A; i386_linux_record_tdep.ioctl_TIOCSERSETMULTI = 0x545B; i386_linux_record_tdep.ioctl_TIOCMIWAIT = 0x545C; i386_linux_record_tdep.ioctl_TIOCGICOUNT = 0x545D; i386_linux_record_tdep.ioctl_TIOCGHAYESESP = 0x545E; i386_linux_record_tdep.ioctl_TIOCSHAYESESP = 0x545F; i386_linux_record_tdep.ioctl_FIOQSIZE = 0x5460; /* These values are the second argument of system call "sys_fcntl" and "sys_fcntl64". They are obtained from Linux Kernel source. */ i386_linux_record_tdep.fcntl_F_GETLK = 5; i386_linux_record_tdep.fcntl_F_GETLK64 = 12; i386_linux_record_tdep.fcntl_F_SETLK64 = 13; i386_linux_record_tdep.fcntl_F_SETLKW64 = 14; i386_linux_record_tdep.arg1 = I386_EBX_REGNUM; i386_linux_record_tdep.arg2 = I386_ECX_REGNUM; i386_linux_record_tdep.arg3 = I386_EDX_REGNUM; i386_linux_record_tdep.arg4 = I386_ESI_REGNUM; i386_linux_record_tdep.arg5 = I386_EDI_REGNUM; i386_linux_record_tdep.arg6 = I386_EBP_REGNUM; tdep->i386_intx80_record = i386_linux_intx80_sysenter_syscall_record; tdep->i386_sysenter_record = i386_linux_intx80_sysenter_syscall_record; tdep->i386_syscall_record = i386_linux_intx80_sysenter_syscall_record; /* N_FUN symbols in shared libaries have 0 for their values and need to be relocated. */ set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); /* GNU/Linux uses SVR4-style shared libraries. */ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); /* GNU/Linux uses the dynamic linker included in the GNU C Library. */ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); dwarf2_frame_set_signal_frame_p (gdbarch, i386_linux_dwarf_signal_frame_p); /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); /* Install supported register note sections. */ if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx")) set_gdbarch_core_regset_sections (gdbarch, i386_linux_avx_regset_sections); else if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse")) set_gdbarch_core_regset_sections (gdbarch, i386_linux_sse_regset_sections); else set_gdbarch_core_regset_sections (gdbarch, i386_linux_regset_sections); set_gdbarch_core_read_description (gdbarch, i386_linux_core_read_description); /* Displaced stepping. */ set_gdbarch_displaced_step_copy_insn (gdbarch, i386_linux_displaced_step_copy_insn); set_gdbarch_displaced_step_fixup (gdbarch, i386_displaced_step_fixup); set_gdbarch_displaced_step_free_closure (gdbarch, simple_displaced_step_free_closure); set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point); /* Functions for 'catch syscall'. */ set_xml_syscall_file_name (XML_SYSCALL_FILENAME_I386); set_gdbarch_get_syscall_number (gdbarch, i386_linux_get_syscall_number); set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type); }
static void mips_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum mips_abi abi = mips_abi (gdbarch); struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info; linux_init_abi (info, gdbarch); switch (abi) { case MIPS_ABI_O32: set_gdbarch_get_longjmp_target (gdbarch, mips_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_rt_sigframe); break; case MIPS_ABI_N32: set_gdbarch_get_longjmp_target (gdbarch, mips_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); set_gdbarch_long_double_bit (gdbarch, 128); /* These floatformats should probably be renamed. MIPS uses the same 128-bit IEEE floating point format that IA-64 uses, except that the quiet/signalling NaN bit is reversed (GDB does not distinguish between quiet and signalling NaNs). */ set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe); break; case MIPS_ABI_N64: set_gdbarch_get_longjmp_target (gdbarch, mips64_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); set_gdbarch_long_double_bit (gdbarch, 128); /* These floatformats should probably be renamed. MIPS uses the same 128-bit IEEE floating point format that IA-64 uses, except that the quiet/signalling NaN bit is reversed (GDB does not distinguish between quiet and signalling NaNs). */ set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe); break; default: break; } set_gdbarch_skip_solib_resolver (gdbarch, mips_linux_skip_resolver); set_gdbarch_software_single_step (gdbarch, mips_software_single_step); /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); /* Initialize this lazily, to avoid an initialization order dependency on solib-svr4.c's _initialize routine. */ if (mips_svr4_so_ops.in_dynsym_resolve_code == NULL) { mips_svr4_so_ops = svr4_so_ops; mips_svr4_so_ops.in_dynsym_resolve_code = mips_linux_in_dynsym_resolve_code; } set_solib_ops (gdbarch, &mips_svr4_so_ops); set_gdbarch_write_pc (gdbarch, mips_linux_write_pc); set_gdbarch_core_read_description (gdbarch, mips_linux_core_read_description); set_gdbarch_regset_from_core_section (gdbarch, mips_linux_regset_from_core_section); tdep->syscall_next_pc = mips_linux_syscall_next_pc; if (tdesc_data) { const struct tdesc_feature *feature; /* If we have target-described registers, then we can safely reserve a number for MIPS_RESTART_REGNUM (whether it is described or not). */ gdb_assert (gdbarch_num_regs (gdbarch) <= MIPS_RESTART_REGNUM); set_gdbarch_num_regs (gdbarch, MIPS_RESTART_REGNUM + 1); set_gdbarch_num_pseudo_regs (gdbarch, MIPS_RESTART_REGNUM + 1); /* If it's present, then assign it to the reserved number. */ feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.mips.linux"); if (feature != NULL) tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM, "restart"); } }
static struct gdbarch * mn10300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; struct gdbarch_tdep *tdep; arches = gdbarch_list_lookup_by_info (arches, &info); if (arches != NULL) return arches->gdbarch; tdep = xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); switch (info.bfd_arch_info->mach) { case 0: case bfd_mach_mn10300: set_gdbarch_register_name (gdbarch, mn10300_generic_register_name); tdep->am33_mode = 0; break; case bfd_mach_am33: set_gdbarch_register_name (gdbarch, am33_register_name); tdep->am33_mode = 1; break; default: internal_error (__FILE__, __LINE__, _("mn10300_gdbarch_init: Unknown mn10300 variant")); break; } /* Registers. */ set_gdbarch_num_regs (gdbarch, E_NUM_REGS); set_gdbarch_register_type (gdbarch, mn10300_register_type); set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue); set_gdbarch_read_pc (gdbarch, mn10300_read_pc); set_gdbarch_write_pc (gdbarch, mn10300_write_pc); set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); /* Stack unwinding. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Breakpoints. */ set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc); /* decr_pc_after_break? */ /* Disassembly. */ set_gdbarch_print_insn (gdbarch, print_insn_mn10300); /* Stage 2 */ /* MVS Note: at least the first one is deprecated! */ set_gdbarch_deprecated_use_struct_convention (gdbarch, mn10300_use_struct_convention); set_gdbarch_store_return_value (gdbarch, mn10300_store_return_value); set_gdbarch_extract_return_value (gdbarch, mn10300_extract_return_value); /* Stage 3 -- get target calls working. */ set_gdbarch_push_dummy_call (gdbarch, mn10300_push_dummy_call); /* set_gdbarch_return_value (store, extract) */ mn10300_frame_unwind_init (gdbarch); return gdbarch; }
static struct gdbarch * tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; int arch_size = 64; /* Handle arch_size == 32 or 64. Default to 64. */ if (info.abfd) arch_size = bfd_get_arch_size (info.abfd); /* Try to find a pre-existing architecture. */ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL; arches = gdbarch_list_lookup_by_info (arches->next, &info)) { /* We only have two flavors -- just make sure arch_size matches. */ if (gdbarch_ptr_bit (arches->gdbarch) == arch_size) return (arches->gdbarch); } gdbarch = gdbarch_alloc (&info, NULL); /* Basic register fields and methods, datatype sizes and stuff. */ /* There are 64 physical registers which can be referenced by instructions (although only 56 of them can actually be debugged) and 1 magic register (the PC). The other three magic registers (ex1, syscall, orig_r0) which are known to "ptrace" are ignored by "gdb". Note that we simply pretend that there are 65 registers, and no "pseudo registers". */ set_gdbarch_num_regs (gdbarch, TILEGX_NUM_REGS); set_gdbarch_num_pseudo_regs (gdbarch, 0); set_gdbarch_sp_regnum (gdbarch, TILEGX_SP_REGNUM); set_gdbarch_pc_regnum (gdbarch, TILEGX_PC_REGNUM); set_gdbarch_register_name (gdbarch, tilegx_register_name); set_gdbarch_register_type (gdbarch, tilegx_register_type); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, arch_size); set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_ptr_bit (gdbarch, arch_size); set_gdbarch_addr_bit (gdbarch, arch_size); set_gdbarch_cannot_fetch_register (gdbarch, tilegx_cannot_reference_register); set_gdbarch_cannot_store_register (gdbarch, tilegx_cannot_reference_register); /* Stack grows down. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Frame Info. */ set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp); set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc); set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id); set_gdbarch_frame_align (gdbarch, tilegx_frame_align); frame_base_set_default (gdbarch, &tilegx_frame_base); set_gdbarch_skip_prologue (gdbarch, tilegx_skip_prologue); set_gdbarch_stack_frame_destroyed_p (gdbarch, tilegx_stack_frame_destroyed_p); /* Map debug registers into internal register numbers. */ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, tilegx_dwarf2_reg_to_regnum); /* These values and methods are used when gdb calls a target function. */ set_gdbarch_push_dummy_call (gdbarch, tilegx_push_dummy_call); set_gdbarch_get_longjmp_target (gdbarch, tilegx_get_longjmp_target); set_gdbarch_write_pc (gdbarch, tilegx_write_pc); set_gdbarch_breakpoint_from_pc (gdbarch, tilegx_breakpoint_from_pc); set_gdbarch_return_value (gdbarch, tilegx_return_value); set_gdbarch_print_insn (gdbarch, print_insn_tilegx); gdbarch_init_osabi (info, gdbarch); dwarf2_append_unwinders (gdbarch); frame_unwind_append_unwinder (gdbarch, &tilegx_frame_unwind); return gdbarch; }
static struct gdbarch * ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; struct gdbarch_tdep *tdep; struct type *void_type; struct type *func_void_type; /* If there is already a candidate, use it. */ arches = gdbarch_list_lookup_by_info (arches, &info); if (arches != NULL) return arches->gdbarch; /* Allocate space for the new architecture. */ tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); /* Create a type for PC. We can't use builtin types here, as they may not be defined. */ void_type = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); func_void_type = make_function_type (void_type, NULL); tdep->pc_type = arch_type (gdbarch, TYPE_CODE_PTR, 4, NULL); TYPE_TARGET_TYPE (tdep->pc_type) = func_void_type; TYPE_UNSIGNED (tdep->pc_type) = 1; TYPE_INSTANCE_FLAGS (tdep->pc_type) |= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; set_gdbarch_read_pc (gdbarch, ft32_read_pc); set_gdbarch_write_pc (gdbarch, ft32_write_pc); set_gdbarch_unwind_sp (gdbarch, ft32_unwind_sp); set_gdbarch_num_regs (gdbarch, FT32_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, FT32_SP_REGNUM); set_gdbarch_pc_regnum (gdbarch, FT32_PC_REGNUM); set_gdbarch_register_name (gdbarch, ft32_register_name); set_gdbarch_register_type (gdbarch, ft32_register_type); set_gdbarch_return_value (gdbarch, ft32_return_value); set_gdbarch_pointer_to_address (gdbarch, ft32_pointer_to_address); set_gdbarch_skip_prologue (gdbarch, ft32_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, ft32_breakpoint_from_pc); set_gdbarch_frame_align (gdbarch, ft32_frame_align); frame_base_set_default (gdbarch, &ft32_frame_base); /* Methods for saving / extracting a dummy frame's ID. The ID's stack address must match the SP value returned by PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */ set_gdbarch_dummy_id (gdbarch, ft32_dummy_id); set_gdbarch_unwind_pc (gdbarch, ft32_unwind_pc); set_gdbarch_print_insn (gdbarch, print_insn_ft32); /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); /* Hook in the default unwinders. */ frame_unwind_append_unwinder (gdbarch, &ft32_frame_unwind); /* Support simple overlay manager. */ set_gdbarch_overlay_update (gdbarch, simple_overlay_update); set_gdbarch_address_class_type_flags (gdbarch, ft32_address_class_type_flags); set_gdbarch_address_class_name_to_type_flags (gdbarch, ft32_address_class_name_to_type_flags); set_gdbarch_address_class_type_flags_to_name (gdbarch, ft32_address_class_type_flags_to_name); return gdbarch; }