gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20464 - monkey/branches/MonkeyBacktracking/monkey/src/monk


From: gnunet
Subject: [GNUnet-SVN] r20464 - monkey/branches/MonkeyBacktracking/monkey/src/monkey
Date: Mon, 12 Mar 2012 16:50:36 +0100

Author: safey
Date: 2012-03-12 16:50:36 +0100 (Mon, 12 Mar 2012)
New Revision: 20464

Modified:
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
Log:
Preventing irrelevant expressions from being evaluated and spoiling values of 
relevant expression in the debugging report

Modified: monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c   
2012-03-12 14:35:51 UTC (rev 20463)
+++ monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c   
2012-03-12 15:50:36 UTC (rev 20464)
@@ -398,7 +398,16 @@
   return faultyExpression;
 }
 
+
 static int
+isAssignment(const char* expressionSyntax) {
+       if (NULL != strstr(expressionSyntax, "="))
+               return MONKEY_YES;
+       return MONKEY_NO;
+}
+
+
+static int
 analyzeSegmentationFault (struct Function *function, struct 
MONKEY_ACTION_Context *cntxt)
 {
   struct Expression *tmp;
@@ -413,17 +422,26 @@
        {
          if (tmp != faultyExpression)
            {
-             tmp->expressionValue =
-               gmi_data_evaluate_expression (cntxt->gdb_handle,
-                                             tmp->expressionSyntax);
-             if (NULL != tmp->expressionValue
-                 && (strcmp (tmp->expressionValue, "0x0") == 0
-                     || strcmp (tmp->expressionValue, "NULL") == 0))
-               {
-                 cntxt->gdb_null_variable = tmp->expressionSyntax;
-                 cntxt->bug_detected = BUG_NULL_POINTER; // We are sure at 
this point that it's a NULL Pointer Exception and not a Bad Memory Access
-                 return MONKEY_OK;
-               }
+                 if (MONKEY_NO == isAssignment(tmp->expressionSyntax)) { // We 
should NOT evaluate assignments, otherwise subsequent expression evaluations 
will be spoiled
+                         tmp->expressionValue =
+                       gmi_data_evaluate_expression (cntxt->gdb_handle,
+                                                         
tmp->expressionSyntax);
+                         if (NULL != tmp->expressionValue
+                         && (strcmp (tmp->expressionValue, "0x0") == 0
+                                 || strcmp (tmp->expressionValue, "NULL") == 
0))
+                       {
+                         cntxt->gdb_null_variable = tmp->expressionSyntax;
+                         cntxt->bug_detected = BUG_NULL_POINTER; // We are 
sure at this point that it's a NULL Pointer Exception and not a Bad Memory 
Access
+                         return MONKEY_OK;
+                       }
+                 }
+                 else {
+                         /* Expressions with assignments should be removed 
from the list of expressions */
+                         struct Expression *removedExpression = tmp;
+                         tmp = tmp->next;
+                         
MONKEY_CONTAINER_DLL_remove(function->expressionListHead, 
function->expressionListTail, removedExpression);
+                         continue;// don't progress the pointer twice
+                 }
            }
          tmp = tmp->next;
        }
@@ -464,15 +482,23 @@
       tmp = function->expressionListHead;
       while (NULL != tmp)
        {
-         const char *eval;
-         eval =
-           gmi_data_evaluate_expression (cntxt->gdb_handle,
-                                         tmp->expressionSyntax);
-         if (NULL != eval)
-           {
-             tmp->expressionValue = eval;
-           }
-         tmp = tmp->next;
+         if (MONKEY_NO == isAssignment(tmp->expressionSyntax)) {
+                 const char *eval;
+                 eval =
+                       gmi_data_evaluate_expression (cntxt->gdb_handle,
+                                                 tmp->expressionSyntax);
+                 if (NULL != eval)
+                       {
+                         tmp->expressionValue = eval;
+                       }
+                 tmp = tmp->next;
+          }
+         else {
+                 /* Expressions with assignments should be removed from the 
list of expressions */
+                 struct Expression *removedExpression = tmp;
+                 tmp = tmp->next;
+                 MONKEY_CONTAINER_DLL_remove(function->expressionListHead, 
function->expressionListTail, removedExpression);
+         }
        }
     }
   return MONKEY_OK;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]