X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=inline;f=tests%2Fmarkers%2Fprobe-vararg.c;fp=tests%2Fmarkers%2Fprobe-vararg.c;h=1ada1fd88fc013047c9512e8cb9990cf352cb77d;hb=31efe1f8304f09a4f4139c387a98d3215cd423c9;hp=0000000000000000000000000000000000000000;hpb=27828bc1b0010ee87c2f68e31fb77fd4ae39fa6b;p=lttv.git diff --git a/tests/markers/probe-vararg.c b/tests/markers/probe-vararg.c new file mode 100644 index 00000000..1ada1fd8 --- /dev/null +++ b/tests/markers/probe-vararg.c @@ -0,0 +1,53 @@ +/* probe.c + * + * Loads a function at a marker call site. + * + * (C) Copyright 2006 Mathieu Desnoyers + * + * This file is released under the GPLv2. + * See the file COPYING for more details. + */ + +#include +#include +#include + + +int value; +void *ptr; + +/* function to install */ +#define DO_MARK1_FORMAT "%d %p" +void do_mark1(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + value = va_arg(ap, int); + ptr = va_arg(ap, void*); + + va_end(ap); +} + +int init_module(void) +{ + int result; + result = marker_set_probe("subsys_mark1", DO_MARK1_FORMAT, + (marker_probe_func*)do_mark1); + if(!result) goto end; + + return 0; + +end: + marker_remove_probe(do_mark1); + return -EPERM; +} + +void cleanup_module(void) +{ + marker_remove_probe(do_mark1); +} + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mathieu Desnoyers"); +MODULE_DESCRIPTION("Probe");