Commit Graph

500 Commits

Author SHA1 Message Date
Giacomo Vercesi 0cb3e497a4 Fix typos 2023-11-02 16:48:33 +01:00
Alessandro Di Federico 6e3b7322ff support.c: drop AT_HWCAP2
AT_HWCAP2 is not supported by old kernels.
2023-11-02 16:48:33 +01:00
Alessandro Di Federico 4388acb482 Yield: improve artifact naming 2023-10-24 09:49:05 +02:00
Pietro Fezzardi 75e98006d4 Rename artifacts for decompiled C headers
This also changes the names that show up in the VSCode-based UI, so that
they are coherent with what's included in the decompiled C code via the
related #include directives.
2023-10-19 17:12:25 +02:00
Pietro Fezzardi a78928141b Rename decompiled C headers 2023-10-19 17:08:25 +02:00
Pietro Fezzardi 4bc7a14649 ModelTypeNames: print function attributes 2023-10-18 15:39:17 +02:00
Alessandro Di Federico 86e5ae8680 rm share/revng/well-known-models/CMakeLists.txt
Its presence lead to an undesirable situation where the file itself
would get copied to the install directory and using `add_subdirectory`
led to creating a set of support files (which would get installed too).

Simple solution: just push the content of that file in the root
`CMakeLists.txt`.
2023-10-06 17:16:04 +02:00
Alessandro Di Federico 2a7e06df1f printFunctionPrototype: add newline after ABI
This commit forces getLocationAttribute's argument to be false.
2023-10-06 17:14:29 +02:00
Alessandro Di Federico 7dff660b36 propagatePrototypesInFunction: propagate names 2023-10-05 10:19:44 +02:00
Djordje Todorovic 68400d9b30 Import from LLVM IR to MLIR
- Add PrepareLLVMIRForMLIR Pass.
  This Pass performs massaging of the LLVM IR
  produced by revng so it can be parsed/accepted
  for the LLVM MLIR Dialect.
- Introduce new pipeline branch: llvmir-to-mlir.yml.
- Add LLVMIRToMLIR step.
- Add ImportLLVMToMLIRPipe pipe.
2023-10-02 17:13:55 +02:00
Djordje Todorovic c5f9a61037 Remove make-segment-ref from segregate.yml
We remove this since that was ignored by the parser and didn't
have any effect.
2023-09-21 08:44:47 +02:00
Djordje Todorovic 2760599483 Add StripDebugInfoFromHelpers Pass
During this phase (EnforceABI) the binary is not meant to be run
so the debug info is not useful anymore, so we are striping them
now in order to avoid taking care of them during the pipeline.
2023-09-21 08:05:48 +02:00
Giacomo Vercesi f710af9f2f Cleanup revng.daemon graphql API
Drop autogenerated queries from the GraphQL API and switch `revng.api`
to use `PipelineDescriptor`.
2023-09-14 15:44:33 +02:00
Giacomo Vercesi ca82e47f79 FunctionStringMap: switch to using GzipTarFile
Change the serialization and deserialzation functions of
`FunctionStringMap` to use the GzipTarFile. Also change che filename
of the underlying containers accordingly.
2023-09-06 15:23:43 +02:00
Giacomo Vercesi 93d3a6238d revng: introduce S3 support
Add the capability for all revng tooling to run with an S3-backed
workdir.
2023-09-06 15:23:43 +02:00
Giacomo Vercesi d95c3b4732 Change extension for Decompiled container
The Decompiled container (which use FunctionStringMap) now uses
`.tar.gz` as the container format, as opposed to YAML. Change the
filename of the containers accordingly.
2023-09-06 11:23:40 +02:00
Giacomo Vercesi 187d2744e9 tests: add graphql --produce-artifacts
Add among the tests an invocation of `graphql --produce-artifacts`.
2023-08-23 17:45:36 +02:00
Giacomo Vercesi 1d9e3fc936 tests: add revng graphql
Add a run of `revng graphql` among the tests being run. This
leverages the new Component property to filter out any unwanted
artifacts from being produced.
2023-08-23 17:45:36 +02:00
Giacomo Vercesi 4ca1d1237f Add component configuration for revng-c
`revng` now requires all pipeline files to have a `Component` field
which tells the command line driver to what component the pipeline
definition belongs to.
2023-08-23 17:45:36 +02:00
Giacomo Vercesi e719b3b7e5 Add components to revng cli driver
This commit introduces the concept of `Component` to a pipeline step.
This, in turn, can be used by clients to figure out which artifacts are
produced by which revng component.
Additionally, this commit overhauls the `revng daemon-self-test`
command, renaming it to `revng graphql` and adding extra flexibility.
2023-08-23 17:45:36 +02:00
Giacomo Vercesi d9f97f44d0 revng.test-daemon: only run for with-debug-info
Run the `revng.test-daemon` test only with a debug-info executable in
order to reduce the overall test time.
2023-08-23 17:45:36 +02:00
Alessandro Di Federico 30c127267c Improve ModelToHeader and HeaderToModel tests
* Fix non-PrimitiveTypes with low IDs.
* Ensure we use `revng model compare` to test the model.
* Updates the name to reflect the recent changes in naming convention
  and in the way we represent `model::Type::ID`s.
2023-08-23 16:37:39 +02:00
Alessandro Di Federico 330d2b6cc7 Model: rework how we name things
This commit:

* Introduces `_` as a prefix for all non-user entities we emit in
  decompiled code.
  Also, some names have been changed to be more concise.
  Specifically, the following entities have changed:
  `_ENUM_UNDERLYING`, `_ABI`, `_REG`, `_padding_at_`,
  `_artificial_struct_`, `_artificial_wrapper_`, `_stack`,
  `_break_from_loop_`, `_var_`, `_stack_arguments`,
  `_artificial_struct_returned_`, `_enum_max_value_`.
* Introduce _PACKED for `__attribute__((packed))`.
* `EnumEntry` name: drop the `EnumType` name prefix.
2023-08-23 16:37:39 +02:00
Alessandro Di Federico 247879f7fc model::Type::ID: switch to progressive IDs
This commit switches `model::Type::ID` from being a GUID to be a
progressive number, in order to make things easier for humans.

On top of this, this commit introduces the following changes:

* TypeCopier: import all the necessary PrimitiveTypes and improve
  handling of CustomName.
* Move Kind as the last field of the key of each TupleTree type used in
  an `UpcastablePointer`.
* Update the ground truth of tests to ignore the `CustomName` in favor
  of focusing on `OriginalName`.
* Increase adoption of `model::Binary::makeType`, equivalent to
  `Binary.recordNewType(makeType<model::*Type>())`.
2023-08-23 16:14:04 +02:00
Alessandro Di Federico 68157ea370 for-propagated-prototypes: ignore debug info 2023-08-23 16:14:04 +02:00
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
Pietro Fezzardi 9c755d89e6 Use only compact annotation macros in tests 2023-07-26 10:01:27 +02:00
Djordje Todorovic 1d3cacf6c2 HeaderToModel: support *80_t and *96_t primitives 2023-07-25 12:04:14 +02:00
Djordje Todorovic 943ceff61f Add tests for ImportModelFromC Analysis 2023-07-25 12:04:08 +02:00
Djordje Todorovic 262e579128 ModelToHeader: annotation for enum underlying type 2023-07-25 12:03:57 +02:00
Djordje Todorovic 5c0167f792 Add ImportModelFromC Analysis
This analysis will be used for the following features:

1) Edit Type in the Model
2) Edit Function Prototype in the Model
3) Add Type to the Model

It takes C code as an input, parses it and produces a Model
type that represents the C type.
2023-07-24 11:51:47 +02:00
Djordje Todorovic e6b128c17b ModelToHeader: Print annotation __attributes__
This will be useful for `edit/add type` feature,
since we will be able to specify which ABI describes
a function, from the source code written in C.
2023-07-24 09:17:08 +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
Pietro Fezzardi c06f963fe1 Test recompilation for i386 separately
This is necessary because i386 has weird sizes for `long double` that
result in `float86_t` in the model, so we need to pass additional
arguments to the recompilation tests, in order to avoid compiler errors.
2023-06-30 10:48:59 +02:00