--with-ia-lib-dir=$(top_builddir)/src/.libs \
--with-ia-src-dir=$(top_srcdir) --with-tests-dir=$(srcdir)
TESTS = int-types.xml float-types.xml pointer-types.xml struct-types.xml \
- reinst.xml noinstrument.xml duplicate.xml
+ reinst.xml noinstrument.xml duplicate.xml inparam.xml
endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE testcase SYSTEM "testcase.dtd">
+<testcase name="In params">
+ <plugin id="plugin-inparam" source="plugin-inparam.c" />
+ <run name="Entry parameter capture" target="inparam-target.c" hooks="inparam-hooks.c">
+ <using plugin="plugin-inparam" />
+ <output>
+ Foo entry advice: (12, 1.200000)
+ In foo: (12, 1.200000)
+ Foo entry advice: (34, 3.400000)
+ In foo: (34, 3.400000)
+ </output>
+ <prototypes>
+ void _advice_foo(ALL_SIGNED_T, ALL_FP_T);
+ </prototypes>
+ </run>
+</testcase>
--- /dev/null
+#include <aop.h>
+#include <stdio.h>
+#include <string.h>
+
+AOP_I_AM_GPL_COMPATIBLE();
+
+static void plugin_join_on_call(struct aop_joinpoint *jp, void *data)
+{
+ const char *advice_name = data;
+ struct aop_dynval *p1;
+ struct aop_dynval *p2;
+
+ p1 = aop_capture_in_param(jp, 0);
+ p2 = aop_capture_in_param(jp, 1);
+ aop_insert_advice(jp, advice_name, AOP_INSERT_BEFORE, AOP_DYNVAL(p1), AOP_DYNVAL(p2), AOP_TERM_ARG);
+}
+
+static unsigned int plugin_int()
+{
+ struct aop_pointcut *pc;
+
+ pc = aop_match_function_entry();
+ aop_filter_entry_by_name(pc, "foo");
+ aop_filter_entry_by_in_param(pc, 0, aop_t_all_signed());
+ aop_filter_entry_by_in_param(pc, 1, aop_t_all_fp());
+ aop_join_on(pc, plugin_join_on_call, "_advice_foo");
+
+ return 0;
+}
+
+void aop_finish()
+{
+ const char *header;
+ header = aop_get_arg_value("header");
+
+ if (header != NULL) {
+ int res;
+ res = aop_write_c_header(header, NULL, NULL, NULL);
+ if (res != 0)
+ perror(header);
+ }
+}
+
+AOP_MAIN_PROTO aop_main()
+{
+ aop_register_pass("int", plugin_int);
+}