compile-object-load.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Header file to load module for 'compile' command.
  2. Copyright (C) 2014-2022 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #ifndef COMPILE_COMPILE_OBJECT_LOAD_H
  14. #define COMPILE_COMPILE_OBJECT_LOAD_H
  15. #include "compile-internal.h"
  16. #include <list>
  17. struct munmap_list
  18. {
  19. public:
  20. munmap_list () = default;
  21. ~munmap_list ();
  22. DISABLE_COPY_AND_ASSIGN (munmap_list);
  23. munmap_list &operator= (munmap_list &&) = default;
  24. munmap_list (munmap_list &&) = default;
  25. /* Add a region to the list. */
  26. void add (CORE_ADDR addr, CORE_ADDR size);
  27. private:
  28. /* Track inferior memory reserved by inferior mmap. */
  29. struct munmap_item
  30. {
  31. CORE_ADDR addr, size;
  32. };
  33. std::vector<munmap_item> items;
  34. };
  35. struct compile_module
  36. {
  37. compile_module () = default;
  38. DISABLE_COPY_AND_ASSIGN (compile_module);
  39. compile_module &operator= (compile_module &&other) = default;
  40. compile_module (compile_module &&other) = default;
  41. /* objfile for the compiled module. */
  42. struct objfile *objfile;
  43. /* .c file OBJFILE was built from. */
  44. std::string source_file;
  45. /* Inferior function GCC_FE_WRAPPER_FUNCTION. */
  46. struct symbol *func_sym;
  47. /* Inferior registers address or NULL if the inferior function does not
  48. require any. */
  49. CORE_ADDR regs_addr;
  50. /* The "scope" of this compilation. */
  51. enum compile_i_scope_types scope;
  52. /* User data for SCOPE in use. */
  53. void *scope_data;
  54. /* Inferior parameter out value type or NULL if the inferior function does not
  55. have one. */
  56. struct type *out_value_type;
  57. /* If the inferior function has an out value, this is its address.
  58. Otherwise it is zero. */
  59. CORE_ADDR out_value_addr;
  60. /* Track inferior memory reserved by inferior mmap. */
  61. struct munmap_list munmap_list;
  62. };
  63. /* A unique pointer for a compile_module. */
  64. typedef std::unique_ptr<compile_module> compile_module_up;
  65. extern compile_module_up compile_object_load
  66. (const compile_file_names &fnames,
  67. enum compile_i_scope_types scope, void *scope_data);
  68. #endif /* COMPILE_COMPILE_OBJECT_LOAD_H */