Further infos [about SATIrE]

SATIrE 0.8.5 FAQ

  1. How do I get started with a new analysis?

    After SATIrE, ROSE, and PAG are installed several commands and scripts are available. Use the command

    newanalysis [-u]

    for creating a new analyzer. First create a directory to hold the files of your analysis, <AnalysisName>. Change to this directory and create two files, <AnalysisName>.set and <AnalysisName>.optla; in that directory. Then run the command newanalysis. This command creates all required additional files that are necessary for generating the analyzer and compiling it. You may rerun newanalysis any time. It never overwrites any .set or .optla file. It only (re)generates the files Makefile, main.h, main.C, and main-support.C that are required for building a complete analyzer.
    If you need to modify the generated files main.h or main.C when creating an advanced analyzer, you can run newanalysis with option '-u' to ensure that main.C and main.h are not overwritten, if they already exist in the directory.

  2. Where can I find an example specification and how can I generate and compile the analyzer?

    Here is a documented intra procedural reaching definitions analysis for C++SL1: sl1rd.set sl1rd.optla. C++SL1 is a C++ sublanguage (we only address a subset of C++ in this demo-analysis specification).

    The analysis is specified such that it ensures that the input program is indeed a C++SL1 program (a subset of C++). Therefore it also demonstrates what C++ language constructs are in C++SL1 and how they are restricted.

    If you want to create the analyzer sl1rd then you must run the following commands:
    mkdir sl1rd
    copy the files sl1rd.set and sl1rd.optla into the directory sl1rd
    cd sl1rd
    newanalysis
    make
    sl1rd --output-gdl=sl1rd_result.gdl rdtest1.C (rdtest1.C is some SL1 program in C++ syntax)
    aisee sl1rd_result.gdl & (view example)

  3. Where can I find an example specification for an inter-procedural C++SL2 analysis?

    Here is a documented inter-procedural reaching definitions analysis for C++SL2: sl2rd.set sl2rd.optla.

    The analysis is specified such that it ensures that the input program is indeed a C++SL2 program (a subset of C++). Therefore it also demonstrates what C++ language constructs are in C++SL2 and how we restrict them in this example. It also shows which ICFG nodes are relevant for considering function calls.

  4. Where can I find the program aisee for viewing the gdl files?

    You can find all information on aisee at www.aisee.com. You can download aisee at www.aisee.com/download/

  5. How can I display the result of an analysis?

    The result file has the name <AnalysisName>_result.gdl -- Run aisee with <AnalysisName>_result.gdl as argument

    aisee <AnalysisName>_result.gdl

    or run aisee without argument, activate the menu with the right-mouse button, select menu 'load file', and select the file <AnalysisName>_result.gdl in the dialog.

    If you rerun the analyzer with a different cpp input file, the file <AnalysisName>_result.gdl is overwritten with the new analysis result. You can re-load and display <AnalysisName>_result.gdl by hitting 'g' (you do not need to re-select the file, nor do you need to exit aisee)

    The basic aisee commands are:
    • 'g': reload file
    • 'm': center and scale graph to fit on window
    • '+': zoom in
    • '-': zoom out
    • cursor keys: move up/down/left/right
    • 't': unbox (select a function (a box in the graph) and hit 't' to recompute the graph layout and show call and return edges with its computed values)
  6. How can I conveniently display each analysis step (= each gdl file of the directory anim-out) for debugging my analysis?

    Run the command anim with the directory name as argument:

    anim anim-out

    This will start aisee (must be installed) and in a second window you can select how to browse through all the analysis steps. To turn off the layout-animation hit 'v' (activates menu: view) and move the slider 'Animation Speed after Relayout' such that 'off' appears. This turns off any layout-animation and makes viewing of each step a lot faster.

    <num> <filename>
  7. Which options can I use with a generated analyzer?

    Use the command line option '--help' to get the following description

     Usage: analyzer [OPTION]... <filename1> <filename2> ... 
    
      Frond End options:
       --language=c++|c99|c89   select input language [default=c++]
       --frontend-warnings      show Front End warnings when parsing file(s)
       --no-frontend-warnings   do not show Front End warnings when parsing
                                file(s) [default]
       -I<path>                 specify path for include files
       --input-binary-ast=<FILENAME> read AST from binary file instead of a source file
    
     Analysis options:
       --callstringlength=<num> set callstring length to <num> [default=0]
       --callstringinfinite     select infinite callstring (for non-recursive
                                programs only)
       --cfgordering=<num>      set ordering that is used by the iteration
                                algorithm where
                                      <num> = 1 : dfs preorder [default]
                                              2 : bfs preorder
                                              3 : reversed dfs postorder
                                              4 : bfs postorder
                                              5 : topsort scc dfs preorder
                                              6 : topsort scc bfs preorder
                                              7 : topsort scc reversed bfs
                                                  dfs postorder
                                              8 : topsort scc bfs postorder
       --check-ast              run all ROSE tests for checking
                                whether ROSE-AST is correct
       --no-check-ast           do not run ROSE AST tests
       --analysis-files=all|cl  analyse all source files or only those
                                specified on the command line (cl)
       --analysis-annotation    annotate analysis results in AST and output
       --no-analysis-annotation do not annotate analysis results in AST
       --number-expressions     number expressions and types in the ICFG
       --no-number-expressions  do not number expressions and types in the ICFG
       --pag-memsize-mb=<num>   allocate <num> MB of memory for PAG analysis
       --pag-memsize-perc=<num> allocate <num>% of system memory (autodetected)
       --pag-memsize-grow=<num> grow memory if less than <num>% are free after GC
       --run-pointsto-analysis  run a points-to analysis on the ICFG
       --resolve-funcptr-calls  resolve indirect calls using pointer analysis
    
    
     Output options:
       --statistics             output analyzer statistics on stdout
       --no-statistics          do not show analyzer statistics on stdout
       --verbose                output analyzer info on stdout
       --no-verbose             do not print analyzer info on stdout
       --output-text            print analysis results for each statement
       --output-collectedfuncs  print all functions that are collected for
                                the icfg generation
       --output-source=<FILENAME> generate source file with annotated 
                                analysis results for each statement
       --output-term=<FILENAME> generate Prolog term representation of input
                                program AST
       --output-icfg=<FILENAME> output icfg of input program
       --output-binary-ast=<FILENAME> write AST to binary file
       --help                   print this help message on stdout
       --help-rose              print the ROSE help message on stdout
    
     Multiple input/output files options:
       --output-sourceprefix=<PREFIX> generate for each input file one output file
                                with prefixed name
    
     GDL output options:
       --gdl-preinfo            output analysis info before cfg nodes
       --no-gdl-preinfo         do not output analysis info before cfg nodes
       --gdl-postinfo           output analysis info after cfg nodes
       --no-gdl-postinfo        do not output analysis info after cfg nodes
       --gdl-nodeformat=FORMAT  where FORMAT=varid|varname|exprid|exprsource
                                            |asttext|no-varid|no-varname
                                            |no-exprid|no-exprsource|no-asttext
                                the format can be specified multiple times to
                                have different formats printed at the same node
                                The output is only affected if VariableId
                                and/or ExpressionId is used in the carrier type
       --output-gdl=<FILENAME>  output program as gdl graph
       --output-gdlanim=<DIRNAME> output animation gdl files in 
                                directory <dirname>
    
     Default options:           --language=c++ --no-gdl-preinfo --gdl-postinfo
                                --callstringlength=0 --cfg-ordering=1
                                --no-check-ast --no-check-icfg
                                --number-expressions --pag-memsize-mb=5
                                --pag-memsize-grow=30 --no-statistics
                                --analysis-files=all --analyis-annotation
                                --verbose --gdl-nodeformat=no-asttext
                                --gdl-nodeformat=no-varid --gdl-nodeformat=varname
                                --gdl-nodeformat=no-exprid
                                --gdl-nodeformat=exprsource
    

  8. How can I access elementary block labels in an analysis specification?

    In the TRANSFER section you can access the label of the respective cfg-node by using the variable label. If you want to use a label in a support function you must pass the label as an argument from the transfer function to the support function.

  9. Using program variables and constants in an analysis

    • How can I use the name of a program variable in an analysis?

      If VarRefExp(var) is matched then var can be converted to a value of type str with val-aststring(var).

      If VariableSymbol(var) is matched then var can be converted to a value of type str with val-aststring(var).

    • How can I use the value of an integer constant in an analysis?

          If "IntVal(value)" is matched then "value" can be converted to a value     of type "snum" with "val-astint(value)". Similar functions exist for the     other types of integer and floating point constants. The names of the     corresponding AST data types are given in the syn file.

  10. How can I access all the expressions of a program in an analysis?

    In the TRANSFER section match with:

    ExprStatement(exp), _:

    Each expression (not subexpression!) is bound to exp and can be matched with other patterns.
    There exists one exception: Expressions in boolean expressions where temporary variables were introduced for dealing with short-circuit evaluation must be matched with LogicalIf(exp).

  11. Which integrated auxiliary functions are available in a PAG specification?

    DeclarationDescription
    varsym_varid :: VariableSymbolNT -> VariableId; maps a variable symbol to its VariableId
    varref_varid :: Expression -> VariableId; maps a VarRefExp to its VariableId; it is an error to call this with any other subtype of Expression!
    expr_exprid :: Expression -> ExpressionId; maps the expression to its ExpressionId
    exprid_expr :: ExpressionId -> Expression; maps the expression identifier to the actual expression it represents
    is_tmpvarid :: VariableId -> bool; determines whether the variable identifier refers to a temporary variable introduced by SATIrE (for logical values, function return values, etc.)
    varid_str :: VariableId -> str; gives the name of the variable with the given identifier
    exprid_str :: ExpressionId -> str; gives the string representation of the expression with the given identifier
    varid_exprid :: VariableId -> ExpressionId; maps a variable identifier to an expression identifier which denotes a VarRefExp for that variable
    type_typeid :: Type -> TypeId; convert a type to its corresponding TypeId
    typeid_type :: TypeId -> Type; convert a type identifier to the actual type it represents
    typeid_str :: TypeId -> str; convert a type identifier to a string representation of the type
    exprid_typeid :: ExpressionId -> TypeId; get the type identifier for a given expression identifier
    add_tmpvarid :: TypeId -> VariableId; creates a new, unique temporary variable of the given type; this function returns different values for each call
    stmt_asttext :: Statement -> str; returns a string representing the structure of the given statement in a format very similar to PAG's pattern syntax
    expr_asttext :: Expression -> str; returns a string representing the structure of the given expression in a format very similar to PAG's pattern syntax
    varid_has_location :: VariableId -> bool;determines whether a variable has a corresponding abstract memory location
    varid_location :: VariableId -> Location; determine the abstract memory location corresponding to a variable; program variables have locations, SATIrE's temporary variables do not
    exprid_has_location :: ExpressionId -> bool;determine whether the expression allows to access an abstract memory location
    exprid_location :: ExpressionId -> Location; determine the abstract memory location corresponding to an expression, this can be a simple variable reference, but also a pointer dereference or other more complex expression; expressions that denote one of SATIrE's temporary variables, or expressions that do not denote an object in memory (an "lvalue") do not have locations
    location_varsyms :: Location -> *VariableSymbolNT; returns the list of program variables stored in the given location
    may_be_aliased :: Location -> bool; determines whether the given location may be "aliased", i.e., whether some other location may hold a pointer to it
    is_ptr_location :: Location -> bool; determines whether the given location contains a pointer to some other location
    dereference :: Location -> Location; returns the pointed-to location of a given location that holds a pointer

    SATIrE provides declarations and definitions for these functions.

  12. How can I set the call string length for inter-procedural analysis?

    Use the command line option '--callstringlength <num>' with your generated analyzer to set the call string to an arbitrary length <num>. Alternatively you can also set the callstring length to infinite with '--callstringinfinite' for non-recursive programs.

  13. Why do I get a parse error in file analysis.set although no such file exists in my analysis directory?

    If PAG reports a parse error in file analysis.set it means that your *.set file has a parsing error. It does not report the correct file name.

  14. How can I display the abstract syntax tree (ROSE-AST) for a given C++ program?

    Use the tool cpp2dot for generating a dot-file which contains a description of the ROSE-AST. Use the tool dotty for displaying the dot-file (=the AST). You can also use cpp2ps for generating a postscript file, or cpp2pdf for generating a pdf file (the thumbnails show the AST structure, each page the information of the AST node)

    Example: cpp2dot test1.C test1.dot; dotty test1.dot

    Example: cpp2ps test1.C test1.ps; gv test1.ps

    Example: cpp2pdf test1.C test1.pdf; xpdf test1.pdf

Complang
SATIrE
   FAQ
Sitemap
Other Infos
FAQ
Fakultät für Informatik
Technische Universität Wien
Anfang | HTML 4.01 | letzte Änderung: 2008-12-01 (Schordan)