angr.analyses.decompiler.known_patterns.context¶
PatternContext: the architecture / platform / language facts a KnownPattern template needs to instantiate itself for a given binary.
A pattern is defined once as a KnownPatternTemplate whose
build(ctx) computes concrete field offsets, load sizes, and return types
from a PatternContext, so a single definition covers 32- and 64-bit,
libstdc++ and MSVC, etc.
- angr.analyses.decompiler.known_patterns.context.size_t_typename(bits)¶
The C spelling of size_t for a given word width.
- angr.analyses.decompiler.known_patterns.context.detect_linux_kernel_object(project)¶
Whether the main object is a Linux kernel module or the kernel image.
Sections are checked first because they are the cheap and decisive signal: modpost emits
.modinfoand.gnu.linkonce.this_moduleinto every.ko, and they survive stripping. The__ksymtab/__kcrctabsymbol scan additionally catches a vmlinux and modules whose section names were renamed.
- angr.analyses.decompiler.known_patterns.context.detect_windows_kernel_driver(project)¶
Whether the main object is a Windows kernel-mode driver, i.e. imports the kernel executive / HAL / a kernel-mode port or class library instead of the user-mode Win32 DLLs.
- angr.analyses.decompiler.known_patterns.context.detect_cxx_runtime(project)¶
Identify the C++ standard-library runtime:
"msvc","libstdcxx", or None. Mirrors the old is_cpp_binary / is_msvc_cpp_binary heuristics: dependency names first, then mangled-symbol evidence (mingw PEs link libstdc++ and use its layouts even though they are PEs), then, for statically linked, stripped binaries that carry neither, RTTI type descriptors embedded in data sections.
- class angr.analyses.decompiler.known_patterns.context.PatternContext¶
Bases:
objectTarget facts used to instantiate pattern templates.
The last two fields are binary evidence: facts about what kind of program this is, used by
gatingto switch whole pattern families on for targets where the idioms are certain to appear and off everywhere else.- arch_name: str
- bits: int
- ptr_size: int
- is_cpp: bool
- __init__(arch_name, bits, ptr_size, platform, cxx_runtime, is_cpp, is_linux_kernel_object=False, is_windows_kernel_driver=False)¶