2 * Debug information support.
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef ACCEL_TCG_DEBUGINFO_H
8 #define ACCEL_TCG_DEBUGINFO_H
10 #include "qemu/bitops.h"
13 * Debuginfo describing a certain address.
15 struct debuginfo_query
{
16 uint64_t address
; /* Input: address. */
17 int flags
; /* Input: debuginfo subset. */
18 const char *symbol
; /* Symbol that the address is part of. */
19 uint64_t offset
; /* Offset from the symbol. */
20 const char *file
; /* Source file associated with the address. */
21 int line
; /* Line number in the source file. */
27 #define DEBUGINFO_SYMBOL BIT(1)
28 #define DEBUGINFO_LINE BIT(2)
30 #if defined(CONFIG_TCG) && defined(CONFIG_LIBDW)
32 * Load debuginfo for the specified guest ELF image.
33 * Return true on success, false on failure.
35 void debuginfo_report_elf(const char *name
, int fd
, uint64_t bias
);
38 * Take the debuginfo lock.
40 void debuginfo_lock(void);
43 * Fill each on N Qs with the debuginfo about Q->ADDRESS as specified by
46 * - DEBUGINFO_SYMBOL: update Q->SYMBOL and Q->OFFSET. If symbol debuginfo is
47 * missing, then leave them as is.
48 * - DEBUINFO_LINE: update Q->FILE and Q->LINE. If line debuginfo is missing,
49 * then leave them as is.
51 * This function must be called under the debuginfo lock. The results can be
52 * accessed only until the debuginfo lock is released.
54 void debuginfo_query(struct debuginfo_query
*q
, size_t n
);
57 * Release the debuginfo lock.
59 void debuginfo_unlock(void);
61 static inline void debuginfo_report_elf(const char *image_name
, int image_fd
,
66 static inline void debuginfo_lock(void)
70 static inline void debuginfo_query(struct debuginfo_query
*q
, size_t n
)
74 static inline void debuginfo_unlock(void)