From b87e59df855c9a734e9b20ff62d56782f08c324e Mon Sep 17 00:00:00 2001 From: Justin Seyster Date: Thu, 17 Feb 2011 17:21:42 -0500 Subject: [PATCH] Tracecut initialize also sends param names to tracecut-advice. --- src/tracecut-advice.c | 5 +++++ src/tracecut.c | 10 ++++++++++ test/tracecut-hooks.c | 5 +++++ test/tracecut.xml | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/src/tracecut-advice.c b/src/tracecut-advice.c index 2802b3c..6519f03 100644 --- a/src/tracecut-advice.c +++ b/src/tracecut-advice.c @@ -317,6 +317,11 @@ _tc_name_symbol (int tc_index, int symbol_index, const char *symbol_name) tc->symbol_names[symbol_index] = symbol_name; } +ADVICE_FUNC void +_tc_name_param (int tc_index, int param_index, const char *param_name) +{ +} + ADVICE_FUNC void _tc_compile_rule (int tc_index, int rule_index, const char *specification) { diff --git a/src/tracecut.c b/src/tracecut.c index af50d42..17883c1 100644 --- a/src/tracecut.c +++ b/src/tracecut.c @@ -647,6 +647,7 @@ tc_insert_tracecut_init_advice (struct aop_joinpoint *jp) { int i; struct tc_call_symbol *symbol; + struct tc_param *param; struct tc_rule *rule; int num_params, num_symbols, num_rules; @@ -668,6 +669,15 @@ tc_insert_tracecut_init_advice (struct aop_joinpoint *jp) AOP_STR_CST (symbol->name), AOP_TERM_ARG); } + for (param = tc->param_list; param != NULL; param = param->next) + { + /* _tc_name_param(tc_index, param_index, param_name); */ + aop_insert_advice (jp, "_tc_name_param", AOP_INSERT_BEFORE, + AOP_INT_CST (tc->index), + AOP_INT_CST (param->index), + AOP_STR_CST (param->name), AOP_TERM_ARG); + } + for (rule = tc->rule_list, i = 0; rule != NULL; rule = rule->next, i++) { /* _tc_compile_rule(tc_index, rule_index, specification) */ diff --git a/test/tracecut-hooks.c b/test/tracecut-hooks.c index 8f5a5a8..46b75f0 100644 --- a/test/tracecut-hooks.c +++ b/test/tracecut-hooks.c @@ -15,6 +15,11 @@ void _tc_name_symbol(int tc, int symbol_index, const char *symbol_name) printf("Name symbol -- tc: %d, symbol: %d, name: %s\n", tc, symbol_index, symbol_name); } +void _tc_name_param(int tc, int param_index, const char *param_name) +{ + printf("Name param -- tc: %d, param: %d, name: %s\n", tc, param_index, param_name); +} + void _tc_compile_rule(int tc, int rule_index, const char *specification) { printf("Compile -- tc: %d, %d, %s\n", tc, rule_index, specification); diff --git a/test/tracecut.xml b/test/tracecut.xml index a5fab03..072e7a3 100644 --- a/test/tracecut.xml +++ b/test/tracecut.xml @@ -8,16 +8,20 @@ Init -- n: 3 New tracecut -- tc: 0, params: 2, symbols: 2 Name symbol -- tc: 0, symbol: 0, name: transfer + Name param -- tc: 0, param: 1, name: bar + Name param -- tc: 0, param: 0, name: foo Compile -- tc: 0, 0, transfer transfer New tracecut -- tc: 1, params: 1, symbols: 1 Name symbol -- tc: 1, symbol: 2, name: half Name symbol -- tc: 1, symbol: 1, name: double Name symbol -- tc: 1, symbol: 0, name: get + Name param -- tc: 1, param: 0, name: bar Compile -- tc: 1, 0, get double* half New tracecut -- tc: 2, params: 1, symbols: 1 Name symbol -- tc: 2, symbol: 2, name: dec Name symbol -- tc: 2, symbol: 1, name: inc Name symbol -- tc: 2, symbol: 0, name: get + Name param -- tc: 2, param: 0, name: foo Compile -- tc: 2, 0, get inc* dec Beginning event -- tc: 2 Param -- tc: 2, symbol: 0, param: 0, value: 0x8 -- 2.34.1