Commit Graph

134 Commits

Author SHA1 Message Date
Kacper Kołodziej 46e9ea0e10 HexDump implementation
HexDumpPipe dumps content of binary file in the similar way as hexdump
tool with addition of PTML markup for instructions addresses.

Continuous parts of binary code are wrapped with <span
data-location-definition=""></span> where data-location-definition
attribute contains Entry/BasicBlock/Instruction addresses in generic
form. <span> tags can be nested if byte(s) belong to many instructions
in code.

At the end of the line every <span> is closed and opened on the next
line again if it still applies to the next byte.

MetaAddress are converted to IntervalMetaAddress (which implements own,
optional-less operator-) and stored in boost::icl::intruval_map. This
map is used to get addresses of instructions to which each byte belongs.
2023-07-31 11:29:41 +02:00
Giacomo Vercesi 878f9efcc8 daemon/test.py: change output capture
Change the way the tests capture the output of the daemon from `PIPE`
to `TemporaryFile`, as the latter avoids deadlocks related to the use of
the `Popen.wait` function in conjunction with `PIPE`.
2023-07-31 10:34:43 +02:00
Alessandro Di Federico 8ca44dc32a for-propagated-prototypes: disable debug-info 2023-07-26 13:39:10 +02:00
Kacper Kołodziej 4b76bbbac8 Add test case for propagating prototypes
This test case relies on simple program that calls function from
dynamically linked library (puts function). Function from Procedure
Linkage Table is a wrapper for this call and puts prototype (recognized
from debug symbols) should be propagated to `puts@plt` function.

Verification relies on `revng model compare`.

Fetching prototypes requires internet connection. Adding puts prototype
to test case's model makes it independent of the Internet connection.
2023-07-20 18:09:48 +02:00
Massimo Fioravanti 6707a20eea revng-pipeline CLI: drop list- from analysis lists 2023-07-20 17:08:28 +02:00
Alessandro Di Federico 448ebfc285 support.c: no-op g_assertion_message_expr
This lead to linking failures during translation of certain ARM
programs.
2023-07-18 17:39:37 +02:00
Ivan Krysak ce6d9a6dbf Formatting: forbid \brief 2023-07-05 14:33:03 +02:00
Ivan Krysak 260508dea7 Formatting: add mlir include category 2023-07-03 15:23:10 +00:00
Ivan Krysak ef7e576886 Formatting: drop unused include categories 2023-07-03 15:23:10 +00:00
Ivan Krysak ee0dc1866d Forbid clang format off 2023-07-03 15:23:10 +00:00
Ivan Krysak d0e174497b Formatting: change PenaltyBreakOpenParenthesis
The new value is `800000`, same as that of
`PenaltyBreakBeforeFirstCallParameter`.

Currenly there are no cases where this is relevant in the codebase
(since it was not allowed), so here's an artificial one to illustrate
the situation:

(behaviour before this commit)
```
  auto x = short_whatever(
    whatever_but_the_name_is_long("first", "second", "a long argument"));
```
(behaviour after this commit)
```
  auto x = short_whatever(whatever_but_the_name_is_long("first",
                                                        "second",
                                                        "a long argument"));
```
2023-07-02 13:20:49 +02:00
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00
Ivan Krysak 01b4ec36c9 Formatting: set AllowShortEnumsOnASingleLine
The new value is `false`.
2023-07-02 13:15:08 +02:00
Ivan Krysak f198f67e87 Formatting: set LineEnding to LF 2023-07-02 11:06:55 +00:00
Ivan Krysak 6c668d6820 Formatting: set InsertNewlineAtEOF to true 2023-07-02 11:06:55 +00:00
Ivan Krysak aabc22a388 Update clang-format-style-file
Fill all the missing options based on their values from
`clang-format-16`'s `llvm` configuration.
2023-07-02 11:06:55 +00:00
Ivan Krysak 6e2d222c23 Formatting: update deprecated options
Updates options include
- `ConstructorInitializerAllOnOneLineOrOnePerLine: true`
  - became `PackConstructorInitializers: NextLine`
2023-07-02 11:06:55 +00:00
Ivan Krysak 0e061aedc4 Make clang-format-style-file a YAML file 2023-07-02 11:06:55 +00: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 fa61c784c2 Reintroduce st0_x86 as floating point return value 2023-06-23 17:54:16 +02:00
Alessandro Di Federico 866e6edb10 Import CollectFunctions tests 2023-05-17 11:19:35 +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 471b9c8396 rcc: fix issues with mypy>=1.0
Add additional config options to the `revng-check-conventions` config to
make mypy work with the revng codebase (mainly related to untyped
functions now causing a warning in mypy).
2023-05-11 10:02:46 +02:00
Alessandro Di Federico 92c028235f Introduce WellKnownModels analysis 2023-05-10 11:16:08 +02:00
Alessandro Di Federico 5542382bdb revng-qa tests: adopt full paths 2023-05-10 09:15:18 +02:00
Alessandro Di Federico 4b2e067574 rcc: ban functions we wrap 2023-04-28 14:34:52 +02:00
Alessandro Di Federico 596fa25a1b Introduce revng_add_test
This enables us to pass --debug-log=verify to tests.
2023-04-28 14:34:38 +02:00
Massimo Fioravanti 254dc99fcb TupleTreeGenerator: emit tracking machinery 2023-04-21 17:50:16 +02:00
Giacomo Vercesi 07be2c1cae Allow the use of valgrind with python
This commit does 2 main things:
* Adds PYTHONMALLOC=1 environment variable when `--valgrind` is used
  to force python to use normal malloc instead of the custom allocator
  python normally uses that's not friendly with valgrind
* Add a suppression file to remove a couple of false-positives that
  happen consistently and generate useless noise
2023-04-20 14:43:12 +02:00
Alessandro Di Federico 6e0fc63b77 Reschedule AttachDebugInfo after InlineHelpers 2023-04-13 18:11:48 +02:00
Giacomo Vercesi af237074f3 Implement AnalysesList in Python API & GraphQL
Implement the new functionality of AnalysesList on the python's side of
rev.ng and the GraphQL schema both in static and autogenerated form
2023-03-22 17:31:46 +01:00
Massimo Fioravanti 0373732b69 Add auto-analysis list
Introduces a default analysis list indede to be run first on binaries.
2023-03-22 17:31:46 +01:00
Ivan Krysak e1ebe8ea35 ABI-testing: introduce CABI-FT correction script 2023-03-15 10:19:03 +01:00
Ivan Krysak a360b11426 ABI: fix issues with regparm abi definitions 2023-03-15 10:19:03 +01:00
Ivan Krysak e84c76019a ABI: introduce an additional definition option
The new option is `NoRegisterArgumentsCanComeAfterStackOnes`
If it's set to `true`, then no register argument can follow any stack
argument under the said abi, otherwise such "shuffling" of arguments
is allowed.
2023-03-15 10:19:03 +01:00
Ivan Krysak 550b286a9e ABI: stop treating stack pointer as callee saved 2023-03-15 10:19:03 +01:00
Ivan Krysak f068bcb34f ABI-testing: switch to the new analyses 2023-03-15 10:19:03 +01:00
Ivan Krysak 6fc300d6d4 ABI: forbid using XMM registers to return values
This should be reverted once the vector register support is introduced
2023-03-15 10:19:02 +01:00
Ivan Krysak 8b675e131e ABI: introduce runtime abi definition 2023-03-15 10:19:02 +01:00
Ivan Krysak ad0fc079b8 ABI-testing: rename verify-abi
The new name is `check-compatibility-with-abi`
2023-03-15 10:19:02 +01:00
Ivan Krysak f4cbbaa365 ABI-testing: remove an extra tag redefinition 2023-03-15 10:19:02 +01:00
Ivan Krysak 3687869795 Model: make AddPrimitiveTypes a pure analysis 2023-03-15 10:19:01 +01:00
Giacomo Vercesi 7751143aad revng daemon: add timeout-keep-alive option
Add the `--timeout-keep-alive` option for all invocations of `revng
daemon`. This avoids some edge cases where connections are abruply
closed.
2023-03-14 20:50:28 +01:00
Giacomo Vercesi 8e05ae5ead rcc: fix report output with multiple rules
The rule output logic was wrongly coded to do `"\n".join` where
appending a newline to each line was the correct behavior.
Also remove a leftover typo in `rcc-config.yml`.
2023-03-13 22:53:44 +01:00
Alessandro Di Federico f68b7866b3 Introduce BasicBlockID
This commit introduces `BasicBlockID` as the unique identifier for a
`efa::BasicBlock` into the CFG. A `BasicBlockID` is defined by a
`MetaAddress` plus an incremental integer. This enables us to have
multiple instances of the same block in a single function, which is
particularly useful when inlining multiple times the same function.

Apart from this, the commit also does the following:

* It drops representing `MetaAddress`es a `structs` in the IR. This created
  several issues related to ABI. We now represent them as strings.

* It defines more functions in `support.h`, instead of defining prototypes
  by hand in `CodeGenerator.cpp` and the like. Specifically, `unknownPC`
  and `raise_exception_helper`. We also introduce a C "constructor" for
  `PlainMetaAddress`.

* It significantly reduces the API of `GeneratedCodeBasicInfo`, which
  was supposed to be put on a diet since a long time.  Specifically,
  many jump target related methods have been moved to free functions in
  `IRHelpers.h`.  Also `GCBI::getSuccessors` has been pushed into its
  only user, `PruneRetSuccessors`, to prevent further usage of a
  deprecated API. In the future, it would be nice to drop it entirely.

* It introduces `efa::BasicBlock::InlinedFrom`.

* Introduce an enum to represent named argument indices for `newpc`.
  This enables us to more effectively manipulate its argument list.

* It improves the verification and error reporting for
  `efa::FunctionMetadata`.

* Update tests.

This commit is preliminary to another piece of work to improve the
generality of inlining beyond the simple "fake function" scenario, for
which the feature was originally conceived.
2023-02-23 14:51:10 +01:00
Alessandro Di Federico 892922794e rcc-config.yml: ban "#pragma clang optimize off" 2023-02-23 14:51:10 +01:00
Alessandro Di Federico 1d4fc9de5b rcc-config.yml: add documentation 2023-02-23 14:51:10 +01:00