Edward J. Schwartz commited on
Commit
b0bdd92
·
1 Parent(s): 9287d92

Explain verifier inputs and examples in the Gradio introduction

Browse files
Files changed (1) hide show
  1. demo/app.py +25 -3
demo/app.py CHANGED
@@ -130,8 +130,30 @@ def create_app(examples_directory=None):
130
  session = gr.State(UISession())
131
  ticket = gr.State(None)
132
  reference_function = gr.State(None)
133
- gr.Markdown("# Decompiler verifier\nCompare a C candidate with a binary function across shared random seeds.",
134
- elem_id="intro")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  # Render inputs later so the example picker can sit above setup.
136
  binary = gr.File(label="Binary", type="filepath", file_count="single", render=False, elem_id="binary")
137
  function = gr.Textbox(label="Function start address", placeholder="0x401000",
@@ -154,7 +176,7 @@ def create_app(examples_directory=None):
154
  seed_count, seed_start, instruction_budget, compiler, flags, interfaces]
155
  example_picker = gr.Examples(examples=examples, inputs=inputs, label="Examples",
156
  example_labels=list(EXAMPLE_LABELS),
157
- examples_per_page=20,
158
  cache_examples=False, elem_id="examples")
159
  with gr.Row(elem_id="setup"):
160
  binary.render()
 
130
  session = gr.State(UISession())
131
  ticket = gr.State(None)
132
  reference_function = gr.State(None)
133
+ gr.Markdown("""# Decompiler verifier
134
+ Check whether candidate C behaves like an original binary function on shared, seeded random inputs.
135
+
136
+ Choose an **example** below to fill in the inputs, or upload an **x86-64 ELF binary**, enter the
137
+ **function start address**, and paste complete **Candidate C**. Set **Candidate function name**
138
+ to the C function to test. Examples include matching implementations, deliberate bugs, real
139
+ `factor` binary functions, and saved **Ghidra exports at the end of the list**. Some Ghidra
140
+ exports agree; others reveal mismatches or compile/type errors. **Reference C**, when shown,
141
+ is a reading aid; verification runs the binary.
142
+
143
+ Open **Bindings** to map candidate `extern` names to original binary addresses: `globals`
144
+ for shared data and `callees` for called functions. Bound callees receive deterministic
145
+ synthetic returns. In the same panel, `original_prototype` is the **trusted prototype**: a C
146
+ declaration describing the original function's argument and return types, such as
147
+ `unsigned original(unsigned x);`. Supply it from your knowledge of the binary, independently
148
+ of the candidate's guessed types; it controls input generation and return interpretation.
149
+ The examples supply it. You can also specify callee interfaces and memory ranges there.
150
+
151
+ Open **Run settings** to adjust seeds, instruction budget, compiler, or flags, then click
152
+ **Verify**. Inspect the assembly panes, per-seed results, and first mismatch, or download the
153
+ JSON report. Agreement covers the tested inputs and comparison scope described below.
154
+ **Try changing the Candidate C**—an operator, constant, or type—and verify again with the
155
+ same seeds to see how the assembly and results change.
156
+ """, elem_id="intro")
157
  # Render inputs later so the example picker can sit above setup.
158
  binary = gr.File(label="Binary", type="filepath", file_count="single", render=False, elem_id="binary")
159
  function = gr.Textbox(label="Function start address", placeholder="0x401000",
 
176
  seed_count, seed_start, instruction_budget, compiler, flags, interfaces]
177
  example_picker = gr.Examples(examples=examples, inputs=inputs, label="Examples",
178
  example_labels=list(EXAMPLE_LABELS),
179
+ examples_per_page=len(examples),
180
  cache_examples=False, elem_id="examples")
181
  with gr.Row(elem_id="setup"):
182
  binary.render()