solib-svr4.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* Handle shared libraries for GDB, the GNU Debugger.
  2. Copyright (C) 2000-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. #ifndef SOLIB_SVR4_H
  15. #define SOLIB_SVR4_H
  16. #include "solist.h"
  17. struct objfile;
  18. struct target_so_ops;
  19. extern struct target_so_ops svr4_so_ops;
  20. /* Link map info to include in an allocated so_list entry. */
  21. struct lm_info_svr4 : public lm_info_base
  22. {
  23. /* Amount by which addresses in the binary should be relocated to
  24. match the inferior. The direct inferior value is L_ADDR_INFERIOR.
  25. When prelinking is involved and the prelink base address changes,
  26. we may need a different offset - the recomputed offset is in L_ADDR.
  27. It is commonly the same value. It is cached as we want to warn about
  28. the difference and compute it only once. L_ADDR is valid
  29. iff L_ADDR_P. */
  30. CORE_ADDR l_addr = 0, l_addr_inferior = 0;
  31. bool l_addr_p = false;
  32. /* The target location of lm. */
  33. CORE_ADDR lm_addr = 0;
  34. /* Values read in from inferior's fields of the same name. */
  35. CORE_ADDR l_ld = 0, l_next = 0, l_prev = 0, l_name = 0;
  36. };
  37. /* Critical offsets and sizes which describe struct r_debug and
  38. struct link_map on SVR4-like targets. All offsets and sizes are
  39. in bytes unless otherwise specified. */
  40. struct link_map_offsets
  41. {
  42. /* Offset and size of r_debug.r_version. */
  43. int r_version_offset, r_version_size;
  44. /* Offset of r_debug.r_map. */
  45. int r_map_offset;
  46. /* Offset of r_debug.r_brk. */
  47. int r_brk_offset;
  48. /* Offset of r_debug.r_ldsomap. */
  49. int r_ldsomap_offset;
  50. /* Size of struct link_map (or equivalent), or at least enough of it
  51. to be able to obtain the fields below. */
  52. int link_map_size;
  53. /* Offset to l_addr field in struct link_map. */
  54. int l_addr_offset;
  55. /* Offset to l_ld field in struct link_map. */
  56. int l_ld_offset;
  57. /* Offset to l_next field in struct link_map. */
  58. int l_next_offset;
  59. /* Offset to l_prev field in struct link_map. */
  60. int l_prev_offset;
  61. /* Offset to l_name field in struct link_map. */
  62. int l_name_offset;
  63. };
  64. /* set_solib_svr4_fetch_link_map_offsets() is intended to be called by
  65. a <arch>_gdbarch_init() function. It is used to establish an
  66. architecture specific link_map_offsets fetcher for the architecture
  67. being defined. */
  68. extern void set_solib_svr4_fetch_link_map_offsets
  69. (struct gdbarch *gdbarch, struct link_map_offsets *(*func) (void));
  70. /* This function is called by thread_db.c. Return the address of the
  71. link map for the given objfile. */
  72. extern CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile);
  73. /* Fetch (and possibly build) an appropriate `struct link_map_offsets'
  74. for ILP32 and LP64 SVR4 systems. */
  75. extern struct link_map_offsets *svr4_ilp32_fetch_link_map_offsets (void);
  76. extern struct link_map_offsets *svr4_lp64_fetch_link_map_offsets (void);
  77. /* Return 1 if PC lies in the dynamic symbol resolution code of the
  78. SVR4 run time loader. */
  79. int svr4_in_dynsym_resolve_code (CORE_ADDR pc);
  80. #endif /* solib-svr4.h */