repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
angr/angr | angr/sim_state_options.py | SimStateOptions.tally | def tally(self, exclude_false=True, description=False):
"""
Return a string representation of all state options.
:param bool exclude_false: Whether to exclude Boolean switches that are disabled.
:param bool description: Whether to display the description of each option.
:ret... | python | def tally(self, exclude_false=True, description=False):
"""
Return a string representation of all state options.
:param bool exclude_false: Whether to exclude Boolean switches that are disabled.
:param bool description: Whether to display the description of each option.
:ret... | [
"def",
"tally",
"(",
"self",
",",
"exclude_false",
"=",
"True",
",",
"description",
"=",
"False",
")",
":",
"total",
"=",
"[",
"]",
"for",
"o",
"in",
"sorted",
"(",
"self",
".",
"OPTIONS",
".",
"values",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
... | Return a string representation of all state options.
:param bool exclude_false: Whether to exclude Boolean switches that are disabled.
:param bool description: Whether to display the description of each option.
:return: A string representation.
:rtype: ... | [
"Return",
"a",
"string",
"representation",
"of",
"all",
"state",
"options",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_state_options.py#L341-L369 | train |
angr/angr | angr/sim_state_options.py | SimStateOptions.register_option | def register_option(cls, name, types, default=None, description=None):
"""
Register a state option.
:param str name: Name of the state option.
:param types: A collection of allowed types of this state option.
:param default: The default value of this sta... | python | def register_option(cls, name, types, default=None, description=None):
"""
Register a state option.
:param str name: Name of the state option.
:param types: A collection of allowed types of this state option.
:param default: The default value of this sta... | [
"def",
"register_option",
"(",
"cls",
",",
"name",
",",
"types",
",",
"default",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"if",
"name",
"in",
"cls",
".",
"OPTIONS",
":",
"raise",
"SimStateOptionsError",
"(",
"\"A state option with the same name ... | Register a state option.
:param str name: Name of the state option.
:param types: A collection of allowed types of this state option.
:param default: The default value of this state option.
:param str description: The description of this state option.
:r... | [
"Register",
"a",
"state",
"option",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_state_options.py#L372-L390 | train |
angr/angr | angr/sim_state_options.py | SimStateOptions.register_bool_option | def register_bool_option(cls, name, description=None):
"""
Register a Boolean switch as state option.
This is equivalent to cls.register_option(name, set([bool]), description=description)
:param str name: Name of the state option.
:param str description: The description o... | python | def register_bool_option(cls, name, description=None):
"""
Register a Boolean switch as state option.
This is equivalent to cls.register_option(name, set([bool]), description=description)
:param str name: Name of the state option.
:param str description: The description o... | [
"def",
"register_bool_option",
"(",
"cls",
",",
"name",
",",
"description",
"=",
"None",
")",
":",
"cls",
".",
"register_option",
"(",
"name",
",",
"{",
"bool",
"}",
",",
"default",
"=",
"False",
",",
"description",
"=",
"description",
")"
] | Register a Boolean switch as state option.
This is equivalent to cls.register_option(name, set([bool]), description=description)
:param str name: Name of the state option.
:param str description: The description of this state option.
:return: None | [
"Register",
"a",
"Boolean",
"switch",
"as",
"state",
"option",
".",
"This",
"is",
"equivalent",
"to",
"cls",
".",
"register_option",
"(",
"name",
"set",
"(",
"[",
"bool",
"]",
")",
"description",
"=",
"description",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_state_options.py#L393-L403 | train |
angr/angr | angr/state_plugins/heap/utils.py | concretize | def concretize(x, solver, sym_handler):
"""
For now a lot of naive concretization is done when handling heap metadata to keep things manageable. This idiom
showed up a lot as a result, so to reduce code repetition this function uses a callback to handle the one or two
operations that varied across invoc... | python | def concretize(x, solver, sym_handler):
"""
For now a lot of naive concretization is done when handling heap metadata to keep things manageable. This idiom
showed up a lot as a result, so to reduce code repetition this function uses a callback to handle the one or two
operations that varied across invoc... | [
"def",
"concretize",
"(",
"x",
",",
"solver",
",",
"sym_handler",
")",
":",
"if",
"solver",
".",
"symbolic",
"(",
"x",
")",
":",
"try",
":",
"return",
"solver",
".",
"eval_one",
"(",
"x",
")",
"except",
"SimSolverError",
":",
"return",
"sym_handler",
"... | For now a lot of naive concretization is done when handling heap metadata to keep things manageable. This idiom
showed up a lot as a result, so to reduce code repetition this function uses a callback to handle the one or two
operations that varied across invocations.
:param x: the item to be concretized
... | [
"For",
"now",
"a",
"lot",
"of",
"naive",
"concretization",
"is",
"done",
"when",
"handling",
"heap",
"metadata",
"to",
"keep",
"things",
"manageable",
".",
"This",
"idiom",
"showed",
"up",
"a",
"lot",
"as",
"a",
"result",
"so",
"to",
"reduce",
"code",
"r... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/utils.py#L3-L20 | train |
angr/angr | angr/sim_procedure.py | SimProcedure._describe_me | def _describe_me(self):
"""
return a 5-tuple of strings sufficient for formatting with ``%s%s%s%s%s`` to verbosely describe the procedure
"""
return (
self.display_name,
' (cont: %s)' % self.run_func if self.is_continuation else '',
' (syscall)' if sel... | python | def _describe_me(self):
"""
return a 5-tuple of strings sufficient for formatting with ``%s%s%s%s%s`` to verbosely describe the procedure
"""
return (
self.display_name,
' (cont: %s)' % self.run_func if self.is_continuation else '',
' (syscall)' if sel... | [
"def",
"_describe_me",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"display_name",
",",
"' (cont: %s)'",
"%",
"self",
".",
"run_func",
"if",
"self",
".",
"is_continuation",
"else",
"''",
",",
"' (syscall)'",
"if",
"self",
".",
"is_syscall",
"else",
... | return a 5-tuple of strings sufficient for formatting with ``%s%s%s%s%s`` to verbosely describe the procedure | [
"return",
"a",
"5",
"-",
"tuple",
"of",
"strings",
"sufficient",
"for",
"formatting",
"with",
"%s%s%s%s%s",
"to",
"verbosely",
"describe",
"the",
"procedure"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L90-L100 | train |
angr/angr | angr/sim_procedure.py | SimProcedure.execute | def execute(self, state, successors=None, arguments=None, ret_to=None):
"""
Call this method with a SimState and a SimSuccessors to execute the procedure.
Alternately, successors may be none if this is an inline call. In that case, you should
provide arguments to the function.
"... | python | def execute(self, state, successors=None, arguments=None, ret_to=None):
"""
Call this method with a SimState and a SimSuccessors to execute the procedure.
Alternately, successors may be none if this is an inline call. In that case, you should
provide arguments to the function.
"... | [
"def",
"execute",
"(",
"self",
",",
"state",
",",
"successors",
"=",
"None",
",",
"arguments",
"=",
"None",
",",
"ret_to",
"=",
"None",
")",
":",
"# fill out all the fun stuff we don't want to frontload",
"if",
"self",
".",
"addr",
"is",
"None",
"and",
"not",
... | Call this method with a SimState and a SimSuccessors to execute the procedure.
Alternately, successors may be none if this is an inline call. In that case, you should
provide arguments to the function. | [
"Call",
"this",
"method",
"with",
"a",
"SimState",
"and",
"a",
"SimSuccessors",
"to",
"execute",
"the",
"procedure",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L102-L187 | train |
angr/angr | angr/sim_procedure.py | SimProcedure.arg | def arg(self, i):
"""
Returns the ith argument. Raise a SimProcedureArgumentError if we don't have such an argument available.
:param int i: The index of the argument to get
:return: The argument
:rtype: object
"""
if self.use_state_arguments:
r = sel... | python | def arg(self, i):
"""
Returns the ith argument. Raise a SimProcedureArgumentError if we don't have such an argument available.
:param int i: The index of the argument to get
:return: The argument
:rtype: object
"""
if self.use_state_arguments:
r = sel... | [
"def",
"arg",
"(",
"self",
",",
"i",
")",
":",
"if",
"self",
".",
"use_state_arguments",
":",
"r",
"=",
"self",
".",
"cc",
".",
"arg",
"(",
"self",
".",
"state",
",",
"i",
")",
"else",
":",
"if",
"i",
">=",
"len",
"(",
"self",
".",
"arguments",... | Returns the ith argument. Raise a SimProcedureArgumentError if we don't have such an argument available.
:param int i: The index of the argument to get
:return: The argument
:rtype: object | [
"Returns",
"the",
"ith",
"argument",
".",
"Raise",
"a",
"SimProcedureArgumentError",
"if",
"we",
"don",
"t",
"have",
"such",
"an",
"argument",
"available",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L262-L278 | train |
angr/angr | angr/sim_procedure.py | SimProcedure.inline_call | def inline_call(self, procedure, *arguments, **kwargs):
"""
Call another SimProcedure in-line to retrieve its return value.
Returns an instance of the procedure with the ret_expr property set.
:param procedure: The class of the procedure to execute
:param arguments: ... | python | def inline_call(self, procedure, *arguments, **kwargs):
"""
Call another SimProcedure in-line to retrieve its return value.
Returns an instance of the procedure with the ret_expr property set.
:param procedure: The class of the procedure to execute
:param arguments: ... | [
"def",
"inline_call",
"(",
"self",
",",
"procedure",
",",
"*",
"arguments",
",",
"*",
"*",
"kwargs",
")",
":",
"e_args",
"=",
"[",
"self",
".",
"state",
".",
"solver",
".",
"BVV",
"(",
"a",
",",
"self",
".",
"state",
".",
"arch",
".",
"bits",
")"... | Call another SimProcedure in-line to retrieve its return value.
Returns an instance of the procedure with the ret_expr property set.
:param procedure: The class of the procedure to execute
:param arguments: Any additional positional args will be used as arguments to the
... | [
"Call",
"another",
"SimProcedure",
"in",
"-",
"line",
"to",
"retrieve",
"its",
"return",
"value",
".",
"Returns",
"an",
"instance",
"of",
"the",
"procedure",
"with",
"the",
"ret_expr",
"property",
"set",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L284-L297 | train |
angr/angr | angr/sim_procedure.py | SimProcedure.ret | def ret(self, expr=None):
"""
Add an exit representing a return from this function.
If this is not an inline call, grab a return address from the state and jump to it.
If this is not an inline call, set a return expression with the calling convention.
"""
self.inhibit_aut... | python | def ret(self, expr=None):
"""
Add an exit representing a return from this function.
If this is not an inline call, grab a return address from the state and jump to it.
If this is not an inline call, set a return expression with the calling convention.
"""
self.inhibit_aut... | [
"def",
"ret",
"(",
"self",
",",
"expr",
"=",
"None",
")",
":",
"self",
".",
"inhibit_autoret",
"=",
"True",
"if",
"expr",
"is",
"not",
"None",
":",
"if",
"o",
".",
"SIMPLIFY_RETS",
"in",
"self",
".",
"state",
".",
"options",
":",
"l",
".",
"debug",... | Add an exit representing a return from this function.
If this is not an inline call, grab a return address from the state and jump to it.
If this is not an inline call, set a return expression with the calling convention. | [
"Add",
"an",
"exit",
"representing",
"a",
"return",
"from",
"this",
"function",
".",
"If",
"this",
"is",
"not",
"an",
"inline",
"call",
"grab",
"a",
"return",
"address",
"from",
"the",
"state",
"and",
"jump",
"to",
"it",
".",
"If",
"this",
"is",
"not",... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L299-L349 | train |
angr/angr | angr/sim_procedure.py | SimProcedure.call | def call(self, addr, args, continue_at, cc=None):
"""
Add an exit representing calling another function via pointer.
:param addr: The address of the function to call
:param args: The list of arguments to call the function with
:param continue_at: Later, when the ca... | python | def call(self, addr, args, continue_at, cc=None):
"""
Add an exit representing calling another function via pointer.
:param addr: The address of the function to call
:param args: The list of arguments to call the function with
:param continue_at: Later, when the ca... | [
"def",
"call",
"(",
"self",
",",
"addr",
",",
"args",
",",
"continue_at",
",",
"cc",
"=",
"None",
")",
":",
"self",
".",
"inhibit_autoret",
"=",
"True",
"if",
"cc",
"is",
"None",
":",
"cc",
"=",
"self",
".",
"cc",
"call_state",
"=",
"self",
".",
... | Add an exit representing calling another function via pointer.
:param addr: The address of the function to call
:param args: The list of arguments to call the function with
:param continue_at: Later, when the called function returns, execution of the current
... | [
"Add",
"an",
"exit",
"representing",
"calling",
"another",
"function",
"via",
"pointer",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L352-L396 | train |
angr/angr | angr/sim_procedure.py | SimProcedure.jump | def jump(self, addr):
"""
Add an exit representing jumping to an address.
"""
self.inhibit_autoret = True
self._exit_action(self.state, addr)
self.successors.add_successor(self.state, addr, self.state.solver.true, 'Ijk_Boring') | python | def jump(self, addr):
"""
Add an exit representing jumping to an address.
"""
self.inhibit_autoret = True
self._exit_action(self.state, addr)
self.successors.add_successor(self.state, addr, self.state.solver.true, 'Ijk_Boring') | [
"def",
"jump",
"(",
"self",
",",
"addr",
")",
":",
"self",
".",
"inhibit_autoret",
"=",
"True",
"self",
".",
"_exit_action",
"(",
"self",
".",
"state",
",",
"addr",
")",
"self",
".",
"successors",
".",
"add_successor",
"(",
"self",
".",
"state",
",",
... | Add an exit representing jumping to an address. | [
"Add",
"an",
"exit",
"representing",
"jumping",
"to",
"an",
"address",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L398-L404 | train |
angr/angr | angr/sim_procedure.py | SimProcedure.exit | def exit(self, exit_code):
"""
Add an exit representing terminating the program.
"""
self.inhibit_autoret = True
self.state.options.discard(o.AST_DEPS)
self.state.options.discard(o.AUTO_REFS)
if isinstance(exit_code, int):
exit_code = self.state.solve... | python | def exit(self, exit_code):
"""
Add an exit representing terminating the program.
"""
self.inhibit_autoret = True
self.state.options.discard(o.AST_DEPS)
self.state.options.discard(o.AUTO_REFS)
if isinstance(exit_code, int):
exit_code = self.state.solve... | [
"def",
"exit",
"(",
"self",
",",
"exit_code",
")",
":",
"self",
".",
"inhibit_autoret",
"=",
"True",
"self",
".",
"state",
".",
"options",
".",
"discard",
"(",
"o",
".",
"AST_DEPS",
")",
"self",
".",
"state",
".",
"options",
".",
"discard",
"(",
"o",... | Add an exit representing terminating the program. | [
"Add",
"an",
"exit",
"representing",
"terminating",
"the",
"program",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_procedure.py#L406-L417 | train |
angr/angr | angr/analyses/vsa_ddg.py | VSA_DDG._explore | def _explore(self):
"""
Starting from the start_node, explore the entire VFG, and perform the following:
- Generate def-use chains for all registers and memory addresses using a worklist
"""
# TODO: The worklist algorithm can definitely use some optimizations. It is a future wor... | python | def _explore(self):
"""
Starting from the start_node, explore the entire VFG, and perform the following:
- Generate def-use chains for all registers and memory addresses using a worklist
"""
# TODO: The worklist algorithm can definitely use some optimizations. It is a future wor... | [
"def",
"_explore",
"(",
"self",
")",
":",
"# TODO: The worklist algorithm can definitely use some optimizations. It is a future work.",
"# The worklist holds individual VFGNodes that comes from the VFG",
"# Initialize the worklist with all nodes in VFG",
"worklist",
"=",
"list",
"(",
"self... | Starting from the start_node, explore the entire VFG, and perform the following:
- Generate def-use chains for all registers and memory addresses using a worklist | [
"Starting",
"from",
"the",
"start_node",
"explore",
"the",
"entire",
"VFG",
"and",
"perform",
"the",
"following",
":",
"-",
"Generate",
"def",
"-",
"use",
"chains",
"for",
"all",
"registers",
"and",
"memory",
"addresses",
"using",
"a",
"worklist"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vsa_ddg.py#L108-L185 | train |
angr/angr | angr/analyses/vsa_ddg.py | VSA_DDG._track | def _track(self, state, live_defs):
"""
Given all live definitions prior to this program point, track the changes, and return a new list of live
definitions. We scan through the action list of the new state to track the changes.
:param state: The input state at that program point.... | python | def _track(self, state, live_defs):
"""
Given all live definitions prior to this program point, track the changes, and return a new list of live
definitions. We scan through the action list of the new state to track the changes.
:param state: The input state at that program point.... | [
"def",
"_track",
"(",
"self",
",",
"state",
",",
"live_defs",
")",
":",
"# Make a copy of live_defs",
"live_defs",
"=",
"live_defs",
".",
"copy",
"(",
")",
"action_list",
"=",
"list",
"(",
"state",
".",
"history",
".",
"recent_actions",
")",
"# Since all tempo... | Given all live definitions prior to this program point, track the changes, and return a new list of live
definitions. We scan through the action list of the new state to track the changes.
:param state: The input state at that program point.
:param live_defs: A list of all live definiti... | [
"Given",
"all",
"live",
"definitions",
"prior",
"to",
"this",
"program",
"point",
"track",
"the",
"changes",
"and",
"return",
"a",
"new",
"list",
"of",
"live",
"definitions",
".",
"We",
"scan",
"through",
"the",
"action",
"list",
"of",
"the",
"new",
"state... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vsa_ddg.py#L187-L342 | train |
angr/angr | angr/analyses/vsa_ddg.py | VSA_DDG._def_lookup | def _def_lookup(self, live_defs, variable):
"""
This is a backward lookup in the previous defs.
:param addr_list: a list of normalized addresses.
Note that, as we are using VSA, it is possible that @a is affected by several definitions.
:returns: a dict {s... | python | def _def_lookup(self, live_defs, variable):
"""
This is a backward lookup in the previous defs.
:param addr_list: a list of normalized addresses.
Note that, as we are using VSA, it is possible that @a is affected by several definitions.
:returns: a dict {s... | [
"def",
"_def_lookup",
"(",
"self",
",",
"live_defs",
",",
"variable",
")",
":",
"prevdefs",
"=",
"{",
"}",
"if",
"variable",
"in",
"live_defs",
":",
"code_loc_set",
"=",
"live_defs",
"[",
"variable",
"]",
"for",
"code_loc",
"in",
"code_loc_set",
":",
"# La... | This is a backward lookup in the previous defs.
:param addr_list: a list of normalized addresses.
Note that, as we are using VSA, it is possible that @a is affected by several definitions.
:returns: a dict {stmt:labels} where label is the number of individual addresses of... | [
"This",
"is",
"a",
"backward",
"lookup",
"in",
"the",
"previous",
"defs",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vsa_ddg.py#L345-L385 | train |
angr/angr | angr/analyses/vsa_ddg.py | VSA_DDG._kill | def _kill(self, live_defs, variable, code_loc):
"""
Kill previous defs. `addr_list` is a list of normalized addresses.
"""
# Case 1: address perfectly match, we kill
# Case 2: a is a subset of the original address
# Case 3: a is a superset of the original address
... | python | def _kill(self, live_defs, variable, code_loc):
"""
Kill previous defs. `addr_list` is a list of normalized addresses.
"""
# Case 1: address perfectly match, we kill
# Case 2: a is a subset of the original address
# Case 3: a is a superset of the original address
... | [
"def",
"_kill",
"(",
"self",
",",
"live_defs",
",",
"variable",
",",
"code_loc",
")",
":",
"# Case 1: address perfectly match, we kill",
"# Case 2: a is a subset of the original address",
"# Case 3: a is a superset of the original address",
"live_defs",
"[",
"variable",
"]",
"=... | Kill previous defs. `addr_list` is a list of normalized addresses. | [
"Kill",
"previous",
"defs",
".",
"addr_list",
"is",
"a",
"list",
"of",
"normalized",
"addresses",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vsa_ddg.py#L387-L397 | train |
angr/angr | angr/analyses/vsa_ddg.py | VSA_DDG._add_edge | def _add_edge(self, s_a, s_b, **edge_labels):
"""
Add an edge in the graph from `s_a` to statement `s_b`, where `s_a` and `s_b` are tuples of statements of the
form (irsb_addr, stmt_idx).
"""
# Is that edge already in the graph ?
# If at least one is new, then we are not ... | python | def _add_edge(self, s_a, s_b, **edge_labels):
"""
Add an edge in the graph from `s_a` to statement `s_b`, where `s_a` and `s_b` are tuples of statements of the
form (irsb_addr, stmt_idx).
"""
# Is that edge already in the graph ?
# If at least one is new, then we are not ... | [
"def",
"_add_edge",
"(",
"self",
",",
"s_a",
",",
"s_b",
",",
"*",
"*",
"edge_labels",
")",
":",
"# Is that edge already in the graph ?",
"# If at least one is new, then we are not redoing the same path again",
"if",
"(",
"s_a",
",",
"s_b",
")",
"not",
"in",
"self",
... | Add an edge in the graph from `s_a` to statement `s_b`, where `s_a` and `s_b` are tuples of statements of the
form (irsb_addr, stmt_idx). | [
"Add",
"an",
"edge",
"in",
"the",
"graph",
"from",
"s_a",
"to",
"statement",
"s_b",
"where",
"s_a",
"and",
"s_b",
"are",
"tuples",
"of",
"statements",
"of",
"the",
"form",
"(",
"irsb_addr",
"stmt_idx",
")",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vsa_ddg.py#L399-L409 | train |
angr/angr | angr/analyses/vsa_ddg.py | VSA_DDG.get_all_nodes | def get_all_nodes(self, simrun_addr, stmt_idx):
"""
Get all DDG nodes matching the given basic block address and statement index.
"""
nodes=[]
for n in self.graph.nodes():
if n.simrun_addr == simrun_addr and n.stmt_idx == stmt_idx:
nodes.add(n)
... | python | def get_all_nodes(self, simrun_addr, stmt_idx):
"""
Get all DDG nodes matching the given basic block address and statement index.
"""
nodes=[]
for n in self.graph.nodes():
if n.simrun_addr == simrun_addr and n.stmt_idx == stmt_idx:
nodes.add(n)
... | [
"def",
"get_all_nodes",
"(",
"self",
",",
"simrun_addr",
",",
"stmt_idx",
")",
":",
"nodes",
"=",
"[",
"]",
"for",
"n",
"in",
"self",
".",
"graph",
".",
"nodes",
"(",
")",
":",
"if",
"n",
".",
"simrun_addr",
"==",
"simrun_addr",
"and",
"n",
".",
"s... | Get all DDG nodes matching the given basic block address and statement index. | [
"Get",
"all",
"DDG",
"nodes",
"matching",
"the",
"given",
"basic",
"block",
"address",
"and",
"statement",
"index",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vsa_ddg.py#L411-L419 | train |
angr/angr | angr/engines/vex/irop.py | SimIROp.vector_args | def vector_args(self, args):
"""
Yields each of the individual lane pairs from the arguments, in
order from most significan to least significant
"""
for i in reversed(range(self._vector_count)):
pieces = []
for vec in args:
pieces.append(... | python | def vector_args(self, args):
"""
Yields each of the individual lane pairs from the arguments, in
order from most significan to least significant
"""
for i in reversed(range(self._vector_count)):
pieces = []
for vec in args:
pieces.append(... | [
"def",
"vector_args",
"(",
"self",
",",
"args",
")",
":",
"for",
"i",
"in",
"reversed",
"(",
"range",
"(",
"self",
".",
"_vector_count",
")",
")",
":",
"pieces",
"=",
"[",
"]",
"for",
"vec",
"in",
"args",
":",
"pieces",
".",
"append",
"(",
"vec",
... | Yields each of the individual lane pairs from the arguments, in
order from most significan to least significant | [
"Yields",
"each",
"of",
"the",
"individual",
"lane",
"pairs",
"from",
"the",
"arguments",
"in",
"order",
"from",
"most",
"significan",
"to",
"least",
"significant"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L491-L500 | train |
angr/angr | angr/engines/vex/irop.py | SimIROp._op_generic_Clz | def _op_generic_Clz(self, args):
"""Count the leading zeroes"""
wtf_expr = claripy.BVV(self._from_size, self._from_size)
for a in range(self._from_size):
bit = claripy.Extract(a, a, args[0])
wtf_expr = claripy.If(bit==1, claripy.BVV(self._from_size-a-1, self._from_size), ... | python | def _op_generic_Clz(self, args):
"""Count the leading zeroes"""
wtf_expr = claripy.BVV(self._from_size, self._from_size)
for a in range(self._from_size):
bit = claripy.Extract(a, a, args[0])
wtf_expr = claripy.If(bit==1, claripy.BVV(self._from_size-a-1, self._from_size), ... | [
"def",
"_op_generic_Clz",
"(",
"self",
",",
"args",
")",
":",
"wtf_expr",
"=",
"claripy",
".",
"BVV",
"(",
"self",
".",
"_from_size",
",",
"self",
".",
"_from_size",
")",
"for",
"a",
"in",
"range",
"(",
"self",
".",
"_from_size",
")",
":",
"bit",
"="... | Count the leading zeroes | [
"Count",
"the",
"leading",
"zeroes"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L508-L514 | train |
angr/angr | angr/engines/vex/irop.py | SimIROp._op_generic_Ctz | def _op_generic_Ctz(self, args):
"""Count the trailing zeroes"""
wtf_expr = claripy.BVV(self._from_size, self._from_size)
for a in reversed(range(self._from_size)):
bit = claripy.Extract(a, a, args[0])
wtf_expr = claripy.If(bit == 1, claripy.BVV(a, self._from_size), wtf_e... | python | def _op_generic_Ctz(self, args):
"""Count the trailing zeroes"""
wtf_expr = claripy.BVV(self._from_size, self._from_size)
for a in reversed(range(self._from_size)):
bit = claripy.Extract(a, a, args[0])
wtf_expr = claripy.If(bit == 1, claripy.BVV(a, self._from_size), wtf_e... | [
"def",
"_op_generic_Ctz",
"(",
"self",
",",
"args",
")",
":",
"wtf_expr",
"=",
"claripy",
".",
"BVV",
"(",
"self",
".",
"_from_size",
",",
"self",
".",
"_from_size",
")",
"for",
"a",
"in",
"reversed",
"(",
"range",
"(",
"self",
".",
"_from_size",
")",
... | Count the trailing zeroes | [
"Count",
"the",
"trailing",
"zeroes"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L516-L522 | train |
angr/angr | angr/engines/vex/irop.py | SimIROp._op_generic_HAdd | def _op_generic_HAdd(self, args):
"""
Halving add, for some ARM NEON instructions.
"""
components = []
for a, b in self.vector_args(args):
if self.is_signed:
a = a.sign_extend(self._vector_size)
b = b.sign_extend(self._vector_size)
... | python | def _op_generic_HAdd(self, args):
"""
Halving add, for some ARM NEON instructions.
"""
components = []
for a, b in self.vector_args(args):
if self.is_signed:
a = a.sign_extend(self._vector_size)
b = b.sign_extend(self._vector_size)
... | [
"def",
"_op_generic_HAdd",
"(",
"self",
",",
"args",
")",
":",
"components",
"=",
"[",
"]",
"for",
"a",
",",
"b",
"in",
"self",
".",
"vector_args",
"(",
"args",
")",
":",
"if",
"self",
".",
"is_signed",
":",
"a",
"=",
"a",
".",
"sign_extend",
"(",
... | Halving add, for some ARM NEON instructions. | [
"Halving",
"add",
"for",
"some",
"ARM",
"NEON",
"instructions",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L656-L669 | train |
angr/angr | angr/engines/vex/irop.py | SimIROp._op_generic_QAdd | def _op_generic_QAdd(self, args):
"""
Saturating add.
"""
components = []
for a, b in self.vector_args(args):
top_a = a[self._vector_size-1]
top_b = b[self._vector_size-1]
res = a + b
top_r = res[self._vector_size-1]
if ... | python | def _op_generic_QAdd(self, args):
"""
Saturating add.
"""
components = []
for a, b in self.vector_args(args):
top_a = a[self._vector_size-1]
top_b = b[self._vector_size-1]
res = a + b
top_r = res[self._vector_size-1]
if ... | [
"def",
"_op_generic_QAdd",
"(",
"self",
",",
"args",
")",
":",
"components",
"=",
"[",
"]",
"for",
"a",
",",
"b",
"in",
"self",
".",
"vector_args",
"(",
"args",
")",
":",
"top_a",
"=",
"a",
"[",
"self",
".",
"_vector_size",
"-",
"1",
"]",
"top_b",
... | Saturating add. | [
"Saturating",
"add",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L688-L706 | train |
angr/angr | angr/engines/vex/irop.py | SimIROp._op_generic_pack_StoU_saturation | def _op_generic_pack_StoU_saturation(self, args, src_size, dst_size):
"""
Generic pack with unsigned saturation.
Split args in chunks of src_size signed bits and in pack them into unsigned saturated chunks of dst_size bits.
Then chunks are concatenated resulting in a BV of len(args)*dst_... | python | def _op_generic_pack_StoU_saturation(self, args, src_size, dst_size):
"""
Generic pack with unsigned saturation.
Split args in chunks of src_size signed bits and in pack them into unsigned saturated chunks of dst_size bits.
Then chunks are concatenated resulting in a BV of len(args)*dst_... | [
"def",
"_op_generic_pack_StoU_saturation",
"(",
"self",
",",
"args",
",",
"src_size",
",",
"dst_size",
")",
":",
"if",
"src_size",
"<=",
"0",
"or",
"dst_size",
"<=",
"0",
":",
"raise",
"SimOperationError",
"(",
"\"Can't pack from or to zero or negative size\"",
"%",... | Generic pack with unsigned saturation.
Split args in chunks of src_size signed bits and in pack them into unsigned saturated chunks of dst_size bits.
Then chunks are concatenated resulting in a BV of len(args)*dst_size//src_size*len(args[0]) bits. | [
"Generic",
"pack",
"with",
"unsigned",
"saturation",
".",
"Split",
"args",
"in",
"chunks",
"of",
"src_size",
"signed",
"bits",
"and",
"in",
"pack",
"them",
"into",
"unsigned",
"saturated",
"chunks",
"of",
"dst_size",
"bits",
".",
"Then",
"chunks",
"are",
"co... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L816-L835 | train |
angr/angr | angr/engines/vex/irop.py | SimIROp._op_generic_StoU_saturation | def _op_generic_StoU_saturation(self, value, min_value, max_value): #pylint:disable=no-self-use
"""
Return unsigned saturated BV from signed BV.
Min and max value should be unsigned.
"""
return claripy.If(
claripy.SGT(value, max_value),
max_value,
... | python | def _op_generic_StoU_saturation(self, value, min_value, max_value): #pylint:disable=no-self-use
"""
Return unsigned saturated BV from signed BV.
Min and max value should be unsigned.
"""
return claripy.If(
claripy.SGT(value, max_value),
max_value,
... | [
"def",
"_op_generic_StoU_saturation",
"(",
"self",
",",
"value",
",",
"min_value",
",",
"max_value",
")",
":",
"#pylint:disable=no-self-use",
"return",
"claripy",
".",
"If",
"(",
"claripy",
".",
"SGT",
"(",
"value",
",",
"max_value",
")",
",",
"max_value",
","... | Return unsigned saturated BV from signed BV.
Min and max value should be unsigned. | [
"Return",
"unsigned",
"saturated",
"BV",
"from",
"signed",
"BV",
".",
"Min",
"and",
"max",
"value",
"should",
"be",
"unsigned",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/irop.py#L837-L845 | train |
angr/angr | angr/analyses/cfg/cfg_fast_soot.py | CFGFastSoot._scan_block | def _scan_block(self, cfg_job):
"""
Scan a basic block starting at a specific address
:param CFGJob cfg_job: The CFGJob instance.
:return: a list of successors
:rtype: list
"""
addr = cfg_job.addr
current_func_addr = cfg_job.func_addr
if self._a... | python | def _scan_block(self, cfg_job):
"""
Scan a basic block starting at a specific address
:param CFGJob cfg_job: The CFGJob instance.
:return: a list of successors
:rtype: list
"""
addr = cfg_job.addr
current_func_addr = cfg_job.func_addr
if self._a... | [
"def",
"_scan_block",
"(",
"self",
",",
"cfg_job",
")",
":",
"addr",
"=",
"cfg_job",
".",
"addr",
"current_func_addr",
"=",
"cfg_job",
".",
"func_addr",
"if",
"self",
".",
"_addr_hooked_or_syscall",
"(",
"addr",
")",
":",
"entries",
"=",
"self",
".",
"_sca... | Scan a basic block starting at a specific address
:param CFGJob cfg_job: The CFGJob instance.
:return: a list of successors
:rtype: list | [
"Scan",
"a",
"basic",
"block",
"starting",
"at",
"a",
"specific",
"address"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L299-L317 | train |
angr/angr | angr/analyses/cfg/cfg_fast_soot.py | CFGFastSoot._scan_soot_block | def _scan_soot_block(self, cfg_job, current_func_addr):
"""
Generate a list of successors (generating them each as entries) to IRSB.
Updates previous CFG nodes with edges.
:param CFGJob cfg_job: The CFGJob instance.
:param int current_func_addr: Address of the current function
... | python | def _scan_soot_block(self, cfg_job, current_func_addr):
"""
Generate a list of successors (generating them each as entries) to IRSB.
Updates previous CFG nodes with edges.
:param CFGJob cfg_job: The CFGJob instance.
:param int current_func_addr: Address of the current function
... | [
"def",
"_scan_soot_block",
"(",
"self",
",",
"cfg_job",
",",
"current_func_addr",
")",
":",
"addr",
",",
"function_addr",
",",
"cfg_node",
",",
"soot_block",
"=",
"self",
".",
"_generate_cfgnode",
"(",
"cfg_job",
",",
"current_func_addr",
")",
"# Add edges going t... | Generate a list of successors (generating them each as entries) to IRSB.
Updates previous CFG nodes with edges.
:param CFGJob cfg_job: The CFGJob instance.
:param int current_func_addr: Address of the current function
:return: a list of successors
:rtype: list | [
"Generate",
"a",
"list",
"of",
"successors",
"(",
"generating",
"them",
"each",
"as",
"entries",
")",
"to",
"IRSB",
".",
"Updates",
"previous",
"CFG",
"nodes",
"with",
"edges",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L319-L369 | train |
angr/angr | angr/analyses/cfg/cfg_fast_soot.py | CFGFastSoot._create_jobs | def _create_jobs(self, target, jumpkind, current_function_addr, soot_block, addr, cfg_node, stmt_addr, stmt_idx): # pylint:disable=arguments-differ
"""
Given a node and details of a successor, makes a list of CFGJobs
and if it is a call or exit marks it appropriately so in the CFG
:pa... | python | def _create_jobs(self, target, jumpkind, current_function_addr, soot_block, addr, cfg_node, stmt_addr, stmt_idx): # pylint:disable=arguments-differ
"""
Given a node and details of a successor, makes a list of CFGJobs
and if it is a call or exit marks it appropriately so in the CFG
:pa... | [
"def",
"_create_jobs",
"(",
"self",
",",
"target",
",",
"jumpkind",
",",
"current_function_addr",
",",
"soot_block",
",",
"addr",
",",
"cfg_node",
",",
"stmt_addr",
",",
"stmt_idx",
")",
":",
"# pylint:disable=arguments-differ",
"target_addr",
"=",
"target",
"jobs... | Given a node and details of a successor, makes a list of CFGJobs
and if it is a call or exit marks it appropriately so in the CFG
:param int target: Destination of the resultant job
:param str jumpkind: The jumpkind of the edge going to this node
:param int current_funct... | [
"Given",
"a",
"node",
"and",
"details",
"of",
"a",
"successor",
"makes",
"a",
"list",
"of",
"CFGJobs",
"and",
"if",
"it",
"is",
"a",
"call",
"or",
"exit",
"marks",
"it",
"appropriately",
"so",
"in",
"the",
"CFG"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L371-L443 | train |
angr/angr | angr/analyses/cfg/cfg_fast_soot.py | CFGFastSoot.make_functions | def make_functions(self):
"""
Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into
each function.
Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a
pre-constructed CFG,... | python | def make_functions(self):
"""
Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into
each function.
Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a
pre-constructed CFG,... | [
"def",
"make_functions",
"(",
"self",
")",
":",
"tmp_functions",
"=",
"self",
".",
"kb",
".",
"functions",
".",
"copy",
"(",
")",
"for",
"function",
"in",
"tmp_functions",
".",
"values",
"(",
")",
":",
"function",
".",
"mark_nonreturning_calls_endpoints",
"(... | Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into
each function.
Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a
pre-constructed CFG, this method rebuilds all functions bearing th... | [
"Revisit",
"the",
"entire",
"control",
"flow",
"graph",
"create",
"Function",
"instances",
"accordingly",
"and",
"correctly",
"put",
"blocks",
"into",
"each",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast_soot.py#L445-L552 | train |
angr/angr | angr/engines/soot/values/thisref.py | SimSootValue_ThisRef.set_field | def set_field(self, state, field_name, field_type, value):
"""
Sets an instance field.
"""
field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state,
obj_alloc_id=self.heap_alloc_id,
... | python | def set_field(self, state, field_name, field_type, value):
"""
Sets an instance field.
"""
field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state,
obj_alloc_id=self.heap_alloc_id,
... | [
"def",
"set_field",
"(",
"self",
",",
"state",
",",
"field_name",
",",
"field_type",
",",
"value",
")",
":",
"field_ref",
"=",
"SimSootValue_InstanceFieldRef",
".",
"get_ref",
"(",
"state",
"=",
"state",
",",
"obj_alloc_id",
"=",
"self",
".",
"heap_alloc_id",
... | Sets an instance field. | [
"Sets",
"an",
"instance",
"field",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L35-L45 | train |
angr/angr | angr/engines/soot/values/thisref.py | SimSootValue_ThisRef.get_field | def get_field(self, state, field_name, field_type):
"""
Gets the value of an instance field.
"""
# get field reference
field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state,
obj_alloc_id=self.heap_alloc_id,
... | python | def get_field(self, state, field_name, field_type):
"""
Gets the value of an instance field.
"""
# get field reference
field_ref = SimSootValue_InstanceFieldRef.get_ref(state=state,
obj_alloc_id=self.heap_alloc_id,
... | [
"def",
"get_field",
"(",
"self",
",",
"state",
",",
"field_name",
",",
"field_type",
")",
":",
"# get field reference",
"field_ref",
"=",
"SimSootValue_InstanceFieldRef",
".",
"get_ref",
"(",
"state",
"=",
"state",
",",
"obj_alloc_id",
"=",
"self",
".",
"heap_al... | Gets the value of an instance field. | [
"Gets",
"the",
"value",
"of",
"an",
"instance",
"field",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L47-L58 | train |
angr/angr | angr/engines/soot/values/thisref.py | SimSootValue_ThisRef.store_field | def store_field(self, state, field_name, field_type, value):
"""
Store a field of a given object, without resolving hierachy
:param state: angr state where we want to allocate the object attribute
:type SimState
:param field_name: name of the attribute
:type str
... | python | def store_field(self, state, field_name, field_type, value):
"""
Store a field of a given object, without resolving hierachy
:param state: angr state where we want to allocate the object attribute
:type SimState
:param field_name: name of the attribute
:type str
... | [
"def",
"store_field",
"(",
"self",
",",
"state",
",",
"field_name",
",",
"field_type",
",",
"value",
")",
":",
"field_ref",
"=",
"SimSootValue_InstanceFieldRef",
"(",
"self",
".",
"heap_alloc_id",
",",
"self",
".",
"type",
",",
"field_name",
",",
"field_type",... | Store a field of a given object, without resolving hierachy
:param state: angr state where we want to allocate the object attribute
:type SimState
:param field_name: name of the attribute
:type str
:param field_value: attibute's value
:type SimSootValue | [
"Store",
"a",
"field",
"of",
"a",
"given",
"object",
"without",
"resolving",
"hierachy"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L60-L72 | train |
angr/angr | angr/engines/soot/values/thisref.py | SimSootValue_ThisRef.load_field | def load_field(self, state, field_name, field_type):
"""
Load a field of a given object, without resolving hierachy
:param state: angr state where we want to load the object attribute
:type SimState
:param field_name: name of the attribute
:type str
:param field_... | python | def load_field(self, state, field_name, field_type):
"""
Load a field of a given object, without resolving hierachy
:param state: angr state where we want to load the object attribute
:type SimState
:param field_name: name of the attribute
:type str
:param field_... | [
"def",
"load_field",
"(",
"self",
",",
"state",
",",
"field_name",
",",
"field_type",
")",
":",
"field_ref",
"=",
"SimSootValue_InstanceFieldRef",
"(",
"self",
".",
"heap_alloc_id",
",",
"self",
".",
"type",
",",
"field_name",
",",
"field_type",
")",
"return",... | Load a field of a given object, without resolving hierachy
:param state: angr state where we want to load the object attribute
:type SimState
:param field_name: name of the attribute
:type str
:param field_type: type of the attribute
:type str | [
"Load",
"a",
"field",
"of",
"a",
"given",
"object",
"without",
"resolving",
"hierachy"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L74-L86 | train |
angr/angr | angr/engines/soot/values/thisref.py | SimSootValue_ThisRef.new_object | def new_object(cls, state, type_, symbolic=False, init_object=False):
"""
Creates a new object reference.
:param state: State associated to the object.
:param type_: Class of the object.
:param init_object: Whether the objects initializer method should be run.
:return: Re... | python | def new_object(cls, state, type_, symbolic=False, init_object=False):
"""
Creates a new object reference.
:param state: State associated to the object.
:param type_: Class of the object.
:param init_object: Whether the objects initializer method should be run.
:return: Re... | [
"def",
"new_object",
"(",
"cls",
",",
"state",
",",
"type_",
",",
"symbolic",
"=",
"False",
",",
"init_object",
"=",
"False",
")",
":",
"# create reference",
"obj_ref",
"=",
"cls",
"(",
"heap_alloc_id",
"=",
"state",
".",
"memory",
".",
"get_new_uuid",
"("... | Creates a new object reference.
:param state: State associated to the object.
:param type_: Class of the object.
:param init_object: Whether the objects initializer method should be run.
:return: Reference to the new object. | [
"Creates",
"a",
"new",
"object",
"reference",
".",
":",
"param",
"state",
":",
"State",
"associated",
"to",
"the",
"object",
".",
":",
"param",
"type_",
":",
"Class",
"of",
"the",
"object",
".",
":",
"param",
"init_object",
":",
"Whether",
"the",
"object... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/thisref.py#L94-L123 | train |
angr/angr | angr/simos/simos.py | SimOS.configure_project | def configure_project(self):
"""
Configure the project to set up global settings (like SimProcedures).
"""
self.return_deadend = self.project.loader.extern_object.allocate()
self.project.hook(self.return_deadend, P['stubs']['CallReturn']())
self.unresolvable_jump_target ... | python | def configure_project(self):
"""
Configure the project to set up global settings (like SimProcedures).
"""
self.return_deadend = self.project.loader.extern_object.allocate()
self.project.hook(self.return_deadend, P['stubs']['CallReturn']())
self.unresolvable_jump_target ... | [
"def",
"configure_project",
"(",
"self",
")",
":",
"self",
".",
"return_deadend",
"=",
"self",
".",
"project",
".",
"loader",
".",
"extern_object",
".",
"allocate",
"(",
")",
"self",
".",
"project",
".",
"hook",
"(",
"self",
".",
"return_deadend",
",",
"... | Configure the project to set up global settings (like SimProcedures). | [
"Configure",
"the",
"project",
"to",
"set",
"up",
"global",
"settings",
"(",
"like",
"SimProcedures",
")",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L37-L75 | train |
angr/angr | angr/simos/simos.py | SimOS.state_blank | def state_blank(self, addr=None, initial_prefix=None, brk=None, stack_end=None, stack_size=1024*1024*8, stdin=None, **kwargs):
"""
Initialize a blank state.
All parameters are optional.
:param addr: The execution start address.
:param initial_prefix:
:param s... | python | def state_blank(self, addr=None, initial_prefix=None, brk=None, stack_end=None, stack_size=1024*1024*8, stdin=None, **kwargs):
"""
Initialize a blank state.
All parameters are optional.
:param addr: The execution start address.
:param initial_prefix:
:param s... | [
"def",
"state_blank",
"(",
"self",
",",
"addr",
"=",
"None",
",",
"initial_prefix",
"=",
"None",
",",
"brk",
"=",
"None",
",",
"stack_end",
"=",
"None",
",",
"stack_size",
"=",
"1024",
"*",
"1024",
"*",
"8",
",",
"stdin",
"=",
"None",
",",
"*",
"*"... | Initialize a blank state.
All parameters are optional.
:param addr: The execution start address.
:param initial_prefix:
:param stack_end: The end of the stack (i.e., the byte after the last valid stack address).
:param stack_size: The number of bytes to al... | [
"Initialize",
"a",
"blank",
"state",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L89-L190 | train |
angr/angr | angr/simos/simos.py | SimOS.prepare_call_state | def prepare_call_state(self, calling_state, initial_state=None,
preserve_registers=(), preserve_memory=()):
"""
This function prepares a state that is executing a call instruction.
If given an initial_state, it copies over all of the critical registers to it from the
... | python | def prepare_call_state(self, calling_state, initial_state=None,
preserve_registers=(), preserve_memory=()):
"""
This function prepares a state that is executing a call instruction.
If given an initial_state, it copies over all of the critical registers to it from the
... | [
"def",
"prepare_call_state",
"(",
"self",
",",
"calling_state",
",",
"initial_state",
"=",
"None",
",",
"preserve_registers",
"=",
"(",
")",
",",
"preserve_memory",
"=",
"(",
")",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"arch",
",",
"ArchMIPS32",
"... | This function prepares a state that is executing a call instruction.
If given an initial_state, it copies over all of the critical registers to it from the
calling_state. Otherwise, it prepares the calling_state for action.
This is mostly used to create minimalistic for CFG generation. Some ABI... | [
"This",
"function",
"prepares",
"a",
"state",
"that",
"is",
"executing",
"a",
"call",
"instruction",
".",
"If",
"given",
"an",
"initial_state",
"it",
"copies",
"over",
"all",
"of",
"the",
"critical",
"registers",
"to",
"it",
"from",
"the",
"calling_state",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L222-L249 | train |
angr/angr | angr/simos/simos.py | SimOS.prepare_function_symbol | def prepare_function_symbol(self, symbol_name, basic_addr=None):
"""
Prepare the address space with the data necessary to perform relocations pointing to the given symbol
Returns a 2-tuple. The first item is the address of the function code, the second is the address of the
relocation t... | python | def prepare_function_symbol(self, symbol_name, basic_addr=None):
"""
Prepare the address space with the data necessary to perform relocations pointing to the given symbol
Returns a 2-tuple. The first item is the address of the function code, the second is the address of the
relocation t... | [
"def",
"prepare_function_symbol",
"(",
"self",
",",
"symbol_name",
",",
"basic_addr",
"=",
"None",
")",
":",
"if",
"basic_addr",
"is",
"None",
":",
"basic_addr",
"=",
"self",
".",
"project",
".",
"loader",
".",
"extern_object",
".",
"get_pseudo_addr",
"(",
"... | Prepare the address space with the data necessary to perform relocations pointing to the given symbol
Returns a 2-tuple. The first item is the address of the function code, the second is the address of the
relocation target. | [
"Prepare",
"the",
"address",
"space",
"with",
"the",
"data",
"necessary",
"to",
"perform",
"relocations",
"pointing",
"to",
"the",
"given",
"symbol"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L251-L260 | train |
angr/angr | angr/simos/simos.py | SimOS.setup_gdt | def setup_gdt(self, state, gdt):
"""
Write the GlobalDescriptorTable object in the current state memory
:param state: state in which to write the GDT
:param gdt: GlobalDescriptorTable object
:return:
"""
state.memory.store(gdt.addr+8, gdt.table)
state.reg... | python | def setup_gdt(self, state, gdt):
"""
Write the GlobalDescriptorTable object in the current state memory
:param state: state in which to write the GDT
:param gdt: GlobalDescriptorTable object
:return:
"""
state.memory.store(gdt.addr+8, gdt.table)
state.reg... | [
"def",
"setup_gdt",
"(",
"self",
",",
"state",
",",
"gdt",
")",
":",
"state",
".",
"memory",
".",
"store",
"(",
"gdt",
".",
"addr",
"+",
"8",
",",
"gdt",
".",
"table",
")",
"state",
".",
"regs",
".",
"gdt",
"=",
"gdt",
".",
"gdt",
"state",
".",... | Write the GlobalDescriptorTable object in the current state memory
:param state: state in which to write the GDT
:param gdt: GlobalDescriptorTable object
:return: | [
"Write",
"the",
"GlobalDescriptorTable",
"object",
"in",
"the",
"current",
"state",
"memory"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L295-L310 | train |
angr/angr | angr/simos/simos.py | SimOS.generate_gdt | def generate_gdt(self, fs, gs, fs_size=0xFFFFFFFF, gs_size=0xFFFFFFFF):
"""
Generate a GlobalDescriptorTable object and populate it using the value of the gs and fs register
:param fs: value of the fs segment register
:param gs: value of the gs segment register
:param ... | python | def generate_gdt(self, fs, gs, fs_size=0xFFFFFFFF, gs_size=0xFFFFFFFF):
"""
Generate a GlobalDescriptorTable object and populate it using the value of the gs and fs register
:param fs: value of the fs segment register
:param gs: value of the gs segment register
:param ... | [
"def",
"generate_gdt",
"(",
"self",
",",
"fs",
",",
"gs",
",",
"fs_size",
"=",
"0xFFFFFFFF",
",",
"gs_size",
"=",
"0xFFFFFFFF",
")",
":",
"A_PRESENT",
"=",
"0x80",
"A_DATA",
"=",
"0x10",
"A_DATA_WRITABLE",
"=",
"0x2",
"A_PRIV_0",
"=",
"0x0",
"A_DIR_CON_BIT... | Generate a GlobalDescriptorTable object and populate it using the value of the gs and fs register
:param fs: value of the fs segment register
:param gs: value of the gs segment register
:param fs_size: size of the fs segment register
:param gs_size: size of the gs segment regi... | [
"Generate",
"a",
"GlobalDescriptorTable",
"object",
"and",
"populate",
"it",
"using",
"the",
"value",
"of",
"the",
"gs",
"and",
"fs",
"register"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/simos.py#L312-L356 | train |
angr/angr | angr/sim_type.py | define_struct | def define_struct(defn):
"""
Register a struct definition globally
>>> define_struct('struct abcd {int x; int y;}')
"""
struct = parse_type(defn)
ALL_TYPES[struct.name] = struct
return struct | python | def define_struct(defn):
"""
Register a struct definition globally
>>> define_struct('struct abcd {int x; int y;}')
"""
struct = parse_type(defn)
ALL_TYPES[struct.name] = struct
return struct | [
"def",
"define_struct",
"(",
"defn",
")",
":",
"struct",
"=",
"parse_type",
"(",
"defn",
")",
"ALL_TYPES",
"[",
"struct",
".",
"name",
"]",
"=",
"struct",
"return",
"struct"
] | Register a struct definition globally
>>> define_struct('struct abcd {int x; int y;}') | [
"Register",
"a",
"struct",
"definition",
"globally"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L986-L994 | train |
angr/angr | angr/sim_type.py | do_preprocess | def do_preprocess(defn):
"""
Run a string through the C preprocessor that ships with pycparser but is weirdly inaccessible?
"""
from pycparser.ply import lex, cpp
lexer = lex.lex(cpp)
p = cpp.Preprocessor(lexer)
# p.add_path(dir) will add dir to the include search path
p.parse(defn)
... | python | def do_preprocess(defn):
"""
Run a string through the C preprocessor that ships with pycparser but is weirdly inaccessible?
"""
from pycparser.ply import lex, cpp
lexer = lex.lex(cpp)
p = cpp.Preprocessor(lexer)
# p.add_path(dir) will add dir to the include search path
p.parse(defn)
... | [
"def",
"do_preprocess",
"(",
"defn",
")",
":",
"from",
"pycparser",
".",
"ply",
"import",
"lex",
",",
"cpp",
"lexer",
"=",
"lex",
".",
"lex",
"(",
"cpp",
")",
"p",
"=",
"cpp",
".",
"Preprocessor",
"(",
"lexer",
")",
"# p.add_path(dir) will add dir to the i... | Run a string through the C preprocessor that ships with pycparser but is weirdly inaccessible? | [
"Run",
"a",
"string",
"through",
"the",
"C",
"preprocessor",
"that",
"ships",
"with",
"pycparser",
"but",
"is",
"weirdly",
"inaccessible?"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L1006-L1015 | train |
angr/angr | angr/sim_type.py | parse_file | def parse_file(defn, preprocess=True):
"""
Parse a series of C definitions, returns a tuple of two type mappings, one for variable
definitions and one for type definitions.
"""
if pycparser is None:
raise ImportError("Please install pycparser in order to parse C definitions")
defn = '\n... | python | def parse_file(defn, preprocess=True):
"""
Parse a series of C definitions, returns a tuple of two type mappings, one for variable
definitions and one for type definitions.
"""
if pycparser is None:
raise ImportError("Please install pycparser in order to parse C definitions")
defn = '\n... | [
"def",
"parse_file",
"(",
"defn",
",",
"preprocess",
"=",
"True",
")",
":",
"if",
"pycparser",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"\"Please install pycparser in order to parse C definitions\"",
")",
"defn",
"=",
"'\\n'",
".",
"join",
"(",
"x",
"for"... | Parse a series of C definitions, returns a tuple of two type mappings, one for variable
definitions and one for type definitions. | [
"Parse",
"a",
"series",
"of",
"C",
"definitions",
"returns",
"a",
"tuple",
"of",
"two",
"type",
"mappings",
"one",
"for",
"variable",
"definitions",
"and",
"one",
"for",
"type",
"definitions",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L1033-L1064 | train |
angr/angr | angr/sim_type.py | parse_type | def parse_type(defn, preprocess=True):
"""
Parse a simple type expression into a SimType
>>> parse_type('int *')
"""
if pycparser is None:
raise ImportError("Please install pycparser in order to parse C definitions")
defn = 'typedef ' + defn.strip('; \n\t\r') + ' QQQQ;'
if preproc... | python | def parse_type(defn, preprocess=True):
"""
Parse a simple type expression into a SimType
>>> parse_type('int *')
"""
if pycparser is None:
raise ImportError("Please install pycparser in order to parse C definitions")
defn = 'typedef ' + defn.strip('; \n\t\r') + ' QQQQ;'
if preproc... | [
"def",
"parse_type",
"(",
"defn",
",",
"preprocess",
"=",
"True",
")",
":",
"if",
"pycparser",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"\"Please install pycparser in order to parse C definitions\"",
")",
"defn",
"=",
"'typedef '",
"+",
"defn",
".",
"strip"... | Parse a simple type expression into a SimType
>>> parse_type('int *') | [
"Parse",
"a",
"simple",
"type",
"expression",
"into",
"a",
"SimType"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L1067-L1087 | train |
angr/angr | angr/sim_type.py | SimType.alignment | def alignment(self):
"""
The alignment of the type in bytes.
"""
if self._arch is None:
return NotImplemented
return self.size // self._arch.byte_width | python | def alignment(self):
"""
The alignment of the type in bytes.
"""
if self._arch is None:
return NotImplemented
return self.size // self._arch.byte_width | [
"def",
"alignment",
"(",
"self",
")",
":",
"if",
"self",
".",
"_arch",
"is",
"None",
":",
"return",
"NotImplemented",
"return",
"self",
".",
"size",
"//",
"self",
".",
"_arch",
".",
"byte_width"
] | The alignment of the type in bytes. | [
"The",
"alignment",
"of",
"the",
"type",
"in",
"bytes",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_type.py#L76-L82 | train |
angr/angr | angr/state_plugins/concrete.py | Concrete.sync | def sync(self):
"""
Handle the switch between the concrete execution and angr.
This method takes care of:
1- Synchronize registers.
2- Set a concrete target to the memory backer so the memory reads are redirected in the concrete process memory.
3- If possible restore the ... | python | def sync(self):
"""
Handle the switch between the concrete execution and angr.
This method takes care of:
1- Synchronize registers.
2- Set a concrete target to the memory backer so the memory reads are redirected in the concrete process memory.
3- If possible restore the ... | [
"def",
"sync",
"(",
"self",
")",
":",
"def",
"_sync_segments",
"(",
"state",
")",
":",
"\"\"\"\n Segment registers synchronization is on demand as soon as the\n symbolic execution access a segment register.\n \"\"\"",
"concr_target",
"=",
"state",
"."... | Handle the switch between the concrete execution and angr.
This method takes care of:
1- Synchronize registers.
2- Set a concrete target to the memory backer so the memory reads are redirected in the concrete process memory.
3- If possible restore the SimProcedures with the real addresse... | [
"Handle",
"the",
"switch",
"between",
"the",
"concrete",
"execution",
"and",
"angr",
".",
"This",
"method",
"takes",
"care",
"of",
":",
"1",
"-",
"Synchronize",
"registers",
".",
"2",
"-",
"Set",
"a",
"concrete",
"target",
"to",
"the",
"memory",
"backer",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/concrete.py#L60-L178 | train |
angr/angr | angr/exploration_techniques/unique.py | UniqueSearch.similarity | def similarity(state_a, state_b):
"""
The (L2) distance between the counts of the state addresses in the history of the path.
:param state_a: The first state to compare
:param state_b: The second state to compare
"""
count_a = Counter(state_a.history.bbl_addrs)
co... | python | def similarity(state_a, state_b):
"""
The (L2) distance between the counts of the state addresses in the history of the path.
:param state_a: The first state to compare
:param state_b: The second state to compare
"""
count_a = Counter(state_a.history.bbl_addrs)
co... | [
"def",
"similarity",
"(",
"state_a",
",",
"state_b",
")",
":",
"count_a",
"=",
"Counter",
"(",
"state_a",
".",
"history",
".",
"bbl_addrs",
")",
"count_b",
"=",
"Counter",
"(",
"state_b",
".",
"history",
".",
"bbl_addrs",
")",
"normal_distance",
"=",
"sum"... | The (L2) distance between the counts of the state addresses in the history of the path.
:param state_a: The first state to compare
:param state_b: The second state to compare | [
"The",
"(",
"L2",
")",
"distance",
"between",
"the",
"counts",
"of",
"the",
"state",
"addresses",
"in",
"the",
"history",
"of",
"the",
"path",
".",
":",
"param",
"state_a",
":",
"The",
"first",
"state",
"to",
"compare",
":",
"param",
"state_b",
":",
"T... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/unique.py#L78-L88 | train |
angr/angr | angr/exploration_techniques/unique.py | UniqueSearch.sequence_matcher_similarity | def sequence_matcher_similarity(state_a, state_b):
"""
The `difflib.SequenceMatcher` ratio between the state addresses in the history of the path.
:param state_a: The first state to compare
:param state_b: The second state to compare
"""
addrs_a = tuple(state_a.history.bb... | python | def sequence_matcher_similarity(state_a, state_b):
"""
The `difflib.SequenceMatcher` ratio between the state addresses in the history of the path.
:param state_a: The first state to compare
:param state_b: The second state to compare
"""
addrs_a = tuple(state_a.history.bb... | [
"def",
"sequence_matcher_similarity",
"(",
"state_a",
",",
"state_b",
")",
":",
"addrs_a",
"=",
"tuple",
"(",
"state_a",
".",
"history",
".",
"bbl_addrs",
")",
"addrs_b",
"=",
"tuple",
"(",
"state_b",
".",
"history",
".",
"bbl_addrs",
")",
"return",
"Sequenc... | The `difflib.SequenceMatcher` ratio between the state addresses in the history of the path.
:param state_a: The first state to compare
:param state_b: The second state to compare | [
"The",
"difflib",
".",
"SequenceMatcher",
"ratio",
"between",
"the",
"state",
"addresses",
"in",
"the",
"history",
"of",
"the",
"path",
".",
":",
"param",
"state_a",
":",
"The",
"first",
"state",
"to",
"compare",
":",
"param",
"state_b",
":",
"The",
"secon... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/exploration_techniques/unique.py#L91-L99 | train |
angr/angr | angr/engines/soot/method_dispatcher.py | resolve_method | def resolve_method(state, method_name, class_name, params=(), ret_type=None,
include_superclasses=True, init_class=True,
raise_exception_if_not_found=False):
"""
Resolves the method based on the given characteristics (name, class and
params) The method may be defined in... | python | def resolve_method(state, method_name, class_name, params=(), ret_type=None,
include_superclasses=True, init_class=True,
raise_exception_if_not_found=False):
"""
Resolves the method based on the given characteristics (name, class and
params) The method may be defined in... | [
"def",
"resolve_method",
"(",
"state",
",",
"method_name",
",",
"class_name",
",",
"params",
"=",
"(",
")",
",",
"ret_type",
"=",
"None",
",",
"include_superclasses",
"=",
"True",
",",
"init_class",
"=",
"True",
",",
"raise_exception_if_not_found",
"=",
"False... | Resolves the method based on the given characteristics (name, class and
params) The method may be defined in one of the superclasses of the given
class (TODO: support interfaces).
:rtype: archinfo.arch_soot.SootMethodDescriptor | [
"Resolves",
"the",
"method",
"based",
"on",
"the",
"given",
"characteristics",
"(",
"name",
"class",
"and",
"params",
")",
"The",
"method",
"may",
"be",
"defined",
"in",
"one",
"of",
"the",
"superclasses",
"of",
"the",
"given",
"class",
"(",
"TODO",
":",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/method_dispatcher.py#L11-L44 | train |
angr/angr | angr/calling_conventions.py | SimRegArg._fix_offset | def _fix_offset(self, state, size, arch=None):
"""
This is a hack to deal with small values being stored at offsets into large registers unpredictably
"""
if state is not None:
arch = state.arch
if arch is None:
raise ValueError('Either "state" or "arch" ... | python | def _fix_offset(self, state, size, arch=None):
"""
This is a hack to deal with small values being stored at offsets into large registers unpredictably
"""
if state is not None:
arch = state.arch
if arch is None:
raise ValueError('Either "state" or "arch" ... | [
"def",
"_fix_offset",
"(",
"self",
",",
"state",
",",
"size",
",",
"arch",
"=",
"None",
")",
":",
"if",
"state",
"is",
"not",
"None",
":",
"arch",
"=",
"state",
".",
"arch",
"if",
"arch",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Either \"stat... | This is a hack to deal with small values being stored at offsets into large registers unpredictably | [
"This",
"is",
"a",
"hack",
"to",
"deal",
"with",
"small",
"values",
"being",
"stored",
"at",
"offsets",
"into",
"large",
"registers",
"unpredictably"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L96-L111 | train |
angr/angr | angr/calling_conventions.py | SimCC.from_arg_kinds | def from_arg_kinds(cls, arch, fp_args, ret_fp=False, sizes=None, sp_delta=None, func_ty=None):
"""
Get an instance of the class that will extract floating-point/integral args correctly.
:param arch: The Archinfo arch for this CC
:param fp_args: A list, with one entry for each... | python | def from_arg_kinds(cls, arch, fp_args, ret_fp=False, sizes=None, sp_delta=None, func_ty=None):
"""
Get an instance of the class that will extract floating-point/integral args correctly.
:param arch: The Archinfo arch for this CC
:param fp_args: A list, with one entry for each... | [
"def",
"from_arg_kinds",
"(",
"cls",
",",
"arch",
",",
"fp_args",
",",
"ret_fp",
"=",
"False",
",",
"sizes",
"=",
"None",
",",
"sp_delta",
"=",
"None",
",",
"func_ty",
"=",
"None",
")",
":",
"basic",
"=",
"cls",
"(",
"arch",
",",
"sp_delta",
"=",
"... | Get an instance of the class that will extract floating-point/integral args correctly.
:param arch: The Archinfo arch for this CC
:param fp_args: A list, with one entry for each argument the function can take. True if the argument is fp,
false if it is integral.
... | [
"Get",
"an",
"instance",
"of",
"the",
"class",
"that",
"will",
"extract",
"floating",
"-",
"point",
"/",
"integral",
"args",
"correctly",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L297-L313 | train |
angr/angr | angr/calling_conventions.py | SimCC.int_args | def int_args(self):
"""
Iterate through all the possible arg positions that can only be used to store integer or pointer values
Does not take into account customizations.
Returns an iterator of SimFunctionArguments
"""
if self.ARG_REGS is None:
raise NotImple... | python | def int_args(self):
"""
Iterate through all the possible arg positions that can only be used to store integer or pointer values
Does not take into account customizations.
Returns an iterator of SimFunctionArguments
"""
if self.ARG_REGS is None:
raise NotImple... | [
"def",
"int_args",
"(",
"self",
")",
":",
"if",
"self",
".",
"ARG_REGS",
"is",
"None",
":",
"raise",
"NotImplementedError",
"(",
")",
"for",
"reg",
"in",
"self",
".",
"ARG_REGS",
":",
"# pylint: disable=not-an-iterable",
"yield",
"SimRegArg",
"(",
"reg",
","... | Iterate through all the possible arg positions that can only be used to store integer or pointer values
Does not take into account customizations.
Returns an iterator of SimFunctionArguments | [
"Iterate",
"through",
"all",
"the",
"possible",
"arg",
"positions",
"that",
"can",
"only",
"be",
"used",
"to",
"store",
"integer",
"or",
"pointer",
"values",
"Does",
"not",
"take",
"into",
"account",
"customizations",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L338-L348 | train |
angr/angr | angr/calling_conventions.py | SimCC.both_args | def both_args(self):
"""
Iterate through all the possible arg positions that can be used to store any kind of argument
Does not take into account customizations.
Returns an iterator of SimFunctionArguments
"""
turtle = self.STACKARG_SP_BUFF + self.STACKARG_SP_DIFF
... | python | def both_args(self):
"""
Iterate through all the possible arg positions that can be used to store any kind of argument
Does not take into account customizations.
Returns an iterator of SimFunctionArguments
"""
turtle = self.STACKARG_SP_BUFF + self.STACKARG_SP_DIFF
... | [
"def",
"both_args",
"(",
"self",
")",
":",
"turtle",
"=",
"self",
".",
"STACKARG_SP_BUFF",
"+",
"self",
".",
"STACKARG_SP_DIFF",
"while",
"True",
":",
"yield",
"SimStackArg",
"(",
"turtle",
",",
"self",
".",
"arch",
".",
"bytes",
")",
"turtle",
"+=",
"se... | Iterate through all the possible arg positions that can be used to store any kind of argument
Does not take into account customizations.
Returns an iterator of SimFunctionArguments | [
"Iterate",
"through",
"all",
"the",
"possible",
"arg",
"positions",
"that",
"can",
"be",
"used",
"to",
"store",
"any",
"kind",
"of",
"argument",
"Does",
"not",
"take",
"into",
"account",
"customizations",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L351-L361 | train |
angr/angr | angr/calling_conventions.py | SimCC.fp_args | def fp_args(self):
"""
Iterate through all the possible arg positions that can only be used to store floating point values
Does not take into account customizations.
Returns an iterator of SimFunctionArguments
"""
if self.FP_ARG_REGS is None:
raise NotImpleme... | python | def fp_args(self):
"""
Iterate through all the possible arg positions that can only be used to store floating point values
Does not take into account customizations.
Returns an iterator of SimFunctionArguments
"""
if self.FP_ARG_REGS is None:
raise NotImpleme... | [
"def",
"fp_args",
"(",
"self",
")",
":",
"if",
"self",
".",
"FP_ARG_REGS",
"is",
"None",
":",
"raise",
"NotImplementedError",
"(",
")",
"for",
"reg",
"in",
"self",
".",
"FP_ARG_REGS",
":",
"# pylint: disable=not-an-iterable",
"yield",
"SimRegArg",
"(",
"reg",
... | Iterate through all the possible arg positions that can only be used to store floating point values
Does not take into account customizations.
Returns an iterator of SimFunctionArguments | [
"Iterate",
"through",
"all",
"the",
"possible",
"arg",
"positions",
"that",
"can",
"only",
"be",
"used",
"to",
"store",
"floating",
"point",
"values",
"Does",
"not",
"take",
"into",
"account",
"customizations",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L364-L374 | train |
angr/angr | angr/calling_conventions.py | SimCC.is_fp_arg | def is_fp_arg(self, arg):
"""
This should take a SimFunctionArgument instance and return whether or not that argument is a floating-point
argument.
Returns True for MUST be a floating point arg,
False for MUST NOT be a floating point arg,
None for when it... | python | def is_fp_arg(self, arg):
"""
This should take a SimFunctionArgument instance and return whether or not that argument is a floating-point
argument.
Returns True for MUST be a floating point arg,
False for MUST NOT be a floating point arg,
None for when it... | [
"def",
"is_fp_arg",
"(",
"self",
",",
"arg",
")",
":",
"if",
"arg",
"in",
"self",
".",
"int_args",
":",
"return",
"False",
"if",
"arg",
"in",
"self",
".",
"fp_args",
"or",
"arg",
"==",
"self",
".",
"FP_RETURN_VAL",
":",
"return",
"True",
"return",
"N... | This should take a SimFunctionArgument instance and return whether or not that argument is a floating-point
argument.
Returns True for MUST be a floating point arg,
False for MUST NOT be a floating point arg,
None for when it can be either. | [
"This",
"should",
"take",
"a",
"SimFunctionArgument",
"instance",
"and",
"return",
"whether",
"or",
"not",
"that",
"argument",
"is",
"a",
"floating",
"-",
"point",
"argument",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L376-L389 | train |
angr/angr | angr/calling_conventions.py | SimCC.stack_space | def stack_space(self, args):
"""
:param args: A list of SimFunctionArguments
:returns: The number of bytes that should be allocated on the stack to store all these args,
NOT INCLUDING the return address.
"""
out = self.STACKARG_SP_DIF... | python | def stack_space(self, args):
"""
:param args: A list of SimFunctionArguments
:returns: The number of bytes that should be allocated on the stack to store all these args,
NOT INCLUDING the return address.
"""
out = self.STACKARG_SP_DIF... | [
"def",
"stack_space",
"(",
"self",
",",
"args",
")",
":",
"out",
"=",
"self",
".",
"STACKARG_SP_DIFF",
"for",
"arg",
"in",
"args",
":",
"if",
"isinstance",
"(",
"arg",
",",
"SimStackArg",
")",
":",
"out",
"=",
"max",
"(",
"out",
",",
"arg",
".",
"s... | :param args: A list of SimFunctionArguments
:returns: The number of bytes that should be allocated on the stack to store all these args,
NOT INCLUDING the return address. | [
":",
"param",
"args",
":",
"A",
"list",
"of",
"SimFunctionArguments"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L404-L417 | train |
angr/angr | angr/calling_conventions.py | SimCC.arg_locs | def arg_locs(self, is_fp=None, sizes=None):
"""
Pass this a list of whether each parameter is floating-point or not, and get back a list of
SimFunctionArguments. Optionally, pass a list of argument sizes (in bytes) as well.
If you've customized this CC, this will sanity-check the provid... | python | def arg_locs(self, is_fp=None, sizes=None):
"""
Pass this a list of whether each parameter is floating-point or not, and get back a list of
SimFunctionArguments. Optionally, pass a list of argument sizes (in bytes) as well.
If you've customized this CC, this will sanity-check the provid... | [
"def",
"arg_locs",
"(",
"self",
",",
"is_fp",
"=",
"None",
",",
"sizes",
"=",
"None",
")",
":",
"session",
"=",
"self",
".",
"arg_session",
"if",
"self",
".",
"func_ty",
"is",
"None",
":",
"# No function prototype is provided. `is_fp` must be provided.",
"if",
... | Pass this a list of whether each parameter is floating-point or not, and get back a list of
SimFunctionArguments. Optionally, pass a list of argument sizes (in bytes) as well.
If you've customized this CC, this will sanity-check the provided locations with the given list. | [
"Pass",
"this",
"a",
"list",
"of",
"whether",
"each",
"parameter",
"is",
"floating",
"-",
"point",
"or",
"not",
"and",
"get",
"back",
"a",
"list",
"of",
"SimFunctionArguments",
".",
"Optionally",
"pass",
"a",
"list",
"of",
"argument",
"sizes",
"(",
"in",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L448-L465 | train |
angr/angr | angr/calling_conventions.py | SimCC.arg | def arg(self, state, index, stack_base=None):
"""
Returns a bitvector expression representing the nth argument of a function.
`stack_base` is an optional pointer to the top of the stack at the function start. If it is not
specified, use the current stack pointer.
WARNING: this ... | python | def arg(self, state, index, stack_base=None):
"""
Returns a bitvector expression representing the nth argument of a function.
`stack_base` is an optional pointer to the top of the stack at the function start. If it is not
specified, use the current stack pointer.
WARNING: this ... | [
"def",
"arg",
"(",
"self",
",",
"state",
",",
"index",
",",
"stack_base",
"=",
"None",
")",
":",
"session",
"=",
"self",
".",
"arg_session",
"if",
"self",
".",
"args",
"is",
"None",
":",
"arg_loc",
"=",
"[",
"session",
".",
"next_arg",
"(",
"False",
... | Returns a bitvector expression representing the nth argument of a function.
`stack_base` is an optional pointer to the top of the stack at the function start. If it is not
specified, use the current stack pointer.
WARNING: this assumes that none of the arguments are floating-point and they're ... | [
"Returns",
"a",
"bitvector",
"expression",
"representing",
"the",
"nth",
"argument",
"of",
"a",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L467-L483 | train |
angr/angr | angr/calling_conventions.py | SimCC.get_args | def get_args(self, state, is_fp=None, sizes=None, stack_base=None):
"""
`is_fp` should be a list of booleans specifying whether each corresponding argument is floating-point -
True for fp and False for int. For a shorthand to assume that all the parameters are int, pass the number of
par... | python | def get_args(self, state, is_fp=None, sizes=None, stack_base=None):
"""
`is_fp` should be a list of booleans specifying whether each corresponding argument is floating-point -
True for fp and False for int. For a shorthand to assume that all the parameters are int, pass the number of
par... | [
"def",
"get_args",
"(",
"self",
",",
"state",
",",
"is_fp",
"=",
"None",
",",
"sizes",
"=",
"None",
",",
"stack_base",
"=",
"None",
")",
":",
"if",
"sizes",
"is",
"None",
"and",
"self",
".",
"func_ty",
"is",
"not",
"None",
":",
"sizes",
"=",
"[",
... | `is_fp` should be a list of booleans specifying whether each corresponding argument is floating-point -
True for fp and False for int. For a shorthand to assume that all the parameters are int, pass the number of
parameters as an int.
If you've customized this CC, you may omit this parameter en... | [
"is_fp",
"should",
"be",
"a",
"list",
"of",
"booleans",
"specifying",
"whether",
"each",
"corresponding",
"argument",
"is",
"floating",
"-",
"point",
"-",
"True",
"for",
"fp",
"and",
"False",
"for",
"int",
".",
"For",
"a",
"shorthand",
"to",
"assume",
"tha... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L485-L520 | train |
angr/angr | angr/calling_conventions.py | SimCC.setup_callsite | def setup_callsite(self, state, ret_addr, args, stack_base=None, alloc_base=None, grow_like_stack=True):
"""
This function performs the actions of the caller getting ready to jump into a function.
:param state: The SimState to operate on
:param ret_addr: The address to ... | python | def setup_callsite(self, state, ret_addr, args, stack_base=None, alloc_base=None, grow_like_stack=True):
"""
This function performs the actions of the caller getting ready to jump into a function.
:param state: The SimState to operate on
:param ret_addr: The address to ... | [
"def",
"setup_callsite",
"(",
"self",
",",
"state",
",",
"ret_addr",
",",
"args",
",",
"stack_base",
"=",
"None",
",",
"alloc_base",
"=",
"None",
",",
"grow_like_stack",
"=",
"True",
")",
":",
"# STEP 0: clerical work",
"if",
"isinstance",
"(",
"self",
",",
... | This function performs the actions of the caller getting ready to jump into a function.
:param state: The SimState to operate on
:param ret_addr: The address to return to when the called function finishes
:param args: The list of arguments that that the called functi... | [
"This",
"function",
"performs",
"the",
"actions",
"of",
"the",
"caller",
"getting",
"ready",
"to",
"jump",
"into",
"a",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L522-L629 | train |
angr/angr | angr/calling_conventions.py | SimCC.teardown_callsite | def teardown_callsite(self, state, return_val=None, arg_types=None, force_callee_cleanup=False):
"""
This function performs the actions of the callee as it's getting ready to return.
It returns the address to return to.
:param state: The state to mutate
:param ... | python | def teardown_callsite(self, state, return_val=None, arg_types=None, force_callee_cleanup=False):
"""
This function performs the actions of the callee as it's getting ready to return.
It returns the address to return to.
:param state: The state to mutate
:param ... | [
"def",
"teardown_callsite",
"(",
"self",
",",
"state",
",",
"return_val",
"=",
"None",
",",
"arg_types",
"=",
"None",
",",
"force_callee_cleanup",
"=",
"False",
")",
":",
"if",
"return_val",
"is",
"not",
"None",
":",
"self",
".",
"set_return_val",
"(",
"st... | This function performs the actions of the callee as it's getting ready to return.
It returns the address to return to.
:param state: The state to mutate
:param return_val: The value to return
:param arg_types: The fp-ness of each of the args.... | [
"This",
"function",
"performs",
"the",
"actions",
"of",
"the",
"callee",
"as",
"it",
"s",
"getting",
"ready",
"to",
"return",
".",
"It",
"returns",
"the",
"address",
"to",
"return",
"to",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L631-L663 | train |
angr/angr | angr/calling_conventions.py | SimCC.get_return_val | def get_return_val(self, state, is_fp=None, size=None, stack_base=None):
"""
Get the return value out of the given state
"""
ty = self.func_ty.returnty if self.func_ty is not None else None
if self.ret_val is not None:
loc = self.ret_val
elif is_fp is not None... | python | def get_return_val(self, state, is_fp=None, size=None, stack_base=None):
"""
Get the return value out of the given state
"""
ty = self.func_ty.returnty if self.func_ty is not None else None
if self.ret_val is not None:
loc = self.ret_val
elif is_fp is not None... | [
"def",
"get_return_val",
"(",
"self",
",",
"state",
",",
"is_fp",
"=",
"None",
",",
"size",
"=",
"None",
",",
"stack_base",
"=",
"None",
")",
":",
"ty",
"=",
"self",
".",
"func_ty",
".",
"returnty",
"if",
"self",
".",
"func_ty",
"is",
"not",
"None",
... | Get the return value out of the given state | [
"Get",
"the",
"return",
"value",
"out",
"of",
"the",
"given",
"state"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L667-L687 | train |
angr/angr | angr/calling_conventions.py | SimCC.set_return_val | def set_return_val(self, state, val, is_fp=None, size=None, stack_base=None):
"""
Set the return value into the given state
"""
ty = self.func_ty.returnty if self.func_ty is not None else None
try:
betterval = self._standardize_value(val, ty, state, None)
exce... | python | def set_return_val(self, state, val, is_fp=None, size=None, stack_base=None):
"""
Set the return value into the given state
"""
ty = self.func_ty.returnty if self.func_ty is not None else None
try:
betterval = self._standardize_value(val, ty, state, None)
exce... | [
"def",
"set_return_val",
"(",
"self",
",",
"state",
",",
"val",
",",
"is_fp",
"=",
"None",
",",
"size",
"=",
"None",
",",
"stack_base",
"=",
"None",
")",
":",
"ty",
"=",
"self",
".",
"func_ty",
".",
"returnty",
"if",
"self",
".",
"func_ty",
"is",
"... | Set the return value into the given state | [
"Set",
"the",
"return",
"value",
"into",
"the",
"given",
"state"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L689-L710 | train |
angr/angr | angr/calling_conventions.py | SimCC.find_cc | def find_cc(arch, args, sp_delta):
"""
Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is
found.
:param Arch arch: An ArchX instance. Can be obtained from archinfo.
:param list args: A list of arguments.
... | python | def find_cc(arch, args, sp_delta):
"""
Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is
found.
:param Arch arch: An ArchX instance. Can be obtained from archinfo.
:param list args: A list of arguments.
... | [
"def",
"find_cc",
"(",
"arch",
",",
"args",
",",
"sp_delta",
")",
":",
"if",
"arch",
".",
"name",
"not",
"in",
"CC",
":",
"return",
"None",
"possible_cc_classes",
"=",
"CC",
"[",
"arch",
".",
"name",
"]",
"for",
"cc_cls",
"in",
"possible_cc_classes",
"... | Pinpoint the best-fit calling convention and return the corresponding SimCC instance, or None if no fit is
found.
:param Arch arch: An ArchX instance. Can be obtained from archinfo.
:param list args: A list of arguments.
:param int sp_delta: The change of stack pointer be... | [
"Pinpoint",
"the",
"best",
"-",
"fit",
"calling",
"convention",
"and",
"return",
"the",
"corresponding",
"SimCC",
"instance",
"or",
"None",
"if",
"no",
"fit",
"is",
"found",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L889-L907 | train |
angr/angr | angr/calling_conventions.py | SimCC.get_arg_info | def get_arg_info(self, state, is_fp=None, sizes=None):
"""
This is just a simple wrapper that collects the information from various locations
is_fp and sizes are passed to self.arg_locs and self.get_args
:param angr.SimState state: The state to evaluate and extract the values from
... | python | def get_arg_info(self, state, is_fp=None, sizes=None):
"""
This is just a simple wrapper that collects the information from various locations
is_fp and sizes are passed to self.arg_locs and self.get_args
:param angr.SimState state: The state to evaluate and extract the values from
... | [
"def",
"get_arg_info",
"(",
"self",
",",
"state",
",",
"is_fp",
"=",
"None",
",",
"sizes",
"=",
"None",
")",
":",
"argument_types",
"=",
"self",
".",
"func_ty",
".",
"args",
"argument_names",
"=",
"self",
".",
"func_ty",
".",
"arg_names",
"if",
"self",
... | This is just a simple wrapper that collects the information from various locations
is_fp and sizes are passed to self.arg_locs and self.get_args
:param angr.SimState state: The state to evaluate and extract the values from
:return: A list of tuples, where the nth tuple is (type, name, locatio... | [
"This",
"is",
"just",
"a",
"simple",
"wrapper",
"that",
"collects",
"the",
"information",
"from",
"various",
"locations",
"is_fp",
"and",
"sizes",
"are",
"passed",
"to",
"self",
".",
"arg_locs",
"and",
"self",
".",
"get_args",
":",
"param",
"angr",
".",
"S... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L910-L921 | train |
angr/angr | angr/engines/successors.py | SimSuccessors.add_successor | def add_successor(self, state, target, guard, jumpkind, add_guard=True, exit_stmt_idx=None, exit_ins_addr=None,
source=None):
"""
Add a successor state of the SimRun.
This procedure stores method parameters into state.scratch, does some housekeeping,
and calls out t... | python | def add_successor(self, state, target, guard, jumpkind, add_guard=True, exit_stmt_idx=None, exit_ins_addr=None,
source=None):
"""
Add a successor state of the SimRun.
This procedure stores method parameters into state.scratch, does some housekeeping,
and calls out t... | [
"def",
"add_successor",
"(",
"self",
",",
"state",
",",
"target",
",",
"guard",
",",
"jumpkind",
",",
"add_guard",
"=",
"True",
",",
"exit_stmt_idx",
"=",
"None",
",",
"exit_ins_addr",
"=",
"None",
",",
"source",
"=",
"None",
")",
":",
"# First, trigger th... | Add a successor state of the SimRun.
This procedure stores method parameters into state.scratch, does some housekeeping,
and calls out to helper functions to prepare the state and categorize it into the appropriate
successor lists.
:param SimState state: The successor state.
... | [
"Add",
"a",
"successor",
"state",
"of",
"the",
"SimRun",
".",
"This",
"procedure",
"stores",
"method",
"parameters",
"into",
"state",
".",
"scratch",
"does",
"some",
"housekeeping",
"and",
"calls",
"out",
"to",
"helper",
"functions",
"to",
"prepare",
"the",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L86-L127 | train |
angr/angr | angr/engines/successors.py | SimSuccessors._preprocess_successor | def _preprocess_successor(self, state, add_guard=True): #pylint:disable=unused-argument
"""
Preprocesses the successor state.
:param state: the successor state
"""
# Next, simplify what needs to be simplified
if o.SIMPLIFY_EXIT_STATE in state.options:
state.... | python | def _preprocess_successor(self, state, add_guard=True): #pylint:disable=unused-argument
"""
Preprocesses the successor state.
:param state: the successor state
"""
# Next, simplify what needs to be simplified
if o.SIMPLIFY_EXIT_STATE in state.options:
state.... | [
"def",
"_preprocess_successor",
"(",
"self",
",",
"state",
",",
"add_guard",
"=",
"True",
")",
":",
"#pylint:disable=unused-argument",
"# Next, simplify what needs to be simplified",
"if",
"o",
".",
"SIMPLIFY_EXIT_STATE",
"in",
"state",
".",
"options",
":",
"state",
"... | Preprocesses the successor state.
:param state: the successor state | [
"Preprocesses",
"the",
"successor",
"state",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L133-L169 | train |
angr/angr | angr/engines/successors.py | SimSuccessors._categorize_successor | def _categorize_successor(self, state):
"""
Append state into successor lists.
:param state: a SimState instance
:param target: The target (of the jump/call/ret)
:return: The state
"""
self.all_successors.append(state)
target = state.scratch.target
... | python | def _categorize_successor(self, state):
"""
Append state into successor lists.
:param state: a SimState instance
:param target: The target (of the jump/call/ret)
:return: The state
"""
self.all_successors.append(state)
target = state.scratch.target
... | [
"def",
"_categorize_successor",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"all_successors",
".",
"append",
"(",
"state",
")",
"target",
"=",
"state",
".",
"scratch",
".",
"target",
"# categorize the state",
"if",
"o",
".",
"APPROXIMATE_GUARDS",
"in",
... | Append state into successor lists.
:param state: a SimState instance
:param target: The target (of the jump/call/ret)
:return: The state | [
"Append",
"state",
"into",
"successor",
"lists",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L228-L340 | train |
angr/angr | angr/engines/successors.py | SimSuccessors._fix_syscall_ip | def _fix_syscall_ip(state):
"""
Resolve syscall information from the state, get the IP address of the syscall SimProcedure, and set the IP of
the state accordingly. Don't do anything if the resolution fails.
:param SimState state: the program state.
:return: None
"""
... | python | def _fix_syscall_ip(state):
"""
Resolve syscall information from the state, get the IP address of the syscall SimProcedure, and set the IP of
the state accordingly. Don't do anything if the resolution fails.
:param SimState state: the program state.
:return: None
"""
... | [
"def",
"_fix_syscall_ip",
"(",
"state",
")",
":",
"try",
":",
"bypass",
"=",
"o",
".",
"BYPASS_UNSUPPORTED_SYSCALL",
"in",
"state",
".",
"options",
"stub",
"=",
"state",
".",
"project",
".",
"simos",
".",
"syscall",
"(",
"state",
",",
"allow_unsupported",
... | Resolve syscall information from the state, get the IP address of the syscall SimProcedure, and set the IP of
the state accordingly. Don't do anything if the resolution fails.
:param SimState state: the program state.
:return: None | [
"Resolve",
"syscall",
"information",
"from",
"the",
"state",
"get",
"the",
"IP",
"address",
"of",
"the",
"syscall",
"SimProcedure",
"and",
"set",
"the",
"IP",
"of",
"the",
"state",
"accordingly",
".",
"Don",
"t",
"do",
"anything",
"if",
"the",
"resolution",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L372-L387 | train |
angr/angr | angr/engines/successors.py | SimSuccessors._finalize | def _finalize(self):
"""
Finalizes the request.
"""
if len(self.all_successors) == 0:
return
# do some cleanup
if o.DOWNSIZE_Z3 in self.all_successors[0].options:
for s in self.all_successors:
s.downsize()
# record if the ... | python | def _finalize(self):
"""
Finalizes the request.
"""
if len(self.all_successors) == 0:
return
# do some cleanup
if o.DOWNSIZE_Z3 in self.all_successors[0].options:
for s in self.all_successors:
s.downsize()
# record if the ... | [
"def",
"_finalize",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"all_successors",
")",
"==",
"0",
":",
"return",
"# do some cleanup",
"if",
"o",
".",
"DOWNSIZE_Z3",
"in",
"self",
".",
"all_successors",
"[",
"0",
"]",
".",
"options",
":",
"for... | Finalizes the request. | [
"Finalizes",
"the",
"request",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L389-L403 | train |
angr/angr | angr/engines/successors.py | SimSuccessors._eval_target_jumptable | def _eval_target_jumptable(state, ip, limit):
"""
A *very* fast method to evaluate symbolic jump targets if they are a) concrete targets, or b) targets coming
from jump tables.
:param state: A SimState instance.
:param ip: The AST of the instruction pointer to evaluate.
... | python | def _eval_target_jumptable(state, ip, limit):
"""
A *very* fast method to evaluate symbolic jump targets if they are a) concrete targets, or b) targets coming
from jump tables.
:param state: A SimState instance.
:param ip: The AST of the instruction pointer to evaluate.
... | [
"def",
"_eval_target_jumptable",
"(",
"state",
",",
"ip",
",",
"limit",
")",
":",
"if",
"ip",
".",
"symbolic",
"is",
"False",
":",
"return",
"[",
"(",
"claripy",
".",
"ast",
".",
"bool",
".",
"true",
",",
"ip",
")",
"]",
"# concrete",
"# Detect whether... | A *very* fast method to evaluate symbolic jump targets if they are a) concrete targets, or b) targets coming
from jump tables.
:param state: A SimState instance.
:param ip: The AST of the instruction pointer to evaluate.
:param limit: The maximum number of concrete IPs.
... | [
"A",
"*",
"very",
"*",
"fast",
"method",
"to",
"evaluate",
"symbolic",
"jump",
"targets",
"if",
"they",
"are",
"a",
")",
"concrete",
"targets",
"or",
"b",
")",
"targets",
"coming",
"from",
"jump",
"tables",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L406-L493 | train |
angr/angr | angr/engines/successors.py | SimSuccessors._eval_target_brutal | def _eval_target_brutal(state, ip, limit):
"""
The traditional way of evaluating symbolic jump targets.
:param state: A SimState instance.
:param ip: The AST of the instruction pointer to evaluate.
:param limit: The maximum number of concrete IPs.
:return: ... | python | def _eval_target_brutal(state, ip, limit):
"""
The traditional way of evaluating symbolic jump targets.
:param state: A SimState instance.
:param ip: The AST of the instruction pointer to evaluate.
:param limit: The maximum number of concrete IPs.
:return: ... | [
"def",
"_eval_target_brutal",
"(",
"state",
",",
"ip",
",",
"limit",
")",
":",
"addrs",
"=",
"state",
".",
"solver",
".",
"eval_upto",
"(",
"ip",
",",
"limit",
")",
"return",
"[",
"(",
"ip",
"==",
"addr",
",",
"addr",
")",
"for",
"addr",
"in",
"add... | The traditional way of evaluating symbolic jump targets.
:param state: A SimState instance.
:param ip: The AST of the instruction pointer to evaluate.
:param limit: The maximum number of concrete IPs.
:return: A list of conditions and the corresponding concrete IPs.
... | [
"The",
"traditional",
"way",
"of",
"evaluating",
"symbolic",
"jump",
"targets",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/successors.py#L496-L509 | train |
angr/angr | angr/procedures/libc/memset.py | memset._repeat_bytes | def _repeat_bytes(byt, rep):
"""
Get a long number for a byte being repeated for many times. This is part of the effort of optimizing
performance of angr's memory operations.
:param int byt: the byte to repeat
:param int rep: times to repeat the byte
:return: a long inte... | python | def _repeat_bytes(byt, rep):
"""
Get a long number for a byte being repeated for many times. This is part of the effort of optimizing
performance of angr's memory operations.
:param int byt: the byte to repeat
:param int rep: times to repeat the byte
:return: a long inte... | [
"def",
"_repeat_bytes",
"(",
"byt",
",",
"rep",
")",
":",
"if",
"rep",
"==",
"1",
":",
"return",
"byt",
"remainder",
"=",
"rep",
"%",
"2",
"quotient",
"=",
"rep",
"//",
"2",
"r_",
"=",
"memset",
".",
"_repeat_bytes",
"(",
"byt",
",",
"quotient",
")... | Get a long number for a byte being repeated for many times. This is part of the effort of optimizing
performance of angr's memory operations.
:param int byt: the byte to repeat
:param int rep: times to repeat the byte
:return: a long integer representing the repeating bytes
;rty... | [
"Get",
"a",
"long",
"number",
"for",
"a",
"byte",
"being",
"repeated",
"for",
"many",
"times",
".",
"This",
"is",
"part",
"of",
"the",
"effort",
"of",
"optimizing",
"performance",
"of",
"angr",
"s",
"memory",
"operations",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/memset.py#L15-L39 | train |
angr/angr | angr/knowledge_plugins/cfg/memory_data.py | MemoryData.copy | def copy(self):
"""
Make a copy of the MemoryData.
:return: A copy of the MemoryData instance.
:rtype: MemoryData
"""
s = MemoryData(self.address, self.size, self.sort, pointer_addr=self.pointer_addr, max_size=self.max_size)
s.content = self.content
retu... | python | def copy(self):
"""
Make a copy of the MemoryData.
:return: A copy of the MemoryData instance.
:rtype: MemoryData
"""
s = MemoryData(self.address, self.size, self.sort, pointer_addr=self.pointer_addr, max_size=self.max_size)
s.content = self.content
retu... | [
"def",
"copy",
"(",
"self",
")",
":",
"s",
"=",
"MemoryData",
"(",
"self",
".",
"address",
",",
"self",
".",
"size",
",",
"self",
".",
"sort",
",",
"pointer_addr",
"=",
"self",
".",
"pointer_addr",
",",
"max_size",
"=",
"self",
".",
"max_size",
")",
... | Make a copy of the MemoryData.
:return: A copy of the MemoryData instance.
:rtype: MemoryData | [
"Make",
"a",
"copy",
"of",
"the",
"MemoryData",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/memory_data.py#L111-L121 | train |
angr/angr | angr/storage/paged_memory.py | BasePage.store_mo | def store_mo(self, state, new_mo, overwrite=True): #pylint:disable=unused-argument
"""
Stores a memory object.
:param new_mo: the memory object
:param overwrite: whether to overwrite objects already in memory (if false, just fill in the holes)
"""
start, end = self._reso... | python | def store_mo(self, state, new_mo, overwrite=True): #pylint:disable=unused-argument
"""
Stores a memory object.
:param new_mo: the memory object
:param overwrite: whether to overwrite objects already in memory (if false, just fill in the holes)
"""
start, end = self._reso... | [
"def",
"store_mo",
"(",
"self",
",",
"state",
",",
"new_mo",
",",
"overwrite",
"=",
"True",
")",
":",
"#pylint:disable=unused-argument",
"start",
",",
"end",
"=",
"self",
".",
"_resolve_range",
"(",
"new_mo",
")",
"if",
"overwrite",
":",
"self",
".",
"stor... | Stores a memory object.
:param new_mo: the memory object
:param overwrite: whether to overwrite objects already in memory (if false, just fill in the holes) | [
"Stores",
"a",
"memory",
"object",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L69-L80 | train |
angr/angr | angr/storage/paged_memory.py | TreePage.load_mo | def load_mo(self, state, page_idx):
"""
Loads a memory object from memory.
:param page_idx: the index into the page
:returns: a tuple of the object
"""
try:
key = next(self._storage.irange(maximum=page_idx, reverse=True))
except StopIteration:
... | python | def load_mo(self, state, page_idx):
"""
Loads a memory object from memory.
:param page_idx: the index into the page
:returns: a tuple of the object
"""
try:
key = next(self._storage.irange(maximum=page_idx, reverse=True))
except StopIteration:
... | [
"def",
"load_mo",
"(",
"self",
",",
"state",
",",
"page_idx",
")",
":",
"try",
":",
"key",
"=",
"next",
"(",
"self",
".",
"_storage",
".",
"irange",
"(",
"maximum",
"=",
"page_idx",
",",
"reverse",
"=",
"True",
")",
")",
"except",
"StopIteration",
":... | Loads a memory object from memory.
:param page_idx: the index into the page
:returns: a tuple of the object | [
"Loads",
"a",
"memory",
"object",
"from",
"memory",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L207-L220 | train |
angr/angr | angr/storage/paged_memory.py | TreePage.load_slice | def load_slice(self, state, start, end):
"""
Return the memory objects overlapping with the provided slice.
:param start: the start address
:param end: the end address (non-inclusive)
:returns: tuples of (starting_addr, memory_object)
"""
keys = list(self._storag... | python | def load_slice(self, state, start, end):
"""
Return the memory objects overlapping with the provided slice.
:param start: the start address
:param end: the end address (non-inclusive)
:returns: tuples of (starting_addr, memory_object)
"""
keys = list(self._storag... | [
"def",
"load_slice",
"(",
"self",
",",
"state",
",",
"start",
",",
"end",
")",
":",
"keys",
"=",
"list",
"(",
"self",
".",
"_storage",
".",
"irange",
"(",
"start",
",",
"end",
"-",
"1",
")",
")",
"if",
"not",
"keys",
"or",
"keys",
"[",
"0",
"]"... | Return the memory objects overlapping with the provided slice.
:param start: the start address
:param end: the end address (non-inclusive)
:returns: tuples of (starting_addr, memory_object) | [
"Return",
"the",
"memory",
"objects",
"overlapping",
"with",
"the",
"provided",
"slice",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L222-L239 | train |
angr/angr | angr/storage/paged_memory.py | ListPage.load_mo | def load_mo(self, state, page_idx):
"""
Loads a memory object from memory.
:param page_idx: the index into the page
:returns: a tuple of the object
"""
mo = self._storage[page_idx-self._page_addr]
return self._sinkhole if mo is None else mo | python | def load_mo(self, state, page_idx):
"""
Loads a memory object from memory.
:param page_idx: the index into the page
:returns: a tuple of the object
"""
mo = self._storage[page_idx-self._page_addr]
return self._sinkhole if mo is None else mo | [
"def",
"load_mo",
"(",
"self",
",",
"state",
",",
"page_idx",
")",
":",
"mo",
"=",
"self",
".",
"_storage",
"[",
"page_idx",
"-",
"self",
".",
"_page_addr",
"]",
"return",
"self",
".",
"_sinkhole",
"if",
"mo",
"is",
"None",
"else",
"mo"
] | Loads a memory object from memory.
:param page_idx: the index into the page
:returns: a tuple of the object | [
"Loads",
"a",
"memory",
"object",
"from",
"memory",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L287-L295 | train |
angr/angr | angr/storage/paged_memory.py | ListPage.load_slice | def load_slice(self, state, start, end):
"""
Return the memory objects overlapping with the provided slice.
:param start: the start address
:param end: the end address (non-inclusive)
:returns: tuples of (starting_addr, memory_object)
"""
items = [ ]
if s... | python | def load_slice(self, state, start, end):
"""
Return the memory objects overlapping with the provided slice.
:param start: the start address
:param end: the end address (non-inclusive)
:returns: tuples of (starting_addr, memory_object)
"""
items = [ ]
if s... | [
"def",
"load_slice",
"(",
"self",
",",
"state",
",",
"start",
",",
"end",
")",
":",
"items",
"=",
"[",
"]",
"if",
"start",
">",
"self",
".",
"_page_addr",
"+",
"self",
".",
"_page_size",
"or",
"end",
"<",
"self",
".",
"_page_addr",
":",
"l",
".",
... | Return the memory objects overlapping with the provided slice.
:param start: the start address
:param end: the end address (non-inclusive)
:returns: tuples of (starting_addr, memory_object) | [
"Return",
"the",
"memory",
"objects",
"overlapping",
"with",
"the",
"provided",
"slice",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L297-L317 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.contains_no_backer | def contains_no_backer(self, addr):
"""
Tests if the address is contained in any page of paged memory, without considering memory backers.
:param int addr: The address to test.
:return: True if the address is included in one of the pages, False otherwise.
:rtype: bool
""... | python | def contains_no_backer(self, addr):
"""
Tests if the address is contained in any page of paged memory, without considering memory backers.
:param int addr: The address to test.
:return: True if the address is included in one of the pages, False otherwise.
:rtype: bool
""... | [
"def",
"contains_no_backer",
"(",
"self",
",",
"addr",
")",
":",
"for",
"i",
",",
"p",
"in",
"self",
".",
"_pages",
".",
"items",
"(",
")",
":",
"if",
"i",
"*",
"self",
".",
"_page_size",
"<=",
"addr",
"<",
"(",
"i",
"+",
"1",
")",
"*",
"self",... | Tests if the address is contained in any page of paged memory, without considering memory backers.
:param int addr: The address to test.
:return: True if the address is included in one of the pages, False otherwise.
:rtype: bool | [
"Tests",
"if",
"the",
"address",
"is",
"contained",
"in",
"any",
"page",
"of",
"paged",
"memory",
"without",
"considering",
"memory",
"backers",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L601-L613 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.__changed_bytes | def __changed_bytes(self, other):
"""
Gets the set of changed bytes between `self` and `other`.
:type other: SimPagedMemory
:returns: A set of differing bytes.
"""
if self._page_size != other._page_size:
raise SimMemoryError("SimPagedMemory page size... | python | def __changed_bytes(self, other):
"""
Gets the set of changed bytes between `self` and `other`.
:type other: SimPagedMemory
:returns: A set of differing bytes.
"""
if self._page_size != other._page_size:
raise SimMemoryError("SimPagedMemory page size... | [
"def",
"__changed_bytes",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"_page_size",
"!=",
"other",
".",
"_page_size",
":",
"raise",
"SimMemoryError",
"(",
"\"SimPagedMemory page sizes differ. This is asking for disaster.\"",
")",
"our_pages",
"=",
"set",
... | Gets the set of changed bytes between `self` and `other`.
:type other: SimPagedMemory
:returns: A set of differing bytes. | [
"Gets",
"the",
"set",
"of",
"changed",
"bytes",
"between",
"self",
"and",
"other",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L630-L697 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory._apply_object_to_page | def _apply_object_to_page(self, page_base, mo, page=None, overwrite=True):
"""
Writes a memory object to a `page`
:param page_base: The base address of the page.
:param mo: The memory object.
:param page: (optional) the page to use.
:param overwrite: ... | python | def _apply_object_to_page(self, page_base, mo, page=None, overwrite=True):
"""
Writes a memory object to a `page`
:param page_base: The base address of the page.
:param mo: The memory object.
:param page: (optional) the page to use.
:param overwrite: ... | [
"def",
"_apply_object_to_page",
"(",
"self",
",",
"page_base",
",",
"mo",
",",
"page",
"=",
"None",
",",
"overwrite",
"=",
"True",
")",
":",
"page_num",
"=",
"page_base",
"//",
"self",
".",
"_page_size",
"try",
":",
"page",
"=",
"self",
".",
"_get_page",... | Writes a memory object to a `page`
:param page_base: The base address of the page.
:param mo: The memory object.
:param page: (optional) the page to use.
:param overwrite: (optional) If False, only write to currently-empty memory. | [
"Writes",
"a",
"memory",
"object",
"to",
"a",
"page"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L703-L726 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.store_memory_object | def store_memory_object(self, mo, overwrite=True):
"""
This function optimizes a large store by storing a single reference to the :class:`SimMemoryObject` instead of
one for each byte.
:param memory_object: the memory object to store
"""
for p in self._containing_pages_... | python | def store_memory_object(self, mo, overwrite=True):
"""
This function optimizes a large store by storing a single reference to the :class:`SimMemoryObject` instead of
one for each byte.
:param memory_object: the memory object to store
"""
for p in self._containing_pages_... | [
"def",
"store_memory_object",
"(",
"self",
",",
"mo",
",",
"overwrite",
"=",
"True",
")",
":",
"for",
"p",
"in",
"self",
".",
"_containing_pages_mo",
"(",
"mo",
")",
":",
"self",
".",
"_apply_object_to_page",
"(",
"p",
",",
"mo",
",",
"overwrite",
"=",
... | This function optimizes a large store by storing a single reference to the :class:`SimMemoryObject` instead of
one for each byte.
:param memory_object: the memory object to store | [
"This",
"function",
"optimizes",
"a",
"large",
"store",
"by",
"storing",
"a",
"single",
"reference",
"to",
"the",
":",
"class",
":",
"SimMemoryObject",
"instead",
"of",
"one",
"for",
"each",
"byte",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L738-L749 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.replace_memory_object | def replace_memory_object(self, old, new_content):
"""
Replaces the memory object `old` with a new memory object containing `new_content`.
:param old: A SimMemoryObject (i.e., one from :func:`memory_objects_for_hash()` or :func:`
memory_objects_for_name()`).
... | python | def replace_memory_object(self, old, new_content):
"""
Replaces the memory object `old` with a new memory object containing `new_content`.
:param old: A SimMemoryObject (i.e., one from :func:`memory_objects_for_hash()` or :func:`
memory_objects_for_name()`).
... | [
"def",
"replace_memory_object",
"(",
"self",
",",
"old",
",",
"new_content",
")",
":",
"if",
"old",
".",
"object",
".",
"size",
"(",
")",
"!=",
"new_content",
".",
"size",
"(",
")",
":",
"raise",
"SimMemoryError",
"(",
"\"memory objects can only be replaced by... | Replaces the memory object `old` with a new memory object containing `new_content`.
:param old: A SimMemoryObject (i.e., one from :func:`memory_objects_for_hash()` or :func:`
memory_objects_for_name()`).
:param new_content: The content (claripy expression) for the ne... | [
"Replaces",
"the",
"memory",
"object",
"old",
"with",
"a",
"new",
"memory",
"object",
"containing",
"new_content",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L751-L771 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.replace_all | def replace_all(self, old, new):
"""
Replaces all instances of expression `old` with expression `new`.
:param old: A claripy expression. Must contain at least one named variable (to make it possible to use the
name index for speedup).
:param new: The new variable to ... | python | def replace_all(self, old, new):
"""
Replaces all instances of expression `old` with expression `new`.
:param old: A claripy expression. Must contain at least one named variable (to make it possible to use the
name index for speedup).
:param new: The new variable to ... | [
"def",
"replace_all",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"if",
"options",
".",
"REVERSE_MEMORY_NAME_MAP",
"not",
"in",
"self",
".",
"state",
".",
"options",
":",
"raise",
"SimMemoryError",
"(",
"\"replace_all is not doable without a reverse name mapping.... | Replaces all instances of expression `old` with expression `new`.
:param old: A claripy expression. Must contain at least one named variable (to make it possible to use the
name index for speedup).
:param new: The new variable to replace it with. | [
"Replaces",
"all",
"instances",
"of",
"expression",
"old",
"with",
"expression",
"new",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L773-L821 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.addrs_for_name | def addrs_for_name(self, n):
"""
Returns addresses that contain expressions that contain a variable named `n`.
"""
if n not in self._name_mapping:
return
self._mark_updated_mapping(self._name_mapping, n)
to_discard = set()
for e in self._name_mapping... | python | def addrs_for_name(self, n):
"""
Returns addresses that contain expressions that contain a variable named `n`.
"""
if n not in self._name_mapping:
return
self._mark_updated_mapping(self._name_mapping, n)
to_discard = set()
for e in self._name_mapping... | [
"def",
"addrs_for_name",
"(",
"self",
",",
"n",
")",
":",
"if",
"n",
"not",
"in",
"self",
".",
"_name_mapping",
":",
"return",
"self",
".",
"_mark_updated_mapping",
"(",
"self",
".",
"_name_mapping",
",",
"n",
")",
"to_discard",
"=",
"set",
"(",
")",
"... | Returns addresses that contain expressions that contain a variable named `n`. | [
"Returns",
"addresses",
"that",
"contain",
"expressions",
"that",
"contain",
"a",
"variable",
"named",
"n",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L926-L942 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.addrs_for_hash | def addrs_for_hash(self, h):
"""
Returns addresses that contain expressions that contain a variable with the hash of `h`.
"""
if h not in self._hash_mapping:
return
self._mark_updated_mapping(self._hash_mapping, h)
to_discard = set()
for e in self._h... | python | def addrs_for_hash(self, h):
"""
Returns addresses that contain expressions that contain a variable with the hash of `h`.
"""
if h not in self._hash_mapping:
return
self._mark_updated_mapping(self._hash_mapping, h)
to_discard = set()
for e in self._h... | [
"def",
"addrs_for_hash",
"(",
"self",
",",
"h",
")",
":",
"if",
"h",
"not",
"in",
"self",
".",
"_hash_mapping",
":",
"return",
"self",
".",
"_mark_updated_mapping",
"(",
"self",
".",
"_hash_mapping",
",",
"h",
")",
"to_discard",
"=",
"set",
"(",
")",
"... | Returns addresses that contain expressions that contain a variable with the hash of `h`. | [
"Returns",
"addresses",
"that",
"contain",
"expressions",
"that",
"contain",
"a",
"variable",
"with",
"the",
"hash",
"of",
"h",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L944-L960 | train |
angr/angr | angr/storage/paged_memory.py | SimPagedMemory.flush_pages | def flush_pages(self, white_list):
"""
:param white_list: white list of page number to exclude from the flush
"""
white_list_page_number = []
for addr in white_list:
for page_addr in range(addr[0], addr[1], self._page_size):
white_list_page_number... | python | def flush_pages(self, white_list):
"""
:param white_list: white list of page number to exclude from the flush
"""
white_list_page_number = []
for addr in white_list:
for page_addr in range(addr[0], addr[1], self._page_size):
white_list_page_number... | [
"def",
"flush_pages",
"(",
"self",
",",
"white_list",
")",
":",
"white_list_page_number",
"=",
"[",
"]",
"for",
"addr",
"in",
"white_list",
":",
"for",
"page_addr",
"in",
"range",
"(",
"addr",
"[",
"0",
"]",
",",
"addr",
"[",
"1",
"]",
",",
"self",
"... | :param white_list: white list of page number to exclude from the flush | [
":",
"param",
"white_list",
":",
"white",
"list",
"of",
"page",
"number",
"to",
"exclude",
"from",
"the",
"flush"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/paged_memory.py#L1079-L1098 | train |
angr/angr | angr/state_plugins/posix.py | SimSystemPosix.open | def open(self, name, flags, preferred_fd=None):
"""
Open a symbolic file. Basically open(2).
:param name: Path of the symbolic file, as a string or bytes.
:type name: string or bytes
:param flags: File operation flags, a bitfield of constants fro... | python | def open(self, name, flags, preferred_fd=None):
"""
Open a symbolic file. Basically open(2).
:param name: Path of the symbolic file, as a string or bytes.
:type name: string or bytes
:param flags: File operation flags, a bitfield of constants fro... | [
"def",
"open",
"(",
"self",
",",
"name",
",",
"flags",
",",
"preferred_fd",
"=",
"None",
")",
":",
"if",
"len",
"(",
"name",
")",
"==",
"0",
":",
"return",
"None",
"if",
"type",
"(",
"name",
")",
"is",
"str",
":",
"name",
"=",
"name",
".",
"enc... | Open a symbolic file. Basically open(2).
:param name: Path of the symbolic file, as a string or bytes.
:type name: string or bytes
:param flags: File operation flags, a bitfield of constants from open(2), as an AST
:param preferred_fd: Assign this fd ... | [
"Open",
"a",
"symbolic",
"file",
".",
"Basically",
"open",
"(",
"2",
")",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L267-L316 | train |
angr/angr | angr/state_plugins/posix.py | SimSystemPosix.get_fd | def get_fd(self, fd):
"""
Looks up the SimFileDescriptor associated with the given number (an AST).
If the number is concrete and does not map to anything, return None.
If the number is symbolic, constrain it to an open fd and create a new file for it.
"""
try:
... | python | def get_fd(self, fd):
"""
Looks up the SimFileDescriptor associated with the given number (an AST).
If the number is concrete and does not map to anything, return None.
If the number is symbolic, constrain it to an open fd and create a new file for it.
"""
try:
... | [
"def",
"get_fd",
"(",
"self",
",",
"fd",
")",
":",
"try",
":",
"fd",
"=",
"self",
".",
"state",
".",
"solver",
".",
"eval_one",
"(",
"fd",
")",
"except",
"SimSolverError",
":",
"ideal",
"=",
"self",
".",
"_pick_fd",
"(",
")",
"self",
".",
"state",
... | Looks up the SimFileDescriptor associated with the given number (an AST).
If the number is concrete and does not map to anything, return None.
If the number is symbolic, constrain it to an open fd and create a new file for it. | [
"Looks",
"up",
"the",
"SimFileDescriptor",
"associated",
"with",
"the",
"given",
"number",
"(",
"an",
"AST",
")",
".",
"If",
"the",
"number",
"is",
"concrete",
"and",
"does",
"not",
"map",
"to",
"anything",
"return",
"None",
".",
"If",
"the",
"number",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L355-L375 | train |
angr/angr | angr/state_plugins/posix.py | SimSystemPosix.close | def close(self, fd):
"""
Closes the given file descriptor (an AST).
Returns whether the operation succeeded (a concrete boolean)
"""
try:
fd = self.state.solver.eval_one(fd)
except SimSolverError:
l.error("Trying to close a symbolic file descriptor... | python | def close(self, fd):
"""
Closes the given file descriptor (an AST).
Returns whether the operation succeeded (a concrete boolean)
"""
try:
fd = self.state.solver.eval_one(fd)
except SimSolverError:
l.error("Trying to close a symbolic file descriptor... | [
"def",
"close",
"(",
"self",
",",
"fd",
")",
":",
"try",
":",
"fd",
"=",
"self",
".",
"state",
".",
"solver",
".",
"eval_one",
"(",
"fd",
")",
"except",
"SimSolverError",
":",
"l",
".",
"error",
"(",
"\"Trying to close a symbolic file descriptor\"",
")",
... | Closes the given file descriptor (an AST).
Returns whether the operation succeeded (a concrete boolean) | [
"Closes",
"the",
"given",
"file",
"descriptor",
"(",
"an",
"AST",
")",
".",
"Returns",
"whether",
"the",
"operation",
"succeeded",
"(",
"a",
"concrete",
"boolean",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L377-L396 | train |
angr/angr | angr/state_plugins/posix.py | SimSystemPosix.sigmask | def sigmask(self, sigsetsize=None):
"""
Gets the current sigmask. If it's blank, a new one is created (of sigsetsize).
:param sigsetsize: the size (in *bytes* of the sigmask set)
:return: the sigmask
"""
if self._sigmask is None:
if sigsetsize is not None:
... | python | def sigmask(self, sigsetsize=None):
"""
Gets the current sigmask. If it's blank, a new one is created (of sigsetsize).
:param sigsetsize: the size (in *bytes* of the sigmask set)
:return: the sigmask
"""
if self._sigmask is None:
if sigsetsize is not None:
... | [
"def",
"sigmask",
"(",
"self",
",",
"sigsetsize",
"=",
"None",
")",
":",
"if",
"self",
".",
"_sigmask",
"is",
"None",
":",
"if",
"sigsetsize",
"is",
"not",
"None",
":",
"sc",
"=",
"self",
".",
"state",
".",
"solver",
".",
"eval",
"(",
"sigsetsize",
... | Gets the current sigmask. If it's blank, a new one is created (of sigsetsize).
:param sigsetsize: the size (in *bytes* of the sigmask set)
:return: the sigmask | [
"Gets",
"the",
"current",
"sigmask",
".",
"If",
"it",
"s",
"blank",
"a",
"new",
"one",
"is",
"created",
"(",
"of",
"sigsetsize",
")",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L425-L439 | train |
angr/angr | angr/state_plugins/posix.py | SimSystemPosix.sigprocmask | def sigprocmask(self, how, new_mask, sigsetsize, valid_ptr=True):
"""
Updates the signal mask.
:param how: the "how" argument of sigprocmask (see manpage)
:param new_mask: the mask modification to apply
:param sigsetsize: the size (in *bytes* of the sigmask set)
:param v... | python | def sigprocmask(self, how, new_mask, sigsetsize, valid_ptr=True):
"""
Updates the signal mask.
:param how: the "how" argument of sigprocmask (see manpage)
:param new_mask: the mask modification to apply
:param sigsetsize: the size (in *bytes* of the sigmask set)
:param v... | [
"def",
"sigprocmask",
"(",
"self",
",",
"how",
",",
"new_mask",
",",
"sigsetsize",
",",
"valid_ptr",
"=",
"True",
")",
":",
"oldmask",
"=",
"self",
".",
"sigmask",
"(",
"sigsetsize",
")",
"self",
".",
"_sigmask",
"=",
"self",
".",
"state",
".",
"solver... | Updates the signal mask.
:param how: the "how" argument of sigprocmask (see manpage)
:param new_mask: the mask modification to apply
:param sigsetsize: the size (in *bytes* of the sigmask set)
:param valid_ptr: is set if the new_mask was not NULL | [
"Updates",
"the",
"signal",
"mask",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L441-L463 | train |
angr/angr | angr/state_plugins/posix.py | SimSystemPosix.dump_file_by_path | def dump_file_by_path(self, path, **kwargs):
"""
Returns the concrete content for a file by path.
:param path: file path as string
:param kwargs: passed to state.solver.eval
:return: file contents as string
"""
file = self.state.fs.get(path)
if file is No... | python | def dump_file_by_path(self, path, **kwargs):
"""
Returns the concrete content for a file by path.
:param path: file path as string
:param kwargs: passed to state.solver.eval
:return: file contents as string
"""
file = self.state.fs.get(path)
if file is No... | [
"def",
"dump_file_by_path",
"(",
"self",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"file",
"=",
"self",
".",
"state",
".",
"fs",
".",
"get",
"(",
"path",
")",
"if",
"file",
"is",
"None",
":",
"return",
"None",
"return",
"file",
".",
"concreti... | Returns the concrete content for a file by path.
:param path: file path as string
:param kwargs: passed to state.solver.eval
:return: file contents as string | [
"Returns",
"the",
"concrete",
"content",
"for",
"a",
"file",
"by",
"path",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L540-L551 | train |
angr/angr | angr/state_plugins/posix.py | SimSystemPosix.dumps | def dumps(self, fd, **kwargs):
"""
Returns the concrete content for a file descriptor.
BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout,
or stderr as a flat string.
:param fd: A file descriptor.
:return: Th... | python | def dumps(self, fd, **kwargs):
"""
Returns the concrete content for a file descriptor.
BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout,
or stderr as a flat string.
:param fd: A file descriptor.
:return: Th... | [
"def",
"dumps",
"(",
"self",
",",
"fd",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"0",
"<=",
"fd",
"<=",
"2",
":",
"data",
"=",
"[",
"self",
".",
"stdin",
",",
"self",
".",
"stdout",
",",
"self",
".",
"stderr",
"]",
"[",
"fd",
"]",
".",
"con... | Returns the concrete content for a file descriptor.
BACKWARD COMPATIBILITY: if you ask for file descriptors 0 1 or 2, it will return the data from stdin, stdout,
or stderr as a flat string.
:param fd: A file descriptor.
:return: The concrete content.
:rtype: str | [
"Returns",
"the",
"concrete",
"content",
"for",
"a",
"file",
"descriptor",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/posix.py#L553-L569 | train |
angr/angr | angr/engines/concrete.py | SimEngineConcrete.to_engine | def to_engine(self, state, extra_stop_points, concretize, timeout):
"""
Handle the concrete execution of the process
This method takes care of:
1- Set the breakpoints on the addresses provided by the user
2- Concretize the symbolic variables and perform the write inside the concr... | python | def to_engine(self, state, extra_stop_points, concretize, timeout):
"""
Handle the concrete execution of the process
This method takes care of:
1- Set the breakpoints on the addresses provided by the user
2- Concretize the symbolic variables and perform the write inside the concr... | [
"def",
"to_engine",
"(",
"self",
",",
"state",
",",
"extra_stop_points",
",",
"concretize",
",",
"timeout",
")",
":",
"state",
".",
"timeout",
"=",
"False",
"state",
".",
"errored",
"=",
"False",
"extra_stop_points",
"=",
"[",
"]",
"if",
"extra_stop_points",... | Handle the concrete execution of the process
This method takes care of:
1- Set the breakpoints on the addresses provided by the user
2- Concretize the symbolic variables and perform the write inside the concrete process
3- Continue the program execution.
:param state: ... | [
"Handle",
"the",
"concrete",
"execution",
"of",
"the",
"process",
"This",
"method",
"takes",
"care",
"of",
":",
"1",
"-",
"Set",
"the",
"breakpoints",
"on",
"the",
"addresses",
"provided",
"by",
"the",
"user",
"2",
"-",
"Concretize",
"the",
"symbolic",
"va... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/concrete.py#L56-L128 | train |
angr/angr | angr/engines/concrete.py | SimEngineConcrete.check_concrete_target_methods | def check_concrete_target_methods(concrete_target):
"""
Check if the concrete target methods return the correct type of data
:return: True if the concrete target is compliant
"""
entry_point = concrete_target.read_register("pc")
if not type(entry_point) is int:
... | python | def check_concrete_target_methods(concrete_target):
"""
Check if the concrete target methods return the correct type of data
:return: True if the concrete target is compliant
"""
entry_point = concrete_target.read_register("pc")
if not type(entry_point) is int:
... | [
"def",
"check_concrete_target_methods",
"(",
"concrete_target",
")",
":",
"entry_point",
"=",
"concrete_target",
".",
"read_register",
"(",
"\"pc\"",
")",
"if",
"not",
"type",
"(",
"entry_point",
")",
"is",
"int",
":",
"l",
".",
"error",
"(",
"\"read_register re... | Check if the concrete target methods return the correct type of data
:return: True if the concrete target is compliant | [
"Check",
"if",
"the",
"concrete",
"target",
"methods",
"return",
"the",
"correct",
"type",
"of",
"data",
":",
"return",
":",
"True",
"if",
"the",
"concrete",
"target",
"is",
"compliant"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/concrete.py#L131-L163 | train |
angr/angr | angr/engines/vex/engine.py | SimEngineVEX.process | def process(self, state,
irsb=None,
skip_stmts=0,
last_stmt=99999999,
whitelist=None,
inline=False,
force_addr=None,
insn_bytes=None,
size=None,
num_inst=None,
traceflags=0,
thumb=False,
... | python | def process(self, state,
irsb=None,
skip_stmts=0,
last_stmt=99999999,
whitelist=None,
inline=False,
force_addr=None,
insn_bytes=None,
size=None,
num_inst=None,
traceflags=0,
thumb=False,
... | [
"def",
"process",
"(",
"self",
",",
"state",
",",
"irsb",
"=",
"None",
",",
"skip_stmts",
"=",
"0",
",",
"last_stmt",
"=",
"99999999",
",",
"whitelist",
"=",
"None",
",",
"inline",
"=",
"False",
",",
"force_addr",
"=",
"None",
",",
"insn_bytes",
"=",
... | :param state: The state with which to execute
:param irsb: The PyVEX IRSB object to use for execution. If not provided one will be lifted.
:param skip_stmts: The number of statements to skip in processing
:param last_stmt: Do not execute any statements after this statement
... | [
":",
"param",
"state",
":",
"The",
"state",
"with",
"which",
"to",
"execute",
":",
"param",
"irsb",
":",
"The",
"PyVEX",
"IRSB",
"object",
"to",
"use",
"for",
"execution",
".",
"If",
"not",
"provided",
"one",
"will",
"be",
"lifted",
".",
":",
"param",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L88-L147 | train |
angr/angr | angr/engines/vex/engine.py | SimEngineVEX._handle_statement | def _handle_statement(self, state, successors, stmt):
"""
This function receives an initial state and imark and processes a list of pyvex.IRStmts
It annotates the request with a final state, last imark, and a list of SimIRStmts
"""
if type(stmt) == pyvex.IRStmt.IMark:
... | python | def _handle_statement(self, state, successors, stmt):
"""
This function receives an initial state and imark and processes a list of pyvex.IRStmts
It annotates the request with a final state, last imark, and a list of SimIRStmts
"""
if type(stmt) == pyvex.IRStmt.IMark:
... | [
"def",
"_handle_statement",
"(",
"self",
",",
"state",
",",
"successors",
",",
"stmt",
")",
":",
"if",
"type",
"(",
"stmt",
")",
"==",
"pyvex",
".",
"IRStmt",
".",
"IMark",
":",
"# TODO how much of this could be moved into the imark handler",
"ins_addr",
"=",
"s... | This function receives an initial state and imark and processes a list of pyvex.IRStmts
It annotates the request with a final state, last imark, and a list of SimIRStmts | [
"This",
"function",
"receives",
"an",
"initial",
"state",
"and",
"imark",
"and",
"processes",
"a",
"list",
"of",
"pyvex",
".",
"IRStmts",
"It",
"annotates",
"the",
"request",
"with",
"a",
"final",
"state",
"last",
"imark",
"and",
"a",
"list",
"of",
"SimIRS... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L362-L439 | train |
angr/angr | angr/engines/vex/engine.py | SimEngineVEX.lift | def lift(self,
state=None,
clemory=None,
insn_bytes=None,
arch=None,
addr=None,
size=None,
num_inst=None,
traceflags=0,
thumb=False,
extra_stop_points=None,
opt_level=None,
... | python | def lift(self,
state=None,
clemory=None,
insn_bytes=None,
arch=None,
addr=None,
size=None,
num_inst=None,
traceflags=0,
thumb=False,
extra_stop_points=None,
opt_level=None,
... | [
"def",
"lift",
"(",
"self",
",",
"state",
"=",
"None",
",",
"clemory",
"=",
"None",
",",
"insn_bytes",
"=",
"None",
",",
"arch",
"=",
"None",
",",
"addr",
"=",
"None",
",",
"size",
"=",
"None",
",",
"num_inst",
"=",
"None",
",",
"traceflags",
"=",
... | Lift an IRSB.
There are many possible valid sets of parameters. You at the very least must pass some
source of data, some source of an architecture, and some source of an address.
Sources of data in order of priority: insn_bytes, clemory, state
Sources of an address, in order of prior... | [
"Lift",
"an",
"IRSB",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/engine.py#L466-L641 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.