Commit Graph

1065 Commits

Author SHA1 Message Date
Andrea Gussoni d2db8d4cfa ControlFlowEdgesGraph: improve at method
Improve the `at` method by giving it a coherent semantics with a
standard `at` map method semantics.
2023-10-09 10:33:48 +02:00
Andrea Gussoni e2090b8746 GraphAlgorithms: nodesBetween double DFS
We now implement the `nodesBetween` primitive with a double DFS visit.
Specifically, we have:
1) A forward DFS that starts from the `Source`, and stops at `Target`.
2) A backward DFS that starts from the `Target`, and stops at `Source`.
The final result is then the intersection of the nodes found by the two
above DFS visits.

A new `findReachableNodes` primitive is also added to perform a DFS from
a `Source` node, which stops at the `Stop` parameter node, if present.

Added unit tests to improve the coverage.
2023-10-09 10:33:48 +02:00
Alessandro Di Federico d8147aa62e Introduce TupleTreeReference::dump 2023-10-05 10:19:44 +02:00
Alessandro Di Federico c6425b2618 TupleTree::verify: more fine grained assertions 2023-10-05 10:19:44 +02:00
Alessandro Di Federico 2cbf3a8313 TypeCopier: minor rework 2023-10-05 10:19:44 +02:00
Alessandro Di Federico 456b916bcc Move TypePath definition 2023-10-05 10:19:44 +02:00
Alessandro Di Federico bf66ecc389 {,Dynamic}Function::Prototype: support typedefs 2023-10-05 10:19:44 +02:00
Giacomo Vercesi e2504dd6f2 Implement storage credentials update
Add the functionality to rev.ng's infrastructure to allow to dynamically
update the credentials of the underlying storage provider at runtime.
2023-09-14 17:32:08 +02:00
Giacomo Vercesi 0c5bc8c120 Drop unused functions from PipelineC
Remove all the functions that are no longer needed by `revng.api`.
2023-09-14 15:44:33 +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 2a239ddf47 Introduce PipelineDescription
Add the PipelineDescription object that describes the structure of a
pipeline. This will be used by all the downstream users instead of
pipeline accessor methods via PipelineC.
2023-09-14 15:44:33 +02:00
Giacomo Vercesi 6b6bfd2693 pipeline::Option: fix TypeName
Fix the `getTypeName` function needed to report the type of an Analysis'
option.
2023-09-14 15:44:32 +02:00
Giacomo Vercesi 29b229455f Tuple Tree: rename Parent in struct.h.tpl
Rename the Parent attribute of a struct to BaseClass to avoid conflicts
with Tuple Tree structs that might need that attribute.
2023-09-14 15:44:32 +02:00
Giacomo Vercesi d2967d2a49 Tuple Tree Generator: remove Model headers
This commit removes the inclusion of the `Binary.h` header in
Tuple-Tree Generator files, allowing Model-independent Tuple Trees to be
generated.
2023-09-14 15:44:32 +02:00
Giacomo Vercesi dab9369942 ContainerFactory: expose mime type
Allow retrieving the mimetype of a container without having to
materialize it in the pipeline.
2023-09-14 15:44:32 +02:00
Alessandro Di Federico 26310efc1c TypeCopier::copyTypeInto: fix returning wrong type
TypeCopier::copyTypeInto used to return a random type among those just
created instead of the new version of the originally requested type.
2023-09-11 14:15:37 +02:00
Giacomo Vercesi 0b2754c824 pipeline: drop Disk from storage methods
This commit changes the following method names across the codebase:
* `storeToDisk` -> `store`
* `loadFromDisk` -> `load`
This has been done since the storage is no longer bound to the local
storage.
2023-09-06 15:23:43 +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 4a2cd259e3 Introduce GzipTarFile
Add the GzipTarFileWriter and GzipTarReader classes that allow reading a
slightly custom `.tar.gz`.
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 a84ebd0e51 revng.daemon: trim Eventmanager's functionality
Drop most of the functionality provided by EventManager. Add the
functionality that allows saving the working directory after a period of
inactivity.
2023-09-06 15:23:43 +02:00
Giacomo Vercesi 7f0bea6f6a Improve TemporaryFile
This commit adds the following enhancements to `TemporaryFile`:
* Adds TemporaryFile::make to allow catching the error if the temporary
  file creation fails
* Fix the move assignment, as it would leak the original file until shutdown
* Fix the destructor, as it would be called even on a moved object
2023-09-06 15:23:43 +02:00
Giacomo Vercesi dc90bca33e revng/Support: split part of Statistics in OnQuit
Split the OnQuit functionality of Statistics as a separate header and
object file. Rework the interface to use lambdas instead of the
OnQuitInterface.
2023-09-06 15:23:43 +02:00
Pietro Fezzardi 6addadcda7 DynamicHierarchy.h: drop unused include 2023-09-05 15:53:43 +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
Alessandro Di Federico b5aa75f1f1 Introduce model::PrimitiveType::fromName 2023-08-23 16:14:05 +02:00
Alessandro Di Federico f6a5857d80 StructType: move the Size field up 2023-08-23 16:14:05 +02:00
Alessandro Di Federico f51af94e8f TupleTreeReference::isValid is for assertions only 2023-08-23 16:14:05 +02:00
Alessandro Di Federico f584308ead Introduce getLibrariesFullPath 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
Alessandro Di Federico 70136ab7ef pipeline::Global: verify upon load 2023-08-23 16:14:04 +02:00
Alessandro Di Federico e63573ee81 Introduce model::Binary::path 2023-08-23 16:14:04 +02:00
Alessandro Di Federico 67be2c30b8 Introduce PrimitiveType::FirstNonPrimitiveID 2023-08-23 16:14:04 +02:00
Alessandro Di Federico 56268e94b0 VerifyHelper: handle fail in type verification
Before this commit, if there was a failure during the verification of a
type (which is recursive), we'd get an assertion in ~VerifyHelper due to
a "pending" type still being verified.
2023-08-23 16:14:04 +02:00
Pietro Fezzardi 72bedb7dfd TypeSystemPrinter: print DynamicFunctions 2023-08-21 12:29:31 +02:00
Alessandro Di Federico e9470d6329 Pipeline: improve naming and docs 2023-08-01 12:17:20 +02:00
Alessandro Di Federico 14525d91f5 Adopt llvm::Task 2023-08-01 10:51:16 +02:00
Alessandro Di Federico b188f91863 Introduce ContainerToTargetsMap::size() 2023-08-01 10:51:15 +02:00
Giacomo Vercesi 9ea7d361f6 BinaryCrossRelations: fix mime type
Change the mime type of `BinaryCrossRelations` to `text/x.yaml`, so that
it's not base64-encoded when transmitting over GraphQL.
2023-07-31 16:05:52 +02:00
Giacomo Vercesi f77d4d6d1f PTML: introduce data-scope-location
Introduce the new `data-scope-location` tag that's to be used for
switching between C and ASM. Include the tag when generating ASM
instructions.
2023-07-31 16:05:51 +02:00
Giacomo Vercesi db7ad24175 PipelineManager: add produceTargets with checks
Move much of the logic of `rp_manager_produce_targets` to a method
inside `PipelineManager`, add additional checks for the existence of the
targets that are requested to be produced.
2023-07-31 16:05:51 +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
Kacper Kołodziej c0f226fa70 Add const qualifiers to some functions
getJumpTargetBlock takes llvm::BasicBlock * as argument, but doesn't
need to modify it, so const it adds const to it and other functions that
are used by getJumpTargetBlock: findJumpTarget, isTranslated, getType,
isJumpTarget.
2023-07-31 11:29:40 +02:00
Kacper Kołodziej 7bec0190e8 Fix spelling in docstring 2023-07-31 11:29:40 +02:00
Alessandro Di Federico 6ed958d614 Improve TypeShrinking
This commit fixes a TypeShrinking bug and extends it to better handle
more instructions. Specifically, we now handle shift left, select, phi
and bitwise operations.
2023-07-26 10:16:25 +02:00
Alessandro Di Federico dcc7ca3c6b AdvancedValueInfoMFI: zero-extend constraints
This commit introduces a change in AdvancedValueInfoMFI which forces to
consider constraints valid on 32-bit values to be valid on their
untruncated 64-bit counterparts.

While being unsound, this is important to easily devirtualize indirect
branches on 64-bit architectures where often constraints are expressed
on 32-bit switch values.
2023-07-26 10:16:25 +02:00
Alessandro Di Federico 259d64fc59 MFP::getMaximalFixedPoint: name return result type 2023-07-26 10:16:25 +02:00
Alessandro Di Federico 43baa73149 DOTGraphTraits<MFP::Graph>: improve HTML handling 2023-07-26 10:16:25 +02:00
Alessandro Di Federico ee335eadf1 GraphTraits: improve handling of const MFP::Graph
Improve the handling of const MFP::Graph in GraphTraits and
DOTGraphTraits.
2023-07-26 10:16:25 +02:00