Commit Graph

2366 Commits

Author SHA1 Message Date
Ivan Krysak dc16217f6d Layout: introduce usedRegisters helper 2024-03-18 19:32:34 +01:00
Ivan Krysak 816b49c09f TrackingContainer: introduce asVector helper 2024-03-18 19:32:34 +01:00
Ivan Krysak 408c37caf2 Layout: introduce finalStackOffset helper 2024-03-18 19:32:34 +01:00
Ivan Krysak 54fd2295ac Layout: introduce calleeSavedRegisters helper 2024-03-18 19:32:34 +01:00
Ivan Krysak 58e5fffb14 Layout: rework dump 2024-03-18 19:32:34 +01:00
Ivan Krysak 116510cd13 Layout: clean ArgumentKind enum up 2024-03-18 19:32:34 +01:00
Ivan Krysak ff59c24a3f Yield: set CommentFontSize to 0
Since VSCode does not display instruction comments, accounting for
them was interfering with the graph rendering.
2024-03-18 11:40:32 +00:00
Ivan Krysak 44e5328477 Yield: add explicit directive support 2024-03-18 11:40:32 +00:00
Ivan Krysak ff436f36bf SortedVector: add an iterator constructor 2024-03-18 11:02:21 +00:00
Ivan Krysak 77fb7e6e5b Yield: introduce BasicBlockPrefix option 2024-03-18 10:58:55 +00:00
Ivan Krysak e5328290c6 Yield: reorder disassembly processing
This commit moves stuff around to enforce complete information being
present by the time the "Internal" assembly output is ready.

Because of that, the "Internal" format needed to change, now it uses
tag representation close to PTML as opposed to the one close to LLVM's
used before now.
2024-03-18 10:58:52 +00:00
Ivan Krysak 948d905752 Add PrintFullMetaAddress configuration option 2024-03-18 11:58:11 +01:00
Ivan Krysak 4d7785f0bb Yield: remove unused 'plain' assembly style
When needed similar results can be achieved using `GenerateTagLessPTML`
option of the `PTMLBuilder`.
2024-03-18 11:58:11 +01:00
Ivan Krysak e2018fa1c3 MetaAddress: add partial serialization option 2024-03-18 11:58:11 +01:00
Ivan Krysak 86fdb19b9f MetaAddress: pull separator into the header 2024-03-18 11:58:11 +01:00
Ivan Krysak 2bffccaaf6 Move ImmediateStyle configuration to the model 2024-03-18 11:58:11 +01:00
Ivan Krysak 184aa03847 Move AddressStyle configuration to the model 2024-03-18 11:58:11 +01:00
Ivan Krysak 2827c9d7f7 Move UseATTSyntax configuration to the model 2024-03-18 11:58:11 +01:00
Ivan Krysak d781f3ae79 Yield: make disassembler config-aware 2024-03-18 07:20:41 +00:00
Ivan Krysak 371784afbd Model: introduce basic disassembly configuration 2024-03-18 07:20:41 +00:00
Ivan Krysak a150b49c70 Support: remove unused dumper 2024-03-18 07:20:41 +00:00
Alessandro Di Federico e93d8ba09f RawBinaryView:getByOffset: fix of by = 2024-03-15 17:13:20 +01:00
Andrea Gussoni cf43b9e92d GenerateAst: remove weaved switch handling
Remove the special handling for the weaved `switch`es.
2024-03-15 14:27:00 +01:00
Andrea Gussoni 95f9bb32cb GenerateAst: add SwitchBreakNode::removeDefault 2024-03-15 14:27:00 +01:00
Andrea Gussoni 8fe291a62b GenerateAst: use llvm::find_if and llvm::count 2024-03-15 14:27:00 +01:00
Andrea Gussoni 6c8d963f69 RestructureCFG: Reorganize debug graphs
Various improvements to the debug graphs for `restructure-cfg` and
`beautify`:
- Normalize casing and syntax of debug graphs.
- Improve the graph folders name and layout.
- Implement `CFGDumper` and `ASTDumper` for when we need a serialization
  with incremental indexes.
- Remove old and stale graph serializations.
2024-03-11 19:08:34 +01:00
Andrea Gussoni d863dd1542 RegionCFGTreeImpl: do not reprocess conditionals
Do not re-enqueue conditional nodes a for combing, when duplicating a
conditional.

This can be done in such way, thanks to the property that we process
conditional nodes in postorder. Therefore, if conditional node A causes
the duplication of, say, node B, we have the guarantee that such node B
has already been processed by the combing. Therefore, the clone of node
B, say node B', should not be reprocessed for combing.
2024-03-11 18:51:03 +01:00
Alessandro Di Federico 0da9d1e1a4 Model: fix handling of 0-sized arguments
We used to support having a single `void` argument. It was for some
C-compatibility ambitions, but just omitting the argument is perfectly
fine.

Also, the DWARF importer has been fixed to handle typedef'd void as
arguments.

More in general, arguments are now required to always have a size.
2024-03-01 14:53:06 +01:00
Alessandro Di Federico 0c212b66d9 Relicense to MIT 2024-02-29 17:03:36 +01:00
Andrea Gussoni 3966d57cfd DecompileFunction.cpp: move helpers to header file
Move some helper functions to the `DecompilationHelpers.h` file in order
to use them from other `.cpp` files.
2024-02-20 16:35:36 +01:00
Andrea Gussoni d4d5e1a966 GenerateAst: rewrite SwitchNode tiling
Perform a complete rewrite of the `SwitchNode` tiling routine.
The tiling now works in the following way:
- When encountering a node which will produce a `SwitchNode` (either a
  standard `switch` or a dispatcher `switch`), we look for the following
  situations:
  1) We have a node, a successor (case) of the `switch`, which in turn
     is the successor of all the other successors (cases) of the
     `switch`.
  2) We have a node, not a successor (case) of the `switch`, which is
     the successor of all the successors (cases) of the `switch`.
- If we find such candidate node, this node will be the fallthrough of
  the `switch`. In addition, depending on whether the `switch` dominates
  the candidate fallthrough, we can incorporate it as the immediate
  successor of the `SwitchNode` we are building.
- There is currently an exception to the above, due to how we currently
  handle weaved `switch`es. In such cases, we mandate that the weaved
  `switch` is nested inside the main corresponding `switch`. For this
  reason, we have a special casing handling the "all inlined but one"
  situation in the new code, while this part could in theory be merged
  in the common criterion below, at the cost of dropping the invariant
  of the nesting of weaved switch`es.
2024-02-16 15:42:27 +01:00
Ivan Krysak e708a3655b ABI: drop incomplete clrcall support 2024-02-09 15:09:37 +00:00
Ivan Krysak b1ed3aa959 AccessTracker: make an assertion more obvious
It's pretty confusing for a nullptr access to fail on the same line as
an existing assert, which is why it's better to move them to separate
lines.
2024-02-09 15:09:37 +00:00
Ivan Krysak e62d4f79ef ABI: remove an obsolete definition parameter
Since pointer to copy system got straightenned up, the old way of
marking them (`abi::Definition::UsePointerToCopyForStackArguments`)
is no longer needed.
2024-02-09 15:09:37 +00:00
Ivan Krysak 27491410d6 ABI: introduce a way to disable vector registers 2024-02-09 15:09:37 +00:00
Ivan Krysak fe025e37ef ABI: short-circuit zero-offset to always be zero 2024-02-09 15:09:37 +00:00
Ivan Krysak 68301138c0 ABI: redesign register sorting from the ground up 2024-02-09 15:09:37 +00:00
Ivan Krysak 5bf4b3fa1e ABI: improve robustness to duplicate registers 2024-02-09 15:09:37 +00:00
Ivan Krysak 9d815d79ec ToRaw: take advantage of the updated distributor
This lets us drop the repeated alignment calculations at
the "leaves" of the conversion. Since new distributor already
provides the necessary information, we can just grab it from
there.
2024-02-09 15:09:37 +00:00
Ivan Krysak 4e81a34cd7 ABI: separate 'gcc' editions of microsoft ABIs 2024-02-09 15:09:37 +00:00
Ivan Krysak 3fdd7d8e8a ABI: introduce a way to set stack argument offset 2024-02-09 15:09:37 +00:00
Ivan Krysak d2fe578091 ABI: add getArchitecture helper 2024-02-09 15:09:37 +00:00
Ivan Krysak f1f6fc5e12 ABI: assert on 0-sized stack arguments 2024-02-09 15:09:37 +00:00
Ivan Krysak fffd62391c Model: introduce hasMetadata helper 2024-02-09 15:09:37 +00:00
Alessandro Di Federico 346b367c19 Drop revng efa-extractcfg 2024-02-09 10:04:25 +01:00
Alessandro Di Federico d9367954a4 Convert all public strings to kebab-case 2024-02-09 10:04:24 +01:00
Alessandro Di Federico 944f827ae3 Drop obsolete +yaml MIME types 2024-02-09 10:04:21 +01:00
Alessandro Di Federico f2be46d4da ToolCLOptions: introduce --model 2024-02-09 10:04:21 +01:00
Alessandro Di Federico 5fbb5ff503 Minor changes 2024-02-09 10:04:17 +01:00
Alessandro Di Federico f6f542769b Convert all public strings to kebab-case 2024-02-09 09:04:25 +01:00