perf annotate-data: Introduce 'struct data_loc_info'

The find_data_type() needs many information to describe the location of
the data.  Add the new 'struct data_loc_info' to pass those information at
once.

No functional changes intended.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20240319055115.4063940-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Namhyung Kim
2024-03-18 22:50:58 -07:00
committed by Arnaldo Carvalho de Melo
parent 52a09bc24c
commit a3f4d5b57d
3 changed files with 91 additions and 60 deletions

View File

@@ -8,6 +8,7 @@
#include <linux/types.h>
struct annotated_op_loc;
struct debuginfo;
struct evsel;
struct map_symbol;
@@ -72,6 +73,35 @@ struct annotated_data_type {
extern struct annotated_data_type unknown_type;
extern struct annotated_data_type stackop_type;
/**
* struct data_loc_info - Data location information
* @ms: Map and Symbol info
* @ip: Instruction address
* @var_addr: Data address (for global variables)
* @var_name: Variable name (for global variables)
* @op: Instruction operand location (regs and offset)
* @di: Debug info
* @fbreg: Frame base register
* @fb_cfa: Whether the frame needs to check CFA
* @type_offset: Final offset in the type
*/
struct data_loc_info {
/* These are input field, should be filled by caller */
struct map_symbol *ms;
u64 ip;
u64 var_addr;
const char *var_name;
struct annotated_op_loc *op;
/* These are used internally */
struct debuginfo *di;
int fbreg;
bool fb_cfa;
/* This is for the result */
int type_offset;
};
/**
* struct annotated_data_stat - Debug statistics
* @total: Total number of entry
@@ -106,9 +136,7 @@ extern struct annotated_data_stat ann_data_stat;
#ifdef HAVE_DWARF_SUPPORT
/* Returns data type at the location (ip, reg, offset) */
struct annotated_data_type *find_data_type(struct map_symbol *ms, u64 ip,
struct annotated_op_loc *loc, u64 addr,
const char *var_name);
struct annotated_data_type *find_data_type(struct data_loc_info *dloc);
/* Update type access histogram at the given offset */
int annotated_data_type__update_samples(struct annotated_data_type *adt,
@@ -121,9 +149,7 @@ void annotated_data_type__tree_delete(struct rb_root *root);
#else /* HAVE_DWARF_SUPPORT */
static inline struct annotated_data_type *
find_data_type(struct map_symbol *ms __maybe_unused, u64 ip __maybe_unused,
struct annotated_op_loc *loc __maybe_unused,
u64 addr __maybe_unused, const char *var_name __maybe_unused)
find_data_type(struct data_loc_info *dloc __maybe_unused)
{
return NULL;
}