Request & Result¶
DecompileRequest is the input payload for one
function decompilation. DecompileResult is the
output, carrying decompiled C code, structured function data, warnings, and
an optional error descriptor.
Request and Result¶
flatline.DecompileRequest
dataclass
¶
DecompileRequest(memory_image: bytes, base_address: int, function_address: int, language_id: str, compiler_spec: str | None = None, runtime_data_dir: str | None = None, function_size_hint: int | None = None, analysis_budget: AnalysisBudget | None = None, enriched: bool = False, tail_padding: bytes | None = b'\x00')
Input payload for one function decompilation.
The caller provides a flat memory image covering the relevant address space. The library does not perform binary format parsing; callers working with binary files must extract memory content first.
Attributes:
| Name | Type | Description |
|---|---|---|
memory_image |
bytes
|
Byte content of the target memory region. Must be
non-empty |
base_address |
int
|
Virtual address of the start of |
function_address |
int
|
Entry point virtual address of the function to decompile, within the memory image. |
language_id |
str
|
Target architecture identifier (e.g.
|
compiler_spec |
str | None
|
Compiler specification (e.g. |
runtime_data_dir |
str | None
|
Explicit path to the Ghidra runtime data
directory. When |
function_size_hint |
int | None
|
Optional advisory size hint in bytes for the function body. |
analysis_budget |
AnalysisBudget | None
|
Resource limits for this decompilation. Accepts
an |
enriched |
bool
|
When |
tail_padding |
bytes | None
|
Optional byte pattern used to satisfy decoder
lookahead reads that start within |
Raises:
| Type | Description |
|---|---|
InvalidArgumentError
|
If |
flatline.DecompileResult
dataclass
¶
DecompileResult(c_code: str | None, function_info: FunctionInfo | None, warnings: list[WarningItem], error: ErrorItem | None, metadata: dict[str, Any], enriched: Enriched | None = None)
Output payload from one function decompilation.
On success, c_code and function_info are populated. On
failure, error describes the problem and the other fields may be
None.
Attributes:
| Name | Type | Description |
|---|---|---|
c_code |
str | None
|
Decompiled C source code, or |
function_info |
FunctionInfo | None
|
Structured function data, or |
warnings |
list[WarningItem]
|
Decompiler warnings emitted during processing. |
error |
ErrorItem | None
|
Structured error descriptor if decompilation failed,
otherwise |
metadata |
dict[str, Any]
|
Additional metadata with stable keys:
|
enriched |
Enriched | None
|
Optional |
flatline.AnalysisBudget
dataclass
¶
Deterministic per-request resource limits.
Attributes:
| Name | Type | Description |
|---|---|---|
max_instructions |
int
|
Maximum number of p-code instructions the
decompiler will process before stopping. Defaults to
|
Raises:
| Type | Description |
|---|---|
InvalidArgumentError
|
If |
Example
Diagnostics¶
flatline.WarningItem
dataclass
¶
One decompiler warning.
Attributes:
| Name | Type | Description |
|---|---|---|
code |
str
|
Warning identifier string. |
message |
str
|
Human-readable warning message. |
phase |
str
|
Decompiler phase that produced the warning. One of
|
flatline.ErrorItem
dataclass
¶
Structured error descriptor returned in DecompileResult.error.
Attributes:
| Name | Type | Description |
|---|---|---|
category |
str
|
Error category string from
|
message |
str
|
Human-readable error message. |
retryable |
bool
|
|