Modified duplication test to exercise fixed duplication bugs.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 28 Oct 2010 00:13:28 +0000 (20:13 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 28 Oct 2010 00:28:12 +0000 (20:28 -0400)
test/duplicate-hooks.c
test/duplicate.xml
test/plugin-duplicate.c

index e7c601f247021627f6d8fe2327fbe4a1d0b82d46..89e8010031e94f90abf804a98fc9dade2aef5876 100644 (file)
@@ -1,9 +1,12 @@
+#include <stdint.h>
 #include <stdio.h>
 
-int _distrib()
+int _distrib(int64_t param)
 {
   static int n = 0;
 
+  printf("In distributor: %d\n", (int)param);
+
   return (n++ % 2);
 }
 
index 90cad8da4e14bef1f6c9333df369cb3cd15c82b8..b8550a80f8f59398e24f35a900996612d21be01a 100644 (file)
@@ -6,11 +6,13 @@
     <using plugin="plugin-duplicate" />
     <output>
       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
     </output>
     <prototypes>
-      int _distrib();
+      int _distrib(ALL_SIGNED_T);
       void _assign_advice();
       void _bar_advice();
       void _entry_advice(signed char *, int32_t);
index 73c4f7f3613f2f2d43f147d9bea4f8f857cdc3cd..c5cb6f193c4695020ddd040fa7414acb90c3ae63 100644 (file)
@@ -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) {