diff options
Diffstat (limited to 'miasm2/core')
| -rw-r--r-- | miasm2/core/asmblock.py | 14 | ||||
| -rw-r--r-- | miasm2/core/cpu.py | 4 | ||||
| -rw-r--r-- | miasm2/core/ctypesmngr.py | 6 | ||||
| -rw-r--r-- | miasm2/core/graph.py | 12 | ||||
| -rw-r--r-- | miasm2/core/locationdb.py | 6 | ||||
| -rw-r--r-- | miasm2/core/objc.py | 34 | ||||
| -rw-r--r-- | miasm2/core/sembuilder.py | 2 | ||||
| -rw-r--r-- | miasm2/core/types.py | 20 |
8 files changed, 49 insertions, 49 deletions
diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py index 34f11474..f6e68a0e 100644 --- a/miasm2/core/asmblock.py +++ b/miasm2/core/asmblock.py @@ -313,8 +313,8 @@ class AsmBlockBad(AsmBlock): } def __init__(self, loc_key=None, alignment=1, errno=ERROR_UNKNOWN, *args, **kwargs): - """Instanciate an AsmBlock_bad. - @loc_key, @alignement: same as AsmBlock.__init__ + """Instantiate an AsmBlock_bad. + @loc_key, @alignment: same as AsmBlock.__init__ @errno: (optional) specify a error type associated with the block """ super(AsmBlockBad, self).__init__(loc_key, alignment, *args, **kwargs) @@ -334,7 +334,7 @@ class AsmBlockBad(AsmBlock): raise RuntimeError("An AsmBlockBad cannot have bto") def split(self, *args, **kwargs): - raise RuntimeError("An AsmBlockBad cannot be splitted") + raise RuntimeError("An AsmBlockBad cannot be split") class asm_block_bad(AsmBlockBad): @@ -486,7 +486,7 @@ class AsmCFG(DiGraph): Edges will be created for @block.bto, if destinations are already in this instance. If not, they will be resolved when adding these - aforementionned destinations. + aforementioned destinations. `self.pendings` indicates which blocks are not yet resolved. """ @@ -795,7 +795,7 @@ class AsmCFG(DiGraph): if not (off > range_start and off < range_stop): continue - # `cur_block` must be splitted at offset `off`from miasm2.core.locationdb import LocationDB + # `cur_block` must be split at offset `off`from miasm2.core.locationdb import LocationDB new_b = cur_block.split(loc_db, off) log_asmblock.debug("Split block %x", off) @@ -1253,7 +1253,7 @@ def asmblock_final(mnemo, asmcfg, blockChains, loc_db, conservative=False): chain.fix_blocks(modified_loc_keys) for loc_key in modified_loc_keys: - # Retrive block with modified reference + # Retrieve block with modified reference mod_block = asmcfg.loc_key_to_block(loc_key) if mod_block is not None: blocks_to_rework.add(mod_block) @@ -1343,7 +1343,7 @@ class disasmEngine(object): """ def __init__(self, arch, attrib, bin_stream, **kwargs): - """Instanciate a new disassembly engine + """Instantiate a new disassembly engine @arch: targeted architecture @attrib: architecture attribute @bin_stream: bytes source diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py index 813ac47d..c2fbd3cd 100644 --- a/miasm2/core/cpu.py +++ b/miasm2/core/cpu.py @@ -44,7 +44,7 @@ class bitobj: if not n: return 0 if n > len(self.bits) - self.offset: - raise ValueError('not enought bits %r %r' % (n, len(self.bits))) + raise ValueError('not enough bits %r %r' % (n, len(self.bits))) b = self.bits[self.offset:self.offset + n] b = int("".join([str(x) for x in b]), 2) self.offset += n @@ -1063,7 +1063,7 @@ class cls_mn(object): __metaclass__ = metamn args_symb = [] instruction = instruction - # Block's offset alignement + # Block's offset alignment alignment = 1 @classmethod diff --git a/miasm2/core/ctypesmngr.py b/miasm2/core/ctypesmngr.py index 5daf8950..7dafd7e1 100644 --- a/miasm2/core/ctypesmngr.py +++ b/miasm2/core/ctypesmngr.py @@ -61,7 +61,7 @@ class CTypeId(CTypeBase): def __init__(self, *names): # Type specifier order does not matter - # so the cannonical form is ordered + # so the canonical form is ordered self.names = tuple(sorted(names)) super(CTypeId, self).__init__() @@ -372,7 +372,7 @@ class CAstTypes(object): } def gen_uniq_name(self): - """Generate uniq name for unamed strucs/union""" + """Generate uniq name for unnamed strucs/union""" cpt = self.cpt self.cpt += 1 return self.INTERNAL_PREFIX + "%d" % cpt @@ -554,7 +554,7 @@ class CAstTypes(object): elif isinstance(ast, c_ast.Constant): result = int(ast.value, 0) elif isinstance(ast, c_ast.Cast): - # TODO: Can trunc intergers? + # TODO: Can trunc integers? result = self.ast_eval_int(ast.expr) else: raise NotImplementedError("Not implemented!") diff --git a/miasm2/core/graph.py b/miasm2/core/graph.py index 35bcf01d..f61d1e67 100644 --- a/miasm2/core/graph.py +++ b/miasm2/core/graph.py @@ -301,8 +301,8 @@ class DiGraph(object): of the graph. @head: the head/leaf of the graph @reachable_cb: sons/parents of the head/leaf - @prev_cb: return predecessors/succesors of a node - @next_cb: return succesors/predecessors of a node + @prev_cb: return predecessors/successors of a node + @next_cb: return successors/predecessors of a node """ nodes = set(reachable_cb(head)) @@ -382,7 +382,7 @@ class DiGraph(object): @node: The start node @gen_dominators: The dictionary containing at least node's dominators/post_dominators - @succ_cb: return predecessors/succesors of a node + @succ_cb: return predecessors/successors of a node """ # Init @@ -756,7 +756,7 @@ class MatchGraphJoker(object): def __init__(self, restrict_in=True, restrict_out=True, filt=None, name=None): - """Instanciate a MatchGraphJoker, with restrictions + """Instantiate a MatchGraphJoker, with restrictions @restrict_in: (optional) if set, the number of predecessors of the matched node must be the same than the joker node in the associated MatchGraph @@ -809,7 +809,7 @@ class MatchGraph(DiGraph): restrictions. The implemented algorithm is a naive approach. - The recommended way to instanciate a MatchGraph is the use of + The recommended way to instantiate a MatchGraph is the use of MatchGraphJoker. """ @@ -937,7 +937,7 @@ class MatchGraph(DiGraph): # Partial solution: nodes corrects, edges between these nodes corrects # A partial solution is a dictionary MatchGraphJoker -> @graph's node todo = list() # Dictionnaries containing partial solution - done = list() # Aleady computed partial solutions + done = list() # Already computed partial solutions # Elect first candidates to_match = next(iter(self._nodes)) diff --git a/miasm2/core/locationdb.py b/miasm2/core/locationdb.py index 7d84c491..b6e60794 100644 --- a/miasm2/core/locationdb.py +++ b/miasm2/core/locationdb.py @@ -13,7 +13,7 @@ class LocationDB(object): LocationDB is a "database" of information associated to location. An entry in a LocationDB is uniquely identified with a LocKey. - Additionnal information which can be associated with a LocKey are: + Additional information which can be associated with a LocKey are: - an offset (uniq per LocationDB) - several names (each are uniqs per LocationDB) @@ -22,7 +22,7 @@ class LocationDB(object): 1 <-> 0..n name >>> loc_db = LocationDB() - # Add a location with no additionnal information + # Add a location with no additional information >>> loc_key1 = loc_db.add_location() # Add a location with an offset >>> loc_key2 = loc_db.add_location(offset=0x1234) @@ -221,7 +221,7 @@ class LocationDB(object): if is_int(name): assert offset is None or offset == name warnings.warn("Deprecated API: use 'add_location(offset=)' instead." - " An additionnal 'name=' can be provided to also " + " An additional 'name=' can be provided to also " "associate a name (there is no more default name)") offset = name name = None diff --git a/miasm2/core/objc.py b/miasm2/core/objc.py index 0e5e8cf4..64a935a7 100644 --- a/miasm2/core/objc.py +++ b/miasm2/core/objc.py @@ -716,7 +716,7 @@ def ast_get_c_access_expr(ast, expr_types, lvl=0): """Transform C ast object into a C Miasm expression @ast: parsed pycparser.c_ast object - @expr_types: a dictionnary linking ID names to their types + @expr_types: a dictionary linking ID names to their types @lvl: actual recursion level Example: @@ -796,7 +796,7 @@ class ExprToAccessC(ExprReducer): def __init__(self, expr_types, types_mngr, enforce_strict_access=True): """Init GenCAccess - @expr_types: a dictionnary linking ID names to their types + @expr_types: a dictionary linking ID names to their types @types_mngr: types manager @enforce_strict_access: If false, generate access even on expression pointing to a middle of an object. If true, raise exception if such a @@ -809,7 +809,7 @@ class ExprToAccessC(ExprReducer): def updt_expr_types(self, expr_types): """Update expr_types - @expr_types: Dictionnary associating name to type + @expr_types: Dictionary associating name to type """ self.expr_types = expr_types @@ -969,7 +969,7 @@ class ExprToAccessC(ExprReducer): def get_solo_type(self, node): """Return the type of the @node if it has only one possible type, - different from not None. In othe cases, return None. + different from not None. In other cases, return None. """ if node.info is None or len(node.info) != 1: return None @@ -1060,7 +1060,7 @@ class ExprToAccessC(ExprReducer): def get_accesses(self, expr, expr_context=None): """Generate C access(es) for the native Miasm expression @expr @expr: native Miasm expression - @expr_context: a dictionnary linking known expressions to their + @expr_context: a dictionary linking known expressions to their types. An expression is linked to a tuple of types. """ if expr_context is None: @@ -1115,7 +1115,7 @@ class ExprCToExpr(ExprReducer): def __init__(self, expr_types, types_mngr): """Init ExprCAccess - @expr_types: a dictionnary linking ID names to their types + @expr_types: a dictionary linking ID names to their types @types_mngr: types manager """ @@ -1124,7 +1124,7 @@ class ExprCToExpr(ExprReducer): def updt_expr_types(self, expr_types): """Update expr_types - @expr_types: Dictionnary associating name to type + @expr_types: Dictionary associating name to type """ self.expr_types = expr_types @@ -1330,7 +1330,7 @@ class ExprCToExpr(ExprReducer): """Translate a Miasm expression @expr (representing a C access) into a tuple composed of a native Miasm expression and its C type. @expr: Miasm expression (representing a C access) - @c_context: a dictionnary linking known tokens (strings) to their + @c_context: a dictionary linking known tokens (strings) to their types. A token is linked to only one type. """ ret = self.reduce(expr, ctxt=c_context) @@ -1597,7 +1597,7 @@ class CHandler(object): def updt_expr_types(self, expr_types): """Update expr_types - @expr_types: Dictionnary associating name to type + @expr_types: Dictionary associating name to type """ self.expr_types = expr_types @@ -1607,7 +1607,7 @@ class CHandler(object): def expr_to_c_access(self, expr, expr_context=None): """Generate the C access object(s) for a given native Miasm expression. @expr: Miasm expression - @expr_context: a dictionnary linking known expressions to a set of types + @expr_context: a dictionary linking known expressions to a set of types """ if expr_context is None: @@ -1618,7 +1618,7 @@ class CHandler(object): def expr_to_c_and_types(self, expr, expr_context=None): """Generate the C access string and corresponding type for a given native Miasm expression. - @expr_context: a dictionnary linking known expressions to a set of types + @expr_context: a dictionary linking known expressions to a set of types """ accesses = set() @@ -1629,7 +1629,7 @@ class CHandler(object): def expr_to_c(self, expr, expr_context=None): """Convert a Miasm @expr into it's C equivalent string - @expr_context: a dictionnary linking known expressions to a set of types + @expr_context: a dictionary linking known expressions to a set of types """ return set(access[0] @@ -1637,7 +1637,7 @@ class CHandler(object): def expr_to_types(self, expr, expr_context=None): """Get the possible types of the Miasm @expr - @expr_context: a dictionnary linking known expressions to a set of types + @expr_context: a dictionary linking known expressions to a set of types """ return set(access.ctype @@ -1647,7 +1647,7 @@ class CHandler(object): """Convert a C string expression to a Miasm expression and it's corresponding c type @c_str: C string - @c_context: a dictionnary linking known tokens (strings) to its type. + @c_context: a dictionary linking known tokens (strings) to its type. """ ast = parse_access(c_str) @@ -1657,7 +1657,7 @@ class CHandler(object): def c_to_expr(self, c_str, c_context): """Convert a C string expression to a Miasm expression @c_str: C string - @c_context: a dictionnary linking known tokens (strings) to its type. + @c_context: a dictionary linking known tokens (strings) to its type. """ expr, _ = self.c_to_expr_and_type(c_str, c_context) @@ -1666,7 +1666,7 @@ class CHandler(object): def c_to_type(self, c_str, c_context): """Get the type of a C string expression @expr: Miasm expression - @c_context: a dictionnary linking known tokens (strings) to its type. + @c_context: a dictionary linking known tokens (strings) to its type. """ _, ctype = self.c_to_expr_and_type(c_str, c_context) @@ -1674,5 +1674,5 @@ class CHandler(object): class CLeafTypes(object): - """Define C types sizes/alignement for a given architecture""" + """Define C types sizes/alignment for a given architecture""" pass diff --git a/miasm2/core/sembuilder.py b/miasm2/core/sembuilder.py index 67c6c257..5694ffa3 100644 --- a/miasm2/core/sembuilder.py +++ b/miasm2/core/sembuilder.py @@ -116,7 +116,7 @@ class SemBuilder(object): This class provides a decorator @parse to use on them. The context in which the function will be parsed must be supplied on - instanciation + instantiation """ def __init__(self, ctx): diff --git a/miasm2/core/types.py b/miasm2/core/types.py index a60077ac..5d9a8d27 100644 --- a/miasm2/core/types.py +++ b/miasm2/core/types.py @@ -91,7 +91,7 @@ And access the fields: MemUnion and MemBitField can also be subclassed, the `fields` field being in the format expected by, respectively, Union and BitField. -The `addr` argument can be omited if an allocator is set, in which case the +The `addr` argument can be omitted if an allocator is set, in which case the structure will be automatically allocated in memory: my_heap = miasm2.os_dep.common.heap() @@ -277,7 +277,7 @@ class Type(object): """Set a VmMngr memory from a value. @vm: VmMngr instance - @addr: the start adress in memory to set + @addr: the start address in memory to set @val: the python value to serialize in @vm at @addr """ raw = self._pack(val) @@ -293,7 +293,7 @@ class Type(object): """Returns a class with a (vm, addr) constructor that allows to interact with this type in memory. - In compilation terms, it returns a class allowing to instanciate an + In compilation terms, it returns a class allowing to instantiate an lvalue of this type. @return: a MemType subclass. @@ -305,7 +305,7 @@ class Type(object): return pinned_type def _build_pinned_type(self): - """Builds the MemType subclass allowing to interract with this type. + """Builds the MemType subclass allowing to interact with this type. Called by self.lval when it is not in cache. """ @@ -419,7 +419,7 @@ class Ptr(Num): If a Type is given, it is transformed into a MemType with TheType.lval. *type_args, **type_kwargs: arguments to pass to the the pointed - MemType when instanciating it (e.g. for MemStr encoding or + MemType when instantiating it (e.g. for MemStr encoding or MemArray field_type). """ if (not isinstance(dst_type, Type) and @@ -490,7 +490,7 @@ class Ptr(Num): """ # Sanity check if self.dst_type != val.get_type(): - log.warning("Original type was %s, overriden by value of type %s", + log.warning("Original type was %s, overridden by value of type %s", self._dst_type.__name__, val.__class__.__name__) # Actual job @@ -980,7 +980,7 @@ class BitField(Union): """ def __init__(self, backing_num, bit_list): - """@backing num: Num intance, @bit_list: [(name, n_bits)]""" + """@backing num: Num instance, @bit_list: [(name, n_bits)]""" self._num = backing_num fields = [] offset = 0 @@ -1161,7 +1161,7 @@ class Self(Void): def _build_pinned_type(self): return MemSelf -# To avoid reinstanciation when testing equality +# To avoid reinstantiation when testing equality SELF_TYPE_INSTANCE = Self() VOID_TYPE_INSTANCE = Void() @@ -1232,7 +1232,7 @@ class MemType(object): @classmethod def set_allocator(cls, alloc_func): - """Set an allocator for this class; allows to instanciate statically + """Set an allocator for this class; allows to instantiate statically sized MemTypes (i.e. sizeof() is implemented) without specifying the address (the object is allocated by @alloc_func in the vm). @@ -1357,7 +1357,7 @@ class MemStruct(MemType): The mechanism is the following: - set a "fields" class field to be a list of (<field_name (str)>, <Type_subclass_instance>) - - instances of this class will have properties to interract with these + - instances of this class will have properties to interact with these fields. Example: |