1/* Target-dependent code for Haiku i386. 2 3 Copyright 2005 Ingo Weinhold <bonefish@cs.tu-berlin.de>. 4 5 This file is part of GDB. 6 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 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place - Suite 330, 20 Boston, MA 02111-1307, USA. */ 21 22#include "defs.h" 23#include "gdbarch.h" 24#include "i386-tdep.h" 25#include "osabi.h" 26 27//#define TRACE_I386_HAIKU_NAT 28#ifdef TRACE_I386_HAIKU_NAT 29 #define TRACE(x) printf x 30#else 31 #define TRACE(x) while (false) {} 32#endif 33 34static void 35i386_haiku_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 36{ 37 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 38 39 // Haiku uses ELF. 40 i386_elf_init_abi (info, gdbarch); 41 42 // the offset of the PC in the jmp_buf structure (cf. setjmp(), longjmp()) 43 tdep->jb_pc_offset = 20; 44 45// TODO: Signal support. 46// tdep->sigtramp_p = i386_haiku_sigtramp_p; 47// tdep->sigcontext_addr = i386_haiku_sigcontext_addr; 48// tdep->sc_reg_offset = i386_haiku_sc_reg_offset; 49// tdep->sc_num_regs = ARRAY_SIZE (i386_haiku_sc_reg_offset); 50 51// We don't need this at the moment. The Haiku runtime loader also relocates 52// R_386_JMP_SLOT entries. No lazy resolving is done. 53// set_gdbarch_skip_solib_resolver (gdbarch, haiku_skip_solib_resolver); 54} 55 56 57static enum gdb_osabi 58i386_haiku_osabi_sniffer (bfd * abfd) 59{ 60 char *targetName = bfd_get_target (abfd); 61 62 if (strcmp (targetName, "elf32-i386") == 0) 63 return GDB_OSABI_HAIKU; 64 65 return GDB_OSABI_UNKNOWN; 66} 67 68 69void 70_initialize_i386_haiku_tdep (void) 71{ 72 gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour, 73 i386_haiku_osabi_sniffer); 74 75 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_HAIKU, 76 i386_haiku_init_abi); 77} 78