Skip to content

Commit

Permalink
tetragon: Add uprobe test functions for argument values
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
olsajiri committed Jan 20, 2024
1 parent 22f90ef commit 06d7d0c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
30 changes: 30 additions & 0 deletions contrib/tester-progs/uprobe-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,33 @@ int uprobe_test_lib()
printf("uprobe_test_lib called\n");
return 0;
}

int uprobe_test_lib_arg1(int a1)
{
printf("uprobe_test_lib_arg1 called\n");
return 0;
}

int uprobe_test_lib_arg2(char a1, short a2)
{
printf("uprobe_test_lib_arg2 called\n");
return 0;
}

int uprobe_test_lib_arg3(unsigned long a1, unsigned int a2, void *a3)
{
printf("uprobe_test_lib_arg3 called\n");
return 0;
}

int uprobe_test_lib_arg4(long a1, int a2, char a3, void *a4)
{
printf("uprobe_test_lib_arg3 called\n");
return 0;
}

int uprobe_test_lib_arg5(int a1, char a2, unsigned long a3, short a4, void *a5)
{
printf("uprobe_test_lib_arg3 called\n");
return 0;
}
12 changes: 12 additions & 0 deletions contrib/tester-progs/uprobe-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@

void uprobe_test_lib(void);

// argument test functions
int uprobe_test_lib_arg1(int a1);
int uprobe_test_lib_arg2(char a1, short a2);
int uprobe_test_lib_arg3(unsigned long a1, unsigned int a2, void *a3);
int uprobe_test_lib_arg4(long a1, int a2, char a3, void *a4);
int uprobe_test_lib_arg5(int a1, char a2, unsigned long a3, short a4, void *a5);

int main(void)
{
uprobe_test_lib();
uprobe_test_lib_arg1(123);
uprobe_test_lib_arg2('a', 4321);
uprobe_test_lib_arg3(1, 0xdeadbeef, NULL);
uprobe_test_lib_arg4(-321, -2, 'b', (void *) 1);
uprobe_test_lib_arg5(1, 'c', 0xcafe, 1234, (void *) 2);
}

0 comments on commit 06d7d0c

Please sign in to comment.