Commit Graph

2614 Commits

Author SHA1 Message Date
Djordje Todorovic b196eadcc2 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-05-31 14:22:22 +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
Ivan Krysak 0170c0dfeb Model: add segment overlap check to verification 2023-05-17 14:08:06 +02:00
Ivan Krysak c838d2b019 CrossRelations: greatly simplify Relation Targets
This improves readability of the serialized version quite a bit.
2023-05-17 14:08:06 +02:00
Ivan Krysak eae029d156 CrossRelations: merge IsCalledFrom flavors
`IsDynamicallyCalledFrom` is removed in favour of `IsCalledFrom`.

Looking at just how similar the actual uses of both are, there's not
much reason to keep them separate.
2023-05-17 14:08:06 +02:00
Ivan Krysak 641fb61f7b EFA: upgrade buildControlFlowGraph
It now assumes that the nodes of the graph it constructs also require
the function entry point on top of the basic block ID.
2023-05-17 14:08:05 +02:00
Ivan Krysak fade3ec01f CallGraph: switch to pipeline::Location 2023-05-17 14:08:05 +02:00
Ivan Krysak 7322d1a845 ControlFlow: switch to pipeline::Location 2023-05-17 14:08:05 +02:00
Ivan Krysak 50b5abf505 Yield: add isEmpty() helper to graph nodes 2023-05-17 14:08:05 +02:00
Ivan Krysak 013696a939 yield: move SVG out of the ControlFlow
Since the file is also used for call graphs, it's placement is not ideal
2023-05-17 14:08:05 +02:00
Ivan Krysak 045cdefcac GraphLayout: move outside of yield 2023-05-17 14:08:04 +02:00
Ivan Krysak d99b0241e8 Minor improvements 2023-05-17 14:08:04 +02:00
Alessandro Di Federico 51e23cb99d Merge branch 'feature/improve-cfep-detection' 2023-05-17 12:01:19 +02:00
Alessandro Di Federico 866e6edb10 Import CollectFunctions tests 2023-05-17 11:19:35 +02:00
Alessandro Di Federico 14b40ebe45 CFEP: ignore if already part of another block
We used to ignore CFEPs that matched the starting address of a basic
block of a previously detect function.
We now also exclude such CFEPs even if the candidate is *part* of an
existing block.
2023-05-17 11:19:32 +02:00
Alessandro Di Federico 739bed3c1d DetectABI: serialize CFG in root
This is done mainly so that downstream passes do not need to run
`CollectCFG` to store information that has already been computed but not
serialized.

This come at the cost of computing the CFG also of functions we don't
want to analyze in `DetectABI`.
2023-05-17 11:17:44 +02:00
Alessandro Di Federico d0b235c1f4 JTM::findCodePointers: ignore non-aligned data 2023-05-17 11:17:41 +02:00
Alessandro Di Federico b3eaae6f83 ELFImporter: fix handling of DT_{INIT,FINI} 2023-05-17 11:17:39 +02:00
Alessandro Di Federico f1f8c217e7 TypeCopier: reset TTR's root pointer after copy 2023-05-17 11:17:35 +02:00
Giacomo Vercesi 12186ff3a2 scripts/revng: re-implement path fix
Re-add the code that allows the `revng` script to be also invoked from
the build directory.
2023-05-11 14:24:00 +02:00
Alessandro Di Federico 5d3d2e84ad Merge branch 'feature/rcc-additional-features' 2023-05-11 10:33:01 +02:00
Giacomo Vercesi 52d20ffc36 rcc: add commit check
Add the command-line flag `--check-commit` to `revng-check-conventions`,
this will introduce additional checks related to commits message
conformity.
2023-05-11 10:05:32 +02:00
Giacomo Vercesi 31cd2b53f9 rcc: add codespell
Add codespell to the list of checks performed by
revng-check-conventions. This should reduce the amount of typos present
in the revng codebase.
2023-05-11 10:05:32 +02:00
Giacomo Vercesi a13c3e5ac2 revng: fix executable/shebang in scripts
Some files had discordant executable bit presence and shebang presence.
This commit fixes these occurrences by adding removing the required
feautures where needed.
2023-05-11 10:02:46 +02:00
Giacomo Vercesi 9d5b6d1f34 revng cli: migrate legacy scripts to _commands
Move the remaining commands in the `scripts` to be used by the `revng`
command line driver.
2023-05-11 10:02:46 +02:00
Giacomo Vercesi fdd07f640a revng cli: drop old code
Remove code for the `revng` command line entrypoint that was needed
before python became an orchestra component.
2023-05-11 10:02:46 +02:00