package mopsa

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Lang.Addr

Heap addresses of Python objects.

val debug : ('a, Format.formatter, unit, unit) format4 -> 'a

Addresses

type class_address =
  1. | C_builtin of string
  2. | C_user of Python.Lang.Ast.py_clsdec
  3. | C_unsupported of string
    (*

    unsupported class

    *)
  4. | C_annot of Python.Lang.Ast.py_cls_annot
    (*

    class annotations

    *)

Classes

type function_address =
  1. | F_builtin of string * string
  2. | F_user of Python.Lang.Ast.py_fundec
  3. | F_unsupported of string
    (*

    unsupported function

    *)
  4. | F_annot of Python.Lang.Ast.py_func_annot

Functions

type module_address =
  1. | M_user of string * MopsaLib.var list
    (*

    globals

    *)
  2. | M_builtin of string
    (*

    name

    *)
type MopsaLib.addr_kind +=
  1. | A_py_class of class_address * Python.Lang.Ast.py_object list
    (*

    mro

    *)
  2. | A_py_function of function_address
    (*

    function

    *)
  3. | A_py_method of Python.Lang.Ast.py_object * Python.Lang.Ast.py_object * string
  4. | A_py_module of module_address

These addresses refer only to static objects

Allocate an object on the heap and return its address as an evaluation

Built-ins

val classes : (string, Python.Lang.Ast.py_object) Hashtbl.t

Lists of built-ins

val functions : (string, Python.Lang.Ast.py_object) Hashtbl.t
val modules : (string, Python.Lang.Ast.py_object) Hashtbl.t
val type_aliases : (MopsaLib.var, MopsaLib.expr) Hashtbl.t
val typed_functions : (string, Python.Lang.Ast.py_object) Hashtbl.t
val mk_dot_name : string option -> string -> string

Name of a builtin with an optional dot notation in case of sub-objects (methods of classes, etc.)

val split_dot_name : string -> (string * string) option

Return the base and the attribute of a dot name

Address of an object

val oobject_name : Python.Lang.Ast.py_object -> string option

Name of an object

val object_name : Python.Lang.Ast.py_object -> string
val add_type_alias : MopsaLib.var -> MopsaLib.expr -> unit
val find_type_alias_by_name : string -> MopsaLib.expr
val add_builtin_class : Python.Lang.Ast.py_object -> unit -> unit
val print_classes : Format.formatter -> 'a -> unit
val print_functions : Format.formatter -> 'a -> unit
val add_builtin_function : Python.Lang.Ast.py_object -> unit -> unit
val add_typed : Python.Lang.Ast.py_object -> unit
val add_typed_overload : Python.Lang.Ast.py_object -> unit
val add_builtin_module : Python.Lang.Ast.py_object -> unit -> unit
val find_builtin : string -> Python.Lang.Ast.py_object

Search for the address of a builtin given its name

val find_builtin_function : string -> Python.Lang.Ast.py_object
val is_object_unsupported : Python.Lang.Ast.py_object -> bool
val is_builtin_name : string -> bool

Check whether a built-in exists given its name

val is_builtin_var : MopsaLib.var -> bool
val is_builtin_module : string -> bool
val find_builtin_module : string -> Python.Lang.Ast.py_object
val is_builtin_attribute : Python.Lang.Ast.py_object -> string -> bool

Check whether an attribute of a built-in object exists, given its name

val find_builtin_attribute : Python.Lang.Ast.py_object -> string -> Python.Lang.Ast.py_object

Search for the address of a builtin attribute

val is_builtin_class_function : string -> string -> bool

Check whether a dot-named function f is a member of the class cls

Utility functions

val mk_py_z_interval : Z.t -> Z.t -> Mopsa_utils.Core.Location.range -> MopsaLib.expr
val mk_py_float_interval : float -> float -> Mopsa_utils.Core.Location.range -> MopsaLib.expr
val mk_py_issubclass_builtin_r : MopsaLib.expr -> string -> Mopsa_utils.Core.Location.range -> MopsaLib.expr
val mk_py_issubclass_builtin_l : string -> MopsaLib.expr -> Mopsa_utils.Core.Location.range -> MopsaLib.expr
val mk_py_issubclass_builtin2 : string -> string -> Mopsa_utils.Core.Location.range -> MopsaLib.expr
val mk_py_hasattr : MopsaLib.expr -> string -> Mopsa_utils.Core.Location.range -> MopsaLib.expr
val mk_py_isinstance_builtin : MopsaLib.expr -> string -> Mopsa_utils.Core.Location.range -> MopsaLib.expr
type py_c_function_kind =
  1. | Builtin_function_or_method
  2. | Wrapper_descriptor of string option
  3. | Method_descriptor
val str_of_py_c_function_kind : py_c_function_kind -> string
type MopsaLib.addr_kind +=
  1. | A_py_c_module of string
    (*

    name

    *)
  2. | A_py_c_function of string * int * py_c_function_kind * int option * Python.Lang.Ast.py_object
    (*

    self

    *)
  3. | A_py_c_class of string
    (*

    name

    *)
exception C3_lin_failure

Computes the c3 linearization of an object. This is Python's approach to deal with redundant parents in the inheritance

val search_c : Python.Lang.Ast.py_object list list -> Python.Lang.Ast.py_object option
val create_builtin_class : class_address -> 'a -> 'b -> Python.Lang.Ast.py_object list -> 'c -> unit
val builtin_cl_and_mro : string -> class_address * Python.Lang.Ast.py_object list
type MopsaLib.addr_kind +=
  1. | A_py_instance of MopsaLib.addr
val nominal_type_of_addr_kind : (MopsaLib.addr_kind -> string) ref
val structural_type_of_addr_kind : (MopsaLib.addr_kind -> string -> bool) ref
val register_addr_kind_nominal_type : ((MopsaLib.addr_kind -> string) -> MopsaLib.addr_kind -> string) -> unit
val register_addr_kind_structural_type : ((MopsaLib.addr_kind -> string -> bool) -> MopsaLib.addr_kind -> string -> bool) -> unit
val addr_kind_find_nominal_type : MopsaLib.addr_kind -> string
val addr_kind_find_structural_type : MopsaLib.addr_kind -> string -> bool
OCaml

Innovation. Community. Security.