Commit Graph

2638 Commits

Author SHA1 Message Date
Alessandro Di Federico a65ccc3413 Introduce ValueMaterializer
`ValueMaterializer` is a rewrite of what was called `AdvancedValueInfo`
which follows the same principles.

The main benefits over the old version is:

* We materialize the data-flow graph and the CFG of the relevant part of
  root. This makes debugging significantly easier.
* We drop the old MonotoneFramework infrastructure in favor of
  getMaximalFixedPoint.
* We significantly reduce the amount of queries we make to
  AdvancedValueInfo.
2023-06-30 13:39:22 +02:00
Alessandro Di Federico 4c01d9c28d BidirectionalNode: implement edge removal 2023-06-30 13:38:27 +02:00
Alessandro Di Federico 4edcb6dd49 MetaAddress::decomposeIntegerPC: accept APInt 2023-06-30 13:35:04 +02:00
Alessandro Di Federico 466871e866 Introduce RegisterClobberer 2023-06-30 13:28:36 +02:00
Alessandro Di Federico f120ad334c Statistics.h: rework 2023-06-30 13:06:58 +02:00
Alessandro Di Federico 5e72f8e31b ConstantRangeSet::dump: custom APInt formatter 2023-06-30 12:35:18 +02:00
Alessandro Di Federico 08b8b0bd9f ConstantRangeSet::size: fix corner case
In order to correctly represent the size of a 32-bit ConstantRange, you
need 33 bits.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico b21861b7f9 GraphTraits<GenericGraph>: fix const support
GraphTraits were not fully usable in case of a `const` graph due to a
missing std::conditional_t for the definition of the `Node` type.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico 6ca6692d1e getUniqueJumpTarget: do not abort if PC unwritten
Sometimes code performs an indirect jump without changing the value of
the PC.  In most cases this is due to non-code or some other faulty
situation, but it is in principle possible that an instruction performs
an indirect branch to its own address.

This commit ensures that this situation does not end up in an hard
failure.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico 3706f77960 LDDTree: mark Logger static 2023-06-30 12:35:18 +02:00
Alessandro Di Federico 5ebec631b9 getMaximalFixedPoint: fix Flow argument type 2023-06-30 12:35:18 +02:00
Ivan Krysak e3be901f1f STLExtras: allow skip to result in empty ranges
This only affects the case where the number of elements to be skipped
exactly matches the number of elements in the container.
2023-06-30 12:35:18 +02:00
Alessandro Di Federico d3c37fc692 ProgramCounterHandler::expandNewPC: take CallBase 2023-06-30 12:35:18 +02:00
Alessandro Di Federico b8b2fcff71 GenericGraph tests: zero initialize EdgeLabel::X 2023-06-30 12:35:18 +02:00
Alessandro Di Federico 84dd10cbdb GenerichGraph.h: nullptr-initialize Edge::Neighbor 2023-06-30 12:35:18 +02:00
Alessandro Di Federico b53d3f457b Minor changes 2023-06-30 12:35:18 +02:00
Alessandro Di Federico c2f7f62677 Merge branch 'gh/feature/fix-test-list' 2023-06-30 10:47:08 +02:00
Alessandro Di Federico 72947f0f71 tests: limit inputs to ensure 1-to-1 matching 2023-06-23 17:57:02 +02:00
Alessandro Di Federico 0ecfbf94b9 SystemV_x86: remove VectorArgumentRegisters 2023-06-23 17:56:09 +02:00
Alessandro Di Federico 42abf64c62 revng.cli: ensure proper exit code propagation 2023-06-23 17:55:41 +02:00
Alessandro Di Federico 942cc1323a revng::verify: dump module upon failure 2023-06-23 17:54:55 +02:00
Alessandro Di Federico fa61c784c2 Reintroduce st0_x86 as floating point return value 2023-06-23 17:54:16 +02:00
Alessandro Di Federico 55d433e020 Layout::verify: be stricter on return values
We now ensure that, if we have multiple return values, each one of them
covers at most one register.
2023-06-21 10:56:27 +02:00
Alessandro Di Federico 0af9b34a0a Layout: make ReturnValues empty in case of void 2023-06-21 10:55:50 +02:00
Djordje Todorovic f05c08547d ptml: Introduce PTMLBuilder class
By using this class we can create ptml::Tags without
XML tags. It is useful in the revng-c part when we
want to generate Plain C. All PTML Tags, from now on,
should be created via this class only.

In addition, port `Yield` library to be using this.
2023-06-09 17:15:30 +02:00
Alessandro Di Federico e1d65def59 Merge branch 'feature/jump-target-labels' 2023-05-25 13:55:14 +02:00
Ivan Krysak 66fc161f73 Assembly: choose disassembler based on basic block
Before now, it was choosen based on the function, but that led to
problems when disassembling thumb functions calling non-thumb PLTs.
2023-05-25 09:49:13 +02:00
Ivan Krysak 29eae116fd Assembly: handle addresses in a special way 2023-05-25 06:37:40 +00:00
Ivan Krysak 5cdb1642bb Assembly: rework tag processing 2023-05-25 06:37:30 +00:00
Ivan Krysak f0a29f17b9 Assembly: Introduce address style options 2023-05-25 06:37:21 +00:00
Ivan Krysak ec90ac0083 yield::Instruction: add getRelativeAddressBase
This helper computes the architecture-specific base for PC-relative
immediate originating from the given instruction.
2023-05-25 06:36:58 +00:00
Ivan Krysak 37d0a6cd62 yield::Tag: remove obsolete comparator
Due to the specifics of how `SortedVector` works, the comparator in
question was never used - keeping it will only lead to further confusion
2023-05-25 06:36:35 +00:00
Ivan Krysak 9dfc350b1a Assembly: do not add "next instruction" as target 2023-05-25 06:36:26 +00:00
Ivan Krysak c21f2649c9 Assembly: introduce new tags
This also reorders the enum, because when two tags collide (they have
the same `from` and `to` points, they are sorted based on the enum
values.

The new order ensures that the values we are more likely to choose
to preserve are closer to the bottom. Since each token can only have one
type associated with it, we choose the lowest one by default.
2023-05-25 06:36:02 +00:00
Ivan Krysak 6a407a94bf Assembly: partition label helper
This moves the internal implemetation details into a separate
function `labelImpl` as well as renames the `label` into
`labelDefinition`.
2023-05-25 06:35:58 +00:00
Ivan Krysak f3918e3305 Assembly: change label to accept BasicBlockID 2023-05-25 06:25:25 +00:00
Ivan Krysak 084bcfa57b yield::Tag: remove a duplicate constructor
`using generated::Tag::Tag` already provides the same one.
2023-05-25 06:25:07 +00:00
Ivan Krysak 02978910b0 STLExtras: introduce zip_pairs skip flavour
I found that it leads to better looking code when the check of whether
the range in question even has enough elements to skip is inside
the helper.

As such a separate type of skip entry point was introduced: one that
allows to iterate over the container pairwise

Now, instead of asserting, the loop just does nothing in cases like
```cpp
for (const auto &Element : zip_pairs(make_empty_range())
  do_stuff();
```
2023-05-25 06:25:07 +00:00
Ivan Krysak d1cefaee04 PTML: ensure invalid labels are never emitted 2023-05-25 06:25:07 +00:00
Ivan Krysak 560bf16d1f Disassembler: support arbitrarily sized tags 2023-05-25 06:25:07 +00:00
Ivan Krysak 4699c2da72 Assembly: remove ShouldSymbolizeOperands option 2023-05-25 06:25:07 +00:00
Ivan Krysak f9a72125d3 Aseembly: accept relative jump targets
Drops the comment about an attempt to switch to the absolute targets
and sets `setPrintBranchImmAsAddress` to `false` no matter what
immediate style is selected.
2023-05-25 06:25:07 +00:00
Ivan Krysak 83e48bbc3a LLVMDisassemblerInterface: remove unused argument 2023-05-25 06:25:07 +00:00
Ivan Krysak 378f6e76f7 daemon: fix uploading binaries from html
The html view daemon sends when connected directly was not correctly
migrated to support analysis lists.
2023-05-25 06:25:07 +00:00
Ivan Krysak 5b2af637de Minor Changes 2023-05-25 06:25:07 +00:00
Alessandro Di Federico 3f1e6e6477 Merge branch 'feature/tier1-improvements-2' 2023-05-24 16:26:58 +02:00
Giacomo Vercesi 7f73e2bfde revng.daemon: drop REVNG_PROJECT_ID
Remove the logic for computing a manager's workdir using the
REVNG_PROJECT_ID environment variable, as it was unused. The
REVNG_DATA_DIR remains to allow persistence across restarts.
2023-05-24 14:59:16 +02:00
Giacomo Vercesi 5d582a2eec fetch-debuginfo: improve cache folder handling
Rework how the cache folder for debug information is handled. This
commit introduces an additional environment variable, `REVNG_CACHE_DIR`
that allows overriding where semi-disposable files will be stored.
2023-05-24 11:09:04 +02:00
Giacomo Vercesi 2b181e627c fetch_debuginfo/common: improve download_file
Rework the code of `download_file` to leverage requests auto-decoding
option to auto-decompress the response body if needed.
2023-05-24 11:09:04 +02:00
Alessandro Di Federico 3c77bb5d17 Merge branch 'feature/dynamic-calls-in-call-graph' 2023-05-17 16:38:06 +02:00