gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r23142 - in monkey/branches/MonkeyBacktracking/monkey: refs


From: gnunet
Subject: [GNUnet-SVN] r23142 - in monkey/branches/MonkeyBacktracking/monkey: refs/db refs/reports refs/src src/pathologist
Date: Mon, 6 Aug 2012 17:18:50 +0200

Author: safey
Date: 2012-08-06 17:18:50 +0200 (Mon, 06 Aug 2012)
New Revision: 23142

Added:
   monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_bad_food.db
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_food_rpt.xml
   monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_food.c
Modified:
   monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_pathologist.c
Log:
Test bad food. Check for gdb frames

Added: monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_bad_food.db
===================================================================
(Binary files differ)


Property changes on: 
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_bad_food.db
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_food_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_food_rpt.xml 
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_food_rpt.xml 
    2012-08-06 15:18:50 UTC (rev 23142)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<crash category="Bad memory access" function="main" line="8" 
file="bug_bad_food.c" >
+<valgrind>==8211== Memcheck, a memory error detector
+==8211== Copyright (C) 2002-2010, and GNU GPL&apos;d, by Julian Seward et al.
+==8211== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
+==8211== Command: ../../refs/src/bug_bad_food
+==8211== Parent PID: 8210
+==8211== 
+==8211== Invalid read of size 4
+==8211==    at 0x804840D: main (bug_bad_food.c:8)
+==8211==  Address 0xbaadf00d is not stack&apos;d, malloc&apos;d or (recently) 
free&apos;d
+==8211== 
+==8211== 
+==8211== Process terminating with default action of signal 11 (SIGSEGV)
+==8211==  Access not within mapped region at address 0xBAADF00D
+==8211==    at 0x804840D: main (bug_bad_food.c:8)
+==8211==  If you believe this happened as a result of a stack
+==8211==  overflow in your program&apos;s main thread (unlikely but
+==8211==  possible), you can try to increase the size of the
+==8211==  main thread stack using the --main-stacksize= flag.
+==8211==  The main thread stack size used in this run was 16777216.
+==8211== 
+==8211== HEAP SUMMARY:
+==8211==     in use at exit: 0 bytes in 0 blocks
+==8211==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+==8211== 
+==8211== All heap blocks were freed -- no leaks are possible
+==8211== 
+==8211== For counts of detected and suppressed errors, rerun with: -v
+==8211== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 11 from 
6)</valgrind>
+<history><epoch step="0" >
+<trace><function name="main" line="8" file="bug_bad_food.c" depth="0" >
+<expressions><expression name="NULL" >
+0x0</expression>
+<expression name="0xBAADF00D" >
+3131961357</expression>
+<expression name="argv" >
+0xbffff724</expression>
+<expression name="argc" >
+1</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+</history>
+</crash>


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

Modified: monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am      
2012-08-06 13:58:26 UTC (rev 23141)
+++ monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am      
2012-08-06 15:18:50 UTC (rev 23142)
@@ -26,7 +26,10 @@
        gcc -g -O0 -o bug_null_pointer_exception_modified 
bug_null_pointer_exception_modified.c
 
 bug_sigbus:
-       gcc -g -O0 -o bug_sigbus bug_sigbus.c           
+       gcc -g -O0 -o bug_sigbus bug_sigbus.c
+       
+bug_bad_food:
+       gcc -g -O0 -o bug_bad_food bug_bad_food.c               
 
 bin_PROGRAMS = \
         bug_null_pointer_exception \
@@ -35,7 +38,8 @@
         bug_crypto_crc \
         bug_division_by_zero_loop \
         bug_null_pointer_exception_modified \
-        bug_sigbus
+        bug_sigbus \
+        bug_bad_food
  
 #noinst_PROGRAMS = \
         bug_null_pointer_exception \
@@ -44,4 +48,5 @@
         bug_crypto_crc \
         bug_division_by_zero_loop \
         bug_null_pointer_exception_modified \
-        bug_sigbus
\ No newline at end of file
+        bug_sigbus \
+        bug_bad_food
\ No newline at end of file

Added: monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_food.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_food.c           
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_food.c   
2012-08-06 15:18:50 UTC (rev 23142)
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+  void *badfood = (void*) (long) 0xBAADF00D;
+  void *nil = NULL;
+
+  fprintf (stderr, "%d\n",
+          (int) (long) * (int*) ((1 == argc) ? badfood : nil));
+  return 0;
+}


Property changes on: 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_food.c
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c      
2012-08-06 13:58:26 UTC (rev 23141)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c      
2012-08-06 15:18:50 UTC (rev 23142)
@@ -187,15 +187,16 @@
 
                /* Reaching this line means that the program has stopped 
abnormally OR we are in backtracking mode, and it's a step backward */
                cntxt->gdb_frames = gmi_stack_list_frames(cntxt->gdb_handle);
-               while (NULL == cntxt->gdb_frames->file)
+               while ((NULL != cntxt->gdb_frames) && (NULL == 
cntxt->gdb_frames->file)) {
                        cntxt->gdb_frames = cntxt->gdb_frames->next;
+               }
 
-               if (MONKEY_YES != isInCodeBase(cntxt->gdb_frames->file)) {
+               if ((NULL != cntxt->gdb_frames) && (MONKEY_YES != 
isInCodeBase(cntxt->gdb_frames->file))) {
                        do {
                                cntxt->gdb_frames = cntxt->gdb_frames->next;
-                       } while (MONKEY_YES != 
isInCodeBase(cntxt->gdb_frames->file));
+                       } while ((NULL != cntxt->gdb_frames) && (MONKEY_YES != 
isInCodeBase(cntxt->gdb_frames->file)));
 
-                       if (MONKEY_YES == cntxt->run_reverse) {
+                       if ((NULL != cntxt->gdb_frames) && (MONKEY_YES == 
cntxt->run_reverse)) {
                                /* We are in backtracking mode, we need to move 
GDB from the shared library to our source code */
                                stoppedInSharedLib = MONKEY_YES;
                                gmi_break_insert(cntxt->gdb_handle, 
cntxt->gdb_frames->file,
@@ -208,7 +209,7 @@
                }
 
                if (NULL == cntxt->gdb_frames) {
-                       fprintf(stderr, "Cannot get stack frames from gdb.\n"); 
// Something really bad happened. Abort!
+                       fprintf(stderr, "Cannot get stack frames from gdb. You 
might be debugging the wrong program.\n"); // Something really bad happened. 
Abort!
                        return GDB_STATE_ERROR;
                }
 
@@ -629,7 +630,6 @@
                                index++;
                        }
                        endScope = scopeEndPtr->lineNo;
-                       fprintf(stderr, "Pathologist set scope depth to %d\n", 
index);
                }
     }
 

Modified: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_pathologist.c
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_pathologist.c    
    2012-08-06 13:58:26 UTC (rev 23141)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_pathologist.c    
    2012-08-06 15:18:50 UTC (rev 23142)
@@ -397,5 +397,16 @@
                fprintf(stderr, "Test bug division by zero loop with depth 
1000: PASSED\n");
        }
 
+       // Bug Bad Food
+       fprintf(stderr, "Testing bug bad food...\n");
+       if (NO == runTest("ref_bug_bad_food_rpt.xml",
+                       "test_bug_bad_food.xml", "bug_bad_food.db",
+                       "bug_bad_food", commandStr)) {
+               ret = NO;
+               fprintf(stderr, "Test bug bad food: FAILED\n");
+       } else {
+               fprintf(stderr, "Test bug bad food: PASSED\n");
+       }
+
        return ret;
 }




reply via email to

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