Repository navigation
Conversation
- Every `--json` function record from `decompile` and `decompile-all`, and from the browser front-end, now has a `warnings` array of `{kind,message,line,address}`. The array is always present and is `[]` for a function with no warnings and for one that failed.
- The printer records an entry each time it writes one of the engine's own warning comments: a header warning, a body warning, an inline slug, or the note on a body it has no structure for. A comment whose text merely reads like a warning is never listed. That covers an `--assert comment`, a storage comment, and the original name a Rust or Go render keeps above the prototype.
- `address` is the instruction the warning was recorded at, or the function's entry for a header warning. It is `null` only for `structuring-declined`. `line` is the line of `code` that holds the comment, and `message` is the warning text without its `WARNING: ` marker.
- `kind` is assigned by matching the warning text. A fixed table covers decode failures, flow cut at the instruction budget, out-of-bounds and unmapped flow, unrecovered jump tables and declined structuring. Any other warning gets the slug `warnstyle inline` prints for it (without its ` xN` count) or a kuna producer tag. Text that matches none of these gets `other`.
- The `--jobs` result wire and the result store carry the records, and the wire format moves to `KUNAJOBRES12`. Both `warnstyle` values give the same records except for `line`.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
When a function decompiles with warnings, its
--jsonrecord does not say so:errorisnull, and the bad-instruction, truncated-flow and unresolved-jump warnings appear only as C comments insidecode. To tell a truncated body from a clean one, a consumer has to parse the C text.The record should also have a
warningsarray giving the kind and instruction address of each warning incode, witherrorstillnull.The fix
--jsonfunction record fromdecompileanddecompile-all, and from the browser front-end, now has awarningsarray of{kind,message,line,address}. The array is always present and is[]for a function with no warnings and for one that failed.--assert comment, a storage comment, and the original name a Rust or Go render keeps above the prototype.addressis the instruction the warning was recorded at, or the function's entry for a header warning. It isnullonly forstructuring-declined.lineis the line ofcodethat holds the comment, andmessageis the warning text without itsWARNING:marker.kindis assigned by matching the warning text. A fixed table covers decode failures, flow cut at the instruction budget, out-of-bounds and unmapped flow, unrecovered jump tables and declined structuring. Any other warning gets the slugwarnstyle inlineprints for it (without itsxNcount) or a kuna producer tag. Text that matches none of these getsother.--jobsresult wire and the result store carry the records, and the wire format moves toKUNAJOBRES12. Bothwarnstylevalues give the same records except forline.Not changed: Warnings change neither
errornor the exit status, and the warning comments incodeprint as before.The tests
Adds 6 tests in
decompiler/crates/kuna-cli/tests/function_warnings_cli.rsand a case todecompiler/crates/kuna-cli/tests/integration.rs. The acceptance case fails without the fix.