gdb/gdbserver/nto-x86-low.c - gdb

Global variables defined

Functions defined

Macros defined

Source code

  1. /* QNX Neutrino specific low level interface, for the remote server
  2.    for GDB.
  3.    Copyright (C) 2009-2015 Free Software Foundation, Inc.

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. #include "server.h"
  16. #include "nto-low.h"
  17. #include "regdef.h"
  18. #include "regcache.h"

  19. #include <x86/context.h>


  20. /* Definition auto generated from reg-i386.dep.  */
  21. extern void init_registers_i386 ();
  22. extern struct reg *regs_i386;
  23. extern const struct target_desc *tdesc_i386;

  24. const unsigned char x86_breakpoint[] = { 0xCC };
  25. #define x86_breakpoint_len 1

  26. /* Returns offset in appropriate Neutrino's context structure.
  27.    Defined in x86/context.h.
  28.    GDBREGNO is index into regs_i386 array.  It is autogenerated and
  29.    hopefully doesn't change.  */
  30. static int
  31. nto_x86_register_offset (int gdbregno)
  32. {
  33.   if (gdbregno >= 0 && gdbregno < 16)
  34.     {
  35.       X86_CPU_REGISTERS *dummy = (void*)0;
  36.       /* GPRs  */
  37.       switch (gdbregno)
  38.         {
  39.         case 0:
  40.           return (int)&(dummy->eax);
  41.         case 1:
  42.           return (int)&(dummy->ecx);
  43.         case 2:
  44.           return (int)&(dummy->edx);
  45.         case 3:
  46.           return (int)&(dummy->ebx);
  47.         case 4:
  48.           return (int)&(dummy->esp);
  49.         case 5:
  50.           return (int)&(dummy->ebp);
  51.         case 6:
  52.           return (int)&(dummy->esi);
  53.         case 7:
  54.           return (int)&(dummy->edi);
  55.         case 8:
  56.           return (int)&(dummy->eip);
  57.         case 9:
  58.           return (int)&(dummy->efl);
  59.         case 10:
  60.           return (int)&(dummy->cs);
  61.         case 11:
  62.           return (int)&(dummy->ss);
  63. #ifdef __SEGMENTS__
  64.         case 12:
  65.           return (int)&(dummy->ds);
  66.         case 13:
  67.           return (int)&(dummy->es);
  68.         case 14:
  69.           return (int)&(dummy->fs);
  70.         case 15:
  71.           return (int)&(dummy->gs);
  72. #endif
  73.         default:
  74.           return -1;
  75.         }
  76.     }
  77.   return -1;
  78. }

  79. static void
  80. nto_x86_arch_setup (void)
  81. {
  82.   init_registers_i386 ();
  83.   the_low_target.num_regs = 16;
  84.   nto_tdesc = tdesc_i386;
  85. }

  86. struct nto_target_ops the_low_target =
  87. {
  88.   nto_x86_arch_setup,
  89.   0, /* num_regs */
  90.   nto_x86_register_offset,
  91.   x86_breakpoint,
  92.   x86_breakpoint_len
  93. };