gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20934 - in monkey/branches/MonkeyBacktracking/monkey: . sr


From: gnunet
Subject: [GNUnet-SVN] r20934 - in monkey/branches/MonkeyBacktracking/monkey: . src/monkey src/monkey/seaspider src/monkey/seaspider/org/gnunet/seaspider
Date: Wed, 11 Apr 2012 09:23:23 +0200

Author: safey
Date: 2012-04-11 09:23:23 +0200 (Wed, 11 Apr 2012)
New Revision: 20934

Added:
   monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml
   monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_without_depth.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
Modified:
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_assertion_failure.db
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_bad_memory_access.db
   
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_division_by_zero_loop.db
   
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception.db
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/edb_api.c
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/Makefile
   
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionDatabaseHandler.java
   
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java
Log:
Seaspider flags function calls.
Function call problem solved.
Assertion Failures working.


Added: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml 
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml 
2012-04-11 07:23:23 UTC (rev 20934)
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<crash category="Assertion Failure" function="assertionFailure" line="9" 
file="bug_assertion_failure.c" >
+<history><epoch step="0" >
+<trace><function name="assertionFailure" line="9" 
file="bug_assertion_failure.c" depth="0" >
+<expressions><expression name="assert(x&lt;4)" >
+Not Evaluated</expression>
+<expression name="x&lt;4" >
+0</expression>
+<expression name="printf(&quot;Assertion Failure Now!\n&quot;)" >
+Not Evaluated</expression>
+<expression name="x" >
+5</expression>
+</expressions>
+</function>
+<function name="main" line="14" file="bug_assertion_failure.c" depth="1" >
+<expressions><expression name="assertionFailure()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="1" >
+<trace><function name="assertionFailure" line="8" 
file="bug_assertion_failure.c" depth="0" >
+<expressions><expression name="printf(&quot;Assertion Failure Now!\n&quot;)" >
+Not Evaluated</expression>
+<expression name="x" >
+5</expression>
+</expressions>
+</function>
+<function name="main" line="14" file="bug_assertion_failure.c" depth="1" >
+<expressions><expression name="assertionFailure()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="2" >
+<trace><function name="assertionFailure" line="7" 
file="bug_assertion_failure.c" depth="0" >
+<expressions><expression name="x" >
+0</expression>
+</expressions>
+</function>
+<function name="main" line="14" file="bug_assertion_failure.c" depth="1" >
+<expressions><expression name="assertionFailure()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="3" >
+<trace><function name="main" line="14" file="bug_assertion_failure.c" 
depth="0" >
+<expressions><expression name="assertionFailure()" >
+Not Evaluated</expression>
+<expression name="argv" >
+0x7fffffffe688</expression>
+<expression name="argc" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+</history>
+</crash>


Property changes on: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access.xml
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access.xml     
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access.xml     
2012-04-11 07:23:23 UTC (rev 20934)
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+<crash category="Bad memory access" function="badMemoryAccess" line="9" 
file="bug_bad_memory_access.c" >
+<valgrind>==22171== Memcheck, a memory error detector
+==22171== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
+==22171== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
+==22171== Command: src/monkey/bug_bad_memory_access
+==22171== Parent PID: 22170
+==22171== 
+==22171== Invalid write of size 4
+==22171==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
+==22171==    by 0x400532: main (bug_bad_memory_access.c:14)
+==22171==  Address 0x4252352 is not stack'd, malloc'd or (recently) free'd
+==22171== 
+==22171== 
+==22171== Process terminating with default action of signal 11 (SIGSEGV)
+==22171==  Access not within mapped region at address 0x4252352
+==22171==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
+==22171==    by 0x400532: main (bug_bad_memory_access.c:14)
+==22171==  If you believe this happened as a result of a stack
+==22171==  overflow in your program's main thread (unlikely but
+==22171==  possible), you can try to increase the size of the
+==22171==  main thread stack using the --main-stacksize= flag.
+==22171==  The main thread stack size used in this run was 8388608.
+==22171== 
+==22171== HEAP SUMMARY:
+==22171==     in use at exit: 0 bytes in 0 blocks
+==22171==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+==22171== 
+==22171== All heap blocks were freed -- no leaks are possible
+==22171== 
+==22171== For counts of detected and suppressed errors, rerun with: -v
+==22171== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 
4)</valgrind>
+<history><epoch step="0" >
+<trace><function name="badMemoryAccess" line="9" 
file="bug_bad_memory_access.c" depth="0" >
+<expressions><expression name="*p=5" >
+Not Evaluated</expression>
+<expression name="*p" >
+Not Evaluated</expression>
+<expression name="printf(&quot;Bad memory access now!\n&quot;)" >
+Not Evaluated</expression>
+<expression name="0x4252352" >
+69542738</expression>
+</expressions>
+</function>
+<function name="main" line="14" file="bug_bad_memory_access.c" depth="1" >
+<expressions><expression name="badMemoryAccess()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="1" >
+<trace><function name="badMemoryAccess" line="8" 
file="bug_bad_memory_access.c" depth="0" >
+<expressions><expression name="printf(&quot;Bad memory access now!\n&quot;)" >
+Not Evaluated</expression>
+<expression name="0x4252352" >
+69542738</expression>
+</expressions>
+</function>
+<function name="main" line="14" file="bug_bad_memory_access.c" depth="1" >
+<expressions><expression name="badMemoryAccess()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="2" >
+<trace><function name="badMemoryAccess" line="7" 
file="bug_bad_memory_access.c" depth="0" >
+<expressions><expression name="0x4252352" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="14" file="bug_bad_memory_access.c" depth="1" >
+<expressions><expression name="badMemoryAccess()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="3" >
+<trace><function name="main" line="14" file="bug_bad_memory_access.c" 
depth="0" >
+<expressions><expression name="badMemoryAccess()" >
+Not Evaluated</expression>
+<expression name="argv" >
+0x7fffffffe688</expression>
+<expression name="argc" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+</history>
+</crash>


Property changes on: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_without_depth.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_without_depth.xml
                           (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_without_depth.xml
   2012-04-11 07:23:23 UTC (rev 20934)
@@ -0,0 +1,130 @@
+<?xml version="1.0"?>
+<crash category="Division By Zero" function="main" line="14" 
file="bug_division_by_zero_loop.c" >
+<history><epoch step="0" >
+<trace><function name="main" line="14" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="result/k" >
+Not Evaluated</expression>
+<expression name="i&lt;5" >
+1</expression>
+<expression name="i" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="1" >
+<trace><function name="main" line="13" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="i&lt;5" >
+1</expression>
+<expression name="i" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="2" >
+<trace><function name="main" line="11" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="i&lt;5" >
+1</expression>
+<expression name="i" >
+0</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="3" >
+<trace><function name="main" line="15" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="printf(&quot;result = %d\n&quot;,result)" >
+Not Evaluated</expression>
+<expression name="result/k" >
+10</expression>
+<expression name="i&lt;5" >
+1</expression>
+<expression name="i" >
+0</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="4" >
+<trace><function name="main" line="14" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="result/k" >
+-10</expression>
+<expression name="i&lt;5" >
+1</expression>
+<expression name="i" >
+0</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="5" >
+<trace><function name="main" line="13" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="i&lt;5" >
+1</expression>
+<expression name="i" >
+0</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="6" >
+<trace><function name="main" line="11" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="i&lt;5" >
+1</expression>
+<expression name="i" >
+0</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="7" >
+<trace><function name="main" line="10" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="printf(&quot;I am alive!\n&quot;)" >
+Not Evaluated</expression>
+<expression name="result" >
+10</expression>
+<expression name="-1" >
+-1</expression>
+<expression name="k" >
+-1</expression>
+<expression name="argv" >
+0x7fffffffe688</expression>
+<expression name="argc" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="8" >
+<trace><function name="main" line="8" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="result" >
+32767</expression>
+<expression name="-1" >
+-1</expression>
+<expression name="k" >
+-1</expression>
+<expression name="argv" >
+0x7fffffffe688</expression>
+<expression name="argc" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="9" >
+<trace><function name="main" line="7" file="bug_division_by_zero_loop.c" 
depth="0" >
+<expressions><expression name="-1" >
+-1</expression>
+<expression name="k" >
+0</expression>
+<expression name="argv" >
+0x7fffffffe688</expression>
+<expression name="argc" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+</history>
+</crash>


Property changes on: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_without_depth.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
    2012-04-11 07:23:23 UTC (rev 20934)
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<crash category="npe" function="crashFunction" line="14" 
file="bug_null_pointer_exception.c" >
+<history><epoch step="0" >
+<trace><function name="crashFunction" line="14" 
file="bug_null_pointer_exception.c" depth="0" >
+<expressions><expression name="crashStruct-&gt;crashValue=&quot;hello!&quot;" >
+Not Evaluated</expression>
+<expression name="crashStruct-&gt;crashValue" >
+Not Evaluated</expression>
+<expression name="printf(&quot;Now the program will crash!\n&quot;)" >
+Not Evaluated</expression>
+<expression name="NULL" >
+Not Evaluated</expression>
+<expression name="crashStruct" >
+0x0</expression>
+</expressions>
+</function>
+<function name="main" line="19" file="bug_null_pointer_exception.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="1" >
+<trace><function name="crashFunction" line="13" 
file="bug_null_pointer_exception.c" depth="0" >
+<expressions><expression name="printf(&quot;Now the program will 
crash!\n&quot;)" >
+Not Evaluated</expression>
+<expression name="NULL" >
+Not Evaluated</expression>
+<expression name="crashStruct" >
+0x0</expression>
+</expressions>
+</function>
+<function name="main" line="19" file="bug_null_pointer_exception.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="2" >
+<trace><function name="crashFunction" line="12" 
file="bug_null_pointer_exception.c" depth="0" >
+<expressions><expression name="crashStruct=NULL" >
+Not Evaluated</expression>
+<expression name="NULL" >
+Not Evaluated</expression>
+<expression name="crashStruct" >
+0x400540</expression>
+</expressions>
+</function>
+<function name="main" line="19" file="bug_null_pointer_exception.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="3" >
+<trace><function name="main" line="19" file="bug_null_pointer_exception.c" 
depth="0" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+0x7fffffffe688</expression>
+<expression name="argc" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+</history>
+</crash>


Property changes on: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c   
2012-04-11 01:49:49 UTC (rev 20933)
+++ monkey/branches/MonkeyBacktracking/monkey/src/monkey/action_api.c   
2012-04-11 07:23:23 UTC (rev 20934)
@@ -18,6 +18,7 @@
 static int async_c = 0;
 static int stepBackCount = 0;
 static char *signalMeaning = NULL;
+static int stoppedInSharedLib = MONKEY_NO;
 static int failureFunctionStartLine = 0;       // start line number of the 
function in which the failure occurs
 static struct Expression *expressionListHead = NULL;
 static struct Expression *expressionListTail = NULL;
@@ -51,6 +52,7 @@
     struct Expression *prev;
     const char *expressionSyntax;
     const char *expressionValue;
+    int isCall;
     int lineNo;
 };
 
@@ -192,12 +194,13 @@
 
                        if (MONKEY_YES == cntxt->run_reverse) {
                                /* We are in backtracking mode, we need to move 
GDB from the shared library to our source code */
-                               /*gmi_break_insert(cntxt->gdb_handle, 
cntxt->gdb_frames->file,
+                               stoppedInSharedLib = MONKEY_YES;
+                               *gmi_break_insert(cntxt->gdb_handle, 
cntxt->gdb_frames->file,
                                                 cntxt->gdb_frames->line);
                                gmi_exec_continue_reverse(cntxt->gdb_handle);
                                while (!mi_get_response(cntxt->gdb_handle))
-                               usleep(1000);
-                               cntxt->gdb_frames = 
gmi_stack_list_frames(cntxt->gdb_handle);*/
+                                       usleep(1000);
+                               cntxt->gdb_frames = 
gmi_stack_list_frames(cntxt->gdb_handle);
                        }
                }
 
@@ -333,6 +336,7 @@
     expression = MONKEY_malloc(sizeof(struct Expression));
     expression->expressionSyntax = MONKEY_strdup(colValues[0]);
     expression->lineNo = atoi(colValues[1]);
+    expression->isCall = atoi(colValues[2]);
     expression->expressionValue = NULL;
     expression->next = NULL;
     expression->prev = NULL;
@@ -397,6 +401,10 @@
     if (NULL != faultyExpression) {
        tmp = function->expressionListHead;
        while (NULL != tmp) {
+               if (MONKEY_YES == tmp->isCall) {
+                       tmp = tmp->next;
+                       continue; // We will not evaluate function calls 
(because GDB will evaluate by calling the function)
+               }
            if (tmp != faultyExpression) {
                if (MONKEY_NO == isAssignment(tmp->expressionSyntax)) { // We 
should NOT evaluate assignments, otherwise subsequent expression evaluations 
will be spoiled
                    tmp->expressionValue =
@@ -423,7 +431,7 @@
                    continue;   // don't progress the pointer twice
                }
            }
-           tmp = tmp->next;
+               tmp = tmp->next;
        }
     }
     /* Set watch points on the faulty-expression's subexpressions */
@@ -445,7 +453,7 @@
 //              }
 //              return MONKEY_OK;
 //      }
-    return GDB_STATE_ERROR;
+    return MONKEY_OK;
 }
 
 
@@ -461,6 +469,10 @@
     if (NULL != faultyExpression) {
        tmp = function->expressionListHead;
        while (NULL != tmp) {
+               if (MONKEY_YES == tmp->isCall) {
+                       tmp = tmp->next;
+                       continue;
+               }
            if (MONKEY_NO == isAssignment(tmp->expressionSyntax)) {
                        const char *eval;
                        eval =
@@ -574,7 +586,8 @@
        if (NULL == edbCntxt) {
            fprintf(stderr,
                    "Unable to connect to Expression Database file!\n");
-           return MONKEY_NO;
+           ret = MONKEY_NO;
+           goto cleanup;
        }
     }
 
@@ -583,8 +596,9 @@
                                              cntxt->gdb_frames->line,
                                              &scopeEndCallback,
                                              &endScope);
-    if (endScope <= 0)
-       return MONKEY_NO;
+    if (endScope <= 0) {
+       goto cleanup;
+    }
 
     if (cntxt->scope_depth > 0) {
        /* Means we need to look is scopes outer than the one where the problem 
occurred */
@@ -597,8 +611,9 @@
                                                     file, endScope,
                                                     &functionStartCallback,
                                                     NULL);
-       if (ret == MONKEY_NO || failureFunctionStartLine <= 0)
-           return MONKEY_NO;
+       if (ret == MONKEY_NO || failureFunctionStartLine <= 0) {
+               goto cleanup;
+       }
 
        ret =
            MONKEY_EDB_get_all_outer_scopes(edbCntxt,
@@ -607,8 +622,9 @@
                                            cntxt->gdb_frames->line,
                                            endScope, &outerScopesCallback,
                                            NULL);
-       if (ret == MONKEY_NO)
-           return MONKEY_NO;
+       if (ret == MONKEY_NO) {
+               goto cleanup;
+       }
          /**
           * 1 void fun()
           * 2 {
@@ -699,16 +715,17 @@
     /* Now, dive deeper into the stack trace */
     cntxt->gdb_frames = cntxt->gdb_frames->next;
     if (NULL == cntxt->gdb_frames) {
-       /* Cleanup function static variables that are used across recursive 
calls */
-       stackDepth = 0;
-       trace = NULL;
+               /* Cleanup function static variables that are used across 
recursive calls */
+cleanup:
+               stackDepth = 0;
+               trace = NULL;
+               MONKEY_EDB_disconnect(edbCntxt);
 
-       if (MONKEY_NO == cntxt->run_reverse)
-           mi_disconnect(cntxt->gdb_handle);   // otherwise, we will need to 
use gdb mi for reverse execution
-       MONKEY_EDB_disconnect(edbCntxt);
+               if (MONKEY_NO == cntxt->run_reverse)
+                       mi_disconnect(cntxt->gdb_handle);       // otherwise, 
we will need to use gdb mi for reverse execution
     } else {
-       /* Recursively inspect the database for deeper frames */
-       MONKEY_ACTION_inspect_expression_database(cntxt);
+               /* Recursively inspect the database for deeper frames */
+               ret = MONKEY_ACTION_inspect_expression_database(cntxt);
     }
     return ret;
 }
@@ -727,13 +744,15 @@
      * We execute one step back operation before starting analysis. We do that 
to go to the expression before the one where the crash occurred.
      * Because we already have the expression where the crash happened in our 
stack structure from the previous epoch step (the initial epoch)
      */
-    if (MONKEY_NO != gmi_exec_next_reverse(cntxt->gdb_handle)) {
-       while (!mi_get_response(cntxt->gdb_handle))
-           usleep(1000);
-    } else {
-       fprintf(stderr, "Error: Reverse Execution has failed!\n");
-       mi_disconnect(cntxt->gdb_handle);       // No need for gdb mi at this 
point!
-       return MONKEY_NO;
+    if (MONKEY_NO == stoppedInSharedLib) {
+               if (MONKEY_NO != gmi_exec_next_reverse(cntxt->gdb_handle)) {
+               while (!mi_get_response(cntxt->gdb_handle))
+                       usleep(1000);
+               } else {
+               fprintf(stderr, "Error: Reverse Execution has failed!\n");
+               mi_disconnect(cntxt->gdb_handle);       // No need for gdb mi 
at this point!
+               return MONKEY_NO;
+               }
     }
 
     /* Do reverse execution for all expressions in the function in which the 
failure occurred */

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_assertion_failure.db
===================================================================
(Binary files differ)

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_bad_memory_access.db
===================================================================
(Binary files differ)

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_division_by_zero_loop.db
===================================================================
(Binary files differ)

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception.db
===================================================================
(Binary files differ)

Modified: monkey/branches/MonkeyBacktracking/monkey/src/monkey/edb_api.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/edb_api.c      
2012-04-11 01:49:49 UTC (rev 20933)
+++ monkey/branches/MonkeyBacktracking/monkey/src/monkey/edb_api.c      
2012-04-11 07:23:23 UTC (rev 20934)
@@ -217,7 +217,7 @@
   char *query;
   if (MONKEY_asprintf
          (&query,
-          "select expr_syntax, start_lineno from Expression where file_name 
LIKE \'%%/%s\' and start_lineno <= %d and end_lineno <= %d",
+          "select expr_syntax, start_lineno, is_call from Expression where 
file_name LIKE \'%%/%s\' and start_lineno <= %d and end_lineno <= %d",
           file_name, start_line_no, end_line_no) == -1)
        {
          fprintf(stderr,
@@ -260,7 +260,7 @@
   char *query;
   if (MONKEY_asprintf
       (&query,
-       "select expr_syntax, start_lineno from Expression where file_name LIKE 
\'%%/%s\' and start_lineno <= %d and end_lineno = %d",
+       "select expr_syntax, start_lineno, is_call from Expression where 
file_name LIKE \'%%/%s\' and start_lineno <= %d and end_lineno = %d",
        file_name, start_line_no, end_line_no) == -1)
     {
       fprintf(stderr,
@@ -292,7 +292,7 @@
   char *query;
   if (MONKEY_asprintf
       (&query,
-       "select expr_syntax, start_lineno from Expression where file_name LIKE 
\'%%/%s\' and start_lineno = %d and end_lineno = %d",
+       "select expr_syntax, start_lineno, is_call from Expression where 
file_name LIKE \'%%/%s\' and start_lineno = %d and end_lineno = %d",
        file_name, start_line_no, end_line_no) == -1)
     {
       fprintf(stderr,

Modified: monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c       
2012-04-11 01:49:49 UTC (rev 20933)
+++ monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c       
2012-04-11 07:23:23 UTC (rev 20934)
@@ -118,7 +118,9 @@
          ret = 1;
          break;
        }
-      else if (GDB_STATE_ERROR == retVal)
+      else if (BUG_NULL_POINTER != cntxt->bug_detected
+                 && BUG_ABORT != cntxt->bug_detected
+                 && BUG_ARITHMETIC != cntxt->bug_detected)
        {
          /* GDB could not locate a NULL value expression, launch Valgrind */
          retVal = MONKEY_ACTION_rerun_with_valgrind (cntxt);

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/Makefile
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/Makefile     
2012-04-11 01:49:49 UTC (rev 20933)
+++ monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/Makefile     
2012-04-11 07:23:23 UTC (rev 20934)
@@ -1,5 +1,5 @@
 all:
        jtb C.jj
        javacc C.out.jj
-       javac -nowarn -classpath 
../../../contrib/antlr-runtime-3.1.3.jariantlr-runtime-3.1.3.jarantlr-runtime-3.1.3.jar:../../../contrib/sqljet.1.0.3.b914.jar
 `find * -name "*.java"`
+       javac -nowarn -classpath 
../../../contrib/antlr-runtime-3.1.3.jar:../../../contrib/sqljet.1.0.3.b914.jar 
`find * -name "*.java"`
        jar -cvf seaspider.jar `find * -name "*.class"` 

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionDatabaseHandler.java
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionDatabaseHandler.java
  2012-04-11 01:49:49 UTC (rev 20933)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionDatabaseHandler.java
  2012-04-11 07:23:23 UTC (rev 20934)
@@ -40,7 +40,7 @@
        public static void createExpressionDatabase(String databasePath) {
                String createTableQuery = "CREATE TABLE Expression ( expr_ID 
INTEGER PRIMARY KEY AUTOINCREMENT, "
                                + "file_name TEXT NOT NULL , expr_syntax TEXT 
NOT NULL ,"
-                               + " start_lineno INT, end_lineno INT)";
+                               + " start_lineno INT, end_lineno INT, is_call 
INT NOT NULL)";
 
                File dbFile = new File(databasePath);
                dbFile.delete();/* Delete it if already existent */
@@ -74,13 +74,13 @@
        }
 
        private static void doInsertExpression(String fileName,
-                       String expressionSyntax, int startLineNo, int 
endLineNo) {
+                       String expressionSyntax, int startLineNo, int 
endLineNo, boolean isCall) {
                try {
                        if (DEBUG)
                                System.out.println(fileName + ":[" + 
startLineNo + "-"
                                                + endLineNo + "]: " + 
expressionSyntax);
                        table.insert(null, currentFileName, expressionSyntax, 
startLineNo,
-                                       endLineNo);
+                                       endLineNo, isCall);
                } catch (SqlJetException e) {
                        e.printStackTrace();
                }
@@ -130,7 +130,7 @@
        }
 
        private static void insertExpression(String fileName,
-                       String expressionSyntax, int startLineNo, int 
endLineNo) {
+                       String expressionSyntax, int startLineNo, int 
endLineNo, boolean isCall) {
 
                HashMap<String, Integer> currentScopeExpressions = null;
 
@@ -173,7 +173,7 @@
 
                /* Add the new expression */
                currentScopeExpressions.put(expressionSyntax, endLineNo);
-               doInsertExpression(fileName, expressionSyntax, startLineNo, 
endLineNo);
+               doInsertExpression(fileName, expressionSyntax, startLineNo, 
endLineNo, isCall);
        }
 
        /**
@@ -185,7 +185,7 @@
         * @param endLineNo end line of the expression scope
         */
        public static void insertIntoExpressionTable(String fileName,
-                       String expressionSyntax, int startLineNo, int 
endLineNo) {
+                       String expressionSyntax, int startLineNo, int 
endLineNo, boolean isCall) {
                if (expressionSyntax.matches("[0-9]*"))
                        return;
                if (expressionSyntax.startsWith("\""))
@@ -199,6 +199,6 @@
                String[] fileNameArr = fileName.split("src/");
                if (fileNameArr.length > 1)
                        fileName = fileNameArr[1];
-               insertExpression(fileName, expressionSyntax, startLineNo, 
endLineNo);
+               insertExpression(fileName, expressionSyntax, startLineNo, 
endLineNo, isCall);
        }
 }

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java
 2012-04-11 01:49:49 UTC (rev 20933)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java
 2012-04-11 07:23:23 UTC (rev 20934)
@@ -54,23 +54,29 @@
 
        class ExpressionBuilder {
                String expression = "";
-
-               boolean contains_call;
-
+               boolean contains_call;
+               
+               ExpressionBuilder() {
+                       
+               }
+               ExpressionBuilder(String expression) {
+                       this.expression = expression;
+               }
+           
+           /*    
                void push(String token) {
                        expression = expression + token;
                }
+               */
 
                void push(ExpressionBuilder eb) {
                        expression = expression + eb.expression;
-                       contains_calls |= eb.contains_call;
+                       contains_call |= eb.contains_call;
                }
 
                void commit(int line) {
-                       if (contains_calls)
-                           return; // skip this, we don't want to run function 
calls
                        
ExpressionDatabaseHandler.insertIntoExpressionTable(filename,
-                                       expression, line, scope_end_line);
+                                               expression, line, 
scope_end_line, contains_call);
                }
 
        }
@@ -102,7 +108,9 @@
        public void visit(NodeToken n) {
                if (skip_mode)
                        return;
-               current_expression.push(n.tokenImage);
+               ExpressionBuilder eb = new ExpressionBuilder();
+               eb.expression = n.tokenImage;
+               current_expression.push(eb);
        }
 
        public void visit(StructOrUnionSpecifier n) {
@@ -129,7 +137,7 @@
                        n.f0.accept(this);
                        LineNumberInfo lin = LineNumberInfo.get(n);
                        if (old != null) {
-                               old.push(current_expression.expression);
+                               old.push(current_expression);
                                old.commit(lin.lineEnd);
                        } else {
                                current_expression.commit(lin.lineEnd);
@@ -307,7 +315,7 @@
                        current_expression = new ExpressionBuilder();
                        ns.elementAt(1).accept(this);
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }       
        
@@ -332,11 +340,11 @@
                        u.accept(this);
                        current_expression.commit(lin.lineEnd);
                        ao.accept (this);
-                       old.push(current_expression.expression);
+                       old.push(current_expression);
                        current_expression = new ExpressionBuilder();
                        ae.accept(this);
                        current_expression.commit(lin.lineEnd);
-                       old.push(current_expression.expression);
+                       old.push(current_expression);
                        current_expression = old;
                }
                else
@@ -349,20 +357,20 @@
                ExpressionBuilder old = current_expression;
                current_expression = new ExpressionBuilder();
                n.f0.accept(this);
-               old.push(current_expression.expression);
+               old.push(current_expression);
                if (n.f1.present()) {
                        LineNumberInfo lin = LineNumberInfo.get(n);
                        NodeSequence ns = (NodeSequence) n.f1.node;
                        current_expression = new ExpressionBuilder();
                        ns.elementAt(1).accept(this);
                        current_expression.commit(lin.lineEnd);
-                       old.push("?");
-                       old.push(current_expression.expression);
+                       old.push(new ExpressionBuilder("?"));
+                       old.push(current_expression);
                        current_expression = new ExpressionBuilder();
                        ns.elementAt(3).accept(this);
                        current_expression.commit(lin.lineEnd);
-                       old.push(":");
-                       old.push(current_expression.expression);
+                       old.push(new ExpressionBuilder(":"));
+                       old.push(current_expression);
                        old.commit(lin.lineEnd);
                }
                current_expression = old;
@@ -384,12 +392,12 @@
                        NodeSequence ns = (NodeSequence) n.f1.node;
                        ns.nodes.get(0).accept(this);
                        operator = false;
-                       old.push(current_expression.expression);                
        
+                       old.push(current_expression);                   
                        current_expression = new ExpressionBuilder();           
        
                        ns.nodes.get(1).accept(this);
                        current_expression.commit(lin.lineEnd);
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -405,12 +413,12 @@
                        NodeSequence ns = (NodeSequence) n.f1.node;
                        ns.nodes.get(0).accept(this);
                        operator = false;
-                       old.push(current_expression.expression);                
        
+                       old.push(current_expression);                   
                        current_expression = new ExpressionBuilder();           
        
                        ns.nodes.get(1).accept(this);
                        current_expression.commit(lin.lineEnd);
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -431,10 +439,10 @@
                        ns.nodes.get(1).accept(this);
                        lin = LineNumberInfo.get(ns.nodes.get(1));
                        current_expression.commit(lin.lineEnd);
-                       tmp.push (current_expression.expression);
+                       tmp.push (current_expression);
                        current_expression = tmp;
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -455,10 +463,10 @@
                        ns.nodes.get(1).accept(this);
                        lin = LineNumberInfo.get(ns.nodes.get(1));
                        current_expression.commit(lin.lineEnd);
-                       tmp.push (current_expression.expression);
+                       tmp.push (current_expression);
                        current_expression = tmp;
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -479,10 +487,10 @@
                        ns.nodes.get(1).accept(this);
                        lin = LineNumberInfo.get(ns.nodes.get(1));
                        current_expression.commit(lin.lineEnd);
-                       tmp.push (current_expression.expression);
+                       tmp.push (current_expression);
                        current_expression = tmp;
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -500,12 +508,12 @@
                        NodeSequence ns = (NodeSequence) n.f1.node;
                        ns.nodes.get(0).accept(this);
                        operator = false;
-                       old.push(current_expression.expression);
+                       old.push(current_expression);
                        current_expression = new ExpressionBuilder();
                        ns.nodes.get(1).accept(this);
                        current_expression.commit(lin.lineEnd);
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -521,12 +529,12 @@
                        NodeSequence ns = (NodeSequence) n.f1.node;
                        ns.nodes.get(0).accept(this);
                        operator = false;
-                       old.push(current_expression.expression);
+                       old.push(current_expression);
                        current_expression = new ExpressionBuilder();
                        ns.nodes.get(1).accept(this);
                        current_expression.commit(lin.lineEnd);
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -547,10 +555,10 @@
                        ns.nodes.get(1).accept(this);
                        lin = LineNumberInfo.get(ns.nodes.get(1));
                        current_expression.commit(lin.lineEnd);
-                       tmp.push (current_expression.expression);
+                       tmp.push (current_expression);
                        current_expression = tmp;
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -571,10 +579,10 @@
                        ns.nodes.get(1).accept(this);
                        lin = LineNumberInfo.get(ns.nodes.get(1));
                        current_expression.commit(lin.lineEnd);
-                       tmp.push (current_expression.expression);
+                       tmp.push (current_expression);
                        current_expression = tmp;
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -595,10 +603,10 @@
                        ns.nodes.get(1).accept(this);
                        lin = LineNumberInfo.get(ns.nodes.get(1));
                        current_expression.commit(lin.lineEnd);
-                       tmp.push (current_expression.expression);
+                       tmp.push (current_expression);
                        current_expression = tmp;
                }
-               old.push(current_expression.expression);
+               old.push(current_expression);
                current_expression = old;
        }
 
@@ -639,9 +647,9 @@
                                ns.elementAt(1).accept(this);
                                LineNumberInfo lin = LineNumberInfo.get(n);
                                current_expression.commit(lin.lineEnd);
-                               old.push("[");
-                               old.push(current_expression.expression);
-                               old.push("]");
+                               old.push(new ExpressionBuilder("["));
+                               old.push(current_expression);
+                               old.push(new ExpressionBuilder("]"));
                                current_expression = old;
                        }
                        case 1: // ()
@@ -653,9 +661,9 @@
                                LineNumberInfo lin = LineNumberInfo.get 
(ns.elementAt(1));
                                if (! current_expression.expression.isEmpty())
                                        current_expression.commit(lin.lineEnd);
-                               old.push("(");
-                               old.push(current_expression.expression);
-                               old.push(")");
+                               old.push(new ExpressionBuilder("("));
+                               old.push(current_expression);
+                               old.push(new ExpressionBuilder(")"));
                                current_expression = old;
                                current_expression.contains_call = true;
                        }
@@ -670,10 +678,10 @@
                                NodeSequence ns = (NodeSequence) nc.choice;
                                ns.elementAt(1).accept(this);
                                if (nc.which == 2)
-                                       old.push(".");
+                                       old.push(new ExpressionBuilder("."));
                                else
-                                       old.push("->");
-                               old.push(current_expression.expression);
+                                       old.push(new ExpressionBuilder("->"));
+                               old.push(current_expression);
                                current_expression = old;
                        }
                                break;
@@ -695,9 +703,9 @@
                        ns.elementAt(1).accept(this);
                        LineNumberInfo lin1 = LineNumberInfo.get 
(ns.elementAt(1));
                        current_expression.commit(lin1.lineEnd);
-                       old.push("(");
-                       old.push(current_expression.expression);
-                       old.push(")");
+                       old.push(new ExpressionBuilder("("));
+                       old.push(current_expression);
+                       old.push(new ExpressionBuilder(")"));
                        LineNumberInfo lin = LineNumberInfo.get(n);
                        old.commit(lin.lineEnd);
                        current_expression = old;
@@ -709,13 +717,13 @@
                ExpressionBuilder old = current_expression;
                current_expression = new ExpressionBuilder();
                n.f0.accept(this);
-               old.push(current_expression.expression);
+               old.push(current_expression);
                for (int i = 0; i < n.f1.size(); i++) {
                        NodeSequence ns = (NodeSequence) n.f1.elementAt(i);
                        current_expression = new ExpressionBuilder();
                        ns.elementAt(1).accept(this);
-                       old.push(",");
-                       old.push(current_expression.expression);
+                       old.push(new ExpressionBuilder(","));
+                       old.push(current_expression);
                }
                current_expression = old;
        }




reply via email to

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