GDB.h 1011 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2023, Jesús Lapastora <cyber.gsuscode@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/FixedArray.h>
  8. #include <AK/Span.h>
  9. #include <AK/StringView.h>
  10. namespace JIT::GDB {
  11. void register_into_gdb(ReadonlyBytes data);
  12. void unregister_from_gdb(ReadonlyBytes data);
  13. // Build a GDB compatible image to register with the GDB JIT Interface.
  14. // Returns Optional since the platform may not be supported.
  15. // The `code` must be the region of memory that will be executed, since the
  16. // image will hold direct references to addresses within the code. This way GDB
  17. // will be able to identify the code region and insert breakpoints into it.
  18. // Both `file_symbol_name` and `code_symbol_name` will end up in the symbol
  19. // table of the image. They represent a file name for the image and a name for
  20. // the region of code that is being executed.
  21. Optional<FixedArray<u8>> build_gdb_image(ReadonlyBytes code, StringView file_symbol_name, StringView code_symbol_name);
  22. }