Commit Graph

61 Commits

Author SHA1 Message Date
Alessandro Di Federico 47c3dd8f0f Drop model::Segment::Sections 2024-05-22 10:25:25 +02:00
Alessandro Di Federico bf6cefc05a Externalize functions to improve build times 2024-05-03 21:52:40 +02:00
Alessandro Di Federico fe1dffcffd Add some missing includes
This is in preparation of reducing headers in Debug.h.
2024-05-03 21:52:40 +02:00
Alessandro Di Federico ffe93548c5 Model ::size(): do not suspend tracking 2024-03-01 14:53:07 +01:00
Alessandro Di Federico db4e5c4a5e Introduce dumpModel 2024-03-01 14:53:07 +01:00
Alessandro Di Federico c73e88a8d8 Model: handle missing function prototype 2024-02-09 10:04:20 +01:00
Massimo Fioravanti f6ff8e544d Add tracking debug infrastructure
Add a mechanism to make the program crash when a given element of the
model is read or written.
2024-01-02 11:14:56 +01:00
Massimo Fioravanti c276a439b5 Add pipeline invalidation
Replace the stub implementation of invalidation with the proper
implementation. A ReadPathCache is added to each global so that it can
keep tracks of what target are associated to which read paths.
2024-01-02 11:14:56 +01:00
Pietro Fezzardi 48b27af795 Make Segment::Type a TupleTreeReference
This is homogeneous with all other nullable reference to types in the
model, like the StackFrameType in model::Function, and others.
2023-12-05 16:19:38 +01:00
Pietro Fezzardi ef8a9699f1 Improve model::Function::verify 2023-12-05 16:19:38 +01:00
Alessandro Di Federico 79c5f59449 DwarfImporter: handle invalid function addresses 2023-10-06 17:16:04 +02:00
Alessandro Di Federico bf66ecc389 {,Dynamic}Function::Prototype: support typedefs 2023-10-05 10:19:44 +02:00
Alessandro Di Federico f51af94e8f TupleTreeReference::isValid is for assertions only 2023-08-23 16:14:05 +02:00
Alessandro Di Federico a5b380b201 Model: rework how we name things
This commit improves the formalization of how we handle names.

The main changes are:

* Now `_` is a reserved prefix and all the generated names start with
  `_`.
* The model verification routine now checks that `CustomName`s in the
  global scope do not collide with any local namespace (e.g., fields of
  a `StructType`).
* We changed the prefix `prefix_` to `unreserved_` to better convey the
  fact that the prefix has been introduce to use an non-reserved name.
2023-08-23 16:14:04 +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
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02: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 0170c0dfeb Model: add segment overlap check to verification 2023-05-17 14:08:06 +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
Alessandro Di Federico 19d59ffd73 Implement Segment::dump 2023-04-08 08:42:24 +02:00
Ivan Krysak 726baf5318 Model: make Binary::recordNewType stricter 2023-03-15 10:19:02 +01:00
Djordje Todorovic 24a5705e12 Importer: Attach attributes when copying types 2023-02-16 11:07:52 +01:00
Massimo Fioravanti 4dc2e92782 Introduce DocumentError
`DocumentError`s are the inteded way of propagating errors from the
pipeline to the frontend when a location is required to inform the user
of the error whereabouts.
2023-02-09 13:42:50 +01:00
Antonio Frighetto ea0a06a876 revng.daemon: accept no arguments for analysis
Let GraphQL accept zero or more parameters for analyses.
2023-02-06 09:37:23 +01:00
Massimo Fioravanti 742e1a0c56 TupleTree: switch from public fields to accessors 2022-12-12 18:36:57 +01:00
Alvise de Faveri 999df25246 Add revng model export type-graph tool
This tools dumps a type, a function or an entire type-system to a
dot file,representing dependencies between types as edges.
2022-09-19 08:35:06 +02:00
Djordje Todorovic 098f864d8d Model: Add parsing of dyn syms to PECOFFImporter
This parses symbols similar to ELF's .dynsym.
2022-07-28 14:52:02 +02:00
Giacomo Vercesi 09009836a1 PipelineC: expose globals verification 2022-07-28 08:47:46 +02:00
Alessandro Di Federico d42fb9bb13 Segment::verify(): relocations can be out segment
We used to check that the target address of a relocation needs to be
within the `model::Segment` it's referring to.
However this is not correct.
2022-07-27 18:57:21 +02:00
Antonio Frighetto 4bc21328d8 Model: reserve type prefixes 2022-07-22 16:10:51 +02:00
Antonio Frighetto 186d907be3 Model: extend model::Segment
`Segment` now includes a `Type` of struct kind. This is intended to
emit the segment as a struct later in decompilation. The implementation
of name has also been added.
2022-07-22 16:10:51 +02:00
Giacomo Vercesi 039f7db93e model::*: ensure Kind -> Class correspondence 2022-04-08 17:31:05 +02:00
Antonio Frighetto 20cdfe668a EFA: take the control-flow graph out of the model
The control-flow graph and all its hierarchy components
have been moved from `model` to `efa`. The CFG is now
serialized onto the LLVM IR module as a metadata.
2022-04-05 15:37:57 +02:00
Alessandro Di Federico 1a57229693 Introduce model::Binary::DefaultPrototype 2022-03-08 15:04:34 +01:00
Alessandro Di Federico a88a9e52c3 Improve model::Segment 2022-03-08 13:06:47 +01:00
Alessandro Di Federico 97f0941aee Introduce model::Section 2022-03-08 12:26:07 +01:00
Alessandro Di Federico 8570923d64 Introduce model::Relocation 2022-03-08 12:25:59 +01:00
Alessandro Di Federico b7f5884f8c DynamicFunction::name: no OriginalName direct use 2022-02-14 17:54:32 +01:00
Alessandro Di Federico dd7477664c Update CustomName verification criteria
This commit ensures `CustomName` is unambiguous according to C symbols
rules.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 863652f480 Introduce OriginalName in the type system
The goal of `OriginalName` is to keep track of the original name of a
symbol upon import.

In future, this will also be used to promote it to `CustomName`.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 1ce1f1cbd6 model::Function::verify: relax assumptions
Now `model::Function` can miss the CFG, the `Prototype` and have
`Invalid` type.
2022-01-27 11:51:03 +01:00
Alessandro Di Federico 3799f1e973 Whitespace and other minor changes 2022-01-25 21:27:05 +01:00
Filippo Cremonese 74217b4fe5 Generate C++ model from YAML definition
Model classes are now described by a YAML document, which is used to
generate C++ headers containing classes and all the boilerplate
required for YAML serialization/deserialization, usage in
SortedVectors, etc. See the README in include/revng/Model for more
info.
2022-01-13 14:34:11 +01:00
Pietro Fezzardi 275959618f TupleTree: make Root a std::variant<T *, const T*>
This enables holding TupleTreeReferences to immutable model objects
2022-01-05 13:33:52 +01:00
Antonio Frighetto f1ac5e4075 Model: handle NoReturn functions in CallEdge 2021-12-15 18:03:30 +01:00
Alvise de Faveri 2f4b716e6b Add Model::toString() and writeToFile()
These functions can be used in conjunction to dump the Model on a
file during a gdb session, for example:

```
(gdb)  p  writeToFile(Model->toString(), "/tmp/model.yaml")
```
2021-11-19 10:17:09 +01:00
Alessandro Di Federico 83f420abda Introduce dump method for model structs 2021-10-21 15:02:00 +02:00
Alessandro Di Federico 8546a0c786 CallEdge: only indirect calls have a prototype 2021-10-21 15:01:59 +02:00
Alessandro Di Federico 3a3eea0cf5 Introduce support for dynamic functions 2021-10-21 15:01:19 +02:00