You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
adds command to recipes, removes the default command hack (#1027)
* adds `command` to recipes, removes the default command hack
After the introduction of the commands in bap, the recipe system wasn't updated and it was only possible to write recipes for the default `disassemble` command. We use recipes to pack our analysis into self-contained entities and we would like to be benefit from commands, e.g., we would like to be able to implement analyses that do not require a fully disassembly of the target file.
This PR adds the `command' stanza to the recipe grammar. The new command stanza didn't play well with the hack that was prepending the `disassemble` command when the first argument was a file. No worries, the command is still optional, we were just able to find a much better solution, which is not a hack. Now it is the responsiblility of `Bap_main.init` to set the default command if no command was specified. So no more hacks, no need for `:` to disambiguate command and, more importantly, no need to specify the file before any other arguments on the command line, which was previously required by the hack.
To summarize, if no command is specified then `disassemble` is the default command. A recipe may specify a command, it will be prepended in the right position. Users may specify a command on the command like if they want to.
For example, consider a recipe (named `mc-test`) with the following specification
```
(command mc)
(option llvm-x86-syntax intel)
(option show-insn asm)
(option show-bil)
```
The following are valid invocations of this recipe,
```
bap 48 83 ec 08 --recipe=mc-test # the command could be omitted
bap mc 48 83 ec 08 --recipe=mc-test # can specify the command
bap --recipe=mc-test -- 48 83 ec 08 # recipes now work fine with --
```
* updates the testsuite to reflect the changed command syntax
0 commit comments