Skip to content

analyzers.py

ofrak.core.patch_maker.analyzers

ComplexBlockSymbolAnalyzer (Analyzer)

analyze(self, resource, config=None) async

Analyze a resource for to extract specific ResourceAttributes.

Users should not call this method directly; rather, they should run Resource.run or Resource.analyze.

Parameters:

Name Type Description Default
resource Resource

The resource that is being analyzed

required
config ComponentConfig

Optional config for analyzing. If an implementation provides a default, this default will always be used when config would otherwise be None. Note that a copy of the default config will be passed, so the default config values cannot be modified persistently by a component run.

None

Returns:

Type Description
LinkableSymbol

The analysis results

Source code in ofrak/core/patch_maker/analyzers.py
async def analyze(self, resource: Resource, config: ComponentConfig = None) -> LinkableSymbol:
    cb = await resource.view_as(ComplexBlock)
    cb_mode = await cb.get_mode()

    return LinkableSymbol(
        cb.VirtualAddress,
        cb.Symbol,
        LinkableSymbolType.FUNC,
        cb_mode,
    )