i386-go32-tdep.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* Target-dependent code for DJGPP/i386.
  2. Copyright (C) 1988-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #include "defs.h"
  15. #include "i386-tdep.h"
  16. #include "gdbsupport/x86-xstate.h"
  17. #include "target-descriptions.h"
  18. #include "osabi.h"
  19. static void
  20. i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
  21. {
  22. i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
  23. /* DJGPP doesn't have any special frames for signal handlers. */
  24. tdep->sigtramp_p = NULL;
  25. tdep->jb_pc_offset = 36;
  26. /* DJGPP does not support the SSE registers. */
  27. if (!tdesc_has_registers (info.target_desc))
  28. tdep->tdesc = i386_target_description (X86_XSTATE_X87_MASK, false);
  29. /* Native compiler is GCC, which uses the SVR4 register numbering
  30. even in COFF and STABS. See the comment in i386_gdbarch_init,
  31. before the calls to set_gdbarch_stab_reg_to_regnum and
  32. set_gdbarch_sdb_reg_to_regnum. */
  33. set_gdbarch_stab_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
  34. set_gdbarch_sdb_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
  35. set_gdbarch_has_dos_based_file_system (gdbarch, 1);
  36. set_gdbarch_wchar_bit (gdbarch, 16);
  37. set_gdbarch_wchar_signed (gdbarch, 0);
  38. }
  39. static enum gdb_osabi
  40. i386_coff_osabi_sniffer (bfd *abfd)
  41. {
  42. if (strcmp (bfd_get_target (abfd), "coff-go32-exe") == 0
  43. || strcmp (bfd_get_target (abfd), "coff-go32") == 0)
  44. return GDB_OSABI_GO32;
  45. return GDB_OSABI_UNKNOWN;
  46. }
  47. void _initialize_i386_go32_tdep ();
  48. void
  49. _initialize_i386_go32_tdep ()
  50. {
  51. gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
  52. i386_coff_osabi_sniffer);
  53. gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_GO32,
  54. i386_go32_init_abi);
  55. }