1
linux/tools/perf/util/debuginfo.h
Arnaldo Carvalho de Melo 13d675aea6 perf debuginfo: Fix the build with !HAVE_DWARF_SUPPORT
In that case we have a set of placeholder functions, one of them uses a
'Dwarf_Addr' type that is not present as it is defined in the missing
DWARF libraries, so provide a placeholder typedef for that as well.

The build error before this patch:

  In file included from util/annotate.c:28:
  util/debuginfo.h:44:46: error: unknown type name ‘Dwarf_Addr’
     44 |                                              Dwarf_Addr *offs __maybe_unused,
        |                                              ^~~~~~~~~~
  make[6]: *** [/home/acme/git/perf-tools-next/tools/build/Makefile.build:106: util/annotate.o] Error 1
  make[6]: *** Waiting for unfinished jobs....

Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Link: https://lore.kernel.org/lkml/CAM9d7ciushSwEfj7yW4rtDEJBTcCB991V4cswwFEL+cv6QF2pg@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2024-08-09 17:37:03 -03:00

67 lines
1.5 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _PERF_DEBUGINFO_H
#define _PERF_DEBUGINFO_H
#include <errno.h>
#include <linux/compiler.h>
#ifdef HAVE_DWARF_SUPPORT
#include "dwarf-aux.h"
/* debug information structure */
struct debuginfo {
Dwarf *dbg;
Dwfl_Module *mod;
Dwfl *dwfl;
Dwarf_Addr bias;
const unsigned char *build_id;
};
/* This also tries to open distro debuginfo */
struct debuginfo *debuginfo__new(const char *path);
void debuginfo__delete(struct debuginfo *dbg);
int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs,
bool adjust_offset);
#else /* HAVE_DWARF_SUPPORT */
/* dummy debug information structure */
struct debuginfo {
};
static inline struct debuginfo *debuginfo__new(const char *path __maybe_unused)
{
return NULL;
}
static inline void debuginfo__delete(struct debuginfo *dbg __maybe_unused)
{
}
typedef void Dwarf_Addr;
static inline int debuginfo__get_text_offset(struct debuginfo *dbg __maybe_unused,
Dwarf_Addr *offs __maybe_unused,
bool adjust_offset __maybe_unused)
{
return -EINVAL;
}
#endif /* HAVE_DWARF_SUPPORT */
#ifdef HAVE_DEBUGINFOD_SUPPORT
int get_source_from_debuginfod(const char *raw_path, const char *sbuild_id,
char **new_path);
#else /* HAVE_DEBUGINFOD_SUPPORT */
static inline int get_source_from_debuginfod(const char *raw_path __maybe_unused,
const char *sbuild_id __maybe_unused,
char **new_path __maybe_unused)
{
return -ENOTSUP;
}
#endif /* HAVE_DEBUGINFOD_SUPPORT */
#endif /* _PERF_DEBUGINFO_H */