debuginfod-support.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* debuginfod utilities for GDB.
  2. Copyright (C) 2020-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 DEBUGINFOD_SUPPORT_H
  15. #define DEBUGINFOD_SUPPORT_H
  16. #include "gdbsupport/scoped_fd.h"
  17. /* Query debuginfod servers for a source file associated with an
  18. executable with BUILD_ID. BUILD_ID can be given as a binary blob or
  19. a null-terminated string. If given as a binary blob, BUILD_ID_LEN
  20. should be the number of bytes. If given as a null-terminated string,
  21. BUILD_ID_LEN should be 0.
  22. SRC_PATH should be the source file's absolute path that includes the
  23. compilation directory of the CU associated with the source file.
  24. For example if a CU's compilation directory is `/my/build` and the
  25. source file path is `/my/source/foo.c`, then SRC_PATH should be
  26. `/my/build/../source/foo.c`.
  27. If the file is successfully retrieved, its path on the local machine
  28. is stored in DESTNAME. If GDB is not built with debuginfod, this
  29. function returns -ENOSYS. */
  30. extern scoped_fd
  31. debuginfod_source_query (const unsigned char *build_id,
  32. int build_id_len,
  33. const char *src_path,
  34. gdb::unique_xmalloc_ptr<char> *destname);
  35. /* Query debuginfod servers for a debug info file with BUILD_ID.
  36. BUILD_ID can be given as a binary blob or a null-terminated string.
  37. If given as a binary blob, BUILD_ID_LEN should be the number of bytes.
  38. If given as a null-terminated string, BUILD_ID_LEN should be 0.
  39. FILENAME should be the name or path of the main binary associated with
  40. the separate debug info. It is used for printing messages to the user.
  41. If the file is successfully retrieved, its path on the local machine
  42. is stored in DESTNAME. If GDB is not built with debuginfod, this
  43. function returns -ENOSYS. */
  44. extern scoped_fd
  45. debuginfod_debuginfo_query (const unsigned char *build_id,
  46. int build_id_len,
  47. const char *filename,
  48. gdb::unique_xmalloc_ptr<char> *destname);
  49. /* Query debuginfod servers for an executable file with BUILD_ID.
  50. BUILD_ID can be given as a binary blob or a null-terminated string.
  51. If given as a binary blob, BUILD_ID_LEN should be the number of bytes.
  52. If given as a null-terminated string, BUILD_ID_LEN should be 0.
  53. FILENAME should be the name or path associated with the executable.
  54. It is used for printing messages to the user.
  55. If the file is successfully retrieved, its path on the local machine
  56. is stored in DESTNAME. If GDB is not built with debuginfod, this
  57. function returns -ENOSYS. */
  58. extern scoped_fd debuginfod_exec_query (const unsigned char *build_id,
  59. int build_id_len,
  60. const char *filename,
  61. gdb::unique_xmalloc_ptr<char>
  62. *destname);
  63. #endif /* DEBUGINFOD_SUPPORT_H */