gdb/alpha-linux-nat.c - gdb

Functions defined

Macros defined

Source code

  1. /* Low level Alpha GNU/Linux interface, for GDB when running native.
  2.    Copyright (C) 2005-2015 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 "target.h"
  16. #include "regcache.h"
  17. #include "linux-nat.h"

  18. #include "alpha-tdep.h"

  19. #include <sys/ptrace.h>
  20. #include <alpha/ptrace.h>

  21. #include <sys/procfs.h>
  22. #include "gregset.h"

  23. /* The address of UNIQUE for ptrace.  */
  24. #define ALPHA_UNIQUE_PTRACE_ADDR 65


  25. /* See the comment in m68k-tdep.c regarding the utility of these
  26.    functions.  */

  27. void
  28. supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
  29. {
  30.   const long *regp = (const long *)gregsetp;

  31.   /* PC is in slot 32, UNIQUE is in slot 33.  */
  32.   alpha_supply_int_regs (regcache, -1, regp, regp + 31, regp + 32);
  33. }

  34. void
  35. fill_gregset (const struct regcache *regcache,
  36.               gdb_gregset_t *gregsetp, int regno)
  37. {
  38.   long *regp = (long *)gregsetp;

  39.   /* PC is in slot 32, UNIQUE is in slot 33.  */
  40.   alpha_fill_int_regs (regcache, regno, regp, regp + 31, regp + 32);
  41. }

  42. /* Now we do the same thing for floating-point registers.
  43.    Again, see the comments in m68k-tdep.c.  */

  44. void
  45. supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
  46. {
  47.   const long *regp = (const long *)fpregsetp;

  48.   /* FPCR is in slot 32.  */
  49.   alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
  50. }

  51. void
  52. fill_fpregset (const struct regcache *regcache,
  53.                gdb_fpregset_t *fpregsetp, int regno)
  54. {
  55.   long *regp = (long *)fpregsetp;

  56.   /* FPCR is in slot 32.  */
  57.   alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
  58. }


  59. static CORE_ADDR
  60. alpha_linux_register_u_offset (struct gdbarch *gdbarch, int regno, int store_p)
  61. {
  62.   if (regno == gdbarch_pc_regnum (gdbarch))
  63.     return PC;
  64.   if (regno == ALPHA_UNIQUE_REGNUM)
  65.     return ALPHA_UNIQUE_PTRACE_ADDR;
  66.   if (regno < gdbarch_fp0_regnum (gdbarch))
  67.     return GPR_BASE + regno;
  68.   else
  69.     return FPR_BASE + regno - gdbarch_fp0_regnum (gdbarch);
  70. }

  71. void _initialize_alpha_linux_nat (void);

  72. void
  73. _initialize_alpha_linux_nat (void)
  74. {
  75.   linux_nat_add_target (linux_trad_target (alpha_linux_register_u_offset));
  76. }