sparc-sol2-nat.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* Native-dependent code for Solaris SPARC.
  2. Copyright (C) 2003-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 "regcache.h"
  16. #include <sys/procfs.h>
  17. #include "gregset.h"
  18. #include "sparc-tdep.h"
  19. #include "target.h"
  20. #include "procfs.h"
  21. /* This file provids the (temporary) glue between the Solaris SPARC
  22. target dependent code and the machine independent SVR4 /proc
  23. support. */
  24. /* Solaris 7 (Solaris 2.7, SunOS 5.7) and up support two process data
  25. models, the traditional 32-bit data model (ILP32) and the 64-bit
  26. data model (LP64). The format of /proc depends on the data model
  27. of the observer (the controlling process, GDB in our case). The
  28. Solaris header files conveniently define PR_MODEL_NATIVE to the
  29. data model of the controlling process. If its value is
  30. PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit
  31. program.
  32. Note that a 32-bit GDB won't be able to debug a 64-bit target
  33. process using /proc on Solaris. */
  34. #if PR_MODEL_NATIVE == PR_MODEL_LP64
  35. #include "sparc64-tdep.h"
  36. #define sparc_supply_gregset sparc64_supply_gregset
  37. #define sparc_supply_fpregset sparc64_supply_fpregset
  38. #define sparc_collect_gregset sparc64_collect_gregset
  39. #define sparc_collect_fpregset sparc64_collect_fpregset
  40. #define sparc_sol2_gregmap sparc64_sol2_gregmap
  41. #define sparc_sol2_fpregmap sparc64_sol2_fpregmap
  42. #else
  43. #define sparc_supply_gregset sparc32_supply_gregset
  44. #define sparc_supply_fpregset sparc32_supply_fpregset
  45. #define sparc_collect_gregset sparc32_collect_gregset
  46. #define sparc_collect_fpregset sparc32_collect_fpregset
  47. #define sparc_sol2_gregmap sparc32_sol2_gregmap
  48. #define sparc_sol2_fpregmap sparc32_sol2_fpregmap
  49. #endif
  50. void
  51. supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
  52. {
  53. sparc_supply_gregset (&sparc_sol2_gregmap, regcache, -1, gregs);
  54. }
  55. void
  56. supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
  57. {
  58. sparc_supply_fpregset (&sparc_sol2_fpregmap, regcache, -1, fpregs);
  59. }
  60. void
  61. fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
  62. {
  63. sparc_collect_gregset (&sparc_sol2_gregmap, regcache, regnum, gregs);
  64. }
  65. void
  66. fill_fpregset (const struct regcache *regcache,
  67. prfpregset_t *fpregs, int regnum)
  68. {
  69. sparc_collect_fpregset (&sparc_sol2_fpregmap, regcache, regnum, fpregs);
  70. }