From: Justin Seyster Date: Wed, 20 Oct 2010 18:24:35 +0000 (-0400) Subject: No longer need a join point to find out the current function name. X-Git-Tag: release-v1.0~36 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=4616042deae2cfe940ef47003a0b08c61a32904c;p=interaspect.git No longer need a join point to find out the current function name. --- diff --git a/src/aop-main.c b/src/aop-main.c index 1b63018..d554d16 100644 --- a/src/aop-main.c +++ b/src/aop-main.c @@ -453,8 +453,12 @@ aop_abort (const char *filename, int lineno, const char *function) fancy_abort(filename, lineno, function); } +/** + * Get the name of the current function. You can call this directly + * from a pass function or from any join point iterator function. + */ const char * -aop_capture_function_name (struct aop_joinpoint *jp) +aop_get_function_name (void) { return IDENTIFIER_POINTER (DECL_NAME (current_function_decl)); } diff --git a/src/aop.h b/src/aop.h index 7ef9082..9522ee0 100644 --- a/src/aop.h +++ b/src/aop.h @@ -261,7 +261,7 @@ enum aop_argkind { */ #define AOP_DYNVAL(VAL) ATA_DYNVAL, VAL -extern const char *aop_capture_function_name (struct aop_joinpoint *jp); +extern const char *aop_get_function_name (void); extern struct aop_pointcut *aop_match_function_entry (); extern void aop_filter_by_in_param (struct aop_pointcut *pc, int n, diff --git a/test/plugin-duplicate.c b/test/plugin-duplicate.c index e6ef15f..73c4f7f 100644 --- a/test/plugin-duplicate.c +++ b/test/plugin-duplicate.c @@ -10,7 +10,7 @@ static void plugin_join_on_entry(struct aop_joinpoint *jp, void *data) { const char *name; - name = aop_capture_function_name(jp); + name = aop_get_function_name(); if (name != NULL && strcmp(name, "foo") == 0) { aop_duplicate(jp, "_distrib", AOP_TERM_ARG); duplicated = 1; diff --git a/test/plugin-pointer-types.c b/test/plugin-pointer-types.c index 971c5ee..06468ea 100644 --- a/test/plugin-pointer-types.c +++ b/test/plugin-pointer-types.c @@ -11,7 +11,7 @@ static void plugin_join_on_call(struct aop_joinpoint *jp, void *data) const char *called; struct aop_dynval *p; - func = aop_capture_function_name(jp); + func = aop_get_function_name(); if (func == NULL || strcmp(func, "run_test") != 0) return; diff --git a/test/plugin-reinst-dup.c b/test/plugin-reinst-dup.c index 63ac3b0..93231ab 100644 --- a/test/plugin-reinst-dup.c +++ b/test/plugin-reinst-dup.c @@ -10,7 +10,7 @@ static void plugin_join_on_entry(struct aop_joinpoint *jp, void *data) { const char *name; - name = aop_capture_function_name(jp); + name = aop_get_function_name(); if (name != NULL && strcmp(name, "foo") == 0) { aop_duplicate(jp, "_distrib", AOP_TERM_ARG); duplicated = 1;