From 6448498ae9d3ec5c413754c7f963ff6a50a2f25c Mon Sep 17 00:00:00 2001 From: Justin Seyster Date: Tue, 12 Apr 2011 20:28:13 -0400 Subject: [PATCH] Adds TC_BAD_RETURN_BINDING error code. --- src/tracecut.c | 9 +++++++++ src/tracecut.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/tracecut.c b/src/tracecut.c index 89f68cf..b7c9c29 100644 --- a/src/tracecut.c +++ b/src/tracecut.c @@ -441,6 +441,11 @@ add_call_symbol_binding (struct tc_tracecut *tc, const char *param_name, if (param == NULL || symbol == NULL) return return_error (tc, TC_NOENT); + /* Can't bind the return value for an AOP_INSERT_BEFORE join + point! */ + if (index == -1 && symbol->location == AOP_INSERT_BEFORE) + return return_error (tc, TC_BAD_RETURN_BINDING); + binding = (struct tc_call_binding *)malloc (sizeof (struct tc_call_binding)); if (binding == NULL) return return_error (tc, TC_NOMEM); @@ -494,6 +499,8 @@ tc_bind_to_call_param (struct tc_tracecut *tc, const char *param_name, * \return #TC_SUCCESS or * - #TC_BAD_CONTEXT, when called after compilation has already * started; + * - #TC_BAD_RETURN_BINDING, if the specified symbol has a location of + * #AOP_INSERT_BEFORE; * - #TC_NOENT, if either the symbol or the binding does not exist; * - #TC_NOMEM, if memory runs out. */ @@ -550,6 +557,8 @@ tc_bind_to_return_value (struct tc_tracecut *tc, const char *param_name, * must only contain letters, numbers and the underscore character, * with no spaces. Identifiers are case sensitive and should be no * longer than #TC_MAX_ID_SIZE.) + * - #TC_BAD_RETURN_BINDING, if the the declaration binds the return + * value but the location is #AOP_INSERT_BEFORE; * - #TC_NOENT, if one of the parameters in the declaration does not * exist; * - #TC_NOMEM, if memory runs out. diff --git a/src/tracecut.h b/src/tracecut.h index 5b06534..b967288 100644 --- a/src/tracecut.h +++ b/src/tracecut.h @@ -82,6 +82,12 @@ enum tc_error { */ TC_BAD_ID, + /** + * Attempt to bind the return value of a call symbol that has a + * location of #AOP_INSERT_BEFORE. + */ + TC_BAD_RETURN_BINDING, + /** * Attempt to reference a name that does not exist. */ -- 2.34.1