EPCDebugObjectRegistrar.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- EPCDebugObjectRegistrar.h - EPC-based debug registration -*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // ExecutorProcessControl based registration of debug objects.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
  18. #define LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
  19. #include "llvm/ExecutionEngine/JITSymbol.h"
  20. #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
  21. #include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
  22. #include "llvm/Support/Error.h"
  23. #include "llvm/Support/Memory.h"
  24. #include <cstdint>
  25. #include <memory>
  26. #include <vector>
  27. using namespace llvm::orc::shared;
  28. namespace llvm {
  29. namespace orc {
  30. class ExecutionSession;
  31. /// Abstract interface for registering debug objects in the executor process.
  32. class DebugObjectRegistrar {
  33. public:
  34. virtual Error registerDebugObject(ExecutorAddrRange TargetMem) = 0;
  35. virtual ~DebugObjectRegistrar() = default;
  36. };
  37. /// Use ExecutorProcessControl to register debug objects locally or in a remote
  38. /// executor process.
  39. class EPCDebugObjectRegistrar : public DebugObjectRegistrar {
  40. public:
  41. EPCDebugObjectRegistrar(ExecutionSession &ES, ExecutorAddr RegisterFn)
  42. : ES(ES), RegisterFn(RegisterFn) {}
  43. Error registerDebugObject(ExecutorAddrRange TargetMem) override;
  44. private:
  45. ExecutionSession &ES;
  46. ExecutorAddr RegisterFn;
  47. };
  48. /// Create a ExecutorProcessControl-based DebugObjectRegistrar that emits debug
  49. /// objects to the GDB JIT interface.
  50. Expected<std::unique_ptr<EPCDebugObjectRegistrar>>
  51. createJITLoaderGDBRegistrar(ExecutionSession &ES);
  52. } // end namespace orc
  53. } // end namespace llvm
  54. #endif // LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
  55. #ifdef __GNUC__
  56. #pragma GCC diagnostic pop
  57. #endif