Recover and compare code

glaurung decompile

Render experimental pseudocode for one or more functions.

does not write by default 2 worked examples

use it for

Use --db to apply project names. --all and --vas support batch work, but one function is easier to inspect against its disassembly.

Run glaurung decompile --help on your installed version before putting the command in a script. Glaurung is still pre-1.0.

input
A native binary and, optionally, one function name or VA. A project can supply analyst names and types.
output
Experimental pseudocode in plain, C-like, or DecBench form.
mode
read only. The examples leave the input unchanged.

command shape

syntax

short form
$ glaurung decompile PATH [--func NAME|VA] [--style plain|c|decbench]

The installed parser is authoritative: glaurung decompile --help

run it

examples

Render main as C-like pseudocode

One function is small enough to compare line by line with disassembly.

run

from the engine checkout
$ glaurung decompile samples/binaries/platforms/linux/amd64/export/native/clang/debug/hello-c-clang-debug --func main --style c

output

captured result captured 2026-08-31, shortened
fn main {
    // x86-64 prologue: save rbp
    rsp = (rsp - 32);
    local_8 = arg0;
    local_10 = arg1;
    var0 = printf@plt("Hello, World from C!\n");
    local_14 = 0;
    local_18 = 0;
    while (1) {
        if (((%sf ^ %of) == 0)) {
            break;
        }
        var2 = strlen@plt(*&[ret+var1*8]);
        local_14 = (local_14 + var2);
        local_18 = (local_18 + 1);
    }
    print_sum(local_14);
    static_function();
    return;
}

captured 2026-08-31, shortened.

Read the result: The loop and calls are useful leads. The temporary variables and reconstructed condition show why you still need the instructions beside this output.

Apply analyst names and types

Project annotations change presentation, not the underlying bytes.

run

from the engine checkout
$ glaurung decompile samples/binaries/platforms/linux/amd64/export/native/clang/debug/hello-c-clang-debug --func 0x1150 --style c --db hello.glaurung

output

captured result captured with a fresh project, shortened
fn main {
    rsp = (rsp - 32);
    local_8 = arg0;
    local_10 = arg1;
    var0 = printf@plt("Hello, World from C!\n");
    while (1) {
        if (((%sf ^ %of) == 0)) break;
        var2 = strlen@plt(*&[ret+var1*8]);
        local_14 = (local_14 + var2);
    }
    print_sum((unsigned long)((unsigned int)(local_14)));
    static_function();
    return;
}

captured with a fresh project, shortened.

Read the result: The project supplies main and print_sum, but it does not repair every temporary or condition. Compare the output with disasm before accepting a type or control-flow claim.

used above

important options

--func NAME|VA
Select one function.
--style plain|c|decbench
Choose the output shape.
--db PROJECT
Apply project names, prototypes, and stack annotations.
--all
Render every recovered function; expect much more output.

These are the flags used by the examples. Run glaurung decompile --help for the complete parser help.

before you rely on it

checks

  • Pseudocode can be wrong. Check important claims against disassembly and runtime behavior.

keep working

related commands

← all 40 commands