Commit Graph

27 Commits

Author SHA1 Message Date
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
Alessandro Di Federico 0dfc81da41 Minor model improvements
* Introduce some documentation for the model.
* Improve the way enums are serialized/deserialized.
* Mark certain fields of model data structures as optional.
* introduces some error messages during model validation.
2021-10-18 20:44:58 +02:00
Alessandro Di Federico fd30d3de42 Import the model's type system
This commit introduces the type system of the model along with several
various other improvements to the model and its users.

* Introduce the type system.
* Introduce possibility to tag certain fields in the model as to be
  optional during YAML serialization.
* All the `Name` fields have been replaced in favor of `CustomName` plus
  a `name` method that will use `CustomName` if available, or an
  automatically generated name otherwise.
* Make TupleTreeReferences behavior more robust: now you either need to
  have a valid pointer to `Root` and a `Path` or be default constructed
  (`nullptr` for `Root` and an empty `Path`). Any other configuration is
  invalid.
* The type system introduces `RawFunctionType`: this superseds the
  previous way in which we were specifying arguments and return
  values. Users of such information have been updated accordingly.
2021-07-21 18:22:58 +02:00
Alessandro Di Federico 6d10581163 Whitespace and other minor changes 2021-07-15 13:30:25 +02:00
Alessandro Di Federico c04a30e703 Model: fake functions have no blocks 2021-05-08 11:39:10 +02:00
Alessandro Di Federico 1ac2884f2e Handle blocks ending with unreachable
Sometimes basic blocks end with an
2021-05-08 11:39:10 +02:00
Alessandro Di Federico 51682eb024 model::FunctionEdge: carve out CallEdge 2021-05-05 17:10:12 +02:00
Alessandro Di Federico 0f7de0c2e0 Call to noreturn functions are not killer
We used to mark call to noreturn functions as killers, but this is not
correct.

Note that this is a temporary solution, we need to explicitly handle
such situations.
2021-02-19 09:39:49 +01:00
Alessandro Di Federico 93b7420c8a Implement model::Function::dumpCFG 2021-02-19 09:39:49 +01:00
Alessandro Di Federico 82605514c4 model: prepare for ABI information
This commit also drops some dead code and fixes Model tests accordingly.
2021-02-19 09:39:49 +01:00
Massimo Fioravanti 8ba9930638 Invert inheritance of GenericGraph nodes
GenericGraphs no longer require CRTP.
2021-01-27 19:46:53 +01:00
Alessandro Di Federico 38031f2f8a Import preliminary model
This commit imports:

* support for (de-)serializing tuple-like objects in YAML
* the Model data structure
* the {Load,Serialize}ModelPass
2021-01-27 19:46:53 +01:00