Ejemplo n.º 1
0
static void handler_wait(const char **args)
{
    s2e_message("Waiting for S2E...");
    while (!s2e_version()) {
       SLEEP(1);
    }
    s2e_message("Done waiting for S2E.");
}
Ejemplo n.º 2
0
int main (void) {
   char buf[256];
   memset (buf, '\0', sizeof (buf) );
   unsigned int given_low = 0;
   unsigned int given_high = 10;
   unsigned int symb;
  
   snprintf (buf, sizeof (buf), "Running Modifed S2E Tutorial1 (for Iteration)\n");
   s2e_message (buf);
   printf ("%s\n", buf);

   symb = s2e_dasospreproc_fuzz (given_low, given_high);
   if (symb < given_low || symb > given_high) {
      snprintf (buf, sizeof (buf), "Error: should not be here, char is not in range: %02x<=%02x<=%02x:%u<=%u<=%u", given_low, symb, given_high, given_low, symb, given_high);
      s2e_warning (buf);
      printf ("%s\n", buf);
      s2e_kill_state (1, buf);
      return 1;
   }
   
   snprintf (buf, sizeof (buf), "Success: char is in range: %02x<=%02x<=%02x:%u<=%u<=%u", given_low, symb, given_high, given_low, symb, given_high);
   s2e_warning (buf);
   printf ("%s\n", buf);
   s2e_kill_state (0, buf);
   return 0;
} // end fn main
Ejemplo n.º 3
0
int main (void) {
   char buf[256];
   memset (buf, '\0', sizeof (buf) );
   char given_low = 'a';
   char given_high = 'j';
   char symb;
   //char i;
  
   snprintf (buf, sizeof (buf), "Running Modifed S2E Tutorial1 (for Iteration)\n");
   s2e_message (buf);
   printf ("%s\n", buf);

   //s2e_disable_all_apic_interrupts();  // make faster
   //s2e_enable_forking ();
   //s2e_make_symbolic (&(symb), 1 * sizeof (char), "symb"); 
   symb = s2e_dasospreproc_fuzz (given_low, given_high);
   if (symb < given_low || symb > given_high) {
      snprintf (buf, sizeof (buf), "Error: should not be here, char is not in range: %02x<=%02x<=%02x:%c<=%c<=%c", given_low, symb, given_high, given_low, symb, given_high);
      s2e_warning (buf);
      printf ("%s\n", buf);
      //s2e_dasospreproc_fuzz_kill_state ();
      s2e_kill_state (1, buf);
      return 1;
   }
   
   /* something goes here to make it print all possible examples */ //{
      //s2e_get_example (&(symb), 1 * sizeof (char) );
      snprintf (buf, sizeof (buf), "Success: char is in range: %02x<=%02x<=%02x:%c<=%c<=%c", given_low, symb, given_high, given_low, symb, given_high);
      s2e_warning (buf);
      printf ("%s\n", buf);
      //s2e_dasospreproc_fuzz_kill_state ();
      s2e_kill_state (0, buf);
      return 0;
   //}
   
   
   s2e_kill_state (1, "should never be here, outside of the forloop, program terminated");
   return 1;
} // end fn main
Ejemplo n.º 4
0
int main (void) {
  char buf[32];
  memset (buf, '\0', sizeof (buf) );
  char given;
  char symb;
  // for non-symbolic:
  /*
   char str[3];
   memset (str, '\0', 3);
   printf("Enter two characters: ");
   if (!fgets(str, sizeof(str), stdin))
      return 1;
   symb = str[0];
   given = str[1];
  */
  
  // for symbolic:
  //s2e_disable_all_apic_interrupts();  // make faster
  given = 'a';
  s2e_enable_forking ();               // Enable forking on symbolic conditions.
  s2e_make_symbolic (&(symb), 1 * sizeof (char), "symb"); 
  // saves state
  // forks to creates a new state with symbolic (random) values for str[0] and str[1]
  // note, this means it only created and ran 1 set of symbolic value
  snprintf (buf, sizeof (buf), "Running S2E Tutorial1\n");
  /*s2e_get_example (&(symb), 1 * sizeof (char) ); // gets the symbolic values that were used which reached this point
  snprintf (buf, sizeof (buf), "Running S2E Tutorial1:%02x%02x%c%c:\n", (unsigned char) symb, (unsigned char) given, symb, given);*/
  s2e_message (buf);
  printf ("%s\n", buf);

  if (symb == '\0') {
    printf ("No input char\n");
      s2e_get_example (&(symb), 1 * sizeof (char) ); // gets the symbolic values that were used which reached this point
      snprintf (buf, sizeof (buf), "s2e_get_example4:%02x%02x%c%c:\n", (unsigned char) symb, (unsigned char) given, symb, given);
      s2e_warning (buf);
      printf ("%s\n", buf);

  } else {
      s2e_get_example (&(symb), 1 * sizeof (char) ); // gets the symbolic values that were used which reached this point
      snprintf (buf, sizeof (buf), "s2e_get_example1:%02x%02x%c%c:\n", (unsigned char) symb, (unsigned char) given, symb, given);
      s2e_warning (buf);
      printf ("%s\n", buf);
    if (symb == given) {
	//s2e_warning ("symb equals 1\n");
      printf ("Chars are the same: %c == %c\n", symb, given);
      s2e_get_example (&(symb), 1 * sizeof (char) ); // gets the symbolic values that were used which reached this point
      snprintf (buf, sizeof (buf), "s2e_get_example2:%02x%02x%c%c:\n", (unsigned char) symb, (unsigned char) given, symb, given);
      s2e_warning (buf);
      printf ("%s\n", buf);
    }
  }

  //s2e_disable_forking ();

  s2e_get_example (&(symb), 1 * sizeof (char) ); // gets the symbolic values that were used which reached this point
  snprintf (buf, sizeof (buf), "s2e_get_example3:%02x%02x%c%c:\n", (unsigned char) symb, (unsigned char) given, symb, given);
  s2e_warning (buf);
  printf ("%s\n", buf);

  s2e_kill_state (0, "program terminated");

  return 0;
}
Ejemplo n.º 5
0
static void handler_message(const char **args)
{
    s2e_message(args[0]);
}