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