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/utils/library.py | get_function_name | def get_function_name(s):
"""
Get the function name from a C-style function declaration string.
:param str s: A C-style function declaration string.
:return: The function name.
:rtype: str
"""
s = s.strip()
if s.startswith("__attribute__"):
# Remove "__attribute__ ((... | python | def get_function_name(s):
"""
Get the function name from a C-style function declaration string.
:param str s: A C-style function declaration string.
:return: The function name.
:rtype: str
"""
s = s.strip()
if s.startswith("__attribute__"):
# Remove "__attribute__ ((... | [
"def",
"get_function_name",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"strip",
"(",
")",
"if",
"s",
".",
"startswith",
"(",
"\"__attribute__\"",
")",
":",
"# Remove \"__attribute__ ((foobar))\"",
"if",
"\"))\"",
"not",
"in",
"s",
":",
"raise",
"ValueError",
... | Get the function name from a C-style function declaration string.
:param str s: A C-style function declaration string.
:return: The function name.
:rtype: str | [
"Get",
"the",
"function",
"name",
"from",
"a",
"C",
"-",
"style",
"function",
"declaration",
"string",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/utils/library.py#L5-L36 | train |
angr/angr | angr/utils/library.py | convert_cproto_to_py | def convert_cproto_to_py(c_decl):
"""
Convert a C-style function declaration string to its corresponding SimTypes-based Python representation.
:param str c_decl: The C-style function declaration string.
:return: A tuple of the function name, the prototype, and a stri... | python | def convert_cproto_to_py(c_decl):
"""
Convert a C-style function declaration string to its corresponding SimTypes-based Python representation.
:param str c_decl: The C-style function declaration string.
:return: A tuple of the function name, the prototype, and a stri... | [
"def",
"convert_cproto_to_py",
"(",
"c_decl",
")",
":",
"s",
"=",
"[",
"]",
"try",
":",
"s",
".",
"append",
"(",
"'# %s'",
"%",
"c_decl",
")",
"# comment string",
"parsed",
"=",
"parse_file",
"(",
"c_decl",
")",
"parsed_decl",
"=",
"parsed",
"[",
"0",
... | Convert a C-style function declaration string to its corresponding SimTypes-based Python representation.
:param str c_decl: The C-style function declaration string.
:return: A tuple of the function name, the prototype, and a string representing the
... | [
"Convert",
"a",
"C",
"-",
"style",
"function",
"declaration",
"string",
"to",
"its",
"corresponding",
"SimTypes",
"-",
"based",
"Python",
"representation",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/utils/library.py#L39-L73 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | PTChunk.set_size | def set_size(self, size, is_free=None): #pylint:disable=arguments-differ
"""
Use this to set the size on a chunk. When the chunk is new (such as when a free chunk is shrunk to form an
allocated chunk and a remainder free chunk) it is recommended that the is_free hint be used since setting the
... | python | def set_size(self, size, is_free=None): #pylint:disable=arguments-differ
"""
Use this to set the size on a chunk. When the chunk is new (such as when a free chunk is shrunk to form an
allocated chunk and a remainder free chunk) it is recommended that the is_free hint be used since setting the
... | [
"def",
"set_size",
"(",
"self",
",",
"size",
",",
"is_free",
"=",
"None",
")",
":",
"#pylint:disable=arguments-differ",
"self",
".",
"_set_leading_size",
"(",
"size",
")",
"next_chunk",
"=",
"self",
".",
"next_chunk",
"(",
")",
"if",
"is_free",
"is",
"not",
... | Use this to set the size on a chunk. When the chunk is new (such as when a free chunk is shrunk to form an
allocated chunk and a remainder free chunk) it is recommended that the is_free hint be used since setting the
size depends on the chunk's freeness, and vice versa.
:param size: size of the... | [
"Use",
"this",
"to",
"set",
"the",
"size",
"on",
"a",
"chunk",
".",
"When",
"the",
"chunk",
"is",
"new",
"(",
"such",
"as",
"when",
"a",
"free",
"chunk",
"is",
"shrunk",
"to",
"form",
"an",
"allocated",
"chunk",
"and",
"a",
"remainder",
"free",
"chun... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L64-L82 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | PTChunk.set_prev_freeness | def set_prev_freeness(self, is_free):
"""
Sets (or unsets) the flag controlling whether the previous chunk is free.
:param is_free: if True, sets the previous chunk to be free; if False, sets it to be allocated
"""
level = silence_logger()
size_field = self.state.memory.... | python | def set_prev_freeness(self, is_free):
"""
Sets (or unsets) the flag controlling whether the previous chunk is free.
:param is_free: if True, sets the previous chunk to be free; if False, sets it to be allocated
"""
level = silence_logger()
size_field = self.state.memory.... | [
"def",
"set_prev_freeness",
"(",
"self",
",",
"is_free",
")",
":",
"level",
"=",
"silence_logger",
"(",
")",
"size_field",
"=",
"self",
".",
"state",
".",
"memory",
".",
"load",
"(",
"self",
".",
"base",
"+",
"self",
".",
"_chunk_size_t_size",
",",
"self... | Sets (or unsets) the flag controlling whether the previous chunk is free.
:param is_free: if True, sets the previous chunk to be free; if False, sets it to be allocated | [
"Sets",
"(",
"or",
"unsets",
")",
"the",
"flag",
"controlling",
"whether",
"the",
"previous",
"chunk",
"is",
"free",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L84-L96 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | PTChunk.is_prev_free | def is_prev_free(self):
"""
Returns a concrete state of the flag indicating whether the previous chunk is free or not. Issues a warning if
that flag is symbolic and has multiple solutions, and then assumes that the previous chunk is free.
:returns: True if the previous chunk is free; Fa... | python | def is_prev_free(self):
"""
Returns a concrete state of the flag indicating whether the previous chunk is free or not. Issues a warning if
that flag is symbolic and has multiple solutions, and then assumes that the previous chunk is free.
:returns: True if the previous chunk is free; Fa... | [
"def",
"is_prev_free",
"(",
"self",
")",
":",
"flag",
"=",
"self",
".",
"state",
".",
"memory",
".",
"load",
"(",
"self",
".",
"base",
"+",
"self",
".",
"_chunk_size_t_size",
",",
"self",
".",
"_chunk_size_t_size",
")",
"&",
"CHUNK_P_MASK",
"def",
"sym_f... | Returns a concrete state of the flag indicating whether the previous chunk is free or not. Issues a warning if
that flag is symbolic and has multiple solutions, and then assumes that the previous chunk is free.
:returns: True if the previous chunk is free; False otherwise | [
"Returns",
"a",
"concrete",
"state",
"of",
"the",
"flag",
"indicating",
"whether",
"the",
"previous",
"chunk",
"is",
"free",
"or",
"not",
".",
"Issues",
"a",
"warning",
"if",
"that",
"flag",
"is",
"symbolic",
"and",
"has",
"multiple",
"solutions",
"and",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L98-L112 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | PTChunk.prev_size | def prev_size(self):
"""
Returns the size of the previous chunk, masking off what would be the flag bits if it were in the actual size
field. Performs NO CHECKING to determine whether the previous chunk size is valid (for example, when the
previous chunk is not free, its size cannot be d... | python | def prev_size(self):
"""
Returns the size of the previous chunk, masking off what would be the flag bits if it were in the actual size
field. Performs NO CHECKING to determine whether the previous chunk size is valid (for example, when the
previous chunk is not free, its size cannot be d... | [
"def",
"prev_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"state",
".",
"memory",
".",
"load",
"(",
"self",
".",
"base",
",",
"self",
".",
"_chunk_size_t_size",
")",
"&",
"~",
"CHUNK_FLAGS_MASK"
] | Returns the size of the previous chunk, masking off what would be the flag bits if it were in the actual size
field. Performs NO CHECKING to determine whether the previous chunk size is valid (for example, when the
previous chunk is not free, its size cannot be determined). | [
"Returns",
"the",
"size",
"of",
"the",
"previous",
"chunk",
"masking",
"off",
"what",
"would",
"be",
"the",
"flag",
"bits",
"if",
"it",
"were",
"in",
"the",
"actual",
"size",
"field",
".",
"Performs",
"NO",
"CHECKING",
"to",
"determine",
"whether",
"the",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L114-L120 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | PTChunk.next_chunk | def next_chunk(self):
"""
Returns the chunk immediately following (and adjacent to) this one, if it exists.
:returns: The following chunk, or None if applicable
"""
def sym_base_handler(base):
l.warning("A computed chunk base is symbolic; maximizing it")
... | python | def next_chunk(self):
"""
Returns the chunk immediately following (and adjacent to) this one, if it exists.
:returns: The following chunk, or None if applicable
"""
def sym_base_handler(base):
l.warning("A computed chunk base is symbolic; maximizing it")
... | [
"def",
"next_chunk",
"(",
"self",
")",
":",
"def",
"sym_base_handler",
"(",
"base",
")",
":",
"l",
".",
"warning",
"(",
"\"A computed chunk base is symbolic; maximizing it\"",
")",
"return",
"self",
".",
"state",
".",
"solver",
".",
"max_int",
"(",
"base",
")"... | Returns the chunk immediately following (and adjacent to) this one, if it exists.
:returns: The following chunk, or None if applicable | [
"Returns",
"the",
"chunk",
"immediately",
"following",
"(",
"and",
"adjacent",
"to",
")",
"this",
"one",
"if",
"it",
"exists",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L143-L158 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | PTChunk.prev_chunk | def prev_chunk(self):
"""
Returns the chunk immediately prior (and adjacent) to this one, if that chunk is free. If the prior chunk is not
free, then its base cannot be located and this method raises an error.
:returns: If possible, the previous chunk; otherwise, raises an error
... | python | def prev_chunk(self):
"""
Returns the chunk immediately prior (and adjacent) to this one, if that chunk is free. If the prior chunk is not
free, then its base cannot be located and this method raises an error.
:returns: If possible, the previous chunk; otherwise, raises an error
... | [
"def",
"prev_chunk",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_prev_free",
"(",
")",
":",
"return",
"PTChunk",
"(",
"self",
".",
"base",
"-",
"self",
".",
"prev_size",
"(",
")",
",",
"self",
".",
"state",
")",
"else",
":",
"raise",
"SimHeapError"... | Returns the chunk immediately prior (and adjacent) to this one, if that chunk is free. If the prior chunk is not
free, then its base cannot be located and this method raises an error.
:returns: If possible, the previous chunk; otherwise, raises an error | [
"Returns",
"the",
"chunk",
"immediately",
"prior",
"(",
"and",
"adjacent",
")",
"to",
"this",
"one",
"if",
"that",
"chunk",
"is",
"free",
".",
"If",
"the",
"prior",
"chunk",
"is",
"not",
"free",
"then",
"its",
"base",
"cannot",
"be",
"located",
"and",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L160-L170 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | PTChunk.fwd_chunk | def fwd_chunk(self):
"""
Returns the chunk following this chunk in the list of free chunks. If this chunk is not free, then it resides in
no such list and this method raises an error.
:returns: If possible, the forward chunk; otherwise, raises an error
"""
if self.is_fre... | python | def fwd_chunk(self):
"""
Returns the chunk following this chunk in the list of free chunks. If this chunk is not free, then it resides in
no such list and this method raises an error.
:returns: If possible, the forward chunk; otherwise, raises an error
"""
if self.is_fre... | [
"def",
"fwd_chunk",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_free",
"(",
")",
":",
"base",
"=",
"self",
".",
"state",
".",
"memory",
".",
"load",
"(",
"self",
".",
"base",
"+",
"2",
"*",
"self",
".",
"_chunk_size_t_size",
",",
"self",
".",
"... | Returns the chunk following this chunk in the list of free chunks. If this chunk is not free, then it resides in
no such list and this method raises an error.
:returns: If possible, the forward chunk; otherwise, raises an error | [
"Returns",
"the",
"chunk",
"following",
"this",
"chunk",
"in",
"the",
"list",
"of",
"free",
"chunks",
".",
"If",
"this",
"chunk",
"is",
"not",
"free",
"then",
"it",
"resides",
"in",
"no",
"such",
"list",
"and",
"this",
"method",
"raises",
"an",
"error",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L172-L183 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | SimHeapPTMalloc.chunk_from_mem | def chunk_from_mem(self, ptr):
"""
Given a pointer to a user payload, return the base of the chunk associated with that payload (i.e. the chunk
pointer). Returns None if ptr is null.
:param ptr: a pointer to the base of a user payload in the heap
:returns: a pointer to the base ... | python | def chunk_from_mem(self, ptr):
"""
Given a pointer to a user payload, return the base of the chunk associated with that payload (i.e. the chunk
pointer). Returns None if ptr is null.
:param ptr: a pointer to the base of a user payload in the heap
:returns: a pointer to the base ... | [
"def",
"chunk_from_mem",
"(",
"self",
",",
"ptr",
")",
":",
"if",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
"(",
"ptr",
")",
":",
"try",
":",
"ptr",
"=",
"self",
".",
"state",
".",
"solver",
".",
"eval_one",
"(",
"ptr",
")",
"except",
... | Given a pointer to a user payload, return the base of the chunk associated with that payload (i.e. the chunk
pointer). Returns None if ptr is null.
:param ptr: a pointer to the base of a user payload in the heap
:returns: a pointer to the base of the associated heap chunk, or None if ptr is nul... | [
"Given",
"a",
"pointer",
"to",
"a",
"user",
"payload",
"return",
"the",
"base",
"of",
"the",
"chunk",
"associated",
"with",
"that",
"payload",
"(",
"i",
".",
"e",
".",
"the",
"chunk",
"pointer",
")",
".",
"Returns",
"None",
"if",
"ptr",
"is",
"null",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L263-L279 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | SimHeapPTMalloc._find_bck | def _find_bck(self, chunk):
"""
Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head
and all other metadata are unaltered by this function.
"""
cur = self.free_head_chunk
if cur is None:
return None
... | python | def _find_bck(self, chunk):
"""
Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head
and all other metadata are unaltered by this function.
"""
cur = self.free_head_chunk
if cur is None:
return None
... | [
"def",
"_find_bck",
"(",
"self",
",",
"chunk",
")",
":",
"cur",
"=",
"self",
".",
"free_head_chunk",
"if",
"cur",
"is",
"None",
":",
"return",
"None",
"fwd",
"=",
"cur",
".",
"fwd_chunk",
"(",
")",
"if",
"cur",
"==",
"fwd",
":",
"return",
"cur",
"#... | Simply finds the free chunk that would be the backwards chunk relative to the chunk at ptr. Hence, the free head
and all other metadata are unaltered by this function. | [
"Simply",
"finds",
"the",
"free",
"chunk",
"that",
"would",
"be",
"the",
"backwards",
"chunk",
"relative",
"to",
"the",
"chunk",
"at",
"ptr",
".",
"Hence",
"the",
"free",
"head",
"and",
"all",
"other",
"metadata",
"are",
"unaltered",
"by",
"this",
"functio... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L281-L302 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | SimHeapPTMalloc._set_final_freeness | def _set_final_freeness(self, flag):
"""
Sets the freedom of the final chunk. Since no proper chunk follows the final chunk, the heap itself manages
this. Nonetheless, for now it is implemented as if an additional chunk followed the final chunk.
"""
if flag:
self.stat... | python | def _set_final_freeness(self, flag):
"""
Sets the freedom of the final chunk. Since no proper chunk follows the final chunk, the heap itself manages
this. Nonetheless, for now it is implemented as if an additional chunk followed the final chunk.
"""
if flag:
self.stat... | [
"def",
"_set_final_freeness",
"(",
"self",
",",
"flag",
")",
":",
"if",
"flag",
":",
"self",
".",
"state",
".",
"memory",
".",
"store",
"(",
"self",
".",
"heap_base",
"+",
"self",
".",
"heap_size",
"-",
"self",
".",
"_chunk_size_t_size",
",",
"~",
"CHU... | Sets the freedom of the final chunk. Since no proper chunk follows the final chunk, the heap itself manages
this. Nonetheless, for now it is implemented as if an additional chunk followed the final chunk. | [
"Sets",
"the",
"freedom",
"of",
"the",
"final",
"chunk",
".",
"Since",
"no",
"proper",
"chunk",
"follows",
"the",
"final",
"chunk",
"the",
"heap",
"itself",
"manages",
"this",
".",
"Nonetheless",
"for",
"now",
"it",
"is",
"implemented",
"as",
"if",
"an",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L304-L312 | train |
angr/angr | angr/state_plugins/heap/heap_ptmalloc.py | SimHeapPTMalloc._make_chunk_size | def _make_chunk_size(self, req_size):
"""
Takes an allocation size as requested by the user and modifies it to be a suitable chunk size.
"""
size = req_size
size += 2 * self._chunk_size_t_size # Two size fields
size = self._chunk_min_size if size < self._chunk_min_size e... | python | def _make_chunk_size(self, req_size):
"""
Takes an allocation size as requested by the user and modifies it to be a suitable chunk size.
"""
size = req_size
size += 2 * self._chunk_size_t_size # Two size fields
size = self._chunk_min_size if size < self._chunk_min_size e... | [
"def",
"_make_chunk_size",
"(",
"self",
",",
"req_size",
")",
":",
"size",
"=",
"req_size",
"size",
"+=",
"2",
"*",
"self",
".",
"_chunk_size_t_size",
"# Two size fields",
"size",
"=",
"self",
".",
"_chunk_min_size",
"if",
"size",
"<",
"self",
".",
"_chunk_m... | Takes an allocation size as requested by the user and modifies it to be a suitable chunk size. | [
"Takes",
"an",
"allocation",
"size",
"as",
"requested",
"by",
"the",
"user",
"and",
"modifies",
"it",
"to",
"be",
"a",
"suitable",
"chunk",
"size",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_ptmalloc.py#L314-L323 | train |
angr/angr | angr/engines/soot/values/strref.py | SimSootValue_StringRef.new_string | def new_string(state, value):
"""
Allocate and initialize a new string in the context of the state passed.
The method returns the reference to the newly allocated string
:param state: angr state where we want to allocate the string
:type SimState
:param value: value of ... | python | def new_string(state, value):
"""
Allocate and initialize a new string in the context of the state passed.
The method returns the reference to the newly allocated string
:param state: angr state where we want to allocate the string
:type SimState
:param value: value of ... | [
"def",
"new_string",
"(",
"state",
",",
"value",
")",
":",
"str_ref",
"=",
"SimSootValue_StringRef",
"(",
"state",
".",
"memory",
".",
"get_new_uuid",
"(",
")",
")",
"state",
".",
"memory",
".",
"store",
"(",
"str_ref",
",",
"value",
")",
"return",
"str_... | Allocate and initialize a new string in the context of the state passed.
The method returns the reference to the newly allocated string
:param state: angr state where we want to allocate the string
:type SimState
:param value: value of the string to initialize
:type claripy.Str... | [
"Allocate",
"and",
"initialize",
"a",
"new",
"string",
"in",
"the",
"context",
"of",
"the",
"state",
"passed",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/soot/values/strref.py#L26-L41 | train |
angr/angr | angr/procedures/libc/strtol.py | strtol.strtol_inner | def strtol_inner(s, state, region, base, signed, read_length=None):
"""
:param s: the string address/offset
:param state: SimState
:param region: memory, file, etc
:param base: the base to use to interpret the number
note: all numbers may start with +/- and base 16 may st... | python | def strtol_inner(s, state, region, base, signed, read_length=None):
"""
:param s: the string address/offset
:param state: SimState
:param region: memory, file, etc
:param base: the base to use to interpret the number
note: all numbers may start with +/- and base 16 may st... | [
"def",
"strtol_inner",
"(",
"s",
",",
"state",
",",
"region",
",",
"base",
",",
"signed",
",",
"read_length",
"=",
"None",
")",
":",
"# sanity check",
"if",
"base",
"<",
"2",
"or",
"base",
">",
"36",
":",
"raise",
"SimProcedureError",
"(",
"\"base should... | :param s: the string address/offset
:param state: SimState
:param region: memory, file, etc
:param base: the base to use to interpret the number
note: all numbers may start with +/- and base 16 may start with 0x
:param signed: boolean, true means the result will be signed, otherw... | [
":",
"param",
"s",
":",
"the",
"string",
"address",
"/",
"offset",
":",
"param",
"state",
":",
"SimState",
":",
"param",
"region",
":",
"memory",
"file",
"etc",
":",
"param",
"base",
":",
"the",
"base",
"to",
"use",
"to",
"interpret",
"the",
"number",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L15-L55 | train |
angr/angr | angr/procedures/libc/strtol.py | strtol._load_num_with_prefix | def _load_num_with_prefix(prefix, addr, region, state, base, signed, read_length=None):
"""
loads a number from addr, and returns a condition that addr must start with the prefix
"""
length = len(prefix)
read_length = (read_length-length) if read_length else None
conditio... | python | def _load_num_with_prefix(prefix, addr, region, state, base, signed, read_length=None):
"""
loads a number from addr, and returns a condition that addr must start with the prefix
"""
length = len(prefix)
read_length = (read_length-length) if read_length else None
conditio... | [
"def",
"_load_num_with_prefix",
"(",
"prefix",
",",
"addr",
",",
"region",
",",
"state",
",",
"base",
",",
"signed",
",",
"read_length",
"=",
"None",
")",
":",
"length",
"=",
"len",
"(",
"prefix",
")",
"read_length",
"=",
"(",
"read_length",
"-",
"length... | loads a number from addr, and returns a condition that addr must start with the prefix | [
"loads",
"a",
"number",
"from",
"addr",
"and",
"returns",
"a",
"condition",
"that",
"addr",
"must",
"start",
"with",
"the",
"prefix"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L58-L75 | train |
angr/angr | angr/procedures/libc/strtol.py | strtol._string_to_int | def _string_to_int(s, state, region, base, signed, read_length=None):
"""
reads values from s and generates the symbolic number that it would equal
the first char is either a number in the given base, or the result is 0
expression indicates whether or not it was successful
"""
... | python | def _string_to_int(s, state, region, base, signed, read_length=None):
"""
reads values from s and generates the symbolic number that it would equal
the first char is either a number in the given base, or the result is 0
expression indicates whether or not it was successful
"""
... | [
"def",
"_string_to_int",
"(",
"s",
",",
"state",
",",
"region",
",",
"base",
",",
"signed",
",",
"read_length",
"=",
"None",
")",
":",
"# if length wasn't provided, read the maximum bytes",
"length",
"=",
"state",
".",
"libc",
".",
"max_strtol_len",
"if",
"read_... | reads values from s and generates the symbolic number that it would equal
the first char is either a number in the given base, or the result is 0
expression indicates whether or not it was successful | [
"reads",
"values",
"from",
"s",
"and",
"generates",
"the",
"symbolic",
"number",
"that",
"it",
"would",
"equal",
"the",
"first",
"char",
"is",
"either",
"a",
"number",
"in",
"the",
"given",
"base",
"or",
"the",
"result",
"is",
"0",
"expression",
"indicates... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L78-L149 | train |
angr/angr | angr/procedures/libc/strtol.py | strtol._char_to_val | def _char_to_val(char, base):
"""
converts a symbolic char to a number in the given base
returns expression, result
expression is a symbolic boolean indicating whether or not it was a valid number
result is the value
"""
cases = []
# 0-9
max_digit ... | python | def _char_to_val(char, base):
"""
converts a symbolic char to a number in the given base
returns expression, result
expression is a symbolic boolean indicating whether or not it was a valid number
result is the value
"""
cases = []
# 0-9
max_digit ... | [
"def",
"_char_to_val",
"(",
"char",
",",
"base",
")",
":",
"cases",
"=",
"[",
"]",
"# 0-9",
"max_digit",
"=",
"claripy",
".",
"BVV",
"(",
"b\"9\"",
")",
"min_digit",
"=",
"claripy",
".",
"BVV",
"(",
"b\"0\"",
")",
"if",
"base",
"<",
"10",
":",
"max... | converts a symbolic char to a number in the given base
returns expression, result
expression is a symbolic boolean indicating whether or not it was a valid number
result is the value | [
"converts",
"a",
"symbolic",
"char",
"to",
"a",
"number",
"in",
"the",
"given",
"base",
"returns",
"expression",
"result",
"expression",
"is",
"a",
"symbolic",
"boolean",
"indicating",
"whether",
"or",
"not",
"it",
"was",
"a",
"valid",
"number",
"result",
"i... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/libc/strtol.py#L152-L186 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatString.replace | def replace(self, startpos, args):
"""
Implement printf - based on the stored format specifier information, format the values from the arg getter function `args` into a string.
:param startpos: The index of the first argument to be used by the first element of the format string
:... | python | def replace(self, startpos, args):
"""
Implement printf - based on the stored format specifier information, format the values from the arg getter function `args` into a string.
:param startpos: The index of the first argument to be used by the first element of the format string
:... | [
"def",
"replace",
"(",
"self",
",",
"startpos",
",",
"args",
")",
":",
"argpos",
"=",
"startpos",
"string",
"=",
"None",
"for",
"component",
"in",
"self",
".",
"components",
":",
"# if this is just concrete data",
"if",
"isinstance",
"(",
"component",
",",
"... | Implement printf - based on the stored format specifier information, format the values from the arg getter function `args` into a string.
:param startpos: The index of the first argument to be used by the first element of the format string
:param args: A function which, given an argum... | [
"Implement",
"printf",
"-",
"based",
"on",
"the",
"stored",
"format",
"specifier",
"information",
"format",
"the",
"values",
"from",
"the",
"arg",
"getter",
"function",
"args",
"into",
"a",
"string",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L54-L113 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatString.interpret | def interpret(self, startpos, args, addr=None, simfd=None):
"""
implement scanf - extract formatted data from memory or a file according to the stored format
specifiers and store them into the pointers extracted from `args`.
:param startpos: The index of the first argument correspond... | python | def interpret(self, startpos, args, addr=None, simfd=None):
"""
implement scanf - extract formatted data from memory or a file according to the stored format
specifiers and store them into the pointers extracted from `args`.
:param startpos: The index of the first argument correspond... | [
"def",
"interpret",
"(",
"self",
",",
"startpos",
",",
"args",
",",
"addr",
"=",
"None",
",",
"simfd",
"=",
"None",
")",
":",
"if",
"simfd",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"simfd",
".",
"read_storage",
",",
"SimPackets",
")",
":",
"ar... | implement scanf - extract formatted data from memory or a file according to the stored format
specifiers and store them into the pointers extracted from `args`.
:param startpos: The index of the first argument corresponding to the first format element
:param args: A function which, gi... | [
"implement",
"scanf",
"-",
"extract",
"formatted",
"data",
"from",
"memory",
"or",
"a",
"file",
"according",
"to",
"the",
"stored",
"format",
"specifiers",
"and",
"store",
"them",
"into",
"the",
"pointers",
"extracted",
"from",
"args",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L115-L298 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatParser._mod_spec | def _mod_spec(self):
"""
Modified length specifiers: mapping between length modifiers and conversion specifiers. This generates all the
possibilities, i.e. hhd, etc.
"""
mod_spec={}
for mod, sizes in self.int_len_mod.items():
for conv in self.int_sign['signe... | python | def _mod_spec(self):
"""
Modified length specifiers: mapping between length modifiers and conversion specifiers. This generates all the
possibilities, i.e. hhd, etc.
"""
mod_spec={}
for mod, sizes in self.int_len_mod.items():
for conv in self.int_sign['signe... | [
"def",
"_mod_spec",
"(",
"self",
")",
":",
"mod_spec",
"=",
"{",
"}",
"for",
"mod",
",",
"sizes",
"in",
"self",
".",
"int_len_mod",
".",
"items",
"(",
")",
":",
"for",
"conv",
"in",
"self",
".",
"int_sign",
"[",
"'signed'",
"]",
":",
"mod_spec",
"[... | Modified length specifiers: mapping between length modifiers and conversion specifiers. This generates all the
possibilities, i.e. hhd, etc. | [
"Modified",
"length",
"specifiers",
":",
"mapping",
"between",
"length",
"modifiers",
"and",
"conversion",
"specifiers",
".",
"This",
"generates",
"all",
"the",
"possibilities",
"i",
".",
"e",
".",
"hhd",
"etc",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L396-L411 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatParser._all_spec | def _all_spec(self):
"""
All specifiers and their lengths.
"""
base = self._mod_spec
for spec in self.basic_spec:
base[spec] = self.basic_spec[spec]
return base | python | def _all_spec(self):
"""
All specifiers and their lengths.
"""
base = self._mod_spec
for spec in self.basic_spec:
base[spec] = self.basic_spec[spec]
return base | [
"def",
"_all_spec",
"(",
"self",
")",
":",
"base",
"=",
"self",
".",
"_mod_spec",
"for",
"spec",
"in",
"self",
".",
"basic_spec",
":",
"base",
"[",
"spec",
"]",
"=",
"self",
".",
"basic_spec",
"[",
"spec",
"]",
"return",
"base"
] | All specifiers and their lengths. | [
"All",
"specifiers",
"and",
"their",
"lengths",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L414-L424 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatParser._match_spec | def _match_spec(self, nugget):
"""
match the string `nugget` to a format specifier.
"""
# TODO: handle positional modifiers and other similar format string tricks.
all_spec = self._all_spec
# iterate through nugget throwing away anything which is an int
# TODO st... | python | def _match_spec(self, nugget):
"""
match the string `nugget` to a format specifier.
"""
# TODO: handle positional modifiers and other similar format string tricks.
all_spec = self._all_spec
# iterate through nugget throwing away anything which is an int
# TODO st... | [
"def",
"_match_spec",
"(",
"self",
",",
"nugget",
")",
":",
"# TODO: handle positional modifiers and other similar format string tricks.",
"all_spec",
"=",
"self",
".",
"_all_spec",
"# iterate through nugget throwing away anything which is an int",
"# TODO store this in a size variable... | match the string `nugget` to a format specifier. | [
"match",
"the",
"string",
"nugget",
"to",
"a",
"format",
"specifier",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L429-L475 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatParser._get_fmt | def _get_fmt(self, fmt):
"""
Extract the actual formats from the format string `fmt`.
:param list fmt: A list of format chars.
:returns: a FormatString object
"""
# iterate over the format string looking for format specifiers
components = [ ]
i = 0
... | python | def _get_fmt(self, fmt):
"""
Extract the actual formats from the format string `fmt`.
:param list fmt: A list of format chars.
:returns: a FormatString object
"""
# iterate over the format string looking for format specifiers
components = [ ]
i = 0
... | [
"def",
"_get_fmt",
"(",
"self",
",",
"fmt",
")",
":",
"# iterate over the format string looking for format specifiers",
"components",
"=",
"[",
"]",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"fmt",
")",
":",
"if",
"type",
"(",
"fmt",
"[",
"i",
"]",
"... | Extract the actual formats from the format string `fmt`.
:param list fmt: A list of format chars.
:returns: a FormatString object | [
"Extract",
"the",
"actual",
"formats",
"from",
"the",
"format",
"string",
"fmt",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L477-L515 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatParser._sim_atoi_inner | def _sim_atoi_inner(self, str_addr, region, base=10, read_length=None):
"""
Return the result of invoking the atoi simprocedure on `str_addr`.
"""
from .. import SIM_PROCEDURES
strtol = SIM_PROCEDURES['libc']['strtol']
return strtol.strtol_inner(str_addr, self.state, re... | python | def _sim_atoi_inner(self, str_addr, region, base=10, read_length=None):
"""
Return the result of invoking the atoi simprocedure on `str_addr`.
"""
from .. import SIM_PROCEDURES
strtol = SIM_PROCEDURES['libc']['strtol']
return strtol.strtol_inner(str_addr, self.state, re... | [
"def",
"_sim_atoi_inner",
"(",
"self",
",",
"str_addr",
",",
"region",
",",
"base",
"=",
"10",
",",
"read_length",
"=",
"None",
")",
":",
"from",
".",
".",
"import",
"SIM_PROCEDURES",
"strtol",
"=",
"SIM_PROCEDURES",
"[",
"'libc'",
"]",
"[",
"'strtol'",
... | Return the result of invoking the atoi simprocedure on `str_addr`. | [
"Return",
"the",
"result",
"of",
"invoking",
"the",
"atoi",
"simprocedure",
"on",
"str_addr",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L517-L525 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatParser._sim_strlen | def _sim_strlen(self, str_addr):
"""
Return the result of invoking the strlen simprocedure on `str_addr`.
"""
from .. import SIM_PROCEDURES
strlen = SIM_PROCEDURES['libc']['strlen']
return self.inline_call(strlen, str_addr).ret_expr | python | def _sim_strlen(self, str_addr):
"""
Return the result of invoking the strlen simprocedure on `str_addr`.
"""
from .. import SIM_PROCEDURES
strlen = SIM_PROCEDURES['libc']['strlen']
return self.inline_call(strlen, str_addr).ret_expr | [
"def",
"_sim_strlen",
"(",
"self",
",",
"str_addr",
")",
":",
"from",
".",
".",
"import",
"SIM_PROCEDURES",
"strlen",
"=",
"SIM_PROCEDURES",
"[",
"'libc'",
"]",
"[",
"'strlen'",
"]",
"return",
"self",
".",
"inline_call",
"(",
"strlen",
",",
"str_addr",
")"... | Return the result of invoking the strlen simprocedure on `str_addr`. | [
"Return",
"the",
"result",
"of",
"invoking",
"the",
"strlen",
"simprocedure",
"on",
"str_addr",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L528-L536 | train |
angr/angr | angr/procedures/stubs/format_parser.py | FormatParser._parse | def _parse(self, fmt_idx):
"""
Parse format strings.
:param fmt_idx: The index of the (pointer to the) format string in the arguments list.
:returns: A FormatString object which can be used for replacing the format specifiers with arguments or
for scanning ... | python | def _parse(self, fmt_idx):
"""
Parse format strings.
:param fmt_idx: The index of the (pointer to the) format string in the arguments list.
:returns: A FormatString object which can be used for replacing the format specifiers with arguments or
for scanning ... | [
"def",
"_parse",
"(",
"self",
",",
"fmt_idx",
")",
":",
"fmtstr_ptr",
"=",
"self",
".",
"arg",
"(",
"fmt_idx",
")",
"if",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
"(",
"fmtstr_ptr",
")",
":",
"raise",
"SimProcedureError",
"(",
"\"Symbolic po... | Parse format strings.
:param fmt_idx: The index of the (pointer to the) format string in the arguments list.
:returns: A FormatString object which can be used for replacing the format specifiers with arguments or
for scanning into arguments. | [
"Parse",
"format",
"strings",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L539-L582 | train |
angr/angr | angr/state_plugins/unicorn_engine.py | Unicorn._process_value | def _process_value(self, d, from_where):
"""
Pre-process an AST for insertion into unicorn.
:param d: the AST
:param from_where: the ID of the memory region it comes from ('mem' or 'reg')
:returns: the value to be inserted into Unicorn, or None
"""
if len(d.annot... | python | def _process_value(self, d, from_where):
"""
Pre-process an AST for insertion into unicorn.
:param d: the AST
:param from_where: the ID of the memory region it comes from ('mem' or 'reg')
:returns: the value to be inserted into Unicorn, or None
"""
if len(d.annot... | [
"def",
"_process_value",
"(",
"self",
",",
"d",
",",
"from_where",
")",
":",
"if",
"len",
"(",
"d",
".",
"annotations",
")",
":",
"l",
".",
"debug",
"(",
"\"Blocking annotated AST.\"",
")",
"return",
"None",
"elif",
"not",
"d",
".",
"symbolic",
":",
"r... | Pre-process an AST for insertion into unicorn.
:param d: the AST
:param from_where: the ID of the memory region it comes from ('mem' or 'reg')
:returns: the value to be inserted into Unicorn, or None | [
"Pre",
"-",
"process",
"an",
"AST",
"for",
"insertion",
"into",
"unicorn",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/unicorn_engine.py#L657-L684 | train |
angr/angr | angr/state_plugins/unicorn_engine.py | Unicorn._hook_mem_unmapped | def _hook_mem_unmapped(self, uc, access, address, size, value, user_data, size_extension=True): #pylint:disable=unused-argument
"""
This callback is called when unicorn needs to access data that's not yet present in memory.
"""
# FIXME check angr hooks at `address`
if size_exten... | python | def _hook_mem_unmapped(self, uc, access, address, size, value, user_data, size_extension=True): #pylint:disable=unused-argument
"""
This callback is called when unicorn needs to access data that's not yet present in memory.
"""
# FIXME check angr hooks at `address`
if size_exten... | [
"def",
"_hook_mem_unmapped",
"(",
"self",
",",
"uc",
",",
"access",
",",
"address",
",",
"size",
",",
"value",
",",
"user_data",
",",
"size_extension",
"=",
"True",
")",
":",
"#pylint:disable=unused-argument",
"# FIXME check angr hooks at `address`",
"if",
"size_ext... | This callback is called when unicorn needs to access data that's not yet present in memory. | [
"This",
"callback",
"is",
"called",
"when",
"unicorn",
"needs",
"to",
"access",
"data",
"that",
"s",
"not",
"yet",
"present",
"in",
"memory",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/unicorn_engine.py#L686-L758 | train |
angr/angr | angr/state_plugins/unicorn_engine.py | Unicorn.set_regs | def set_regs(self):
''' setting unicorn registers '''
uc = self.uc
if self.state.arch.qemu_name == 'x86_64':
fs = self.state.solver.eval(self.state.regs.fs)
gs = self.state.solver.eval(self.state.regs.gs)
self.write_msr(fs, 0xC0000100)
self.write_... | python | def set_regs(self):
''' setting unicorn registers '''
uc = self.uc
if self.state.arch.qemu_name == 'x86_64':
fs = self.state.solver.eval(self.state.regs.fs)
gs = self.state.solver.eval(self.state.regs.gs)
self.write_msr(fs, 0xC0000100)
self.write_... | [
"def",
"set_regs",
"(",
"self",
")",
":",
"uc",
"=",
"self",
".",
"uc",
"if",
"self",
".",
"state",
".",
"arch",
".",
"qemu_name",
"==",
"'x86_64'",
":",
"fs",
"=",
"self",
".",
"state",
".",
"solver",
".",
"eval",
"(",
"self",
".",
"state",
".",... | setting unicorn registers | [
"setting",
"unicorn",
"registers"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/unicorn_engine.py#L1079-L1163 | train |
angr/angr | angr/state_plugins/unicorn_engine.py | Unicorn.get_regs | def get_regs(self):
''' loading registers from unicorn '''
# first, get the ignore list (in case of symbolic registers)
if options.UNICORN_SYM_REGS_SUPPORT in self.state.options:
highest_reg_offset, reg_size = max(self.state.arch.registers.values())
symbolic_list = (ctyp... | python | def get_regs(self):
''' loading registers from unicorn '''
# first, get the ignore list (in case of symbolic registers)
if options.UNICORN_SYM_REGS_SUPPORT in self.state.options:
highest_reg_offset, reg_size = max(self.state.arch.registers.values())
symbolic_list = (ctyp... | [
"def",
"get_regs",
"(",
"self",
")",
":",
"# first, get the ignore list (in case of symbolic registers)",
"if",
"options",
".",
"UNICORN_SYM_REGS_SUPPORT",
"in",
"self",
".",
"state",
".",
"options",
":",
"highest_reg_offset",
",",
"reg_size",
"=",
"max",
"(",
"self",... | loading registers from unicorn | [
"loading",
"registers",
"from",
"unicorn"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/unicorn_engine.py#L1215-L1316 | train |
angr/angr | angr/state_plugins/unicorn_engine.py | Unicorn._check_registers | def _check_registers(self, report=True):
''' check if this state might be used in unicorn (has no concrete register)'''
for r in self.state.arch.uc_regs.keys():
v = getattr(self.state.regs, r)
processed_v = self._process_value(v, 'reg')
if processed_v is None or proce... | python | def _check_registers(self, report=True):
''' check if this state might be used in unicorn (has no concrete register)'''
for r in self.state.arch.uc_regs.keys():
v = getattr(self.state.regs, r)
processed_v = self._process_value(v, 'reg')
if processed_v is None or proce... | [
"def",
"_check_registers",
"(",
"self",
",",
"report",
"=",
"True",
")",
":",
"for",
"r",
"in",
"self",
".",
"state",
".",
"arch",
".",
"uc_regs",
".",
"keys",
"(",
")",
":",
"v",
"=",
"getattr",
"(",
"self",
".",
"state",
".",
"regs",
",",
"r",
... | check if this state might be used in unicorn (has no concrete register) | [
"check",
"if",
"this",
"state",
"might",
"be",
"used",
"in",
"unicorn",
"(",
"has",
"no",
"concrete",
"register",
")"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/unicorn_engine.py#L1318-L1339 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._track_stack_pointers | def _track_stack_pointers(self):
"""
For each instruction, track its stack pointer offset and stack base pointer offset.
:return: None
"""
regs = {self.project.arch.sp_offset}
if hasattr(self.project.arch, 'bp_offset') and self.project.arch.bp_offset is not None:
... | python | def _track_stack_pointers(self):
"""
For each instruction, track its stack pointer offset and stack base pointer offset.
:return: None
"""
regs = {self.project.arch.sp_offset}
if hasattr(self.project.arch, 'bp_offset') and self.project.arch.bp_offset is not None:
... | [
"def",
"_track_stack_pointers",
"(",
"self",
")",
":",
"regs",
"=",
"{",
"self",
".",
"project",
".",
"arch",
".",
"sp_offset",
"}",
"if",
"hasattr",
"(",
"self",
".",
"project",
".",
"arch",
",",
"'bp_offset'",
")",
"and",
"self",
".",
"project",
".",... | For each instruction, track its stack pointer offset and stack base pointer offset.
:return: None | [
"For",
"each",
"instruction",
"track",
"its",
"stack",
"pointer",
"offset",
"and",
"stack",
"base",
"pointer",
"offset",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L107-L120 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._convert | def _convert(self, block_node):
"""
Convert a VEX block to an AIL block.
:param block_node: A BlockNode instance.
:return: An converted AIL block.
:rtype: ailment.Block
"""
if not type(block_node) is BlockNode:
return block_no... | python | def _convert(self, block_node):
"""
Convert a VEX block to an AIL block.
:param block_node: A BlockNode instance.
:return: An converted AIL block.
:rtype: ailment.Block
"""
if not type(block_node) is BlockNode:
return block_no... | [
"def",
"_convert",
"(",
"self",
",",
"block_node",
")",
":",
"if",
"not",
"type",
"(",
"block_node",
")",
"is",
"BlockNode",
":",
"return",
"block_node",
"block",
"=",
"self",
".",
"project",
".",
"factory",
".",
"block",
"(",
"block_node",
".",
"addr",
... | Convert a VEX block to an AIL block.
:param block_node: A BlockNode instance.
:return: An converted AIL block.
:rtype: ailment.Block | [
"Convert",
"a",
"VEX",
"block",
"to",
"an",
"AIL",
"block",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L134-L149 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._simplify_blocks | def _simplify_blocks(self, stack_pointer_tracker=None):
"""
Simplify all blocks in self._blocks.
:param stack_pointer_tracker: The RegisterDeltaTracker analysis instance.
:return: None
"""
# First of all, let's simplify blocks one by one
... | python | def _simplify_blocks(self, stack_pointer_tracker=None):
"""
Simplify all blocks in self._blocks.
:param stack_pointer_tracker: The RegisterDeltaTracker analysis instance.
:return: None
"""
# First of all, let's simplify blocks one by one
... | [
"def",
"_simplify_blocks",
"(",
"self",
",",
"stack_pointer_tracker",
"=",
"None",
")",
":",
"# First of all, let's simplify blocks one by one",
"for",
"key",
"in",
"self",
".",
"_blocks",
":",
"ail_block",
"=",
"self",
".",
"_blocks",
"[",
"key",
"]",
"simplified... | Simplify all blocks in self._blocks.
:param stack_pointer_tracker: The RegisterDeltaTracker analysis instance.
:return: None | [
"Simplify",
"all",
"blocks",
"in",
"self",
".",
"_blocks",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L151-L167 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._simplify_block | def _simplify_block(self, ail_block, stack_pointer_tracker=None):
"""
Simplify a single AIL block.
:param ailment.Block ail_block: The AIL block to simplify.
:param stack_pointer_tracker: The RegisterDeltaTracker analysis instance.
:return: A simplified ... | python | def _simplify_block(self, ail_block, stack_pointer_tracker=None):
"""
Simplify a single AIL block.
:param ailment.Block ail_block: The AIL block to simplify.
:param stack_pointer_tracker: The RegisterDeltaTracker analysis instance.
:return: A simplified ... | [
"def",
"_simplify_block",
"(",
"self",
",",
"ail_block",
",",
"stack_pointer_tracker",
"=",
"None",
")",
":",
"simp",
"=",
"self",
".",
"project",
".",
"analyses",
".",
"AILBlockSimplifier",
"(",
"ail_block",
",",
"stack_pointer_tracker",
"=",
"stack_pointer_track... | Simplify a single AIL block.
:param ailment.Block ail_block: The AIL block to simplify.
:param stack_pointer_tracker: The RegisterDeltaTracker analysis instance.
:return: A simplified AIL block. | [
"Simplify",
"a",
"single",
"AIL",
"block",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L169-L179 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._simplify_function | def _simplify_function(self):
"""
Simplify the entire function.
:return: None
"""
# Computing reaching definitions
rd = self.project.analyses.ReachingDefinitions(func=self.function, func_graph=self.graph, observe_all=True)
simp = self.project.analyses.AILSim... | python | def _simplify_function(self):
"""
Simplify the entire function.
:return: None
"""
# Computing reaching definitions
rd = self.project.analyses.ReachingDefinitions(func=self.function, func_graph=self.graph, observe_all=True)
simp = self.project.analyses.AILSim... | [
"def",
"_simplify_function",
"(",
"self",
")",
":",
"# Computing reaching definitions",
"rd",
"=",
"self",
".",
"project",
".",
"analyses",
".",
"ReachingDefinitions",
"(",
"func",
"=",
"self",
".",
"function",
",",
"func_graph",
"=",
"self",
".",
"graph",
","... | Simplify the entire function.
:return: None | [
"Simplify",
"the",
"entire",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L181-L198 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._make_callsites | def _make_callsites(self, stack_pointer_tracker=None):
"""
Simplify all function call statements.
:return: None
"""
# Computing reaching definitions
rd = self.project.analyses.ReachingDefinitions(func=self.function, func_graph=self.graph, observe_all=True)
f... | python | def _make_callsites(self, stack_pointer_tracker=None):
"""
Simplify all function call statements.
:return: None
"""
# Computing reaching definitions
rd = self.project.analyses.ReachingDefinitions(func=self.function, func_graph=self.graph, observe_all=True)
f... | [
"def",
"_make_callsites",
"(",
"self",
",",
"stack_pointer_tracker",
"=",
"None",
")",
":",
"# Computing reaching definitions",
"rd",
"=",
"self",
".",
"project",
".",
"analyses",
".",
"ReachingDefinitions",
"(",
"func",
"=",
"self",
".",
"function",
",",
"func_... | Simplify all function call statements.
:return: None | [
"Simplify",
"all",
"function",
"call",
"statements",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L213-L231 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._link_variables_on_block | def _link_variables_on_block(self, block, kb):
"""
Link atoms (AIL expressions) in the given block to corresponding variables identified previously.
:param ailment.Block block: The AIL block to work on.
:return: None
"""
variable_manager = kb.variable... | python | def _link_variables_on_block(self, block, kb):
"""
Link atoms (AIL expressions) in the given block to corresponding variables identified previously.
:param ailment.Block block: The AIL block to work on.
:return: None
"""
variable_manager = kb.variable... | [
"def",
"_link_variables_on_block",
"(",
"self",
",",
"block",
",",
"kb",
")",
":",
"variable_manager",
"=",
"kb",
".",
"variables",
"[",
"self",
".",
"function",
".",
"addr",
"]",
"for",
"stmt_idx",
",",
"stmt",
"in",
"enumerate",
"(",
"block",
".",
"sta... | Link atoms (AIL expressions) in the given block to corresponding variables identified previously.
:param ailment.Block block: The AIL block to work on.
:return: None | [
"Link",
"atoms",
"(",
"AIL",
"expressions",
")",
"in",
"the",
"given",
"block",
"to",
"corresponding",
"variables",
"identified",
"previously",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L244-L273 | train |
angr/angr | angr/analyses/decompiler/clinic.py | Clinic._link_variables_on_expr | def _link_variables_on_expr(self, variable_manager, block, stmt_idx, stmt, expr):
"""
Link atoms (AIL expressions) in the given expression to corresponding variables identified previously.
:param variable_manager: Variable manager of the function.
:param ailment.Block block: AIL bloc... | python | def _link_variables_on_expr(self, variable_manager, block, stmt_idx, stmt, expr):
"""
Link atoms (AIL expressions) in the given expression to corresponding variables identified previously.
:param variable_manager: Variable manager of the function.
:param ailment.Block block: AIL bloc... | [
"def",
"_link_variables_on_expr",
"(",
"self",
",",
"variable_manager",
",",
"block",
",",
"stmt_idx",
",",
"stmt",
",",
"expr",
")",
":",
"if",
"type",
"(",
"expr",
")",
"is",
"ailment",
".",
"Expr",
".",
"Register",
":",
"# find a register variable",
"reg_... | Link atoms (AIL expressions) in the given expression to corresponding variables identified previously.
:param variable_manager: Variable manager of the function.
:param ailment.Block block: AIL block.
:param int stmt_idx: ID of the statement.
:param stmt: The AI... | [
"Link",
"atoms",
"(",
"AIL",
"expressions",
")",
"in",
"the",
"given",
"expression",
"to",
"corresponding",
"variables",
"identified",
"previously",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/clinic.py#L275-L337 | train |
angr/angr | angr/state_plugins/javavm_classloader.py | SimJavaVmClassloader.get_class | def get_class(self, class_name, init_class=False, step_func=None):
"""
Get a class descriptor for the class.
:param str class_name: Name of class.
:param bool init_class: Whether the class initializer <clinit> should be
executed.
:param func step... | python | def get_class(self, class_name, init_class=False, step_func=None):
"""
Get a class descriptor for the class.
:param str class_name: Name of class.
:param bool init_class: Whether the class initializer <clinit> should be
executed.
:param func step... | [
"def",
"get_class",
"(",
"self",
",",
"class_name",
",",
"init_class",
"=",
"False",
",",
"step_func",
"=",
"None",
")",
":",
"# try to get the soot class object from CLE",
"java_binary",
"=",
"self",
".",
"state",
".",
"javavm_registers",
".",
"load",
"(",
"'ip... | Get a class descriptor for the class.
:param str class_name: Name of class.
:param bool init_class: Whether the class initializer <clinit> should be
executed.
:param func step_func: Callback function executed at every step of the simulation manager during
... | [
"Get",
"a",
"class",
"descriptor",
"for",
"the",
"class",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_classloader.py#L23-L41 | train |
angr/angr | angr/state_plugins/javavm_classloader.py | SimJavaVmClassloader.get_superclass | def get_superclass(self, class_):
"""
Get the superclass of the class.
"""
if not class_.is_loaded or class_.superclass_name is None:
return None
return self.get_class(class_.superclass_name) | python | def get_superclass(self, class_):
"""
Get the superclass of the class.
"""
if not class_.is_loaded or class_.superclass_name is None:
return None
return self.get_class(class_.superclass_name) | [
"def",
"get_superclass",
"(",
"self",
",",
"class_",
")",
":",
"if",
"not",
"class_",
".",
"is_loaded",
"or",
"class_",
".",
"superclass_name",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"get_class",
"(",
"class_",
".",
"superclass_name",
... | Get the superclass of the class. | [
"Get",
"the",
"superclass",
"of",
"the",
"class",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_classloader.py#L43-L49 | train |
angr/angr | angr/state_plugins/javavm_classloader.py | SimJavaVmClassloader.get_class_hierarchy | def get_class_hierarchy(self, base_class):
"""
Walks up the class hierarchy and returns a list of all classes between
base class (inclusive) and java.lang.Object (exclusive).
"""
classes = [base_class]
while classes[-1] is not None and classes[-1] != "java.lang.Object":
... | python | def get_class_hierarchy(self, base_class):
"""
Walks up the class hierarchy and returns a list of all classes between
base class (inclusive) and java.lang.Object (exclusive).
"""
classes = [base_class]
while classes[-1] is not None and classes[-1] != "java.lang.Object":
... | [
"def",
"get_class_hierarchy",
"(",
"self",
",",
"base_class",
")",
":",
"classes",
"=",
"[",
"base_class",
"]",
"while",
"classes",
"[",
"-",
"1",
"]",
"is",
"not",
"None",
"and",
"classes",
"[",
"-",
"1",
"]",
"!=",
"\"java.lang.Object\"",
":",
"classes... | Walks up the class hierarchy and returns a list of all classes between
base class (inclusive) and java.lang.Object (exclusive). | [
"Walks",
"up",
"the",
"class",
"hierarchy",
"and",
"returns",
"a",
"list",
"of",
"all",
"classes",
"between",
"base",
"class",
"(",
"inclusive",
")",
"and",
"java",
".",
"lang",
".",
"Object",
"(",
"exclusive",
")",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_classloader.py#L51-L59 | train |
angr/angr | angr/state_plugins/javavm_classloader.py | SimJavaVmClassloader.init_class | def init_class(self, class_, step_func=None):
"""
This method simulates the loading of a class by the JVM, during which
parts of the class (e.g. static fields) are initialized. For this, we
run the class initializer method <clinit> (if available) and update
the state accordingly.... | python | def init_class(self, class_, step_func=None):
"""
This method simulates the loading of a class by the JVM, during which
parts of the class (e.g. static fields) are initialized. For this, we
run the class initializer method <clinit> (if available) and update
the state accordingly.... | [
"def",
"init_class",
"(",
"self",
",",
"class_",
",",
"step_func",
"=",
"None",
")",
":",
"if",
"self",
".",
"is_class_initialized",
"(",
"class_",
")",
":",
"l",
".",
"debug",
"(",
"\"Class %r already initialized.\"",
",",
"class_",
")",
"return",
"l",
".... | This method simulates the loading of a class by the JVM, during which
parts of the class (e.g. static fields) are initialized. For this, we
run the class initializer method <clinit> (if available) and update
the state accordingly.
Note: Initialization is skipped, if the class has alread... | [
"This",
"method",
"simulates",
"the",
"loading",
"of",
"a",
"class",
"by",
"the",
"JVM",
"during",
"which",
"parts",
"of",
"the",
"class",
"(",
"e",
".",
"g",
".",
"static",
"fields",
")",
"are",
"initialized",
".",
"For",
"this",
"we",
"run",
"the",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_classloader.py#L68-L106 | train |
angr/angr | angr/blade.py | Blade._get_irsb | def _get_irsb(self, v):
"""
Get the IRSB object from an address, a SimRun, or a CFGNode.
:param v: Can be one of the following: an address, or a CFGNode.
:return: The IRSB instance.
:rtype: pyvex.IRSB
"""
if isinstance(v, CFGNode):
v = v.addr
... | python | def _get_irsb(self, v):
"""
Get the IRSB object from an address, a SimRun, or a CFGNode.
:param v: Can be one of the following: an address, or a CFGNode.
:return: The IRSB instance.
:rtype: pyvex.IRSB
"""
if isinstance(v, CFGNode):
v = v.addr
... | [
"def",
"_get_irsb",
"(",
"self",
",",
"v",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"CFGNode",
")",
":",
"v",
"=",
"v",
".",
"addr",
"if",
"type",
"(",
"v",
")",
"is",
"int",
":",
"# Generate an IRSB from self._project",
"if",
"v",
"in",
"self",
... | Get the IRSB object from an address, a SimRun, or a CFGNode.
:param v: Can be one of the following: an address, or a CFGNode.
:return: The IRSB instance.
:rtype: pyvex.IRSB | [
"Get",
"the",
"IRSB",
"object",
"from",
"an",
"address",
"a",
"SimRun",
"or",
"a",
"CFGNode",
".",
":",
"param",
"v",
":",
"Can",
"be",
"one",
"of",
"the",
"following",
":",
"an",
"address",
"or",
"a",
"CFGNode",
".",
":",
"return",
":",
"The",
"IR... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/blade.py#L133-L158 | train |
angr/angr | angr/blade.py | Blade._get_addr | def _get_addr(self, v):
"""
Get address of the basic block or CFG node specified by v.
:param v: Can be one of the following: a CFGNode, or an address.
:return: The address.
:rtype: int
"""
if isinstance(v, CFGNode):
return v.addr
elif type(v)... | python | def _get_addr(self, v):
"""
Get address of the basic block or CFG node specified by v.
:param v: Can be one of the following: a CFGNode, or an address.
:return: The address.
:rtype: int
"""
if isinstance(v, CFGNode):
return v.addr
elif type(v)... | [
"def",
"_get_addr",
"(",
"self",
",",
"v",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"CFGNode",
")",
":",
"return",
"v",
".",
"addr",
"elif",
"type",
"(",
"v",
")",
"is",
"int",
":",
"return",
"v",
"else",
":",
"raise",
"AngrBladeError",
"(",
... | Get address of the basic block or CFG node specified by v.
:param v: Can be one of the following: a CFGNode, or an address.
:return: The address.
:rtype: int | [
"Get",
"address",
"of",
"the",
"basic",
"block",
"or",
"CFG",
"node",
"specified",
"by",
"v",
".",
":",
"param",
"v",
":",
"Can",
"be",
"one",
"of",
"the",
"following",
":",
"a",
"CFGNode",
"or",
"an",
"address",
".",
":",
"return",
":",
"The",
"ad... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/blade.py#L171-L184 | train |
angr/angr | angr/blade.py | Blade._backward_slice | def _backward_slice(self):
"""
Backward slicing.
We support the following IRStmts:
# WrTmp
# Put
We support the following IRExprs:
# Get
# RdTmp
# Const
:return:
"""
temps = set()
regs = set()
# Retrieve... | python | def _backward_slice(self):
"""
Backward slicing.
We support the following IRStmts:
# WrTmp
# Put
We support the following IRExprs:
# Get
# RdTmp
# Const
:return:
"""
temps = set()
regs = set()
# Retrieve... | [
"def",
"_backward_slice",
"(",
"self",
")",
":",
"temps",
"=",
"set",
"(",
")",
"regs",
"=",
"set",
"(",
")",
"# Retrieve the target: are we slicing from a register(IRStmt.Put), or a temp(IRStmt.WrTmp)?",
"try",
":",
"stmts",
"=",
"self",
".",
"_get_irsb",
"(",
"sel... | Backward slicing.
We support the following IRStmts:
# WrTmp
# Put
We support the following IRExprs:
# Get
# RdTmp
# Const
:return: | [
"Backward",
"slicing",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/blade.py#L200-L287 | train |
angr/angr | angr/engines/vex/ccall.py | pc_calculate_condition_simple | def pc_calculate_condition_simple(state, cond, cc_op, cc_dep1, cc_dep2, cc_ndep, platform=None):
"""
A simplified version of pc_calculate_condition(). Please refer to the documentation of Simplified CCalls above.
Limitation: symbolic flags are not supported for now.
"""
if state.solver.symbolic(co... | python | def pc_calculate_condition_simple(state, cond, cc_op, cc_dep1, cc_dep2, cc_ndep, platform=None):
"""
A simplified version of pc_calculate_condition(). Please refer to the documentation of Simplified CCalls above.
Limitation: symbolic flags are not supported for now.
"""
if state.solver.symbolic(co... | [
"def",
"pc_calculate_condition_simple",
"(",
"state",
",",
"cond",
",",
"cc_op",
",",
"cc_dep1",
",",
"cc_dep2",
",",
"cc_ndep",
",",
"platform",
"=",
"None",
")",
":",
"if",
"state",
".",
"solver",
".",
"symbolic",
"(",
"cond",
")",
":",
"raise",
"SimEr... | A simplified version of pc_calculate_condition(). Please refer to the documentation of Simplified CCalls above.
Limitation: symbolic flags are not supported for now. | [
"A",
"simplified",
"version",
"of",
"pc_calculate_condition",
"()",
".",
"Please",
"refer",
"to",
"the",
"documentation",
"of",
"Simplified",
"CCalls",
"above",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/ccall.py#L729-L778 | train |
angr/angr | angr/engines/vex/ccall.py | _concat_flags | def _concat_flags(nbits, flags_vec):
"""
Concatenate different flag BVs to a single BV. Currently used for ARM, X86
and AMD64.
:param nbits : platform size in bits.
:param flags_vec: vector of flag BVs and their offset in the resulting BV.
:type nbits : int
:type flags_vec : list
... | python | def _concat_flags(nbits, flags_vec):
"""
Concatenate different flag BVs to a single BV. Currently used for ARM, X86
and AMD64.
:param nbits : platform size in bits.
:param flags_vec: vector of flag BVs and their offset in the resulting BV.
:type nbits : int
:type flags_vec : list
... | [
"def",
"_concat_flags",
"(",
"nbits",
",",
"flags_vec",
")",
":",
"result",
"=",
"claripy",
".",
"BVV",
"(",
"0",
",",
"0",
")",
"for",
"offset",
",",
"bit",
"in",
"flags_vec",
":",
"current_position",
"=",
"nbits",
"-",
"1",
"-",
"result",
".",
"len... | Concatenate different flag BVs to a single BV. Currently used for ARM, X86
and AMD64.
:param nbits : platform size in bits.
:param flags_vec: vector of flag BVs and their offset in the resulting BV.
:type nbits : int
:type flags_vec : list
:return : the resulting flag BV.
:r... | [
"Concatenate",
"different",
"flag",
"BVs",
"to",
"a",
"single",
"BV",
".",
"Currently",
"used",
"for",
"ARM",
"X86",
"and",
"AMD64",
".",
":",
"param",
"nbits",
":",
"platform",
"size",
"in",
"bits",
".",
":",
"param",
"flags_vec",
":",
"vector",
"of",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/engines/vex/ccall.py#L1718-L1737 | train |
angr/angr | angr/analyses/decompiler/region_simplifier.py | RegionSimplifier._simplify | def _simplify(self):
"""
RegionSimplifier performs the following simplifications:
- Remove redundant Gotos
- Remove redundant If/If-else statements
"""
r = self.region
r = self._simplify_gotos(r)
r = self._simplify_ifs(r)
self.result = r | python | def _simplify(self):
"""
RegionSimplifier performs the following simplifications:
- Remove redundant Gotos
- Remove redundant If/If-else statements
"""
r = self.region
r = self._simplify_gotos(r)
r = self._simplify_ifs(r)
self.result = r | [
"def",
"_simplify",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"region",
"r",
"=",
"self",
".",
"_simplify_gotos",
"(",
"r",
")",
"r",
"=",
"self",
".",
"_simplify_ifs",
"(",
"r",
")",
"self",
".",
"result",
"=",
"r"
] | RegionSimplifier performs the following simplifications:
- Remove redundant Gotos
- Remove redundant If/If-else statements | [
"RegionSimplifier",
"performs",
"the",
"following",
"simplifications",
":",
"-",
"Remove",
"redundant",
"Gotos",
"-",
"Remove",
"redundant",
"If",
"/",
"If",
"-",
"else",
"statements"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/region_simplifier.py#L38-L49 | train |
angr/angr | angr/serializable.py | Serializable.parse | def parse(cls, s, **kwargs):
"""
Parse a bytes object and create a class object.
:param bytes s: A bytes object.
:return: A class object.
:rtype: cls
"""
pb2_obj = cls._get_cmsg()
pb2_obj.ParseFromString(s)
return cls.parse_from_c... | python | def parse(cls, s, **kwargs):
"""
Parse a bytes object and create a class object.
:param bytes s: A bytes object.
:return: A class object.
:rtype: cls
"""
pb2_obj = cls._get_cmsg()
pb2_obj.ParseFromString(s)
return cls.parse_from_c... | [
"def",
"parse",
"(",
"cls",
",",
"s",
",",
"*",
"*",
"kwargs",
")",
":",
"pb2_obj",
"=",
"cls",
".",
"_get_cmsg",
"(",
")",
"pb2_obj",
".",
"ParseFromString",
"(",
"s",
")",
"return",
"cls",
".",
"parse_from_cmessage",
"(",
"pb2_obj",
",",
"*",
"*",
... | Parse a bytes object and create a class object.
:param bytes s: A bytes object.
:return: A class object.
:rtype: cls | [
"Parse",
"a",
"bytes",
"object",
"and",
"create",
"a",
"class",
"object",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/serializable.py#L52-L64 | train |
angr/angr | angr/state_plugins/javavm_memory.py | SimJavaVmMemory.store_array_elements | def store_array_elements(self, array, start_idx, data):
"""
Stores either a single element or a range of elements in the array.
:param array: Reference to the array.
:param start_idx: Starting index for the store.
:param data: Either a single value or a list of values.
... | python | def store_array_elements(self, array, start_idx, data):
"""
Stores either a single element or a range of elements in the array.
:param array: Reference to the array.
:param start_idx: Starting index for the store.
:param data: Either a single value or a list of values.
... | [
"def",
"store_array_elements",
"(",
"self",
",",
"array",
",",
"start_idx",
",",
"data",
")",
":",
"# we process data as a list of elements",
"# => if there is only a single element, wrap it in a list",
"data",
"=",
"data",
"if",
"isinstance",
"(",
"data",
",",
"list",
... | Stores either a single element or a range of elements in the array.
:param array: Reference to the array.
:param start_idx: Starting index for the store.
:param data: Either a single value or a list of values. | [
"Stores",
"either",
"a",
"single",
"element",
"or",
"a",
"range",
"of",
"elements",
"in",
"the",
"array",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_memory.py#L133-L180 | train |
angr/angr | angr/state_plugins/javavm_memory.py | SimJavaVmMemory.load_array_elements | def load_array_elements(self, array, start_idx, no_of_elements):
"""
Loads either a single element or a range of elements from the array.
:param array: Reference to the array.
:param start_idx: Starting index for the load.
:param no_of_elements: Number of elemen... | python | def load_array_elements(self, array, start_idx, no_of_elements):
"""
Loads either a single element or a range of elements from the array.
:param array: Reference to the array.
:param start_idx: Starting index for the load.
:param no_of_elements: Number of elemen... | [
"def",
"load_array_elements",
"(",
"self",
",",
"array",
",",
"start_idx",
",",
"no_of_elements",
")",
":",
"# concretize start index",
"concrete_start_idxes",
"=",
"self",
".",
"concretize_load_idx",
"(",
"start_idx",
")",
"if",
"len",
"(",
"concrete_start_idxes",
... | Loads either a single element or a range of elements from the array.
:param array: Reference to the array.
:param start_idx: Starting index for the load.
:param no_of_elements: Number of elements to load. | [
"Loads",
"either",
"a",
"single",
"element",
"or",
"a",
"range",
"of",
"elements",
"from",
"the",
"array",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_memory.py#L198-L252 | train |
angr/angr | angr/state_plugins/javavm_memory.py | SimJavaVmMemory._apply_concretization_strategies | def _apply_concretization_strategies(self, idx, strategies, action): # pylint: disable=unused-argument
"""
Applies concretization strategies on the index, until one of them succeeds.
"""
for s in strategies:
try:
idxes = s.concretize(self, idx)
ex... | python | def _apply_concretization_strategies(self, idx, strategies, action): # pylint: disable=unused-argument
"""
Applies concretization strategies on the index, until one of them succeeds.
"""
for s in strategies:
try:
idxes = s.concretize(self, idx)
ex... | [
"def",
"_apply_concretization_strategies",
"(",
"self",
",",
"idx",
",",
"strategies",
",",
"action",
")",
":",
"# pylint: disable=unused-argument",
"for",
"s",
"in",
"strategies",
":",
"try",
":",
"idxes",
"=",
"s",
".",
"concretize",
"(",
"self",
",",
"idx",... | Applies concretization strategies on the index, until one of them succeeds. | [
"Applies",
"concretization",
"strategies",
"on",
"the",
"index",
"until",
"one",
"of",
"them",
"succeeds",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_memory.py#L272-L286 | train |
angr/angr | angr/state_plugins/javavm_memory.py | SimJavaVmMemory.concretize_store_idx | def concretize_store_idx(self, idx, strategies=None):
"""
Concretizes a store index.
:param idx: An expression for the index.
:param strategies: A list of concretization strategies (to override the default).
:param min_idx: Minimum value for a concretize... | python | def concretize_store_idx(self, idx, strategies=None):
"""
Concretizes a store index.
:param idx: An expression for the index.
:param strategies: A list of concretization strategies (to override the default).
:param min_idx: Minimum value for a concretize... | [
"def",
"concretize_store_idx",
"(",
"self",
",",
"idx",
",",
"strategies",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"idx",
",",
"int",
")",
":",
"return",
"[",
"idx",
"]",
"elif",
"not",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
"(... | Concretizes a store index.
:param idx: An expression for the index.
:param strategies: A list of concretization strategies (to override the default).
:param min_idx: Minimum value for a concretized index (inclusive).
:param max_idx: Maximum value for a c... | [
"Concretizes",
"a",
"store",
"index",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_memory.py#L288-L304 | train |
angr/angr | angr/state_plugins/javavm_memory.py | SimJavaVmMemory.concretize_load_idx | def concretize_load_idx(self, idx, strategies=None):
"""
Concretizes a load index.
:param idx: An expression for the index.
:param strategies: A list of concretization strategies (to override the default).
:param min_idx: Minimum value for a concretized ... | python | def concretize_load_idx(self, idx, strategies=None):
"""
Concretizes a load index.
:param idx: An expression for the index.
:param strategies: A list of concretization strategies (to override the default).
:param min_idx: Minimum value for a concretized ... | [
"def",
"concretize_load_idx",
"(",
"self",
",",
"idx",
",",
"strategies",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"idx",
",",
"int",
")",
":",
"return",
"[",
"idx",
"]",
"elif",
"not",
"self",
".",
"state",
".",
"solver",
".",
"symbolic",
"("... | Concretizes a load index.
:param idx: An expression for the index.
:param strategies: A list of concretization strategies (to override the default).
:param min_idx: Minimum value for a concretized index (inclusive).
:param max_idx: Maximum value for a co... | [
"Concretizes",
"a",
"load",
"index",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/javavm_memory.py#L306-L322 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.copy | def copy(self):
"""
Make a copy of the CFG.
:return: A copy of the CFG instance.
:rtype: angr.analyses.CFG
"""
new_cfg = CFGEmulated.__new__(CFGEmulated)
super(CFGEmulated, self).make_copy(new_cfg)
new_cfg._indirect_jump_target_limit = self._indirect_jum... | python | def copy(self):
"""
Make a copy of the CFG.
:return: A copy of the CFG instance.
:rtype: angr.analyses.CFG
"""
new_cfg = CFGEmulated.__new__(CFGEmulated)
super(CFGEmulated, self).make_copy(new_cfg)
new_cfg._indirect_jump_target_limit = self._indirect_jum... | [
"def",
"copy",
"(",
"self",
")",
":",
"new_cfg",
"=",
"CFGEmulated",
".",
"__new__",
"(",
"CFGEmulated",
")",
"super",
"(",
"CFGEmulated",
",",
"self",
")",
".",
"make_copy",
"(",
"new_cfg",
")",
"new_cfg",
".",
"_indirect_jump_target_limit",
"=",
"self",
... | Make a copy of the CFG.
:return: A copy of the CFG instance.
:rtype: angr.analyses.CFG | [
"Make",
"a",
"copy",
"of",
"the",
"CFG",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L309-L335 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.resume | def resume(self, starts=None, max_steps=None):
"""
Resume a paused or terminated control flow graph recovery.
:param iterable starts: A collection of new starts to resume from. If `starts` is None, we will resume CFG
recovery from where it was paused before.
... | python | def resume(self, starts=None, max_steps=None):
"""
Resume a paused or terminated control flow graph recovery.
:param iterable starts: A collection of new starts to resume from. If `starts` is None, we will resume CFG
recovery from where it was paused before.
... | [
"def",
"resume",
"(",
"self",
",",
"starts",
"=",
"None",
",",
"max_steps",
"=",
"None",
")",
":",
"self",
".",
"_starts",
"=",
"starts",
"self",
".",
"_max_steps",
"=",
"max_steps",
"self",
".",
"_sanitize_starts",
"(",
")",
"self",
".",
"_analyze",
"... | Resume a paused or terminated control flow graph recovery.
:param iterable starts: A collection of new starts to resume from. If `starts` is None, we will resume CFG
recovery from where it was paused before.
:param int max_steps: The maximum number of blocks on the lon... | [
"Resume",
"a",
"paused",
"or",
"terminated",
"control",
"flow",
"graph",
"recovery",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L337-L353 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.remove_cycles | def remove_cycles(self):
"""
Forces graph to become acyclic, removes all loop back edges and edges between overlapped loop headers and their
successors.
"""
# loop detection
# only detect loops after potential graph normalization
if not self._loop_back_edges:
... | python | def remove_cycles(self):
"""
Forces graph to become acyclic, removes all loop back edges and edges between overlapped loop headers and their
successors.
"""
# loop detection
# only detect loops after potential graph normalization
if not self._loop_back_edges:
... | [
"def",
"remove_cycles",
"(",
"self",
")",
":",
"# loop detection",
"# only detect loops after potential graph normalization",
"if",
"not",
"self",
".",
"_loop_back_edges",
":",
"l",
".",
"debug",
"(",
"\"Detecting loops...\"",
")",
"self",
".",
"_detect_loops",
"(",
"... | Forces graph to become acyclic, removes all loop back edges and edges between overlapped loop headers and their
successors. | [
"Forces",
"graph",
"to",
"become",
"acyclic",
"removes",
"all",
"loop",
"back",
"edges",
"and",
"edges",
"between",
"overlapped",
"loop",
"headers",
"and",
"their",
"successors",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L355-L379 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.unroll_loops | def unroll_loops(self, max_loop_unrolling_times):
"""
Unroll loops for each function. The resulting CFG may still contain loops due to recursion, function calls, etc.
:param int max_loop_unrolling_times: The maximum iterations of unrolling.
:return: None
"""
if not isin... | python | def unroll_loops(self, max_loop_unrolling_times):
"""
Unroll loops for each function. The resulting CFG may still contain loops due to recursion, function calls, etc.
:param int max_loop_unrolling_times: The maximum iterations of unrolling.
:return: None
"""
if not isin... | [
"def",
"unroll_loops",
"(",
"self",
",",
"max_loop_unrolling_times",
")",
":",
"if",
"not",
"isinstance",
"(",
"max_loop_unrolling_times",
",",
"int",
")",
"or",
"max_loop_unrolling_times",
"<",
"0",
":",
"raise",
"AngrCFGError",
"(",
"'Max loop unrolling times must b... | Unroll loops for each function. The resulting CFG may still contain loops due to recursion, function calls, etc.
:param int max_loop_unrolling_times: The maximum iterations of unrolling.
:return: None | [
"Unroll",
"loops",
"for",
"each",
"function",
".",
"The",
"resulting",
"CFG",
"may",
"still",
"contain",
"loops",
"due",
"to",
"recursion",
"function",
"calls",
"etc",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L391-L444 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.force_unroll_loops | def force_unroll_loops(self, max_loop_unrolling_times):
"""
Unroll loops globally. The resulting CFG does not contain any loop, but this method is slow on large graphs.
:param int max_loop_unrolling_times: The maximum iterations of unrolling.
:return: None
"""
if not is... | python | def force_unroll_loops(self, max_loop_unrolling_times):
"""
Unroll loops globally. The resulting CFG does not contain any loop, but this method is slow on large graphs.
:param int max_loop_unrolling_times: The maximum iterations of unrolling.
:return: None
"""
if not is... | [
"def",
"force_unroll_loops",
"(",
"self",
",",
"max_loop_unrolling_times",
")",
":",
"if",
"not",
"isinstance",
"(",
"max_loop_unrolling_times",
",",
"int",
")",
"or",
"max_loop_unrolling_times",
"<",
"0",
":",
"raise",
"AngrCFGError",
"(",
"'Max loop unrolling times ... | Unroll loops globally. The resulting CFG does not contain any loop, but this method is slow on large graphs.
:param int max_loop_unrolling_times: The maximum iterations of unrolling.
:return: None | [
"Unroll",
"loops",
"globally",
".",
"The",
"resulting",
"CFG",
"does",
"not",
"contain",
"any",
"loop",
"but",
"this",
"method",
"is",
"slow",
"on",
"large",
"graphs",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L446-L562 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.immediate_dominators | def immediate_dominators(self, start, target_graph=None):
"""
Get all immediate dominators of sub graph from given node upwards.
:param str start: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, default is self.graph.
... | python | def immediate_dominators(self, start, target_graph=None):
"""
Get all immediate dominators of sub graph from given node upwards.
:param str start: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, default is self.graph.
... | [
"def",
"immediate_dominators",
"(",
"self",
",",
"start",
",",
"target_graph",
"=",
"None",
")",
":",
"return",
"self",
".",
"_immediate_dominators",
"(",
"start",
",",
"target_graph",
"=",
"target_graph",
",",
"reverse_graph",
"=",
"False",
")"
] | Get all immediate dominators of sub graph from given node upwards.
:param str start: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, default is self.graph.
:return: each node of graph as index values, with element as respective ... | [
"Get",
"all",
"immediate",
"dominators",
"of",
"sub",
"graph",
"from",
"given",
"node",
"upwards",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L564-L574 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.immediate_postdominators | def immediate_postdominators(self, end, target_graph=None):
"""
Get all immediate postdominators of sub graph from given node upwards.
:param str start: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, default is self.grap... | python | def immediate_postdominators(self, end, target_graph=None):
"""
Get all immediate postdominators of sub graph from given node upwards.
:param str start: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, default is self.grap... | [
"def",
"immediate_postdominators",
"(",
"self",
",",
"end",
",",
"target_graph",
"=",
"None",
")",
":",
"return",
"self",
".",
"_immediate_dominators",
"(",
"end",
",",
"target_graph",
"=",
"target_graph",
",",
"reverse_graph",
"=",
"True",
")"
] | Get all immediate postdominators of sub graph from given node upwards.
:param str start: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, default is self.graph.
:return: each node of graph as index values, with element as respect... | [
"Get",
"all",
"immediate",
"postdominators",
"of",
"sub",
"graph",
"from",
"given",
"node",
"upwards",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L576-L586 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.remove_fakerets | def remove_fakerets(self):
"""
Get rid of fake returns (i.e., Ijk_FakeRet edges) from this CFG
:return: None
"""
fakeret_edges = [ (src, dst) for src, dst, data in self.graph.edges(data=True)
if data['jumpkind'] == 'Ijk_FakeRet' ]
self.graph.remo... | python | def remove_fakerets(self):
"""
Get rid of fake returns (i.e., Ijk_FakeRet edges) from this CFG
:return: None
"""
fakeret_edges = [ (src, dst) for src, dst, data in self.graph.edges(data=True)
if data['jumpkind'] == 'Ijk_FakeRet' ]
self.graph.remo... | [
"def",
"remove_fakerets",
"(",
"self",
")",
":",
"fakeret_edges",
"=",
"[",
"(",
"src",
",",
"dst",
")",
"for",
"src",
",",
"dst",
",",
"data",
"in",
"self",
".",
"graph",
".",
"edges",
"(",
"data",
"=",
"True",
")",
"if",
"data",
"[",
"'jumpkind'"... | Get rid of fake returns (i.e., Ijk_FakeRet edges) from this CFG
:return: None | [
"Get",
"rid",
"of",
"fake",
"returns",
"(",
"i",
".",
"e",
".",
"Ijk_FakeRet",
"edges",
")",
"from",
"this",
"CFG"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L588-L596 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.get_topological_order | def get_topological_order(self, cfg_node):
"""
Get the topological order of a CFG Node.
:param cfg_node: A CFGNode instance.
:return: An integer representing its order, or None if the CFGNode does not exist in the graph.
"""
if not self._quasi_topological_order:
... | python | def get_topological_order(self, cfg_node):
"""
Get the topological order of a CFG Node.
:param cfg_node: A CFGNode instance.
:return: An integer representing its order, or None if the CFGNode does not exist in the graph.
"""
if not self._quasi_topological_order:
... | [
"def",
"get_topological_order",
"(",
"self",
",",
"cfg_node",
")",
":",
"if",
"not",
"self",
".",
"_quasi_topological_order",
":",
"self",
".",
"_quasi_topological_sort",
"(",
")",
"return",
"self",
".",
"_quasi_topological_order",
".",
"get",
"(",
"cfg_node",
"... | Get the topological order of a CFG Node.
:param cfg_node: A CFGNode instance.
:return: An integer representing its order, or None if the CFGNode does not exist in the graph. | [
"Get",
"the",
"topological",
"order",
"of",
"a",
"CFG",
"Node",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L598-L609 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.get_subgraph | def get_subgraph(self, starting_node, block_addresses):
"""
Get a sub-graph out of a bunch of basic block addresses.
:param CFGNode starting_node: The beginning of the subgraph
:param iterable block_addresses: A collection of block addresses that should be included in the subgraph if
... | python | def get_subgraph(self, starting_node, block_addresses):
"""
Get a sub-graph out of a bunch of basic block addresses.
:param CFGNode starting_node: The beginning of the subgraph
:param iterable block_addresses: A collection of block addresses that should be included in the subgraph if
... | [
"def",
"get_subgraph",
"(",
"self",
",",
"starting_node",
",",
"block_addresses",
")",
":",
"graph",
"=",
"networkx",
".",
"DiGraph",
"(",
")",
"if",
"starting_node",
"not",
"in",
"self",
".",
"graph",
":",
"raise",
"AngrCFGError",
"(",
"'get_subgraph(): the s... | Get a sub-graph out of a bunch of basic block addresses.
:param CFGNode starting_node: The beginning of the subgraph
:param iterable block_addresses: A collection of block addresses that should be included in the subgraph if
there is a path between `starting_node... | [
"Get",
"a",
"sub",
"-",
"graph",
"out",
"of",
"a",
"bunch",
"of",
"basic",
"block",
"addresses",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L611-L646 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.get_function_subgraph | def get_function_subgraph(self, start, max_call_depth=None):
"""
Get a sub-graph of a certain function.
:param start: The function start. Currently it should be an integer.
:param max_call_depth: Call depth limit. None indicates no limit.
:return: A CFG instance which is a sub-g... | python | def get_function_subgraph(self, start, max_call_depth=None):
"""
Get a sub-graph of a certain function.
:param start: The function start. Currently it should be an integer.
:param max_call_depth: Call depth limit. None indicates no limit.
:return: A CFG instance which is a sub-g... | [
"def",
"get_function_subgraph",
"(",
"self",
",",
"start",
",",
"max_call_depth",
"=",
"None",
")",
":",
"# FIXME: syscalls are not supported",
"# FIXME: start should also take a CFGNode instance",
"start_node",
"=",
"self",
".",
"get_any_node",
"(",
"start",
")",
"node_w... | Get a sub-graph of a certain function.
:param start: The function start. Currently it should be an integer.
:param max_call_depth: Call depth limit. None indicates no limit.
:return: A CFG instance which is a sub-graph of self.graph | [
"Get",
"a",
"sub",
"-",
"graph",
"of",
"a",
"certain",
"function",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L648-L702 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated.deadends | def deadends(self):
"""
Get all CFGNodes that has an out-degree of 0
:return: A list of CFGNode instances
:rtype: list
"""
if self.graph is None:
raise AngrCFGError('CFG hasn\'t been generated yet.')
deadends = [i for i in self.graph if self.graph.o... | python | def deadends(self):
"""
Get all CFGNodes that has an out-degree of 0
:return: A list of CFGNode instances
:rtype: list
"""
if self.graph is None:
raise AngrCFGError('CFG hasn\'t been generated yet.')
deadends = [i for i in self.graph if self.graph.o... | [
"def",
"deadends",
"(",
"self",
")",
":",
"if",
"self",
".",
"graph",
"is",
"None",
":",
"raise",
"AngrCFGError",
"(",
"'CFG hasn\\'t been generated yet.'",
")",
"deadends",
"=",
"[",
"i",
"for",
"i",
"in",
"self",
".",
"graph",
"if",
"self",
".",
"graph... | Get all CFGNodes that has an out-degree of 0
:return: A list of CFGNode instances
:rtype: list | [
"Get",
"all",
"CFGNodes",
"that",
"has",
"an",
"out",
"-",
"degree",
"of",
"0"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L756-L768 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._sanitize_parameters | def _sanitize_parameters(self):
"""
Perform a sanity check on parameters passed in to CFG.__init__().
An AngrCFGError is raised if any parameter fails the sanity check.
:return: None
"""
# Check additional_edges
if isinstance(self._additional_edges, (list, set, ... | python | def _sanitize_parameters(self):
"""
Perform a sanity check on parameters passed in to CFG.__init__().
An AngrCFGError is raised if any parameter fails the sanity check.
:return: None
"""
# Check additional_edges
if isinstance(self._additional_edges, (list, set, ... | [
"def",
"_sanitize_parameters",
"(",
"self",
")",
":",
"# Check additional_edges",
"if",
"isinstance",
"(",
"self",
".",
"_additional_edges",
",",
"(",
"list",
",",
"set",
",",
"tuple",
")",
")",
":",
"new_dict",
"=",
"defaultdict",
"(",
"list",
")",
"for",
... | Perform a sanity check on parameters passed in to CFG.__init__().
An AngrCFGError is raised if any parameter fails the sanity check.
:return: None | [
"Perform",
"a",
"sanity",
"check",
"on",
"parameters",
"passed",
"in",
"to",
"CFG",
".",
"__init__",
"()",
".",
"An",
"AngrCFGError",
"is",
"raised",
"if",
"any",
"parameter",
"fails",
"the",
"sanity",
"check",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L776-L809 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._job_sorting_key | def _job_sorting_key(self, job):
"""
Get the sorting key of a CFGJob instance.
:param CFGJob job: the CFGJob object.
:return: An integer that determines the order of this job in the queue.
:rtype: int
"""
if self._base_graph is None:
# we don't do so... | python | def _job_sorting_key(self, job):
"""
Get the sorting key of a CFGJob instance.
:param CFGJob job: the CFGJob object.
:return: An integer that determines the order of this job in the queue.
:rtype: int
"""
if self._base_graph is None:
# we don't do so... | [
"def",
"_job_sorting_key",
"(",
"self",
",",
"job",
")",
":",
"if",
"self",
".",
"_base_graph",
"is",
"None",
":",
"# we don't do sorting if there is no base_graph",
"return",
"0",
"MAX_JOBS",
"=",
"1000000",
"if",
"job",
".",
"addr",
"not",
"in",
"self",
".",... | Get the sorting key of a CFGJob instance.
:param CFGJob job: the CFGJob object.
:return: An integer that determines the order of this job in the queue.
:rtype: int | [
"Get",
"the",
"sorting",
"key",
"of",
"a",
"CFGJob",
"instance",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L853-L871 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._pre_analysis | def _pre_analysis(self):
"""
Initialization work. Executed prior to the analysis.
:return: None
"""
# Fill up self._starts
for item in self._starts:
callstack = None
if isinstance(item, tuple):
# (addr, jumpkind)
i... | python | def _pre_analysis(self):
"""
Initialization work. Executed prior to the analysis.
:return: None
"""
# Fill up self._starts
for item in self._starts:
callstack = None
if isinstance(item, tuple):
# (addr, jumpkind)
i... | [
"def",
"_pre_analysis",
"(",
"self",
")",
":",
"# Fill up self._starts",
"for",
"item",
"in",
"self",
".",
"_starts",
":",
"callstack",
"=",
"None",
"if",
"isinstance",
"(",
"item",
",",
"tuple",
")",
":",
"# (addr, jumpkind)",
"ip",
"=",
"item",
"[",
"0",... | Initialization work. Executed prior to the analysis.
:return: None | [
"Initialization",
"work",
".",
"Executed",
"prior",
"to",
"the",
"analysis",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L873-L904 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._job_queue_empty | def _job_queue_empty(self):
"""
A callback method called when the job queue is empty.
:return: None
"""
self._iteratively_clean_pending_exits()
while self._pending_jobs:
# We don't have any exits remaining. Let's pop out a pending exit
pending_j... | python | def _job_queue_empty(self):
"""
A callback method called when the job queue is empty.
:return: None
"""
self._iteratively_clean_pending_exits()
while self._pending_jobs:
# We don't have any exits remaining. Let's pop out a pending exit
pending_j... | [
"def",
"_job_queue_empty",
"(",
"self",
")",
":",
"self",
".",
"_iteratively_clean_pending_exits",
"(",
")",
"while",
"self",
".",
"_pending_jobs",
":",
"# We don't have any exits remaining. Let's pop out a pending exit",
"pending_job",
"=",
"self",
".",
"_get_one_pending_j... | A callback method called when the job queue is empty.
:return: None | [
"A",
"callback",
"method",
"called",
"when",
"the",
"job",
"queue",
"is",
"empty",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L917-L934 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._create_initial_state | def _create_initial_state(self, ip, jumpkind):
"""
Obtain a SimState object for a specific address
Fastpath means the CFG generation will work in an IDA-like way, in which it will not try to execute every
single statement in the emulator, but will just do the decoding job. This is much ... | python | def _create_initial_state(self, ip, jumpkind):
"""
Obtain a SimState object for a specific address
Fastpath means the CFG generation will work in an IDA-like way, in which it will not try to execute every
single statement in the emulator, but will just do the decoding job. This is much ... | [
"def",
"_create_initial_state",
"(",
"self",
",",
"ip",
",",
"jumpkind",
")",
":",
"jumpkind",
"=",
"\"Ijk_Boring\"",
"if",
"jumpkind",
"is",
"None",
"else",
"jumpkind",
"if",
"self",
".",
"_initial_state",
"is",
"None",
":",
"state",
"=",
"self",
".",
"pr... | Obtain a SimState object for a specific address
Fastpath means the CFG generation will work in an IDA-like way, in which it will not try to execute every
single statement in the emulator, but will just do the decoding job. This is much faster than the old way.
:param int ip: The instruction po... | [
"Obtain",
"a",
"SimState",
"object",
"for",
"a",
"specific",
"address"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L936-L973 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._get_one_pending_job | def _get_one_pending_job(self):
"""
Retrieve a pending job.
:return: A CFGJob instance or None
"""
pending_job_key, pending_job = self._pending_jobs.popitem()
pending_job_state = pending_job.state
pending_job_call_stack = pending_job.call_stack
pending_j... | python | def _get_one_pending_job(self):
"""
Retrieve a pending job.
:return: A CFGJob instance or None
"""
pending_job_key, pending_job = self._pending_jobs.popitem()
pending_job_state = pending_job.state
pending_job_call_stack = pending_job.call_stack
pending_j... | [
"def",
"_get_one_pending_job",
"(",
"self",
")",
":",
"pending_job_key",
",",
"pending_job",
"=",
"self",
".",
"_pending_jobs",
".",
"popitem",
"(",
")",
"pending_job_state",
"=",
"pending_job",
".",
"state",
"pending_job_call_stack",
"=",
"pending_job",
".",
"cal... | Retrieve a pending job.
:return: A CFGJob instance or None | [
"Retrieve",
"a",
"pending",
"job",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L975-L1016 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._process_hints | def _process_hints(self, analyzed_addrs):
"""
Process function hints in the binary.
:return: None
"""
# Function hints!
# Now let's see how many new functions we can get here...
while self._pending_function_hints:
f = self._pending_function_hints.pop... | python | def _process_hints(self, analyzed_addrs):
"""
Process function hints in the binary.
:return: None
"""
# Function hints!
# Now let's see how many new functions we can get here...
while self._pending_function_hints:
f = self._pending_function_hints.pop... | [
"def",
"_process_hints",
"(",
"self",
",",
"analyzed_addrs",
")",
":",
"# Function hints!",
"# Now let's see how many new functions we can get here...",
"while",
"self",
".",
"_pending_function_hints",
":",
"f",
"=",
"self",
".",
"_pending_function_hints",
".",
"pop",
"("... | Process function hints in the binary.
:return: None | [
"Process",
"function",
"hints",
"in",
"the",
"binary",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1018-L1046 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._post_analysis | def _post_analysis(self):
"""
Post-CFG-construction.
:return: None
"""
self._make_completed_functions()
new_changes = self._iteratively_analyze_function_features()
functions_do_not_return = new_changes['functions_do_not_return']
self._update_function_cal... | python | def _post_analysis(self):
"""
Post-CFG-construction.
:return: None
"""
self._make_completed_functions()
new_changes = self._iteratively_analyze_function_features()
functions_do_not_return = new_changes['functions_do_not_return']
self._update_function_cal... | [
"def",
"_post_analysis",
"(",
"self",
")",
":",
"self",
".",
"_make_completed_functions",
"(",
")",
"new_changes",
"=",
"self",
".",
"_iteratively_analyze_function_features",
"(",
")",
"functions_do_not_return",
"=",
"new_changes",
"[",
"'functions_do_not_return'",
"]",... | Post-CFG-construction.
:return: None | [
"Post",
"-",
"CFG",
"-",
"construction",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1048-L1068 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._pre_job_handling | def _pre_job_handling(self, job): # pylint:disable=arguments-differ
"""
Before processing a CFGJob.
Right now each block is traced at most once. If it is traced more than once, we will mark it as "should_skip"
before tracing it.
An AngrForwardAnalysisSkipJob exception is raised ... | python | def _pre_job_handling(self, job): # pylint:disable=arguments-differ
"""
Before processing a CFGJob.
Right now each block is traced at most once. If it is traced more than once, we will mark it as "should_skip"
before tracing it.
An AngrForwardAnalysisSkipJob exception is raised ... | [
"def",
"_pre_job_handling",
"(",
"self",
",",
"job",
")",
":",
"# pylint:disable=arguments-differ",
"# Extract initial info the CFGJob",
"job",
".",
"call_stack_suffix",
"=",
"job",
".",
"get_call_stack_suffix",
"(",
")",
"job",
".",
"current_function",
"=",
"self",
"... | Before processing a CFGJob.
Right now each block is traced at most once. If it is traced more than once, we will mark it as "should_skip"
before tracing it.
An AngrForwardAnalysisSkipJob exception is raised in order to skip analyzing the job.
:param CFGJob job: The CFG job object.
... | [
"Before",
"processing",
"a",
"CFGJob",
".",
"Right",
"now",
"each",
"block",
"is",
"traced",
"at",
"most",
"once",
".",
"If",
"it",
"is",
"traced",
"more",
"than",
"once",
"we",
"will",
"mark",
"it",
"as",
"should_skip",
"before",
"tracing",
"it",
".",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1072-L1248 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._get_successors | def _get_successors(self, job):
"""
Get a collection of successors out of the current job.
:param CFGJob job: The CFGJob instance.
:return: A collection of successors.
:rtype: list
"""
addr = job.addr
sim_successors = job.sim_succ... | python | def _get_successors(self, job):
"""
Get a collection of successors out of the current job.
:param CFGJob job: The CFGJob instance.
:return: A collection of successors.
:rtype: list
"""
addr = job.addr
sim_successors = job.sim_succ... | [
"def",
"_get_successors",
"(",
"self",
",",
"job",
")",
":",
"addr",
"=",
"job",
".",
"addr",
"sim_successors",
"=",
"job",
".",
"sim_successors",
"cfg_node",
"=",
"job",
".",
"cfg_node",
"input_state",
"=",
"job",
".",
"state",
"func_addr",
"=",
"job",
... | Get a collection of successors out of the current job.
:param CFGJob job: The CFGJob instance.
:return: A collection of successors.
:rtype: list | [
"Get",
"a",
"collection",
"of",
"successors",
"out",
"of",
"the",
"current",
"job",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1250-L1418 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._post_process_successors | def _post_process_successors(self, input_state, sim_successors, successors):
"""
Filter the list of successors
:param SimState input_state: Input state.
:param SimSuccessors sim_successors: The SimSuccessors instance.
:param list successors: ... | python | def _post_process_successors(self, input_state, sim_successors, successors):
"""
Filter the list of successors
:param SimState input_state: Input state.
:param SimSuccessors sim_successors: The SimSuccessors instance.
:param list successors: ... | [
"def",
"_post_process_successors",
"(",
"self",
",",
"input_state",
",",
"sim_successors",
",",
"successors",
")",
":",
"if",
"sim_successors",
".",
"sort",
"==",
"'IRSB'",
"and",
"input_state",
".",
"thumb",
":",
"successors",
"=",
"self",
".",
"_arm_thumb_filt... | Filter the list of successors
:param SimState input_state: Input state.
:param SimSuccessors sim_successors: The SimSuccessors instance.
:param list successors: A list of successors generated after processing the current block.
:return: ... | [
"Filter",
"the",
"list",
"of",
"successors"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1441-L1477 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._post_handle_job_debug | def _post_handle_job_debug(self, job, successors):
"""
Post job handling: print debugging information regarding the current job.
:param CFGJob job: The current CFGJob instance.
:param list successors: All successors of the analysis job.
:return: None
"""
si... | python | def _post_handle_job_debug(self, job, successors):
"""
Post job handling: print debugging information regarding the current job.
:param CFGJob job: The current CFGJob instance.
:param list successors: All successors of the analysis job.
:return: None
"""
si... | [
"def",
"_post_handle_job_debug",
"(",
"self",
",",
"job",
",",
"successors",
")",
":",
"sim_successors",
"=",
"job",
".",
"sim_successors",
"call_stack_suffix",
"=",
"job",
".",
"call_stack_suffix",
"extra_info",
"=",
"job",
".",
"extra_info",
"successor_status",
... | Post job handling: print debugging information regarding the current job.
:param CFGJob job: The current CFGJob instance.
:param list successors: All successors of the analysis job.
:return: None | [
"Post",
"job",
"handling",
":",
"print",
"debugging",
"information",
"regarding",
"the",
"current",
"job",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1479-L1520 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._iteratively_clean_pending_exits | def _iteratively_clean_pending_exits(self):
"""
Iteratively update the completed functions set, analyze whether each function returns or not, and remove
pending exits if the callee function does not return. We do this iteratively so that we come to a fixed point
in the end. In most cases... | python | def _iteratively_clean_pending_exits(self):
"""
Iteratively update the completed functions set, analyze whether each function returns or not, and remove
pending exits if the callee function does not return. We do this iteratively so that we come to a fixed point
in the end. In most cases... | [
"def",
"_iteratively_clean_pending_exits",
"(",
"self",
")",
":",
"while",
"True",
":",
"# did we finish analyzing any function?",
"# fill in self._completed_functions",
"self",
".",
"_make_completed_functions",
"(",
")",
"if",
"self",
".",
"_pending_jobs",
":",
"# There ar... | Iteratively update the completed functions set, analyze whether each function returns or not, and remove
pending exits if the callee function does not return. We do this iteratively so that we come to a fixed point
in the end. In most cases, the number of outer iteration equals to the maximum levels of ... | [
"Iteratively",
"update",
"the",
"completed",
"functions",
"set",
"analyze",
"whether",
"each",
"function",
"returns",
"or",
"not",
"and",
"remove",
"pending",
"exits",
"if",
"the",
"callee",
"function",
"does",
"not",
"return",
".",
"We",
"do",
"this",
"iterat... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1522-L1557 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._clean_pending_exits | def _clean_pending_exits(self):
"""
Remove those pending exits if:
a) they are the return exits of non-returning SimProcedures
b) they are the return exits of non-returning syscalls
c) they are the return exits of non-returning functions
:return: True if any pending exit... | python | def _clean_pending_exits(self):
"""
Remove those pending exits if:
a) they are the return exits of non-returning SimProcedures
b) they are the return exits of non-returning syscalls
c) they are the return exits of non-returning functions
:return: True if any pending exit... | [
"def",
"_clean_pending_exits",
"(",
"self",
")",
":",
"pending_exits_to_remove",
"=",
"[",
"]",
"for",
"block_id",
",",
"pe",
"in",
"self",
".",
"_pending_jobs",
".",
"items",
"(",
")",
":",
"if",
"pe",
".",
"returning_source",
"is",
"None",
":",
"# The or... | Remove those pending exits if:
a) they are the return exits of non-returning SimProcedures
b) they are the return exits of non-returning syscalls
c) they are the return exits of non-returning functions
:return: True if any pending exits are removed, False otherwise
:rtype: bool | [
"Remove",
"those",
"pending",
"exits",
"if",
":",
"a",
")",
"they",
"are",
"the",
"return",
"exits",
"of",
"non",
"-",
"returning",
"SimProcedures",
"b",
")",
"they",
"are",
"the",
"return",
"exits",
"of",
"non",
"-",
"returning",
"syscalls",
"c",
")",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1559-L1614 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._handle_successor | def _handle_successor(self, job, successor, successors):
"""
Returns a new CFGJob instance for further analysis, or None if there is no immediate state to perform the
analysis on.
:param CFGJob job: The current job.
"""
state = successor
all_successor_states = s... | python | def _handle_successor(self, job, successor, successors):
"""
Returns a new CFGJob instance for further analysis, or None if there is no immediate state to perform the
analysis on.
:param CFGJob job: The current job.
"""
state = successor
all_successor_states = s... | [
"def",
"_handle_successor",
"(",
"self",
",",
"job",
",",
"successor",
",",
"successors",
")",
":",
"state",
"=",
"successor",
"all_successor_states",
"=",
"successors",
"addr",
"=",
"job",
".",
"addr",
"# The PathWrapper instance to return",
"pw",
"=",
"None",
... | Returns a new CFGJob instance for further analysis, or None if there is no immediate state to perform the
analysis on.
:param CFGJob job: The current job. | [
"Returns",
"a",
"new",
"CFGJob",
"instance",
"for",
"further",
"analysis",
"or",
"None",
"if",
"there",
"is",
"no",
"immediate",
"state",
"to",
"perform",
"the",
"analysis",
"on",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1635-L1821 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._handle_job_without_successors | def _handle_job_without_successors(self, job, irsb, insn_addrs):
"""
A block without successors should still be handled so it can be added to the function graph correctly.
:param CFGJob job: The current job that do not have any successor.
:param IRSB irsb: The related IRSB.
:... | python | def _handle_job_without_successors(self, job, irsb, insn_addrs):
"""
A block without successors should still be handled so it can be added to the function graph correctly.
:param CFGJob job: The current job that do not have any successor.
:param IRSB irsb: The related IRSB.
:... | [
"def",
"_handle_job_without_successors",
"(",
"self",
",",
"job",
",",
"irsb",
",",
"insn_addrs",
")",
":",
"# it's not an empty block",
"# handle all conditional exits",
"ins_addr",
"=",
"job",
".",
"addr",
"for",
"stmt_idx",
",",
"stmt",
"in",
"enumerate",
"(",
... | A block without successors should still be handled so it can be added to the function graph correctly.
:param CFGJob job: The current job that do not have any successor.
:param IRSB irsb: The related IRSB.
:param insn_addrs: A list of instruction addresses of this IRSB.
:return: Non... | [
"A",
"block",
"without",
"successors",
"should",
"still",
"be",
"handled",
"so",
"it",
"can",
"be",
"added",
"to",
"the",
"function",
"graph",
"correctly",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1823-L1856 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._handle_actions | def _handle_actions(self, state, current_run, func, sp_addr, accessed_registers):
"""
For a given state and current location of of execution, will update a function by adding the offets of
appropriate actions to the stack variable or argument registers for the fnc.
:param SimState state... | python | def _handle_actions(self, state, current_run, func, sp_addr, accessed_registers):
"""
For a given state and current location of of execution, will update a function by adding the offets of
appropriate actions to the stack variable or argument registers for the fnc.
:param SimState state... | [
"def",
"_handle_actions",
"(",
"self",
",",
"state",
",",
"current_run",
",",
"func",
",",
"sp_addr",
",",
"accessed_registers",
")",
":",
"se",
"=",
"state",
".",
"solver",
"if",
"func",
"is",
"not",
"None",
"and",
"sp_addr",
"is",
"not",
"None",
":",
... | For a given state and current location of of execution, will update a function by adding the offets of
appropriate actions to the stack variable or argument registers for the fnc.
:param SimState state: upcoming state.
:param SimSuccessors current_run: possible result states.
:param kno... | [
"For",
"a",
"given",
"state",
"and",
"current",
"location",
"of",
"of",
"execution",
"will",
"update",
"a",
"function",
"by",
"adding",
"the",
"offets",
"of",
"appropriate",
"actions",
"to",
"the",
"stack",
"variable",
"or",
"argument",
"registers",
"for",
"... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1860-L1900 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._update_function_transition_graph | def _update_function_transition_graph(self, src_node_key, dst_node_key, jumpkind='Ijk_Boring', ins_addr=None,
stmt_idx=None, confirmed=None):
"""
Update transition graphs of functions in function manager based on information passed in.
:param str jumpki... | python | def _update_function_transition_graph(self, src_node_key, dst_node_key, jumpkind='Ijk_Boring', ins_addr=None,
stmt_idx=None, confirmed=None):
"""
Update transition graphs of functions in function manager based on information passed in.
:param str jumpki... | [
"def",
"_update_function_transition_graph",
"(",
"self",
",",
"src_node_key",
",",
"dst_node_key",
",",
"jumpkind",
"=",
"'Ijk_Boring'",
",",
"ins_addr",
"=",
"None",
",",
"stmt_idx",
"=",
"None",
",",
"confirmed",
"=",
"None",
")",
":",
"if",
"dst_node_key",
... | Update transition graphs of functions in function manager based on information passed in.
:param str jumpkind: Jumpkind.
:param CFGNode src_node: Source CFGNode
:param CFGNode dst_node: Destionation CFGNode
:param int ret_addr: The theoretical return address for calls
:return: N... | [
"Update",
"transition",
"graphs",
"of",
"functions",
"in",
"function",
"manager",
"based",
"on",
"information",
"passed",
"in",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L1969-L2085 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._update_function_callsites | def _update_function_callsites(self, noreturns):
"""
Update the callsites of functions (remove return targets) that are calling functions that are just deemed not
returning.
:param iterable func_addrs: A collection of functions for newly-recovered non-returning functions.
:retur... | python | def _update_function_callsites(self, noreturns):
"""
Update the callsites of functions (remove return targets) that are calling functions that are just deemed not
returning.
:param iterable func_addrs: A collection of functions for newly-recovered non-returning functions.
:retur... | [
"def",
"_update_function_callsites",
"(",
"self",
",",
"noreturns",
")",
":",
"for",
"callee_func",
"in",
"noreturns",
":",
"# consult the callgraph to find callers of each function",
"if",
"callee_func",
".",
"addr",
"not",
"in",
"self",
".",
"functions",
".",
"callg... | Update the callsites of functions (remove return targets) that are calling functions that are just deemed not
returning.
:param iterable func_addrs: A collection of functions for newly-recovered non-returning functions.
:return: None | [
"Update",
"the",
"callsites",
"of",
"functions",
"(",
"remove",
"return",
"targets",
")",
"that",
"are",
"calling",
"functions",
"that",
"are",
"just",
"deemed",
"not",
"returning",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2087-L2107 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._filter_insane_successors | def _filter_insane_successors(self, successors):
"""
Throw away all successors whose target doesn't make sense
This method is called after we resolve an indirect jump using an unreliable method (like, not through one of
the indirect jump resolvers, but through either pure concrete execu... | python | def _filter_insane_successors(self, successors):
"""
Throw away all successors whose target doesn't make sense
This method is called after we resolve an indirect jump using an unreliable method (like, not through one of
the indirect jump resolvers, but through either pure concrete execu... | [
"def",
"_filter_insane_successors",
"(",
"self",
",",
"successors",
")",
":",
"old_successors",
"=",
"successors",
"[",
":",
":",
"]",
"successors",
"=",
"[",
"]",
"for",
"i",
",",
"suc",
"in",
"enumerate",
"(",
"old_successors",
")",
":",
"if",
"suc",
"... | Throw away all successors whose target doesn't make sense
This method is called after we resolve an indirect jump using an unreliable method (like, not through one of
the indirect jump resolvers, but through either pure concrete execution or backward slicing) to filter out the
obviously incorre... | [
"Throw",
"away",
"all",
"successors",
"whose",
"target",
"doesn",
"t",
"make",
"sense"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2138-L2172 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._remove_non_return_edges | def _remove_non_return_edges(self):
"""
Remove those return_from_call edges that actually do not return due to
calling some not-returning functions.
:return: None
"""
for func in self.kb.functions.values():
graph = func.transition_graph
all_return_... | python | def _remove_non_return_edges(self):
"""
Remove those return_from_call edges that actually do not return due to
calling some not-returning functions.
:return: None
"""
for func in self.kb.functions.values():
graph = func.transition_graph
all_return_... | [
"def",
"_remove_non_return_edges",
"(",
"self",
")",
":",
"for",
"func",
"in",
"self",
".",
"kb",
".",
"functions",
".",
"values",
"(",
")",
":",
"graph",
"=",
"func",
".",
"transition_graph",
"all_return_edges",
"=",
"[",
"(",
"u",
",",
"v",
")",
"for... | Remove those return_from_call edges that actually do not return due to
calling some not-returning functions.
:return: None | [
"Remove",
"those",
"return_from_call",
"edges",
"that",
"actually",
"do",
"not",
"return",
"due",
"to",
"calling",
"some",
"not",
"-",
"returning",
"functions",
".",
":",
"return",
":",
"None"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2174-L2203 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._convert_indirect_jump_targets_to_states | def _convert_indirect_jump_targets_to_states(job, indirect_jump_targets):
"""
Convert each concrete indirect jump target into a SimState.
:param job: The CFGJob instance.
:param indirect_jump_targets: A collection of concrete jump targets resolved from a indirect j... | python | def _convert_indirect_jump_targets_to_states(job, indirect_jump_targets):
"""
Convert each concrete indirect jump target into a SimState.
:param job: The CFGJob instance.
:param indirect_jump_targets: A collection of concrete jump targets resolved from a indirect j... | [
"def",
"_convert_indirect_jump_targets_to_states",
"(",
"job",
",",
"indirect_jump_targets",
")",
":",
"successors",
"=",
"[",
"]",
"for",
"t",
"in",
"indirect_jump_targets",
":",
"# Insert new successors",
"a",
"=",
"job",
".",
"sim_successors",
".",
"all_successors"... | Convert each concrete indirect jump target into a SimState.
:param job: The CFGJob instance.
:param indirect_jump_targets: A collection of concrete jump targets resolved from a indirect jump.
:return: A list of SimStates.
:rtype: ... | [
"Convert",
"each",
"concrete",
"indirect",
"jump",
"target",
"into",
"a",
"SimState",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2214-L2230 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._try_resolving_indirect_jumps | def _try_resolving_indirect_jumps(self, sim_successors, cfg_node, func_addr, successors, exception_info, artifacts):
"""
Resolve indirect jumps specified by sim_successors.addr.
:param SimSuccessors sim_successors: The SimSuccessors instance.
:param CFGNode cfg_node: ... | python | def _try_resolving_indirect_jumps(self, sim_successors, cfg_node, func_addr, successors, exception_info, artifacts):
"""
Resolve indirect jumps specified by sim_successors.addr.
:param SimSuccessors sim_successors: The SimSuccessors instance.
:param CFGNode cfg_node: ... | [
"def",
"_try_resolving_indirect_jumps",
"(",
"self",
",",
"sim_successors",
",",
"cfg_node",
",",
"func_addr",
",",
"successors",
",",
"exception_info",
",",
"artifacts",
")",
":",
"# Try to resolve indirect jumps with advanced backward slicing (if enabled)",
"if",
"sim_succe... | Resolve indirect jumps specified by sim_successors.addr.
:param SimSuccessors sim_successors: The SimSuccessors instance.
:param CFGNode cfg_node: The CFGNode instance.
:param int func_addr: Current function address.
:param list successors: ... | [
"Resolve",
"indirect",
"jumps",
"specified",
"by",
"sim_successors",
".",
"addr",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2232-L2391 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._backward_slice_indirect | def _backward_slice_indirect(self, cfgnode, sim_successors, current_function_addr):
"""
Try to resolve an indirect jump by slicing backwards
"""
# TODO: make this a real indirect jump resolver under the new paradigm
irsb = sim_successors.artifacts['irsb'] # shorthand
l... | python | def _backward_slice_indirect(self, cfgnode, sim_successors, current_function_addr):
"""
Try to resolve an indirect jump by slicing backwards
"""
# TODO: make this a real indirect jump resolver under the new paradigm
irsb = sim_successors.artifacts['irsb'] # shorthand
l... | [
"def",
"_backward_slice_indirect",
"(",
"self",
",",
"cfgnode",
",",
"sim_successors",
",",
"current_function_addr",
")",
":",
"# TODO: make this a real indirect jump resolver under the new paradigm",
"irsb",
"=",
"sim_successors",
".",
"artifacts",
"[",
"'irsb'",
"]",
"# s... | Try to resolve an indirect jump by slicing backwards | [
"Try",
"to",
"resolve",
"an",
"indirect",
"jump",
"by",
"slicing",
"backwards"
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2393-L2508 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._symbolically_back_traverse | def _symbolically_back_traverse(self, current_block, block_artifacts, cfg_node):
"""
Symbolically executes from ancestor nodes (2-5 times removed) finding paths of execution through the given
CFGNode.
:param SimSuccessors current_block: SimSuccessor with address to attempt to navigate t... | python | def _symbolically_back_traverse(self, current_block, block_artifacts, cfg_node):
"""
Symbolically executes from ancestor nodes (2-5 times removed) finding paths of execution through the given
CFGNode.
:param SimSuccessors current_block: SimSuccessor with address to attempt to navigate t... | [
"def",
"_symbolically_back_traverse",
"(",
"self",
",",
"current_block",
",",
"block_artifacts",
",",
"cfg_node",
")",
":",
"class",
"register_protector",
":",
"def",
"__init__",
"(",
"self",
",",
"reg_offset",
",",
"info_collection",
")",
":",
"\"\"\"\n ... | Symbolically executes from ancestor nodes (2-5 times removed) finding paths of execution through the given
CFGNode.
:param SimSuccessors current_block: SimSuccessor with address to attempt to navigate to.
:param dict block_artifacts: Container of IRSB data - specifically used for known persist... | [
"Symbolically",
"executes",
"from",
"ancestor",
"nodes",
"(",
"2",
"-",
"5",
"times",
"removed",
")",
"finding",
"paths",
"of",
"execution",
"through",
"the",
"given",
"CFGNode",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2510-L2639 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._get_symbolic_function_initial_state | def _get_symbolic_function_initial_state(self, function_addr, fastpath_mode_state=None):
"""
Symbolically execute the first basic block of the specified function,
then returns it. We prepares the state using the already existing
state in fastpath mode (if avaiable).
:param functi... | python | def _get_symbolic_function_initial_state(self, function_addr, fastpath_mode_state=None):
"""
Symbolically execute the first basic block of the specified function,
then returns it. We prepares the state using the already existing
state in fastpath mode (if avaiable).
:param functi... | [
"def",
"_get_symbolic_function_initial_state",
"(",
"self",
",",
"function_addr",
",",
"fastpath_mode_state",
"=",
"None",
")",
":",
"if",
"function_addr",
"is",
"None",
":",
"return",
"None",
"if",
"function_addr",
"in",
"self",
".",
"_symbolic_function_initial_state... | Symbolically execute the first basic block of the specified function,
then returns it. We prepares the state using the already existing
state in fastpath mode (if avaiable).
:param function_addr: The function address
:return: A symbolic state if succeeded, None otherwise | [
"Symbolically",
"execute",
"the",
"first",
"basic",
"block",
"of",
"the",
"specified",
"function",
"then",
"returns",
"it",
".",
"We",
"prepares",
"the",
"state",
"using",
"the",
"already",
"existing",
"state",
"in",
"fastpath",
"mode",
"(",
"if",
"avaiable",
... | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2641-L2696 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._search_for_function_hints | def _search_for_function_hints(self, successor_state):
"""
Scan for constants that might be used as exit targets later, and add them into pending_exits.
:param SimState successor_state: A successing state.
:return: A list of discovered code addresses.
... | python | def _search_for_function_hints(self, successor_state):
"""
Scan for constants that might be used as exit targets later, and add them into pending_exits.
:param SimState successor_state: A successing state.
:return: A list of discovered code addresses.
... | [
"def",
"_search_for_function_hints",
"(",
"self",
",",
"successor_state",
")",
":",
"function_hints",
"=",
"[",
"]",
"for",
"action",
"in",
"successor_state",
".",
"history",
".",
"recent_actions",
":",
"if",
"action",
".",
"type",
"==",
"'reg'",
"and",
"actio... | Scan for constants that might be used as exit targets later, and add them into pending_exits.
:param SimState successor_state: A successing state.
:return: A list of discovered code addresses.
:rtype: list | [
"Scan",
"for",
"constants",
"that",
"might",
"be",
"used",
"as",
"exit",
"targets",
"later",
"and",
"add",
"them",
"into",
"pending_exits",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2700-L2748 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._get_simsuccessors | def _get_simsuccessors(self, addr, job, current_function_addr=None):
"""
Create the SimSuccessors instance for a block.
:param int addr: Address of the block.
:param CFGJob job: The CFG job instance with an input state inside.
:param int current_f... | python | def _get_simsuccessors(self, addr, job, current_function_addr=None):
"""
Create the SimSuccessors instance for a block.
:param int addr: Address of the block.
:param CFGJob job: The CFG job instance with an input state inside.
:param int current_f... | [
"def",
"_get_simsuccessors",
"(",
"self",
",",
"addr",
",",
"job",
",",
"current_function_addr",
"=",
"None",
")",
":",
"exception_info",
"=",
"None",
"state",
"=",
"job",
".",
"state",
"saved_state",
"=",
"job",
".",
"state",
"# We don't have to make a copy her... | Create the SimSuccessors instance for a block.
:param int addr: Address of the block.
:param CFGJob job: The CFG job instance with an input state inside.
:param int current_function_addr: Address of the current function.
:return: ... | [
"Create",
"the",
"SimSuccessors",
"instance",
"for",
"a",
"block",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2752-L2915 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._create_new_call_stack | def _create_new_call_stack(self, addr, all_jobs, job, exit_target, jumpkind):
"""
Creates a new call stack, and according to the jumpkind performs appropriate actions.
:param int addr: Address to create at.
:param Simsuccessors all_jobs: Jobs to get s... | python | def _create_new_call_stack(self, addr, all_jobs, job, exit_target, jumpkind):
"""
Creates a new call stack, and according to the jumpkind performs appropriate actions.
:param int addr: Address to create at.
:param Simsuccessors all_jobs: Jobs to get s... | [
"def",
"_create_new_call_stack",
"(",
"self",
",",
"addr",
",",
"all_jobs",
",",
"job",
",",
"exit_target",
",",
"jumpkind",
")",
":",
"if",
"self",
".",
"_is_call_jumpkind",
"(",
"jumpkind",
")",
":",
"new_call_stack",
"=",
"job",
".",
"call_stack_copy",
"(... | Creates a new call stack, and according to the jumpkind performs appropriate actions.
:param int addr: Address to create at.
:param Simsuccessors all_jobs: Jobs to get stack pointer from or return address.
:param CFGJob job: CFGJob to c... | [
"Creates",
"a",
"new",
"call",
"stack",
"and",
"according",
"to",
"the",
"jumpkind",
"performs",
"appropriate",
"actions",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L2917-L3017 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._create_cfgnode | def _create_cfgnode(self, sim_successors, call_stack, func_addr, block_id=None, depth=None, exception_info=None):
"""
Create a context-sensitive CFGNode instance for a specific block.
:param SimSuccessors sim_successors: The SimSuccessors object.
:param CallStack call_stack_suff... | python | def _create_cfgnode(self, sim_successors, call_stack, func_addr, block_id=None, depth=None, exception_info=None):
"""
Create a context-sensitive CFGNode instance for a specific block.
:param SimSuccessors sim_successors: The SimSuccessors object.
:param CallStack call_stack_suff... | [
"def",
"_create_cfgnode",
"(",
"self",
",",
"sim_successors",
",",
"call_stack",
",",
"func_addr",
",",
"block_id",
"=",
"None",
",",
"depth",
"=",
"None",
",",
"exception_info",
"=",
"None",
")",
":",
"sa",
"=",
"sim_successors",
".",
"artifacts",
"# shorth... | Create a context-sensitive CFGNode instance for a specific block.
:param SimSuccessors sim_successors: The SimSuccessors object.
:param CallStack call_stack_suffix: The call stack.
:param int func_addr: Address of the current function.
:param Bloc... | [
"Create",
"a",
"context",
"-",
"sensitive",
"CFGNode",
"instance",
"for",
"a",
"specific",
"block",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L3019-L3085 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._detect_loops | def _detect_loops(self, loop_callback=None):
"""
Loop detection.
:param func loop_callback: A callback function for each detected loop backedge.
:return: None
"""
loop_finder = self.project.analyses.LoopFinder(kb=self.kb, normalize=False, fail_fast=self._fail_fast)
... | python | def _detect_loops(self, loop_callback=None):
"""
Loop detection.
:param func loop_callback: A callback function for each detected loop backedge.
:return: None
"""
loop_finder = self.project.analyses.LoopFinder(kb=self.kb, normalize=False, fail_fast=self._fail_fast)
... | [
"def",
"_detect_loops",
"(",
"self",
",",
"loop_callback",
"=",
"None",
")",
":",
"loop_finder",
"=",
"self",
".",
"project",
".",
"analyses",
".",
"LoopFinder",
"(",
"kb",
"=",
"self",
".",
"kb",
",",
"normalize",
"=",
"False",
",",
"fail_fast",
"=",
... | Loop detection.
:param func loop_callback: A callback function for each detected loop backedge.
:return: None | [
"Loop",
"detection",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L3089-L3108 | train |
angr/angr | angr/analyses/cfg/cfg_emulated.py | CFGEmulated._immediate_dominators | def _immediate_dominators(self, node, target_graph=None, reverse_graph=False):
"""
Get all immediate dominators of sub graph from given node upwards.
:param str node: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, defaul... | python | def _immediate_dominators(self, node, target_graph=None, reverse_graph=False):
"""
Get all immediate dominators of sub graph from given node upwards.
:param str node: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, defaul... | [
"def",
"_immediate_dominators",
"(",
"self",
",",
"node",
",",
"target_graph",
"=",
"None",
",",
"reverse_graph",
"=",
"False",
")",
":",
"if",
"target_graph",
"is",
"None",
":",
"target_graph",
"=",
"self",
".",
"graph",
"if",
"node",
"not",
"in",
"target... | Get all immediate dominators of sub graph from given node upwards.
:param str node: id of the node to navigate forwards from.
:param networkx.classes.digraph.DiGraph target_graph: graph to analyse, default is self.graph.
:param bool reverse_graph: Whether the target graph should be reversed bef... | [
"Get",
"all",
"immediate",
"dominators",
"of",
"sub",
"graph",
"from",
"given",
"node",
"upwards",
"."
] | 4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40 | https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_emulated.py#L3212-L3269 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.