1 /* debuginfod utilities for GDB. 2 Copyright (C) 2020-2021 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 #include "gdbsupport/scoped_fd.h" 23 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. 29 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`. 35 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. */ 39 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); 45 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. 50 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. 53 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. */ 57 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); 63 64 #endif /* DEBUGINFOD_SUPPORT_H */ 65