mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
perf dlfilter: Add a test for object_code()
Extend the "dlfilter C API" test to test perf_dlfilter_fns.object_code(). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20230928091033.33998-1-adrian.hunter@intel.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
7a48b58eb5
commit
f38f547314
@ -289,6 +289,15 @@ static int check_attr(void *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample)
|
||||
{
|
||||
__u8 buf[15];
|
||||
|
||||
CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early)
|
||||
{
|
||||
struct filter_data *d = data;
|
||||
@ -314,7 +323,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void
|
||||
if (early && !d->do_early)
|
||||
return 0;
|
||||
|
||||
if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample))
|
||||
if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) ||
|
||||
check_object_code(ctx, sample))
|
||||
return -1;
|
||||
|
||||
if (early)
|
||||
|
@ -308,6 +308,15 @@ static int check_attr(void *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample)
|
||||
{
|
||||
__u8 buf[15];
|
||||
|
||||
CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early)
|
||||
{
|
||||
struct filter_data *d = data;
|
||||
@ -333,7 +342,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void
|
||||
if (early && !d->do_early)
|
||||
return 0;
|
||||
|
||||
if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample))
|
||||
if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) ||
|
||||
check_object_code(ctx, sample))
|
||||
return -1;
|
||||
|
||||
if (early)
|
||||
|
Loading…
Reference in New Issue
Block a user