From fe4840fff309b21e8ae0b1b4f3c872acc17297b2 Mon Sep 17 00:00:00 2001 From: Justin Seyster Date: Wed, 27 Oct 2010 20:13:28 -0400 Subject: [PATCH] Modified duplication test to exercise fixed duplication bugs. --- test/duplicate-hooks.c | 5 ++++- test/duplicate.xml | 4 +++- test/plugin-duplicate.c | 16 +++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/test/duplicate-hooks.c b/test/duplicate-hooks.c index e7c601f..89e8010 100644 --- a/test/duplicate-hooks.c +++ b/test/duplicate-hooks.c @@ -1,9 +1,12 @@ +#include #include -int _distrib() +int _distrib(int64_t param) { static int n = 0; + printf("In distributor: %d\n", (int)param); + return (n++ % 2); } diff --git a/test/duplicate.xml b/test/duplicate.xml index 90cad8d..b8550a8 100644 --- a/test/duplicate.xml +++ b/test/duplicate.xml @@ -6,11 +6,13 @@ In entry advice: Before distributor (line 12) + In distributor: 5 In entry advice: Zero (line 12) In bar advice! In bar: 10! In exit advice: Zero In entry advice: Before distributor (line 12) + In distributor: 6 In entry advice: One (line 12) In assign advice! In assign advice! @@ -18,7 +20,7 @@ In exit advice: One - int _distrib(); + int _distrib(ALL_SIGNED_T); void _assign_advice(); void _bar_advice(); void _entry_advice(signed char *, int32_t); diff --git a/test/plugin-duplicate.c b/test/plugin-duplicate.c index 73c4f7f..c5cb6f1 100644 --- a/test/plugin-duplicate.c +++ b/test/plugin-duplicate.c @@ -8,16 +8,11 @@ int duplicated = 0; static void plugin_join_on_entry(struct aop_joinpoint *jp, void *data) { - const char *name; + struct aop_dynval *param; - name = aop_get_function_name(); - if (name != NULL && strcmp(name, "foo") == 0) { - aop_duplicate(jp, "_distrib", AOP_TERM_ARG); - duplicated = 1; - } - else { - duplicated = 0; - } + param = aop_capture_in_param(jp, 0); + aop_duplicate(jp, "_distrib", AOP_DYNVAL(param), AOP_TERM_ARG); + duplicated = 1; } static void plugin_join_on_bar(struct aop_joinpoint *jp, void *data) @@ -45,7 +40,10 @@ static unsigned int plugin_duplicate() { struct aop_pointcut *pc; + duplicated = 0; pc = aop_match_function_entry(); + aop_filter_entry_by_name(pc, "foo"); + aop_filter_by_in_param(pc, 0, aop_t_all_signed()); aop_join_on(pc, plugin_join_on_entry, NULL); if (duplicated) { -- 2.34.1