Adds TC_BAD_RETURN_BINDING error code.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Wed, 13 Apr 2011 00:28:13 +0000 (20:28 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Wed, 13 Apr 2011 00:28:13 +0000 (20:28 -0400)
src/tracecut.c
src/tracecut.h

index 89f68cf1c338864c87c6f28a67733b154042e743..b7c9c2910d57912a9b8c660211eb9aa2e204d4eb 100644 (file)
@@ -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.
index 5b065347f14832b0a5e4b173ec18fddc903d5e2e..b967288b23a855604310e9c6ebaedf8395a9f1fc 100644 (file)
@@ -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.
    */