Automatic date update in version.in
[binutils-gdb.git] / gdb / debuginfod-support.h
blob5b1c1cb91f49bc1855e1a7b09eb25a848d6ee8d9
1 /* debuginfod utilities for GDB.
2 Copyright (C) 2020-2022 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #ifndef DEBUGINFOD_SUPPORT_H
20 #define DEBUGINFOD_SUPPORT_H
22 #include "gdbsupport/scoped_fd.h"
24 /* Query debuginfod servers for a source file associated with an
25 executable with BUILD_ID. BUILD_ID can be given as a binary blob or
26 a null-terminated string. If given as a binary blob, BUILD_ID_LEN
27 should be the number of bytes. If given as a null-terminated string,
28 BUILD_ID_LEN should be 0.
30 SRC_PATH should be the source file's absolute path that includes the
31 compilation directory of the CU associated with the source file.
32 For example if a CU's compilation directory is `/my/build` and the
33 source file path is `/my/source/foo.c`, then SRC_PATH should be
34 `/my/build/../source/foo.c`.
36 If the file is successfully retrieved, its path on the local machine
37 is stored in DESTNAME. If GDB is not built with debuginfod, this
38 function returns -ENOSYS. */
40 extern scoped_fd
41 debuginfod_source_query (const unsigned char *build_id,
42 int build_id_len,
43 const char *src_path,
44 gdb::unique_xmalloc_ptr<char> *destname);
46 /* Query debuginfod servers for a debug info file with BUILD_ID.
47 BUILD_ID can be given as a binary blob or a null-terminated string.
48 If given as a binary blob, BUILD_ID_LEN should be the number of bytes.
49 If given as a null-terminated string, BUILD_ID_LEN should be 0.
51 FILENAME should be the name or path of the main binary associated with
52 the separate debug info. It is used for printing messages to the user.
54 If the file is successfully retrieved, its path on the local machine
55 is stored in DESTNAME. If GDB is not built with debuginfod, this
56 function returns -ENOSYS. */
58 extern scoped_fd
59 debuginfod_debuginfo_query (const unsigned char *build_id,
60 int build_id_len,
61 const char *filename,
62 gdb::unique_xmalloc_ptr<char> *destname);
64 /* Query debuginfod servers for an executable file with BUILD_ID.
65 BUILD_ID can be given as a binary blob or a null-terminated string.
66 If given as a binary blob, BUILD_ID_LEN should be the number of bytes.
67 If given as a null-terminated string, BUILD_ID_LEN should be 0.
69 FILENAME should be the name or path associated with the executable.
70 It is used for printing messages to the user.
72 If the file is successfully retrieved, its path on the local machine
73 is stored in DESTNAME. If GDB is not built with debuginfod, this
74 function returns -ENOSYS. */
76 extern scoped_fd debuginfod_exec_query (const unsigned char *build_id,
77 int build_id_len,
78 const char *filename,
79 gdb::unique_xmalloc_ptr<char>
80 *destname);
81 #endif /* DEBUGINFOD_SUPPORT_H */