Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Classes | Functions | Variables
miasm2.jitter.jitload Namespace Reference

Classes

class  CallbackHandler
 
class  CallbackHandlerBitflag
 
class  ExceptionHandle
 
class  jitter
 

Functions

def named_arguments
 

Variables

tuple hnd = logging.StreamHandler()
 
tuple log = logging.getLogger('jitload.py')
 
tuple log_func = logging.getLogger('jit function call')
 

Function Documentation

def miasm2.jitter.jitload.named_arguments (   func)
Function decorator to allow the use of .func_args_*() methods
with either the number of arguments or the list of the argument
names.

The wrapper is also used to log the argument values.

@func: function

Definition at line 42 of file jitload.py.

42 
43 def named_arguments(func):
44  """Function decorator to allow the use of .func_args_*() methods
45  with either the number of arguments or the list of the argument
46  names.
47 
48  The wrapper is also used to log the argument values.
49 
50  @func: function
51 
52  """
53  @wraps(func)
54  def newfunc(self, args):
55  if isinstance(args, Sequence):
56  ret_ad, arg_vals = func(self, len(args))
57  arg_vals = namedtuple("args", args)(*arg_vals)
58  # func_name(arguments) return address
59  log_func.info('%s(%s) ret addr: %s',
60  whoami(),
61  ', '.join("%s=0x%x" % (field, value)
62  for field, value in arg_vals._asdict().iteritems()),
63  hex(ret_ad))
64  return ret_ad, namedtuple("args", args)(*arg_vals)
65  else:
66  ret_ad, arg_vals = func(self, args)
67  # func_name(arguments) return address
68  log_func.info('%s(%s) ret addr: %s',
69  whoami(),
70  ', '.join(hex(arg) for arg in arg_vals),
71  hex(ret_ad))
72  return ret_ad, arg_vals
73  return newfunc
74 

+ Here is the call graph for this function:

Variable Documentation

tuple miasm2.jitter.jitload.hnd = logging.StreamHandler()

Definition at line 12 of file jitload.py.

tuple miasm2.jitter.jitload.log = logging.getLogger('jitload.py')

Definition at line 14 of file jitload.py.

tuple miasm2.jitter.jitload.log_func = logging.getLogger('jit function call')

Definition at line 17 of file jitload.py.