gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22908 - in monkey/branches/MonkeyBacktracking/monkey: . re


From: gnunet
Subject: [GNUnet-SVN] r22908 - in monkey/branches/MonkeyBacktracking/monkey: . refs refs/db refs/reports refs/src src src/include src/mi src/pathologist src/util
Date: Wed, 25 Jul 2012 15:05:29 +0200

Author: safey
Date: 2012-07-25 15:05:29 +0200 (Wed, 25 Jul 2012)
New Revision: 22908

Added:
   monkey/branches/MonkeyBacktracking/monkey/refs/
   monkey/branches/MonkeyBacktracking/monkey/refs/db/
   monkey/branches/MonkeyBacktracking/monkey/refs/db/bad_memory_access.db
   monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_assertion_failure.db
   monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_bad_memory_access.db
   
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_bug_assertion_failure.db
   
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_division_by_zero_loop.db
   
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_null_pointer_exception.db
   
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_null_pointer_exception_modified.db
   monkey/branches/MonkeyBacktracking/monkey/refs/reports/
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_assertion_failure_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_bad_memory_access_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_modified_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_assertion_failure_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_memory_access_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_depth_1.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_nodepth_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_modified_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_rpt.xml
   monkey/branches/MonkeyBacktracking/monkey/refs/src/
   monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am
   monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_assertion_failure.c
   monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_memory_access.c
   monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_crypto_crc.c
   
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_division_by_zero_loop.c
   
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception.c
   
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception_modified.c
   monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_sigbus.c
   monkey/branches/MonkeyBacktracking/monkey/seaspider/
   monkey/branches/MonkeyBacktracking/monkey/src/include/gdbmi.h
   monkey/branches/MonkeyBacktracking/monkey/src/mi/
   monkey/branches/MonkeyBacktracking/monkey/src/mi/Makefile.am
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_alloc.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_breakpoint.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_connect.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_data_man.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_error.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_pty.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_vt.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_misc.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_parse.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_prg_control.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_stack_man.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_symbol_query.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_target_man.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_thread.c
   monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_var_obj.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
   monkey/branches/MonkeyBacktracking/monkey/src/util/Makefile.in
Removed:
   
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_assertion_failure_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_bad_memory_access_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_modified_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_rpt.xml
   monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml
   monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_depth_1.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_nodepth_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_modified_rpt.xml
   
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
   monkey/branches/MonkeyBacktracking/monkey/src/monkey/
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bad_memory_access.db
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_assertion_failure.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_assertion_failure.db
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bad_memory_access.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bad_memory_access.db
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bad_memory_access_rpt.ref
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bug_assertion_failure.db
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_crypto_crc.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_division_by_zero_loop.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_division_by_zero_loop.db
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception.db
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception_modified.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception_modified.db
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_sigbus.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi.h
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_alloc.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_breakpoint.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_connect.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_data_man.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_error.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_get_free_pty.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_get_free_vt.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_misc.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_parse.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_prg_control.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_stack_man.c
   
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_symbol_query.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_target_man.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_thread.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_var_obj.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/monkey.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/seaspider/
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test.db
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey.sh
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey_edb.c
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/tmp
Modified:
   monkey/branches/MonkeyBacktracking/monkey/Makefile.am
   monkey/branches/MonkeyBacktracking/monkey/configure.ac
   monkey/branches/MonkeyBacktracking/monkey/src/Makefile.am
   monkey/branches/MonkeyBacktracking/monkey/src/pathologist/Makefile.am
Log:
Refactoring source tree

Modified: monkey/branches/MonkeyBacktracking/monkey/Makefile.am
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/Makefile.am       2012-07-25 
12:27:11 UTC (rev 22907)
+++ monkey/branches/MonkeyBacktracking/monkey/Makefile.am       2012-07-25 
13:05:29 UTC (rev 22908)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = src
+SUBDIRS = src refs/src
 
 EXTRA_DIST = config.rpath  \
   install-sh

Modified: monkey/branches/MonkeyBacktracking/monkey/configure.ac
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/configure.ac      2012-07-25 
12:27:11 UTC (rev 22907)
+++ monkey/branches/MonkeyBacktracking/monkey/configure.ac      2012-07-25 
13:05:29 UTC (rev 22908)
@@ -215,6 +215,8 @@
 Makefile
 src/Makefile
 src/include/Makefile
+src/mi/Makefile
 src/util/Makefile
-src/monkey/Makefile
+src/pathologist/Makefile
+refs/src/Makefile
 ])

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_assertion_failure_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_assertion_failure_rpt.xml  
    2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_assertion_failure_rpt.xml  
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,75 +0,0 @@
-<?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>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_bad_memory_access_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_bad_memory_access_rpt.xml  
    2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_bad_memory_access_rpt.xml  
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,105 +0,0 @@
-<?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>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
  2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
  2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,214 +0,0 @@
-<?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>
-<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" >
-0</expression>
-<expression name="argv" >
-0x7fffffffe688</expression>
-<expression name="argc" >
-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>
-<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="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>
-<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="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>
-<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="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>
-<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="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>
-<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="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>
-<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="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>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
  2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
  2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,130 +0,0 @@
-<?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>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_modified_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_modified_rpt.xml
        2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_modified_rpt.xml
        2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,207 +0,0 @@
-<?xml version="1.0"?>
-<crash category="npe" function="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.c" >
-<history><epoch step="0" >
-<trace><function name="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.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>
-<expression name="a+b" >
-8</expression>
-<expression name="c" >
-8</expression>
-<expression name="b" >
-5</expression>
-<expression name="a" >
-3</expression>
-</expressions>
-</function>
-<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
-<expressions><expression name="intermediateFunction()" >
-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="19" 
file="bug_null_pointer_exception_modified.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>
-<expression name="a+b" >
-8</expression>
-<expression name="c" >
-8</expression>
-<expression name="b" >
-5</expression>
-<expression name="a" >
-3</expression>
-</expressions>
-</function>
-<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
-<expressions><expression name="intermediateFunction()" >
-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="18" 
file="bug_null_pointer_exception_modified.c" depth="0" >
-<expressions><expression name="crashStruct=NULL" >
-Not Evaluated</expression>
-<expression name="NULL" >
-Not Evaluated</expression>
-<expression name="crashStruct" >
-0x4003db</expression>
-<expression name="a+b" >
-8</expression>
-<expression name="c" >
-8</expression>
-<expression name="b" >
-5</expression>
-<expression name="a" >
-3</expression>
-</expressions>
-</function>
-<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
-<expressions><expression name="intermediateFunction()" >
-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="crashFunction" line="17" 
file="bug_null_pointer_exception_modified.c" depth="0" >
-<expressions><expression name="c=a+b" >
-Not Evaluated</expression>
-<expression name="a+b" >
-8</expression>
-<expression name="c" >
-32767</expression>
-<expression name="b" >
-5</expression>
-<expression name="a" >
-3</expression>
-</expressions>
-</function>
-<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
-<expressions><expression name="intermediateFunction()" >
-Not Evaluated</expression>
-<expression name="argv" >
-Not Evaluated</expression>
-<expression name="argc" >
-Not Evaluated</expression>
-</expressions>
-</function>
-</trace>
-</epoch>
-<epoch step="4" >
-<trace><function name="crashFunction" line="16" 
file="bug_null_pointer_exception_modified.c" depth="0" >
-<expressions><expression name="b=5" >
-Not Evaluated</expression>
-<expression name="b" >
-4195765</expression>
-<expression name="a" >
-3</expression>
-</expressions>
-</function>
-<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
-<expressions><expression name="intermediateFunction()" >
-Not Evaluated</expression>
-<expression name="argv" >
-Not Evaluated</expression>
-<expression name="argc" >
-Not Evaluated</expression>
-</expressions>
-</function>
-</trace>
-</epoch>
-<epoch step="5" >
-<trace><function name="crashFunction" line="15" 
file="bug_null_pointer_exception_modified.c" depth="0" >
-<expressions><expression name="a=3" >
-Not Evaluated</expression>
-<expression name="a" >
-0</expression>
-</expressions>
-</function>
-<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
-<expressions><expression name="intermediateFunction()" >
-Not Evaluated</expression>
-<expression name="argv" >
-Not Evaluated</expression>
-<expression name="argc" >
-Not Evaluated</expression>
-</expressions>
-</function>
-</trace>
-</epoch>
-<epoch step="6" >
-<trace><function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="0" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="1" >
-<expressions><expression name="intermediateFunction()" >
-Not Evaluated</expression>
-<expression name="argv" >
-Not Evaluated</expression>
-<expression name="argc" >
-Not Evaluated</expression>
-</expressions>
-</function>
-</trace>
-</epoch>
-</history>
-</crash>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_rpt.xml
 2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_rpt.xml
 2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,83 +0,0 @@
-<?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>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml 
2012-07-25 12:27:11 UTC (rev 22907)
+++ monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml 
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,27 +0,0 @@
-<?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>
-</history>
-</crash>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access_rpt.xml
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access_rpt.xml 
2012-07-25 12:27:11 UTC (rev 22907)
+++ monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access_rpt.xml 
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,57 +0,0 @@
-<?xml version="1.0"?>
-<crash category="Bad memory access" function="badMemoryAccess" line="9" 
file="bug_bad_memory_access.c" >
-<valgrind>==8476== Memcheck, a memory error detector
-==8476== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
-==8476== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
-==8476== Command: src/monkey/bug_bad_memory_access
-==8476== Parent PID: 8475
-==8476== 
-==8476== Invalid write of size 4
-==8476==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
-==8476==    by 0x400532: main (bug_bad_memory_access.c:14)
-==8476==  Address 0x4252352 is not stack'd, malloc'd or (recently) free'd
-==8476== 
-==8476== 
-==8476== Process terminating with default action of signal 11 (SIGSEGV)
-==8476==  Access not within mapped region at address 0x4252352
-==8476==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
-==8476==    by 0x400532: main (bug_bad_memory_access.c:14)
-==8476==  If you believe this happened as a result of a stack
-==8476==  overflow in your program's main thread (unlikely but
-==8476==  possible), you can try to increase the size of the
-==8476==  main thread stack using the --main-stacksize= flag.
-==8476==  The main thread stack size used in this run was 8388608.
-==8476== 
-==8476== HEAP SUMMARY:
-==8476==     in use at exit: 0 bytes in 0 blocks
-==8476==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
-==8476== 
-==8476== All heap blocks were freed -- no leaks are possible
-==8476== 
-==8476== For counts of detected and suppressed errors, rerun with: -v
-==8476== 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>
-</history>
-</crash>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_depth_1.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_depth_1.xml
 2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_depth_1.xml
 2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,28 +0,0 @@
-<?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>
-<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" >
-0</expression>
-<expression name="argv" >
-0x7fffffffe688</expression>
-<expression name="argc" >
-1</expression>
-</expressions>
-</function>
-</trace>
-</epoch>
-</history>
-</crash>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_nodepth_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_nodepth_rpt.xml
     2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_nodepth_rpt.xml
     2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,16 +0,0 @@
-<?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>
-</history>
-</crash>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_modified_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_modified_rpt.xml
   2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_modified_rpt.xml
   2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<crash category="npe" function="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.c" >
-<history><epoch step="0" >
-<trace><function name="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.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>
-<expression name="a+b" >
-8</expression>
-<expression name="c" >
-8</expression>
-<expression name="b" >
-5</expression>
-<expression name="a" >
-3</expression>
-</expressions>
-</function>
-<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
-<expressions><expression name="crashFunction()" >
-Not Evaluated</expression>
-</expressions>
-</function>
-<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
-<expressions><expression name="intermediateFunction()" >
-Not Evaluated</expression>
-<expression name="argv" >
-Not Evaluated</expression>
-<expression name="argc" >
-Not Evaluated</expression>
-</expressions>
-</function>
-</trace>
-</epoch>
-</history>
-</crash>

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
    2012-07-25 12:27:11 UTC (rev 22907)
+++ 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,29 +0,0 @@
-<?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>
-</history>
-</crash>

Copied: monkey/branches/MonkeyBacktracking/monkey/refs/db/bad_memory_access.db 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bad_memory_access.db)
===================================================================
(Binary files differ)


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_assertion_failure.db 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_assertion_failure.db)
===================================================================
(Binary files differ)


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_bad_memory_access.db 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_bad_memory_access.db)
===================================================================
(Binary files differ)


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_bug_assertion_failure.db 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_bug_assertion_failure.db)
===================================================================
Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_division_by_zero_loop.db 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_division_by_zero_loop.db)
===================================================================
(Binary files differ)


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_null_pointer_exception.db 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception.db)
===================================================================
(Binary files differ)


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/db/bug_null_pointer_exception_modified.db
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception_modified.db)
===================================================================
(Binary files differ)


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_assertion_failure_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_assertion_failure_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_assertion_failure_rpt.xml
                         (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_assertion_failure_rpt.xml
 2012-07-25 13:05:29 UTC (rev 22908)
@@ -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/refs/reports/ref_bt_bug_assertion_failure_rpt.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_bad_memory_access_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_bad_memory_access_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_bad_memory_access_rpt.xml
                         (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_bad_memory_access_rpt.xml
 2012-07-25 13:05:29 UTC (rev 22908)
@@ -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/refs/reports/ref_bt_bug_bad_memory_access_rpt.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
                             (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
     2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,214 @@
+<?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>
+<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" >
+0</expression>
+<expression name="argv" >
+0x7fffffffe688</expression>
+<expression name="argc" >
+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>
+<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="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>
+<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="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>
+<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="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>
+<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="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>
+<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="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>
+<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="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/refs/reports/ref_bt_bug_division_by_zero_loop_depth_1_rpt.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
                             (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
     2012-07-25 13:05:29 UTC (rev 22908)
@@ -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/refs/reports/ref_bt_bug_division_by_zero_loop_nodepth_rpt.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_modified_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_modified_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_modified_rpt.xml
                           (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_modified_rpt.xml
   2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,207 @@
+<?xml version="1.0"?>
+<crash category="npe" function="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.c" >
+<history><epoch step="0" >
+<trace><function name="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.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>
+<expression name="a+b" >
+8</expression>
+<expression name="c" >
+8</expression>
+<expression name="b" >
+5</expression>
+<expression name="a" >
+3</expression>
+</expressions>
+</function>
+<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
+<expressions><expression name="intermediateFunction()" >
+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="19" 
file="bug_null_pointer_exception_modified.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>
+<expression name="a+b" >
+8</expression>
+<expression name="c" >
+8</expression>
+<expression name="b" >
+5</expression>
+<expression name="a" >
+3</expression>
+</expressions>
+</function>
+<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
+<expressions><expression name="intermediateFunction()" >
+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="18" 
file="bug_null_pointer_exception_modified.c" depth="0" >
+<expressions><expression name="crashStruct=NULL" >
+Not Evaluated</expression>
+<expression name="NULL" >
+Not Evaluated</expression>
+<expression name="crashStruct" >
+0x4003db</expression>
+<expression name="a+b" >
+8</expression>
+<expression name="c" >
+8</expression>
+<expression name="b" >
+5</expression>
+<expression name="a" >
+3</expression>
+</expressions>
+</function>
+<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
+<expressions><expression name="intermediateFunction()" >
+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="crashFunction" line="17" 
file="bug_null_pointer_exception_modified.c" depth="0" >
+<expressions><expression name="c=a+b" >
+Not Evaluated</expression>
+<expression name="a+b" >
+8</expression>
+<expression name="c" >
+32767</expression>
+<expression name="b" >
+5</expression>
+<expression name="a" >
+3</expression>
+</expressions>
+</function>
+<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
+<expressions><expression name="intermediateFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="4" >
+<trace><function name="crashFunction" line="16" 
file="bug_null_pointer_exception_modified.c" depth="0" >
+<expressions><expression name="b=5" >
+Not Evaluated</expression>
+<expression name="b" >
+4195765</expression>
+<expression name="a" >
+3</expression>
+</expressions>
+</function>
+<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
+<expressions><expression name="intermediateFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="5" >
+<trace><function name="crashFunction" line="15" 
file="bug_null_pointer_exception_modified.c" depth="0" >
+<expressions><expression name="a=3" >
+Not Evaluated</expression>
+<expression name="a" >
+0</expression>
+</expressions>
+</function>
+<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
+<expressions><expression name="intermediateFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+<epoch step="6" >
+<trace><function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="0" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="1" >
+<expressions><expression name="intermediateFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+</history>
+</crash>


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bt_bug_null_pointer_exception_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_rpt.xml
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bt_bug_null_pointer_exception_rpt.xml
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -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/refs/reports/ref_bt_bug_null_pointer_exception_rpt.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_assertion_failure_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_assertion_failure_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_assertion_failure_rpt.xml
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_assertion_failure_rpt.xml
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,27 @@
+<?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>
+</history>
+</crash>


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_memory_access_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_bad_memory_access_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_memory_access_rpt.xml
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_bad_memory_access_rpt.xml
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<crash category="Bad memory access" function="badMemoryAccess" line="9" 
file="bug_bad_memory_access.c" >
+<valgrind>==8476== Memcheck, a memory error detector
+==8476== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
+==8476== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
+==8476== Command: src/monkey/bug_bad_memory_access
+==8476== Parent PID: 8475
+==8476== 
+==8476== Invalid write of size 4
+==8476==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
+==8476==    by 0x400532: main (bug_bad_memory_access.c:14)
+==8476==  Address 0x4252352 is not stack'd, malloc'd or (recently) free'd
+==8476== 
+==8476== 
+==8476== Process terminating with default action of signal 11 (SIGSEGV)
+==8476==  Access not within mapped region at address 0x4252352
+==8476==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
+==8476==    by 0x400532: main (bug_bad_memory_access.c:14)
+==8476==  If you believe this happened as a result of a stack
+==8476==  overflow in your program's main thread (unlikely but
+==8476==  possible), you can try to increase the size of the
+==8476==  main thread stack using the --main-stacksize= flag.
+==8476==  The main thread stack size used in this run was 8388608.
+==8476== 
+==8476== HEAP SUMMARY:
+==8476==     in use at exit: 0 bytes in 0 blocks
+==8476==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+==8476== 
+==8476== All heap blocks were freed -- no leaks are possible
+==8476== 
+==8476== For counts of detected and suppressed errors, rerun with: -v
+==8476== 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>
+</history>
+</crash>


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_depth_1.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_depth_1.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_depth_1.xml
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_depth_1.xml
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,28 @@
+<?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>
+<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" >
+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/refs/reports/ref_bug_division_by_zero_loop_depth_1.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_nodepth_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_division_by_zero_loop_nodepth_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_nodepth_rpt.xml
                                (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_division_by_zero_loop_nodepth_rpt.xml
        2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,16 @@
+<?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>
+</history>
+</crash>


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_modified_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_modified_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_modified_rpt.xml
                              (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_modified_rpt.xml
      2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<crash category="npe" function="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.c" >
+<history><epoch step="0" >
+<trace><function name="crashFunction" line="20" 
file="bug_null_pointer_exception_modified.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>
+<expression name="a+b" >
+8</expression>
+<expression name="c" >
+8</expression>
+<expression name="b" >
+5</expression>
+<expression name="a" >
+3</expression>
+</expressions>
+</function>
+<function name="intermediateFunction" line="25" 
file="bug_null_pointer_exception_modified.c" depth="1" >
+<expressions><expression name="crashFunction()" >
+Not Evaluated</expression>
+</expressions>
+</function>
+<function name="main" line="30" file="bug_null_pointer_exception_modified.c" 
depth="2" >
+<expressions><expression name="intermediateFunction()" >
+Not Evaluated</expression>
+<expression name="argv" >
+Not Evaluated</expression>
+<expression name="argc" >
+Not Evaluated</expression>
+</expressions>
+</function>
+</trace>
+</epoch>
+</history>
+</crash>


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_rpt.xml
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/ref_bug_null_pointer_exception_rpt.xml)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_rpt.xml
                               (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/reports/ref_bug_null_pointer_exception_rpt.xml
       2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,29 @@
+<?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>
+</history>
+</crash>


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

Added: monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am              
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/refs/src/Makefile.am      
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,47 @@
+if MINGW
+ WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols 
+endif
+
+if USE_COVERAGE
+  AM_CFLAGS = --coverage -O0
+  XLIB = -lgcov
+endif
+
+bug_null_pointer_exception:
+       gcc -g -O0 -o bug_null_pointer_exception bug_null_pointer_exception.c
+
+bug_bad_memory_access:
+       gcc -g -O0 -o bug_bad_memory_access bug_bad_memory_access.c     
+
+bug_assertion_failure:
+       gcc -g -O0 -o bug_assertion_failure bug_assertion_failure.c     
+
+bug_crypto_crc:
+       gcc -g -O0 -o bug_crypto_crc bug_crypto_crc.c
+       
+bug_division_by_zero_loop:
+       gcc -g -O0 -o bug_division_by_zero_loop bug_division_by_zero_loop.c     
+       
+bug_null_pointer_exception_modified:
+       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           
+
+bin_PROGRAMS = \
+        bug_null_pointer_exception \
+        bug_bad_memory_access \
+        bug_assertion_failure \
+        bug_crypto_crc \
+        bug_division_by_zero_loop \
+        bug_null_pointer_exception_modified \
+        bug_sigbus
+ 
+#noinst_PROGRAMS = \
+        bug_null_pointer_exception \
+        bug_bad_memory_access \
+        bug_assertion_failure \
+        bug_crypto_crc \
+        bug_division_by_zero_loop \
+        bug_null_pointer_exception_modified \
+        bug_sigbus
\ No newline at end of file

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_assertion_failure.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_assertion_failure.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_assertion_failure.c  
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_assertion_failure.c  
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <assert.h>
+
+void assertionFailure()
+{
+       int x;
+       x = 5;
+       printf("Assertion Failure Now!\n");
+       assert(x < 4);
+}
+
+int main(int argc, char *argv[])
+{
+       assertionFailure();
+       return 0;
+}

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_memory_access.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_bad_memory_access.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_memory_access.c  
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_bad_memory_access.c  
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <string.h>
+
+
+void badMemoryAccess()
+{
+       int *p = (int*) 0x4252352;
+       printf("Bad memory access now!\n");
+       *p = 5;
+}
+
+int main(int argc, char *argv[])
+{
+       badMemoryAccess();
+       return 0;
+}

Copied: monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_crypto_crc.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_crypto_crc.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_crypto_crc.c         
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_crypto_crc.c 
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,121 @@
+/*
+     This file is part of GNUnet.
+     (C) 2001, 2002, 2003, 2004, 2006 Christian Grothoff (and other 
contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+
+     For the actual CRC code:
+     Copyright abandoned; this code is in the public domain.
+     Provided to GNUnet by address@hidden
+*/
+
+/**
+ * @file monkey/bug_crypto_crc.c
+ * @brief implementation of CRC32 (this code has been copied from GNUnet util 
source directory, and modified to be Seaspider friendly)
+ * @author Christian Grothoff, Safey A.Halim
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#define Z_NULL  0
+
+
+#define POLYNOMIAL (unsigned long)0xedb88320
+static unsigned long crc_table[256];
+
+/*
+ * This routine writes each crc_table entry exactly once,
+ * with the ccorrect final value.  Thus, it is safe to call
+ * even on a table that someone else is using concurrently.
+ */
+static void 
+crc_init ()
+{
+  static int once;
+  unsigned int i, j;
+  unsigned long h = 1;
+
+  if (once)
+    return;
+  once = 1;
+  crc_table[0] = 0;
+  for (i = 128; i; i >>= 1)
+    {
+      h = (h >> 1) ^ ((h & 1) ? POLYNOMIAL : 0);
+      /* h is now crc_table[i] */
+      for (j = 0; j < 256; j += 2 * i)
+        crc_table[i + j] = crc_table[j] ^ h;
+    }
+}
+
+/*
+ * This computes the standard preset and inverted CRC, as used
+ * by most networking standards.  Start by passing in an initial
+ * chaining value of 0, and then pass in the return value from the
+ * previous crc32() call.  The final return value is the CRC.
+ * Note that this is a little-endian CRC, which is best used with
+ * data transmitted lsbit-first, and it should, itself, be appended
+ * to data in little-endian byte and bit order to preserve the
+ * property of detecting all burst errors of length 32 bits or less.
+ */
+static unsigned long
+crc_go (unsigned long crc, const char *buf, size_t len)
+{
+  crc_init ();
+  assert (crc_table[255] != 0);
+  crc ^= 0xffffffff;
+  while (len--)
+    crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
+  return crc ^ 0xffffffff;
+}
+
+
+/**
+ * Compute the CRC32 checksum for the first len bytes of the buffer.
+ *
+ * @param buf the data over which we're taking the CRC
+ * @param len the length of the buffer
+ * @return the resulting CRC32 checksum
+ */
+int32_t
+crc32_n (const void *buf, size_t len)
+{
+  unsigned long crc;
+  crc = crc_go (0L, Z_NULL, 0);
+  crc = crc_go (crc, (char *) buf, len);
+  return crc;
+}
+
+
+int main ()
+{
+  char buf[1024];
+  int i;
+  for (i = 0; i < 1024; i++)
+  {
+     buf[i] = (char) i;
+  }
+  for (i = 0; i < 1024; i++)
+  {
+    printf("%d\n", crc32_n (&buf[i], 1024 - i));
+  }
+  return 0;
+}
+
+/* end of bug_crypto_crc.c */


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_division_by_zero_loop.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_division_by_zero_loop.c)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_division_by_zero_loop.c  
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_division_by_zero_loop.c  
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+  int i, k, result, tmp;
+  k = -1;
+  result = 10;
+
+  printf("I am alive!\n");
+  for (i = 0; i < 5; i++)
+    {
+      k += i;
+      result = result / k;     /* Division by zero in second iteration */
+      printf("result = %d\n", result);
+    }
+  return 0;
+}


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

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception.c)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception.c 
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception.c 
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <string.h>
+
+
+struct CrashStruct {
+       const char *crashValue;
+};
+
+void crashFunction() 
+{
+       struct CrashStruct *crashStruct;
+       crashStruct = NULL;
+       printf("Now the program will crash!\n");
+       crashStruct->crashValue = "hello!";
+}
+
+int main(int argc, char *argv[]) 
+{
+       crashFunction();
+       return 0;
+}

Copied: 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception_modified.c
 (from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception_modified.c)
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception_modified.c
                            (rev 0)
+++ 
monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_null_pointer_exception_modified.c
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <string.h>
+
+
+struct CrashStruct {
+       const char *crashValue;
+};
+
+void crashFunction()
+{
+       struct CrashStruct *crashStruct;
+       int a;
+       int b;
+       int c;
+       a = 3;
+       b = 5;
+       c = a + b;
+       crashStruct = NULL;
+       printf("Now the program will crash!\n");
+       crashStruct->crashValue = "hello!";
+}
+
+void intermediateFunction()
+{
+       crashFunction();
+}
+
+int main(int argc, char *argv[])
+{
+       intermediateFunction();
+       return 0;
+}


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

Copied: monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_sigbus.c (from 
rev 22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_sigbus.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_sigbus.c             
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/refs/src/bug_sigbus.c     
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,50 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+//
+//     __asm__("pushf\n"
+//            "orl $0x40000, (%esp)\n"
+//            "popf");
+
+    int testvar = 0x12345678;
+    int *testvarp;
+
+    testvarp = &testvar;
+    printf("testvarp was %lx\n", testvarp);
+    printf("testvar was %lx\n", *testvarp);
+
+    testvarp = (int *)(((char *)testvarp) + 1);
+    printf("testvarp is %lx\n", testvarp);
+    printf("testvar is %lx\n", *testvarp);
+
+
+//     char* str;
+//     str = realloc(str,10);
+//     */
+//
+//     /*
+//    char *p;
+//
+//    __asm__("pushf\n"
+//            "orl $0x40000, (%esp)\n"
+//            "popf");
+//
+//    /*
+//     * malloc() always provides aligned memory.
+//     * Do not use stack variable like a[9], depending on the compiler you 
use,
+//     * a may not be aligned properly.
+//     */
+//    p = malloc(sizeof(int) + 1);
+//    memset(p, 0, sizeof(int) + 1);
+//
+//    /* making p unaligned */
+//    p++;
+//
+//    printf("%d\n", *(int *)p);
+//
+//    return 0;
+
+}


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

Modified: monkey/branches/MonkeyBacktracking/monkey/src/Makefile.am
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/Makefile.am   2012-07-25 
12:27:11 UTC (rev 22907)
+++ monkey/branches/MonkeyBacktracking/monkey/src/Makefile.am   2012-07-25 
13:05:29 UTC (rev 22908)
@@ -1,2 +1,2 @@
-SUBDIRS = include util monkey .
+SUBDIRS = include mi util pathologist .
 

Copied: monkey/branches/MonkeyBacktracking/monkey/src/include/gdbmi.h (from rev 
22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi.h)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/include/gdbmi.h               
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/include/gdbmi.h       
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,728 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004-2009 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Comments:
+  Main header for libmigdb.
+  
+***************************************************************************/
+
+#ifndef GDBMI_H
+#define GDBMI_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0                           /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h> /* pid_t */
+
+#define MI_OK                      0
+#define MI_OUT_OF_MEMORY           1
+#define MI_PIPE_CREATE             2
+#define MI_FORK                    3
+#define MI_DEBUGGER_RUN            4
+#define MI_PARSER                  5
+#define MI_UNKNOWN_ASYNC           6
+#define MI_UNKNOWN_RESULT          7
+#define MI_FROM_GDB                8
+#define MI_GDB_TIME_OUT            9
+#define MI_GDB_DIED               10
+#define MI_MISSING_XTERM          11
+#define MI_CREATE_TEMPORAL        12
+#define MI_MISSING_GDB            13
+#define MI_LAST_ERROR             13
+
+#define MI_R_NONE                  0 /* We are no waiting any response. */
+#define MI_R_SKIP                  1 /* We want to discard it. */
+#define MI_R_FE_AND_S              2 /* Wait for done. */
+#define MI_R_E_ARGS                3
+
+enum mi_val_type { t_const, t_tuple, t_list };
+
+/* Types and subtypes. */
+/* Type. */
+#define MI_T_OUT_OF_BAND   0
+#define MI_T_RESULT_RECORD 1
+/* Out of band subtypes. */
+#define MI_ST_ASYNC        0
+#define MI_ST_STREAM       1
+/* Async sub-subtypes. */
+#define MI_SST_EXEC        0
+#define MI_SST_STATUS      1
+#define MI_SST_NOTIFY      2
+/* Stream sub-subtypes. */
+#define MI_SST_CONSOLE     3
+#define MI_SST_TARGET      4
+#define MI_SST_LOG         5
+/* Classes. */
+/* Async classes. */
+#define MI_CL_UNKNOWN      0
+#define MI_CL_STOPPED      1
+#define MI_CL_DOWNLOAD     2
+/* Result classes. */
+#define MI_CL_DONE         2
+#define MI_CL_RUNNING      3
+#define MI_CL_CONNECTED    4
+#define MI_CL_ERROR        5
+#define MI_CL_EXIT         6
+
+#define MI_DEFAULT_TIME_OUT 10
+
+#define MI_DIS_ASM        0
+#define MI_DIS_SRC_ASM    1
+
+/* Implemented workaround for gdb bugs that we can dis/enable. */
+/* At least gdb<=6.1.1 fails to find a source file with absolute path if the
+   name is for a psym instead of a sym. psym==partially loaded symbol table. */
+#define MI_PSYM_SEARCH    0
+
+#define MI_VERSION_STR "0.8.12"
+#define MI_VERSION_MAJOR  0
+#define MI_VERSION_MIDDLE 8
+#define MI_VERSION_MINOR  12
+
+struct mi_results_struct
+{
+ char *var; /* Result name or NULL if just a value. */
+ enum mi_val_type type;
+ union
+ {
+  char *cstr;
+  struct mi_results_struct *rs;
+ } v;
+ struct mi_results_struct *next;
+};
+typedef struct mi_results_struct mi_results;
+
+struct mi_output_struct
+{
+ /* Type of output. */
+ char type;
+ char stype;
+ char sstype;
+ char tclass;
+ /* Content. */
+ mi_results *c;
+ /* Always modeled as a list. */
+ struct mi_output_struct *next;
+};
+typedef struct mi_output_struct mi_output;
+
+typedef void (*stream_cb)(const char *, void *);
+typedef void (*async_cb)(mi_output *o, void *);
+typedef int  (*tm_cb)(void *);
+
+/* Values of this structure shouldn't be manipulated by the user. */
+struct mi_h_struct
+{
+ /* Pipes connected to gdb. */
+ int to_gdb[2];
+ int from_gdb[2];
+ /* Streams for the pipes. */
+ FILE *to, *from;
+ /* PID of child gdb. */
+ pid_t pid;
+ char died;
+ /* Which rensponse we are waiting for. */
+ /*int response;*/
+ /* The line we are reading. */
+ char *line;
+ int   llen, lread;
+ /* Parsed output. */
+ mi_output *po, *last;
+ /* Tunneled streams callbacks. */
+ stream_cb console;
+ void *console_data;
+ stream_cb target;
+ void *target_data;
+ stream_cb log;
+ void *log_data;
+ /* Async responses callback. */
+ async_cb async;
+ void *async_data;
+ /* Callbacks to get echo of gdb dialog. */
+ stream_cb to_gdb_echo;
+ void *to_gdb_echo_data;
+ stream_cb from_gdb_echo;
+ void *from_gdb_echo_data;
+ /* Time out */
+ tm_cb time_out_cb;
+ void *time_out_cb_data;
+ int time_out;
+ /* Ugly workaround for some of the show responses :-( */
+ int catch_console;
+ char *catched_console;
+ /* MI version, currently unknown but the user can force v2 */
+ unsigned version;
+};
+typedef struct mi_h_struct mi_h;
+
+#define MI_TO(a) ((a)->to_gdb[1])
+
+enum mi_bkp_type { t_unknown=0, t_breakpoint=1, t_hw=2 };
+enum mi_bkp_disp { d_unknown=0, d_keep=1, d_del=2 };
+enum mi_bkp_mode { m_file_line=0, m_function=1, m_file_function=2, m_address=3 
};
+
+struct mi_bkpt_struct
+{
+ int number;
+ enum mi_bkp_type type;
+ enum mi_bkp_disp disp; /* keep or del if temporal */
+ char enabled;
+ void *addr;
+ char *func;
+ char *file;
+ int line;
+ int ignore;
+ int times;
+
+ /* For the user: */
+ char *cond;
+ char *file_abs;
+ int thread;
+ enum mi_bkp_mode mode;
+ struct mi_bkpt_struct *next;
+};
+typedef struct mi_bkpt_struct mi_bkpt;
+
+enum mi_wp_mode { wm_unknown=0, wm_write=1, wm_read=2, wm_rw=3 };
+
+struct mi_wp_struct
+{
+ int number;
+ char *exp;
+ enum mi_wp_mode mode;
+
+ /* For the user: */
+ struct mi_wp_struct *next;
+ char enabled;
+};
+typedef struct mi_wp_struct mi_wp;
+
+struct mi_frames_struct
+{
+ int level;  /* The frame number, 0 being the topmost frame, i.e. the innermost
+                function. */
+ void *addr; /* The `$pc' value for that frame. */
+ char *func; /* Function name. */
+ char *file; /* File name of the source file where the function lives. */
+ char *from;
+ int line;   /* Line number corresponding to the `$pc'. */
+ /* When arguments are available: */
+ mi_results *args;
+ int thread_id;
+ /* When more than one is provided: */
+ struct mi_frames_struct *next;
+};
+typedef struct mi_frames_struct mi_frames;
+
+struct mi_aux_term_struct
+{
+ pid_t pid;
+ char *tty;
+};
+typedef struct mi_aux_term_struct mi_aux_term;
+
+struct mi_pty_struct
+{
+ char *slave;
+ int master;
+};
+typedef struct mi_pty_struct mi_pty;
+
+enum mi_gvar_fmt { fm_natural=0, fm_binary=1, fm_decimal=2, fm_hexadecimal=3,
+                   fm_octal=4,
+                   /* Only for registers format: */
+                   fm_raw=5 };
+enum mi_gvar_lang { lg_unknown=0, lg_c, lg_cpp, lg_java };
+
+#define MI_ATTR_DONT_KNOW   0
+#define MI_ATTR_NONEDITABLE 1
+#define MI_ATTR_EDITABLE    2
+
+struct mi_gvar_struct
+{
+ char *name;
+ int   numchild;
+ char *type;
+ enum mi_gvar_fmt format;
+ enum mi_gvar_lang lang;
+ char *exp;
+ int   attr;
+
+ /* MI v2 fills it, not yet implemented here. */
+ /* Use gmi_var_evaluate_expression. */
+ char *value;
+
+ /* Pointer to the parent. NULL if none. */
+ struct mi_gvar_struct *parent;
+ /* List containing the children.
+    Filled by gmi_var_list_children.
+    NULL if numchild==0 or not yet filled. */
+ struct mi_gvar_struct *child;
+ /* Next var in the list. */
+ struct mi_gvar_struct *next;
+
+ /* For the user: */
+ char opened;  /* We will show its children. 1 when we fill "child" */
+ char changed; /* Needs to be updated. 0 when created. */
+ int vischild; /* How many items visible. numchild when we fill "child" */
+ int depth;    /* How deep is this var. */
+ char ispointer;
+};
+typedef struct mi_gvar_struct mi_gvar;
+
+struct mi_gvar_chg_struct
+{
+ char *name;
+ int   in_scope;  /* if true the other fields apply. */
+ char *new_type;  /* NULL if type_changed==false */
+ int   new_num_children; /* only when new_type!=NULL */
+
+ struct mi_gvar_chg_struct *next;
+};
+typedef struct mi_gvar_chg_struct mi_gvar_chg;
+
+
+/* A list of assembler instructions. */
+struct mi_asm_insn_struct
+{
+ void *addr;
+ char *func;
+ unsigned offset;
+ char *inst;
+
+ struct mi_asm_insn_struct *next;
+};
+typedef struct mi_asm_insn_struct mi_asm_insn;
+
+/* A list of source lines containing assembler instructions. */
+struct mi_asm_insns_struct
+{
+ char *file;
+ int line;
+ mi_asm_insn *ins;
+
+ struct mi_asm_insns_struct *next;
+};
+typedef struct mi_asm_insns_struct mi_asm_insns;
+
+/* Changed register. */
+struct mi_chg_reg_struct
+{
+ int reg;
+ char *val;
+ char *name;
+ char updated;
+
+ struct mi_chg_reg_struct *next;
+};
+typedef struct mi_chg_reg_struct mi_chg_reg;
+
+/*
+ Examining gdb sources and looking at docs I can see the following "stop"
+reasons:
+
+Breakpoints:
+a) breakpoint-hit (bkptno) + frame
+Also: without reason for temporal breakpoints.
+
+Watchpoints:
+b) watchpoint-trigger (wpt={number,exp};value={old,new}) + frame
+c) read-watchpoint-trigger (hw-rwpt{number,exp};value={value}) + frame
+d) access-watchpoint-trigger (hw-awpt{number,exp};value={[old,]new}) + frame
+e) watchpoint-scope (wpnum) + frame
+
+Movement:
+f) function-finished ([gdb-result-var,return-value]) + frame
+g) location-reached + frame
+h) end-stepping-range + frame
+
+Exit:
+i) exited-signalled (signal-name,signal-meaning)
+j) exited (exit-code)
+k) exited-normally
+
+Signal:
+l) signal-received (signal-name,signal-meaning) + frame
+
+Plus: thread-id
+*/
+enum mi_stop_reason
+{
+ sr_unknown=0,
+ sr_bkpt_hit,
+ sr_wp_trigger, sr_read_wp_trigger, sr_access_wp_trigger, sr_wp_scope,
+ sr_function_finished, sr_location_reached, sr_end_stepping_range,
+ sr_exited_signalled, sr_exited, sr_exited_normally,
+ sr_signal_received
+};
+
+struct mi_stop_struct
+{
+ enum mi_stop_reason reason; /* If more than one reason just the last. */
+ /* Flags indicating if non-pointer fields are filled. */
+ char have_thread_id;
+ char have_bkptno;
+ char have_exit_code;
+ char have_wpno;
+ /* Where stopped. Doesn't exist for sr_exited*. */
+ int thread_id;
+ mi_frames *frame;
+ /* sr_bkpt_hit */
+ int bkptno;
+ /* sr_*wp_* no scope */
+ mi_wp *wp;
+ char *wp_old;
+ char *wp_val;
+ /* sr_wp_scope */
+ int wpno;
+ /* sr_function_finished. Not for void func. */
+ char *gdb_result_var;
+ char *return_value;
+ /* sr_exited_signalled, sr_signal_received */
+ char *signal_name;
+ char *signal_meaning;
+ /* sr_exited */
+ int exit_code;
+};
+typedef struct mi_stop_struct mi_stop;
+
+/* Variable containing the last error. */
+extern int mi_error;
+extern char *mi_error_from_gdb;
+const char *mi_get_error_str();
+
+/* Indicate the name of gdb exe. Default is /usr/bin/gdb */
+void mi_set_gdb_exe(const char *name);
+const char *mi_get_gdb_exe();
+/* Indicate the name of a file containing commands to send at start-up */
+void mi_set_gdb_start(const char *name);
+const char *mi_get_gdb_start();
+/* Indicate the name of a file containing commands to send after connection */
+void mi_set_gdb_conn(const char *name);
+const char *mi_get_gdb_conn();
+void mi_send_target_commands(mi_h *h);
+/* Connect to a local copy of gdb. */
+mi_h *mi_connect_local();
+/* Close connection. You should ask gdb to quit first. */
+void  mi_disconnect(mi_h *h);
+/* Force MI version. */
+#define MI_VERSION2U(maj,mid,min) (maj*0x1000000+mid*0x10000+min)
+void  mi_force_version(mi_h *h, unsigned vMajor, unsigned vMiddle,
+                       unsigned vMinor);
+void  mi_set_workaround(unsigned wa, int enable);
+int   mi_get_workaround(unsigned wa);
+/* Parse gdb output. */
+mi_output *mi_parse_gdb_output(const char *str);
+/* Functions to set/get the tunneled streams callbacks. */
+void mi_set_console_cb(mi_h *h, stream_cb cb, void *data);
+void mi_set_target_cb(mi_h *h, stream_cb cb, void *data);
+void mi_set_log_cb(mi_h *h, stream_cb cb, void *data);
+stream_cb mi_get_console_cb(mi_h *h, void **data);
+stream_cb mi_get_target_cb(mi_h *h, void **data);
+stream_cb mi_get_log_cb(mi_h *h, void **data);
+/* The callback to deal with async events. */
+void mi_set_async_cb(mi_h *h, async_cb cb, void *data);
+async_cb mi_get_async_cb(mi_h *h, void **data);
+/* Time out in gdb responses. */
+void mi_set_time_out_cb(mi_h *h, tm_cb cb, void *data);
+tm_cb mi_get_time_out_cb(mi_h *h, void **data);
+void mi_set_time_out(mi_h *h, int to);
+int mi_get_time_out(mi_h *h);
+/* Callbacks to "see" the dialog with gdb. */
+void mi_set_to_gdb_cb(mi_h *h, stream_cb cb, void *data);
+void mi_set_from_gdb_cb(mi_h *h, stream_cb cb, void *data);
+stream_cb mi_get_to_gdb_cb(mi_h *h, void **data);
+stream_cb mi_get_from_gdb_cb(mi_h *h, void **data);
+/* Sends a message to gdb. */
+int mi_send(mi_h *h, const char *format, ...);
+/* Wait until gdb sends a response. */
+mi_output *mi_get_response_blk(mi_h *h);
+/* Check if gdb sent a complete response. Use with mi_retire_response. */
+int mi_get_response(mi_h *h);
+/* Get the last response. Use with mi_get_response. */
+mi_output *mi_retire_response(mi_h *h);
+/* Look for a result record in gdb output. */
+mi_output *mi_get_rrecord(mi_output *r);
+/* Look if the output contains an async stop.
+   If that's the case return the reason for the stop.
+   If the output contains an error the description is returned in reason. */
+int mi_get_async_stop_reason(mi_output *r, char **reason);
+mi_stop *mi_get_stopped(mi_results *r);
+mi_frames *mi_get_async_frame(mi_output *r);
+/* Wait until gdb sends a response.
+   Then check if the response is of the desired type. */
+int mi_res_simple_exit(mi_h *h);
+int mi_res_simple_done(mi_h *h);
+int mi_res_simple_running(mi_h *h);
+int mi_res_simple_connected(mi_h *h);
+/* It additionally extracts an specified variable. */
+mi_results *mi_res_done_var(mi_h *h, const char *var);
+/* Extract a frames list from the response. */
+mi_frames *mi_res_frames_array(mi_h *h, const char *var);
+mi_frames *mi_res_frames_list(mi_h *h);
+mi_frames *mi_parse_frame(mi_results *c);
+mi_frames *mi_res_frame(mi_h *h);
+/* Create an auxiliar terminal using xterm. */
+mi_aux_term *gmi_start_xterm();
+/* Indicate the name of xterm exe. Default is /usr/bin/X11/xterm */
+void mi_set_xterm_exe(const char *name);
+const char *mi_get_xterm_exe();
+/* Kill the auxiliar terminal and release the structure. */
+void gmi_end_aux_term(mi_aux_term *t);
+/* Look for a free Linux VT for the child. */
+mi_aux_term *gmi_look_for_free_vt();
+/* Look for a free and usable Linux VT. */
+int mi_look_for_free_vt();
+/* Close master and release the structure. */
+void gmi_end_pty(mi_pty *p);
+/* Look for a free pseudo terminal. */
+mi_pty *gmi_look_for_free_pty();
+/* Extract a list of thread IDs from response. */
+int mi_res_thread_ids(mi_h *h, int **list);
+int mi_get_thread_ids(mi_output *res, int **list);
+/* A variable response. */
+mi_gvar *mi_res_gvar(mi_h *h, mi_gvar *cur, const char *expression);
+enum mi_gvar_fmt mi_format_str_to_enum(const char *format);
+const char *mi_format_enum_to_str(enum mi_gvar_fmt format);
+char mi_format_enum_to_char(enum mi_gvar_fmt format);
+enum mi_gvar_lang mi_lang_str_to_enum(const char *lang);
+const char *mi_lang_enum_to_str(enum mi_gvar_lang lang);
+int mi_res_changelist(mi_h *h, mi_gvar_chg **changed);
+int mi_res_children(mi_h *h, mi_gvar *v);
+mi_bkpt *mi_res_bkpt(mi_h *h);
+mi_wp *mi_res_wp(mi_h *h);
+char *mi_res_value(mi_h *h);
+mi_stop *mi_res_stop(mi_h *h);
+enum mi_stop_reason mi_reason_str_to_enum(const char *s);
+const char *mi_reason_enum_to_str(enum mi_stop_reason r);
+int mi_get_read_memory(mi_h *h, unsigned char *dest, unsigned ws, int *na,
+                       unsigned long *addr);
+mi_asm_insns *mi_get_asm_insns(mi_h *h);
+/* Starting point of the program. */
+void mi_set_main_func(const char *name);
+const char *mi_get_main_func();
+mi_chg_reg *mi_get_list_registers(mi_h *h, int *how_many);
+int mi_get_list_registers_l(mi_h *h, mi_chg_reg *l);
+mi_chg_reg *mi_get_list_changed_regs(mi_h *h);
+int mi_get_reg_values(mi_h *h, mi_chg_reg *l);
+mi_chg_reg *mi_get_reg_values_l(mi_h *h, int *how_many);
+int gmi_target_download(mi_h *h);
+
+/* Allocation functions: */
+void *mi_calloc(size_t count, size_t sz);
+void *mi_calloc1(size_t sz);
+char *mi_malloc(size_t sz);
+mi_results       *mi_alloc_results(void);
+mi_output        *mi_alloc_output(void);
+mi_frames        *mi_alloc_frames(void);
+mi_gvar          *mi_alloc_gvar(void);
+mi_gvar_chg      *mi_alloc_gvar_chg(void);
+mi_bkpt          *mi_alloc_bkpt(void);
+mi_wp            *mi_alloc_wp(void);
+mi_stop          *mi_alloc_stop(void);
+mi_asm_insns     *mi_alloc_asm_insns(void);
+mi_asm_insn      *mi_alloc_asm_insn(void);
+mi_chg_reg       *mi_alloc_chg_reg(void);
+void mi_free_output(mi_output *r);
+void mi_free_output_but(mi_output *r, mi_output *no, mi_results *no_r);
+void mi_free_frames(mi_frames *f);
+void mi_free_aux_term(mi_aux_term *t);
+void mi_free_results(mi_results *r);
+void mi_free_results_but(mi_results *r, mi_results *no);
+void mi_free_gvar(mi_gvar *v);
+void mi_free_gvar_chg(mi_gvar_chg *p);
+void mi_free_wp(mi_wp *wp);
+void mi_free_stop(mi_stop *s);
+void mi_free_asm_insns(mi_asm_insns *i);
+void mi_free_asm_insn(mi_asm_insn *i);
+void mi_free_charp_list(char **l);
+void mi_free_chg_reg(mi_chg_reg *r);
+
+/* Porgram control: */
+/* Specify the executable and arguments for local debug. */
+int gmi_set_unwind_on_signal_on(mi_h * h);
+int gmi_set_exec(mi_h *h, const char *file, const char *args);
+/* Start running the executable. Remote sessions starts running. */
+int gmi_exec_run(mi_h *h);
+/* Continue the execution after a "stop". */
+int gmi_exec_continue(mi_h *h);
+/* Continue the execution in reverse order after a "stop". */
+int gmi_exec_continue_reverse(mi_h *h);
+/* Indicate which terminal will use the target program. For local sessions. */
+int gmi_target_terminal(mi_h *h, const char *tty_name);
+/* Specify what's the local copy that have debug info. For remote sessions. */
+int gmi_file_symbol_file(mi_h *h, const char *file);
+/* Continue until function return, the return value is included in the async
+   response. */
+int gmi_exec_finish(mi_h *h);
+/* Continue backwardly until function return, the return value is included in
+  the async response.*/
+int gmi_exec_finish_reverse(mi_h *h);
+/* Stop the program using SIGINT. */
+int gmi_exec_interrupt(mi_h *h);
+/* Next line of code. */
+int gmi_exec_next(mi_h *h);
+/* Start recording a process */
+int gmi_exec_record_process(mi_h *h);
+/* Next count lines of code. */
+int gmi_exec_next_cnt(mi_h *h, int count);
+/* Next line of assembler code. */
+int gmi_exec_next_instruction(mi_h *h);
+/* Next line of code. Get inside functions. */
+int gmi_exec_step(mi_h *h);
+/* Previous line of code. Get inside functions. */
+int gmi_exec_step_back(mi_h *h);
+/*  Previous line of code (do not step into).*/
+int gmi_exec_next_reverse(mi_h *h);
+/* Next count lines of code. Get inside functions. */
+int gmi_exec_step_cnt(mi_h *h, int count);
+/* Next line of assembler code. Get inside calls. */
+int gmi_exec_step_instruction(mi_h *h);
+/* Execute until location is reached. If file is NULL then is until next line. 
*/
+int gmi_exec_until(mi_h *h, const char *file, int line);
+int gmi_exec_until_addr(mi_h *h, void *addr);
+/* Return to previous frame inmediatly. */
+mi_frames *gmi_exec_return(mi_h *h);
+/* Just kill the program. Please read the notes in prg_control.c. */
+int gmi_exec_kill(mi_h *h);
+
+/* Target manipulation: */
+/* Connect to a remote gdbserver using the specified methode. */
+int gmi_target_select(mi_h *h, const char *type, const char *params);
+/* Attach to an already running process. */
+mi_frames *gmi_target_attach(mi_h *h, pid_t pid);
+/* Detach from an attached process. */
+int gmi_target_detach(mi_h *h);
+
+/* Miscellaneous commands: */
+/* Exit gdb killing the child is it is running. */
+void gmi_gdb_exit(mi_h *h);
+/* Send the version to the console. */
+int gmi_gdb_version(mi_h *h);
+/* Set a gdb variable. */
+int gmi_gdb_set(mi_h *h, const char *var, const char *val);
+/* Get a gdb variable. */
+char *gmi_gdb_show(mi_h *h, const char *var);
+
+/* Breakpoints manipulation: */
+/* Insert a breakpoint at file:line. */
+mi_bkpt *gmi_break_insert(mi_h *h, const char *file, int line);
+/* Insert a breakpoint, all available options. */
+mi_bkpt *gmi_break_insert_full(mi_h *h, int temporary, int hard_assist,
+                               const char *cond, int count, int thread,
+                               const char *where);
+mi_bkpt *gmi_break_insert_full_fl(mi_h *h, const char *file, int line,
+                                  int temporary, int hard_assist,
+                                  const char *cond, int count, int thread);
+/* Remove a breakpoint. */
+int gmi_break_delete(mi_h *h, int number);
+/* Free the memory used for a breakpoint description. */
+void mi_free_bkpt(mi_bkpt *b);
+/* Modify the "ignore" count for a breakpoint. */
+int gmi_break_set_times(mi_h *h, int number, int count);
+/* Associate a condition with the breakpoint. */
+int gmi_break_set_condition(mi_h *h, int number, const char *condition);
+/* Enable or disable a breakpoint. */
+int gmi_break_state(mi_h *h, int number, int enable);
+/* Set a watchpoint. It doesn't work for remote targets! */
+mi_wp *gmi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp);
+
+/* Data Manipulation. */
+/* Evaluate an expression. Returns a parsed tree. */
+char *gmi_data_evaluate_expression(mi_h *h, const char *expression);
+/* Path for sources. */
+int gmi_dir(mi_h *h, const char *path);
+/* A very limited "data read memory" implementation. */
+int gmi_read_memory(mi_h *h, const char *exp, unsigned size,
+                    unsigned char *dest, int *na, int convAddr,
+                    unsigned long *addr);
+mi_asm_insns *gmi_data_disassemble_se(mi_h *h, const char *start,
+                                      const char *end, int mode);
+mi_asm_insns *gmi_data_disassemble_fl(mi_h *h, const char *file, int line,
+                                      int lines, int mode);
+mi_chg_reg *gmi_data_list_register_names(mi_h *h, int *how_many);
+int gmi_data_list_register_names_l(mi_h *h, mi_chg_reg *l);
+mi_chg_reg *gmi_data_list_changed_registers(mi_h *h);
+int gmi_data_list_register_values(mi_h *h, enum mi_gvar_fmt fmt, mi_chg_reg 
*l);
+mi_chg_reg *gmi_data_list_all_register_values(mi_h *h, enum mi_gvar_fmt fmt, 
int *how_many);
+
+/* Stack manipulation. */
+/* List of frames. Arguments aren't filled. */
+mi_frames *gmi_stack_list_frames(mi_h *h);
+/* List of frames. Indicating a range. */
+mi_frames *gmi_stack_list_frames_r(mi_h *h, int from, int to);
+/* List arguments. Only level and args filled. */
+mi_frames *gmi_stack_list_arguments(mi_h *h, int show);
+/* List arguments. Indicating a range. Only level and args filled. */
+mi_frames *gmi_stack_list_arguments_r(mi_h *h, int show, int from, int to);
+/* Information about the current frame, including args. */
+mi_frames *gmi_stack_info_frame(mi_h *h);
+/* Stack info depth. error => -1 */
+int gmi_stack_info_depth_get(mi_h *h);
+/* Set stack info depth. error => -1 */
+int gmi_stack_info_depth(mi_h *h, int max_depth);
+/* Change current frame. */
+int gmi_stack_select_frame(mi_h *h, int framenum);
+/* List of local vars. */
+mi_results *gmi_stack_list_locals(mi_h *h, int show);
+
+/* Thread. */
+/* List available thread ids. */
+int gmi_thread_list_ids(mi_h *h, int **list);
+/* Select a thread. */
+mi_frames *gmi_thread_select(mi_h *h, int id);
+/* List available threads. */
+mi_frames *gmi_thread_list_all_threads(mi_h *h);
+
+/* Variable objects. */
+/* Create a variable object. */
+mi_gvar *gmi_var_create_nm(mi_h *h, const char *name, int frame, const char 
*exp);
+mi_gvar *gmi_var_create(mi_h *h, int frame, const char *exp);
+/* Create the variable and also fill the lang and attr fields. */
+mi_gvar *gmi_full_var_create(mi_h *h, int frame, const char *exp);
+/* Delete a variable object. Doesn't free the mi_gvar data. */
+int gmi_var_delete(mi_h *h, mi_gvar *var);
+/* Set the format used to represent the result. */
+int gmi_var_set_format(mi_h *h, mi_gvar *var, enum mi_gvar_fmt format);
+/* Fill the format field with info from gdb. */
+int gmi_var_show_format(mi_h *h, mi_gvar *var);
+/* Fill the numchild field with info from gdb. */
+int gmi_var_info_num_children(mi_h *h, mi_gvar *var);
+/* Fill the type field with info from gdb. */
+int gmi_var_info_type(mi_h *h, mi_gvar *var);
+/* Fill the expression and lang fields with info from gdb.
+   Note that lang isn't filled during creation. */
+int gmi_var_info_expression(mi_h *h, mi_gvar *var);
+/* Fill the attr field with info from gdb.
+   Note that attr isn't filled during creation. */
+int gmi_var_show_attributes(mi_h *h, mi_gvar *var);
+/* Update variable. Use NULL for all.
+   Note that *changed can be NULL if none updated. */
+int gmi_var_update(mi_h *h, mi_gvar *var, mi_gvar_chg **changed);
+/* Change variable. Fills the value field. */
+int gmi_var_assign(mi_h *h, mi_gvar *var, const char *expression);
+/* Get current value for a variable. */
+int gmi_var_evaluate_expression(mi_h *h, mi_gvar *var);
+/* List children. It ONLY returns the first level information. :-( */
+int gmi_var_list_children(mi_h *h, mi_gvar *var);
+
+
+
+
+#if 0                           /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Added: monkey/branches/MonkeyBacktracking/monkey/src/mi/Makefile.am
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/Makefile.am                
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/Makefile.am        
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,30 @@
+INCLUDES = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include
+
+if MINGW
+ WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols 
+endif
+
+if USE_COVERAGE
+  AM_CFLAGS = --coverage -O0
+  XLIB = -lgcov
+endif
+
+lib_LTLIBRARIES = libmonkeymi.la
+
+libmonkeymi_la_SOURCES = \
+        gdbmi.h \
+        gdbmi_alloc.c \
+        gdbmi_breakpoint.c \
+        gdbmi_connect.c \
+        gdbmi_data_man.c \
+        gdbmi_error.c \
+        gdbmi_get_free_pty.c \
+        gdbmi_get_free_vt.c \
+        gdbmi_misc.c \
+        gdbmi_parse.c \
+        gdbmi_prg_control.c \
+        gdbmi_stack_man.c \
+        gdbmi_symbol_query.c \
+        gdbmi_target_man.c \
+        gdbmi_thread.c \
+        gdbmi_var_obj.c
\ No newline at end of file

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_alloc.c (from 
rev 22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_alloc.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_alloc.c              
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_alloc.c      
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,308 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Allocator.
+  Comments:
+  Most alloc/free routines are here. Free routines must accept NULL
+pointers. Alloc functions must set mi_error.  @<p>
+  
+***************************************************************************/
+
+#include "gdbmi.h"
+
+void *mi_calloc(size_t count, size_t sz)
+{
+ void *res=calloc(count,sz);
+ if (!res)
+    mi_error=MI_OUT_OF_MEMORY;
+ return res;
+}
+
+void *mi_calloc1(size_t sz)
+{
+ return mi_calloc(1,sz);
+}
+
+char *mi_malloc(size_t sz)
+{
+ char *res=malloc(sz);
+ if (!res)
+    mi_error=MI_OUT_OF_MEMORY;
+ return res;
+}
+
+mi_results *mi_alloc_results(void)
+{
+ return (mi_results *)mi_calloc1(sizeof(mi_results));
+}
+
+mi_output *mi_alloc_output(void)
+{
+ return (mi_output *)mi_calloc1(sizeof(mi_output));
+}
+
+mi_frames *mi_alloc_frames(void)
+{
+ return (mi_frames *)mi_calloc1(sizeof(mi_frames));
+}
+
+mi_gvar *mi_alloc_gvar(void)
+{
+ return (mi_gvar *)mi_calloc1(sizeof(mi_gvar));
+}
+
+mi_gvar_chg *mi_alloc_gvar_chg(void)
+{
+ return (mi_gvar_chg *)mi_calloc1(sizeof(mi_gvar_chg));
+}
+
+mi_bkpt *mi_alloc_bkpt(void)
+{
+ mi_bkpt *b=(mi_bkpt *)mi_calloc1(sizeof(mi_bkpt));
+ if (b)
+   {
+    b->thread=-1;
+    b->ignore=-1;
+   }
+ return b;
+}
+
+mi_wp *mi_alloc_wp(void)
+{
+ return (mi_wp *)mi_calloc1(sizeof(mi_wp));
+}
+
+mi_stop *mi_alloc_stop(void)
+{
+ return (mi_stop *)mi_calloc1(sizeof(mi_stop));
+}
+
+mi_asm_insns *mi_alloc_asm_insns(void)
+{
+ return (mi_asm_insns *)mi_calloc1(sizeof(mi_asm_insns));
+}
+
+mi_asm_insn *mi_alloc_asm_insn(void)
+{
+ return (mi_asm_insn *)mi_calloc1(sizeof(mi_asm_insn));
+}
+
+mi_chg_reg *mi_alloc_chg_reg(void)
+{
+ return (mi_chg_reg *)mi_calloc1(sizeof(mi_chg_reg));
+}
+
+/*****************************************************************************
+  Free functions
+*****************************************************************************/
+
+void mi_free_frames(mi_frames *f)
+{
+ mi_frames *aux;
+
+ while (f)
+   {
+    free(f->func);
+    free(f->file);
+    free(f->from);
+    mi_free_results(f->args);
+    aux=f->next;
+    free(f);
+    f=aux;
+   }
+}
+
+void mi_free_bkpt(mi_bkpt *b)
+{
+ mi_bkpt *aux;
+
+ while (b)
+   {
+    free(b->func);
+    free(b->file);
+    free(b->file_abs);
+    free(b->cond);
+    aux=b->next;
+    free(b);
+    b=aux;
+   }
+}
+
+void mi_free_gvar(mi_gvar *v)
+{
+ mi_gvar *aux;
+
+ while (v)
+   {
+    free(v->name);
+    free(v->type);
+    free(v->exp);
+    free(v->value);
+    if (v->numchild && v->child)
+       mi_free_gvar(v->child);
+    aux=v->next;
+    free(v);
+    v=aux;
+   }
+}
+
+void mi_free_gvar_chg(mi_gvar_chg *p)
+{
+ mi_gvar_chg *aux;
+
+ while (p)
+   {
+    free(p->name);
+    free(p->new_type);
+    aux=p->next;
+    free(p);
+    p=aux;
+   }
+}
+
+void mi_free_results_but(mi_results *r, mi_results *no)
+{
+ mi_results *aux;
+
+ while (r)
+   {
+    if (r==no)
+      {
+       aux=r->next;
+       r->next=NULL;
+       r=aux;
+      }
+    else
+      {
+       free(r->var);
+       switch (r->type)
+         {
+          case t_const:
+               free(r->v.cstr);
+               break;
+          case t_tuple:
+          case t_list:
+               mi_free_results_but(r->v.rs,no);
+               break;
+         }
+       aux=r->next;
+       free(r);
+       r=aux;
+      }
+   }
+}
+
+void mi_free_results(mi_results *r)
+{
+ mi_free_results_but(r,NULL);
+}
+
+void mi_free_output_but(mi_output *r, mi_output *no, mi_results *no_r)
+{
+ mi_output *aux;
+
+ while (r)
+   {
+    if (r==no)
+      {
+       aux=r->next;
+       r->next=NULL;
+       r=aux;
+      }
+    else
+      {
+       if (r->c)
+          mi_free_results_but(r->c,no_r);
+       aux=r->next;
+       free(r);
+       r=aux;
+      }
+   }
+}
+
+void mi_free_output(mi_output *r)
+{
+ mi_free_output_but(r,NULL,NULL);
+}
+
+void mi_free_stop(mi_stop *s)
+{
+ if (!s)
+    return;
+ mi_free_frames(s->frame);
+ mi_free_wp(s->wp);
+ free(s->wp_old);
+ free(s->wp_val);
+ free(s->gdb_result_var);
+ free(s->return_value);
+ free(s->signal_name);
+ free(s->signal_meaning);
+ free(s);
+}
+
+void mi_free_wp(mi_wp *wp)
+{
+ mi_wp *aux;
+ while (wp)
+   {
+    free(wp->exp);
+    aux=wp->next;
+    free(wp);
+    wp=aux;
+   }
+}
+
+void mi_free_asm_insns(mi_asm_insns *i)
+{
+ mi_asm_insns *aux;
+
+ while (i)
+   {
+    free(i->file);
+    mi_free_asm_insn(i->ins);
+    aux=i->next;
+    free(i);
+    i=aux;
+   }
+}
+
+void mi_free_asm_insn(mi_asm_insn *i)
+{
+ mi_asm_insn *aux;
+
+ while (i)
+   {
+    free(i->func);
+    free(i->inst);
+    aux=i->next;
+    free(i);
+    i=aux;
+   }
+}
+
+/*void mi_free_charp_list(char **l)
+{
+ char **c=l;
+ while (c)
+   {
+    free(*c);
+    c++;
+   }
+ free(l);
+}*/
+
+void mi_free_chg_reg(mi_chg_reg *r)
+{
+ mi_chg_reg *aux;
+ while (r)
+   {
+    free(r->val);
+    free(r->name);
+    aux=r->next;
+    free(r);
+    r=aux;
+   }
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_breakpoint.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_breakpoint.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_breakpoint.c         
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_breakpoint.c 
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,265 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Breakpoint table commands.
+  Comments:
+  GDB/MI commands for the "Breakpoint Table Commands" section.
+   @<p>
+@<pre>
+gdb command:          Implemented?
+
+-break-after          Yes
+-break-condition      Yes
+-break-delete         Yes
+-break-disable        Yes
+-break-enable         Yes
+-break-info           N.A. (info break NUMBER) (*)
+-break-insert         Yes
+-break-list           No (*)
+-break-watch          Yes
+@</pre>
+
+(*) I think the program should keep track of the breakpoints, so it will
+be implemented when I have more time.  @<p>
+
+***************************************************************************/
+
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_break_insert_fl(mi_h *h, const char *file, int line)
+{
+ mi_send(h,"-break-insert %s:%d\n",file,line);
+}
+
+void mi_break_insert(mi_h *h, int temporary, int hard_assist,
+                     const char *cond, int count, int thread,
+                     const char *where)
+{
+ char s_count[32];
+ char s_thread[32];
+
+ if (count>=0)
+    snprintf(s_count,32,"%d",count);
+ if (thread>=0)
+    snprintf(s_thread,32,"%d",thread);
+ if (cond)
+    // Conditions may contain spaces, in fact, if they don't gdb will add
+    // them after parsing. Enclosing the expression with "" solves the
+    // problem.
+    mi_send(h,"-break-insert %s %s -c \"%s\" %s %s %s %s %s\n",
+            temporary   ? "-t" : "",
+            hard_assist ? "-h" : "",
+            cond,
+            count>=0    ? "-i" : "", count>=0  ? s_count  : "",
+            thread>=0   ? "-p" : "", thread>=0 ? s_thread : "",
+            where);
+ else
+    mi_send(h,"-break-insert %s %s %s %s %s %s %s\n",
+            temporary   ? "-t" : "",
+            hard_assist ? "-h" : "",
+            count>=0    ? "-i" : "", count>=0  ? s_count  : "",
+            thread>=0   ? "-p" : "", thread>=0 ? s_thread : "",
+            where);
+}
+
+void mi_break_insert_flf(mi_h *h, const char *file, int line, int temporary,
+                         int hard_assist, const char *cond, int count,
+                         int thread)
+{
+ char s_count[32];
+ char s_thread[32];
+
+ if (count>=0)
+    snprintf(s_count,32,"%d",count);
+ if (thread>=0)
+    snprintf(s_thread,32,"%d",thread);
+ mi_send(h,"-break-insert %s %s %s %s %s %s %s %s %s:%d\n",
+         temporary   ? "-t" : "",
+         hard_assist ? "-h" : "",
+         cond        ? "-c" : "", cond      ? cond     : "",
+         count>=0    ? "-i" : "", count>=0  ? s_count  : "",
+         thread>=0   ? "-p" : "", thread>=0 ? s_thread : "",
+         file,line);
+}
+
+void mi_break_delete(mi_h *h, int number)
+{
+ mi_send(h,"-break-delete %d\n",number);
+}
+
+void mi_break_after(mi_h *h, int number, int count)
+{
+ mi_send(h,"-break-after %d %d\n",number,count);
+}
+
+void mi_break_condition(mi_h *h, int number, const char *condition)
+{
+ mi_send(h,"-break-condition %d %s\n",number,condition);
+}
+
+void mi_break_enable(mi_h *h, int number)
+{
+ mi_send(h,"-break-enable %d\n",number);
+}
+
+void mi_break_disable(mi_h *h, int number)
+{
+ mi_send(h,"-break-disable %d\n",number);
+}
+
+void mi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp)
+{
+ if (mode==wm_write)
+    mi_send(h,"-break-watch \"%s\"\n",exp);
+ else
+    mi_send(h,"-break-watch -%c \"%s\"\n",mode==wm_rw ? 'a' : 'r',exp);
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  Insert a breakpoint at file:line.
+
+  Command: -break-insert file:line
+  Return: A new mi_bkpt structure with info about the breakpoint. NULL on
+error.
+  
+***************************************************************************/
+
+mi_bkpt *gmi_break_insert(mi_h *h, const char *file, int line)
+{
+ mi_break_insert_fl(h,file,line);
+ return mi_res_bkpt(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Insert a breakpoint, all available options.
+  
+  Command: -break-insert
+  Return: A new mi_bkpt structure with info about the breakpoint. NULL on
+error.
+  
+***************************************************************************/
+
+mi_bkpt *gmi_break_insert_full(mi_h *h, int temporary, int hard_assist,
+                               const char *cond, int count, int thread,
+                               const char *where)
+{
+ mi_break_insert(h,temporary,hard_assist,cond,count,thread,where);
+ return mi_res_bkpt(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Insert a breakpoint, all available options.
+  
+  Command: -break-insert [ops] file:line
+  Return: A new mi_bkpt structure with info about the breakpoint. NULL on
+error.
+  
+***************************************************************************/
+
+mi_bkpt *gmi_break_insert_full_fl(mi_h *h, const char *file, int line,
+                                  int temporary, int hard_assist,
+                                  const char *cond, int count, int thread)
+{
+ mi_break_insert_flf(h,file,line,temporary,hard_assist,cond,count,thread);
+ return mi_res_bkpt(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Remove a breakpoint.
+
+  Command: -break-delete
+  Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
+console.
+  
+***************************************************************************/
+
+int gmi_break_delete(mi_h *h, int number)
+{
+ mi_break_delete(h,number);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Modify the "ignore" count for a breakpoint.
+
+  Command: -break-after
+  Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
+console.
+  
+***************************************************************************/
+
+int gmi_break_set_times(mi_h *h, int number, int count)
+{
+ mi_break_after(h,number,count);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Associate a condition with the breakpoint.
+
+  Command: -break-condition
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_break_set_condition(mi_h *h, int number, const char *condition)
+{
+ mi_break_condition(h,number,condition);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Enable or disable a breakpoint.
+
+  Command: -break-enable + -break-disable
+  Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
+console.
+  
+***************************************************************************/
+
+int gmi_break_state(mi_h *h, int number, int enable)
+{
+ if (enable)
+    mi_break_enable(h,number);
+ else
+    mi_break_disable(h,number);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Set a watchpoint. It doesn't work for remote targets!
+
+  Command: -break-watch
+  Return: A new mi_wp structure with info about the watchpoint. NULL on
+error.
+  
+***************************************************************************/
+
+mi_wp *gmi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp)
+{
+ mi_break_watch(h,mode,exp);
+ return mi_res_wp(h);
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_connect.c (from 
rev 22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_connect.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_connect.c            
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_connect.c    
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,885 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004-2009 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Connect.
+  Comments:
+  This module handles the dialog with gdb, including starting and stopping
+gdb.
+  @<p>
+
+GDB Bug workaround for "file -readnow": I tried to workaround a bug using
+it but looks like this option also have bugs!!!! so I have to use the
+command line option --readnow.
+It also have a bug!!!! when the binary is changed and gdb must reload it
+this option is ignored. So it looks like we have no solution but 3 gdb bugs
+in a row.
+
+***************************************************************************/
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include "plibc.h"
+
+#include "gdbmi.h"
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#ifndef TEMP_FAILURE_RETRY
+ #define TEMP_FAILURE_RETRY(a) (a)
+#endif
+
+int mi_error=MI_OK;
+char *mi_error_from_gdb=NULL;
+static char *gdb_exe=NULL;
+static char *xterm_exe=NULL;
+static char *gdb_start=NULL;
+static char *gdb_conn=NULL;
+static char *main_func=NULL;
+static char  disable_psym_search_workaround=0;
+
+mi_h *mi_alloc_h()
+{
+ mi_h *h=(mi_h *)calloc(1,sizeof(mi_h));
+ if (!h)
+   {
+    mi_error=MI_OUT_OF_MEMORY;
+    return NULL;
+   }
+ h->to_gdb[0]=h->to_gdb[1]=h->from_gdb[0]=h->from_gdb[1]=-1;
+ h->pid=-1;
+ return h;
+}
+
+int mi_check_running_pid(pid_t pid)
+{
+ int status;
+
+ if (pid<=0)
+    return 0;
+ /* If waitpid returns the number of our child means it communicated
+    to as a termination status. */
+ if (waitpid(pid,&status,WNOHANG)==pid)
+   {
+    pid=0;
+    return 0;
+   }
+ return 1;
+}
+
+int mi_check_running(mi_h *h)
+{
+ return !h->died && mi_check_running_pid(h->pid);
+}
+
+void mi_kill_child(pid_t pid)
+{
+ kill(pid,SIGTERM);
+ usleep(100000);
+ if (mi_check_running_pid(pid))
+   {
+    int status;
+    kill(pid,SIGKILL);
+    waitpid(pid,&status,0);
+   }
+}
+
+void mi_free_h(mi_h **handle)
+{
+ mi_h *h=*handle;
+ if (h->to_gdb[0]>=0)
+    close(h->to_gdb[0]);
+ if (h->to)
+    fclose(h->to);
+ else if (h->to_gdb[1]>=0)
+    close(h->to_gdb[1]);
+ if (h->from)
+    fclose(h->from);
+ else if (h->from_gdb[0]>=0)
+    close(h->from_gdb[0]);
+ if (h->from_gdb[1]>=0)
+    close(h->from_gdb[1]);
+ if (mi_check_running(h))
+   {/* GDB is running! */
+    mi_kill_child(h->pid);
+   }
+ if (h->line)
+    free(h->line);
+ mi_free_output(h->po);
+ free(h->catched_console);
+ free(h);
+ *handle=NULL;
+}
+
+void mi_set_nonblk(int h)
+{
+ int flf;
+ flf=fcntl(h,F_GETFL,0);
+ flf=flf | O_NONBLOCK;
+ fcntl(h,F_SETFL,flf);
+}
+
+int mi_getline(mi_h *h)
+{
+ char c;
+
+ while (read(h->from_gdb[0],&c,1)==1)
+   {
+    if (h->lread>=h->llen)
+      {
+       h->llen=h->lread+128;
+       h->line=(char *)realloc(h->line,h->llen);
+       if (!h->line)
+         {
+          h->llen=0;
+          h->lread=0;
+          return -1;
+         }
+      }
+    if (c=='\n')
+      {
+       int ret=h->lread;
+       h->line[ret]=0;
+       h->lread=0;
+       return ret;
+      }
+    h->line[h->lread]=c;
+    h->lread++;
+   }
+ return 0;
+}
+
+char *get_cstr(mi_output *o)
+{
+ if (!o->c || o->c->type!=t_const)
+    return NULL;
+ return o->c->v.cstr;
+}
+
+int mi_get_response(mi_h *h)
+{
+ int l=mi_getline(h);
+ if (!l)
+    return 0;
+
+ if (h->from_gdb_echo)
+    h->from_gdb_echo(h->line,h->from_gdb_echo_data);
+ if (strncmp(h->line,"(gdb)",5)==0)
+   {/* End of response. */
+    return 1;
+   }
+ else
+   {/* Add to the response. */
+    mi_output *o;
+    int add=1, is_exit=0;
+    o=mi_parse_gdb_output(h->line);
+
+    if (!o)
+       return 0;
+    /* Tunneled streams callbacks. */
+    if (o->type==MI_T_OUT_OF_BAND && o->stype==MI_ST_STREAM)
+      {
+       char *aux;
+       add=0;
+       switch (o->sstype)
+         {
+          case MI_SST_CONSOLE:
+               aux=get_cstr(o);
+               if (h->console)
+                  h->console(aux,h->console_data);
+               if (h->catch_console && aux)
+                 {
+                  h->catch_console--;
+                  if (!h->catch_console)
+                    {
+                     free(h->catched_console);
+                     h->catched_console=strdup(aux);
+                    }
+                 }
+               break;
+          case MI_SST_TARGET:
+               /* This one seems to be useless. */
+               if (h->target)
+                  h->target(get_cstr(o),h->target_data);
+               break;
+          case MI_SST_LOG:
+               if (h->log)
+                  h->log(get_cstr(o),h->log_data);
+               break;
+         }
+      }
+    else if (o->type==MI_T_OUT_OF_BAND && o->stype==MI_ST_ASYNC)
+      {
+       if (h->async)
+          h->async(o,h->async_data);
+      }
+    else if (o->type==MI_T_RESULT_RECORD && o->tclass==MI_CL_ERROR)
+      {/* Error from gdb, record it. */
+       mi_error=MI_FROM_GDB;
+       free(mi_error_from_gdb);
+       mi_error_from_gdb=NULL;
+       if (o->c && strcmp(o->c->var,"msg")==0 && o->c->type==t_const)
+          mi_error_from_gdb=strdup(o->c->v.cstr);
+      }
+    is_exit=(o->type==MI_T_RESULT_RECORD && o->tclass==MI_CL_EXIT);
+    /* Add to the list of responses. */
+    if (add)
+      {
+       if (h->last)
+          h->last->next=o;
+       else
+          h->po=o;
+       h->last=o;
+      }
+    else
+       mi_free_output(o);
+    /* Exit RR means gdb exited, we won't get a new prompt ;-) */
+    if (is_exit)
+       return 1;
+   }
+
+ return 0;
+}
+
+mi_output *mi_retire_response(mi_h *h)
+{
+ mi_output *ret=h->po;
+ h->po=h->last=NULL;
+ return ret;
+}
+
+mi_output *mi_get_response_blk(mi_h *h)
+{
+ int r;
+ /* Sometimes gdb dies. */
+ if (!mi_check_running(h))
+   {
+    h->died=1;
+    mi_error=MI_GDB_DIED;
+    return NULL;
+   }
+ do
+   {
+   /*
+    That's a must. If we just keep trying to read and failing things
+    become really sloooowwww. Instead we try and if it fails we wait
+    until something is available.
+    TODO: Implement something with the time out, a callback to ask the
+    application is we have to wait or not could be a good thing.
+   */
+   fd_set set;
+   struct timeval timeout;
+   int ret;
+
+   r=mi_get_response(h);
+   if (r)
+      return mi_retire_response(h);
+
+   FD_ZERO(&set);
+   FD_SET(h->from_gdb[0],&set);
+   timeout.tv_sec=h->time_out;
+   timeout.tv_usec=0;
+   ret=TEMP_FAILURE_RETRY(select(FD_SETSIZE,&set,NULL,NULL,&timeout));
+   if (!ret)
+     {
+      if (!mi_check_running(h))
+        {
+         h->died=1;
+         mi_error=MI_GDB_DIED;
+         return NULL;
+        }
+      if (h->time_out_cb)
+         ret=h->time_out_cb(h->time_out_cb_data);
+      if (!ret)
+        {
+         mi_error=MI_GDB_TIME_OUT;
+         return NULL;
+        }
+     }
+   }
+ while (!r);
+
+ return NULL;
+}
+
+void mi_send_commands(mi_h *h, const char *file)
+{
+ FILE *f;
+ char b[PATH_MAX];
+
+ //printf("File: %s\n",file);
+ if (!file)
+    return;
+ f=fopen(file,"rt");
+ if (!f)
+    return;
+ while (!feof(f))
+   {
+    if (fgets(b,PATH_MAX,f))
+      {
+       //printf("Send: %s\n",b);
+       mi_send (h, "%s", b);
+       mi_res_simple_done(h);
+      }
+   }
+ fclose(f);
+}
+
+void mi_send_target_commands(mi_h *h)
+{
+ mi_send_commands(h,gdb_conn);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Connect to a local copy of gdb. Note that the mi_h structure is something
+similar to a "FILE *" for stdio.
+  
+  Return: A new mi_h structure or NULL on error.
+  
+***************************************************************************/
+
+mi_h *mi_connect_local()
+{
+ mi_h *h;
+ const char *gdb=mi_get_gdb_exe();
+
+ /* Start without error. */
+ mi_error=MI_OK;
+ /* Verify we have a GDB binary. */
+ if (access(gdb,X_OK))
+   {
+    mi_error=MI_MISSING_GDB;
+    return NULL;
+   }
+ /* Alloc the handle structure. */
+ h=mi_alloc_h();
+ if (!h)
+    return h;
+ h->time_out=MI_DEFAULT_TIME_OUT;
+ /* Create the pipes to connect with the child. */
+ if (pipe(h->to_gdb) || pipe(h->from_gdb))
+   {
+    mi_error=MI_PIPE_CREATE;
+    mi_free_h(&h);
+    return NULL;
+   }
+ mi_set_nonblk(h->to_gdb[1]);
+ mi_set_nonblk(h->from_gdb[0]);
+ /* Associate streams to the file handles. */
+ h->to=fdopen(h->to_gdb[1],"w");
+ h->from=fdopen(h->from_gdb[0],"r");
+ if (!h->to || !h->from)
+   {
+    mi_error=MI_PIPE_CREATE;
+    mi_free_h(&h);
+    return NULL;
+   }
+ /* Create the child. */
+ h->pid=fork();
+ if (h->pid==0)
+   {/* We are the child. */
+    char *argv[5];
+    /* Connect stdin/out to the pipes. */
+    dup2(h->to_gdb[0],STDIN_FILENO);
+    dup2(h->from_gdb[1],STDOUT_FILENO);
+    /* Pass the control to gdb. */
+    argv[0]=(char *)gdb; /* Is that OK? */
+    argv[1]="--interpreter=mi";
+    argv[2]="--quiet";
+    argv[3]=disable_psym_search_workaround ? 0 : "--readnow";
+    argv[4]=0;
+    execvp(argv[0],argv);
+    /* We get here only if exec failed. */
+    _exit(127);
+   }
+ /* We are the parent. */
+ if (h->pid==-1)
+   {/* Fork failed. */
+    mi_error=MI_FORK;
+    mi_free_h(&h);
+    return NULL;
+   }
+ if (!mi_check_running(h))
+   {
+    mi_error=MI_DEBUGGER_RUN;
+    mi_free_h(&h);
+    return NULL;
+   }
+ /* Wait for the prompt. */
+ mi_get_response_blk(h);
+ /* Send the start-up commands */
+ mi_send_commands(h,gdb_start);
+
+ return h;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Close connection. You should ask gdb to quit first gmi_gdb_exit.
+  
+***************************************************************************/
+
+void mi_disconnect(mi_h *h)
+{
+ mi_free_h(&h);
+ free(mi_error_from_gdb);
+ mi_error_from_gdb=NULL;
+}
+
+void mi_set_console_cb(mi_h *h, stream_cb cb, void *data)
+{
+ h->console=cb;
+ h->console_data=data;
+}
+
+void mi_set_target_cb(mi_h *h, stream_cb cb, void *data)
+{
+ h->target=cb;
+ h->target_data=data;
+}
+
+void mi_set_log_cb(mi_h *h, stream_cb cb, void *data)
+{
+ h->log=cb;
+ h->log_data=data;
+}
+
+stream_cb mi_get_console_cb(mi_h *h, void **data)
+{
+ if (data)
+    *data=h->console_data;
+ return h->console;
+}
+
+stream_cb mi_get_target_cb(mi_h *h, void **data)
+{
+ if (data)
+    *data=h->target_data;
+ return h->target;
+}
+
+stream_cb mi_get_log_cb(mi_h *h, void **data)
+{
+ if (data)
+    *data=h->log_data;
+ return h->log;
+}
+
+void mi_set_async_cb(mi_h *h, async_cb cb, void *data)
+{
+ h->async=cb;
+ h->async_data=data;
+}
+
+async_cb mi_get_async_cb(mi_h *h, void **data)
+{
+ if (data)
+    *data=h->async_data;
+ return h->async;
+}
+
+void mi_set_to_gdb_cb(mi_h *h, stream_cb cb, void *data)
+{
+ h->to_gdb_echo=cb;
+ h->to_gdb_echo_data=data;
+}
+
+void mi_set_from_gdb_cb(mi_h *h, stream_cb cb, void *data)
+{
+ h->from_gdb_echo=cb;
+ h->from_gdb_echo_data=data;
+}
+
+stream_cb mi_get_to_gdb_cb(mi_h *h, void **data)
+{
+ if (data)
+    *data=h->to_gdb_echo_data;
+ return h->to_gdb_echo;
+}
+
+stream_cb mi_get_from_gdb_cb(mi_h *h, void **data)
+{
+ if (data)
+    *data=h->from_gdb_echo_data;
+ return h->from_gdb_echo;
+}
+
+void mi_set_time_out_cb(mi_h *h, tm_cb cb, void *data)
+{
+ h->time_out_cb=cb;
+ h->time_out_cb_data=data;
+}
+
+tm_cb mi_get_time_out_cb(mi_h *h, void **data)
+{
+ if (data)
+    *data=h->time_out_cb_data;
+ return h->time_out_cb;
+}
+
+void mi_set_time_out(mi_h *h, int to)
+{
+ h->time_out=to;
+}
+
+int mi_get_time_out(mi_h *h)
+{
+ return h->time_out;
+}
+
+int mi_send(mi_h *h, const char *format, ...)
+{
+ int ret;
+ char *str;
+ va_list argptr;
+
+ if (h->died)
+    return 0;
+
+ va_start(argptr,format);
+ ret=vasprintf(&str,format,argptr);
+ va_end(argptr);
+ if (-1 != ret)
+   {
+     fputs(str,h->to);
+     fflush(h->to);
+     if (h->to_gdb_echo)
+       h->to_gdb_echo(str,h->to_gdb_echo_data);
+     free(str);
+   }
+ else
+   {
+     abort ();
+   }
+
+ return ret;
+}
+
+void mi_clean_up_globals()
+{
+ free(gdb_exe);
+ gdb_exe=NULL;
+ free(xterm_exe);
+ xterm_exe=NULL;
+ free(gdb_start);
+ gdb_start=NULL;
+ free(gdb_conn);
+ gdb_conn=NULL;
+ free(main_func);
+ main_func=NULL;
+}
+
+void mi_register_exit()
+{
+ static int registered=0;
+ if (!registered)
+   {
+    registered=1;
+    atexit(mi_clean_up_globals);
+   }
+}
+
+void mi_set_gdb_exe(const char *name)
+{
+ free(gdb_exe);
+ gdb_exe=name ? strdup(name) : NULL;
+ mi_register_exit();
+}
+
+void mi_set_gdb_start(const char *name)
+{
+ free(gdb_start);
+ gdb_start=name ? strdup(name) : NULL;
+ mi_register_exit();
+}
+
+void mi_set_gdb_conn(const char *name)
+{
+ free(gdb_conn);
+ gdb_conn=name ? strdup(name) : NULL;
+ mi_register_exit();
+}
+
+static
+char *mi_search_in_path(const char *file)
+{
+ char *path, *pt, *r;
+ char test[PATH_MAX];
+ struct stat st;
+
+ path=getenv("PATH");
+ if (!path)
+    return NULL;
+ pt=strdup(path);
+ r=strtok(pt,PATH_SEPARATOR_STR);
+ while (r)
+   {
+    strcpy(test,r);
+    strcat(test,"/");
+    strcat(test,file);
+    if (stat(test,&st)==0 && S_ISREG(st.st_mode))
+      {
+       free(pt);
+       return strdup(test);
+      }
+    r=strtok(NULL,PATH_SEPARATOR_STR);
+   }
+ free(pt);
+ return NULL;
+}
+
+const char *mi_get_gdb_exe()
+{
+ if (!gdb_exe)
+   {/* Look for gdb in path */
+    gdb_exe=mi_search_in_path("gdb");
+    if (!gdb_exe)
+       return "/usr/bin/gdb";
+   }
+ return gdb_exe;
+}
+
+const char *mi_get_gdb_start()
+{
+ return gdb_start;
+}
+
+const char *mi_get_gdb_conn()
+{
+ return gdb_conn;
+}
+
+void mi_set_xterm_exe(const char *name)
+{
+ free(xterm_exe);
+ xterm_exe=name ? strdup(name) : NULL;
+ mi_register_exit();
+}
+
+const char *mi_get_xterm_exe()
+{
+ if (!xterm_exe)
+   {/* Look for xterm in path */
+    xterm_exe=mi_search_in_path("xterm");
+    if (!xterm_exe)
+       return "/usr/bin/X11/xterm";
+   }
+ return xterm_exe;
+}
+
+void mi_set_main_func(const char *name)
+{
+ free(main_func);
+ main_func=name ? strdup(name) : NULL;
+ mi_register_exit();
+}
+
+const char *mi_get_main_func()
+{
+ if (main_func)
+    return main_func;
+ return "main";
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Opens a new xterm to be used by the child process to debug.
+  
+  Return: A new mi_aux_term structure, you can use gmi_end_aux_term to
+release it.
+  
+***************************************************************************/
+
+mi_aux_term *gmi_start_xterm()
+{
+ char nsh[14]="/tmp/shXXXXXX";
+ char ntt[14]="/tmp/ttXXXXXX";
+ const char *xterm;
+ struct stat st;
+ int hsh, htt=-1;
+ mi_aux_term *res=NULL;
+ FILE *f;
+ pid_t pid;
+ char buf[PATH_MAX];
+
+ /* Verify we have an X terminal. */
+ xterm=mi_get_xterm_exe();
+ if (access(xterm,X_OK))
+   {
+    mi_error=MI_MISSING_XTERM;
+    return NULL;
+   }
+
+ /* Create 2 temporals. */
+ hsh=mkstemp(nsh);
+ if (hsh==-1)
+   {
+    mi_error=MI_CREATE_TEMPORAL;
+    return NULL;
+   }
+ htt=mkstemp(ntt);
+ if (htt==-1)
+   {
+    close(hsh);
+    unlink(nsh);
+    mi_error=MI_CREATE_TEMPORAL;
+    return NULL;
+   }
+ close(htt);
+ /* Create the script. */
+ f=fdopen(hsh,"w");
+ if (!f)
+   {
+    close(hsh);
+    unlink(nsh);
+    unlink(ntt);
+    mi_error=MI_CREATE_TEMPORAL;
+    return NULL;
+   }
+ fprintf(f,"#!/bin/sh\n");
+ fprintf(f,"tty > %s\n",ntt);
+ fprintf(f,"rm %s\n",nsh);
+ fprintf(f,"sleep 365d\n");
+ fclose(f);
+ /* Spawn xterm. */
+ /* Create the child. */
+ pid=fork();
+ if (pid==0)
+   {/* We are the child. */
+    char *argv[5];
+    /* Pass the control to gdb. */
+    argv[0]=(char *)mi_get_xterm_exe(); /* Is that ok? */
+    argv[1]="-e";
+    argv[2]="/bin/sh";
+    argv[3]=nsh;
+    argv[4]=0;
+    execvp(argv[0],argv);
+    /* We get here only if exec failed. */
+    unlink(nsh);
+    unlink(ntt);
+    _exit(127);
+   }
+ /* We are the parent. */
+ if (pid==-1)
+   {/* Fork failed. */
+    unlink(nsh);
+    unlink(ntt);
+    mi_error=MI_FORK;
+    return NULL;
+   }
+ /* Wait until the shell is deleted. */
+ while (stat(nsh,&st)==0)
+   usleep(1000);
+ /* Try to read the tty name. */
+ f=fopen(ntt,"rt");
+ if (f)
+   {
+    if (fgets(buf,PATH_MAX,f))
+      {
+       char *s; /* Strip the \n. */
+       for (s=buf; *s && *s!='\n'; s++);
+       *s=0;
+       res=(mi_aux_term *)malloc(sizeof(mi_aux_term));
+       if (res)
+         {
+          res->pid=pid;
+          res->tty=strdup(buf);
+         }
+      }
+    fclose(f);
+   }
+ unlink(ntt);
+ return res;
+}
+
+void mi_free_aux_term(mi_aux_term *t)
+{
+ if (!t)
+    return;
+ free(t->tty);
+ free(t);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Closes the auxiliar terminal and releases the allocated memory.
+  
+***************************************************************************/
+
+void gmi_end_aux_term(mi_aux_term *t)
+{
+ if (!t)
+    return;
+ if (t->pid!=-1 && mi_check_running_pid(t->pid))
+    mi_kill_child(t->pid);
+ mi_free_aux_term(t);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Forces the MI version. Currently the library can't detect it so you must
+force it manually. GDB 5.x implemented MI v1 and 6.x v2.
+  
+***************************************************************************/
+
+void mi_force_version(mi_h *h, unsigned vMajor, unsigned vMiddle,
+                      unsigned vMinor)
+{
+ h->version=MI_VERSION2U(vMajor,vMiddle,vMinor);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Dis/Enables the workaround for a bug in gdb.
+
+***************************************************************************/
+
+void mi_set_workaround(unsigned wa, int enable)
+{
+ switch (wa)
+   {
+    case MI_PSYM_SEARCH:
+         disable_psym_search_workaround=enable ? 0 : 1;
+         break;
+   }
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Finds if the workaround for a bug in gdb is enabled.
+  
+  Return: !=0 if enabled.
+  
+***************************************************************************/
+
+int mi_get_workaround(unsigned wa)
+{
+ switch (wa)
+   {
+    case MI_PSYM_SEARCH:
+         return disable_psym_search_workaround==0;
+   }
+ return 0;
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_data_man.c (from 
rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_data_man.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_data_man.c           
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_data_man.c   
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,243 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Data manipulation.
+  Comments:
+  GDB/MI commands for the "Data manipulation" section.
+
+  @<p>
+
+@<pre>
+gdb command:                       Implemented?
+
+-data-disassemble                  Yes
+-data-evaluate-expression          Yes
+-data-list-changed-registers       No
+-data-list-register-names          Yes
+-data-list-register-values         No
+-data-read-memory                  No
+-display-delete                    N.A. (delete display)
+-display-disable                   N.A. (disable display)
+-display-enable                    N.A. (enable display)
+-display-insert                    N.A. (display)
+-display-list                      N.A. (info display)
+-environment-cd                    No
+-environment-directory             Yes, MI v1 implementation
+-environment-path                  No
+@</pre>
+
+Notes:  @<p>
+
+1) -display* aren't implemented. You can use CLI command display, but the
+results are sent to the console. So it looks like the best is to manually
+use -data-evaluate-expression to emulate it.  @<p>
+
+2) GDB bug mi/1770: Affects gdb<=6.2, when you ask for the names of the
+registers you get it plus the name of the "pseudo-registers", but if you
+try to get the value of a pseudo-register you get an error saying the
+register number is invalid. I reported to address@hidden
+on 2004/08/25 and as I didn't get any answer I filled a bug report on
+2004/09/02. The patch to fix this annoying bug is:
+
+Index: gdb/mi/mi-main.c
+===================================================================
+RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
+retrieving revision 1.64
+diff -u -r1.64 mi-main.c
+--- gdb/mi/mi-main.c    3 Aug 2004 00:57:27 -0000       1.64
++++ gdb/mi/mi-main.c    25 Aug 2004 14:12:50 -0000
+@@ -423,7 +423,7 @@
+      case, some entries of REGISTER_NAME will change depending upon
+      the particular processor being debugged.
+
+-  numregs = NUM_REGS;
++  numregs = NUM_REGS + NUM_PSEUDO_REGS;
+
+   if (argc == 0)
+     {
+----
+
+Note I had to remove an end of comment in the patch to include it here.
+This bug forced me to create another set of functions. The only way is to
+first get the values and then the names.
+Fixed by Changelog entry:
+
+2004-09-12  Salvador E. Tropea  <address@hidden>
+            Andrew Cagney  <address@hidden>
+
+        * mi/mi-main.c (mi_cmd_data_list_changed_registers)
+        (mi_cmd_data_list_register_values)
+        (mi_cmd_data_write_register_values): Include the PSEUDO_REGS in
+        the register number computation.
+
+***************************************************************************/
+
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_data_evaluate_expression(mi_h *h, const char *expression)
+{
+ mi_send(h,"-data-evaluate-expression \"%s\"\n",expression);
+}
+
+void mi_dir(mi_h *h, const char *path)
+{
+ if (h->version>=MI_VERSION2U(2,0,0))
+   {// MI v2
+    if (path)
+       mi_send(h,"-environment-directory \"%s\"\n",path);
+    else
+       mi_send(h,"-environment-directory -r\n");
+   }
+ else
+   {
+    mi_send(h,"-environment-directory %s\n",path ? path : "");
+   }
+}
+
+void mi_data_read_memory_hx(mi_h *h, const char *exp, unsigned ws,
+                            unsigned c, int convAddr)
+{
+ if (convAddr)
+    mi_send(h,"-data-read-memory \"&%s\" x %d 1 %d\n",exp,ws,c);
+ else
+    mi_send(h,"-data-read-memory \"%s\" x %d 1 %d\n",exp,ws,c);
+}
+
+void mi_data_disassemble_se(mi_h *h, const char *start, const char *end,
+                            int mode)
+{
+ mi_send(h,"-data-disassemble -s \"%s\" -e \"%s\" -- %d\n",start,end,mode);
+}
+
+void mi_data_disassemble_fl(mi_h *h, const char *file, int line, int lines,
+                            int mode)
+{
+ mi_send(h,"-data-disassemble -f \"%s\" -l %d -n %d -- %d\n",file,line,lines,
+         mode);
+}
+
+void mi_data_list_register_names(mi_h *h)
+{
+ mi_send(h,"-data-list-register-names\n");
+}
+
+void mi_data_list_register_names_l(mi_h *h, mi_chg_reg *l)
+{
+ mi_send(h,"-data-list-register-names ");
+ while (l)
+   {
+    mi_send(h,"%d ",l->reg);
+    l=l->next;
+   }
+ mi_send(h,"\n");
+}
+
+void mi_data_list_changed_registers(mi_h *h)
+{
+ mi_send(h,"-data-list-changed-registers\n");
+}
+
+void mi_data_list_register_values(mi_h *h, enum mi_gvar_fmt fmt, mi_chg_reg *l)
+{
+ mi_send(h,"-data-list-register-values %c ",mi_format_enum_to_char(fmt));
+ while (l)
+   {
+    mi_send(h,"%d ",l->reg);
+    l=l->next;
+   }
+ mi_send(h,"\n");
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  Evaluate an expression. Returns a parsed tree.
+
+  Command: -data-evaluate-expression
+  Return: The resulting value (as plain text) or NULL on error.
+  
+***************************************************************************/
+
+char *gmi_data_evaluate_expression(mi_h *h, const char *expression)
+{
+ mi_data_evaluate_expression(h,expression);
+ return mi_res_value(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Path for sources. You must use it to indicate where are the sources for
+the program to debug. Only the MI v1 implementation is available.
+
+  Command: -environment-directory
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_dir(mi_h *h, const char *path)
+{
+ mi_dir(h,path);
+ return mi_res_simple_done(h);
+}
+
+int gmi_read_memory(mi_h *h, const char *exp, unsigned size,
+                    unsigned char *dest, int *na, int convAddr,
+                    unsigned long *addr)
+{
+ mi_data_read_memory_hx(h,exp,1,size,convAddr);
+ return mi_get_read_memory(h,dest,1,na,addr);
+}
+
+mi_asm_insns *gmi_data_disassemble_se(mi_h *h, const char *start,
+                                      const char *end, int mode)
+{
+ mi_data_disassemble_se(h,start,end,mode);
+ return mi_get_asm_insns(h);
+}
+
+mi_asm_insns *gmi_data_disassemble_fl(mi_h *h, const char *file, int line,
+                                      int lines, int mode)
+{
+ mi_data_disassemble_fl(h,file,line,lines,mode);
+ return mi_get_asm_insns(h);
+}
+
+// Affected by gdb bug mi/1770
+mi_chg_reg *gmi_data_list_register_names(mi_h *h, int *how_many)
+{
+ mi_data_list_register_names(h);
+ return mi_get_list_registers(h,how_many);
+}
+
+int gmi_data_list_register_names_l(mi_h *h, mi_chg_reg *l)
+{
+ mi_data_list_register_names_l(h,l);
+ return mi_get_list_registers_l(h,l);
+}
+
+mi_chg_reg *gmi_data_list_changed_registers(mi_h *h)
+{
+ mi_error=MI_OK;
+ mi_data_list_changed_registers(h);
+ return mi_get_list_changed_regs(h);
+}
+
+int gmi_data_list_register_values(mi_h *h, enum mi_gvar_fmt fmt, mi_chg_reg *l)
+{
+ mi_data_list_register_values(h,fmt,l);
+ return mi_get_reg_values(h,l);
+}
+
+mi_chg_reg *gmi_data_list_all_register_values(mi_h *h, enum mi_gvar_fmt fmt, 
int *how_many)
+{
+ mi_data_list_register_values(h,fmt,NULL);
+ return mi_get_reg_values_l(h,how_many);
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_error.c (from 
rev 22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_error.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_error.c              
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_error.c      
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,38 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Error.
+  Comment:
+  Translates error numbers into messages.
+  
+***************************************************************************/
+
+#include "gdbmi.h"
+
+static
+const char *error_strs[]=
+{
+ "Ok",
+ "Out of memory",
+ "Pipe creation",
+ "Fork failed",
+ "GDB not running",
+ "Parser failed",
+ "Unknown asyn response",
+ "Unknown result response",
+ "Error from gdb",
+ "Time out in gdb response",
+ "GDB suddenly died",
+ "Can't execute X terminal",
+ "Failed to create temporal",
+ "Can't execute the debugger"
+};
+
+const char *mi_get_error_str()
+{
+ if (mi_error<0 || mi_error>MI_LAST_ERROR)
+    return "Unknown";
+ return error_strs[mi_error];
+}

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_pty.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_get_free_pty.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_pty.c       
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_pty.c       
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,132 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: pseudo terminal
+  Comments:
+  Helper to find a free pseudo terminal. Use this if you need to manage
+  input *and* output to the target process. If you just need output then
+  define a handler for target output stream records (assuming that this
+  is working for your particular version of gdb).
+  Usage:
+
+        mi_pty *pty = gmi_look_for_free_pty();
+        if (pty) gmi_target_terminal(mih, pty->slave);
+        ...
+        * reading from pty->master will get stdout from target *
+        * writing to pty->master will send to target stdin *
+        
+  Note: Contributed by Greg Watson (gwatson lanl gov)
+
+***************************************************************************/
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include "gdbmi.h"
+
+/**[txh]********************************************************************
+
+  Description:
+  Look for a free and usable pseudo terminal. Low level, use
+  gmi_look_for_free_pty().
+  
+  Return: A file descriptor connected to the master pty and the name of the 
slave device, or <0 on error.
+  
+***************************************************************************/
+
+#ifdef __APPLE__
+
+#include <util.h>
+
+int mi_look_for_free_pty(int *master, char **slave)
+{
+ int fdmaster;
+ int fdslave;
+ static char name[BUFSIZ];
+
+ if (openpty(&fdmaster,&fdslave,name,NULL,NULL)<0)
+    return -1;
+
+ (void)close(fdslave); /* this will be reopened by gdb */
+ *master=fdmaster;
+ *slave =name;
+
+ return 0;
+}
+
+#elif defined(__linux__)
+
+int mi_look_for_free_pty(int *master, char **slave)
+{
+ if ((*master=open("/dev/ptmx",O_RDWR))<0)
+    return -1;
+ if (grantpt(*master)<0 || unlockpt(*master)<0)
+    return -1;
+ *slave = ptsname(*master);
+
+ return 0;
+}
+
+#else /* undefined o/s */
+
+int mi_look_for_free_pty(int *master, char **slave)
+{
+ return -1;
+}
+#endif
+
+/**[txh]********************************************************************
+
+  Description:
+  Look for a free and usable pseudo terminal to be used by the child.
+  
+  Return: A new mi_pty structure, you can use gmi_end_pty to
+release it.
+  
+***************************************************************************/
+
+mi_pty *gmi_look_for_free_pty()
+{
+ int master;
+ char *slave;
+ int pty=mi_look_for_free_pty(&master,&slave);
+ mi_pty *res;
+
+ if (pty<0)
+    return NULL;
+ res=(mi_pty *)malloc(sizeof(mi_pty));
+ if (!res)
+    return NULL;
+ res->slave=strdup(slave);
+ res->master=master;
+ return res;
+}
+
+void mi_free_pty(mi_pty *p)
+{
+ if (!p)
+    return;
+ free(p->slave);
+ free(p);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Closes the pseudo termial master and releases the allocated memory.
+  
+***************************************************************************/
+
+void gmi_end_pty(mi_pty *p)
+{
+ if (!p)
+    return;
+ close(p->master);
+ mi_free_pty(p);
+}

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_vt.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_get_free_vt.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_vt.c        
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_get_free_vt.c        
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,156 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Linux VT.
+  Comments:
+  Helper to find a free VT. That's 100% Linux address@hidden
+  The code comes from "lconsole.c" from Allegro project and was originally
+created by Marek Habersack and then modified by George Foot. I addapted it
+to my needs and changed license from giftware to address@hidden
+  
+***************************************************************************/
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#ifdef __APPLE__
+#include <util.h>
+#endif /* __APPLE__ */
+
+#include "gdbmi.h"
+
+#if !defined(__linux__)
+
+int mi_look_for_free_vt()
+{
+ return -1;
+}
+
+mi_aux_term *gmi_look_for_free_vt()
+{
+ return NULL;
+}
+
+#else
+
+#include <linux/vt.h>
+
+/**[txh]********************************************************************
+
+  Description:
+  Look for a free and usable Linux VT. Low level, use
address@hidden
+  
+  Return: The VT number or <0 on error.
+  
+***************************************************************************/
+
+int mi_look_for_free_vt()
+{/* Code from Allegro. */
+ int tty, console_fd, fd;
+ unsigned short mask;
+ char tty_name[16];
+ struct vt_stat vts; 
+
+ /* Now we need to find a VT we can use.  It must be readable and
+  * writable by us, if we're not setuid root.  VT_OPENQRY itself
+  * isn't too useful because it'll only ever come up with one 
+  * suggestion, with no guarrantee that we actually have access 
+  * to it.
+  *
+  * At some stage I think this is a candidate for config
+  * file overriding, but for now we'll stat the first N consoles
+  * to see which ones we can write to (hopefully at least one!),
+  * so that we can use that one to do ioctls.  We used to use 
+  * /dev/console for that purpose but it looks like it's not 
+  * always writable by enough people.
+  *
+  * Having found and opened a writable device, we query the state
+  * of the first sixteen (fifteen really) consoles, and try 
+  * opening each unused one in turn.
+  */
+
+ console_fd=open("/dev/console",O_WRONLY);
+ if (console_fd<0)
+   {
+    int n;
+    /* Try some ttys instead... */
+    for (n=1; n<=24; n++)
+       {
+        snprintf(tty_name,sizeof(tty_name),"/dev/tty%d",n);
+        console_fd=open(tty_name,O_WRONLY);
+        if (console_fd>=0)
+           break;
+       }
+    if (n>24)
+       return -1;
+   }
+
+ /* Get the state of the console -- in particular, the free VT field */
+ if (ioctl(console_fd,VT_GETSTATE,&vts)) {
+        close(console_fd);
+    return -2;
+ }
+ close(console_fd);
+
+ /* We attempt to set our euid to 0; if we were run with euid 0 to
+  * start with, we'll be able to do this now.  Otherwise, we'll just
+  * ignore the error returned since it might not be a problem if the
+  * ttys we look at are owned by the user running the program. */
+ seteuid(0);
+
+ /* tty0 is not really a console, so start counting at 2. */
+ fd=-1;
+ for (tty=1, mask=2; mask; tty++, mask<<=1)
+     if (!(vts.v_state & mask))
+       {
+        snprintf(tty_name,sizeof(tty_name),"/dev/tty%d",tty);
+        fd=open(tty_name,O_RDWR);
+        if (fd!=-1)
+          {
+           close(fd);
+           break;
+          }
+       }
+
+ seteuid(getuid());
+
+ if (!mask)
+    return -3;
+
+ return tty;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Look for a free and usable Linux VT to be used by the child.
+  
+  Return: A new mi_aux_term structure, you can use @x{gmi_end_aux_term} to
+release it.
+  
+***************************************************************************/
+
+mi_aux_term *gmi_look_for_free_vt()
+{
+ int ret;
+ int vt=mi_look_for_free_vt();
+ mi_aux_term *res;
+
+ if (vt<0)
+    return NULL;
+ res=(mi_aux_term *)malloc(sizeof(mi_aux_term));
+ if (!res)
+    return NULL;
+ res->pid=-1;
+ ret = asprintf(&res->tty,"/dev/tty%d",vt);
+ return res;
+}
+
+#endif
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_misc.c (from rev 
22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_misc.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_misc.c               
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_misc.c       
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,118 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Miscellaneous commands.
+  Comments:
+  GDB/MI commands for the "Miscellaneous Commands" section.  @<p>
+
+@<pre>
+gdb command:       Implemented?
+
+-gdb-exit          Yes
+-gdb-set           Yes
+-gdb-show          Yes
+-gdb-version       Yes
+@</pre>
+
+GDB Bug workaround for "-gdb-show architecture": gdb 6.1 and olders doesn't
+report it in "value", but they give the output of "show architecture". In
+6.4 we observed that not even a clue is reported. So now we always use
+"show architecture".
+
+***************************************************************************/
+
+#include <string.h>
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_gdb_exit(mi_h *h)
+{
+ mi_send(h,"-gdb-exit\n");
+}
+
+void mi_gdb_version(mi_h *h)
+{
+ mi_send(h,"-gdb-version\n");
+}
+
+void mi_gdb_set(mi_h *h, const char *var, const char *val)
+{
+ mi_send(h,"-gdb-set %s %s\n",var,val);
+}
+
+void mi_gdb_show(mi_h *h, const char *var)
+{
+ if (strcmp(var,"architecture")==0)
+    mi_send(h,"show %s\n",var);
+ else
+    mi_send(h,"-gdb-show %s\n",var);
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  Exit gdb killing the child is it is running.
+
+  Command: -gdb-exit
+
+***************************************************************************/
+
+void gmi_gdb_exit(mi_h *h)
+{
+ mi_gdb_exit(h);
+ mi_res_simple_exit(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Send the version to the console.
+
+  Command: -gdb-version
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_gdb_version(mi_h *h)
+{
+ mi_gdb_version(h);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Set a gdb variable.
+
+  Command: -gdb-set
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_gdb_set(mi_h *h, const char *var, const char *val)
+{
+ mi_gdb_set(h,var,val);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Get a gdb variable.
+
+  Command: -gdb-show
+  Return: The current value of the variable or NULL on error.
+  
+***************************************************************************/
+
+char *gmi_gdb_show(mi_h *h, const char *var)
+{
+ mi_gdb_show(h,var);
+ return mi_res_value(h);
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_parse.c (from 
rev 22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_parse.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_parse.c              
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_parse.c      
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,1927 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004-2007 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Parser.
+  Comments:
+  Parses the output of gdb. It basically converts the text from gdb into a
+tree (could be a complex one) that we can easily interpret using C code.
+  
+***************************************************************************/
+
+#include <ctype.h>
+#include <string.h>
+#include <assert.h>
+#include "gdbmi.h"
+
+mi_results *mi_get_result(const char *str, const char **end);
+int mi_get_value(mi_results *r, const char *str, const char **end);
+
+
+/* GDB BUG!!!! I got:
+^error,msg="Problem parsing arguments: data-evaluate-expression ""1+2"""
+Afects gdb 2002-04-01-cvs and 6.1.1 for sure.
+That's an heuristical workaround.
+*/
+static inline
+int EndOfStr(const char *s)
+{
+ if (*s=='"')
+   {
+    s++;
+    return !*s || *s==',' || *s==']' || *s=='}';
+   }
+ return 0;
+}
+
+int mi_get_cstring_r(mi_results *r, const char *str, const char **end)
+{
+ const char *s;
+ char *d;
+ int len;
+
+ if (*str!='"')
+   {
+    mi_error=MI_PARSER;
+    return 0;
+   }
+ str++;
+ /* Meassure. */
+ for (s=str, len=0; *s && !EndOfStr(s); s++)
+    {
+        if (!*s) {
+                mi_error = MI_PARSER;
+                return 0;
+        }
+     if (*s=='\\')
+        s++;
+     len++;
+    }
+ /* Copy. */
+ r->type=t_const;
+ d=r->v.cstr=mi_malloc(len+1);
+ if (!r->v.cstr)
+    return 0;
+ for (s=str; *s && !EndOfStr(s); s++, d++)
+    {
+     if (*s=='\\')
+       {
+        s++;
+        switch (*s)
+          {
+           case 'n':
+                *d='\n';
+                break;
+           case 't':
+                *d='\t';
+                break;
+           default:
+                *d=*s;
+          }
+       }
+     else
+        *d=*s;
+    }
+ *d=0;
+ if (end)
+    *end=s+1;
+
+ return 1;
+}
+
+/* TODO: What's a valid variable name?
+   I'll assume a-zA-Z0-9_- */
+inline
+int mi_is_var_name_char(char c)
+{
+ return isalnum(c) || c=='-' || c=='_';
+}
+
+char *mi_get_var_name(const char *str, const char **end)
+{
+ const char *s;
+ char *r;
+ int l;
+ /* Meassure. */
+ for (s=str; *s && mi_is_var_name_char(*s); s++);
+ if (*s!='=')
+   {
+    mi_error=MI_PARSER;
+    return NULL;
+   }
+ /* Allocate. */
+ l=s-str;
+ r=mi_malloc(l+1);
+ /* Copy. */
+ if (NULL != r) {
+        memcpy(r,str,l);
+        r[l]=0;
+ }
+ if (end)
+    *end=s+1;
+ return r;
+}
+
+
+int mi_get_list_res(mi_results *r, const char *str, const char **end, char 
closeC)
+{
+ mi_results *last_r, *rs;
+
+ last_r=NULL;
+ do
+   {
+    rs=mi_get_result(str,&str);
+    if (last_r)
+       last_r->next=rs;
+    else
+       r->v.rs=rs;
+    last_r=rs;
+    if (*str==closeC)
+      {
+       *end=str+1;
+       return 1;
+      }
+    if (*str!=',')
+       break;
+    str++;
+   }
+ while (1);
+
+ mi_error=MI_PARSER;
+ return 0;
+}
+
+#ifdef __APPLE__
+int mi_get_tuple_val(mi_results *r, const char *str, const char **end)
+{
+ mi_results *last_r, *rs;
+
+ last_r=NULL;
+ do
+   {
+    rs=mi_alloc_results();
+    if (!rs || !mi_get_value(rs,str,&str))
+      {
+       mi_free_results(rs);
+       return 0;
+      }
+    /* Note that rs->var is NULL, that indicates that's just a value and not
+       a result. */
+    if (last_r)
+       last_r->next=rs;
+    else
+       r->v.rs=rs;
+    last_r=rs;
+    if (*str=='}')
+      {
+       *end=str+1;
+       return 1;
+      }
+    if (*str!=',')
+       break;
+    str++;
+   }
+ while (1);
+
+ mi_error=MI_PARSER;
+ return 0;
+}
+#endif /* __APPLE__ */
+
+int mi_get_tuple(mi_results *r, const char *str, const char **end)
+{
+ if (*str!='{')
+   {
+    mi_error=MI_PARSER;
+    return 0;
+   }
+ r->type=t_tuple;
+ str++;
+ if (*str=='}')
+   {/* Special case: empty tuple */
+    *end=str+1;
+    return 1;
+   }
+ #ifdef __APPLE__
+ if (mi_is_var_name_char(*str))
+    return mi_get_list_res(r,str,end,'}');
+ return mi_get_tuple_val(r,str,end);
+ #else /* __APPLE__ */
+ return mi_get_list_res(r,str,end,'}');
+ #endif /* __APPLE__ */
+}
+
+int mi_get_list_val(mi_results *r, const char *str, const char **end)
+{
+ mi_results *last_r, *rs;
+
+ last_r=NULL;
+ do
+   {
+    rs=mi_alloc_results();
+    if (!rs || !mi_get_value(rs,str,&str))
+      {
+       mi_free_results(rs);
+       return 0;
+      }
+    /* Note that rs->var is NULL, that indicates that's just a value and not
+       a result. */
+    if (last_r)
+       last_r->next=rs;
+    else
+       r->v.rs=rs;
+    last_r=rs;
+    if (*str==']')
+      {
+       *end=str+1;
+       return 1;
+      }
+    if (*str!=',')
+       break;
+    str++;
+   }
+ while (1);
+
+ mi_error=MI_PARSER;
+ return 0;
+}
+
+int mi_get_list(mi_results *r, const char *str, const char **end)
+{
+ if (*str!='[')
+   {
+    mi_error=MI_PARSER;
+    return 0;
+   }
+ r->type=t_list;
+ str++;
+ if (*str==']')
+   {/* Special case: empty list */
+    *end=str+1;
+    return 1;
+   }
+ /* Comment: I think they could choose () for values. Is confusing in this 
way. */
+ if (mi_is_var_name_char(*str))
+    return mi_get_list_res(r,str,end,']');
+ return mi_get_list_val(r,str,end);
+}
+
+int mi_get_value(mi_results *r, const char *str, const char **end)
+{
+ switch (str[0])
+   {
+    case '"':
+         return mi_get_cstring_r(r,str,end);
+    case '{':
+         return mi_get_tuple(r,str,end);
+    case '[':
+         return mi_get_list(r,str,end);
+   }
+ mi_error=MI_PARSER;
+ return 0;
+}
+
+mi_results *mi_get_result(const char *str, const char **end)
+{
+ char *var;
+ mi_results *r;
+
+ var=mi_get_var_name(str,&str);
+ if (!var)
+    return NULL;
+
+ r=mi_alloc_results();
+ if (!r)
+   {
+    free(var);
+    return NULL;
+   }
+ r->var=var;
+
+ if (!mi_get_value(r,str,end))
+   {
+    mi_free_results(r);
+    return NULL;
+   }
+
+ return r;
+}
+
+mi_output *mi_get_results_alone(mi_output *r,const char *str)
+{
+ mi_results *last_r, *rs;
+
+ /* * results */
+ last_r=NULL;
+ do
+   {
+    if (!*str)
+       return r;
+    if (*str!=',')
+      {
+       mi_error=MI_PARSER;
+       break;
+      }
+    str++;
+    rs=mi_get_result(str,&str);
+    if (!rs)
+       break;
+    if (!last_r)
+       r->c=rs;
+    else
+       last_r->next=rs;
+    last_r=rs;
+   }
+ while (1);
+ mi_free_output(r);
+ return NULL;
+}
+
+mi_output *mi_parse_result_record(mi_output *r,const char *str)
+{
+ r->type=MI_T_RESULT_RECORD;
+
+ /* Solve the result-class. */
+ if (strncmp(str,"done",4)==0)
+   {
+    str+=4;
+    r->tclass=MI_CL_DONE;
+   }
+ else if (strncmp(str,"running",7)==0)
+   {
+    str+=7;
+    r->tclass=MI_CL_RUNNING;
+   }
+ else if (strncmp(str,"connected",9)==0)
+   {
+    str+=9;
+    r->tclass=MI_CL_CONNECTED;
+   }
+ else if (strncmp(str,"error",5)==0)
+   {
+    str+=5;
+    r->tclass=MI_CL_ERROR;
+   }
+ else if (strncmp(str,"exit",4)==0)
+   {
+    str+=4;
+    r->tclass=MI_CL_EXIT;
+   }
+ else
+   {
+    mi_error=MI_UNKNOWN_RESULT;
+    return NULL;
+   }
+
+ return mi_get_results_alone(r,str);
+}
+
+mi_output *mi_parse_asyn(mi_output *r,const char *str)
+{
+ r->type=MI_T_OUT_OF_BAND;
+ r->stype=MI_ST_ASYNC;
+ /* async-class. */
+ if (strncmp(str,"stopped",7)==0)
+   {
+    r->tclass=MI_CL_STOPPED;
+    str+=7;
+    return mi_get_results_alone(r,str);
+   }
+ if (strncmp(str,"download",8)==0)
+   {
+    r->tclass=MI_CL_DOWNLOAD;
+    str+=8;
+    return mi_get_results_alone(r,str);
+   }
+ mi_error=MI_UNKNOWN_ASYNC;
+ mi_free_output(r);
+ return NULL;
+}
+
+mi_output *mi_parse_exec_asyn(mi_output *r,const char *str)
+{
+ r->sstype=MI_SST_EXEC;
+ return mi_parse_asyn(r,str);
+}
+
+mi_output *mi_parse_status_asyn(mi_output *r,const char *str)
+{
+ r->sstype=MI_SST_STATUS;
+ return mi_parse_asyn(r,str);
+}
+
+mi_output *mi_parse_notify_asyn(mi_output *r,const char *str)
+{
+ r->sstype=MI_SST_NOTIFY;
+ return mi_parse_asyn(r,str);
+}
+
+mi_output *mi_console(mi_output *r,const char *str)
+{
+ r->type=MI_T_OUT_OF_BAND;
+ r->stype=MI_ST_STREAM;
+ r->c=mi_alloc_results();
+ if (!r->c || !mi_get_cstring_r(r->c,str,NULL))
+   {
+    mi_free_output(r);
+    return NULL;
+   }
+ return r;
+}
+
+mi_output *mi_console_stream(mi_output *r,const char *str)
+{
+ r->sstype=MI_SST_CONSOLE;
+ return mi_console(r,str);
+}
+
+mi_output *mi_target_stream(mi_output *r,const char *str)
+{
+ r->sstype=MI_SST_TARGET;
+ return mi_console(r,str);
+}
+
+mi_output *mi_log_stream(mi_output *r,const char *str)
+{
+ r->sstype=MI_SST_LOG;
+ return mi_console(r,str);
+}
+
+mi_output *mi_parse_gdb_output(const char *str)
+{
+ char type=str[0];
+
+ mi_output *r=mi_alloc_output();
+ if (!r)
+   {
+    mi_error=MI_OUT_OF_MEMORY;
+    return NULL;
+   }
+ str++;
+ switch (type)
+   {
+    case '^':
+         return mi_parse_result_record(r,str);
+    case '*':
+         return mi_parse_exec_asyn(r,str);
+    case '+':
+         return mi_parse_status_asyn(r,str);
+    case '=':
+         return mi_parse_notify_asyn(r,str);
+    case '~':
+         return mi_console_stream(r,str);
+    case '@':
+         return mi_target_stream(r,str);
+    case '&':
+         return mi_log_stream(r,str);
+   }   
+ mi_error=MI_PARSER;
+ return NULL;
+}
+
+mi_output *mi_get_rrecord(mi_output *r)
+{
+ if (!r)
+    return NULL;
+ while (r)
+   {
+    if (r->type==MI_T_RESULT_RECORD)
+       return r;
+    r=r->next;
+   }
+ return r;
+}
+
+mi_results *mi_get_var_r(mi_results *r, const char *var)
+{
+ while (r)
+   {
+    if (strcmp(r->var,var)==0)
+       return r;
+    r=r->next;
+   }
+ return NULL;
+}
+
+mi_results *mi_get_var(mi_output *res, const char *var)
+{
+ if (!res)
+    return NULL;
+ return mi_get_var_r(res->c,var);
+}
+
+int mi_get_async_stop_reason(mi_output *r, char **reason)
+{
+ int found_stopped=0;
+
+ *reason=NULL;
+ while (r)
+   {
+    if (r->type==MI_T_RESULT_RECORD && r->tclass==MI_CL_ERROR)
+      {
+       if (r->c->type==t_const)
+          *reason=r->c->v.cstr;
+       return 0;
+      }
+    if (r->type==MI_T_OUT_OF_BAND && r->stype==MI_ST_ASYNC &&
+        r->sstype==MI_SST_EXEC && r->tclass==MI_CL_STOPPED)
+      {
+       mi_results *p=r->c;
+       found_stopped=1;
+       while (p)
+         {
+          if (strcmp(p->var,"reason")==0)
+            {
+             *reason=p->v.cstr;
+             return 1;
+            }
+          p=p->next;
+         }
+      }
+    r=r->next;
+   }
+ if (*reason==NULL && found_stopped)
+   {
+    *reason=strdup("unknown (temp bkpt?)");
+    return 1;
+   }
+ return 0;
+}
+
+mi_frames *mi_get_async_frame(mi_output *r)
+{
+ while (r)
+   {
+    if (r->type==MI_T_OUT_OF_BAND && r->stype==MI_ST_ASYNC &&
+        r->sstype==MI_SST_EXEC && r->tclass==MI_CL_STOPPED)
+      {
+       mi_results *p=r->c;
+       while (p)
+         {
+          if (strcmp(p->var,"frame")==0)
+             return mi_parse_frame(p->v.rs);
+          p=p->next;
+         }
+      }
+    r=r->next;
+   }
+ return NULL;
+}
+
+int mi_res_simple(mi_h *h, int tclass, int accert_ret)
+{
+ mi_output *r, *res;
+ int ret=0;
+
+ r=mi_get_response_blk(h);
+ res=mi_get_rrecord(r);
+
+ if (res)
+    ret=res->tclass==tclass;
+ mi_free_output(r);
+
+ return ret;
+}
+
+
+int mi_res_simple_done(mi_h *h)
+{
+ return mi_res_simple(h,MI_CL_DONE,0);
+}
+
+int mi_res_simple_exit(mi_h *h)
+{
+ return mi_res_simple(h,MI_CL_EXIT,1);
+}
+
+int mi_res_simple_running(mi_h *h)
+{
+ return mi_res_simple(h,MI_CL_RUNNING,0);
+}
+
+int mi_res_simple_connected(mi_h *h)
+{
+ return mi_res_simple(h,MI_CL_CONNECTED,0);
+}
+
+mi_results *mi_res_var(mi_h *h, const char *var, int tclass)
+{
+ mi_output *r, *res;
+ mi_results *the_var=NULL;
+
+ r=mi_get_response_blk(h);
+ /* All the code that follows is "NULL" tolerant. */
+ /* Look for the result-record. */
+ res=mi_get_rrecord(r);
+ /* Look for the desired var. */
+ if (res && res->tclass==tclass)
+    the_var=mi_get_var(res,var);
+ /* Release all but the one we want. */
+ mi_free_output_but(r,NULL,the_var);
+ return the_var;
+}
+
+mi_results *mi_res_done_var(mi_h *h, const char *var)
+{
+ return mi_res_var(h,var,MI_CL_DONE);
+}
+
+mi_frames *mi_parse_frame(mi_results *c)
+{
+ mi_frames *res=mi_alloc_frames();
+ char *end;
+
+ if (res)
+   {
+    while (c)
+      {
+       if (c->type==t_const)
+         {
+          if (strcmp(c->var,"level")==0)
+             res->level=atoi(c->v.cstr);
+          else if (strcmp(c->var,"addr")==0)
+             res->addr=(void *)strtoul(c->v.cstr,&end,0);
+          else if (strcmp(c->var,"func")==0)
+            {
+             res->func=c->v.cstr;
+             c->v.cstr=NULL;
+            }
+          else if (strcmp(c->var,"file")==0)
+            {
+             res->file=c->v.cstr;
+             c->v.cstr=NULL;
+            }
+          else if (strcmp(c->var,"from")==0)
+            {
+             res->from=c->v.cstr;
+             c->v.cstr=NULL;
+            }
+          else if (strcmp(c->var,"line")==0)
+             res->line=atoi(c->v.cstr);
+         }
+       else if (c->type==t_list && strcmp(c->var,"args")==0)
+         {
+          res->args=c->v.rs;
+          c->v.rs=NULL;
+         }
+       c=c->next;
+      }
+   }
+ return res;
+}
+
+mi_frames *mi_res_frame(mi_h *h)
+{
+ mi_results *r=mi_res_done_var(h,"frame");
+ mi_frames *f=NULL;
+
+ if (r && r->type==t_tuple)
+    f=mi_parse_frame(r->v.rs);
+ mi_free_results(r);
+ return f;
+}
+
+mi_frames *mi_res_frames_array(mi_h *h, const char *var)
+{
+ mi_results *r=mi_res_done_var(h,var), *c;
+ mi_frames *res=NULL, *nframe, *last=NULL;
+
+ if (!r)
+    return NULL;
+#ifdef __APPLE__
+ if (r->type!=t_list && r->type!=t_tuple)
+#else
+ if (r->type!=t_list)
+#endif
+   {
+    mi_free_results(r);
+    return NULL;
+   }
+ c=r->v.rs;
+ while (c)
+   {
+    if (strcmp(c->var,"frame")==0 && c->type==t_tuple)
+      {
+       nframe=mi_parse_frame(c->v.rs);
+       if (nframe)
+         {
+          if (!last)
+             res=nframe;
+          else
+             last->next=nframe;
+          last=nframe;
+         }
+      }
+    c=c->next;
+   }
+ mi_free_results(r);
+ return res;
+}
+
+mi_frames *mi_res_frames_list(mi_h *h)
+{
+ mi_output *r, *res;
+ mi_frames *ret=NULL, *nframe, *last=NULL;
+ mi_results *c;
+
+ r=mi_get_response_blk(h);
+ res=mi_get_rrecord(r);
+ if (res && res->tclass==MI_CL_DONE)
+   {
+    c=res->c;
+    while (c)
+      {
+       if (strcmp(c->var,"frame")==0 && c->type==t_tuple)
+         {
+          nframe=mi_parse_frame(c->v.rs);
+          if (nframe)
+            {
+             if (!last)
+                ret=nframe;
+             else
+                last->next=nframe;
+             last=nframe;
+            }
+         }
+       c=c->next;
+      }
+   }
+ mi_free_output(r);
+ return ret;
+}
+
+int mi_get_thread_ids(mi_output *res, int **list)
+{
+ mi_results *vids, *lids;
+ int ids=-1, i;
+
+ *list=NULL;
+ vids=mi_get_var(res,"number-of-threads");
+ lids=mi_get_var(res,"thread-ids");
+ if (vids && vids->type==t_const &&
+     lids && lids->type==t_tuple)
+   {
+    ids=atoi(vids->v.cstr);
+    if (ids)
+      {
+       int *lst;
+       lst=(int *)mi_calloc(ids,sizeof(int));
+       if (lst)
+         {
+          lids=lids->v.rs;
+          i=0;
+          while (lids)
+            {
+             if (strcmp(lids->var,"thread-id")==0 && lids->type==t_const)
+                lst[i++]=atoi(lids->v.cstr);
+             lids=lids->next;
+            }
+          *list=lst;
+         }
+       else
+          ids=-1;
+      }
+   }
+ return ids;
+}
+
+int mi_res_thread_ids(mi_h *h, int **list)
+{
+ mi_output *r, *res;
+ int ids=-1;
+
+ r=mi_get_response_blk(h);
+ res=mi_get_rrecord(r);
+ if (res && res->tclass==MI_CL_DONE)
+    ids=mi_get_thread_ids(res,list);
+ mi_free_output(r);
+ return ids;
+}
+
+enum mi_gvar_lang mi_lang_str_to_enum(const char *lang)
+{
+ enum mi_gvar_lang lg=lg_unknown;
+
+ if (strcmp(lang,"C")==0)
+    lg=lg_c;
+ else if (strcmp(lang,"C++")==0)
+    lg=lg_cpp;
+ else if (strcmp(lang,"Java")==0)
+    lg=lg_java;
+
+ return lg;
+}
+
+const char *mi_lang_enum_to_str(enum mi_gvar_lang lang)
+{
+ const char *lg;
+
+ switch (lang)
+   {
+    case lg_c:
+         lg="C";
+         break;
+    case lg_cpp:
+         lg="C++";
+         break;
+    case lg_java:
+         lg="Java";
+         break;
+    /*case lg_unknown:*/
+    default:
+         lg="unknown";
+         break;
+   }
+ return lg;
+}
+
+enum mi_gvar_fmt mi_format_str_to_enum(const char *format)
+{
+ enum mi_gvar_fmt fmt=fm_natural;
+
+ if (strcmp(format,"binary")==0)
+    fmt=fm_binary;
+ else if (strcmp(format,"decimal")==0)
+    fmt=fm_decimal;
+ else if (strcmp(format,"hexadecimal")==0)
+    fmt=fm_hexadecimal;
+ else if (strcmp(format,"octal")==0)
+    fmt=fm_octal;
+
+ return fmt;
+}
+
+const char *mi_format_enum_to_str(enum mi_gvar_fmt format)
+{
+ const char *fmt;
+
+ switch (format)
+   {
+    case fm_natural:
+         fmt="natural";
+         break;
+    case fm_binary:
+         fmt="binary";
+         break;
+    case fm_decimal:
+         fmt="decimal";
+         break;
+    case fm_hexadecimal:
+         fmt="hexadecimal";
+         break;
+    case fm_octal:
+         fmt="octal";
+         break;
+    case fm_raw:
+         fmt="raw";
+         break;
+    default:
+         fmt="unknown";
+   }
+ return fmt;
+}
+
+char mi_format_enum_to_char(enum mi_gvar_fmt format)
+{
+ char fmt;
+
+ switch (format)
+   {
+    case fm_natural:
+         fmt='N';
+         break;
+    case fm_binary:
+         fmt='t';
+         break;
+    case fm_decimal:
+         fmt='d';
+         break;
+    case fm_hexadecimal:
+         fmt='x';
+         break;
+    case fm_octal:
+         fmt='o';
+         break;
+    case fm_raw:
+         fmt='r';
+         break;
+    default:
+         fmt=' ';
+   }
+ return fmt;
+}
+
+mi_gvar *mi_get_gvar(mi_output *o, mi_gvar *cur, const char *expression)
+{
+ mi_results *r;
+ mi_gvar *res=cur ? cur : mi_alloc_gvar();
+ int l;
+
+ if (!res)
+    return res;
+ r=o->c;
+ if (expression)
+    res->exp=strdup(expression);
+ while (r)
+   {
+    if (r->type==t_const)
+      {
+       if (strcmp(r->var,"name")==0)
+         {
+          free(res->name);
+          res->name=r->v.cstr;
+          r->v.cstr=NULL;
+         }
+       else if (strcmp(r->var,"numchild")==0)
+         {
+          res->numchild=atoi(r->v.cstr);
+         }
+       else if (strcmp(r->var,"type")==0)
+         {
+          free(res->type);
+          res->type=r->v.cstr;
+          r->v.cstr=NULL;
+          l=strlen(res->type);
+          if (l && res->type[l-1]=='*')
+             res->ispointer=1;
+         }
+       else if (strcmp(r->var,"lang")==0)
+         {
+          res->lang=mi_lang_str_to_enum(r->v.cstr);
+         }
+       else if (strcmp(r->var,"exp")==0)
+         {
+          free(res->exp);
+          res->exp=r->v.cstr;
+          r->v.cstr=NULL;
+         }
+       else if (strcmp(r->var,"format")==0)
+         {
+          res->format=mi_format_str_to_enum(r->v.cstr);
+         }
+       else if (strcmp(r->var,"attr")==0)
+         { /* Note: gdb 6.1.1 have only this: */
+          if (strcmp(r->v.cstr,"editable")==0)
+             res->attr=MI_ATTR_EDITABLE;
+          else /* noneditable */
+             res->attr=MI_ATTR_NONEDITABLE;
+         }
+      }
+    r=r->next;
+   }
+ return res;
+}
+
+mi_gvar *mi_res_gvar(mi_h *h, mi_gvar *cur, const char *expression)
+{
+ mi_output *r, *res;
+ mi_gvar *gvar=NULL;
+
+ r=mi_get_response_blk(h);
+ res=mi_get_rrecord(r);
+ if (res && res->tclass==MI_CL_DONE)
+    gvar=mi_get_gvar(res,cur,expression);
+ mi_free_output(r);
+ return gvar;
+}
+
+mi_gvar_chg *mi_get_gvar_chg(mi_results *r)
+{
+ mi_gvar_chg *n;
+
+ if (r->type!=t_const)
+    return NULL;
+ n=mi_alloc_gvar_chg();
+ if (n)
+   {
+    while (r)
+      {
+       if (r->type==t_const)
+         {
+          if (strcmp(r->var,"name")==0)
+            {
+             n->name=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if (strcmp(r->var,"in_scope")==0)
+            {
+             n->in_scope=strcmp(r->v.cstr,"true")==0;
+            }
+          else if (strcmp(r->var,"new_type")==0)
+            {
+             n->new_type=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if (strcmp(r->var,"new_num_children")==0)
+            {
+             n->new_num_children=atoi(r->v.cstr);
+            }
+          // type_changed="false" is the default
+         }
+       r=r->next;
+      }
+   }
+ return n;
+}
+
+int mi_res_changelist(mi_h *h, mi_gvar_chg **changed)
+{
+ mi_gvar_chg *last, *n;
+ mi_results *res=mi_res_done_var(h,"changelist"), *r;
+ int count=0;
+
+ *changed=NULL;
+ if (!res)
+    return 0;
+ last=NULL;
+ count=1;
+ n=NULL;
+ r=res->v.rs;
+
+ if (res->type==t_list)
+   {// MI v2 a list of tuples
+    while (r)
+      {
+       if (r->type==t_tuple)
+         {
+          n=mi_get_gvar_chg(r->v.rs);
+          if (n)
+            {
+             if (last)
+                last->next=n;
+             else
+                *changed=n;
+             last=n;
+             count++;
+            }
+         }
+       r=r->next;
+      }
+   }
+ else if (res->type==t_tuple)
+   {// MI v1 a tuple with all together *8-P
+    while (r)
+      {
+       if (r->type==t_const) /* Just in case. */
+         {/* Get one var. */
+          if (strcmp(r->var,"name")==0)
+            {
+             if (n)
+               {/* Add to the list*/
+                if (last)
+                   last->next=n;
+                else
+                   *changed=n;
+                last=n;
+                count++;
+               }
+             n=mi_alloc_gvar_chg();
+             if (!n)
+               {
+                mi_free_gvar_chg(*changed);
+                return 0;
+               }
+             n->name=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if ((NULL != n) && (strcmp(r->var,"in_scope")==0))
+            {
+             n->in_scope=strcmp(r->v.cstr,"true")==0;
+            }
+          else if ((NULL != n) && (strcmp(r->var,"new_type")==0))
+            {
+             n->new_type=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if ((NULL != n) && (strcmp(r->var,"new_num_children")==0))
+            {
+             n->new_num_children=atoi(r->v.cstr);
+            }
+          // type_changed="false" is the default
+         }
+       r=r->next;
+      }
+    if (n)
+      {/* Add to the list*/
+       if (last)
+          last->next=n;
+       else
+          *changed=n;
+       last=n;
+       count++;
+      }
+   }
+ mi_free_results(res);
+
+ return count;
+}
+
+int mi_get_children(mi_results *ch, mi_gvar *v)
+{
+ mi_gvar *cur=NULL, *aux;
+ int i=0, count=v->numchild, l;
+
+ while (ch)
+   {
+    if (strcmp(ch->var,"child")==0 && ch->type==t_tuple && i<count)
+      {
+       mi_results *r=ch->v.rs;
+       aux=mi_alloc_gvar();
+       if (!aux)
+          return 0;
+       if (!v->child)
+          v->child=aux;
+       else if (NULL != cur)
+          cur->next=aux;
+       cur=aux;
+       cur->parent=v;
+       cur->depth=v->depth+1;
+
+       while (r)
+         {
+          if (r->type==t_const)
+            {
+             if (strcmp(r->var,"name")==0)
+               {
+                cur->name=r->v.cstr;
+                r->v.cstr=NULL;
+               }
+             else if (strcmp(r->var,"exp")==0)
+               {
+                cur->exp=r->v.cstr;
+                r->v.cstr=NULL;
+               }
+             else if (strcmp(r->var,"type")==0)
+               {
+                cur->type=r->v.cstr;
+                r->v.cstr=NULL;
+                l=strlen(cur->type);
+                if (l && cur->type[l-1]=='*')
+                   cur->ispointer=1;
+               }
+             else if (strcmp(r->var,"value")==0)
+               {
+                cur->value=r->v.cstr;
+                r->v.cstr=NULL;
+               }                     
+             else if (strcmp(r->var,"numchild")==0)
+               {
+                cur->numchild=atoi(r->v.cstr);
+               }
+            }
+          r=r->next;
+         }
+       i++;
+      }
+    ch=ch->next;
+   }
+ v->vischild=i;
+ v->opened=1;
+ return i==v->numchild;
+}
+
+int mi_res_children(mi_h *h, mi_gvar *v)
+{
+ mi_output *r, *res;
+ int ok=0;
+
+ r=mi_get_response_blk(h);
+ res=mi_get_rrecord(r);
+ if (res && res->tclass==MI_CL_DONE)
+   {
+    mi_results *num=mi_get_var(res,"numchild");
+    if (num && num->type==t_const)
+      {
+       v->numchild=atoi(num->v.cstr);
+       if (v->child)
+         {
+          mi_free_gvar(v->child);
+          v->child=NULL;
+         }
+       if (v->numchild)
+         {
+          mi_results *ch =mi_get_var(res,"children");
+          if (ch && ch->type!=t_const) /* MI v1 tuple, MI v2 list */
+             ok=mi_get_children(ch->v.rs,v);
+         }
+       else
+          ok=1;
+      }
+   }
+ mi_free_output(r);
+ return ok;
+}
+
+mi_bkpt *mi_get_bkpt(mi_results *p)
+{
+ mi_bkpt *res;
+ char *end;
+
+ res=mi_alloc_bkpt();
+ if (!res)
+    return NULL;
+ while (p)
+   {
+    if (p->type==t_const && p->var)
+      {
+       if (strcmp(p->var,"number")==0)
+          res->number=atoi(p->v.cstr);
+       else if (strcmp(p->var,"type")==0)
+         {
+          if (strcmp(p->v.cstr,"breakpoint")==0)
+             res->type=t_breakpoint;
+          else
+             res->type=t_unknown;
+         }
+       else if (strcmp(p->var,"disp")==0)
+         {
+          if (strcmp(p->v.cstr,"keep")==0)
+             res->disp=d_keep;
+          else if (strcmp(p->v.cstr,"del")==0)
+             res->disp=d_del;
+          else
+             res->disp=d_unknown;
+         }
+       else if (strcmp(p->var,"enabled")==0)
+          res->enabled=p->v.cstr[0]=='y';
+       else if (strcmp(p->var,"addr")==0)
+          res->addr=(void *)strtoul(p->v.cstr,&end,0);
+       else if (strcmp(p->var,"func")==0)
+         {
+          res->func=p->v.cstr;
+          p->v.cstr=NULL;
+         }
+       else if (strcmp(p->var,"file")==0)
+         {
+          res->file=p->v.cstr;
+          p->v.cstr=NULL;
+         }
+       else if (strcmp(p->var,"line")==0)
+          res->line=atoi(p->v.cstr);
+       else if (strcmp(p->var,"times")==0)
+          res->times=atoi(p->v.cstr);
+       else if (strcmp(p->var,"ignore")==0)
+          res->ignore=atoi(p->v.cstr);
+       else if (strcmp(p->var,"cond")==0)
+         {
+          res->cond=p->v.cstr;
+          p->v.cstr=NULL;
+         }
+      }
+    p=p->next;
+   }
+ return res;
+}
+
+mi_bkpt *mi_res_bkpt(mi_h *h)
+{
+ mi_results *r=mi_res_done_var(h,"bkpt");
+ mi_bkpt *b=NULL;
+
+ if (r && r->type==t_tuple)
+    b=mi_get_bkpt(r->v.rs);
+ mi_free_results(r);
+ return b;
+}
+
+mi_wp *mi_get_wp(mi_results *p, enum mi_wp_mode m)
+{
+ mi_wp *res=mi_alloc_wp();
+
+ if (res)
+   {
+    res->mode=m;
+    while (p)
+      {
+       if (p->type==t_const && p->var)
+         {
+          if (strcmp(p->var,"number")==0)
+            {
+             res->number=atoi(p->v.cstr);
+             res->enabled=1;
+            }
+          else if (strcmp(p->var,"exp")==0)
+            {
+             res->exp=p->v.cstr;
+             p->v.cstr=NULL;
+            }
+         }
+       p=p->next;
+      }
+   }
+ return res;
+}
+
+mi_wp *mi_parse_wp_res(mi_output *r)
+{
+ mi_results *p;
+ enum mi_wp_mode m=wm_unknown;
+
+ /* The info is in a result wpt=... */
+ p=r->c;
+ while (p)
+   {
+    if (p->var)
+      {
+       if (strcmp(p->var,"wpt")==0)
+          m=wm_write;
+       else if (strcmp(p->var,"hw-rwpt")==0)
+          m=wm_read;
+       else if (strcmp(p->var,"hw-awpt")==0)
+          m=wm_rw;
+       if (m!=wm_unknown)
+          break;
+      }
+    p=p->next;
+   }
+ if (!p || p->type!=t_tuple)
+    return NULL;
+ /* Scan the values inside it. */
+ return mi_get_wp(p->v.rs,m);
+}
+
+mi_wp *mi_res_wp(mi_h *h)
+{
+ mi_output *r, *res;
+ mi_wp *ret=NULL;
+
+ r=mi_get_response_blk(h);
+ res=mi_get_rrecord(r);
+
+ if (res)
+    ret=mi_parse_wp_res(res);
+
+ mi_free_output(r);
+ return ret;
+}
+
+char *mi_res_value(mi_h *h)
+{
+ mi_results *r=mi_res_done_var(h,"value");
+ char *s=NULL;
+
+ if (r && r->type==t_const)
+   {
+    s=r->v.cstr;
+    r->v.rs=NULL;
+   }
+ mi_free_results(r);
+ return s;
+}
+
+mi_output *mi_get_stop_record(mi_output *r)
+{
+ while (r)
+   {
+    if (r->type==MI_T_OUT_OF_BAND && r->stype==MI_ST_ASYNC &&
+        r->sstype==MI_SST_EXEC && r->tclass==MI_CL_STOPPED)
+       return r;
+    r=r->next;
+   }
+ return r;
+}
+
+static
+char *reason_names[]=
+{
+ "breakpoint-hit",
+ "watchpoint-trigger",
+ "read-watchpoint-trigger",
+ "access-watchpoint-trigger",
+ "watchpoint-scope",
+ "function-finished",
+ "location-reached",
+ "end-stepping-range",
+ "exited-signalled",
+ "exited",
+ "exited-normally",
+ "signal-received"
+};
+
+static
+enum mi_stop_reason reason_values[]=
+{
+ sr_bkpt_hit,
+ sr_wp_trigger, sr_read_wp_trigger, sr_access_wp_trigger, sr_wp_scope,
+ sr_function_finished, sr_location_reached, sr_end_stepping_range,
+ sr_exited_signalled, sr_exited, sr_exited_normally,
+ sr_signal_received
+};
+
+static
+char *reason_expl[]=
+{
+ "Hit a breakpoint",
+ "Write watchpoint",
+ "Read watchpoint",
+ "Access watchpoint",
+ "Watchpoint out of scope",
+ "Function finished",
+ "Location reached",
+ "End of stepping",
+ "Exited signalled",
+ "Exited with error",
+ "Exited normally",
+ "Signal received"
+};
+
+enum mi_stop_reason mi_reason_str_to_enum(const char *s)
+{
+ int i;
+
+ for (i=0; i<sizeof(reason_names)/sizeof(char *); i++)
+     if (strcmp(reason_names[i],s)==0)
+        return reason_values[i];
+ return sr_unknown;
+}
+
+const char *mi_reason_enum_to_str(enum mi_stop_reason r)
+{
+ int i;
+
+ if (r==sr_unknown)
+    return "Unknown (temp bkp?)";
+ for (i=0; i<sizeof(reason_values)/sizeof(char *); i++)
+     if (reason_values[i]==r)
+        return reason_expl[i];
+ return NULL;
+}
+
+mi_stop *mi_get_stopped(mi_results *r)
+{
+ mi_stop *res=mi_alloc_stop();
+
+ if (res)
+   {
+    while (r)
+      {
+       if (r->type==t_const)
+         {
+          if (strcmp(r->var,"reason")==0)
+             res->reason=mi_reason_str_to_enum(r->v.cstr);
+          else if (!res->have_thread_id && strcmp(r->var,"thread-id")==0)
+            {
+             res->have_thread_id=1;
+             res->thread_id=atoi(r->v.cstr);
+            }
+          else if (!res->have_bkptno && strcmp(r->var,"bkptno")==0)
+            {
+             res->have_bkptno=1;
+             res->bkptno=atoi(r->v.cstr);
+            }
+          else if (!res->have_bkptno && strcmp(r->var,"wpnum")==0)
+            {
+             res->have_wpno=1;
+             res->wpno=atoi(r->v.cstr);
+            }
+          else if (strcmp(r->var,"gdb-result-var")==0)
+            {
+             res->gdb_result_var=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if (strcmp(r->var,"return-value")==0)
+            {
+             res->return_value=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if (strcmp(r->var,"signal-name")==0)
+            {
+             res->signal_name=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if (strcmp(r->var,"signal-meaning")==0)
+            {
+             res->signal_meaning=r->v.cstr;
+             r->v.cstr=NULL;
+            }
+          else if (!res->have_exit_code && strcmp(r->var,"exit-code")==0)
+            {
+             res->have_exit_code=1;
+             res->exit_code=atoi(r->v.cstr);
+            }
+         }
+       else // tuple or list
+         {
+          if (strcmp(r->var,"frame")==0)
+             res->frame=mi_parse_frame(r->v.rs);
+          else if (!res->wp && strcmp(r->var,"wpt")==0)
+             res->wp=mi_get_wp(r->v.rs,wm_write);
+          else if (!res->wp && strcmp(r->var,"hw-rwpt")==0)
+             res->wp=mi_get_wp(r->v.rs,wm_read);
+          else if (!res->wp && strcmp(r->var,"hw-awpt")==0)
+             res->wp=mi_get_wp(r->v.rs,wm_rw);
+          else if (!(res->wp_old || res->wp_val) && strcmp(r->var,"value")==0)
+             {
+              mi_results *p=r->v.rs;
+              while (p)
+                {
+                 if (strcmp(p->var,"value")==0 || strcmp(p->var,"new")==0)
+                   {
+                    res->wp_val=p->v.cstr;
+                    p->v.cstr=NULL;
+                   }
+                 else if (strcmp(p->var,"old")==0)
+                   {
+                    res->wp_old=p->v.cstr;
+                    p->v.cstr=NULL;
+                   }
+                 p=p->next;
+                }
+             }
+         }
+       r=r->next;
+      }
+   }
+ return res;
+}
+
+mi_stop *mi_res_stop(mi_h *h)
+{
+ mi_output *o=mi_retire_response(h);
+ mi_stop *stop=NULL;
+
+ if (o)
+   {
+    mi_output *sr=mi_get_stop_record(o);
+    if (sr)
+       stop=mi_get_stopped(sr->c);
+   }
+ mi_free_output(o);
+
+ return stop;
+}
+
+int mi_get_read_memory(mi_h *h, unsigned char *dest, unsigned ws, int *na,
+                       unsigned long *addr)
+{
+ char *end;
+ mi_results *res=mi_res_done_var(h,"memory"), *r;
+ int ok=0;
+
+ *na=0;
+ r=res;
+ if (r && r->type==t_list && ws==1)
+   {
+    r=r->v.rs;
+    if (r->type!=t_tuple)
+      {
+       mi_free_results(res);
+       return 0;
+      }
+    r=r->v.rs;
+    while (r)
+      {
+       if (r->type==t_list && strcmp(r->var,"data")==0)
+         {
+          mi_results *data=r->v.rs;
+          ok++;
+          if (data && data->type==t_const &&
+              strcmp(data->v.cstr,"N/A")==0)
+             *na=1;
+          else
+             while (data)
+               {
+                if (data->type==t_const)
+                   *(dest++)=strtol(data->v.cstr,&end,0);
+                data=data->next;
+               }
+         }
+       else if (r->type==t_const && strcmp(r->var,"addr")==0)
+         {
+          ok++;
+          if (addr)
+             *addr=strtoul(r->v.cstr,&end,0);
+         }
+       r=r->next;
+      }
+
+   }
+ mi_free_results(res);
+ return ok==2;
+}
+
+mi_asm_insn *mi_parse_insn(mi_results *c)
+{
+ mi_asm_insn *res=NULL, *cur=NULL;
+ mi_results *sub;
+ char *end;
+
+ while (c)
+   {
+    if (c->type==t_tuple)
+      {
+       if (!res)
+          res=cur=mi_alloc_asm_insn();
+       else
+         {
+          cur->next=mi_alloc_asm_insn();
+          cur=cur->next;
+         }
+       if (!cur)
+         {
+          mi_free_asm_insn(res);
+          return NULL;
+         }
+       sub=c->v.rs;
+       while (sub)
+         {
+          if (sub->type==t_const)
+            {
+             if (strcmp(sub->var,"address")==0)
+                cur->addr=(void *)strtoul(sub->v.cstr,&end,0);
+             else if (strcmp(sub->var,"func-name")==0)
+               {
+                cur->func=sub->v.cstr;
+                sub->v.cstr=NULL;
+               }
+             else if (strcmp(sub->var,"offset")==0)
+                cur->offset=atoi(sub->v.cstr);
+             else if (strcmp(sub->var,"inst")==0)
+               {
+                cur->inst=sub->v.cstr;
+                sub->v.cstr=NULL;
+               }
+            }
+          sub=sub->next;
+         }
+      }
+    c=c->next;
+   }
+ return res;
+}
+
+mi_asm_insns *mi_parse_insns(mi_results *c)
+{
+ mi_asm_insns *res=NULL, *cur=NULL;
+ mi_results *sub;
+
+ while (c)
+   {
+    if (c->var)
+      {
+       if (strcmp(c->var,"src_and_asm_line")==0 && c->type==t_tuple)
+         {
+          if (!res)
+             res=cur=mi_alloc_asm_insns();
+          else
+            {
+             cur->next=mi_alloc_asm_insns();
+             cur=cur->next;
+            }
+          if (!cur)
+            {
+             mi_free_asm_insns(res);
+             return NULL;
+            }
+          sub=c->v.rs;
+          while (sub)
+            {
+             if (sub->var)
+               {
+                if (sub->type==t_const)
+                  {
+                   if (strcmp(sub->var,"line")==0)
+                      cur->line=atoi(sub->v.cstr);
+                   else if (strcmp(sub->var,"file")==0)
+                     {
+                      cur->file=sub->v.cstr;
+                      sub->v.cstr=NULL;
+                     }
+                  }
+                else if (sub->type==t_list)
+                  {
+                   if (strcmp(sub->var,"line_asm_insn")==0)
+                      cur->ins=mi_parse_insn(sub->v.rs);
+                  }
+               }
+             sub=sub->next;
+            }
+         }
+      }
+    else
+      {/* No source line, just instructions */
+       res=mi_alloc_asm_insns();
+       res->ins=mi_parse_insn(c);
+       break;
+      }
+    c=c->next;
+   }
+ return res;
+}
+
+
+mi_asm_insns *mi_get_asm_insns(mi_h *h)
+{
+ mi_results *r=mi_res_done_var(h,"asm_insns");
+ mi_asm_insns *f=NULL;
+
+ if (r && r->type==t_list)
+    f=mi_parse_insns(r->v.rs);
+ mi_free_results(r);
+ return f;
+}
+
+mi_chg_reg *mi_parse_list_regs(mi_results *r, int *how_many)
+{
+ mi_results *c=r;
+ int cregs=0;
+ mi_chg_reg *first=NULL, *cur=NULL;
+
+ /* Create the list. */
+ while (c)
+   {
+    if (c->type==t_const && !c->var)
+      {
+       if (first)
+          cur=cur->next=mi_alloc_chg_reg();
+       else
+          first=cur=mi_alloc_chg_reg();
+       
+       if (NULL != cur) {
+              cur->name=c->v.cstr;
+              cur->reg=cregs++;
+              c->v.cstr=NULL;
+       }
+      }
+    c=c->next;
+   }
+ if (how_many)
+    *how_many=cregs;
+
+ return first;
+}
+
+mi_chg_reg *mi_get_list_registers(mi_h *h, int *how_many)
+{
+ mi_results *r=mi_res_done_var(h,"register-names");
+ mi_chg_reg *l=NULL;
+
+ if (r && r->type==t_list)
+    l=mi_parse_list_regs(r->v.rs,how_many);
+ mi_free_results(r);
+ return l;
+}
+
+mi_chg_reg *mi_parse_list_changed_regs(mi_results *r)
+{
+ mi_results *c=r;
+ mi_chg_reg *first=NULL, *cur=NULL;
+
+ /* Create the list. */
+ while (c)
+   {
+    if (c->type==t_const && !c->var)
+      {
+       if (first)
+          cur=cur->next=mi_alloc_chg_reg();
+       else
+          first=cur=mi_alloc_chg_reg();
+       cur->reg=atoi(c->v.cstr);
+      }
+    c=c->next;
+   }
+
+ return first;
+}
+
+mi_chg_reg *mi_get_list_changed_regs(mi_h *h)
+{
+ mi_results *r=mi_res_done_var(h,"changed-registers");
+ mi_chg_reg *changed=NULL;
+
+ if (r && r->type==t_list)
+    changed=mi_parse_list_changed_regs(r->v.rs);
+ mi_free_results(r);
+ return changed;
+}
+
+int mi_parse_reg_values(mi_results *r, mi_chg_reg *l)
+{
+ mi_results *c;
+
+ while (r && l)
+   {
+    if (r->type==t_tuple && !r->var)
+      {
+       c=r->v.rs;
+       while (c)
+         {
+          if (c->type==t_const && c->var)
+            {
+             if (strcmp(c->var,"number")==0)
+               {
+                if (atoi(c->v.cstr)!=l->reg)
+                  {
+                   mi_error=MI_PARSER;
+                   return 0;
+                  }
+               }
+             else if (strcmp(c->var,"value")==0)
+               {
+                l->val=c->v.cstr;
+                c->v.cstr=NULL;
+               }
+            }
+          c=c->next;
+         }
+      }
+    r=r->next;
+    l=l->next;
+   }
+
+ return !l && !r;
+}
+
+int mi_get_reg_values(mi_h *h, mi_chg_reg *l)
+{
+ mi_results *r=mi_res_done_var(h,"register-values");
+ int ok=0;
+
+ if (r && r->type==t_list)
+    ok=mi_parse_reg_values(r->v.rs,l);
+ mi_free_results(r);
+ return ok;
+}
+
+int mi_parse_list_regs_l(mi_results *r, mi_chg_reg *l)
+{
+ while (r && l)
+   {
+    if (r->type==t_const && !r->var)
+      {
+       free(l->name);
+       l->name=r->v.cstr;
+       r->v.cstr=NULL;
+       l=l->next;
+      }
+    r=r->next;
+   }
+
+ return !l && !r;
+}
+
+int mi_get_list_registers_l(mi_h *h, mi_chg_reg *l)
+{
+ mi_results *r=mi_res_done_var(h,"register-names");
+ int ok=0;
+
+ if (r && r->type==t_list)
+    ok=mi_parse_list_regs_l(r->v.rs,l);
+ mi_free_results(r);
+ return ok;
+}
+
+mi_chg_reg *mi_parse_reg_values_l(mi_results *r, int *how_many)
+{
+ mi_results *c;
+ mi_chg_reg *first=NULL, *cur=NULL;
+ *how_many=0;
+
+ while (r)
+   {
+    if (r->type==t_tuple && !r->var)
+      {
+       c=r->v.rs;
+       if (first)
+          cur=cur->next=mi_alloc_chg_reg();
+       else
+          first=cur=mi_alloc_chg_reg();
+       while (c)
+         {
+          if (c->type==t_const && c->var)
+            {
+             if (strcmp(c->var,"number")==0)
+               {
+               if (NULL != cur) 
+                       cur->reg=atoi(c->v.cstr);
+                (*how_many)++;
+               }
+             else if (strcmp(c->var,"value")==0)
+               {
+               if (NULL != cur)
+                        cur->val=c->v.cstr;
+                c->v.cstr=NULL;
+               }
+            }
+          c=c->next;
+         }
+      }
+    r=r->next;
+   }
+
+ return first;
+}
+
+mi_chg_reg *mi_get_reg_values_l(mi_h *h, int *how_many)
+{
+ mi_results *r=mi_res_done_var(h,"register-values");
+ mi_chg_reg *rgs=NULL;
+
+ if (r && r->type==t_list)
+    rgs=mi_parse_reg_values_l(r->v.rs,how_many);
+ mi_free_results(r);
+ return rgs;
+}
+
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_prg_control.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_prg_control.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_prg_control.c        
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_prg_control.c        
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,578 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Program control.
+  Comments:
+  GDB/MI commands for the "Program Control" section.  @<p>
+
+@<pre>
+gdb command:                   Implemented?
+
+-exec-abort                    N.A. (*) (kill, but with non-interactive 
options)
+-exec-arguments                Yes
+-exec-continue                 Yes  ASYNC
+-exec-finish                   Yes  ASYNC
+-exec-interrupt                Yes  ASYNC
+-exec-next                     Yes  ASYNC
+-exec-next-instruction         Yes  ASYNC
+-exec-return                   Yes
+-exec-run                      Yes  ASYNC
+-exec-show-arguments           N.A. (show args) see gmi_stack_info_frame
+-exec-step                     Yes  ASYNC
+-exec-step-instruction         Yes  ASYNC
+-exec-until                    Yes  ASYNC
+-file-exec-and-symbols         Yes
+-file-exec-file                No
+-file-list-exec-sections       N.A. (info file)
+-file-list-exec-source-files   N.A.
+-file-list-shared-libraries    N.A.
+-file-list-symbol-files        N.A.
+-file-symbol-file              Yes
+@</pre>
+
+(*)  gmi_exec_kill implements it, but you should ensure that
+gmi_gdb_set("confirm","off") was called.  @<p>
+
+GDB Bug workaround for -file-exec-and-symbols and -file-symbol-file: This
+is complex, but a real bug. When you set a breakpoint you never know the
+name of the file as it appears in the debug info. So you can be specifying
+an absolute file name or a relative file name. The reference point could be
+different than the one used in the debug info. To solve all the combinations
+gdb does a search trying various combinations. GDB isn't very smart so you
+must at least specify the working directory and the directory where the
+binary is located to get a good chance (+ user options to solve the rest).
+Once you did it gdb can find the file by doing transformations to the
+"canonical" filename. This search works OK for already loaded symtabs
+(symbol tables), but it have a bug when the search is done for psymtabs
+(partial symtabs). The bug is in the use of source_full_path_of (source.c).
+This function calls openp indicating try_cwd_first. It makes the search file
+if the psymtab file name have at least one dirseparator. It means that
+psymtabs for files compiled with relative paths will fail. The search for
+symtabs uses symtab_to_filename, it calls open_source_file which finally
+calls openp without address@hidden
+To workaround this bug we must ensure gdb loads *all* the symtabs to memory.
+And here comes another problem -file-exec-and-symbols doesn't support it
+according to docs. In real life that's a wrapper for "file", but as nobody
+can say it won't change we must use the CLI command.
+  
+***************************************************************************/
+
+#include <signal.h>
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_file_exec_and_symbols(mi_h *h, const char *file)
+{
+ if (mi_get_workaround(MI_PSYM_SEARCH))
+    mi_send(h,"file %s -readnow\n",file);
+ else
+    mi_send(h,"-file-exec-and-symbols %s\n",file);
+}
+
+void mi_set_unwind_on_signal_on(mi_h *h)
+{
+       mi_send(h, "set unwindonsignal on\n");
+}
+
+void mi_exec_arguments(mi_h *h, const char *args)
+{
+ mi_send(h,"-exec-arguments %s\n",args);
+}
+
+void mi_exec_run(mi_h *h)
+{
+ mi_send(h,"-exec-run\n");
+}
+
+void mi_exec_continue(mi_h *h)
+{
+ mi_send(h,"-exec-continue\n");
+}
+
+void mi_exec_continue_reverse(mi_h *h)
+{
+ mi_send(h, "-exec-continue --reverse\n");
+}
+
+void mi_target_terminal(mi_h *h, const char *tty_name)
+{
+ mi_send(h,"tty %s\n",tty_name);
+}
+
+void mi_file_symbol_file(mi_h *h, const char *file)
+{
+ if (mi_get_workaround(MI_PSYM_SEARCH))
+    mi_send(h,"symbol-file %s -readnow\n",file);
+ else
+    mi_send(h,"-file-symbol-file %s\n",file);
+}
+
+void mi_exec_finish(mi_h *h)
+{
+ mi_send(h,"-exec-finish\n");
+}
+
+void mi_exec_finish_reverse(mi_h * h)
+{
+ mi_send(h, "-exec-finish --reverse\n");
+}
+void mi_exec_interrupt(mi_h *h)
+{
+ mi_send(h,"-exec-interrupt\n");
+}
+
+void mi_exec_record_process(mi_h *h)
+{
+mi_send(h, "-interpreter-exec mi record\n");
+}
+
+void mi_exec_next(mi_h *h, int count)
+{
+ if (count>1)
+    mi_send(h,"-exec-next %d\n",count);
+ else
+    mi_send(h,"-exec-next\n");
+}
+
+void mi_exec_next_instruction(mi_h *h)
+{
+ mi_send(h,"-exec-next-instruction\n");
+}
+
+void mi_exec_step(mi_h *h, int count)
+{
+ if (count>1)
+    mi_send(h,"-exec-step %d\n",count);
+ else
+    mi_send(h,"-exec-step\n");
+}
+
+
+void mi_exec_step_back(mi_h *h, int count)
+{
+       if (count>1)
+               mi_send(h, "-exec-step %d --reverse\n", count);
+       else
+               mi_send(h, "-exec-step --reverse\n");
+}
+
+
+void mi_exec_next_reverse(mi_h *h, int count)
+{
+       if (count>1)
+               mi_send(h, "-exec-next %d --reverse\n", count);
+       else
+               mi_send(h, "-exec-next --reverse\n");
+}
+
+
+void mi_exec_step_instruction(mi_h *h)
+{
+ mi_send(h,"-exec-step-instruction\n");
+}
+
+void mi_exec_until(mi_h *h, const char *file, int line)
+{
+ if (!file)
+    mi_send(h,"-exec-until\n");
+ else
+    mi_send(h,"-exec-until %s:%d\n",file,line);
+}
+
+void mi_exec_until_addr(mi_h *h, void *addr)
+{
+ mi_send(h,"-exec-until *%p\n",addr);
+}
+
+void mi_exec_return(mi_h *h)
+{
+ mi_send(h,"-exec-return\n");
+}
+
+void mi_exec_kill(mi_h *h)
+{
+ mi_send(h,"kill\n");
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  Specify the executable and arguments for local debug.
+
+  Command: -file-exec-and-symbols + -exec-arguments
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_set_exec(mi_h *h, const char *file, const char *args)
+{
+ mi_file_exec_and_symbols(h,file);
+ if (!mi_res_simple_done(h))
+    return 0;
+ if (!args)
+    return 1;
+ mi_exec_arguments(h,args);
+ return mi_res_simple_done(h);
+}
+
+int gmi_set_unwind_on_signal_on(mi_h * h)
+{
+       mi_set_unwind_on_signal_on(h);
+       return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Start running the executable. Remote sessions starts running.
+
+  Command: -exec-run
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_run(mi_h *h)
+{
+ mi_exec_run(h);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Continue the execution after a "stop".
+
+  Command: -exec-continue
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_continue(mi_h *h)
+{
+ mi_exec_continue(h);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Continue the execution in reverse order after a "stop".
+
+  Command: -exec-continue --reverse
+  Return: !=0 OK
+
+***************************************************************************/
+int gmi_exec_continue_reverse(mi_h *h)
+{
+       mi_exec_continue_reverse(h);
+       return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Indicate which terminal will use the target program. For local sessions.
+
+  Command: tty
+  Return: !=0 OK
+  Example: 
+  
+***************************************************************************/
+
+int gmi_target_terminal(mi_h *h, const char *tty_name)
+{
+ mi_target_terminal(h,tty_name);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Specify what's the local copy that have debug info. For remote sessions.
+
+  Command: -file-symbol-file
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_file_symbol_file(mi_h *h, const char *file)
+{
+ mi_file_symbol_file(h,file);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Continue until function return, the return value is included in the async
+response.
+
+  Command: -exec-finish
+  Return: !=0 OK.
+  
+***************************************************************************/
+
+int gmi_exec_finish(mi_h *h)
+{
+ mi_exec_finish(h);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Continue backwardly until function return, the return value is included in
+  the async response.
+
+  Command: -exec-finish --reverse
+  Return: !=0 OK.
+
+***************************************************************************/
+int gmi_exec_finish_reverse(mi_h *h)
+{
+ mi_exec_finish_reverse(h);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Stop the program using SIGINT. The corresponding command should be
+-exec-interrupt but not even gdb 6.1.1 can do it because the "async" mode
+isn't really working.
+
+  Command: -exec-interrupt [replacement]
+  Return: Always 1
+  Example: 
+  
+***************************************************************************/
+
+int gmi_exec_interrupt(mi_h *h)
+{
+ // **** IMPORTANT!!! **** Not even gdb 6.1.1 can do it because the "async"
+ // mode isn't really working.
+ //mi_exec_interrupt(h);
+ //return mi_res_simple_running(h);
+
+ kill(h->pid,SIGINT);
+ return 1; // How can I know?
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Next line of code.
+
+  Command: -exec-next
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_next(mi_h *h)
+{
+ mi_exec_next(h,1);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Start recording a process
+
+  Command: -interpreter-exec console record
+  Return: !=0 OK
+
+***************************************************************************/
+int gmi_exec_record_process(mi_h *h)
+{
+       mi_exec_record_process(h);
+       return 1;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Skip count lines of code.
+
+  Command: -exec-next count
+  Return: !=0 OK
+
+***************************************************************************/
+
+int gmi_exec_next_cnt(mi_h *h, int count)
+{
+ mi_exec_next(h,count);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Next line of assembler code.
+
+  Command: -exec-next-instruction
+  Return: !=0 OK
+
+***************************************************************************/
+
+int gmi_exec_next_instruction(mi_h *h)
+{
+ mi_exec_next_instruction(h);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Next line of code. Get inside functions.
+
+  Command: -exec-step
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_step(mi_h *h)
+{
+ mi_exec_step(h,1);
+ return mi_res_simple_running(h);
+}
+
+
+
+/**[txh]********************************************************************
+
+  Description:
+  Previous line of code. Get inside functions.
+
+  Command: -exec-step --reverse
+  Return: !=0 OK
+
+***************************************************************************/
+int gmi_exec_step_back(mi_h *h)
+{
+       mi_exec_step_back(h,1);
+       return mi_res_simple_running(h);
+}
+
+
+/**[txh]********************************************************************
+
+  Description:
+  Previous line of code (do not step into).
+
+  Command: -exec-next --reverse
+  Return: !=0 OK
+
+***************************************************************************/
+int gmi_exec_next_reverse(mi_h *h)
+{
+       mi_exec_next_reverse(h,1);
+       return mi_res_simple_running(h);
+}
+
+
+/**[txh]********************************************************************
+
+  Description:
+  Next count lines of code. Get inside functions.
+
+  Command: -exec-step count
+  Return: !=0 OK
+
+***************************************************************************/
+
+int gmi_exec_step_cnt(mi_h *h, int count)
+{
+ mi_exec_step(h,count);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Next line of assembler code. Get inside calls.
+
+  Command: -exec-step-instruction
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_step_instruction(mi_h *h)
+{
+ mi_exec_step_instruction(h);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Execute until location is reached. If file is NULL then is until next
+line.
+
+  Command: -exec-until
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_until(mi_h *h, const char *file, int line)
+{
+ mi_exec_until(h,file,line);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Execute until location is reached.
+
+  Command: -exec-until (using *address)
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_until_addr(mi_h *h, void *addr)
+{
+ mi_exec_until_addr(h,addr);
+ return mi_res_simple_running(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Return to previous frame inmediatly.
+
+  Command: -exec-return
+  Return: A pointer to a new mi_frames structure indicating the current
+location. NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_exec_return(mi_h *h)
+{
+ mi_exec_return(h);
+ return mi_res_frame(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Just kill the program. That's what -exec-abort should do, but it isn't
+implemented by gdb. This implementation only works if the interactive mode
+is disabled (gmi_gdb_set("confirm","off")).
+
+  Command: -exec-abort [using kill]
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_exec_kill(mi_h *h)
+{
+ mi_exec_kill(h);
+ return mi_res_simple_done(h);
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_stack_man.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_stack_man.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_stack_man.c          
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_stack_man.c  
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,222 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Stack manipulation.
+  Comments:
+  GDB/MI commands for the "Stack Manipulation" section.  @<p>
+
+@<pre>
+gdb command:              Implemented?
+
+-stack-info-frame         Yes, implemented as "frame"
+-stack-info-depth         Yes
+-stack-list-arguments     Yes
+-stack-list-frames        Yes
+-stack-list-locals        Yes
+-stack-select-frame       Yes
+@</pre>
+
+***************************************************************************/
+
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_stack_list_frames(mi_h *h, int from, int to)
+{
+ if (from<0)
+    mi_send(h,"-stack-list-frames\n");
+ else
+    mi_send(h,"-stack-list-frames %d %d\n",from,to);
+}
+
+void mi_stack_list_arguments(mi_h *h, int show, int from, int to)
+{
+ if (from<0)
+    mi_send(h,"-stack-list-arguments %d\n",show);
+ else
+    mi_send(h,"-stack-list-arguments %d %d %d\n",show,from,to);
+}
+
+void mi_stack_info_frame(mi_h *h)
+{
+ mi_send(h,"frame\n");
+}
+
+void mi_stack_info_depth(mi_h *h, int depth)
+{
+ if (depth<0)
+    mi_send(h,"-stack-info-depth\n");
+ else
+    mi_send(h,"-stack-info-depth %d\n",depth);
+}
+
+void mi_stack_select_frame(mi_h *h, int framenum)
+{
+ mi_send(h,"-stack-select-frame %d\n",framenum);
+}
+
+void mi_stack_list_locals(mi_h *h, int show)
+{
+ mi_send(h,"-stack-list-locals %d\n",show);
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  List of frames. Arguments aren't filled.
+
+  Command: -stack-list-frames
+  Return:  A new list of mi_frames or NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_stack_list_frames(mi_h *h)
+{
+ mi_stack_list_frames(h,-1,-1);
+ return mi_res_frames_array(h,"stack");
+}
+
+/**[txh]********************************************************************
+
+  Description: 
+  List of frames. Arguments aren't filled. Only the frames in the from
+ - to range are returned.
+  
+  Command: -stack-list-frames
+  Return:  A new list of mi_frames or NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_stack_list_frames_r(mi_h *h, int from, int to)
+{
+ mi_stack_list_frames(h,from,to);
+ return mi_res_frames_array(h,"stack");
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  List arguments. Only level and args filled.
+  
+  Command: -stack-list-arguments
+  Return:  A new list of mi_frames or NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_stack_list_arguments(mi_h *h, int show)
+{
+ mi_stack_list_arguments(h,show,-1,-1);
+ return mi_res_frames_array(h,"stack-args");
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  List arguments. Only level and args filled. Only for the
+frames in the from - to range.
+  
+  Command: -stack-list-arguments
+  Return:  A new list of mi_frames or NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_stack_list_arguments_r(mi_h *h, int show, int from, int to)
+{
+ mi_stack_list_arguments(h,show,from,to);
+ return mi_res_frames_array(h,"stack-args");
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Information about the current frame, including args.
+
+  Command: -stack-info-frame [using frame]
+  Return: A new mi_frames or NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_stack_info_frame(mi_h *h)
+{
+ mi_stack_info_frame(h);
+ return mi_res_frame(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Stack info depth.
+
+  Command: -stack-info-depth
+  Return: The depth or -1 on error.
+  
+***************************************************************************/
+
+int gmi_stack_info_depth(mi_h *h, int max_depth)
+{
+ mi_results *r;
+ int ret=-1;
+
+ mi_stack_info_depth(h,max_depth);
+ r=mi_res_done_var(h,"depth");
+ if (r && r->type==t_const)
+   {
+    ret=atoi(r->v.cstr);
+    mi_free_results(r);
+   }
+ return ret;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Set stack info depth.
+
+  Command: -stack-info-depth [no args]
+  Return: The depth or -1 on error.
+  Example: 
+  
+***************************************************************************/
+
+int gmi_stack_info_depth_get(mi_h *h)
+{
+ return gmi_stack_info_depth(h,-1);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Change current frame.
+
+  Command: -stack-select-frame
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_stack_select_frame(mi_h *h, int framenum)
+{
+ mi_stack_select_frame(h,framenum);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  List of local vars.
+
+  Command: -stack-list-locals
+  Return: A new mi_results tree containing the variables or NULL on error.
+  
+***************************************************************************/
+
+mi_results *gmi_stack_list_locals(mi_h *h, int show)
+{
+ mi_stack_list_locals(h,show);
+ return mi_res_done_var(h,"locals");
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_symbol_query.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_symbol_query.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_symbol_query.c       
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_symbol_query.c       
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,32 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Symbol query.
+  Comments:
+  GDB/MI commands for the "Symbol Query" address@hidden
+
+@<pre>
+gdb command:              Implemented?
+-symbol-info-address      N.A. (info address, human readable)
+-symbol-info-file         N.A.
+-symbol-info-function     N.A.
+-symbol-info-line         N.A. (info line, human readable)
+-symbol-info-symbol       N.A. (info symbol, human readable)
+-symbol-list-functions    N.A. (info functions, human readable)
+-symbol-list-types        N.A. (info types, human readable)
+-symbol-list-variables    N.A. (info variables, human readable)
+-symbol-list-lines        No (gdb 6.x)
+-symbol-locate            N.A.
+-symbol-type              N.A. (ptype, human readable)
+@</pre>
+
+Note:@p
+
+Only one is implemented and not in gdb address@hidden
+
+***************************************************************************/
+
+#include "gdbmi.h"
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_target_man.c 
(from rev 22904, 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_target_man.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_target_man.c         
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_target_man.c 
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,119 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004-2007 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Target manipulation.
+  Comments:
+  GDB/MI commands for the "Target Manipulation" section.  @<p>
+
+@<pre>
+-target-attach                  Yes (implemented using attach)
+-target-compare-sections        N.A. (compare-sections)
+-target-detach                  Yes
+-target-download                Yes
+-target-exec-status             N.A.
+-target-list-available-targets  N.A. (help target)
+-target-list-current-targets    N.A. (info file among other things)
+-target-list-parameters         N.A.
+-target-select                  Yes
+@</pre>
+
+***************************************************************************/
+
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_target_select(mi_h *h, const char *type, const char *params)
+{
+ mi_send(h,"-target-select %s %s\n",type,params);
+}
+
+/* Note: -target-attach isn't currently implemented :-( (gdb 6.1.1) */
+void mi_target_attach(mi_h *h, pid_t pid)
+{
+ mi_send(h,"attach %d\n",pid);
+}
+
+void mi_target_detach(mi_h *h)
+{
+ mi_send(h,"-target-detach\n");
+}
+
+void mi_target_download(mi_h *h)
+{
+ mi_send(h,"-target-download\n");
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  Connect to a remote gdbserver using the specified methode.
+
+  Command: -target-select
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_target_select(mi_h *h, const char *type, const char *params)
+{
+ mi_target_select(h,type,params);
+ if (!mi_res_simple_connected(h))
+    return 0;
+ mi_send_target_commands(h);
+ return 1;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Attach to an already running process.
+
+  Command: -target-attach [using attach]
+  Return: The frame of the current location, NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_target_attach(mi_h *h, pid_t pid)
+{
+ mi_target_attach(h,pid);
+ //return mi_res_simple_done(h);
+ return mi_res_frame(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Detach from an attached process.
+
+  Command: -target-detach
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_target_detach(mi_h *h)
+{
+ mi_target_detach(h);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Loads the executable onto the remote target.
+
+  Command: -target-download
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_target_download(mi_h *h)
+{
+ mi_target_download(h);
+ // TODO: this response have some data
+ return mi_res_simple_done(h);
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_thread.c (from 
rev 22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_thread.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_thread.c             
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_thread.c     
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,89 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Thread commands.
+  Comments:
+  GDB/MI commands for the "Thread Commands" section.  @<p>
+
+@<pre>
+gdb command:              Implemented?
+-thread-info              N.A.
+-thread-list-all-threads  Yes, implemented as "info threads"
+-thread-list-ids          Yes
+-thread-select            Yes
+@</pre>
+
+***************************************************************************/
+
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_thread_list_ids(mi_h *h)
+{
+ mi_send(h,"-thread-list-ids\n");
+}
+
+void mi_thread_select(mi_h *h, int id)
+{
+ mi_send(h,"-thread-select %d\n",id);
+}
+
+void mi_thread_list_all_threads(mi_h *h)
+{
+ mi_send(h,"info threads\n");
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  List available thread ids.
+
+  Command: -thread-list-ids
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_thread_list_ids(mi_h *h, int **list)
+{
+ mi_thread_list_ids(h);
+ return mi_res_thread_ids(h,list);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Select a thread.
+
+  Command: -thread-select
+  Return: A new mi_frames or NULL on error.
+  
+***************************************************************************/
+
+mi_frames *gmi_thread_select(mi_h *h, int id)
+{
+ mi_thread_select(h,id);
+ return mi_res_frame(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Get a list of frames for each available thread. Implemented using "info
+thread".
+
+  Command: -thread-list-all-threads
+  Return: A kist of frames, NULL on error
+  
+***************************************************************************/
+
+mi_frames *gmi_thread_list_all_threads(mi_h *h)
+{
+ mi_thread_list_all_threads(h);
+ return mi_res_frames_list(h);
+}
+

Copied: monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_var_obj.c (from 
rev 22904, monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_var_obj.c)
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_var_obj.c            
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/mi/gdbmi_var_obj.c    
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,371 @@
+/**[txh]********************************************************************
+
+  Copyright (c) 2004 by Salvador E. Tropea.
+  Covered by the GPL license.
+
+  Module: Variable objects.
+  Comments:
+  GDB/MI commands for the "Variable Objects" section.
+    @<p>
+
+@<pre>
+gdb command:              Imp? Description:
+-var-create               Yes  create a variable object
+-var-delete               Yes  delete the variable object and its children
+-var-set-format           Yes  set the display format of this variable
+-var-show-format          Yes  show the display format of this variable
+-var-info-num-children    Yes  tells how many children this object has
+-var-list-children        Yes* return a list of the object's children
+-var-info-type            Yes  show the type of this variable object
+-var-info-expression      Yes  print what this variable object represents
+-var-show-attributes      Yes  is this variable editable?
+-var-evaluate-expression  Yes  get the value of this variable
+-var-assign               Yes  set the value of this variable
+-var-update               Yes* update the variable and its children
+@</pre>
+
+Notes:  @<p>
+1) I suggest letting gdb to choose the names for the address@hidden
+2) -var-list-children supports an optional "show values" argument in MI v2.
+It isn't address@hidden
+
+  @<p>
+
+* MI v1 and v2 result formats supported.  @<p>
+
+***************************************************************************/
+
+#include "gdbmi.h"
+
+/* Low level versions. */
+
+void mi_var_create(mi_h *h, const char *name, int frame, const char *exp)
+{
+ const char *n=name ? name : "-";
+
+ if (frame<0)
+    mi_send(h,"-var-create %s * %s\n",n,exp);
+ else
+    mi_send(h,"-var-create %s %d %s\n",n,frame,exp);
+}
+
+void mi_var_delete(mi_h *h, const char *name)
+{
+ mi_send(h,"-var-delete %s\n",name);
+}
+
+void mi_var_set_format(mi_h *h, const char *name, const char *format)
+{
+ mi_send(h,"-var-set-format \"%s\" %s\n",name,format);
+}
+
+void mi_var_show_format(mi_h *h, const char *name)
+{
+ mi_send(h,"-var-show-format \"%s\"\n",name);
+}
+
+void mi_var_info_num_children(mi_h *h, const char *name)
+{
+ mi_send(h,"-var-info-num-children \"%s\"\n",name);
+}
+
+void mi_var_info_type(mi_h *h, const char *name)
+{
+ mi_send(h,"-var-info-type \"%s\"\n",name);
+}
+
+void mi_var_info_expression(mi_h *h, const char *name)
+{
+ mi_send(h,"-var-info-expression \"%s\"\n",name);
+}
+
+void mi_var_show_attributes(mi_h *h, const char *name)
+{
+ mi_send(h,"-var-show-attributes \"%s\"\n",name);
+}
+
+void mi_var_update(mi_h *h, const char *name)
+{
+ if (name)
+    mi_send(h,"-var-update %s\n",name);
+ else
+    mi_send(h,"-var-update *\n");
+}
+
+void mi_var_assign(mi_h *h, const char *name, const char *expression)
+{
+ mi_send(h,"-var-assign \"%s\" \"%s\"\n",name,expression);
+}
+
+void mi_var_evaluate_expression(mi_h *h, const char *name)
+{
+ mi_send(h,"-var-evaluate-expression \"%s\"\n",name);
+}
+
+void mi_var_list_children(mi_h *h, const char *name)
+{
+ if (h->version>=MI_VERSION2U(2,0,0))
+    mi_send(h,"-var-list-children --all-values \"%s\"\n",name);
+ else
+    mi_send(h,"-var-list-children \"%s\"\n",name);
+}
+
+/* High level versions. */
+
+/**[txh]********************************************************************
+
+  Description:
+  Create a variable object. I recommend using gmi_var_create and letting
+gdb choose the names.
+
+  Command: -var-create
+  Return: A new mi_gvar strcture or NULL on error.
+  
+***************************************************************************/
+
+mi_gvar *gmi_var_create_nm(mi_h *h, const char *name, int frame, const char 
*exp)
+{
+ mi_var_create(h,name,frame,exp);
+ return mi_res_gvar(h,NULL,exp);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Create a variable object. The name is selected by gdb. Alternative:
+  gmi_full_var_create.
+
+  Command: -var-create [auto name]
+  Return: A new mi_gvar strcture or NULL on error.
+  
+***************************************************************************/
+
+mi_gvar *gmi_var_create(mi_h *h, int frame, const char *exp)
+{
+ return gmi_var_create_nm(h,NULL,frame,exp);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Delete a variable object. Doesn't free the mi_gvar data.
+
+  Command: -var-delete
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_delete(mi_h *h, mi_gvar *var)
+{
+ mi_var_delete(h,var->name);
+ return mi_res_simple_done(h);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Set the format used to represent the result.
+
+  Command: -var-set-format
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_set_format(mi_h *h, mi_gvar *var, enum mi_gvar_fmt format)
+{
+ int ret;
+
+ mi_var_set_format(h,var->name,mi_format_enum_to_str(format));
+ ret=mi_res_simple_done(h);
+ if (ret)
+    var->format=format;
+ return ret;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Fill the format field with info from gdb.
+
+  Command: -var-show-format
+  Return: !=0 OK.
+  
+***************************************************************************/
+
+int gmi_var_show_format(mi_h *h, mi_gvar *var)
+{
+ mi_var_show_format(h,var->name);
+ return mi_res_gvar(h,var,NULL)!=NULL;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Fill the numchild field with info from gdb.
+
+  Command: -var-info-num-children
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_info_num_children(mi_h *h, mi_gvar *var)
+{
+ mi_var_info_num_children(h,var->name);
+ return mi_res_gvar(h,var,NULL)!=NULL;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Fill the type field with info from gdb.
+
+  Command: -var-info-type
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_info_type(mi_h *h, mi_gvar *var)
+{
+ mi_var_info_type(h,var->name);
+ return mi_res_gvar(h,var,NULL)!=NULL;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Fill the expression and lang fields with info from gdb. Note that lang
+isn't filled during creation.
+
+  Command: -var-info-expression
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_info_expression(mi_h *h, mi_gvar *var)
+{
+ mi_var_info_expression(h,var->name);
+ return mi_res_gvar(h,var,NULL)!=NULL;
+}
+
+
+/**[txh]********************************************************************
+
+  Description:
+  Fill the attr field with info from gdb. Note that attr isn't filled
+during creation.
+
+  Command: -var-show-attributes
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_show_attributes(mi_h *h, mi_gvar *var)
+{
+ mi_var_show_attributes(h,var->name);
+ return mi_res_gvar(h,var,NULL)!=NULL;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Create the variable and also fill the lang and attr fields. The name is
+selected by gdb.
+
+  Command: -var-create + -var-info-expression + -var-show-attributes
+  Return: A new mi_gvar strcture or NULL on error.
+  
+***************************************************************************/
+
+mi_gvar *gmi_full_var_create(mi_h *h, int frame, const char *exp)
+{
+ mi_gvar *var=gmi_var_create_nm(h,NULL,frame,exp);
+ if (var)
+   {/* What if it fails? */
+    gmi_var_info_expression(h,var);
+    gmi_var_show_attributes(h,var);
+   }
+ return var;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Update variable. Use NULL for all. Note that *changed can be NULL if none
+updated.
+
+  Command: -var-update
+  Return: !=0 OK. The changed list contains the list of changed vars.
+  
+***************************************************************************/
+
+int gmi_var_update(mi_h *h, mi_gvar *var, mi_gvar_chg **changed)
+{
+ mi_var_update(h,var ? var->name : NULL);
+ return mi_res_changelist(h,changed);
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Change variable. The new value replaces the value field.
+
+  Command: -var-assign
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_assign(mi_h *h, mi_gvar *var, const char *expression)
+{
+ char *res;
+ mi_var_assign(h,var->name,expression);
+ res=mi_res_value(h);
+ if (res)
+   {
+    free(var->value);
+    var->value=res;
+    return 1;
+   }
+ return 0;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  Fill the value field getting the current value for a variable.
+
+  Command: -var-evaluate-expression
+  Return: !=0 OK, value contains the result.
+  
+***************************************************************************/
+
+int gmi_var_evaluate_expression(mi_h *h, mi_gvar *var)
+{
+ char *s;
+
+ mi_var_evaluate_expression(h,var->name);
+ s=mi_res_value(h);
+ if (s)
+   {
+    free(var->value);
+    var->value=s;
+   }
+ return s!=NULL;
+}
+
+/**[txh]********************************************************************
+
+  Description:
+  List children. It ONLY returns the first level information. :-(@*
+  On success the child field contains the list of children.
+
+  Command: -var-list-children
+  Return: !=0 OK
+  
+***************************************************************************/
+
+int gmi_var_list_children(mi_h *h, mi_gvar *var)
+{
+ mi_var_list_children(h,var->name);
+ return mi_res_children(h,var);
+}
+

Modified: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/Makefile.am
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/Makefile.am    
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/Makefile.am       
2012-07-25 13:05:29 UTC (rev 22908)
@@ -33,89 +33,36 @@
   monkey_action.h
 
 libmonkeyaction_la_LIBADD = \
+  $(top_builddir)/src/mi/libmonkeymi.la \
   $(top_builddir)/src/util/libmonkeyutil.la \
   $(XLIB)
 
-libmonkeyxml_la_LIBADD = \
-  $(top_builddir)/src/util/libmonkeyutil.la \
-  $(XLIB)
-   
 libmonkeyxml_la_SOURCES = \
   xml_writer.c \
   monkey_xml_writer.h
   
+libmonkeyxml_la_LIBADD = \
+  $(top_builddir)/src/util/libmonkeyutil.la \
+  $(XLIB)
+   
 bin_PROGRAMS = \
- monkey \
- bug_null_pointer_exception \
- bug_bad_memory_access \
- bug_assertion_failure \
- bug_crypto_crc \
- bug_division_by_zero_loop \
- bug_null_pointer_exception_modified \
- bug_sigbus
-
-#noinst_PROGRAMS = \
- bug_null_pointer_exception \
- bug_bad_memory_access \
- bug_assertion_failure \
- bug_crypto_crc \
- bug_division_by_zero_loop \
- bug_null_pointer_exception_modified \
- bug_sigbus
-
-monkey_SOURCES = \
- gdbmi.h \
- gdbmi_alloc.c \
- gdbmi_breakpoint.c \
- gdbmi_connect.c \
- gdbmi_data_man.c \
- gdbmi_error.c \
- gdbmi_get_free_pty.c \
- gdbmi_get_free_vt.c \
- gdbmi_misc.c \
- gdbmi_parse.c \
- gdbmi_prg_control.c \
- gdbmi_stack_man.c \
- gdbmi_symbol_query.c \
- gdbmi_target_man.c \
- gdbmi_thread.c \
- gdbmi_var_obj.c \
- monkey.c \
+ pathologist
+ 
+pathologist_SOURCES = \
+ pathologist.c \
  mail_sender.c
 
-monkey_LDADD = \
+pathologist_LDADD = \
+  $(top_builddir)/src/mi/libmonkeymi.la \
   $(top_builddir)/src/util/libmonkeyutil.la \
-  $(top_builddir)/src/monkey/libmonkeyedb.la \
-  $(top_builddir)/src/monkey/libmonkeyaction.la \
-  $(top_builddir)/src/monkey/libmonkeyxml.la \
+  $(top_builddir)/src/pathologist/libmonkeyedb.la \
+  $(top_builddir)/src/pathologist/libmonkeyaction.la \
+  $(top_builddir)/src/pathologist/libmonkeyxml.la \
   -lesmtp \
   $(GN_LIBINTL)
-
-
-bug_null_pointer_exception:
-       gcc -g -O0 -o bug_null_pointer_exception bug_null_pointer_exception.c
-
-bug_bad_memory_access:
-       gcc -g -O0 -o bug_bad_memory_access bug_bad_memory_access.c     
-
-bug_assertion_failure:
-       gcc -g -O0 -o bug_assertion_failure bug_assertion_failure.c     
-
-bug_crypto_crc:
-       gcc -g -O0 -o bug_crypto_crc bug_crypto_crc.c
-       
-bug_division_by_zero_loop:
-       gcc -g -O0 -o bug_division_by_zero_loop bug_division_by_zero_loop.c     
-       
-bug_null_pointer_exception_modified:
-       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           
-       
-
+  
 check_PROGRAMS = \
-    test_monkey_edb
+    #test_monkey_edb
     #test_monkey       
 
 if ENABLE_TEST_RUN
@@ -123,11 +70,6 @@
 TESTS = $(check_PROGRAMS)
 endif
 
-test_monkey_edb_SOURCES = \
-  test_monkey_edb.c
-test_monkey_edb_LDADD = \
-  $(top_builddir)/src/util/libmonkeyutil.la \
-  $(top_builddir)/src/monkey/libmonkeyedb.la
 
 #test_monkey_SOURCES = \
  #test_monkey.c
@@ -137,12 +79,7 @@
 check_SCRIPTS = \
   #test_monkey.sh \
   #test_monkey_npe.sh
-
-EXTRA_DIST = \
-  test_monkey_data.conf \
-  test.db \
-  bug_null_pointer_exception.db
-  
+    
 #$(check_SCRIPTS) 
 
 endif

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bad_memory_access.db
===================================================================
(Binary files differ)

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_assertion_failure.c
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_assertion_failure.c    
    2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_assertion_failure.c
   2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,16 +0,0 @@
-#include <stdio.h>
-#include <assert.h>
-
-void assertionFailure()
-{
-       int x;
-       x = 5;
-       printf("Assertion Failure Now!\n");
-       assert(x < 4);
-}
-
-int main(int argc, char *argv[])
-{
-       assertionFailure();
-       return 0;
-}

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

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bad_memory_access.c
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_bad_memory_access.c    
    2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bad_memory_access.c
   2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,16 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-
-void badMemoryAccess()
-{
-       int *p = (int*) 0x4252352;
-       printf("Bad memory access now!\n");
-       *p = 5;
-}
-
-int main(int argc, char *argv[])
-{
-       badMemoryAccess();
-       return 0;
-}

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

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bad_memory_access_rpt.ref
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_bad_memory_access_rpt.ref
  2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bad_memory_access_rpt.ref
     2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,37 +0,0 @@
-Bug detected in file:bug_bad_memory_access.c
-function:badMemoryAccess
-line:9
-received signal:SIGSEGV
-Segmentation fault
- Details:
- Memory Check from Valgrind:
-==7459== Memcheck, a memory error detector
-==7459== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
-==7459== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
-==7459== Command: src/monkey/bug_bad_memory_access
-==7459== Parent PID: 7458
-==7459== 
-==7459== Invalid write of size 4
-==7459==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
-==7459==    by 0x400532: main (bug_bad_memory_access.c:14)
-==7459==  Address 0x4252352 is not stack'd, malloc'd or (recently) free'd
-==7459== 
-==7459== 
-==7459== Process terminating with default action of signal 11 (SIGSEGV)
-==7459==  Access not within mapped region at address 0x4252352
-==7459==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
-==7459==    by 0x400532: main (bug_bad_memory_access.c:14)
-==7459==  If you believe this happened as a result of a stack
-==7459==  overflow in your program's main thread (unlikely but
-==7459==  possible), you can try to increase the size of the
-==7459==  main thread stack using the --main-stacksize= flag.
-==7459==  The main thread stack size used in this run was 8388608.
-==7459== 
-==7459== HEAP SUMMARY:
-==7459==     in use at exit: 0 bytes in 0 blocks
-==7459==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
-==7459== 
-==7459== All heap blocks were freed -- no leaks are possible
-==7459== 
-==7459== For counts of detected and suppressed errors, rerun with: -v
-==7459== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_bug_assertion_failure.db
===================================================================
Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_crypto_crc.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_crypto_crc.c       
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_crypto_crc.c  
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,121 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2001, 2002, 2003, 2004, 2006 Christian Grothoff (and other 
contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-
-     For the actual CRC code:
-     Copyright abandoned; this code is in the public domain.
-     Provided to GNUnet by address@hidden
-*/
-
-/**
- * @file monkey/bug_crypto_crc.c
- * @brief implementation of CRC32 (this code has been copied from GNUnet util 
source directory, and modified to be Seaspider friendly)
- * @author Christian Grothoff, Safey A.Halim
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#define Z_NULL  0
-
-
-#define POLYNOMIAL (unsigned long)0xedb88320
-static unsigned long crc_table[256];
-
-/*
- * This routine writes each crc_table entry exactly once,
- * with the ccorrect final value.  Thus, it is safe to call
- * even on a table that someone else is using concurrently.
- */
-static void 
-crc_init ()
-{
-  static int once;
-  unsigned int i, j;
-  unsigned long h = 1;
-
-  if (once)
-    return;
-  once = 1;
-  crc_table[0] = 0;
-  for (i = 128; i; i >>= 1)
-    {
-      h = (h >> 1) ^ ((h & 1) ? POLYNOMIAL : 0);
-      /* h is now crc_table[i] */
-      for (j = 0; j < 256; j += 2 * i)
-        crc_table[i + j] = crc_table[j] ^ h;
-    }
-}
-
-/*
- * This computes the standard preset and inverted CRC, as used
- * by most networking standards.  Start by passing in an initial
- * chaining value of 0, and then pass in the return value from the
- * previous crc32() call.  The final return value is the CRC.
- * Note that this is a little-endian CRC, which is best used with
- * data transmitted lsbit-first, and it should, itself, be appended
- * to data in little-endian byte and bit order to preserve the
- * property of detecting all burst errors of length 32 bits or less.
- */
-static unsigned long
-crc_go (unsigned long crc, const char *buf, size_t len)
-{
-  crc_init ();
-  assert (crc_table[255] != 0);
-  crc ^= 0xffffffff;
-  while (len--)
-    crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
-  return crc ^ 0xffffffff;
-}
-
-
-/**
- * Compute the CRC32 checksum for the first len bytes of the buffer.
- *
- * @param buf the data over which we're taking the CRC
- * @param len the length of the buffer
- * @return the resulting CRC32 checksum
- */
-int32_t
-crc32_n (const void *buf, size_t len)
-{
-  unsigned long crc;
-  crc = crc_go (0L, Z_NULL, 0);
-  crc = crc_go (crc, (char *) buf, len);
-  return crc;
-}
-
-
-int main ()
-{
-  char buf[1024];
-  int i;
-  for (i = 0; i < 1024; i++)
-  {
-     buf[i] = (char) i;
-  }
-  for (i = 0; i < 1024; i++)
-  {
-    printf("%d\n", crc32_n (&buf[i], 1024 - i));
-  }
-  return 0;
-}
-
-/* end of bug_crypto_crc.c */

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_division_by_zero_loop.c
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_division_by_zero_loop.c
    2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_division_by_zero_loop.c
       2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,18 +0,0 @@
-#include <stdio.h>
-
-int
-main (int argc, char *argv[])
-{
-  int i, k, result, tmp;
-  k = -1;
-  result = 10;
-
-  printf("I am alive!\n");
-  for (i = 0; i < 5; i++)
-    {
-      k += i;
-      result = result / k;     /* Division by zero in second iteration */
-      printf("result = %d\n", result);
-    }
-  return 0;
-}

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

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception.c
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception.c
   2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception.c
      2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,21 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-
-struct CrashStruct {
-       const char *crashValue;
-};
-
-void crashFunction() 
-{
-       struct CrashStruct *crashStruct;
-       crashStruct = NULL;
-       printf("Now the program will crash!\n");
-       crashStruct->crashValue = "hello!";
-}
-
-int main(int argc, char *argv[]) 
-{
-       crashFunction();
-       return 0;
-}

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

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception_modified.c
===================================================================
--- 
monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_null_pointer_exception_modified.c
  2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception_modified.c
     2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,32 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-
-struct CrashStruct {
-       const char *crashValue;
-};
-
-void crashFunction()
-{
-       struct CrashStruct *crashStruct;
-       int a;
-       int b;
-       int c;
-       a = 3;
-       b = 5;
-       c = a + b;
-       crashStruct = NULL;
-       printf("Now the program will crash!\n");
-       crashStruct->crashValue = "hello!";
-}
-
-void intermediateFunction()
-{
-       crashFunction();
-}
-
-int main(int argc, char *argv[])
-{
-       intermediateFunction();
-       return 0;
-}

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_null_pointer_exception_modified.db
===================================================================
(Binary files differ)

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_sigbus.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/bug_sigbus.c   
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/bug_sigbus.c      
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,50 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-int main(int argc, char **argv)
-{
-//
-//     __asm__("pushf\n"
-//            "orl $0x40000, (%esp)\n"
-//            "popf");
-
-    int testvar = 0x12345678;
-    int *testvarp;
-
-    testvarp = &testvar;
-    printf("testvarp was %lx\n", testvarp);
-    printf("testvar was %lx\n", *testvarp);
-
-    testvarp = (int *)(((char *)testvarp) + 1);
-    printf("testvarp is %lx\n", testvarp);
-    printf("testvar is %lx\n", *testvarp);
-
-
-//     char* str;
-//     str = realloc(str,10);
-//     */
-//
-//     /*
-//    char *p;
-//
-//    __asm__("pushf\n"
-//            "orl $0x40000, (%esp)\n"
-//            "popf");
-//
-//    /*
-//     * malloc() always provides aligned memory.
-//     * Do not use stack variable like a[9], depending on the compiler you 
use,
-//     * a may not be aligned properly.
-//     */
-//    p = malloc(sizeof(int) + 1);
-//    memset(p, 0, sizeof(int) + 1);
-//
-//    /* making p unaligned */
-//    p++;
-//
-//    printf("%d\n", *(int *)p);
-//
-//    return 0;
-
-}

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi.h
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi.h        
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi.h   
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,728 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004-2009 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Comments:
-  Main header for libmigdb.
-  
-***************************************************************************/
-
-#ifndef GDBMI_H
-#define GDBMI_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h> /* pid_t */
-
-#define MI_OK                      0
-#define MI_OUT_OF_MEMORY           1
-#define MI_PIPE_CREATE             2
-#define MI_FORK                    3
-#define MI_DEBUGGER_RUN            4
-#define MI_PARSER                  5
-#define MI_UNKNOWN_ASYNC           6
-#define MI_UNKNOWN_RESULT          7
-#define MI_FROM_GDB                8
-#define MI_GDB_TIME_OUT            9
-#define MI_GDB_DIED               10
-#define MI_MISSING_XTERM          11
-#define MI_CREATE_TEMPORAL        12
-#define MI_MISSING_GDB            13
-#define MI_LAST_ERROR             13
-
-#define MI_R_NONE                  0 /* We are no waiting any response. */
-#define MI_R_SKIP                  1 /* We want to discard it. */
-#define MI_R_FE_AND_S              2 /* Wait for done. */
-#define MI_R_E_ARGS                3
-
-enum mi_val_type { t_const, t_tuple, t_list };
-
-/* Types and subtypes. */
-/* Type. */
-#define MI_T_OUT_OF_BAND   0
-#define MI_T_RESULT_RECORD 1
-/* Out of band subtypes. */
-#define MI_ST_ASYNC        0
-#define MI_ST_STREAM       1
-/* Async sub-subtypes. */
-#define MI_SST_EXEC        0
-#define MI_SST_STATUS      1
-#define MI_SST_NOTIFY      2
-/* Stream sub-subtypes. */
-#define MI_SST_CONSOLE     3
-#define MI_SST_TARGET      4
-#define MI_SST_LOG         5
-/* Classes. */
-/* Async classes. */
-#define MI_CL_UNKNOWN      0
-#define MI_CL_STOPPED      1
-#define MI_CL_DOWNLOAD     2
-/* Result classes. */
-#define MI_CL_DONE         2
-#define MI_CL_RUNNING      3
-#define MI_CL_CONNECTED    4
-#define MI_CL_ERROR        5
-#define MI_CL_EXIT         6
-
-#define MI_DEFAULT_TIME_OUT 10
-
-#define MI_DIS_ASM        0
-#define MI_DIS_SRC_ASM    1
-
-/* Implemented workaround for gdb bugs that we can dis/enable. */
-/* At least gdb<=6.1.1 fails to find a source file with absolute path if the
-   name is for a psym instead of a sym. psym==partially loaded symbol table. */
-#define MI_PSYM_SEARCH    0
-
-#define MI_VERSION_STR "0.8.12"
-#define MI_VERSION_MAJOR  0
-#define MI_VERSION_MIDDLE 8
-#define MI_VERSION_MINOR  12
-
-struct mi_results_struct
-{
- char *var; /* Result name or NULL if just a value. */
- enum mi_val_type type;
- union
- {
-  char *cstr;
-  struct mi_results_struct *rs;
- } v;
- struct mi_results_struct *next;
-};
-typedef struct mi_results_struct mi_results;
-
-struct mi_output_struct
-{
- /* Type of output. */
- char type;
- char stype;
- char sstype;
- char tclass;
- /* Content. */
- mi_results *c;
- /* Always modeled as a list. */
- struct mi_output_struct *next;
-};
-typedef struct mi_output_struct mi_output;
-
-typedef void (*stream_cb)(const char *, void *);
-typedef void (*async_cb)(mi_output *o, void *);
-typedef int  (*tm_cb)(void *);
-
-/* Values of this structure shouldn't be manipulated by the user. */
-struct mi_h_struct
-{
- /* Pipes connected to gdb. */
- int to_gdb[2];
- int from_gdb[2];
- /* Streams for the pipes. */
- FILE *to, *from;
- /* PID of child gdb. */
- pid_t pid;
- char died;
- /* Which rensponse we are waiting for. */
- /*int response;*/
- /* The line we are reading. */
- char *line;
- int   llen, lread;
- /* Parsed output. */
- mi_output *po, *last;
- /* Tunneled streams callbacks. */
- stream_cb console;
- void *console_data;
- stream_cb target;
- void *target_data;
- stream_cb log;
- void *log_data;
- /* Async responses callback. */
- async_cb async;
- void *async_data;
- /* Callbacks to get echo of gdb dialog. */
- stream_cb to_gdb_echo;
- void *to_gdb_echo_data;
- stream_cb from_gdb_echo;
- void *from_gdb_echo_data;
- /* Time out */
- tm_cb time_out_cb;
- void *time_out_cb_data;
- int time_out;
- /* Ugly workaround for some of the show responses :-( */
- int catch_console;
- char *catched_console;
- /* MI version, currently unknown but the user can force v2 */
- unsigned version;
-};
-typedef struct mi_h_struct mi_h;
-
-#define MI_TO(a) ((a)->to_gdb[1])
-
-enum mi_bkp_type { t_unknown=0, t_breakpoint=1, t_hw=2 };
-enum mi_bkp_disp { d_unknown=0, d_keep=1, d_del=2 };
-enum mi_bkp_mode { m_file_line=0, m_function=1, m_file_function=2, m_address=3 
};
-
-struct mi_bkpt_struct
-{
- int number;
- enum mi_bkp_type type;
- enum mi_bkp_disp disp; /* keep or del if temporal */
- char enabled;
- void *addr;
- char *func;
- char *file;
- int line;
- int ignore;
- int times;
-
- /* For the user: */
- char *cond;
- char *file_abs;
- int thread;
- enum mi_bkp_mode mode;
- struct mi_bkpt_struct *next;
-};
-typedef struct mi_bkpt_struct mi_bkpt;
-
-enum mi_wp_mode { wm_unknown=0, wm_write=1, wm_read=2, wm_rw=3 };
-
-struct mi_wp_struct
-{
- int number;
- char *exp;
- enum mi_wp_mode mode;
-
- /* For the user: */
- struct mi_wp_struct *next;
- char enabled;
-};
-typedef struct mi_wp_struct mi_wp;
-
-struct mi_frames_struct
-{
- int level;  /* The frame number, 0 being the topmost frame, i.e. the innermost
-                function. */
- void *addr; /* The `$pc' value for that frame. */
- char *func; /* Function name. */
- char *file; /* File name of the source file where the function lives. */
- char *from;
- int line;   /* Line number corresponding to the `$pc'. */
- /* When arguments are available: */
- mi_results *args;
- int thread_id;
- /* When more than one is provided: */
- struct mi_frames_struct *next;
-};
-typedef struct mi_frames_struct mi_frames;
-
-struct mi_aux_term_struct
-{
- pid_t pid;
- char *tty;
-};
-typedef struct mi_aux_term_struct mi_aux_term;
-
-struct mi_pty_struct
-{
- char *slave;
- int master;
-};
-typedef struct mi_pty_struct mi_pty;
-
-enum mi_gvar_fmt { fm_natural=0, fm_binary=1, fm_decimal=2, fm_hexadecimal=3,
-                   fm_octal=4,
-                   /* Only for registers format: */
-                   fm_raw=5 };
-enum mi_gvar_lang { lg_unknown=0, lg_c, lg_cpp, lg_java };
-
-#define MI_ATTR_DONT_KNOW   0
-#define MI_ATTR_NONEDITABLE 1
-#define MI_ATTR_EDITABLE    2
-
-struct mi_gvar_struct
-{
- char *name;
- int   numchild;
- char *type;
- enum mi_gvar_fmt format;
- enum mi_gvar_lang lang;
- char *exp;
- int   attr;
-
- /* MI v2 fills it, not yet implemented here. */
- /* Use gmi_var_evaluate_expression. */
- char *value;
-
- /* Pointer to the parent. NULL if none. */
- struct mi_gvar_struct *parent;
- /* List containing the children.
-    Filled by gmi_var_list_children.
-    NULL if numchild==0 or not yet filled. */
- struct mi_gvar_struct *child;
- /* Next var in the list. */
- struct mi_gvar_struct *next;
-
- /* For the user: */
- char opened;  /* We will show its children. 1 when we fill "child" */
- char changed; /* Needs to be updated. 0 when created. */
- int vischild; /* How many items visible. numchild when we fill "child" */
- int depth;    /* How deep is this var. */
- char ispointer;
-};
-typedef struct mi_gvar_struct mi_gvar;
-
-struct mi_gvar_chg_struct
-{
- char *name;
- int   in_scope;  /* if true the other fields apply. */
- char *new_type;  /* NULL if type_changed==false */
- int   new_num_children; /* only when new_type!=NULL */
-
- struct mi_gvar_chg_struct *next;
-};
-typedef struct mi_gvar_chg_struct mi_gvar_chg;
-
-
-/* A list of assembler instructions. */
-struct mi_asm_insn_struct
-{
- void *addr;
- char *func;
- unsigned offset;
- char *inst;
-
- struct mi_asm_insn_struct *next;
-};
-typedef struct mi_asm_insn_struct mi_asm_insn;
-
-/* A list of source lines containing assembler instructions. */
-struct mi_asm_insns_struct
-{
- char *file;
- int line;
- mi_asm_insn *ins;
-
- struct mi_asm_insns_struct *next;
-};
-typedef struct mi_asm_insns_struct mi_asm_insns;
-
-/* Changed register. */
-struct mi_chg_reg_struct
-{
- int reg;
- char *val;
- char *name;
- char updated;
-
- struct mi_chg_reg_struct *next;
-};
-typedef struct mi_chg_reg_struct mi_chg_reg;
-
-/*
- Examining gdb sources and looking at docs I can see the following "stop"
-reasons:
-
-Breakpoints:
-a) breakpoint-hit (bkptno) + frame
-Also: without reason for temporal breakpoints.
-
-Watchpoints:
-b) watchpoint-trigger (wpt={number,exp};value={old,new}) + frame
-c) read-watchpoint-trigger (hw-rwpt{number,exp};value={value}) + frame
-d) access-watchpoint-trigger (hw-awpt{number,exp};value={[old,]new}) + frame
-e) watchpoint-scope (wpnum) + frame
-
-Movement:
-f) function-finished ([gdb-result-var,return-value]) + frame
-g) location-reached + frame
-h) end-stepping-range + frame
-
-Exit:
-i) exited-signalled (signal-name,signal-meaning)
-j) exited (exit-code)
-k) exited-normally
-
-Signal:
-l) signal-received (signal-name,signal-meaning) + frame
-
-Plus: thread-id
-*/
-enum mi_stop_reason
-{
- sr_unknown=0,
- sr_bkpt_hit,
- sr_wp_trigger, sr_read_wp_trigger, sr_access_wp_trigger, sr_wp_scope,
- sr_function_finished, sr_location_reached, sr_end_stepping_range,
- sr_exited_signalled, sr_exited, sr_exited_normally,
- sr_signal_received
-};
-
-struct mi_stop_struct
-{
- enum mi_stop_reason reason; /* If more than one reason just the last. */
- /* Flags indicating if non-pointer fields are filled. */
- char have_thread_id;
- char have_bkptno;
- char have_exit_code;
- char have_wpno;
- /* Where stopped. Doesn't exist for sr_exited*. */
- int thread_id;
- mi_frames *frame;
- /* sr_bkpt_hit */
- int bkptno;
- /* sr_*wp_* no scope */
- mi_wp *wp;
- char *wp_old;
- char *wp_val;
- /* sr_wp_scope */
- int wpno;
- /* sr_function_finished. Not for void func. */
- char *gdb_result_var;
- char *return_value;
- /* sr_exited_signalled, sr_signal_received */
- char *signal_name;
- char *signal_meaning;
- /* sr_exited */
- int exit_code;
-};
-typedef struct mi_stop_struct mi_stop;
-
-/* Variable containing the last error. */
-extern int mi_error;
-extern char *mi_error_from_gdb;
-const char *mi_get_error_str();
-
-/* Indicate the name of gdb exe. Default is /usr/bin/gdb */
-void mi_set_gdb_exe(const char *name);
-const char *mi_get_gdb_exe();
-/* Indicate the name of a file containing commands to send at start-up */
-void mi_set_gdb_start(const char *name);
-const char *mi_get_gdb_start();
-/* Indicate the name of a file containing commands to send after connection */
-void mi_set_gdb_conn(const char *name);
-const char *mi_get_gdb_conn();
-void mi_send_target_commands(mi_h *h);
-/* Connect to a local copy of gdb. */
-mi_h *mi_connect_local();
-/* Close connection. You should ask gdb to quit first. */
-void  mi_disconnect(mi_h *h);
-/* Force MI version. */
-#define MI_VERSION2U(maj,mid,min) (maj*0x1000000+mid*0x10000+min)
-void  mi_force_version(mi_h *h, unsigned vMajor, unsigned vMiddle,
-                       unsigned vMinor);
-void  mi_set_workaround(unsigned wa, int enable);
-int   mi_get_workaround(unsigned wa);
-/* Parse gdb output. */
-mi_output *mi_parse_gdb_output(const char *str);
-/* Functions to set/get the tunneled streams callbacks. */
-void mi_set_console_cb(mi_h *h, stream_cb cb, void *data);
-void mi_set_target_cb(mi_h *h, stream_cb cb, void *data);
-void mi_set_log_cb(mi_h *h, stream_cb cb, void *data);
-stream_cb mi_get_console_cb(mi_h *h, void **data);
-stream_cb mi_get_target_cb(mi_h *h, void **data);
-stream_cb mi_get_log_cb(mi_h *h, void **data);
-/* The callback to deal with async events. */
-void mi_set_async_cb(mi_h *h, async_cb cb, void *data);
-async_cb mi_get_async_cb(mi_h *h, void **data);
-/* Time out in gdb responses. */
-void mi_set_time_out_cb(mi_h *h, tm_cb cb, void *data);
-tm_cb mi_get_time_out_cb(mi_h *h, void **data);
-void mi_set_time_out(mi_h *h, int to);
-int mi_get_time_out(mi_h *h);
-/* Callbacks to "see" the dialog with gdb. */
-void mi_set_to_gdb_cb(mi_h *h, stream_cb cb, void *data);
-void mi_set_from_gdb_cb(mi_h *h, stream_cb cb, void *data);
-stream_cb mi_get_to_gdb_cb(mi_h *h, void **data);
-stream_cb mi_get_from_gdb_cb(mi_h *h, void **data);
-/* Sends a message to gdb. */
-int mi_send(mi_h *h, const char *format, ...);
-/* Wait until gdb sends a response. */
-mi_output *mi_get_response_blk(mi_h *h);
-/* Check if gdb sent a complete response. Use with mi_retire_response. */
-int mi_get_response(mi_h *h);
-/* Get the last response. Use with mi_get_response. */
-mi_output *mi_retire_response(mi_h *h);
-/* Look for a result record in gdb output. */
-mi_output *mi_get_rrecord(mi_output *r);
-/* Look if the output contains an async stop.
-   If that's the case return the reason for the stop.
-   If the output contains an error the description is returned in reason. */
-int mi_get_async_stop_reason(mi_output *r, char **reason);
-mi_stop *mi_get_stopped(mi_results *r);
-mi_frames *mi_get_async_frame(mi_output *r);
-/* Wait until gdb sends a response.
-   Then check if the response is of the desired type. */
-int mi_res_simple_exit(mi_h *h);
-int mi_res_simple_done(mi_h *h);
-int mi_res_simple_running(mi_h *h);
-int mi_res_simple_connected(mi_h *h);
-/* It additionally extracts an specified variable. */
-mi_results *mi_res_done_var(mi_h *h, const char *var);
-/* Extract a frames list from the response. */
-mi_frames *mi_res_frames_array(mi_h *h, const char *var);
-mi_frames *mi_res_frames_list(mi_h *h);
-mi_frames *mi_parse_frame(mi_results *c);
-mi_frames *mi_res_frame(mi_h *h);
-/* Create an auxiliar terminal using xterm. */
-mi_aux_term *gmi_start_xterm();
-/* Indicate the name of xterm exe. Default is /usr/bin/X11/xterm */
-void mi_set_xterm_exe(const char *name);
-const char *mi_get_xterm_exe();
-/* Kill the auxiliar terminal and release the structure. */
-void gmi_end_aux_term(mi_aux_term *t);
-/* Look for a free Linux VT for the child. */
-mi_aux_term *gmi_look_for_free_vt();
-/* Look for a free and usable Linux VT. */
-int mi_look_for_free_vt();
-/* Close master and release the structure. */
-void gmi_end_pty(mi_pty *p);
-/* Look for a free pseudo terminal. */
-mi_pty *gmi_look_for_free_pty();
-/* Extract a list of thread IDs from response. */
-int mi_res_thread_ids(mi_h *h, int **list);
-int mi_get_thread_ids(mi_output *res, int **list);
-/* A variable response. */
-mi_gvar *mi_res_gvar(mi_h *h, mi_gvar *cur, const char *expression);
-enum mi_gvar_fmt mi_format_str_to_enum(const char *format);
-const char *mi_format_enum_to_str(enum mi_gvar_fmt format);
-char mi_format_enum_to_char(enum mi_gvar_fmt format);
-enum mi_gvar_lang mi_lang_str_to_enum(const char *lang);
-const char *mi_lang_enum_to_str(enum mi_gvar_lang lang);
-int mi_res_changelist(mi_h *h, mi_gvar_chg **changed);
-int mi_res_children(mi_h *h, mi_gvar *v);
-mi_bkpt *mi_res_bkpt(mi_h *h);
-mi_wp *mi_res_wp(mi_h *h);
-char *mi_res_value(mi_h *h);
-mi_stop *mi_res_stop(mi_h *h);
-enum mi_stop_reason mi_reason_str_to_enum(const char *s);
-const char *mi_reason_enum_to_str(enum mi_stop_reason r);
-int mi_get_read_memory(mi_h *h, unsigned char *dest, unsigned ws, int *na,
-                       unsigned long *addr);
-mi_asm_insns *mi_get_asm_insns(mi_h *h);
-/* Starting point of the program. */
-void mi_set_main_func(const char *name);
-const char *mi_get_main_func();
-mi_chg_reg *mi_get_list_registers(mi_h *h, int *how_many);
-int mi_get_list_registers_l(mi_h *h, mi_chg_reg *l);
-mi_chg_reg *mi_get_list_changed_regs(mi_h *h);
-int mi_get_reg_values(mi_h *h, mi_chg_reg *l);
-mi_chg_reg *mi_get_reg_values_l(mi_h *h, int *how_many);
-int gmi_target_download(mi_h *h);
-
-/* Allocation functions: */
-void *mi_calloc(size_t count, size_t sz);
-void *mi_calloc1(size_t sz);
-char *mi_malloc(size_t sz);
-mi_results       *mi_alloc_results(void);
-mi_output        *mi_alloc_output(void);
-mi_frames        *mi_alloc_frames(void);
-mi_gvar          *mi_alloc_gvar(void);
-mi_gvar_chg      *mi_alloc_gvar_chg(void);
-mi_bkpt          *mi_alloc_bkpt(void);
-mi_wp            *mi_alloc_wp(void);
-mi_stop          *mi_alloc_stop(void);
-mi_asm_insns     *mi_alloc_asm_insns(void);
-mi_asm_insn      *mi_alloc_asm_insn(void);
-mi_chg_reg       *mi_alloc_chg_reg(void);
-void mi_free_output(mi_output *r);
-void mi_free_output_but(mi_output *r, mi_output *no, mi_results *no_r);
-void mi_free_frames(mi_frames *f);
-void mi_free_aux_term(mi_aux_term *t);
-void mi_free_results(mi_results *r);
-void mi_free_results_but(mi_results *r, mi_results *no);
-void mi_free_gvar(mi_gvar *v);
-void mi_free_gvar_chg(mi_gvar_chg *p);
-void mi_free_wp(mi_wp *wp);
-void mi_free_stop(mi_stop *s);
-void mi_free_asm_insns(mi_asm_insns *i);
-void mi_free_asm_insn(mi_asm_insn *i);
-void mi_free_charp_list(char **l);
-void mi_free_chg_reg(mi_chg_reg *r);
-
-/* Porgram control: */
-/* Specify the executable and arguments for local debug. */
-int gmi_set_unwind_on_signal_on(mi_h * h);
-int gmi_set_exec(mi_h *h, const char *file, const char *args);
-/* Start running the executable. Remote sessions starts running. */
-int gmi_exec_run(mi_h *h);
-/* Continue the execution after a "stop". */
-int gmi_exec_continue(mi_h *h);
-/* Continue the execution in reverse order after a "stop". */
-int gmi_exec_continue_reverse(mi_h *h);
-/* Indicate which terminal will use the target program. For local sessions. */
-int gmi_target_terminal(mi_h *h, const char *tty_name);
-/* Specify what's the local copy that have debug info. For remote sessions. */
-int gmi_file_symbol_file(mi_h *h, const char *file);
-/* Continue until function return, the return value is included in the async
-   response. */
-int gmi_exec_finish(mi_h *h);
-/* Continue backwardly until function return, the return value is included in
-  the async response.*/
-int gmi_exec_finish_reverse(mi_h *h);
-/* Stop the program using SIGINT. */
-int gmi_exec_interrupt(mi_h *h);
-/* Next line of code. */
-int gmi_exec_next(mi_h *h);
-/* Start recording a process */
-int gmi_exec_record_process(mi_h *h);
-/* Next count lines of code. */
-int gmi_exec_next_cnt(mi_h *h, int count);
-/* Next line of assembler code. */
-int gmi_exec_next_instruction(mi_h *h);
-/* Next line of code. Get inside functions. */
-int gmi_exec_step(mi_h *h);
-/* Previous line of code. Get inside functions. */
-int gmi_exec_step_back(mi_h *h);
-/*  Previous line of code (do not step into).*/
-int gmi_exec_next_reverse(mi_h *h);
-/* Next count lines of code. Get inside functions. */
-int gmi_exec_step_cnt(mi_h *h, int count);
-/* Next line of assembler code. Get inside calls. */
-int gmi_exec_step_instruction(mi_h *h);
-/* Execute until location is reached. If file is NULL then is until next line. 
*/
-int gmi_exec_until(mi_h *h, const char *file, int line);
-int gmi_exec_until_addr(mi_h *h, void *addr);
-/* Return to previous frame inmediatly. */
-mi_frames *gmi_exec_return(mi_h *h);
-/* Just kill the program. Please read the notes in prg_control.c. */
-int gmi_exec_kill(mi_h *h);
-
-/* Target manipulation: */
-/* Connect to a remote gdbserver using the specified methode. */
-int gmi_target_select(mi_h *h, const char *type, const char *params);
-/* Attach to an already running process. */
-mi_frames *gmi_target_attach(mi_h *h, pid_t pid);
-/* Detach from an attached process. */
-int gmi_target_detach(mi_h *h);
-
-/* Miscellaneous commands: */
-/* Exit gdb killing the child is it is running. */
-void gmi_gdb_exit(mi_h *h);
-/* Send the version to the console. */
-int gmi_gdb_version(mi_h *h);
-/* Set a gdb variable. */
-int gmi_gdb_set(mi_h *h, const char *var, const char *val);
-/* Get a gdb variable. */
-char *gmi_gdb_show(mi_h *h, const char *var);
-
-/* Breakpoints manipulation: */
-/* Insert a breakpoint at file:line. */
-mi_bkpt *gmi_break_insert(mi_h *h, const char *file, int line);
-/* Insert a breakpoint, all available options. */
-mi_bkpt *gmi_break_insert_full(mi_h *h, int temporary, int hard_assist,
-                               const char *cond, int count, int thread,
-                               const char *where);
-mi_bkpt *gmi_break_insert_full_fl(mi_h *h, const char *file, int line,
-                                  int temporary, int hard_assist,
-                                  const char *cond, int count, int thread);
-/* Remove a breakpoint. */
-int gmi_break_delete(mi_h *h, int number);
-/* Free the memory used for a breakpoint description. */
-void mi_free_bkpt(mi_bkpt *b);
-/* Modify the "ignore" count for a breakpoint. */
-int gmi_break_set_times(mi_h *h, int number, int count);
-/* Associate a condition with the breakpoint. */
-int gmi_break_set_condition(mi_h *h, int number, const char *condition);
-/* Enable or disable a breakpoint. */
-int gmi_break_state(mi_h *h, int number, int enable);
-/* Set a watchpoint. It doesn't work for remote targets! */
-mi_wp *gmi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp);
-
-/* Data Manipulation. */
-/* Evaluate an expression. Returns a parsed tree. */
-char *gmi_data_evaluate_expression(mi_h *h, const char *expression);
-/* Path for sources. */
-int gmi_dir(mi_h *h, const char *path);
-/* A very limited "data read memory" implementation. */
-int gmi_read_memory(mi_h *h, const char *exp, unsigned size,
-                    unsigned char *dest, int *na, int convAddr,
-                    unsigned long *addr);
-mi_asm_insns *gmi_data_disassemble_se(mi_h *h, const char *start,
-                                      const char *end, int mode);
-mi_asm_insns *gmi_data_disassemble_fl(mi_h *h, const char *file, int line,
-                                      int lines, int mode);
-mi_chg_reg *gmi_data_list_register_names(mi_h *h, int *how_many);
-int gmi_data_list_register_names_l(mi_h *h, mi_chg_reg *l);
-mi_chg_reg *gmi_data_list_changed_registers(mi_h *h);
-int gmi_data_list_register_values(mi_h *h, enum mi_gvar_fmt fmt, mi_chg_reg 
*l);
-mi_chg_reg *gmi_data_list_all_register_values(mi_h *h, enum mi_gvar_fmt fmt, 
int *how_many);
-
-/* Stack manipulation. */
-/* List of frames. Arguments aren't filled. */
-mi_frames *gmi_stack_list_frames(mi_h *h);
-/* List of frames. Indicating a range. */
-mi_frames *gmi_stack_list_frames_r(mi_h *h, int from, int to);
-/* List arguments. Only level and args filled. */
-mi_frames *gmi_stack_list_arguments(mi_h *h, int show);
-/* List arguments. Indicating a range. Only level and args filled. */
-mi_frames *gmi_stack_list_arguments_r(mi_h *h, int show, int from, int to);
-/* Information about the current frame, including args. */
-mi_frames *gmi_stack_info_frame(mi_h *h);
-/* Stack info depth. error => -1 */
-int gmi_stack_info_depth_get(mi_h *h);
-/* Set stack info depth. error => -1 */
-int gmi_stack_info_depth(mi_h *h, int max_depth);
-/* Change current frame. */
-int gmi_stack_select_frame(mi_h *h, int framenum);
-/* List of local vars. */
-mi_results *gmi_stack_list_locals(mi_h *h, int show);
-
-/* Thread. */
-/* List available thread ids. */
-int gmi_thread_list_ids(mi_h *h, int **list);
-/* Select a thread. */
-mi_frames *gmi_thread_select(mi_h *h, int id);
-/* List available threads. */
-mi_frames *gmi_thread_list_all_threads(mi_h *h);
-
-/* Variable objects. */
-/* Create a variable object. */
-mi_gvar *gmi_var_create_nm(mi_h *h, const char *name, int frame, const char 
*exp);
-mi_gvar *gmi_var_create(mi_h *h, int frame, const char *exp);
-/* Create the variable and also fill the lang and attr fields. */
-mi_gvar *gmi_full_var_create(mi_h *h, int frame, const char *exp);
-/* Delete a variable object. Doesn't free the mi_gvar data. */
-int gmi_var_delete(mi_h *h, mi_gvar *var);
-/* Set the format used to represent the result. */
-int gmi_var_set_format(mi_h *h, mi_gvar *var, enum mi_gvar_fmt format);
-/* Fill the format field with info from gdb. */
-int gmi_var_show_format(mi_h *h, mi_gvar *var);
-/* Fill the numchild field with info from gdb. */
-int gmi_var_info_num_children(mi_h *h, mi_gvar *var);
-/* Fill the type field with info from gdb. */
-int gmi_var_info_type(mi_h *h, mi_gvar *var);
-/* Fill the expression and lang fields with info from gdb.
-   Note that lang isn't filled during creation. */
-int gmi_var_info_expression(mi_h *h, mi_gvar *var);
-/* Fill the attr field with info from gdb.
-   Note that attr isn't filled during creation. */
-int gmi_var_show_attributes(mi_h *h, mi_gvar *var);
-/* Update variable. Use NULL for all.
-   Note that *changed can be NULL if none updated. */
-int gmi_var_update(mi_h *h, mi_gvar *var, mi_gvar_chg **changed);
-/* Change variable. Fills the value field. */
-int gmi_var_assign(mi_h *h, mi_gvar *var, const char *expression);
-/* Get current value for a variable. */
-int gmi_var_evaluate_expression(mi_h *h, mi_gvar *var);
-/* List children. It ONLY returns the first level information. :-( */
-int gmi_var_list_children(mi_h *h, mi_gvar *var);
-
-
-
-
-#if 0                           /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_alloc.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_alloc.c  
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_alloc.c     
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,308 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Allocator.
-  Comments:
-  Most alloc/free routines are here. Free routines must accept NULL
-pointers. Alloc functions must set mi_error.  @<p>
-  
-***************************************************************************/
-
-#include "gdbmi.h"
-
-void *mi_calloc(size_t count, size_t sz)
-{
- void *res=calloc(count,sz);
- if (!res)
-    mi_error=MI_OUT_OF_MEMORY;
- return res;
-}
-
-void *mi_calloc1(size_t sz)
-{
- return mi_calloc(1,sz);
-}
-
-char *mi_malloc(size_t sz)
-{
- char *res=malloc(sz);
- if (!res)
-    mi_error=MI_OUT_OF_MEMORY;
- return res;
-}
-
-mi_results *mi_alloc_results(void)
-{
- return (mi_results *)mi_calloc1(sizeof(mi_results));
-}
-
-mi_output *mi_alloc_output(void)
-{
- return (mi_output *)mi_calloc1(sizeof(mi_output));
-}
-
-mi_frames *mi_alloc_frames(void)
-{
- return (mi_frames *)mi_calloc1(sizeof(mi_frames));
-}
-
-mi_gvar *mi_alloc_gvar(void)
-{
- return (mi_gvar *)mi_calloc1(sizeof(mi_gvar));
-}
-
-mi_gvar_chg *mi_alloc_gvar_chg(void)
-{
- return (mi_gvar_chg *)mi_calloc1(sizeof(mi_gvar_chg));
-}
-
-mi_bkpt *mi_alloc_bkpt(void)
-{
- mi_bkpt *b=(mi_bkpt *)mi_calloc1(sizeof(mi_bkpt));
- if (b)
-   {
-    b->thread=-1;
-    b->ignore=-1;
-   }
- return b;
-}
-
-mi_wp *mi_alloc_wp(void)
-{
- return (mi_wp *)mi_calloc1(sizeof(mi_wp));
-}
-
-mi_stop *mi_alloc_stop(void)
-{
- return (mi_stop *)mi_calloc1(sizeof(mi_stop));
-}
-
-mi_asm_insns *mi_alloc_asm_insns(void)
-{
- return (mi_asm_insns *)mi_calloc1(sizeof(mi_asm_insns));
-}
-
-mi_asm_insn *mi_alloc_asm_insn(void)
-{
- return (mi_asm_insn *)mi_calloc1(sizeof(mi_asm_insn));
-}
-
-mi_chg_reg *mi_alloc_chg_reg(void)
-{
- return (mi_chg_reg *)mi_calloc1(sizeof(mi_chg_reg));
-}
-
-/*****************************************************************************
-  Free functions
-*****************************************************************************/
-
-void mi_free_frames(mi_frames *f)
-{
- mi_frames *aux;
-
- while (f)
-   {
-    free(f->func);
-    free(f->file);
-    free(f->from);
-    mi_free_results(f->args);
-    aux=f->next;
-    free(f);
-    f=aux;
-   }
-}
-
-void mi_free_bkpt(mi_bkpt *b)
-{
- mi_bkpt *aux;
-
- while (b)
-   {
-    free(b->func);
-    free(b->file);
-    free(b->file_abs);
-    free(b->cond);
-    aux=b->next;
-    free(b);
-    b=aux;
-   }
-}
-
-void mi_free_gvar(mi_gvar *v)
-{
- mi_gvar *aux;
-
- while (v)
-   {
-    free(v->name);
-    free(v->type);
-    free(v->exp);
-    free(v->value);
-    if (v->numchild && v->child)
-       mi_free_gvar(v->child);
-    aux=v->next;
-    free(v);
-    v=aux;
-   }
-}
-
-void mi_free_gvar_chg(mi_gvar_chg *p)
-{
- mi_gvar_chg *aux;
-
- while (p)
-   {
-    free(p->name);
-    free(p->new_type);
-    aux=p->next;
-    free(p);
-    p=aux;
-   }
-}
-
-void mi_free_results_but(mi_results *r, mi_results *no)
-{
- mi_results *aux;
-
- while (r)
-   {
-    if (r==no)
-      {
-       aux=r->next;
-       r->next=NULL;
-       r=aux;
-      }
-    else
-      {
-       free(r->var);
-       switch (r->type)
-         {
-          case t_const:
-               free(r->v.cstr);
-               break;
-          case t_tuple:
-          case t_list:
-               mi_free_results_but(r->v.rs,no);
-               break;
-         }
-       aux=r->next;
-       free(r);
-       r=aux;
-      }
-   }
-}
-
-void mi_free_results(mi_results *r)
-{
- mi_free_results_but(r,NULL);
-}
-
-void mi_free_output_but(mi_output *r, mi_output *no, mi_results *no_r)
-{
- mi_output *aux;
-
- while (r)
-   {
-    if (r==no)
-      {
-       aux=r->next;
-       r->next=NULL;
-       r=aux;
-      }
-    else
-      {
-       if (r->c)
-          mi_free_results_but(r->c,no_r);
-       aux=r->next;
-       free(r);
-       r=aux;
-      }
-   }
-}
-
-void mi_free_output(mi_output *r)
-{
- mi_free_output_but(r,NULL,NULL);
-}
-
-void mi_free_stop(mi_stop *s)
-{
- if (!s)
-    return;
- mi_free_frames(s->frame);
- mi_free_wp(s->wp);
- free(s->wp_old);
- free(s->wp_val);
- free(s->gdb_result_var);
- free(s->return_value);
- free(s->signal_name);
- free(s->signal_meaning);
- free(s);
-}
-
-void mi_free_wp(mi_wp *wp)
-{
- mi_wp *aux;
- while (wp)
-   {
-    free(wp->exp);
-    aux=wp->next;
-    free(wp);
-    wp=aux;
-   }
-}
-
-void mi_free_asm_insns(mi_asm_insns *i)
-{
- mi_asm_insns *aux;
-
- while (i)
-   {
-    free(i->file);
-    mi_free_asm_insn(i->ins);
-    aux=i->next;
-    free(i);
-    i=aux;
-   }
-}
-
-void mi_free_asm_insn(mi_asm_insn *i)
-{
- mi_asm_insn *aux;
-
- while (i)
-   {
-    free(i->func);
-    free(i->inst);
-    aux=i->next;
-    free(i);
-    i=aux;
-   }
-}
-
-/*void mi_free_charp_list(char **l)
-{
- char **c=l;
- while (c)
-   {
-    free(*c);
-    c++;
-   }
- free(l);
-}*/
-
-void mi_free_chg_reg(mi_chg_reg *r)
-{
- mi_chg_reg *aux;
- while (r)
-   {
-    free(r->val);
-    free(r->name);
-    aux=r->next;
-    free(r);
-    r=aux;
-   }
-}
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_breakpoint.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_breakpoint.c     
2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_breakpoint.c    
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,265 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Breakpoint table commands.
-  Comments:
-  GDB/MI commands for the "Breakpoint Table Commands" section.
-   @<p>
-@<pre>
-gdb command:          Implemented?
-
--break-after          Yes
--break-condition      Yes
--break-delete         Yes
--break-disable        Yes
--break-enable         Yes
--break-info           N.A. (info break NUMBER) (*)
--break-insert         Yes
--break-list           No (*)
--break-watch          Yes
-@</pre>
-
-(*) I think the program should keep track of the breakpoints, so it will
-be implemented when I have more time.  @<p>
-
-***************************************************************************/
-
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_break_insert_fl(mi_h *h, const char *file, int line)
-{
- mi_send(h,"-break-insert %s:%d\n",file,line);
-}
-
-void mi_break_insert(mi_h *h, int temporary, int hard_assist,
-                     const char *cond, int count, int thread,
-                     const char *where)
-{
- char s_count[32];
- char s_thread[32];
-
- if (count>=0)
-    snprintf(s_count,32,"%d",count);
- if (thread>=0)
-    snprintf(s_thread,32,"%d",thread);
- if (cond)
-    // Conditions may contain spaces, in fact, if they don't gdb will add
-    // them after parsing. Enclosing the expression with "" solves the
-    // problem.
-    mi_send(h,"-break-insert %s %s -c \"%s\" %s %s %s %s %s\n",
-            temporary   ? "-t" : "",
-            hard_assist ? "-h" : "",
-            cond,
-            count>=0    ? "-i" : "", count>=0  ? s_count  : "",
-            thread>=0   ? "-p" : "", thread>=0 ? s_thread : "",
-            where);
- else
-    mi_send(h,"-break-insert %s %s %s %s %s %s %s\n",
-            temporary   ? "-t" : "",
-            hard_assist ? "-h" : "",
-            count>=0    ? "-i" : "", count>=0  ? s_count  : "",
-            thread>=0   ? "-p" : "", thread>=0 ? s_thread : "",
-            where);
-}
-
-void mi_break_insert_flf(mi_h *h, const char *file, int line, int temporary,
-                         int hard_assist, const char *cond, int count,
-                         int thread)
-{
- char s_count[32];
- char s_thread[32];
-
- if (count>=0)
-    snprintf(s_count,32,"%d",count);
- if (thread>=0)
-    snprintf(s_thread,32,"%d",thread);
- mi_send(h,"-break-insert %s %s %s %s %s %s %s %s %s:%d\n",
-         temporary   ? "-t" : "",
-         hard_assist ? "-h" : "",
-         cond        ? "-c" : "", cond      ? cond     : "",
-         count>=0    ? "-i" : "", count>=0  ? s_count  : "",
-         thread>=0   ? "-p" : "", thread>=0 ? s_thread : "",
-         file,line);
-}
-
-void mi_break_delete(mi_h *h, int number)
-{
- mi_send(h,"-break-delete %d\n",number);
-}
-
-void mi_break_after(mi_h *h, int number, int count)
-{
- mi_send(h,"-break-after %d %d\n",number,count);
-}
-
-void mi_break_condition(mi_h *h, int number, const char *condition)
-{
- mi_send(h,"-break-condition %d %s\n",number,condition);
-}
-
-void mi_break_enable(mi_h *h, int number)
-{
- mi_send(h,"-break-enable %d\n",number);
-}
-
-void mi_break_disable(mi_h *h, int number)
-{
- mi_send(h,"-break-disable %d\n",number);
-}
-
-void mi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp)
-{
- if (mode==wm_write)
-    mi_send(h,"-break-watch \"%s\"\n",exp);
- else
-    mi_send(h,"-break-watch -%c \"%s\"\n",mode==wm_rw ? 'a' : 'r',exp);
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  Insert a breakpoint at file:line.
-
-  Command: -break-insert file:line
-  Return: A new mi_bkpt structure with info about the breakpoint. NULL on
-error.
-  
-***************************************************************************/
-
-mi_bkpt *gmi_break_insert(mi_h *h, const char *file, int line)
-{
- mi_break_insert_fl(h,file,line);
- return mi_res_bkpt(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Insert a breakpoint, all available options.
-  
-  Command: -break-insert
-  Return: A new mi_bkpt structure with info about the breakpoint. NULL on
-error.
-  
-***************************************************************************/
-
-mi_bkpt *gmi_break_insert_full(mi_h *h, int temporary, int hard_assist,
-                               const char *cond, int count, int thread,
-                               const char *where)
-{
- mi_break_insert(h,temporary,hard_assist,cond,count,thread,where);
- return mi_res_bkpt(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Insert a breakpoint, all available options.
-  
-  Command: -break-insert [ops] file:line
-  Return: A new mi_bkpt structure with info about the breakpoint. NULL on
-error.
-  
-***************************************************************************/
-
-mi_bkpt *gmi_break_insert_full_fl(mi_h *h, const char *file, int line,
-                                  int temporary, int hard_assist,
-                                  const char *cond, int count, int thread)
-{
- mi_break_insert_flf(h,file,line,temporary,hard_assist,cond,count,thread);
- return mi_res_bkpt(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Remove a breakpoint.
-
-  Command: -break-delete
-  Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
-console.
-  
-***************************************************************************/
-
-int gmi_break_delete(mi_h *h, int number)
-{
- mi_break_delete(h,number);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Modify the "ignore" count for a breakpoint.
-
-  Command: -break-after
-  Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
-console.
-  
-***************************************************************************/
-
-int gmi_break_set_times(mi_h *h, int number, int count)
-{
- mi_break_after(h,number,count);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Associate a condition with the breakpoint.
-
-  Command: -break-condition
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_break_set_condition(mi_h *h, int number, const char *condition)
-{
- mi_break_condition(h,number,condition);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Enable or disable a breakpoint.
-
-  Command: -break-enable + -break-disable
-  Return: !=0 OK. Note that gdb always says OK, but errors can be sent to the
-console.
-  
-***************************************************************************/
-
-int gmi_break_state(mi_h *h, int number, int enable)
-{
- if (enable)
-    mi_break_enable(h,number);
- else
-    mi_break_disable(h,number);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Set a watchpoint. It doesn't work for remote targets!
-
-  Command: -break-watch
-  Return: A new mi_wp structure with info about the watchpoint. NULL on
-error.
-  
-***************************************************************************/
-
-mi_wp *gmi_break_watch(mi_h *h, enum mi_wp_mode mode, const char *exp)
-{
- mi_break_watch(h,mode,exp);
- return mi_res_wp(h);
-}
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_connect.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_connect.c        
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_connect.c   
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,885 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004-2009 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Connect.
-  Comments:
-  This module handles the dialog with gdb, including starting and stopping
-gdb.
-  @<p>
-
-GDB Bug workaround for "file -readnow": I tried to workaround a bug using
-it but looks like this option also have bugs!!!! so I have to use the
-command line option --readnow.
-It also have a bug!!!! when the binary is changed and gdb must reload it
-this option is ignored. So it looks like we have no solution but 3 gdb bugs
-in a row.
-
-***************************************************************************/
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdarg.h>
-#include <limits.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include "plibc.h"
-
-#include "gdbmi.h"
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#ifndef TEMP_FAILURE_RETRY
- #define TEMP_FAILURE_RETRY(a) (a)
-#endif
-
-int mi_error=MI_OK;
-char *mi_error_from_gdb=NULL;
-static char *gdb_exe=NULL;
-static char *xterm_exe=NULL;
-static char *gdb_start=NULL;
-static char *gdb_conn=NULL;
-static char *main_func=NULL;
-static char  disable_psym_search_workaround=0;
-
-mi_h *mi_alloc_h()
-{
- mi_h *h=(mi_h *)calloc(1,sizeof(mi_h));
- if (!h)
-   {
-    mi_error=MI_OUT_OF_MEMORY;
-    return NULL;
-   }
- h->to_gdb[0]=h->to_gdb[1]=h->from_gdb[0]=h->from_gdb[1]=-1;
- h->pid=-1;
- return h;
-}
-
-int mi_check_running_pid(pid_t pid)
-{
- int status;
-
- if (pid<=0)
-    return 0;
- /* If waitpid returns the number of our child means it communicated
-    to as a termination status. */
- if (waitpid(pid,&status,WNOHANG)==pid)
-   {
-    pid=0;
-    return 0;
-   }
- return 1;
-}
-
-int mi_check_running(mi_h *h)
-{
- return !h->died && mi_check_running_pid(h->pid);
-}
-
-void mi_kill_child(pid_t pid)
-{
- kill(pid,SIGTERM);
- usleep(100000);
- if (mi_check_running_pid(pid))
-   {
-    int status;
-    kill(pid,SIGKILL);
-    waitpid(pid,&status,0);
-   }
-}
-
-void mi_free_h(mi_h **handle)
-{
- mi_h *h=*handle;
- if (h->to_gdb[0]>=0)
-    close(h->to_gdb[0]);
- if (h->to)
-    fclose(h->to);
- else if (h->to_gdb[1]>=0)
-    close(h->to_gdb[1]);
- if (h->from)
-    fclose(h->from);
- else if (h->from_gdb[0]>=0)
-    close(h->from_gdb[0]);
- if (h->from_gdb[1]>=0)
-    close(h->from_gdb[1]);
- if (mi_check_running(h))
-   {/* GDB is running! */
-    mi_kill_child(h->pid);
-   }
- if (h->line)
-    free(h->line);
- mi_free_output(h->po);
- free(h->catched_console);
- free(h);
- *handle=NULL;
-}
-
-void mi_set_nonblk(int h)
-{
- int flf;
- flf=fcntl(h,F_GETFL,0);
- flf=flf | O_NONBLOCK;
- fcntl(h,F_SETFL,flf);
-}
-
-int mi_getline(mi_h *h)
-{
- char c;
-
- while (read(h->from_gdb[0],&c,1)==1)
-   {
-    if (h->lread>=h->llen)
-      {
-       h->llen=h->lread+128;
-       h->line=(char *)realloc(h->line,h->llen);
-       if (!h->line)
-         {
-          h->llen=0;
-          h->lread=0;
-          return -1;
-         }
-      }
-    if (c=='\n')
-      {
-       int ret=h->lread;
-       h->line[ret]=0;
-       h->lread=0;
-       return ret;
-      }
-    h->line[h->lread]=c;
-    h->lread++;
-   }
- return 0;
-}
-
-char *get_cstr(mi_output *o)
-{
- if (!o->c || o->c->type!=t_const)
-    return NULL;
- return o->c->v.cstr;
-}
-
-int mi_get_response(mi_h *h)
-{
- int l=mi_getline(h);
- if (!l)
-    return 0;
-
- if (h->from_gdb_echo)
-    h->from_gdb_echo(h->line,h->from_gdb_echo_data);
- if (strncmp(h->line,"(gdb)",5)==0)
-   {/* End of response. */
-    return 1;
-   }
- else
-   {/* Add to the response. */
-    mi_output *o;
-    int add=1, is_exit=0;
-    o=mi_parse_gdb_output(h->line);
-
-    if (!o)
-       return 0;
-    /* Tunneled streams callbacks. */
-    if (o->type==MI_T_OUT_OF_BAND && o->stype==MI_ST_STREAM)
-      {
-       char *aux;
-       add=0;
-       switch (o->sstype)
-         {
-          case MI_SST_CONSOLE:
-               aux=get_cstr(o);
-               if (h->console)
-                  h->console(aux,h->console_data);
-               if (h->catch_console && aux)
-                 {
-                  h->catch_console--;
-                  if (!h->catch_console)
-                    {
-                     free(h->catched_console);
-                     h->catched_console=strdup(aux);
-                    }
-                 }
-               break;
-          case MI_SST_TARGET:
-               /* This one seems to be useless. */
-               if (h->target)
-                  h->target(get_cstr(o),h->target_data);
-               break;
-          case MI_SST_LOG:
-               if (h->log)
-                  h->log(get_cstr(o),h->log_data);
-               break;
-         }
-      }
-    else if (o->type==MI_T_OUT_OF_BAND && o->stype==MI_ST_ASYNC)
-      {
-       if (h->async)
-          h->async(o,h->async_data);
-      }
-    else if (o->type==MI_T_RESULT_RECORD && o->tclass==MI_CL_ERROR)
-      {/* Error from gdb, record it. */
-       mi_error=MI_FROM_GDB;
-       free(mi_error_from_gdb);
-       mi_error_from_gdb=NULL;
-       if (o->c && strcmp(o->c->var,"msg")==0 && o->c->type==t_const)
-          mi_error_from_gdb=strdup(o->c->v.cstr);
-      }
-    is_exit=(o->type==MI_T_RESULT_RECORD && o->tclass==MI_CL_EXIT);
-    /* Add to the list of responses. */
-    if (add)
-      {
-       if (h->last)
-          h->last->next=o;
-       else
-          h->po=o;
-       h->last=o;
-      }
-    else
-       mi_free_output(o);
-    /* Exit RR means gdb exited, we won't get a new prompt ;-) */
-    if (is_exit)
-       return 1;
-   }
-
- return 0;
-}
-
-mi_output *mi_retire_response(mi_h *h)
-{
- mi_output *ret=h->po;
- h->po=h->last=NULL;
- return ret;
-}
-
-mi_output *mi_get_response_blk(mi_h *h)
-{
- int r;
- /* Sometimes gdb dies. */
- if (!mi_check_running(h))
-   {
-    h->died=1;
-    mi_error=MI_GDB_DIED;
-    return NULL;
-   }
- do
-   {
-   /*
-    That's a must. If we just keep trying to read and failing things
-    become really sloooowwww. Instead we try and if it fails we wait
-    until something is available.
-    TODO: Implement something with the time out, a callback to ask the
-    application is we have to wait or not could be a good thing.
-   */
-   fd_set set;
-   struct timeval timeout;
-   int ret;
-
-   r=mi_get_response(h);
-   if (r)
-      return mi_retire_response(h);
-
-   FD_ZERO(&set);
-   FD_SET(h->from_gdb[0],&set);
-   timeout.tv_sec=h->time_out;
-   timeout.tv_usec=0;
-   ret=TEMP_FAILURE_RETRY(select(FD_SETSIZE,&set,NULL,NULL,&timeout));
-   if (!ret)
-     {
-      if (!mi_check_running(h))
-        {
-         h->died=1;
-         mi_error=MI_GDB_DIED;
-         return NULL;
-        }
-      if (h->time_out_cb)
-         ret=h->time_out_cb(h->time_out_cb_data);
-      if (!ret)
-        {
-         mi_error=MI_GDB_TIME_OUT;
-         return NULL;
-        }
-     }
-   }
- while (!r);
-
- return NULL;
-}
-
-void mi_send_commands(mi_h *h, const char *file)
-{
- FILE *f;
- char b[PATH_MAX];
-
- //printf("File: %s\n",file);
- if (!file)
-    return;
- f=fopen(file,"rt");
- if (!f)
-    return;
- while (!feof(f))
-   {
-    if (fgets(b,PATH_MAX,f))
-      {
-       //printf("Send: %s\n",b);
-       mi_send (h, "%s", b);
-       mi_res_simple_done(h);
-      }
-   }
- fclose(f);
-}
-
-void mi_send_target_commands(mi_h *h)
-{
- mi_send_commands(h,gdb_conn);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Connect to a local copy of gdb. Note that the mi_h structure is something
-similar to a "FILE *" for stdio.
-  
-  Return: A new mi_h structure or NULL on error.
-  
-***************************************************************************/
-
-mi_h *mi_connect_local()
-{
- mi_h *h;
- const char *gdb=mi_get_gdb_exe();
-
- /* Start without error. */
- mi_error=MI_OK;
- /* Verify we have a GDB binary. */
- if (access(gdb,X_OK))
-   {
-    mi_error=MI_MISSING_GDB;
-    return NULL;
-   }
- /* Alloc the handle structure. */
- h=mi_alloc_h();
- if (!h)
-    return h;
- h->time_out=MI_DEFAULT_TIME_OUT;
- /* Create the pipes to connect with the child. */
- if (pipe(h->to_gdb) || pipe(h->from_gdb))
-   {
-    mi_error=MI_PIPE_CREATE;
-    mi_free_h(&h);
-    return NULL;
-   }
- mi_set_nonblk(h->to_gdb[1]);
- mi_set_nonblk(h->from_gdb[0]);
- /* Associate streams to the file handles. */
- h->to=fdopen(h->to_gdb[1],"w");
- h->from=fdopen(h->from_gdb[0],"r");
- if (!h->to || !h->from)
-   {
-    mi_error=MI_PIPE_CREATE;
-    mi_free_h(&h);
-    return NULL;
-   }
- /* Create the child. */
- h->pid=fork();
- if (h->pid==0)
-   {/* We are the child. */
-    char *argv[5];
-    /* Connect stdin/out to the pipes. */
-    dup2(h->to_gdb[0],STDIN_FILENO);
-    dup2(h->from_gdb[1],STDOUT_FILENO);
-    /* Pass the control to gdb. */
-    argv[0]=(char *)gdb; /* Is that OK? */
-    argv[1]="--interpreter=mi";
-    argv[2]="--quiet";
-    argv[3]=disable_psym_search_workaround ? 0 : "--readnow";
-    argv[4]=0;
-    execvp(argv[0],argv);
-    /* We get here only if exec failed. */
-    _exit(127);
-   }
- /* We are the parent. */
- if (h->pid==-1)
-   {/* Fork failed. */
-    mi_error=MI_FORK;
-    mi_free_h(&h);
-    return NULL;
-   }
- if (!mi_check_running(h))
-   {
-    mi_error=MI_DEBUGGER_RUN;
-    mi_free_h(&h);
-    return NULL;
-   }
- /* Wait for the prompt. */
- mi_get_response_blk(h);
- /* Send the start-up commands */
- mi_send_commands(h,gdb_start);
-
- return h;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Close connection. You should ask gdb to quit first gmi_gdb_exit.
-  
-***************************************************************************/
-
-void mi_disconnect(mi_h *h)
-{
- mi_free_h(&h);
- free(mi_error_from_gdb);
- mi_error_from_gdb=NULL;
-}
-
-void mi_set_console_cb(mi_h *h, stream_cb cb, void *data)
-{
- h->console=cb;
- h->console_data=data;
-}
-
-void mi_set_target_cb(mi_h *h, stream_cb cb, void *data)
-{
- h->target=cb;
- h->target_data=data;
-}
-
-void mi_set_log_cb(mi_h *h, stream_cb cb, void *data)
-{
- h->log=cb;
- h->log_data=data;
-}
-
-stream_cb mi_get_console_cb(mi_h *h, void **data)
-{
- if (data)
-    *data=h->console_data;
- return h->console;
-}
-
-stream_cb mi_get_target_cb(mi_h *h, void **data)
-{
- if (data)
-    *data=h->target_data;
- return h->target;
-}
-
-stream_cb mi_get_log_cb(mi_h *h, void **data)
-{
- if (data)
-    *data=h->log_data;
- return h->log;
-}
-
-void mi_set_async_cb(mi_h *h, async_cb cb, void *data)
-{
- h->async=cb;
- h->async_data=data;
-}
-
-async_cb mi_get_async_cb(mi_h *h, void **data)
-{
- if (data)
-    *data=h->async_data;
- return h->async;
-}
-
-void mi_set_to_gdb_cb(mi_h *h, stream_cb cb, void *data)
-{
- h->to_gdb_echo=cb;
- h->to_gdb_echo_data=data;
-}
-
-void mi_set_from_gdb_cb(mi_h *h, stream_cb cb, void *data)
-{
- h->from_gdb_echo=cb;
- h->from_gdb_echo_data=data;
-}
-
-stream_cb mi_get_to_gdb_cb(mi_h *h, void **data)
-{
- if (data)
-    *data=h->to_gdb_echo_data;
- return h->to_gdb_echo;
-}
-
-stream_cb mi_get_from_gdb_cb(mi_h *h, void **data)
-{
- if (data)
-    *data=h->from_gdb_echo_data;
- return h->from_gdb_echo;
-}
-
-void mi_set_time_out_cb(mi_h *h, tm_cb cb, void *data)
-{
- h->time_out_cb=cb;
- h->time_out_cb_data=data;
-}
-
-tm_cb mi_get_time_out_cb(mi_h *h, void **data)
-{
- if (data)
-    *data=h->time_out_cb_data;
- return h->time_out_cb;
-}
-
-void mi_set_time_out(mi_h *h, int to)
-{
- h->time_out=to;
-}
-
-int mi_get_time_out(mi_h *h)
-{
- return h->time_out;
-}
-
-int mi_send(mi_h *h, const char *format, ...)
-{
- int ret;
- char *str;
- va_list argptr;
-
- if (h->died)
-    return 0;
-
- va_start(argptr,format);
- ret=vasprintf(&str,format,argptr);
- va_end(argptr);
- if (-1 != ret)
-   {
-     fputs(str,h->to);
-     fflush(h->to);
-     if (h->to_gdb_echo)
-       h->to_gdb_echo(str,h->to_gdb_echo_data);
-     free(str);
-   }
- else
-   {
-     abort ();
-   }
-
- return ret;
-}
-
-void mi_clean_up_globals()
-{
- free(gdb_exe);
- gdb_exe=NULL;
- free(xterm_exe);
- xterm_exe=NULL;
- free(gdb_start);
- gdb_start=NULL;
- free(gdb_conn);
- gdb_conn=NULL;
- free(main_func);
- main_func=NULL;
-}
-
-void mi_register_exit()
-{
- static int registered=0;
- if (!registered)
-   {
-    registered=1;
-    atexit(mi_clean_up_globals);
-   }
-}
-
-void mi_set_gdb_exe(const char *name)
-{
- free(gdb_exe);
- gdb_exe=name ? strdup(name) : NULL;
- mi_register_exit();
-}
-
-void mi_set_gdb_start(const char *name)
-{
- free(gdb_start);
- gdb_start=name ? strdup(name) : NULL;
- mi_register_exit();
-}
-
-void mi_set_gdb_conn(const char *name)
-{
- free(gdb_conn);
- gdb_conn=name ? strdup(name) : NULL;
- mi_register_exit();
-}
-
-static
-char *mi_search_in_path(const char *file)
-{
- char *path, *pt, *r;
- char test[PATH_MAX];
- struct stat st;
-
- path=getenv("PATH");
- if (!path)
-    return NULL;
- pt=strdup(path);
- r=strtok(pt,PATH_SEPARATOR_STR);
- while (r)
-   {
-    strcpy(test,r);
-    strcat(test,"/");
-    strcat(test,file);
-    if (stat(test,&st)==0 && S_ISREG(st.st_mode))
-      {
-       free(pt);
-       return strdup(test);
-      }
-    r=strtok(NULL,PATH_SEPARATOR_STR);
-   }
- free(pt);
- return NULL;
-}
-
-const char *mi_get_gdb_exe()
-{
- if (!gdb_exe)
-   {/* Look for gdb in path */
-    gdb_exe=mi_search_in_path("gdb");
-    if (!gdb_exe)
-       return "/usr/bin/gdb";
-   }
- return gdb_exe;
-}
-
-const char *mi_get_gdb_start()
-{
- return gdb_start;
-}
-
-const char *mi_get_gdb_conn()
-{
- return gdb_conn;
-}
-
-void mi_set_xterm_exe(const char *name)
-{
- free(xterm_exe);
- xterm_exe=name ? strdup(name) : NULL;
- mi_register_exit();
-}
-
-const char *mi_get_xterm_exe()
-{
- if (!xterm_exe)
-   {/* Look for xterm in path */
-    xterm_exe=mi_search_in_path("xterm");
-    if (!xterm_exe)
-       return "/usr/bin/X11/xterm";
-   }
- return xterm_exe;
-}
-
-void mi_set_main_func(const char *name)
-{
- free(main_func);
- main_func=name ? strdup(name) : NULL;
- mi_register_exit();
-}
-
-const char *mi_get_main_func()
-{
- if (main_func)
-    return main_func;
- return "main";
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Opens a new xterm to be used by the child process to debug.
-  
-  Return: A new mi_aux_term structure, you can use gmi_end_aux_term to
-release it.
-  
-***************************************************************************/
-
-mi_aux_term *gmi_start_xterm()
-{
- char nsh[14]="/tmp/shXXXXXX";
- char ntt[14]="/tmp/ttXXXXXX";
- const char *xterm;
- struct stat st;
- int hsh, htt=-1;
- mi_aux_term *res=NULL;
- FILE *f;
- pid_t pid;
- char buf[PATH_MAX];
-
- /* Verify we have an X terminal. */
- xterm=mi_get_xterm_exe();
- if (access(xterm,X_OK))
-   {
-    mi_error=MI_MISSING_XTERM;
-    return NULL;
-   }
-
- /* Create 2 temporals. */
- hsh=mkstemp(nsh);
- if (hsh==-1)
-   {
-    mi_error=MI_CREATE_TEMPORAL;
-    return NULL;
-   }
- htt=mkstemp(ntt);
- if (htt==-1)
-   {
-    close(hsh);
-    unlink(nsh);
-    mi_error=MI_CREATE_TEMPORAL;
-    return NULL;
-   }
- close(htt);
- /* Create the script. */
- f=fdopen(hsh,"w");
- if (!f)
-   {
-    close(hsh);
-    unlink(nsh);
-    unlink(ntt);
-    mi_error=MI_CREATE_TEMPORAL;
-    return NULL;
-   }
- fprintf(f,"#!/bin/sh\n");
- fprintf(f,"tty > %s\n",ntt);
- fprintf(f,"rm %s\n",nsh);
- fprintf(f,"sleep 365d\n");
- fclose(f);
- /* Spawn xterm. */
- /* Create the child. */
- pid=fork();
- if (pid==0)
-   {/* We are the child. */
-    char *argv[5];
-    /* Pass the control to gdb. */
-    argv[0]=(char *)mi_get_xterm_exe(); /* Is that ok? */
-    argv[1]="-e";
-    argv[2]="/bin/sh";
-    argv[3]=nsh;
-    argv[4]=0;
-    execvp(argv[0],argv);
-    /* We get here only if exec failed. */
-    unlink(nsh);
-    unlink(ntt);
-    _exit(127);
-   }
- /* We are the parent. */
- if (pid==-1)
-   {/* Fork failed. */
-    unlink(nsh);
-    unlink(ntt);
-    mi_error=MI_FORK;
-    return NULL;
-   }
- /* Wait until the shell is deleted. */
- while (stat(nsh,&st)==0)
-   usleep(1000);
- /* Try to read the tty name. */
- f=fopen(ntt,"rt");
- if (f)
-   {
-    if (fgets(buf,PATH_MAX,f))
-      {
-       char *s; /* Strip the \n. */
-       for (s=buf; *s && *s!='\n'; s++);
-       *s=0;
-       res=(mi_aux_term *)malloc(sizeof(mi_aux_term));
-       if (res)
-         {
-          res->pid=pid;
-          res->tty=strdup(buf);
-         }
-      }
-    fclose(f);
-   }
- unlink(ntt);
- return res;
-}
-
-void mi_free_aux_term(mi_aux_term *t)
-{
- if (!t)
-    return;
- free(t->tty);
- free(t);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Closes the auxiliar terminal and releases the allocated memory.
-  
-***************************************************************************/
-
-void gmi_end_aux_term(mi_aux_term *t)
-{
- if (!t)
-    return;
- if (t->pid!=-1 && mi_check_running_pid(t->pid))
-    mi_kill_child(t->pid);
- mi_free_aux_term(t);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Forces the MI version. Currently the library can't detect it so you must
-force it manually. GDB 5.x implemented MI v1 and 6.x v2.
-  
-***************************************************************************/
-
-void mi_force_version(mi_h *h, unsigned vMajor, unsigned vMiddle,
-                      unsigned vMinor)
-{
- h->version=MI_VERSION2U(vMajor,vMiddle,vMinor);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Dis/Enables the workaround for a bug in gdb.
-
-***************************************************************************/
-
-void mi_set_workaround(unsigned wa, int enable)
-{
- switch (wa)
-   {
-    case MI_PSYM_SEARCH:
-         disable_psym_search_workaround=enable ? 0 : 1;
-         break;
-   }
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Finds if the workaround for a bug in gdb is enabled.
-  
-  Return: !=0 if enabled.
-  
-***************************************************************************/
-
-int mi_get_workaround(unsigned wa)
-{
- switch (wa)
-   {
-    case MI_PSYM_SEARCH:
-         return disable_psym_search_workaround==0;
-   }
- return 0;
-}
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_data_man.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_data_man.c       
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_data_man.c  
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,243 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Data manipulation.
-  Comments:
-  GDB/MI commands for the "Data manipulation" section.
-
-  @<p>
-
-@<pre>
-gdb command:                       Implemented?
-
--data-disassemble                  Yes
--data-evaluate-expression          Yes
--data-list-changed-registers       No
--data-list-register-names          Yes
--data-list-register-values         No
--data-read-memory                  No
--display-delete                    N.A. (delete display)
--display-disable                   N.A. (disable display)
--display-enable                    N.A. (enable display)
--display-insert                    N.A. (display)
--display-list                      N.A. (info display)
--environment-cd                    No
--environment-directory             Yes, MI v1 implementation
--environment-path                  No
-@</pre>
-
-Notes:  @<p>
-
-1) -display* aren't implemented. You can use CLI command display, but the
-results are sent to the console. So it looks like the best is to manually
-use -data-evaluate-expression to emulate it.  @<p>
-
-2) GDB bug mi/1770: Affects gdb<=6.2, when you ask for the names of the
-registers you get it plus the name of the "pseudo-registers", but if you
-try to get the value of a pseudo-register you get an error saying the
-register number is invalid. I reported to address@hidden
-on 2004/08/25 and as I didn't get any answer I filled a bug report on
-2004/09/02. The patch to fix this annoying bug is:
-
-Index: gdb/mi/mi-main.c
-===================================================================
-RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
-retrieving revision 1.64
-diff -u -r1.64 mi-main.c
---- gdb/mi/mi-main.c    3 Aug 2004 00:57:27 -0000       1.64
-+++ gdb/mi/mi-main.c    25 Aug 2004 14:12:50 -0000
-@@ -423,7 +423,7 @@
-      case, some entries of REGISTER_NAME will change depending upon
-      the particular processor being debugged.
-
--  numregs = NUM_REGS;
-+  numregs = NUM_REGS + NUM_PSEUDO_REGS;
-
-   if (argc == 0)
-     {
-----
-
-Note I had to remove an end of comment in the patch to include it here.
-This bug forced me to create another set of functions. The only way is to
-first get the values and then the names.
-Fixed by Changelog entry:
-
-2004-09-12  Salvador E. Tropea  <address@hidden>
-            Andrew Cagney  <address@hidden>
-
-        * mi/mi-main.c (mi_cmd_data_list_changed_registers)
-        (mi_cmd_data_list_register_values)
-        (mi_cmd_data_write_register_values): Include the PSEUDO_REGS in
-        the register number computation.
-
-***************************************************************************/
-
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_data_evaluate_expression(mi_h *h, const char *expression)
-{
- mi_send(h,"-data-evaluate-expression \"%s\"\n",expression);
-}
-
-void mi_dir(mi_h *h, const char *path)
-{
- if (h->version>=MI_VERSION2U(2,0,0))
-   {// MI v2
-    if (path)
-       mi_send(h,"-environment-directory \"%s\"\n",path);
-    else
-       mi_send(h,"-environment-directory -r\n");
-   }
- else
-   {
-    mi_send(h,"-environment-directory %s\n",path ? path : "");
-   }
-}
-
-void mi_data_read_memory_hx(mi_h *h, const char *exp, unsigned ws,
-                            unsigned c, int convAddr)
-{
- if (convAddr)
-    mi_send(h,"-data-read-memory \"&%s\" x %d 1 %d\n",exp,ws,c);
- else
-    mi_send(h,"-data-read-memory \"%s\" x %d 1 %d\n",exp,ws,c);
-}
-
-void mi_data_disassemble_se(mi_h *h, const char *start, const char *end,
-                            int mode)
-{
- mi_send(h,"-data-disassemble -s \"%s\" -e \"%s\" -- %d\n",start,end,mode);
-}
-
-void mi_data_disassemble_fl(mi_h *h, const char *file, int line, int lines,
-                            int mode)
-{
- mi_send(h,"-data-disassemble -f \"%s\" -l %d -n %d -- %d\n",file,line,lines,
-         mode);
-}
-
-void mi_data_list_register_names(mi_h *h)
-{
- mi_send(h,"-data-list-register-names\n");
-}
-
-void mi_data_list_register_names_l(mi_h *h, mi_chg_reg *l)
-{
- mi_send(h,"-data-list-register-names ");
- while (l)
-   {
-    mi_send(h,"%d ",l->reg);
-    l=l->next;
-   }
- mi_send(h,"\n");
-}
-
-void mi_data_list_changed_registers(mi_h *h)
-{
- mi_send(h,"-data-list-changed-registers\n");
-}
-
-void mi_data_list_register_values(mi_h *h, enum mi_gvar_fmt fmt, mi_chg_reg *l)
-{
- mi_send(h,"-data-list-register-values %c ",mi_format_enum_to_char(fmt));
- while (l)
-   {
-    mi_send(h,"%d ",l->reg);
-    l=l->next;
-   }
- mi_send(h,"\n");
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  Evaluate an expression. Returns a parsed tree.
-
-  Command: -data-evaluate-expression
-  Return: The resulting value (as plain text) or NULL on error.
-  
-***************************************************************************/
-
-char *gmi_data_evaluate_expression(mi_h *h, const char *expression)
-{
- mi_data_evaluate_expression(h,expression);
- return mi_res_value(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Path for sources. You must use it to indicate where are the sources for
-the program to debug. Only the MI v1 implementation is available.
-
-  Command: -environment-directory
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_dir(mi_h *h, const char *path)
-{
- mi_dir(h,path);
- return mi_res_simple_done(h);
-}
-
-int gmi_read_memory(mi_h *h, const char *exp, unsigned size,
-                    unsigned char *dest, int *na, int convAddr,
-                    unsigned long *addr)
-{
- mi_data_read_memory_hx(h,exp,1,size,convAddr);
- return mi_get_read_memory(h,dest,1,na,addr);
-}
-
-mi_asm_insns *gmi_data_disassemble_se(mi_h *h, const char *start,
-                                      const char *end, int mode)
-{
- mi_data_disassemble_se(h,start,end,mode);
- return mi_get_asm_insns(h);
-}
-
-mi_asm_insns *gmi_data_disassemble_fl(mi_h *h, const char *file, int line,
-                                      int lines, int mode)
-{
- mi_data_disassemble_fl(h,file,line,lines,mode);
- return mi_get_asm_insns(h);
-}
-
-// Affected by gdb bug mi/1770
-mi_chg_reg *gmi_data_list_register_names(mi_h *h, int *how_many)
-{
- mi_data_list_register_names(h);
- return mi_get_list_registers(h,how_many);
-}
-
-int gmi_data_list_register_names_l(mi_h *h, mi_chg_reg *l)
-{
- mi_data_list_register_names_l(h,l);
- return mi_get_list_registers_l(h,l);
-}
-
-mi_chg_reg *gmi_data_list_changed_registers(mi_h *h)
-{
- mi_error=MI_OK;
- mi_data_list_changed_registers(h);
- return mi_get_list_changed_regs(h);
-}
-
-int gmi_data_list_register_values(mi_h *h, enum mi_gvar_fmt fmt, mi_chg_reg *l)
-{
- mi_data_list_register_values(h,fmt,l);
- return mi_get_reg_values(h,l);
-}
-
-mi_chg_reg *gmi_data_list_all_register_values(mi_h *h, enum mi_gvar_fmt fmt, 
int *how_many)
-{
- mi_data_list_register_values(h,fmt,NULL);
- return mi_get_reg_values_l(h,how_many);
-}
-

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_error.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_error.c  
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_error.c     
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,38 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Error.
-  Comment:
-  Translates error numbers into messages.
-  
-***************************************************************************/
-
-#include "gdbmi.h"
-
-static
-const char *error_strs[]=
-{
- "Ok",
- "Out of memory",
- "Pipe creation",
- "Fork failed",
- "GDB not running",
- "Parser failed",
- "Unknown asyn response",
- "Unknown result response",
- "Error from gdb",
- "Time out in gdb response",
- "GDB suddenly died",
- "Can't execute X terminal",
- "Failed to create temporal",
- "Can't execute the debugger"
-};
-
-const char *mi_get_error_str()
-{
- if (mi_error<0 || mi_error>MI_LAST_ERROR)
-    return "Unknown";
- return error_strs[mi_error];
-}

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_get_free_pty.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_get_free_pty.c   
2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_get_free_pty.c  
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,132 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: pseudo terminal
-  Comments:
-  Helper to find a free pseudo terminal. Use this if you need to manage
-  input *and* output to the target process. If you just need output then
-  define a handler for target output stream records (assuming that this
-  is working for your particular version of gdb).
-  Usage:
-
-        mi_pty *pty = gmi_look_for_free_pty();
-        if (pty) gmi_target_terminal(mih, pty->slave);
-        ...
-        * reading from pty->master will get stdout from target *
-        * writing to pty->master will send to target stdin *
-        
-  Note: Contributed by Greg Watson (gwatson lanl gov)
-
-***************************************************************************/
-
-#define _GNU_SOURCE
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-
-#include "gdbmi.h"
-
-/**[txh]********************************************************************
-
-  Description:
-  Look for a free and usable pseudo terminal. Low level, use
-  gmi_look_for_free_pty().
-  
-  Return: A file descriptor connected to the master pty and the name of the 
slave device, or <0 on error.
-  
-***************************************************************************/
-
-#ifdef __APPLE__
-
-#include <util.h>
-
-int mi_look_for_free_pty(int *master, char **slave)
-{
- int fdmaster;
- int fdslave;
- static char name[BUFSIZ];
-
- if (openpty(&fdmaster,&fdslave,name,NULL,NULL)<0)
-    return -1;
-
- (void)close(fdslave); /* this will be reopened by gdb */
- *master=fdmaster;
- *slave =name;
-
- return 0;
-}
-
-#elif defined(__linux__)
-
-int mi_look_for_free_pty(int *master, char **slave)
-{
- if ((*master=open("/dev/ptmx",O_RDWR))<0)
-    return -1;
- if (grantpt(*master)<0 || unlockpt(*master)<0)
-    return -1;
- *slave = ptsname(*master);
-
- return 0;
-}
-
-#else /* undefined o/s */
-
-int mi_look_for_free_pty(int *master, char **slave)
-{
- return -1;
-}
-#endif
-
-/**[txh]********************************************************************
-
-  Description:
-  Look for a free and usable pseudo terminal to be used by the child.
-  
-  Return: A new mi_pty structure, you can use gmi_end_pty to
-release it.
-  
-***************************************************************************/
-
-mi_pty *gmi_look_for_free_pty()
-{
- int master;
- char *slave;
- int pty=mi_look_for_free_pty(&master,&slave);
- mi_pty *res;
-
- if (pty<0)
-    return NULL;
- res=(mi_pty *)malloc(sizeof(mi_pty));
- if (!res)
-    return NULL;
- res->slave=strdup(slave);
- res->master=master;
- return res;
-}
-
-void mi_free_pty(mi_pty *p)
-{
- if (!p)
-    return;
- free(p->slave);
- free(p);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Closes the pseudo termial master and releases the allocated memory.
-  
-***************************************************************************/
-
-void gmi_end_pty(mi_pty *p)
-{
- if (!p)
-    return;
- close(p->master);
- mi_free_pty(p);
-}

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_get_free_vt.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_get_free_vt.c    
2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_get_free_vt.c   
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,156 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Linux VT.
-  Comments:
-  Helper to find a free VT. That's 100% Linux address@hidden
-  The code comes from "lconsole.c" from Allegro project and was originally
-created by Marek Habersack and then modified by George Foot. I addapted it
-to my needs and changed license from giftware to address@hidden
-  
-***************************************************************************/
-
-#define _GNU_SOURCE
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#ifdef __APPLE__
-#include <util.h>
-#endif /* __APPLE__ */
-
-#include "gdbmi.h"
-
-#if !defined(__linux__)
-
-int mi_look_for_free_vt()
-{
- return -1;
-}
-
-mi_aux_term *gmi_look_for_free_vt()
-{
- return NULL;
-}
-
-#else
-
-#include <linux/vt.h>
-
-/**[txh]********************************************************************
-
-  Description:
-  Look for a free and usable Linux VT. Low level, use
address@hidden
-  
-  Return: The VT number or <0 on error.
-  
-***************************************************************************/
-
-int mi_look_for_free_vt()
-{/* Code from Allegro. */
- int tty, console_fd, fd;
- unsigned short mask;
- char tty_name[16];
- struct vt_stat vts; 
-
- /* Now we need to find a VT we can use.  It must be readable and
-  * writable by us, if we're not setuid root.  VT_OPENQRY itself
-  * isn't too useful because it'll only ever come up with one 
-  * suggestion, with no guarrantee that we actually have access 
-  * to it.
-  *
-  * At some stage I think this is a candidate for config
-  * file overriding, but for now we'll stat the first N consoles
-  * to see which ones we can write to (hopefully at least one!),
-  * so that we can use that one to do ioctls.  We used to use 
-  * /dev/console for that purpose but it looks like it's not 
-  * always writable by enough people.
-  *
-  * Having found and opened a writable device, we query the state
-  * of the first sixteen (fifteen really) consoles, and try 
-  * opening each unused one in turn.
-  */
-
- console_fd=open("/dev/console",O_WRONLY);
- if (console_fd<0)
-   {
-    int n;
-    /* Try some ttys instead... */
-    for (n=1; n<=24; n++)
-       {
-        snprintf(tty_name,sizeof(tty_name),"/dev/tty%d",n);
-        console_fd=open(tty_name,O_WRONLY);
-        if (console_fd>=0)
-           break;
-       }
-    if (n>24)
-       return -1;
-   }
-
- /* Get the state of the console -- in particular, the free VT field */
- if (ioctl(console_fd,VT_GETSTATE,&vts)) {
-        close(console_fd);
-    return -2;
- }
- close(console_fd);
-
- /* We attempt to set our euid to 0; if we were run with euid 0 to
-  * start with, we'll be able to do this now.  Otherwise, we'll just
-  * ignore the error returned since it might not be a problem if the
-  * ttys we look at are owned by the user running the program. */
- seteuid(0);
-
- /* tty0 is not really a console, so start counting at 2. */
- fd=-1;
- for (tty=1, mask=2; mask; tty++, mask<<=1)
-     if (!(vts.v_state & mask))
-       {
-        snprintf(tty_name,sizeof(tty_name),"/dev/tty%d",tty);
-        fd=open(tty_name,O_RDWR);
-        if (fd!=-1)
-          {
-           close(fd);
-           break;
-          }
-       }
-
- seteuid(getuid());
-
- if (!mask)
-    return -3;
-
- return tty;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Look for a free and usable Linux VT to be used by the child.
-  
-  Return: A new mi_aux_term structure, you can use @x{gmi_end_aux_term} to
-release it.
-  
-***************************************************************************/
-
-mi_aux_term *gmi_look_for_free_vt()
-{
- int ret;
- int vt=mi_look_for_free_vt();
- mi_aux_term *res;
-
- if (vt<0)
-    return NULL;
- res=(mi_aux_term *)malloc(sizeof(mi_aux_term));
- if (!res)
-    return NULL;
- res->pid=-1;
- ret = asprintf(&res->tty,"/dev/tty%d",vt);
- return res;
-}
-
-#endif
-

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_misc.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_misc.c   
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_misc.c      
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,118 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Miscellaneous commands.
-  Comments:
-  GDB/MI commands for the "Miscellaneous Commands" section.  @<p>
-
-@<pre>
-gdb command:       Implemented?
-
--gdb-exit          Yes
--gdb-set           Yes
--gdb-show          Yes
--gdb-version       Yes
-@</pre>
-
-GDB Bug workaround for "-gdb-show architecture": gdb 6.1 and olders doesn't
-report it in "value", but they give the output of "show architecture". In
-6.4 we observed that not even a clue is reported. So now we always use
-"show architecture".
-
-***************************************************************************/
-
-#include <string.h>
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_gdb_exit(mi_h *h)
-{
- mi_send(h,"-gdb-exit\n");
-}
-
-void mi_gdb_version(mi_h *h)
-{
- mi_send(h,"-gdb-version\n");
-}
-
-void mi_gdb_set(mi_h *h, const char *var, const char *val)
-{
- mi_send(h,"-gdb-set %s %s\n",var,val);
-}
-
-void mi_gdb_show(mi_h *h, const char *var)
-{
- if (strcmp(var,"architecture")==0)
-    mi_send(h,"show %s\n",var);
- else
-    mi_send(h,"-gdb-show %s\n",var);
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  Exit gdb killing the child is it is running.
-
-  Command: -gdb-exit
-
-***************************************************************************/
-
-void gmi_gdb_exit(mi_h *h)
-{
- mi_gdb_exit(h);
- mi_res_simple_exit(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Send the version to the console.
-
-  Command: -gdb-version
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_gdb_version(mi_h *h)
-{
- mi_gdb_version(h);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Set a gdb variable.
-
-  Command: -gdb-set
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_gdb_set(mi_h *h, const char *var, const char *val)
-{
- mi_gdb_set(h,var,val);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Get a gdb variable.
-
-  Command: -gdb-show
-  Return: The current value of the variable or NULL on error.
-  
-***************************************************************************/
-
-char *gmi_gdb_show(mi_h *h, const char *var)
-{
- mi_gdb_show(h,var);
- return mi_res_value(h);
-}
-

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_parse.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_parse.c  
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_parse.c     
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,1927 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004-2007 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Parser.
-  Comments:
-  Parses the output of gdb. It basically converts the text from gdb into a
-tree (could be a complex one) that we can easily interpret using C code.
-  
-***************************************************************************/
-
-#include <ctype.h>
-#include <string.h>
-#include <assert.h>
-#include "gdbmi.h"
-
-mi_results *mi_get_result(const char *str, const char **end);
-int mi_get_value(mi_results *r, const char *str, const char **end);
-
-
-/* GDB BUG!!!! I got:
-^error,msg="Problem parsing arguments: data-evaluate-expression ""1+2"""
-Afects gdb 2002-04-01-cvs and 6.1.1 for sure.
-That's an heuristical workaround.
-*/
-static inline
-int EndOfStr(const char *s)
-{
- if (*s=='"')
-   {
-    s++;
-    return !*s || *s==',' || *s==']' || *s=='}';
-   }
- return 0;
-}
-
-int mi_get_cstring_r(mi_results *r, const char *str, const char **end)
-{
- const char *s;
- char *d;
- int len;
-
- if (*str!='"')
-   {
-    mi_error=MI_PARSER;
-    return 0;
-   }
- str++;
- /* Meassure. */
- for (s=str, len=0; *s && !EndOfStr(s); s++)
-    {
-        if (!*s) {
-                mi_error = MI_PARSER;
-                return 0;
-        }
-     if (*s=='\\')
-        s++;
-     len++;
-    }
- /* Copy. */
- r->type=t_const;
- d=r->v.cstr=mi_malloc(len+1);
- if (!r->v.cstr)
-    return 0;
- for (s=str; *s && !EndOfStr(s); s++, d++)
-    {
-     if (*s=='\\')
-       {
-        s++;
-        switch (*s)
-          {
-           case 'n':
-                *d='\n';
-                break;
-           case 't':
-                *d='\t';
-                break;
-           default:
-                *d=*s;
-          }
-       }
-     else
-        *d=*s;
-    }
- *d=0;
- if (end)
-    *end=s+1;
-
- return 1;
-}
-
-/* TODO: What's a valid variable name?
-   I'll assume a-zA-Z0-9_- */
-inline
-int mi_is_var_name_char(char c)
-{
- return isalnum(c) || c=='-' || c=='_';
-}
-
-char *mi_get_var_name(const char *str, const char **end)
-{
- const char *s;
- char *r;
- int l;
- /* Meassure. */
- for (s=str; *s && mi_is_var_name_char(*s); s++);
- if (*s!='=')
-   {
-    mi_error=MI_PARSER;
-    return NULL;
-   }
- /* Allocate. */
- l=s-str;
- r=mi_malloc(l+1);
- /* Copy. */
- if (NULL != r) {
-        memcpy(r,str,l);
-        r[l]=0;
- }
- if (end)
-    *end=s+1;
- return r;
-}
-
-
-int mi_get_list_res(mi_results *r, const char *str, const char **end, char 
closeC)
-{
- mi_results *last_r, *rs;
-
- last_r=NULL;
- do
-   {
-    rs=mi_get_result(str,&str);
-    if (last_r)
-       last_r->next=rs;
-    else
-       r->v.rs=rs;
-    last_r=rs;
-    if (*str==closeC)
-      {
-       *end=str+1;
-       return 1;
-      }
-    if (*str!=',')
-       break;
-    str++;
-   }
- while (1);
-
- mi_error=MI_PARSER;
- return 0;
-}
-
-#ifdef __APPLE__
-int mi_get_tuple_val(mi_results *r, const char *str, const char **end)
-{
- mi_results *last_r, *rs;
-
- last_r=NULL;
- do
-   {
-    rs=mi_alloc_results();
-    if (!rs || !mi_get_value(rs,str,&str))
-      {
-       mi_free_results(rs);
-       return 0;
-      }
-    /* Note that rs->var is NULL, that indicates that's just a value and not
-       a result. */
-    if (last_r)
-       last_r->next=rs;
-    else
-       r->v.rs=rs;
-    last_r=rs;
-    if (*str=='}')
-      {
-       *end=str+1;
-       return 1;
-      }
-    if (*str!=',')
-       break;
-    str++;
-   }
- while (1);
-
- mi_error=MI_PARSER;
- return 0;
-}
-#endif /* __APPLE__ */
-
-int mi_get_tuple(mi_results *r, const char *str, const char **end)
-{
- if (*str!='{')
-   {
-    mi_error=MI_PARSER;
-    return 0;
-   }
- r->type=t_tuple;
- str++;
- if (*str=='}')
-   {/* Special case: empty tuple */
-    *end=str+1;
-    return 1;
-   }
- #ifdef __APPLE__
- if (mi_is_var_name_char(*str))
-    return mi_get_list_res(r,str,end,'}');
- return mi_get_tuple_val(r,str,end);
- #else /* __APPLE__ */
- return mi_get_list_res(r,str,end,'}');
- #endif /* __APPLE__ */
-}
-
-int mi_get_list_val(mi_results *r, const char *str, const char **end)
-{
- mi_results *last_r, *rs;
-
- last_r=NULL;
- do
-   {
-    rs=mi_alloc_results();
-    if (!rs || !mi_get_value(rs,str,&str))
-      {
-       mi_free_results(rs);
-       return 0;
-      }
-    /* Note that rs->var is NULL, that indicates that's just a value and not
-       a result. */
-    if (last_r)
-       last_r->next=rs;
-    else
-       r->v.rs=rs;
-    last_r=rs;
-    if (*str==']')
-      {
-       *end=str+1;
-       return 1;
-      }
-    if (*str!=',')
-       break;
-    str++;
-   }
- while (1);
-
- mi_error=MI_PARSER;
- return 0;
-}
-
-int mi_get_list(mi_results *r, const char *str, const char **end)
-{
- if (*str!='[')
-   {
-    mi_error=MI_PARSER;
-    return 0;
-   }
- r->type=t_list;
- str++;
- if (*str==']')
-   {/* Special case: empty list */
-    *end=str+1;
-    return 1;
-   }
- /* Comment: I think they could choose () for values. Is confusing in this 
way. */
- if (mi_is_var_name_char(*str))
-    return mi_get_list_res(r,str,end,']');
- return mi_get_list_val(r,str,end);
-}
-
-int mi_get_value(mi_results *r, const char *str, const char **end)
-{
- switch (str[0])
-   {
-    case '"':
-         return mi_get_cstring_r(r,str,end);
-    case '{':
-         return mi_get_tuple(r,str,end);
-    case '[':
-         return mi_get_list(r,str,end);
-   }
- mi_error=MI_PARSER;
- return 0;
-}
-
-mi_results *mi_get_result(const char *str, const char **end)
-{
- char *var;
- mi_results *r;
-
- var=mi_get_var_name(str,&str);
- if (!var)
-    return NULL;
-
- r=mi_alloc_results();
- if (!r)
-   {
-    free(var);
-    return NULL;
-   }
- r->var=var;
-
- if (!mi_get_value(r,str,end))
-   {
-    mi_free_results(r);
-    return NULL;
-   }
-
- return r;
-}
-
-mi_output *mi_get_results_alone(mi_output *r,const char *str)
-{
- mi_results *last_r, *rs;
-
- /* * results */
- last_r=NULL;
- do
-   {
-    if (!*str)
-       return r;
-    if (*str!=',')
-      {
-       mi_error=MI_PARSER;
-       break;
-      }
-    str++;
-    rs=mi_get_result(str,&str);
-    if (!rs)
-       break;
-    if (!last_r)
-       r->c=rs;
-    else
-       last_r->next=rs;
-    last_r=rs;
-   }
- while (1);
- mi_free_output(r);
- return NULL;
-}
-
-mi_output *mi_parse_result_record(mi_output *r,const char *str)
-{
- r->type=MI_T_RESULT_RECORD;
-
- /* Solve the result-class. */
- if (strncmp(str,"done",4)==0)
-   {
-    str+=4;
-    r->tclass=MI_CL_DONE;
-   }
- else if (strncmp(str,"running",7)==0)
-   {
-    str+=7;
-    r->tclass=MI_CL_RUNNING;
-   }
- else if (strncmp(str,"connected",9)==0)
-   {
-    str+=9;
-    r->tclass=MI_CL_CONNECTED;
-   }
- else if (strncmp(str,"error",5)==0)
-   {
-    str+=5;
-    r->tclass=MI_CL_ERROR;
-   }
- else if (strncmp(str,"exit",4)==0)
-   {
-    str+=4;
-    r->tclass=MI_CL_EXIT;
-   }
- else
-   {
-    mi_error=MI_UNKNOWN_RESULT;
-    return NULL;
-   }
-
- return mi_get_results_alone(r,str);
-}
-
-mi_output *mi_parse_asyn(mi_output *r,const char *str)
-{
- r->type=MI_T_OUT_OF_BAND;
- r->stype=MI_ST_ASYNC;
- /* async-class. */
- if (strncmp(str,"stopped",7)==0)
-   {
-    r->tclass=MI_CL_STOPPED;
-    str+=7;
-    return mi_get_results_alone(r,str);
-   }
- if (strncmp(str,"download",8)==0)
-   {
-    r->tclass=MI_CL_DOWNLOAD;
-    str+=8;
-    return mi_get_results_alone(r,str);
-   }
- mi_error=MI_UNKNOWN_ASYNC;
- mi_free_output(r);
- return NULL;
-}
-
-mi_output *mi_parse_exec_asyn(mi_output *r,const char *str)
-{
- r->sstype=MI_SST_EXEC;
- return mi_parse_asyn(r,str);
-}
-
-mi_output *mi_parse_status_asyn(mi_output *r,const char *str)
-{
- r->sstype=MI_SST_STATUS;
- return mi_parse_asyn(r,str);
-}
-
-mi_output *mi_parse_notify_asyn(mi_output *r,const char *str)
-{
- r->sstype=MI_SST_NOTIFY;
- return mi_parse_asyn(r,str);
-}
-
-mi_output *mi_console(mi_output *r,const char *str)
-{
- r->type=MI_T_OUT_OF_BAND;
- r->stype=MI_ST_STREAM;
- r->c=mi_alloc_results();
- if (!r->c || !mi_get_cstring_r(r->c,str,NULL))
-   {
-    mi_free_output(r);
-    return NULL;
-   }
- return r;
-}
-
-mi_output *mi_console_stream(mi_output *r,const char *str)
-{
- r->sstype=MI_SST_CONSOLE;
- return mi_console(r,str);
-}
-
-mi_output *mi_target_stream(mi_output *r,const char *str)
-{
- r->sstype=MI_SST_TARGET;
- return mi_console(r,str);
-}
-
-mi_output *mi_log_stream(mi_output *r,const char *str)
-{
- r->sstype=MI_SST_LOG;
- return mi_console(r,str);
-}
-
-mi_output *mi_parse_gdb_output(const char *str)
-{
- char type=str[0];
-
- mi_output *r=mi_alloc_output();
- if (!r)
-   {
-    mi_error=MI_OUT_OF_MEMORY;
-    return NULL;
-   }
- str++;
- switch (type)
-   {
-    case '^':
-         return mi_parse_result_record(r,str);
-    case '*':
-         return mi_parse_exec_asyn(r,str);
-    case '+':
-         return mi_parse_status_asyn(r,str);
-    case '=':
-         return mi_parse_notify_asyn(r,str);
-    case '~':
-         return mi_console_stream(r,str);
-    case '@':
-         return mi_target_stream(r,str);
-    case '&':
-         return mi_log_stream(r,str);
-   }   
- mi_error=MI_PARSER;
- return NULL;
-}
-
-mi_output *mi_get_rrecord(mi_output *r)
-{
- if (!r)
-    return NULL;
- while (r)
-   {
-    if (r->type==MI_T_RESULT_RECORD)
-       return r;
-    r=r->next;
-   }
- return r;
-}
-
-mi_results *mi_get_var_r(mi_results *r, const char *var)
-{
- while (r)
-   {
-    if (strcmp(r->var,var)==0)
-       return r;
-    r=r->next;
-   }
- return NULL;
-}
-
-mi_results *mi_get_var(mi_output *res, const char *var)
-{
- if (!res)
-    return NULL;
- return mi_get_var_r(res->c,var);
-}
-
-int mi_get_async_stop_reason(mi_output *r, char **reason)
-{
- int found_stopped=0;
-
- *reason=NULL;
- while (r)
-   {
-    if (r->type==MI_T_RESULT_RECORD && r->tclass==MI_CL_ERROR)
-      {
-       if (r->c->type==t_const)
-          *reason=r->c->v.cstr;
-       return 0;
-      }
-    if (r->type==MI_T_OUT_OF_BAND && r->stype==MI_ST_ASYNC &&
-        r->sstype==MI_SST_EXEC && r->tclass==MI_CL_STOPPED)
-      {
-       mi_results *p=r->c;
-       found_stopped=1;
-       while (p)
-         {
-          if (strcmp(p->var,"reason")==0)
-            {
-             *reason=p->v.cstr;
-             return 1;
-            }
-          p=p->next;
-         }
-      }
-    r=r->next;
-   }
- if (*reason==NULL && found_stopped)
-   {
-    *reason=strdup("unknown (temp bkpt?)");
-    return 1;
-   }
- return 0;
-}
-
-mi_frames *mi_get_async_frame(mi_output *r)
-{
- while (r)
-   {
-    if (r->type==MI_T_OUT_OF_BAND && r->stype==MI_ST_ASYNC &&
-        r->sstype==MI_SST_EXEC && r->tclass==MI_CL_STOPPED)
-      {
-       mi_results *p=r->c;
-       while (p)
-         {
-          if (strcmp(p->var,"frame")==0)
-             return mi_parse_frame(p->v.rs);
-          p=p->next;
-         }
-      }
-    r=r->next;
-   }
- return NULL;
-}
-
-int mi_res_simple(mi_h *h, int tclass, int accert_ret)
-{
- mi_output *r, *res;
- int ret=0;
-
- r=mi_get_response_blk(h);
- res=mi_get_rrecord(r);
-
- if (res)
-    ret=res->tclass==tclass;
- mi_free_output(r);
-
- return ret;
-}
-
-
-int mi_res_simple_done(mi_h *h)
-{
- return mi_res_simple(h,MI_CL_DONE,0);
-}
-
-int mi_res_simple_exit(mi_h *h)
-{
- return mi_res_simple(h,MI_CL_EXIT,1);
-}
-
-int mi_res_simple_running(mi_h *h)
-{
- return mi_res_simple(h,MI_CL_RUNNING,0);
-}
-
-int mi_res_simple_connected(mi_h *h)
-{
- return mi_res_simple(h,MI_CL_CONNECTED,0);
-}
-
-mi_results *mi_res_var(mi_h *h, const char *var, int tclass)
-{
- mi_output *r, *res;
- mi_results *the_var=NULL;
-
- r=mi_get_response_blk(h);
- /* All the code that follows is "NULL" tolerant. */
- /* Look for the result-record. */
- res=mi_get_rrecord(r);
- /* Look for the desired var. */
- if (res && res->tclass==tclass)
-    the_var=mi_get_var(res,var);
- /* Release all but the one we want. */
- mi_free_output_but(r,NULL,the_var);
- return the_var;
-}
-
-mi_results *mi_res_done_var(mi_h *h, const char *var)
-{
- return mi_res_var(h,var,MI_CL_DONE);
-}
-
-mi_frames *mi_parse_frame(mi_results *c)
-{
- mi_frames *res=mi_alloc_frames();
- char *end;
-
- if (res)
-   {
-    while (c)
-      {
-       if (c->type==t_const)
-         {
-          if (strcmp(c->var,"level")==0)
-             res->level=atoi(c->v.cstr);
-          else if (strcmp(c->var,"addr")==0)
-             res->addr=(void *)strtoul(c->v.cstr,&end,0);
-          else if (strcmp(c->var,"func")==0)
-            {
-             res->func=c->v.cstr;
-             c->v.cstr=NULL;
-            }
-          else if (strcmp(c->var,"file")==0)
-            {
-             res->file=c->v.cstr;
-             c->v.cstr=NULL;
-            }
-          else if (strcmp(c->var,"from")==0)
-            {
-             res->from=c->v.cstr;
-             c->v.cstr=NULL;
-            }
-          else if (strcmp(c->var,"line")==0)
-             res->line=atoi(c->v.cstr);
-         }
-       else if (c->type==t_list && strcmp(c->var,"args")==0)
-         {
-          res->args=c->v.rs;
-          c->v.rs=NULL;
-         }
-       c=c->next;
-      }
-   }
- return res;
-}
-
-mi_frames *mi_res_frame(mi_h *h)
-{
- mi_results *r=mi_res_done_var(h,"frame");
- mi_frames *f=NULL;
-
- if (r && r->type==t_tuple)
-    f=mi_parse_frame(r->v.rs);
- mi_free_results(r);
- return f;
-}
-
-mi_frames *mi_res_frames_array(mi_h *h, const char *var)
-{
- mi_results *r=mi_res_done_var(h,var), *c;
- mi_frames *res=NULL, *nframe, *last=NULL;
-
- if (!r)
-    return NULL;
-#ifdef __APPLE__
- if (r->type!=t_list && r->type!=t_tuple)
-#else
- if (r->type!=t_list)
-#endif
-   {
-    mi_free_results(r);
-    return NULL;
-   }
- c=r->v.rs;
- while (c)
-   {
-    if (strcmp(c->var,"frame")==0 && c->type==t_tuple)
-      {
-       nframe=mi_parse_frame(c->v.rs);
-       if (nframe)
-         {
-          if (!last)
-             res=nframe;
-          else
-             last->next=nframe;
-          last=nframe;
-         }
-      }
-    c=c->next;
-   }
- mi_free_results(r);
- return res;
-}
-
-mi_frames *mi_res_frames_list(mi_h *h)
-{
- mi_output *r, *res;
- mi_frames *ret=NULL, *nframe, *last=NULL;
- mi_results *c;
-
- r=mi_get_response_blk(h);
- res=mi_get_rrecord(r);
- if (res && res->tclass==MI_CL_DONE)
-   {
-    c=res->c;
-    while (c)
-      {
-       if (strcmp(c->var,"frame")==0 && c->type==t_tuple)
-         {
-          nframe=mi_parse_frame(c->v.rs);
-          if (nframe)
-            {
-             if (!last)
-                ret=nframe;
-             else
-                last->next=nframe;
-             last=nframe;
-            }
-         }
-       c=c->next;
-      }
-   }
- mi_free_output(r);
- return ret;
-}
-
-int mi_get_thread_ids(mi_output *res, int **list)
-{
- mi_results *vids, *lids;
- int ids=-1, i;
-
- *list=NULL;
- vids=mi_get_var(res,"number-of-threads");
- lids=mi_get_var(res,"thread-ids");
- if (vids && vids->type==t_const &&
-     lids && lids->type==t_tuple)
-   {
-    ids=atoi(vids->v.cstr);
-    if (ids)
-      {
-       int *lst;
-       lst=(int *)mi_calloc(ids,sizeof(int));
-       if (lst)
-         {
-          lids=lids->v.rs;
-          i=0;
-          while (lids)
-            {
-             if (strcmp(lids->var,"thread-id")==0 && lids->type==t_const)
-                lst[i++]=atoi(lids->v.cstr);
-             lids=lids->next;
-            }
-          *list=lst;
-         }
-       else
-          ids=-1;
-      }
-   }
- return ids;
-}
-
-int mi_res_thread_ids(mi_h *h, int **list)
-{
- mi_output *r, *res;
- int ids=-1;
-
- r=mi_get_response_blk(h);
- res=mi_get_rrecord(r);
- if (res && res->tclass==MI_CL_DONE)
-    ids=mi_get_thread_ids(res,list);
- mi_free_output(r);
- return ids;
-}
-
-enum mi_gvar_lang mi_lang_str_to_enum(const char *lang)
-{
- enum mi_gvar_lang lg=lg_unknown;
-
- if (strcmp(lang,"C")==0)
-    lg=lg_c;
- else if (strcmp(lang,"C++")==0)
-    lg=lg_cpp;
- else if (strcmp(lang,"Java")==0)
-    lg=lg_java;
-
- return lg;
-}
-
-const char *mi_lang_enum_to_str(enum mi_gvar_lang lang)
-{
- const char *lg;
-
- switch (lang)
-   {
-    case lg_c:
-         lg="C";
-         break;
-    case lg_cpp:
-         lg="C++";
-         break;
-    case lg_java:
-         lg="Java";
-         break;
-    /*case lg_unknown:*/
-    default:
-         lg="unknown";
-         break;
-   }
- return lg;
-}
-
-enum mi_gvar_fmt mi_format_str_to_enum(const char *format)
-{
- enum mi_gvar_fmt fmt=fm_natural;
-
- if (strcmp(format,"binary")==0)
-    fmt=fm_binary;
- else if (strcmp(format,"decimal")==0)
-    fmt=fm_decimal;
- else if (strcmp(format,"hexadecimal")==0)
-    fmt=fm_hexadecimal;
- else if (strcmp(format,"octal")==0)
-    fmt=fm_octal;
-
- return fmt;
-}
-
-const char *mi_format_enum_to_str(enum mi_gvar_fmt format)
-{
- const char *fmt;
-
- switch (format)
-   {
-    case fm_natural:
-         fmt="natural";
-         break;
-    case fm_binary:
-         fmt="binary";
-         break;
-    case fm_decimal:
-         fmt="decimal";
-         break;
-    case fm_hexadecimal:
-         fmt="hexadecimal";
-         break;
-    case fm_octal:
-         fmt="octal";
-         break;
-    case fm_raw:
-         fmt="raw";
-         break;
-    default:
-         fmt="unknown";
-   }
- return fmt;
-}
-
-char mi_format_enum_to_char(enum mi_gvar_fmt format)
-{
- char fmt;
-
- switch (format)
-   {
-    case fm_natural:
-         fmt='N';
-         break;
-    case fm_binary:
-         fmt='t';
-         break;
-    case fm_decimal:
-         fmt='d';
-         break;
-    case fm_hexadecimal:
-         fmt='x';
-         break;
-    case fm_octal:
-         fmt='o';
-         break;
-    case fm_raw:
-         fmt='r';
-         break;
-    default:
-         fmt=' ';
-   }
- return fmt;
-}
-
-mi_gvar *mi_get_gvar(mi_output *o, mi_gvar *cur, const char *expression)
-{
- mi_results *r;
- mi_gvar *res=cur ? cur : mi_alloc_gvar();
- int l;
-
- if (!res)
-    return res;
- r=o->c;
- if (expression)
-    res->exp=strdup(expression);
- while (r)
-   {
-    if (r->type==t_const)
-      {
-       if (strcmp(r->var,"name")==0)
-         {
-          free(res->name);
-          res->name=r->v.cstr;
-          r->v.cstr=NULL;
-         }
-       else if (strcmp(r->var,"numchild")==0)
-         {
-          res->numchild=atoi(r->v.cstr);
-         }
-       else if (strcmp(r->var,"type")==0)
-         {
-          free(res->type);
-          res->type=r->v.cstr;
-          r->v.cstr=NULL;
-          l=strlen(res->type);
-          if (l && res->type[l-1]=='*')
-             res->ispointer=1;
-         }
-       else if (strcmp(r->var,"lang")==0)
-         {
-          res->lang=mi_lang_str_to_enum(r->v.cstr);
-         }
-       else if (strcmp(r->var,"exp")==0)
-         {
-          free(res->exp);
-          res->exp=r->v.cstr;
-          r->v.cstr=NULL;
-         }
-       else if (strcmp(r->var,"format")==0)
-         {
-          res->format=mi_format_str_to_enum(r->v.cstr);
-         }
-       else if (strcmp(r->var,"attr")==0)
-         { /* Note: gdb 6.1.1 have only this: */
-          if (strcmp(r->v.cstr,"editable")==0)
-             res->attr=MI_ATTR_EDITABLE;
-          else /* noneditable */
-             res->attr=MI_ATTR_NONEDITABLE;
-         }
-      }
-    r=r->next;
-   }
- return res;
-}
-
-mi_gvar *mi_res_gvar(mi_h *h, mi_gvar *cur, const char *expression)
-{
- mi_output *r, *res;
- mi_gvar *gvar=NULL;
-
- r=mi_get_response_blk(h);
- res=mi_get_rrecord(r);
- if (res && res->tclass==MI_CL_DONE)
-    gvar=mi_get_gvar(res,cur,expression);
- mi_free_output(r);
- return gvar;
-}
-
-mi_gvar_chg *mi_get_gvar_chg(mi_results *r)
-{
- mi_gvar_chg *n;
-
- if (r->type!=t_const)
-    return NULL;
- n=mi_alloc_gvar_chg();
- if (n)
-   {
-    while (r)
-      {
-       if (r->type==t_const)
-         {
-          if (strcmp(r->var,"name")==0)
-            {
-             n->name=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if (strcmp(r->var,"in_scope")==0)
-            {
-             n->in_scope=strcmp(r->v.cstr,"true")==0;
-            }
-          else if (strcmp(r->var,"new_type")==0)
-            {
-             n->new_type=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if (strcmp(r->var,"new_num_children")==0)
-            {
-             n->new_num_children=atoi(r->v.cstr);
-            }
-          // type_changed="false" is the default
-         }
-       r=r->next;
-      }
-   }
- return n;
-}
-
-int mi_res_changelist(mi_h *h, mi_gvar_chg **changed)
-{
- mi_gvar_chg *last, *n;
- mi_results *res=mi_res_done_var(h,"changelist"), *r;
- int count=0;
-
- *changed=NULL;
- if (!res)
-    return 0;
- last=NULL;
- count=1;
- n=NULL;
- r=res->v.rs;
-
- if (res->type==t_list)
-   {// MI v2 a list of tuples
-    while (r)
-      {
-       if (r->type==t_tuple)
-         {
-          n=mi_get_gvar_chg(r->v.rs);
-          if (n)
-            {
-             if (last)
-                last->next=n;
-             else
-                *changed=n;
-             last=n;
-             count++;
-            }
-         }
-       r=r->next;
-      }
-   }
- else if (res->type==t_tuple)
-   {// MI v1 a tuple with all together *8-P
-    while (r)
-      {
-       if (r->type==t_const) /* Just in case. */
-         {/* Get one var. */
-          if (strcmp(r->var,"name")==0)
-            {
-             if (n)
-               {/* Add to the list*/
-                if (last)
-                   last->next=n;
-                else
-                   *changed=n;
-                last=n;
-                count++;
-               }
-             n=mi_alloc_gvar_chg();
-             if (!n)
-               {
-                mi_free_gvar_chg(*changed);
-                return 0;
-               }
-             n->name=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if ((NULL != n) && (strcmp(r->var,"in_scope")==0))
-            {
-             n->in_scope=strcmp(r->v.cstr,"true")==0;
-            }
-          else if ((NULL != n) && (strcmp(r->var,"new_type")==0))
-            {
-             n->new_type=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if ((NULL != n) && (strcmp(r->var,"new_num_children")==0))
-            {
-             n->new_num_children=atoi(r->v.cstr);
-            }
-          // type_changed="false" is the default
-         }
-       r=r->next;
-      }
-    if (n)
-      {/* Add to the list*/
-       if (last)
-          last->next=n;
-       else
-          *changed=n;
-       last=n;
-       count++;
-      }
-   }
- mi_free_results(res);
-
- return count;
-}
-
-int mi_get_children(mi_results *ch, mi_gvar *v)
-{
- mi_gvar *cur=NULL, *aux;
- int i=0, count=v->numchild, l;
-
- while (ch)
-   {
-    if (strcmp(ch->var,"child")==0 && ch->type==t_tuple && i<count)
-      {
-       mi_results *r=ch->v.rs;
-       aux=mi_alloc_gvar();
-       if (!aux)
-          return 0;
-       if (!v->child)
-          v->child=aux;
-       else if (NULL != cur)
-          cur->next=aux;
-       cur=aux;
-       cur->parent=v;
-       cur->depth=v->depth+1;
-
-       while (r)
-         {
-          if (r->type==t_const)
-            {
-             if (strcmp(r->var,"name")==0)
-               {
-                cur->name=r->v.cstr;
-                r->v.cstr=NULL;
-               }
-             else if (strcmp(r->var,"exp")==0)
-               {
-                cur->exp=r->v.cstr;
-                r->v.cstr=NULL;
-               }
-             else if (strcmp(r->var,"type")==0)
-               {
-                cur->type=r->v.cstr;
-                r->v.cstr=NULL;
-                l=strlen(cur->type);
-                if (l && cur->type[l-1]=='*')
-                   cur->ispointer=1;
-               }
-             else if (strcmp(r->var,"value")==0)
-               {
-                cur->value=r->v.cstr;
-                r->v.cstr=NULL;
-               }                     
-             else if (strcmp(r->var,"numchild")==0)
-               {
-                cur->numchild=atoi(r->v.cstr);
-               }
-            }
-          r=r->next;
-         }
-       i++;
-      }
-    ch=ch->next;
-   }
- v->vischild=i;
- v->opened=1;
- return i==v->numchild;
-}
-
-int mi_res_children(mi_h *h, mi_gvar *v)
-{
- mi_output *r, *res;
- int ok=0;
-
- r=mi_get_response_blk(h);
- res=mi_get_rrecord(r);
- if (res && res->tclass==MI_CL_DONE)
-   {
-    mi_results *num=mi_get_var(res,"numchild");
-    if (num && num->type==t_const)
-      {
-       v->numchild=atoi(num->v.cstr);
-       if (v->child)
-         {
-          mi_free_gvar(v->child);
-          v->child=NULL;
-         }
-       if (v->numchild)
-         {
-          mi_results *ch =mi_get_var(res,"children");
-          if (ch && ch->type!=t_const) /* MI v1 tuple, MI v2 list */
-             ok=mi_get_children(ch->v.rs,v);
-         }
-       else
-          ok=1;
-      }
-   }
- mi_free_output(r);
- return ok;
-}
-
-mi_bkpt *mi_get_bkpt(mi_results *p)
-{
- mi_bkpt *res;
- char *end;
-
- res=mi_alloc_bkpt();
- if (!res)
-    return NULL;
- while (p)
-   {
-    if (p->type==t_const && p->var)
-      {
-       if (strcmp(p->var,"number")==0)
-          res->number=atoi(p->v.cstr);
-       else if (strcmp(p->var,"type")==0)
-         {
-          if (strcmp(p->v.cstr,"breakpoint")==0)
-             res->type=t_breakpoint;
-          else
-             res->type=t_unknown;
-         }
-       else if (strcmp(p->var,"disp")==0)
-         {
-          if (strcmp(p->v.cstr,"keep")==0)
-             res->disp=d_keep;
-          else if (strcmp(p->v.cstr,"del")==0)
-             res->disp=d_del;
-          else
-             res->disp=d_unknown;
-         }
-       else if (strcmp(p->var,"enabled")==0)
-          res->enabled=p->v.cstr[0]=='y';
-       else if (strcmp(p->var,"addr")==0)
-          res->addr=(void *)strtoul(p->v.cstr,&end,0);
-       else if (strcmp(p->var,"func")==0)
-         {
-          res->func=p->v.cstr;
-          p->v.cstr=NULL;
-         }
-       else if (strcmp(p->var,"file")==0)
-         {
-          res->file=p->v.cstr;
-          p->v.cstr=NULL;
-         }
-       else if (strcmp(p->var,"line")==0)
-          res->line=atoi(p->v.cstr);
-       else if (strcmp(p->var,"times")==0)
-          res->times=atoi(p->v.cstr);
-       else if (strcmp(p->var,"ignore")==0)
-          res->ignore=atoi(p->v.cstr);
-       else if (strcmp(p->var,"cond")==0)
-         {
-          res->cond=p->v.cstr;
-          p->v.cstr=NULL;
-         }
-      }
-    p=p->next;
-   }
- return res;
-}
-
-mi_bkpt *mi_res_bkpt(mi_h *h)
-{
- mi_results *r=mi_res_done_var(h,"bkpt");
- mi_bkpt *b=NULL;
-
- if (r && r->type==t_tuple)
-    b=mi_get_bkpt(r->v.rs);
- mi_free_results(r);
- return b;
-}
-
-mi_wp *mi_get_wp(mi_results *p, enum mi_wp_mode m)
-{
- mi_wp *res=mi_alloc_wp();
-
- if (res)
-   {
-    res->mode=m;
-    while (p)
-      {
-       if (p->type==t_const && p->var)
-         {
-          if (strcmp(p->var,"number")==0)
-            {
-             res->number=atoi(p->v.cstr);
-             res->enabled=1;
-            }
-          else if (strcmp(p->var,"exp")==0)
-            {
-             res->exp=p->v.cstr;
-             p->v.cstr=NULL;
-            }
-         }
-       p=p->next;
-      }
-   }
- return res;
-}
-
-mi_wp *mi_parse_wp_res(mi_output *r)
-{
- mi_results *p;
- enum mi_wp_mode m=wm_unknown;
-
- /* The info is in a result wpt=... */
- p=r->c;
- while (p)
-   {
-    if (p->var)
-      {
-       if (strcmp(p->var,"wpt")==0)
-          m=wm_write;
-       else if (strcmp(p->var,"hw-rwpt")==0)
-          m=wm_read;
-       else if (strcmp(p->var,"hw-awpt")==0)
-          m=wm_rw;
-       if (m!=wm_unknown)
-          break;
-      }
-    p=p->next;
-   }
- if (!p || p->type!=t_tuple)
-    return NULL;
- /* Scan the values inside it. */
- return mi_get_wp(p->v.rs,m);
-}
-
-mi_wp *mi_res_wp(mi_h *h)
-{
- mi_output *r, *res;
- mi_wp *ret=NULL;
-
- r=mi_get_response_blk(h);
- res=mi_get_rrecord(r);
-
- if (res)
-    ret=mi_parse_wp_res(res);
-
- mi_free_output(r);
- return ret;
-}
-
-char *mi_res_value(mi_h *h)
-{
- mi_results *r=mi_res_done_var(h,"value");
- char *s=NULL;
-
- if (r && r->type==t_const)
-   {
-    s=r->v.cstr;
-    r->v.rs=NULL;
-   }
- mi_free_results(r);
- return s;
-}
-
-mi_output *mi_get_stop_record(mi_output *r)
-{
- while (r)
-   {
-    if (r->type==MI_T_OUT_OF_BAND && r->stype==MI_ST_ASYNC &&
-        r->sstype==MI_SST_EXEC && r->tclass==MI_CL_STOPPED)
-       return r;
-    r=r->next;
-   }
- return r;
-}
-
-static
-char *reason_names[]=
-{
- "breakpoint-hit",
- "watchpoint-trigger",
- "read-watchpoint-trigger",
- "access-watchpoint-trigger",
- "watchpoint-scope",
- "function-finished",
- "location-reached",
- "end-stepping-range",
- "exited-signalled",
- "exited",
- "exited-normally",
- "signal-received"
-};
-
-static
-enum mi_stop_reason reason_values[]=
-{
- sr_bkpt_hit,
- sr_wp_trigger, sr_read_wp_trigger, sr_access_wp_trigger, sr_wp_scope,
- sr_function_finished, sr_location_reached, sr_end_stepping_range,
- sr_exited_signalled, sr_exited, sr_exited_normally,
- sr_signal_received
-};
-
-static
-char *reason_expl[]=
-{
- "Hit a breakpoint",
- "Write watchpoint",
- "Read watchpoint",
- "Access watchpoint",
- "Watchpoint out of scope",
- "Function finished",
- "Location reached",
- "End of stepping",
- "Exited signalled",
- "Exited with error",
- "Exited normally",
- "Signal received"
-};
-
-enum mi_stop_reason mi_reason_str_to_enum(const char *s)
-{
- int i;
-
- for (i=0; i<sizeof(reason_names)/sizeof(char *); i++)
-     if (strcmp(reason_names[i],s)==0)
-        return reason_values[i];
- return sr_unknown;
-}
-
-const char *mi_reason_enum_to_str(enum mi_stop_reason r)
-{
- int i;
-
- if (r==sr_unknown)
-    return "Unknown (temp bkp?)";
- for (i=0; i<sizeof(reason_values)/sizeof(char *); i++)
-     if (reason_values[i]==r)
-        return reason_expl[i];
- return NULL;
-}
-
-mi_stop *mi_get_stopped(mi_results *r)
-{
- mi_stop *res=mi_alloc_stop();
-
- if (res)
-   {
-    while (r)
-      {
-       if (r->type==t_const)
-         {
-          if (strcmp(r->var,"reason")==0)
-             res->reason=mi_reason_str_to_enum(r->v.cstr);
-          else if (!res->have_thread_id && strcmp(r->var,"thread-id")==0)
-            {
-             res->have_thread_id=1;
-             res->thread_id=atoi(r->v.cstr);
-            }
-          else if (!res->have_bkptno && strcmp(r->var,"bkptno")==0)
-            {
-             res->have_bkptno=1;
-             res->bkptno=atoi(r->v.cstr);
-            }
-          else if (!res->have_bkptno && strcmp(r->var,"wpnum")==0)
-            {
-             res->have_wpno=1;
-             res->wpno=atoi(r->v.cstr);
-            }
-          else if (strcmp(r->var,"gdb-result-var")==0)
-            {
-             res->gdb_result_var=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if (strcmp(r->var,"return-value")==0)
-            {
-             res->return_value=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if (strcmp(r->var,"signal-name")==0)
-            {
-             res->signal_name=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if (strcmp(r->var,"signal-meaning")==0)
-            {
-             res->signal_meaning=r->v.cstr;
-             r->v.cstr=NULL;
-            }
-          else if (!res->have_exit_code && strcmp(r->var,"exit-code")==0)
-            {
-             res->have_exit_code=1;
-             res->exit_code=atoi(r->v.cstr);
-            }
-         }
-       else // tuple or list
-         {
-          if (strcmp(r->var,"frame")==0)
-             res->frame=mi_parse_frame(r->v.rs);
-          else if (!res->wp && strcmp(r->var,"wpt")==0)
-             res->wp=mi_get_wp(r->v.rs,wm_write);
-          else if (!res->wp && strcmp(r->var,"hw-rwpt")==0)
-             res->wp=mi_get_wp(r->v.rs,wm_read);
-          else if (!res->wp && strcmp(r->var,"hw-awpt")==0)
-             res->wp=mi_get_wp(r->v.rs,wm_rw);
-          else if (!(res->wp_old || res->wp_val) && strcmp(r->var,"value")==0)
-             {
-              mi_results *p=r->v.rs;
-              while (p)
-                {
-                 if (strcmp(p->var,"value")==0 || strcmp(p->var,"new")==0)
-                   {
-                    res->wp_val=p->v.cstr;
-                    p->v.cstr=NULL;
-                   }
-                 else if (strcmp(p->var,"old")==0)
-                   {
-                    res->wp_old=p->v.cstr;
-                    p->v.cstr=NULL;
-                   }
-                 p=p->next;
-                }
-             }
-         }
-       r=r->next;
-      }
-   }
- return res;
-}
-
-mi_stop *mi_res_stop(mi_h *h)
-{
- mi_output *o=mi_retire_response(h);
- mi_stop *stop=NULL;
-
- if (o)
-   {
-    mi_output *sr=mi_get_stop_record(o);
-    if (sr)
-       stop=mi_get_stopped(sr->c);
-   }
- mi_free_output(o);
-
- return stop;
-}
-
-int mi_get_read_memory(mi_h *h, unsigned char *dest, unsigned ws, int *na,
-                       unsigned long *addr)
-{
- char *end;
- mi_results *res=mi_res_done_var(h,"memory"), *r;
- int ok=0;
-
- *na=0;
- r=res;
- if (r && r->type==t_list && ws==1)
-   {
-    r=r->v.rs;
-    if (r->type!=t_tuple)
-      {
-       mi_free_results(res);
-       return 0;
-      }
-    r=r->v.rs;
-    while (r)
-      {
-       if (r->type==t_list && strcmp(r->var,"data")==0)
-         {
-          mi_results *data=r->v.rs;
-          ok++;
-          if (data && data->type==t_const &&
-              strcmp(data->v.cstr,"N/A")==0)
-             *na=1;
-          else
-             while (data)
-               {
-                if (data->type==t_const)
-                   *(dest++)=strtol(data->v.cstr,&end,0);
-                data=data->next;
-               }
-         }
-       else if (r->type==t_const && strcmp(r->var,"addr")==0)
-         {
-          ok++;
-          if (addr)
-             *addr=strtoul(r->v.cstr,&end,0);
-         }
-       r=r->next;
-      }
-
-   }
- mi_free_results(res);
- return ok==2;
-}
-
-mi_asm_insn *mi_parse_insn(mi_results *c)
-{
- mi_asm_insn *res=NULL, *cur=NULL;
- mi_results *sub;
- char *end;
-
- while (c)
-   {
-    if (c->type==t_tuple)
-      {
-       if (!res)
-          res=cur=mi_alloc_asm_insn();
-       else
-         {
-          cur->next=mi_alloc_asm_insn();
-          cur=cur->next;
-         }
-       if (!cur)
-         {
-          mi_free_asm_insn(res);
-          return NULL;
-         }
-       sub=c->v.rs;
-       while (sub)
-         {
-          if (sub->type==t_const)
-            {
-             if (strcmp(sub->var,"address")==0)
-                cur->addr=(void *)strtoul(sub->v.cstr,&end,0);
-             else if (strcmp(sub->var,"func-name")==0)
-               {
-                cur->func=sub->v.cstr;
-                sub->v.cstr=NULL;
-               }
-             else if (strcmp(sub->var,"offset")==0)
-                cur->offset=atoi(sub->v.cstr);
-             else if (strcmp(sub->var,"inst")==0)
-               {
-                cur->inst=sub->v.cstr;
-                sub->v.cstr=NULL;
-               }
-            }
-          sub=sub->next;
-         }
-      }
-    c=c->next;
-   }
- return res;
-}
-
-mi_asm_insns *mi_parse_insns(mi_results *c)
-{
- mi_asm_insns *res=NULL, *cur=NULL;
- mi_results *sub;
-
- while (c)
-   {
-    if (c->var)
-      {
-       if (strcmp(c->var,"src_and_asm_line")==0 && c->type==t_tuple)
-         {
-          if (!res)
-             res=cur=mi_alloc_asm_insns();
-          else
-            {
-             cur->next=mi_alloc_asm_insns();
-             cur=cur->next;
-            }
-          if (!cur)
-            {
-             mi_free_asm_insns(res);
-             return NULL;
-            }
-          sub=c->v.rs;
-          while (sub)
-            {
-             if (sub->var)
-               {
-                if (sub->type==t_const)
-                  {
-                   if (strcmp(sub->var,"line")==0)
-                      cur->line=atoi(sub->v.cstr);
-                   else if (strcmp(sub->var,"file")==0)
-                     {
-                      cur->file=sub->v.cstr;
-                      sub->v.cstr=NULL;
-                     }
-                  }
-                else if (sub->type==t_list)
-                  {
-                   if (strcmp(sub->var,"line_asm_insn")==0)
-                      cur->ins=mi_parse_insn(sub->v.rs);
-                  }
-               }
-             sub=sub->next;
-            }
-         }
-      }
-    else
-      {/* No source line, just instructions */
-       res=mi_alloc_asm_insns();
-       res->ins=mi_parse_insn(c);
-       break;
-      }
-    c=c->next;
-   }
- return res;
-}
-
-
-mi_asm_insns *mi_get_asm_insns(mi_h *h)
-{
- mi_results *r=mi_res_done_var(h,"asm_insns");
- mi_asm_insns *f=NULL;
-
- if (r && r->type==t_list)
-    f=mi_parse_insns(r->v.rs);
- mi_free_results(r);
- return f;
-}
-
-mi_chg_reg *mi_parse_list_regs(mi_results *r, int *how_many)
-{
- mi_results *c=r;
- int cregs=0;
- mi_chg_reg *first=NULL, *cur=NULL;
-
- /* Create the list. */
- while (c)
-   {
-    if (c->type==t_const && !c->var)
-      {
-       if (first)
-          cur=cur->next=mi_alloc_chg_reg();
-       else
-          first=cur=mi_alloc_chg_reg();
-       
-       if (NULL != cur) {
-              cur->name=c->v.cstr;
-              cur->reg=cregs++;
-              c->v.cstr=NULL;
-       }
-      }
-    c=c->next;
-   }
- if (how_many)
-    *how_many=cregs;
-
- return first;
-}
-
-mi_chg_reg *mi_get_list_registers(mi_h *h, int *how_many)
-{
- mi_results *r=mi_res_done_var(h,"register-names");
- mi_chg_reg *l=NULL;
-
- if (r && r->type==t_list)
-    l=mi_parse_list_regs(r->v.rs,how_many);
- mi_free_results(r);
- return l;
-}
-
-mi_chg_reg *mi_parse_list_changed_regs(mi_results *r)
-{
- mi_results *c=r;
- mi_chg_reg *first=NULL, *cur=NULL;
-
- /* Create the list. */
- while (c)
-   {
-    if (c->type==t_const && !c->var)
-      {
-       if (first)
-          cur=cur->next=mi_alloc_chg_reg();
-       else
-          first=cur=mi_alloc_chg_reg();
-       cur->reg=atoi(c->v.cstr);
-      }
-    c=c->next;
-   }
-
- return first;
-}
-
-mi_chg_reg *mi_get_list_changed_regs(mi_h *h)
-{
- mi_results *r=mi_res_done_var(h,"changed-registers");
- mi_chg_reg *changed=NULL;
-
- if (r && r->type==t_list)
-    changed=mi_parse_list_changed_regs(r->v.rs);
- mi_free_results(r);
- return changed;
-}
-
-int mi_parse_reg_values(mi_results *r, mi_chg_reg *l)
-{
- mi_results *c;
-
- while (r && l)
-   {
-    if (r->type==t_tuple && !r->var)
-      {
-       c=r->v.rs;
-       while (c)
-         {
-          if (c->type==t_const && c->var)
-            {
-             if (strcmp(c->var,"number")==0)
-               {
-                if (atoi(c->v.cstr)!=l->reg)
-                  {
-                   mi_error=MI_PARSER;
-                   return 0;
-                  }
-               }
-             else if (strcmp(c->var,"value")==0)
-               {
-                l->val=c->v.cstr;
-                c->v.cstr=NULL;
-               }
-            }
-          c=c->next;
-         }
-      }
-    r=r->next;
-    l=l->next;
-   }
-
- return !l && !r;
-}
-
-int mi_get_reg_values(mi_h *h, mi_chg_reg *l)
-{
- mi_results *r=mi_res_done_var(h,"register-values");
- int ok=0;
-
- if (r && r->type==t_list)
-    ok=mi_parse_reg_values(r->v.rs,l);
- mi_free_results(r);
- return ok;
-}
-
-int mi_parse_list_regs_l(mi_results *r, mi_chg_reg *l)
-{
- while (r && l)
-   {
-    if (r->type==t_const && !r->var)
-      {
-       free(l->name);
-       l->name=r->v.cstr;
-       r->v.cstr=NULL;
-       l=l->next;
-      }
-    r=r->next;
-   }
-
- return !l && !r;
-}
-
-int mi_get_list_registers_l(mi_h *h, mi_chg_reg *l)
-{
- mi_results *r=mi_res_done_var(h,"register-names");
- int ok=0;
-
- if (r && r->type==t_list)
-    ok=mi_parse_list_regs_l(r->v.rs,l);
- mi_free_results(r);
- return ok;
-}
-
-mi_chg_reg *mi_parse_reg_values_l(mi_results *r, int *how_many)
-{
- mi_results *c;
- mi_chg_reg *first=NULL, *cur=NULL;
- *how_many=0;
-
- while (r)
-   {
-    if (r->type==t_tuple && !r->var)
-      {
-       c=r->v.rs;
-       if (first)
-          cur=cur->next=mi_alloc_chg_reg();
-       else
-          first=cur=mi_alloc_chg_reg();
-       while (c)
-         {
-          if (c->type==t_const && c->var)
-            {
-             if (strcmp(c->var,"number")==0)
-               {
-               if (NULL != cur) 
-                       cur->reg=atoi(c->v.cstr);
-                (*how_many)++;
-               }
-             else if (strcmp(c->var,"value")==0)
-               {
-               if (NULL != cur)
-                        cur->val=c->v.cstr;
-                c->v.cstr=NULL;
-               }
-            }
-          c=c->next;
-         }
-      }
-    r=r->next;
-   }
-
- return first;
-}
-
-mi_chg_reg *mi_get_reg_values_l(mi_h *h, int *how_many)
-{
- mi_results *r=mi_res_done_var(h,"register-values");
- mi_chg_reg *rgs=NULL;
-
- if (r && r->type==t_list)
-    rgs=mi_parse_reg_values_l(r->v.rs,how_many);
- mi_free_results(r);
- return rgs;
-}
-
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_prg_control.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_prg_control.c    
2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_prg_control.c   
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,578 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Program control.
-  Comments:
-  GDB/MI commands for the "Program Control" section.  @<p>
-
-@<pre>
-gdb command:                   Implemented?
-
--exec-abort                    N.A. (*) (kill, but with non-interactive 
options)
--exec-arguments                Yes
--exec-continue                 Yes  ASYNC
--exec-finish                   Yes  ASYNC
--exec-interrupt                Yes  ASYNC
--exec-next                     Yes  ASYNC
--exec-next-instruction         Yes  ASYNC
--exec-return                   Yes
--exec-run                      Yes  ASYNC
--exec-show-arguments           N.A. (show args) see gmi_stack_info_frame
--exec-step                     Yes  ASYNC
--exec-step-instruction         Yes  ASYNC
--exec-until                    Yes  ASYNC
--file-exec-and-symbols         Yes
--file-exec-file                No
--file-list-exec-sections       N.A. (info file)
--file-list-exec-source-files   N.A.
--file-list-shared-libraries    N.A.
--file-list-symbol-files        N.A.
--file-symbol-file              Yes
-@</pre>
-
-(*)  gmi_exec_kill implements it, but you should ensure that
-gmi_gdb_set("confirm","off") was called.  @<p>
-
-GDB Bug workaround for -file-exec-and-symbols and -file-symbol-file: This
-is complex, but a real bug. When you set a breakpoint you never know the
-name of the file as it appears in the debug info. So you can be specifying
-an absolute file name or a relative file name. The reference point could be
-different than the one used in the debug info. To solve all the combinations
-gdb does a search trying various combinations. GDB isn't very smart so you
-must at least specify the working directory and the directory where the
-binary is located to get a good chance (+ user options to solve the rest).
-Once you did it gdb can find the file by doing transformations to the
-"canonical" filename. This search works OK for already loaded symtabs
-(symbol tables), but it have a bug when the search is done for psymtabs
-(partial symtabs). The bug is in the use of source_full_path_of (source.c).
-This function calls openp indicating try_cwd_first. It makes the search file
-if the psymtab file name have at least one dirseparator. It means that
-psymtabs for files compiled with relative paths will fail. The search for
-symtabs uses symtab_to_filename, it calls open_source_file which finally
-calls openp without address@hidden
-To workaround this bug we must ensure gdb loads *all* the symtabs to memory.
-And here comes another problem -file-exec-and-symbols doesn't support it
-according to docs. In real life that's a wrapper for "file", but as nobody
-can say it won't change we must use the CLI command.
-  
-***************************************************************************/
-
-#include <signal.h>
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_file_exec_and_symbols(mi_h *h, const char *file)
-{
- if (mi_get_workaround(MI_PSYM_SEARCH))
-    mi_send(h,"file %s -readnow\n",file);
- else
-    mi_send(h,"-file-exec-and-symbols %s\n",file);
-}
-
-void mi_set_unwind_on_signal_on(mi_h *h)
-{
-       mi_send(h, "set unwindonsignal on\n");
-}
-
-void mi_exec_arguments(mi_h *h, const char *args)
-{
- mi_send(h,"-exec-arguments %s\n",args);
-}
-
-void mi_exec_run(mi_h *h)
-{
- mi_send(h,"-exec-run\n");
-}
-
-void mi_exec_continue(mi_h *h)
-{
- mi_send(h,"-exec-continue\n");
-}
-
-void mi_exec_continue_reverse(mi_h *h)
-{
- mi_send(h, "-exec-continue --reverse\n");
-}
-
-void mi_target_terminal(mi_h *h, const char *tty_name)
-{
- mi_send(h,"tty %s\n",tty_name);
-}
-
-void mi_file_symbol_file(mi_h *h, const char *file)
-{
- if (mi_get_workaround(MI_PSYM_SEARCH))
-    mi_send(h,"symbol-file %s -readnow\n",file);
- else
-    mi_send(h,"-file-symbol-file %s\n",file);
-}
-
-void mi_exec_finish(mi_h *h)
-{
- mi_send(h,"-exec-finish\n");
-}
-
-void mi_exec_finish_reverse(mi_h * h)
-{
- mi_send(h, "-exec-finish --reverse\n");
-}
-void mi_exec_interrupt(mi_h *h)
-{
- mi_send(h,"-exec-interrupt\n");
-}
-
-void mi_exec_record_process(mi_h *h)
-{
-mi_send(h, "-interpreter-exec mi record\n");
-}
-
-void mi_exec_next(mi_h *h, int count)
-{
- if (count>1)
-    mi_send(h,"-exec-next %d\n",count);
- else
-    mi_send(h,"-exec-next\n");
-}
-
-void mi_exec_next_instruction(mi_h *h)
-{
- mi_send(h,"-exec-next-instruction\n");
-}
-
-void mi_exec_step(mi_h *h, int count)
-{
- if (count>1)
-    mi_send(h,"-exec-step %d\n",count);
- else
-    mi_send(h,"-exec-step\n");
-}
-
-
-void mi_exec_step_back(mi_h *h, int count)
-{
-       if (count>1)
-               mi_send(h, "-exec-step %d --reverse\n", count);
-       else
-               mi_send(h, "-exec-step --reverse\n");
-}
-
-
-void mi_exec_next_reverse(mi_h *h, int count)
-{
-       if (count>1)
-               mi_send(h, "-exec-next %d --reverse\n", count);
-       else
-               mi_send(h, "-exec-next --reverse\n");
-}
-
-
-void mi_exec_step_instruction(mi_h *h)
-{
- mi_send(h,"-exec-step-instruction\n");
-}
-
-void mi_exec_until(mi_h *h, const char *file, int line)
-{
- if (!file)
-    mi_send(h,"-exec-until\n");
- else
-    mi_send(h,"-exec-until %s:%d\n",file,line);
-}
-
-void mi_exec_until_addr(mi_h *h, void *addr)
-{
- mi_send(h,"-exec-until *%p\n",addr);
-}
-
-void mi_exec_return(mi_h *h)
-{
- mi_send(h,"-exec-return\n");
-}
-
-void mi_exec_kill(mi_h *h)
-{
- mi_send(h,"kill\n");
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  Specify the executable and arguments for local debug.
-
-  Command: -file-exec-and-symbols + -exec-arguments
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_set_exec(mi_h *h, const char *file, const char *args)
-{
- mi_file_exec_and_symbols(h,file);
- if (!mi_res_simple_done(h))
-    return 0;
- if (!args)
-    return 1;
- mi_exec_arguments(h,args);
- return mi_res_simple_done(h);
-}
-
-int gmi_set_unwind_on_signal_on(mi_h * h)
-{
-       mi_set_unwind_on_signal_on(h);
-       return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Start running the executable. Remote sessions starts running.
-
-  Command: -exec-run
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_run(mi_h *h)
-{
- mi_exec_run(h);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Continue the execution after a "stop".
-
-  Command: -exec-continue
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_continue(mi_h *h)
-{
- mi_exec_continue(h);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Continue the execution in reverse order after a "stop".
-
-  Command: -exec-continue --reverse
-  Return: !=0 OK
-
-***************************************************************************/
-int gmi_exec_continue_reverse(mi_h *h)
-{
-       mi_exec_continue_reverse(h);
-       return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Indicate which terminal will use the target program. For local sessions.
-
-  Command: tty
-  Return: !=0 OK
-  Example: 
-  
-***************************************************************************/
-
-int gmi_target_terminal(mi_h *h, const char *tty_name)
-{
- mi_target_terminal(h,tty_name);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Specify what's the local copy that have debug info. For remote sessions.
-
-  Command: -file-symbol-file
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_file_symbol_file(mi_h *h, const char *file)
-{
- mi_file_symbol_file(h,file);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Continue until function return, the return value is included in the async
-response.
-
-  Command: -exec-finish
-  Return: !=0 OK.
-  
-***************************************************************************/
-
-int gmi_exec_finish(mi_h *h)
-{
- mi_exec_finish(h);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Continue backwardly until function return, the return value is included in
-  the async response.
-
-  Command: -exec-finish --reverse
-  Return: !=0 OK.
-
-***************************************************************************/
-int gmi_exec_finish_reverse(mi_h *h)
-{
- mi_exec_finish_reverse(h);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Stop the program using SIGINT. The corresponding command should be
--exec-interrupt but not even gdb 6.1.1 can do it because the "async" mode
-isn't really working.
-
-  Command: -exec-interrupt [replacement]
-  Return: Always 1
-  Example: 
-  
-***************************************************************************/
-
-int gmi_exec_interrupt(mi_h *h)
-{
- // **** IMPORTANT!!! **** Not even gdb 6.1.1 can do it because the "async"
- // mode isn't really working.
- //mi_exec_interrupt(h);
- //return mi_res_simple_running(h);
-
- kill(h->pid,SIGINT);
- return 1; // How can I know?
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Next line of code.
-
-  Command: -exec-next
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_next(mi_h *h)
-{
- mi_exec_next(h,1);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Start recording a process
-
-  Command: -interpreter-exec console record
-  Return: !=0 OK
-
-***************************************************************************/
-int gmi_exec_record_process(mi_h *h)
-{
-       mi_exec_record_process(h);
-       return 1;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Skip count lines of code.
-
-  Command: -exec-next count
-  Return: !=0 OK
-
-***************************************************************************/
-
-int gmi_exec_next_cnt(mi_h *h, int count)
-{
- mi_exec_next(h,count);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Next line of assembler code.
-
-  Command: -exec-next-instruction
-  Return: !=0 OK
-
-***************************************************************************/
-
-int gmi_exec_next_instruction(mi_h *h)
-{
- mi_exec_next_instruction(h);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Next line of code. Get inside functions.
-
-  Command: -exec-step
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_step(mi_h *h)
-{
- mi_exec_step(h,1);
- return mi_res_simple_running(h);
-}
-
-
-
-/**[txh]********************************************************************
-
-  Description:
-  Previous line of code. Get inside functions.
-
-  Command: -exec-step --reverse
-  Return: !=0 OK
-
-***************************************************************************/
-int gmi_exec_step_back(mi_h *h)
-{
-       mi_exec_step_back(h,1);
-       return mi_res_simple_running(h);
-}
-
-
-/**[txh]********************************************************************
-
-  Description:
-  Previous line of code (do not step into).
-
-  Command: -exec-next --reverse
-  Return: !=0 OK
-
-***************************************************************************/
-int gmi_exec_next_reverse(mi_h *h)
-{
-       mi_exec_next_reverse(h,1);
-       return mi_res_simple_running(h);
-}
-
-
-/**[txh]********************************************************************
-
-  Description:
-  Next count lines of code. Get inside functions.
-
-  Command: -exec-step count
-  Return: !=0 OK
-
-***************************************************************************/
-
-int gmi_exec_step_cnt(mi_h *h, int count)
-{
- mi_exec_step(h,count);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Next line of assembler code. Get inside calls.
-
-  Command: -exec-step-instruction
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_step_instruction(mi_h *h)
-{
- mi_exec_step_instruction(h);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Execute until location is reached. If file is NULL then is until next
-line.
-
-  Command: -exec-until
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_until(mi_h *h, const char *file, int line)
-{
- mi_exec_until(h,file,line);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Execute until location is reached.
-
-  Command: -exec-until (using *address)
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_until_addr(mi_h *h, void *addr)
-{
- mi_exec_until_addr(h,addr);
- return mi_res_simple_running(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Return to previous frame inmediatly.
-
-  Command: -exec-return
-  Return: A pointer to a new mi_frames structure indicating the current
-location. NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_exec_return(mi_h *h)
-{
- mi_exec_return(h);
- return mi_res_frame(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Just kill the program. That's what -exec-abort should do, but it isn't
-implemented by gdb. This implementation only works if the interactive mode
-is disabled (gmi_gdb_set("confirm","off")).
-
-  Command: -exec-abort [using kill]
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_exec_kill(mi_h *h)
-{
- mi_exec_kill(h);
- return mi_res_simple_done(h);
-}
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_stack_man.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_stack_man.c      
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_stack_man.c 
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,222 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Stack manipulation.
-  Comments:
-  GDB/MI commands for the "Stack Manipulation" section.  @<p>
-
-@<pre>
-gdb command:              Implemented?
-
--stack-info-frame         Yes, implemented as "frame"
--stack-info-depth         Yes
--stack-list-arguments     Yes
--stack-list-frames        Yes
--stack-list-locals        Yes
--stack-select-frame       Yes
-@</pre>
-
-***************************************************************************/
-
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_stack_list_frames(mi_h *h, int from, int to)
-{
- if (from<0)
-    mi_send(h,"-stack-list-frames\n");
- else
-    mi_send(h,"-stack-list-frames %d %d\n",from,to);
-}
-
-void mi_stack_list_arguments(mi_h *h, int show, int from, int to)
-{
- if (from<0)
-    mi_send(h,"-stack-list-arguments %d\n",show);
- else
-    mi_send(h,"-stack-list-arguments %d %d %d\n",show,from,to);
-}
-
-void mi_stack_info_frame(mi_h *h)
-{
- mi_send(h,"frame\n");
-}
-
-void mi_stack_info_depth(mi_h *h, int depth)
-{
- if (depth<0)
-    mi_send(h,"-stack-info-depth\n");
- else
-    mi_send(h,"-stack-info-depth %d\n",depth);
-}
-
-void mi_stack_select_frame(mi_h *h, int framenum)
-{
- mi_send(h,"-stack-select-frame %d\n",framenum);
-}
-
-void mi_stack_list_locals(mi_h *h, int show)
-{
- mi_send(h,"-stack-list-locals %d\n",show);
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  List of frames. Arguments aren't filled.
-
-  Command: -stack-list-frames
-  Return:  A new list of mi_frames or NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_stack_list_frames(mi_h *h)
-{
- mi_stack_list_frames(h,-1,-1);
- return mi_res_frames_array(h,"stack");
-}
-
-/**[txh]********************************************************************
-
-  Description: 
-  List of frames. Arguments aren't filled. Only the frames in the from
- - to range are returned.
-  
-  Command: -stack-list-frames
-  Return:  A new list of mi_frames or NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_stack_list_frames_r(mi_h *h, int from, int to)
-{
- mi_stack_list_frames(h,from,to);
- return mi_res_frames_array(h,"stack");
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  List arguments. Only level and args filled.
-  
-  Command: -stack-list-arguments
-  Return:  A new list of mi_frames or NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_stack_list_arguments(mi_h *h, int show)
-{
- mi_stack_list_arguments(h,show,-1,-1);
- return mi_res_frames_array(h,"stack-args");
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  List arguments. Only level and args filled. Only for the
-frames in the from - to range.
-  
-  Command: -stack-list-arguments
-  Return:  A new list of mi_frames or NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_stack_list_arguments_r(mi_h *h, int show, int from, int to)
-{
- mi_stack_list_arguments(h,show,from,to);
- return mi_res_frames_array(h,"stack-args");
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Information about the current frame, including args.
-
-  Command: -stack-info-frame [using frame]
-  Return: A new mi_frames or NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_stack_info_frame(mi_h *h)
-{
- mi_stack_info_frame(h);
- return mi_res_frame(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Stack info depth.
-
-  Command: -stack-info-depth
-  Return: The depth or -1 on error.
-  
-***************************************************************************/
-
-int gmi_stack_info_depth(mi_h *h, int max_depth)
-{
- mi_results *r;
- int ret=-1;
-
- mi_stack_info_depth(h,max_depth);
- r=mi_res_done_var(h,"depth");
- if (r && r->type==t_const)
-   {
-    ret=atoi(r->v.cstr);
-    mi_free_results(r);
-   }
- return ret;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Set stack info depth.
-
-  Command: -stack-info-depth [no args]
-  Return: The depth or -1 on error.
-  Example: 
-  
-***************************************************************************/
-
-int gmi_stack_info_depth_get(mi_h *h)
-{
- return gmi_stack_info_depth(h,-1);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Change current frame.
-
-  Command: -stack-select-frame
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_stack_select_frame(mi_h *h, int framenum)
-{
- mi_stack_select_frame(h,framenum);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  List of local vars.
-
-  Command: -stack-list-locals
-  Return: A new mi_results tree containing the variables or NULL on error.
-  
-***************************************************************************/
-
-mi_results *gmi_stack_list_locals(mi_h *h, int show)
-{
- mi_stack_list_locals(h,show);
- return mi_res_done_var(h,"locals");
-}
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_symbol_query.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_symbol_query.c   
2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_symbol_query.c  
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,32 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Symbol query.
-  Comments:
-  GDB/MI commands for the "Symbol Query" address@hidden
-
-@<pre>
-gdb command:              Implemented?
--symbol-info-address      N.A. (info address, human readable)
--symbol-info-file         N.A.
--symbol-info-function     N.A.
--symbol-info-line         N.A. (info line, human readable)
--symbol-info-symbol       N.A. (info symbol, human readable)
--symbol-list-functions    N.A. (info functions, human readable)
--symbol-list-types        N.A. (info types, human readable)
--symbol-list-variables    N.A. (info variables, human readable)
--symbol-list-lines        No (gdb 6.x)
--symbol-locate            N.A.
--symbol-type              N.A. (ptype, human readable)
-@</pre>
-
-Note:@p
-
-Only one is implemented and not in gdb address@hidden
-
-***************************************************************************/
-
-#include "gdbmi.h"
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_target_man.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_target_man.c     
2012-07-25 10:38:11 UTC (rev 22904)
+++ 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_target_man.c    
    2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,119 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004-2007 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Target manipulation.
-  Comments:
-  GDB/MI commands for the "Target Manipulation" section.  @<p>
-
-@<pre>
--target-attach                  Yes (implemented using attach)
--target-compare-sections        N.A. (compare-sections)
--target-detach                  Yes
--target-download                Yes
--target-exec-status             N.A.
--target-list-available-targets  N.A. (help target)
--target-list-current-targets    N.A. (info file among other things)
--target-list-parameters         N.A.
--target-select                  Yes
-@</pre>
-
-***************************************************************************/
-
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_target_select(mi_h *h, const char *type, const char *params)
-{
- mi_send(h,"-target-select %s %s\n",type,params);
-}
-
-/* Note: -target-attach isn't currently implemented :-( (gdb 6.1.1) */
-void mi_target_attach(mi_h *h, pid_t pid)
-{
- mi_send(h,"attach %d\n",pid);
-}
-
-void mi_target_detach(mi_h *h)
-{
- mi_send(h,"-target-detach\n");
-}
-
-void mi_target_download(mi_h *h)
-{
- mi_send(h,"-target-download\n");
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  Connect to a remote gdbserver using the specified methode.
-
-  Command: -target-select
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_target_select(mi_h *h, const char *type, const char *params)
-{
- mi_target_select(h,type,params);
- if (!mi_res_simple_connected(h))
-    return 0;
- mi_send_target_commands(h);
- return 1;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Attach to an already running process.
-
-  Command: -target-attach [using attach]
-  Return: The frame of the current location, NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_target_attach(mi_h *h, pid_t pid)
-{
- mi_target_attach(h,pid);
- //return mi_res_simple_done(h);
- return mi_res_frame(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Detach from an attached process.
-
-  Command: -target-detach
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_target_detach(mi_h *h)
-{
- mi_target_detach(h);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Loads the executable onto the remote target.
-
-  Command: -target-download
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_target_download(mi_h *h)
-{
- mi_target_download(h);
- // TODO: this response have some data
- return mi_res_simple_done(h);
-}
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_thread.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_thread.c 
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_thread.c    
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,89 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Thread commands.
-  Comments:
-  GDB/MI commands for the "Thread Commands" section.  @<p>
-
-@<pre>
-gdb command:              Implemented?
--thread-info              N.A.
--thread-list-all-threads  Yes, implemented as "info threads"
--thread-list-ids          Yes
--thread-select            Yes
-@</pre>
-
-***************************************************************************/
-
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_thread_list_ids(mi_h *h)
-{
- mi_send(h,"-thread-list-ids\n");
-}
-
-void mi_thread_select(mi_h *h, int id)
-{
- mi_send(h,"-thread-select %d\n",id);
-}
-
-void mi_thread_list_all_threads(mi_h *h)
-{
- mi_send(h,"info threads\n");
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  List available thread ids.
-
-  Command: -thread-list-ids
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_thread_list_ids(mi_h *h, int **list)
-{
- mi_thread_list_ids(h);
- return mi_res_thread_ids(h,list);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Select a thread.
-
-  Command: -thread-select
-  Return: A new mi_frames or NULL on error.
-  
-***************************************************************************/
-
-mi_frames *gmi_thread_select(mi_h *h, int id)
-{
- mi_thread_select(h,id);
- return mi_res_frame(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Get a list of frames for each available thread. Implemented using "info
-thread".
-
-  Command: -thread-list-all-threads
-  Return: A kist of frames, NULL on error
-  
-***************************************************************************/
-
-mi_frames *gmi_thread_list_all_threads(mi_h *h)
-{
- mi_thread_list_all_threads(h);
- return mi_res_frames_list(h);
-}
-

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_var_obj.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/gdbmi_var_obj.c        
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/gdbmi_var_obj.c   
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,371 +0,0 @@
-/**[txh]********************************************************************
-
-  Copyright (c) 2004 by Salvador E. Tropea.
-  Covered by the GPL license.
-
-  Module: Variable objects.
-  Comments:
-  GDB/MI commands for the "Variable Objects" section.
-    @<p>
-
-@<pre>
-gdb command:              Imp? Description:
--var-create               Yes  create a variable object
--var-delete               Yes  delete the variable object and its children
--var-set-format           Yes  set the display format of this variable
--var-show-format          Yes  show the display format of this variable
--var-info-num-children    Yes  tells how many children this object has
--var-list-children        Yes* return a list of the object's children
--var-info-type            Yes  show the type of this variable object
--var-info-expression      Yes  print what this variable object represents
--var-show-attributes      Yes  is this variable editable?
--var-evaluate-expression  Yes  get the value of this variable
--var-assign               Yes  set the value of this variable
--var-update               Yes* update the variable and its children
-@</pre>
-
-Notes:  @<p>
-1) I suggest letting gdb to choose the names for the address@hidden
-2) -var-list-children supports an optional "show values" argument in MI v2.
-It isn't address@hidden
-
-  @<p>
-
-* MI v1 and v2 result formats supported.  @<p>
-
-***************************************************************************/
-
-#include "gdbmi.h"
-
-/* Low level versions. */
-
-void mi_var_create(mi_h *h, const char *name, int frame, const char *exp)
-{
- const char *n=name ? name : "-";
-
- if (frame<0)
-    mi_send(h,"-var-create %s * %s\n",n,exp);
- else
-    mi_send(h,"-var-create %s %d %s\n",n,frame,exp);
-}
-
-void mi_var_delete(mi_h *h, const char *name)
-{
- mi_send(h,"-var-delete %s\n",name);
-}
-
-void mi_var_set_format(mi_h *h, const char *name, const char *format)
-{
- mi_send(h,"-var-set-format \"%s\" %s\n",name,format);
-}
-
-void mi_var_show_format(mi_h *h, const char *name)
-{
- mi_send(h,"-var-show-format \"%s\"\n",name);
-}
-
-void mi_var_info_num_children(mi_h *h, const char *name)
-{
- mi_send(h,"-var-info-num-children \"%s\"\n",name);
-}
-
-void mi_var_info_type(mi_h *h, const char *name)
-{
- mi_send(h,"-var-info-type \"%s\"\n",name);
-}
-
-void mi_var_info_expression(mi_h *h, const char *name)
-{
- mi_send(h,"-var-info-expression \"%s\"\n",name);
-}
-
-void mi_var_show_attributes(mi_h *h, const char *name)
-{
- mi_send(h,"-var-show-attributes \"%s\"\n",name);
-}
-
-void mi_var_update(mi_h *h, const char *name)
-{
- if (name)
-    mi_send(h,"-var-update %s\n",name);
- else
-    mi_send(h,"-var-update *\n");
-}
-
-void mi_var_assign(mi_h *h, const char *name, const char *expression)
-{
- mi_send(h,"-var-assign \"%s\" \"%s\"\n",name,expression);
-}
-
-void mi_var_evaluate_expression(mi_h *h, const char *name)
-{
- mi_send(h,"-var-evaluate-expression \"%s\"\n",name);
-}
-
-void mi_var_list_children(mi_h *h, const char *name)
-{
- if (h->version>=MI_VERSION2U(2,0,0))
-    mi_send(h,"-var-list-children --all-values \"%s\"\n",name);
- else
-    mi_send(h,"-var-list-children \"%s\"\n",name);
-}
-
-/* High level versions. */
-
-/**[txh]********************************************************************
-
-  Description:
-  Create a variable object. I recommend using gmi_var_create and letting
-gdb choose the names.
-
-  Command: -var-create
-  Return: A new mi_gvar strcture or NULL on error.
-  
-***************************************************************************/
-
-mi_gvar *gmi_var_create_nm(mi_h *h, const char *name, int frame, const char 
*exp)
-{
- mi_var_create(h,name,frame,exp);
- return mi_res_gvar(h,NULL,exp);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Create a variable object. The name is selected by gdb. Alternative:
-  gmi_full_var_create.
-
-  Command: -var-create [auto name]
-  Return: A new mi_gvar strcture or NULL on error.
-  
-***************************************************************************/
-
-mi_gvar *gmi_var_create(mi_h *h, int frame, const char *exp)
-{
- return gmi_var_create_nm(h,NULL,frame,exp);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Delete a variable object. Doesn't free the mi_gvar data.
-
-  Command: -var-delete
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_delete(mi_h *h, mi_gvar *var)
-{
- mi_var_delete(h,var->name);
- return mi_res_simple_done(h);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Set the format used to represent the result.
-
-  Command: -var-set-format
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_set_format(mi_h *h, mi_gvar *var, enum mi_gvar_fmt format)
-{
- int ret;
-
- mi_var_set_format(h,var->name,mi_format_enum_to_str(format));
- ret=mi_res_simple_done(h);
- if (ret)
-    var->format=format;
- return ret;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Fill the format field with info from gdb.
-
-  Command: -var-show-format
-  Return: !=0 OK.
-  
-***************************************************************************/
-
-int gmi_var_show_format(mi_h *h, mi_gvar *var)
-{
- mi_var_show_format(h,var->name);
- return mi_res_gvar(h,var,NULL)!=NULL;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Fill the numchild field with info from gdb.
-
-  Command: -var-info-num-children
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_info_num_children(mi_h *h, mi_gvar *var)
-{
- mi_var_info_num_children(h,var->name);
- return mi_res_gvar(h,var,NULL)!=NULL;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Fill the type field with info from gdb.
-
-  Command: -var-info-type
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_info_type(mi_h *h, mi_gvar *var)
-{
- mi_var_info_type(h,var->name);
- return mi_res_gvar(h,var,NULL)!=NULL;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Fill the expression and lang fields with info from gdb. Note that lang
-isn't filled during creation.
-
-  Command: -var-info-expression
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_info_expression(mi_h *h, mi_gvar *var)
-{
- mi_var_info_expression(h,var->name);
- return mi_res_gvar(h,var,NULL)!=NULL;
-}
-
-
-/**[txh]********************************************************************
-
-  Description:
-  Fill the attr field with info from gdb. Note that attr isn't filled
-during creation.
-
-  Command: -var-show-attributes
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_show_attributes(mi_h *h, mi_gvar *var)
-{
- mi_var_show_attributes(h,var->name);
- return mi_res_gvar(h,var,NULL)!=NULL;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Create the variable and also fill the lang and attr fields. The name is
-selected by gdb.
-
-  Command: -var-create + -var-info-expression + -var-show-attributes
-  Return: A new mi_gvar strcture or NULL on error.
-  
-***************************************************************************/
-
-mi_gvar *gmi_full_var_create(mi_h *h, int frame, const char *exp)
-{
- mi_gvar *var=gmi_var_create_nm(h,NULL,frame,exp);
- if (var)
-   {/* What if it fails? */
-    gmi_var_info_expression(h,var);
-    gmi_var_show_attributes(h,var);
-   }
- return var;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Update variable. Use NULL for all. Note that *changed can be NULL if none
-updated.
-
-  Command: -var-update
-  Return: !=0 OK. The changed list contains the list of changed vars.
-  
-***************************************************************************/
-
-int gmi_var_update(mi_h *h, mi_gvar *var, mi_gvar_chg **changed)
-{
- mi_var_update(h,var ? var->name : NULL);
- return mi_res_changelist(h,changed);
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Change variable. The new value replaces the value field.
-
-  Command: -var-assign
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_assign(mi_h *h, mi_gvar *var, const char *expression)
-{
- char *res;
- mi_var_assign(h,var->name,expression);
- res=mi_res_value(h);
- if (res)
-   {
-    free(var->value);
-    var->value=res;
-    return 1;
-   }
- return 0;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  Fill the value field getting the current value for a variable.
-
-  Command: -var-evaluate-expression
-  Return: !=0 OK, value contains the result.
-  
-***************************************************************************/
-
-int gmi_var_evaluate_expression(mi_h *h, mi_gvar *var)
-{
- char *s;
-
- mi_var_evaluate_expression(h,var->name);
- s=mi_res_value(h);
- if (s)
-   {
-    free(var->value);
-    var->value=s;
-   }
- return s!=NULL;
-}
-
-/**[txh]********************************************************************
-
-  Description:
-  List children. It ONLY returns the first level information. :-(@*
-  On success the child field contains the list of children.
-
-  Command: -var-list-children
-  Return: !=0 OK
-  
-***************************************************************************/
-
-int gmi_var_list_children(mi_h *h, mi_gvar *var)
-{
- mi_var_list_children(h,var->name);
- return mi_res_children(h,var);
-}
-

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/monkey.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/monkey.c       
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/monkey.c  
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,327 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2010, 2011 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file monkey/gnunet-monkey.c
- * @brief Monkey: automatic debugging tool
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include "monkey_common.h"
-#include "monkey_action.h"
-
-#define MIN_ARG_REQUIRED 2
-
-static char *mode = NULL;
-static char *dumpFileName = NULL;
-static char *binaryName = NULL;
-static char *binaryArgs = NULL;
-static char *emailAddress = NULL;
-static char *edbFilePath = NULL;
-static char *gdbBinaryPath = NULL;
-static char *valgrindBinaryPath = NULL;
-static char *inspectExpression = NULL;
-static char *inspectFunction = NULL;
-static char *scopeDepth = NULL;
-static int reverseExecutionAllowed = MONKEY_NO;
-static int ret = 0;
-
-/**
- * Main function that will launch Monkey's action api.
-*/
-static void run()
-{
-  int result;
-  struct MONKEY_ACTION_Context *cntxt;
-
-  if (NULL == edbFilePath)
-    {
-      /* lookup a file named test.db in the working directory */
-      struct stat buf;
-      if (0 != stat ("test.db", &buf))
-       {
-         fprintf( stderr,
-                     "Expression Database file was not provided as and 
argument, "
-                     "and there is no file named test.db in monkey's working 
directory!\n");
-         MONKEY_break (0);
-         ret = 1;
-         return;
-       }
-
-    }
-
-  if (NULL == dumpFileName)
-    {
-      /* if no file name provided for the output report, use a default one in 
the current working directory */
-      dumpFileName = "monkey_output";
-    }
-
-  if (strcasecmp (mode, "email") == 0)
-    {
-      if (NULL == emailAddress)
-       {
-         fprintf( stderr,
-                     "Working in email mode requires an email address!\n");
-         MONKEY_break (0);
-         ret = 1;
-         return;
-       }
-    }
-
-  /* Initialize context for the Action API */
-  cntxt = MONKEY_malloc (sizeof (struct MONKEY_ACTION_Context));
-  cntxt->email_address = emailAddress;
-  cntxt->binary_name = binaryName;
-  cntxt->binaryArgs = binaryArgs;
-  cntxt->expression_database_path = edbFilePath;
-  cntxt->gdb_binary_path = gdbBinaryPath;
-  cntxt->valgrind_binary_path = valgrindBinaryPath;
-  cntxt->inspect_expression = inspectExpression;
-  cntxt->inspect_function = inspectFunction;
-  cntxt->scope_depth = (NULL == scopeDepth) ? 0 : atoi(scopeDepth);
-  cntxt->bug_detected = 0;
-  cntxt->xml_report_node = NULL;
-  cntxt->run_reverse = reverseExecutionAllowed;
-  cntxt->gdb_connected = MONKEY_NO;
-
-  result = MONKEY_ACTION_rerun_with_gdb (cntxt);
-  switch (result)
-    {
-      int retVal;
-    case MONKEY_NO:
-       fprintf (stderr, "Error in using gdb. Monkey will exit now!");
-       ret = 1;
-      break;
-    case GDB_STATE_ERROR:
-      break;
-    case GDB_STATE_EXIT_NORMALLY:
-      fprintf (stderr,
-                 "Debug with gdb, program exited normally!\n");
-      break;
-    case GDB_STATE_STOPPED:
-      retVal = MONKEY_ACTION_inspect_expression_database (cntxt);
-      if (MONKEY_NO == retVal)
-       {
-         fprintf( stderr,
-                     "Error in using the expression database. Program will 
exit now!\n");
-         ret = 1;
-         break;
-       }
-      else if (BUG_BAD_MEM_ACCESS == cntxt->bug_detected
-                 || BUG_SIG_BUS == cntxt->bug_detected)
-       {
-         /* launch valgrind */
-         retVal = MONKEY_ACTION_rerun_with_valgrind (cntxt);
-         if (MONKEY_NO == retVal)
-           {
-             fprintf( stderr, "Error using Valgrind! Monkey will continue 
debugging!\n");
-           }
-       }
-
-       /* Start backtracking if enabled by user */
-       if (cntxt->run_reverse) {
-         retVal = MONKEY_ACTION_start_reverse_execution(cntxt);
-         if (MONKEY_NO == retVal) {
-                 fprintf(stderr, "Error during Backtracking! Monkey will 
continue debugging with backtracking.\n");
-         }
-       }
-
-
- /*                            REPORTING                                       
                */
-      if (MONKEY_OK != MONKEY_ACTION_format_report_xml (cntxt))
-       {
-         fprintf( stderr,
-                     "Error in generating debug report!\n");
-         ret = 1;
-       }
-      if (strcasecmp (mode, "email") == 0)
-       {
-         if (MONKEY_OK != MONKEY_ACTION_report_email (cntxt, dumpFileName))
-           {
-             fprintf( stderr, "Error sending email!\n");
-             ret = 1;
-           }
-       }
-      else
-       {
-         /* text mode */
-         if (MONKEY_OK !=
-             MONKEY_ACTION_report_file (cntxt, dumpFileName, MONKEY_YES))
-           {
-             fprintf( stderr,
-                         "Error in saving debug file!\n");
-             ret = 1;
-           }
-       }
-      break;
-    default:
-      break;
-    }
-
-  MONKEY_ACTION_delete_context (cntxt);
-}
-
-
-/* display help */
-void showHelp() {
-   printf("Monkey: Automatically debug a service\n");
-   printf ("\t-b: binary: path to a binary file for a program to debug with 
monkey [mandatory]\n");
-   printf ("\t-d: database: path to Expression Database file [mandatory]\n");
-   printf ("\t-m: mode: monkey's mode of operation: options are \"text\" or 
\"email\" [mandatory]\n");
-   printf ("\t-a: address: email address to which monkey will send debug 
report [optional]\n");
-   printf ("\t-f: function: function name at which monkey will set a 
breakpoint [optional]\n");
-   printf ("\t-g: gdb: path to gdb binary to use. If not passed, monkey will 
set it to /usr/bin/gdb [optional]\n");
-   printf ("\t-l: valgrind: path to valgrind binary. If not passed, monkey 
will set it to /usr/bin/valgrind [optional]\n");
-   printf ("\t-p: depth: scope depth. How many scopes should monkey lookup 
expression values outer than the scope in which the problem occurs.\n\t Default 
is 0 which means, monkey is restricted to the scope of the expression in which 
the debugged program stopped [optional]\n");
-   printf ("\t-r: reverse: enables reverse execution. By default it's not 
allowed [optional]\n");
-   printf ("\t-h: help: print this help [optional]\n");
-   printf ("\t-i: inspect: expression to inspect in the function specified 
after argument f [optional]\n");
-   printf ("\t-o: output: path to the debug report generated by monkey.\n\t If 
not provided monkey will save the report in a file named monkey_output in the 
current working directory [optional]\n");
-   printf ("\t-v: version: monkey's version [optional]\n");
-   printf ("Report bugs to address@hidden");
-   printf ("GNUnet home page:  http://www.gnu.org/software/gnunet/\n";);
-   printf ("General help using GNU software: http://www.gnu.org/gethelp/\n";);
-}
-
-int freeMonkeyArgs()
-{
-       if (NULL != mode)
-               MONKEY_free(mode);
-       if (NULL != dumpFileName)
-               MONKEY_free(dumpFileName);
-       if (NULL != binaryName)
-               MONKEY_free(binaryName);
-       if (NULL != emailAddress)
-               MONKEY_free(emailAddress);
-       if (NULL != edbFilePath)
-               MONKEY_free(edbFilePath);
-       if (NULL != gdbBinaryPath)
-               MONKEY_free(gdbBinaryPath);
-       if (NULL != valgrindBinaryPath)
-               MONKEY_free(valgrindBinaryPath);
-       if (NULL != inspectExpression)
-               MONKEY_free(inspectExpression);
-       if (NULL != inspectFunction)
-               MONKEY_free(inspectFunction);
-       if (NULL != scopeDepth)
-               MONKEY_free(scopeDepth);
-
-       return MONKEY_OK;
-}
-
-
-void checkRequiredArgs()
-{
-        if (NULL == binaryName)
-                printf("Error: missing argument: path to the binary file.\n");
-        if (NULL == edbFilePath)
-                printf("Error: missing argument: path to expression database 
file.\n");
-        if (NULL == mode)
-                printf("Error: missing argument: mode of operation.\n");
-        if (NULL == binaryName || NULL == edbFilePath || NULL == mode) {
-                showHelp();
-                exit(EXIT_FAILURE);
-        }
-}
-
-
-const char * buildBinaryArgs(int argc, char **argv) {
-       char * res = MONKEY_strdup("");
-       char * tmp;
-       int i;
-       for (i = 0; i < argc; i++) {
-               MONKEY_asprintf(&tmp, "%s %s", res, argv[i]);
-               MONKEY_free(res);
-               res = tmp;
-       }
-
-       return res;
-}
-
-int
-main (int argc, char *argv[])
-{
-       int i;
-       int binaryCheck = MONKEY_NO;
-       int databaseCheck = MONKEY_NO;
-       int modeCheck = MONKEY_NO;
-        if (argc < MIN_ARG_REQUIRED)
-           {
-             printf ("%s",
-                     "Monkey should take arguments: Use -h to get a list of 
options.\n");
-             return 1;
-           }
-        /* Parsing arguments */
-        for (i = 0; i < argc; i++) {
-                if (strcmp("-h", argv[i]) == 0) {
-                        showHelp();
-                        freeMonkeyArgs();
-                        return 1;
-                }
-                if (strcmp("-b", argv[i]) == 0) {
-                        binaryCheck = MONKEY_OK;
-                        binaryName = MONKEY_strdup(argv[++i]);
-                        checkRequiredArgs();
-                        /* All remaining args are considered program arguments 
*/
-                        i++;
-                        binaryArgs = buildBinaryArgs(argc - i, &argv[i]);
-                        break;
-                }
-                else if (strcmp("-d", argv[i]) == 0) {
-                        databaseCheck = MONKEY_OK;
-                        edbFilePath = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-m", argv[i]) == 0) {
-                        modeCheck = MONKEY_OK;
-                        mode = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-o", argv[i]) == 0) {
-                        dumpFileName = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-a", argv[i]) == 0) {
-                        emailAddress = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-g", argv[i]) == 0) {
-                        gdbBinaryPath = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-l", argv[i]) == 0) {
-                        valgrindBinaryPath = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-f", argv[i]) == 0) {
-                        inspectFunction = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-i", argv[i]) == 0) {
-                        inspectExpression = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-p", argv[i]) == 0) {
-                        scopeDepth = MONKEY_strdup(argv[++i]);
-                }
-                else if (strcmp("-r", argv[i]) == 0) {
-                        reverseExecutionAllowed = MONKEY_YES;
-                }
-        }
-
-        /* Run Monkey */
-        run();
-
-  return ret;
-}

Added: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c     
                        (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c     
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,327 @@
+/*
+     This file is part of GNUnet.
+     (C) 2010, 2011 Christian Grothoff (and other contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file monkey/gnunet-monkey.c
+ * @brief Monkey: automatic debugging tool
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include "monkey_common.h"
+#include "monkey_action.h"
+
+#define MIN_ARG_REQUIRED 2
+
+static char *mode = NULL;
+static char *dumpFileName = NULL;
+static char *binaryName = NULL;
+static char *binaryArgs = NULL;
+static char *emailAddress = NULL;
+static char *edbFilePath = NULL;
+static char *gdbBinaryPath = NULL;
+static char *valgrindBinaryPath = NULL;
+static char *inspectExpression = NULL;
+static char *inspectFunction = NULL;
+static char *scopeDepth = NULL;
+static int reverseExecutionAllowed = MONKEY_NO;
+static int ret = 0;
+
+/**
+ * Main function that will launch Monkey's action api.
+*/
+static void run()
+{
+  int result;
+  struct MONKEY_ACTION_Context *cntxt;
+
+  if (NULL == edbFilePath)
+    {
+      /* lookup a file named test.db in the working directory */
+      struct stat buf;
+      if (0 != stat ("test.db", &buf))
+       {
+         fprintf( stderr,
+                     "Expression Database file was not provided as and 
argument, "
+                     "and there is no file named test.db in monkey's working 
directory!\n");
+         MONKEY_break (0);
+         ret = 1;
+         return;
+       }
+
+    }
+
+  if (NULL == dumpFileName)
+    {
+      /* if no file name provided for the output report, use a default one in 
the current working directory */
+      dumpFileName = "monkey_output";
+    }
+
+  if (strcasecmp (mode, "email") == 0)
+    {
+      if (NULL == emailAddress)
+       {
+         fprintf( stderr,
+                     "Working in email mode requires an email address!\n");
+         MONKEY_break (0);
+         ret = 1;
+         return;
+       }
+    }
+
+  /* Initialize context for the Action API */
+  cntxt = MONKEY_malloc (sizeof (struct MONKEY_ACTION_Context));
+  cntxt->email_address = emailAddress;
+  cntxt->binary_name = binaryName;
+  cntxt->binaryArgs = binaryArgs;
+  cntxt->expression_database_path = edbFilePath;
+  cntxt->gdb_binary_path = gdbBinaryPath;
+  cntxt->valgrind_binary_path = valgrindBinaryPath;
+  cntxt->inspect_expression = inspectExpression;
+  cntxt->inspect_function = inspectFunction;
+  cntxt->scope_depth = (NULL == scopeDepth) ? 0 : atoi(scopeDepth);
+  cntxt->bug_detected = 0;
+  cntxt->xml_report_node = NULL;
+  cntxt->run_reverse = reverseExecutionAllowed;
+  cntxt->gdb_connected = MONKEY_NO;
+
+  result = MONKEY_ACTION_rerun_with_gdb (cntxt);
+  switch (result)
+    {
+      int retVal;
+    case MONKEY_NO:
+       fprintf (stderr, "Error in using gdb. Monkey will exit now!");
+       ret = 1;
+      break;
+    case GDB_STATE_ERROR:
+      break;
+    case GDB_STATE_EXIT_NORMALLY:
+      fprintf (stderr,
+                 "Debug with gdb, program exited normally!\n");
+      break;
+    case GDB_STATE_STOPPED:
+      retVal = MONKEY_ACTION_inspect_expression_database (cntxt);
+      if (MONKEY_NO == retVal)
+       {
+         fprintf( stderr,
+                     "Error in using the expression database. Program will 
exit now!\n");
+         ret = 1;
+         break;
+       }
+      else if (BUG_BAD_MEM_ACCESS == cntxt->bug_detected
+                 || BUG_SIG_BUS == cntxt->bug_detected)
+       {
+         /* launch valgrind */
+         retVal = MONKEY_ACTION_rerun_with_valgrind (cntxt);
+         if (MONKEY_NO == retVal)
+           {
+             fprintf( stderr, "Error using Valgrind! Monkey will continue 
debugging!\n");
+           }
+       }
+
+       /* Start backtracking if enabled by user */
+       if (cntxt->run_reverse) {
+         retVal = MONKEY_ACTION_start_reverse_execution(cntxt);
+         if (MONKEY_NO == retVal) {
+                 fprintf(stderr, "Error during Backtracking! Monkey will 
continue debugging with backtracking.\n");
+         }
+       }
+
+
+ /*                            REPORTING                                       
                */
+      if (MONKEY_OK != MONKEY_ACTION_format_report_xml (cntxt))
+       {
+         fprintf( stderr,
+                     "Error in generating debug report!\n");
+         ret = 1;
+       }
+      if (strcasecmp (mode, "email") == 0)
+       {
+         if (MONKEY_OK != MONKEY_ACTION_report_email (cntxt, dumpFileName))
+           {
+             fprintf( stderr, "Error sending email!\n");
+             ret = 1;
+           }
+       }
+      else
+       {
+         /* text mode */
+         if (MONKEY_OK !=
+             MONKEY_ACTION_report_file (cntxt, dumpFileName, MONKEY_YES))
+           {
+             fprintf( stderr,
+                         "Error in saving debug file!\n");
+             ret = 1;
+           }
+       }
+      break;
+    default:
+      break;
+    }
+
+  MONKEY_ACTION_delete_context (cntxt);
+}
+
+
+/* display help */
+void showHelp() {
+   printf("Monkey: Automatically debug a service\n");
+   printf ("\t-b: binary: path to a binary file for a program to debug with 
monkey [mandatory]\n");
+   printf ("\t-d: database: path to Expression Database file [mandatory]\n");
+   printf ("\t-m: mode: monkey's mode of operation: options are \"text\" or 
\"email\" [mandatory]\n");
+   printf ("\t-a: address: email address to which monkey will send debug 
report [optional]\n");
+   printf ("\t-f: function: function name at which monkey will set a 
breakpoint [optional]\n");
+   printf ("\t-g: gdb: path to gdb binary to use. If not passed, monkey will 
set it to /usr/bin/gdb [optional]\n");
+   printf ("\t-l: valgrind: path to valgrind binary. If not passed, monkey 
will set it to /usr/bin/valgrind [optional]\n");
+   printf ("\t-p: depth: scope depth. How many scopes should monkey lookup 
expression values outer than the scope in which the problem occurs.\n\t Default 
is 0 which means, monkey is restricted to the scope of the expression in which 
the debugged program stopped [optional]\n");
+   printf ("\t-r: reverse: enables reverse execution. By default it's not 
allowed [optional]\n");
+   printf ("\t-h: help: print this help [optional]\n");
+   printf ("\t-i: inspect: expression to inspect in the function specified 
after argument f [optional]\n");
+   printf ("\t-o: output: path to the debug report generated by monkey.\n\t If 
not provided monkey will save the report in a file named monkey_output in the 
current working directory [optional]\n");
+   printf ("\t-v: version: monkey's version [optional]\n");
+   printf ("Report bugs to address@hidden");
+   printf ("GNUnet home page:  http://www.gnu.org/software/gnunet/\n";);
+   printf ("General help using GNU software: http://www.gnu.org/gethelp/\n";);
+}
+
+int freeMonkeyArgs()
+{
+       if (NULL != mode)
+               MONKEY_free(mode);
+       if (NULL != dumpFileName)
+               MONKEY_free(dumpFileName);
+       if (NULL != binaryName)
+               MONKEY_free(binaryName);
+       if (NULL != emailAddress)
+               MONKEY_free(emailAddress);
+       if (NULL != edbFilePath)
+               MONKEY_free(edbFilePath);
+       if (NULL != gdbBinaryPath)
+               MONKEY_free(gdbBinaryPath);
+       if (NULL != valgrindBinaryPath)
+               MONKEY_free(valgrindBinaryPath);
+       if (NULL != inspectExpression)
+               MONKEY_free(inspectExpression);
+       if (NULL != inspectFunction)
+               MONKEY_free(inspectFunction);
+       if (NULL != scopeDepth)
+               MONKEY_free(scopeDepth);
+
+       return MONKEY_OK;
+}
+
+
+void checkRequiredArgs()
+{
+        if (NULL == binaryName)
+                printf("Error: missing argument: path to the binary file.\n");
+        if (NULL == edbFilePath)
+                printf("Error: missing argument: path to expression database 
file.\n");
+        if (NULL == mode)
+                printf("Error: missing argument: mode of operation.\n");
+        if (NULL == binaryName || NULL == edbFilePath || NULL == mode) {
+                showHelp();
+                exit(EXIT_FAILURE);
+        }
+}
+
+
+const char * buildBinaryArgs(int argc, char **argv) {
+       char * res = MONKEY_strdup("");
+       char * tmp;
+       int i;
+       for (i = 0; i < argc; i++) {
+               MONKEY_asprintf(&tmp, "%s %s", res, argv[i]);
+               MONKEY_free(res);
+               res = tmp;
+       }
+
+       return res;
+}
+
+int
+main (int argc, char *argv[])
+{
+       int i;
+       int binaryCheck = MONKEY_NO;
+       int databaseCheck = MONKEY_NO;
+       int modeCheck = MONKEY_NO;
+        if (argc < MIN_ARG_REQUIRED)
+           {
+             printf ("%s",
+                     "Monkey should take arguments: Use -h to get a list of 
options.\n");
+             return 1;
+           }
+        /* Parsing arguments */
+        for (i = 0; i < argc; i++) {
+                if (strcmp("-h", argv[i]) == 0) {
+                        showHelp();
+                        freeMonkeyArgs();
+                        return 1;
+                }
+                if (strcmp("-b", argv[i]) == 0) {
+                        binaryCheck = MONKEY_OK;
+                        binaryName = MONKEY_strdup(argv[++i]);
+                        checkRequiredArgs();
+                        /* All remaining args are considered program arguments 
*/
+                        i++;
+                        binaryArgs = buildBinaryArgs(argc - i, &argv[i]);
+                        break;
+                }
+                else if (strcmp("-d", argv[i]) == 0) {
+                        databaseCheck = MONKEY_OK;
+                        edbFilePath = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-m", argv[i]) == 0) {
+                        modeCheck = MONKEY_OK;
+                        mode = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-o", argv[i]) == 0) {
+                        dumpFileName = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-a", argv[i]) == 0) {
+                        emailAddress = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-g", argv[i]) == 0) {
+                        gdbBinaryPath = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-l", argv[i]) == 0) {
+                        valgrindBinaryPath = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-f", argv[i]) == 0) {
+                        inspectFunction = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-i", argv[i]) == 0) {
+                        inspectExpression = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-p", argv[i]) == 0) {
+                        scopeDepth = MONKEY_strdup(argv[++i]);
+                }
+                else if (strcmp("-r", argv[i]) == 0) {
+                        reverseExecutionAllowed = MONKEY_YES;
+                }
+        }
+
+        /* Run Monkey */
+        run();
+
+  return ret;
+}

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test.db
===================================================================
(Binary files differ)

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/test_monkey.c  
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey.c     
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,71 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2009 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file monkey/test_gnunet_monkey.c
- * @brief Testcase for Monkey
- * @author Safey A.Halim
- */
-
-/**
- * Test case for Monkey Automatic Debugger.
- * It launches Monkey to run binaries having 
- * known bugs (e.g. Null Pointer Exception)
- * Monkey should be able to detect the problem and send an e-mail
- * containing the problem description.
- */
-
-
-#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_program_lib.h"
-
-
-static int
-check ()
-{
-  GNUNET_OS_process_close (GNUNET_OS_start_process (NULL, NULL,
-                                                   "gnunet-monkey",
-                                                   "gnunet-monkey",
-                                                   
"./bug_null_pointer_exception",
-                                                   NULL));
-
-  return 0;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  int ret;
-
-  GNUNET_log_setup ("test-gnunet-monkey",
-#if VERBOSE
-                   "DEBUG",
-#else
-                   "WARNING",
-#endif
-                   NULL);
-  ret = check ();
-  return ret;
-}
-
-/* end of test_gnunet_monkey.c */

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey.sh
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/test_monkey.sh 
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey.sh    
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,199 +0,0 @@
-#!/bin/sh
-
-rm -rf /tmp/test-gnunetd-monkey/
-exe="./gnunet-monkey -c test_monkey_api_data.conf"
-out=`mktemp /tmp/test-gnunet-monkey-logXXXXXXXX`
-arm="gnunet-arm -c test_monkey_api_data.conf $DEBUG"
-#DEBUG="-L DEBUG"
-# -----------------------------------
-echo -n "Preparing: Starting service..."
-
-$arm -s > /dev/null
-sleep 1
-$arm -i monkey > /dev/null
-sleep 1 
-echo "DONE"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: Bad argument checking..."
-
-if $exe -x 2> /dev/null; then
-  echo "FAIL: error running $exe"
-  $arm -e
-  exit 1
-fi
-echo "PASS"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: Set value..."
-
-if ! $exe $DEBUG -n test -s subsystem 42 ; then
-  echo "FAIL: error running $exe"
-  $arm -e
-  exit 1
-fi
-echo "PASS"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: Set another value..."
-
-if ! $exe $DEBUG -n other -s osystem 43 ; then
-  echo "FAIL: error running $exe"
-  $arm -e
-  exit 1
-fi
-echo "PASS"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: viewing all stats..."
-
-if ! $exe $DEBUG > $out; then
-    echo "FAIL: error running $exe"
-    $arm -e
-    exit 1
-fi
-LINES=`cat $out | wc -l`
-if test $LINES -ne 2; then
-    echo "FAIL: unexpected output"
-    $arm -e
-    exit 1
-fi
-echo "PASS"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: viewing stats by name..."
-
-if ! $exe $DEBUG -n other > $out; then
-    echo "FAIL: error running $exe"
-    $arm -e
-    exit 1
-fi
-LINES=`cat $out | grep 43 | wc -l`
-if test $LINES -ne 1; then
-    echo "FAIL: unexpected output"
-    $arm -e
-    exit 1
-fi
-echo "PASS"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: viewing stats by subsystem..."
-
-if ! $exe $DEBUG -s subsystem > $out; then
-    echo "FAIL: error running $exe"
-    $arm -e
-    exit 1
-fi
-LINES=`cat $out | grep 42 | wc -l`
-if test $LINES -ne 1; then
-    echo "FAIL: unexpected output"
-    $arm -e
-    exit 1
-fi
-echo "PASS"
-
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: Set persistent value..."
-
-if ! $exe $DEBUG -n lasting -s subsystem 40 -p; then
-  echo "FAIL: error running $exe"
-  $arm -e
-  exit 1
-fi
-if ! $exe $DEBUG > $out; then
-    echo "FAIL: error running $exe"
-    $arm -e
-    exit 1
-fi
-LINES=`cat $out | grep 40 | wc -l`
-if test $LINES -ne 1; then
-    echo "FAIL: unexpected output"
-    cat $out
-    $arm -e
-    exit 1
-fi
-echo "PASS"
-
-# -----------------------------------
-echo -n "Restarting service..."
-$arm -k monkey > /dev/null
-sleep 1
-$arm -i monkey > /dev/null
-sleep 1
-echo "DONE"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: checking persistence..."
-
-if ! $exe $DEBUG > $out; then
-    echo "FAIL: error running $exe"
-    $arm -e
-    exit 1
-fi
-LINES=`cat $out | grep 40 | wc -l`
-if test $LINES -ne 1; then
-    echo "FAIL: unexpected output"
-    cat $out
-    $arm -e
-    exit 1
-fi
-echo "PASS"
-
-
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: Removing persistence..."
-
-if ! $exe  $DEBUG -n lasting -s subsystem 40; then
-  echo "FAIL: error running $exe"
-  $arm -e
-  exit 1
-fi
-if ! $exe $DEBUG > $out; then
-    echo "FAIL: error running $exe"
-    $arm -e
-    exit 1
-fi
-LINES=`cat $out | grep \! | wc -l`
-if test $LINES -ne 0; then
-    echo "FAIL: unexpected output"
-    cat $out
-    $arm -e
-    exit 1
-fi
-echo "PASS"
-
-
-# -----------------------------------
-echo -n "Restarting service..."
-$arm -k monkey > /dev/null
-sleep 1
-$arm -i monkey > /dev/null
-sleep 1
-echo "DONE"
-
-# 
----------------------------------------------------------------------------------
-echo -n "TEST: checking removed persistence..."
-
-if ! $exe $DEBUG > $out; then
-    echo "FAIL: error running $exe"
-    $arm -e
-    exit 1
-fi
-LINES=`cat $out | grep 40 | wc -l`
-if test $LINES -ne 0; then
-    echo "FAIL: unexpected output"
-    cat $out
-    $arm -e
-    exit 1
-fi
-echo "PASS"
-
-# -----------------------------------
-echo -n "Stopping service..."
-$arm -e > /dev/null
-sleep 1
-echo "DONE"
-rm -f $out
-rm -rf /tmp/test-gnunetd-monkey/

Deleted: 
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey_edb.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/test_monkey_edb.c      
2012-07-25 10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/test_monkey_edb.c 
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,69 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2010 Christian Grothoff (and other contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file monkey/test_monkey_edb.c
- * @brief testcase for edb_api.c
- */
-#include "monkey_common.h"
-#include "monkey_edb.h"
-
-
-static const char *ref[16] =
-  { "args", "32", "argv", "32", "whole", "42", "whole.member", "42",
-  "whole.member=1", "42", "whole.part", "43", "&part", "43",
-  "whole.part=&part", "43"
-};
-
-static int refCount = 0;
-static int ret = 1;
-
-int
-expressionIterator (void *cls, int colNum, char **colValues, char **colNames)
-{
-  int i;
-  for (i = 0; i < colNum; i++)
-    {
-      if (strcmp (colValues[i], ref[refCount]) != 0)
-       return 1;
-      refCount++;
-    }
-
-  return 0;
-}
-
-
-int
-main (int args, const char *argv[])
-{
-  printf ("test-monkey-edb\n");
-  struct MONKEY_EDB_Context *cntxt;
-  cntxt = MONKEY_EDB_connect ("test.db");
-  ret =
-    MONKEY_EDB_get_expressions (cntxt,
-                                      "monkey/seaspider/SeaspiderTest.c", 44,
-                                      83, &expressionIterator, NULL);
-  MONKEY_EDB_disconnect (cntxt);
-
-  if (ret == MONKEY_OK)
-    {
-      return 0;
-    }
-  return 1;
-}

Deleted: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/tmp
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/monkey/tmp    2012-07-25 
10:38:11 UTC (rev 22904)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/tmp       
2012-07-25 13:05:29 UTC (rev 22908)
@@ -1,30 +0,0 @@
-==1277== Memcheck, a memory error detector
-==1277== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
-==1277== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
-==1277== Command: ./bug_bad_memory_access
-==1277== Parent PID: 1666
-==1277== 
-==1277== Invalid write of size 4
-==1277==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
-==1277==    by 0x400532: main (bug_bad_memory_access.c:14)
-==1277==  Address 0x4252352 is not stack'd, malloc'd or (recently) free'd
-==1277== 
-==1277== 
-==1277== Process terminating with default action of signal 11 (SIGSEGV)
-==1277==  Access not within mapped region at address 0x4252352
-==1277==    at 0x400512: badMemoryAccess (bug_bad_memory_access.c:9)
-==1277==    by 0x400532: main (bug_bad_memory_access.c:14)
-==1277==  If you believe this happened as a result of a stack
-==1277==  overflow in your program's main thread (unlikely but
-==1277==  possible), you can try to increase the size of the
-==1277==  main thread stack using the --main-stacksize= flag.
-==1277==  The main thread stack size used in this run was 8388608.
-==1277== 
-==1277== HEAP SUMMARY:
-==1277==     in use at exit: 0 bytes in 0 blocks
-==1277==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
-==1277== 
-==1277== All heap blocks were freed -- no leaks are possible
-==1277== 
-==1277== For counts of detected and suppressed errors, rerun with: -v
-==1277== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

Added: monkey/branches/MonkeyBacktracking/monkey/src/util/Makefile.in
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/util/Makefile.in              
                (rev 0)
+++ monkey/branches/MonkeyBacktracking/monkey/src/util/Makefile.in      
2012-07-25 13:05:29 UTC (rev 22908)
@@ -0,0 +1,541 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
address@hidden@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/util
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/monkey_config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(libdir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libmonkeyutil_la_LIBADD =
+am_libmonkeyutil_la_OBJECTS = common_allocation.lo str_replace_all.lo
+libmonkeyutil_la_OBJECTS = $(am_libmonkeyutil_la_OBJECTS)
+DEFAULT_INCLUDES = address@hidden@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SOURCES = $(libmonkeyutil_la_SOURCES)
+DIST_SOURCES = $(libmonkeyutil_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_DATA = @PACKAGE_DATA@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include
address@hidden@AM_CFLAGS = --coverage -O0
address@hidden@XLIB = -lgcov
+lib_LTLIBRARIES = libmonkeyutil.la
+libmonkeyutil_la_SOURCES = \
+  common_allocation.c \
+  str_replace_all.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/util/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu src/util/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure 
$(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+       }
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall 
rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f 
"$(DESTDIR)$(libdir)/$$f"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libmonkeyutil.la: $(libmonkeyutil_la_OBJECTS) $(libmonkeyutil_la_DEPENDENCIES) 
+       $(LINK) -rpath $(libdir) $(libmonkeyutil_la_OBJECTS) 
$(libmonkeyutil_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
+
+.c.o:
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
address@hidden@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
address@hidden@@am__fastdepCC_FALSE@    source='$<' object='$@' libtool=no 
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c $<
+
+.c.obj:
address@hidden@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ 
`$(CYGPATH_W) '$<'`
address@hidden@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
address@hidden@@am__fastdepCC_FALSE@    source='$<' object='$@' libtool=no 
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
address@hidden@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
address@hidden@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
address@hidden@@am__fastdepCC_FALSE@    source='$<' object='$@' libtool=yes 
@AMDEPBACKSLASH@
address@hidden@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
address@hidden@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx 
{} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx 
{} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f 
$(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       clean-libLTLIBRARIES clean-libtool ctags distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am \
+       install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-libLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:




reply via email to

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