[eresi-dev] ERESI 0.79b4 features complete support for expressions

Julien Vanegue jv274 at cam.ac.uk
Fri Jul 13 00:10:52 UTC 2007


Hi all,

This mail inaugurate the new mailing list : eresi-dev

If you are subscribed without wanting (maybe you
were subscribed on the previous elf-dev or elfdev-dev
list ?), you can manage your account from there :

http://lists.einherjar.de/mailman/listinfo/eresi-dev

----------------------------------------------------------------------

Now place to the real stuff: ERESI now has full support for
expressions. You can create, set, compare, and even match
expressions together. An example script is provided to you
in testsuite/testscripts/declare.esh.

The original output is perfectly aligned and has colors. Run it in
a terminal ! This is the very first public script on the evarista
static analyzer.

For those who are too lazy, the result of this script is as follow
(please excuse indentation if that was broken somehow because of
the cut/paste)

~print ************ Now declarations of record types *****************
************ Now declarations of record types *****************

~type struct0 = field0:long

         [*] Added type struct0 succesfully

~type struct1 = field1:byte field2:long

         [*] Added type struct1 succesfully

~type struct2 = field3:struct1 field4:long field5:struct1

         [*] Added type struct2 succesfully

~print ************ Now declarations of variables *****************
************ Now declarations of variables *****************

~struct0 mystruct0 = (field0:42)
 [*] Variable mystruct0 succesfully initialized

~struct0 mystruct0b = struct0(field0:42)
 [*] Variable mystruct0b succesfully initialized

~struct0 mystruct0c = struct0(field0:43)
 [*] Variable mystruct0c succesfully initialized

~struct1 mystruct1 = (field1:42,field2:43)
 [*] Variable mystruct1 succesfully initialized

~struct1 mystruct1b = (field1:42,field2:43)
 [*] Variable mystruct1b succesfully initialized

~struct1 mystruct1c = (field1:43,field2:42)
 [*] Variable mystruct1c succesfully initialized

~struct1 mystruct1d = (field2:42,field1:43)
 [*] Variable mystruct1d succesfully initialized

~struct2 mystruct2 = (field3(field1:42, field2:43), field4:44, 
field5(field1:45, field2:46))
 [*] Variable mystruct2 succesfully initialized

~struct2 mystruct2b = (field3(field1:42, field2:43), field4:44, 
field5(field1:45, field2:46))
 [*] Variable mystruct2b succesfully initialized

~struct2 mystruct2c = (field3(field1:42, field2:43), field4:44, 
field5(field1:46, field2:45))
 [*] Variable mystruct2c succesfully initialized

~print ************ Now testing printing of types *****************
************ Now testing printing of types *****************

~type

  .:: Available meta-language types

  Type raw                  size {0}      
  Type struct1              size {5}        = {field1:byte,
                                                             field2:long}

  Type int                  size {4}      
  Type struct2           size {14}       = {field3:struct1,
                                                            field4:long,
                                                             field5:struct1}

  Type hash                 size {16}     
  Type string               size {4}      
  Type long                 size {4}      
  Type caddr                size {4}      
  Type daddr                size {4}      
  Type byte                 size {1}      
  Type short                size {2}      
  Type vector               size {28}     
  Type struct0              size {4}        = {field0:long}


  .:: Found 13 registered types

~print ************ Now testing printing of expressions *****************
************ Now testing printing of expressions *****************

~print $mystruct0
  $mystruct0 = {long               field0 = 42 (0x2A) @ off(0)}



~print $mystruct0b
  $mystruct0b = {long               field0 = 42 (0x2A) @ off(0)}



~print $mystruct0c
  $mystruct0c = {long               field0 = 43 (0x2B) @ off(0)}



~print $mystruct1
  $mystruct1 = {byte               field1 = '*' (42) @ off(0),
                        long               field2 = 43 (0x2B) @ off(1)}



~print $mystruct1b
  $mystruct1b = {byte               field1 = '*' (42) @ off(0),
                           long               field2 = 43 (0x2B) @ off(1)}



~print $mystruct1c
  $mystruct1c = {byte               field1 = '+' (43) @ off(0),
                         long               field2 = 42 (0x2A) @ off(1)}



~print $mystruct1d
  $mystruct1d = {long               field2 = 42 (0x2A) @ off(0),
                         byte               field1 = '+' (43) @ off(4)}



~print $mystruct2
  $mystruct2 = {struct1   field3 = {byte               field1 = '*' (42) 
@ off(0),
                                                      long               
field2 = 43 (0x2B) @ off(1)},
                           long      field4 = 44 (0x2C) @ off(5),
                           struct1   field5 = {byte               field1 
= '-' (45) @ off(9),
                                                        
long               field2 = 46 (0x2E) @ off(10)}}



~print $mystruct2b
  $mystruct2b = {struct1            field3 = {byte               field1 
= '*' (42) @ off(0),
                                                                  
long               field2 = 43 (0x2B) @ off(1)},
                            long               field4 = 44 (0x2C) @ off(5),
                            struct1            field5 = 
{byte               field1 = '-' (45) @ off(9),
                                                                 
long               field2 = 46 (0x2E) @ off(10)}}


~print $mystruct2c
  $mystruct2c = {struct1            field3 = {byte               field1 
= '*' (42) @ off(0),
                                                                 
long               field2 = 43 (0x2B) @ off(1)},
                            long               field4 = 44 (0x2C) @ off(5),
                            struct1            field5 = 
{byte               field1 = '.' (46) @ off(9),
                                                                 
long               field2 = 45 (0x2D) @ off(10)}}



~print *********** Now testing comparison of expressions ****************
*********** Now testing comparison of expressions ****************

~cmp $mystruct0 $mystruct0
 [*] Objects are EQUALS.

~cmp $mystruct0 $mystruct0b
 [*] Objects are EQUALS.

~cmp $mystruct0b $mystruct0c
 [*] Objects are INEQUALS.

~cmp $mystruct1 $mystruct1b
 [*] Objects are EQUALS.

~cmp $mystruct1b $mystruct1c
 [*] Objects are INEQUALS.

~cmp $mystruct2 $mystruct2b
 [*] Objects are EQUALS.

~cmp $mystruct2b $mystruct2c
 [*] Objects are INEQUALS.

~print *********** Now testing comparison without field orders 
****************
*********** Now testing comparison without field orders ****************

~cmp $mystruct1c $mystruct1d
 [*] Objects are EQUALS.

~print $mystruct0b $mystruct0c
  $mystruct0b = {long               field0 = 42 (0x2A) @ off(0)}

  $mystruct0c = {long               field0 = 43 (0x2B) @ off(0)}



~set $mystruct0c $mystruct0b
 [*] Expression set succesfully

~cmp $mystruct0b $mystruct0c
 [*] Objects are EQUALS.

~print $mystruct0b $mystruct0c
  $mystruct0b = {long               field0 = 42 (0x2A) @ off(0)}

  $mystruct0c = {long               field0 = 42 (0x2A) @ off(0)}



~print $mystruct1b $mystruct1c
  $mystruct1b = {byte               field1 = '*' (42) @ off(0),
                            long               field2 = 43 (0x2B) @ off(1)}

  $mystruct1c = {byte               field1 = '+' (43) @ off(0),
                            long               field2 = 42 (0x2A) @ off(1)}


~print *********** Now testing comparison of expressions *********
*********** Now testing comparison of expressions ***********

~cmp $mystruct0 $mystruct0
 [*] Objects are EQUALS.

~cmp $mystruct0 $mystruct0b
 [*] Objects are EQUALS.

~cmp $mystruct0b $mystruct0c
 [*] Objects are INEQUALS.

~cmp $mystruct1 $mystruct1b
 [*] Objects are EQUALS.

~cmp $mystruct1b $mystruct1c
 [*] Objects are INEQUALS.
~print $mystruct2c $mystruct2b
  $mystruct2c = {struct1            field3 = {byte               field1 
= '*' (42) @ off(0),
                                                                 
long               field2 = 43 (0x2B) @ off(1)},
                            long               field4 = 44 (0x2C) @ off(5),
                            struct1            field5 = 
{byte               field1 = '.' (46) @ off(9),
                                                                  
long               field2 = 45 (0x2D) @ off(10)}}

  $mystruct2b = {struct1            field3 = {byte               field1 
= '*' (42) @ off(0),
                                                                 
long               field2 = 43 (0x2B) @ off(1)},
                            long               field4 = 44 (0x2C) @ off(5),
                            struct1            field5 = 
{byte               field1 = '-' (45) @ off(9),
                                                                  
long               field2 = 46 (0x2E) @ off(10)}}


~set $mystruct2c $mystruct2b
 [*] Expression set succesfully

~cmp $mystruct2b $mystruct2c
 [*] Objects are EQUALS.

~print $mystruct2c $mystruct2b
  $mystruct2c = {struct1            field3 = {byte               field1 
= '*' (42) @ off(0),
                                                                 
long               field2 = 43 (0x2B) @ off(1)},
                            long               field4 = 44 (0x2C) @ off(5),
                            struct1            field5 = 
{byte               field1 = '-' (45) @ off(9),
                                                                 
long               field2 = 46 (0x2E) @ off(10)}}

  $mystruct2b = {struct1            field3 = {byte               field1 
= '*' (42) @ off(0),
                                                                 
long               field2 = 43 (0x2B) @ off(1)},
                            long               field4 = 44 (0x2C) @ off(5),
                            struct1            field5 = 
{byte               field1 = '-' (45) @ off(9),
                                                                 
long               field2 = 46 (0x2E) @ off(10)}}



~quit

 [+] Unloading workspace : 0 (local) *
         .:: Bye -:: The Evarista static analyzer 0.79




More information about the eresi-dev mailing list