Commit Graph

6113 Commits

Author SHA1 Message Date
Davide Depau 4c0576c1e4 Set custom crash error message 2022-07-22 21:04:03 +02:00
Davide Depau 0d55cd4c51 Do not explicitly print stack trace on abort
Let the signal handler take care of that
2022-07-22 21:04:03 +02:00
Davide Depau 8d89be44fc Add initialization utility to all main functions 2022-07-22 21:04:03 +02:00
Davide Depau 4f06a26105 Introduce CLI initialization utility 2022-07-22 21:04:03 +02:00
Alessandro Di Federico ba3db134b7 Merge branch 'feature/segments' 2022-07-22 16:11:10 +02:00
Antonio Frighetto 4bc21328d8 Model: reserve type prefixes 2022-07-22 16:10:51 +02:00
Antonio Frighetto 5500fadb0e MachOImporter: add segment name 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
Alessandro Di Federico 91fe152d52 Merge branch 'feature/fix-python-model-wrapper' 2022-07-22 16:09:38 +02:00
Giacomo Vercesi 152a624f47 revng.model: drop last version autodetection
revng.model.__init__ would dynamically import the latest version of
the model when imported, however this would break IDE hints as the
classes would not be properly detected. Instead we now manually
specify the last version in the __init__.py file.
2022-07-22 15:07:14 +02:00
Giacomo Vercesi 4486167d92 revng.model: add TypedList
Add a specialized list class to be used in the model. This will do
runtime instance checking to make sure that list-like fields in the
model only contain object of the correct type.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi 93e1b1a9e8 revng.model: use safe version of yaml.Loader 2022-07-22 14:56:15 +02:00
Giacomo Vercesi cac78b9604 revng.model: fix required sequence fields
Fix the constructor for required sequence fields, now they use a
`default_factory` with `list` to construct an empty list when none is
passed to the constructor.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi 116d965117 revng.model: implement kw_only
Implement a constructor override for model classes that checks that the
constructor does not have positional arguments passed to it. This can
be dropped post-3.10 since it is implemented natively by kw_only.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi 2329201ba1 revng.model: import contents of MetaAddress
This allows to have all the classes needed for model manipulation to
be available with `from revng.model import *`.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi 018518d783 revng.model: remove tags from dumper
Tags in the yaml have been deprecated for a while, remove them from
being outputted from YAML dumper.
2022-07-22 14:56:15 +02:00
Giacomo Vercesi 930bac9bca daemon test: filter out environment variables
When running `revng daemon` for tests, remove a selection of
environment variables that could negatively impact the correct
execution of the tests.
2022-07-22 14:56:15 +02:00
Alessandro Di Federico f84b87e63e Minor changes 2022-07-21 19:01:37 +02:00
Pietro Fezzardi 8e0ec3ca04 Merge branch feature/segments 2022-07-19 15:20:25 +02:00
Antonio Frighetto cb2df465fa Recompilation: add type mismatch flags 2022-07-19 13:54:28 +02:00
Antonio Frighetto 19d7f8b2c9 Late decompilation: support model::Segment
Backend and InitModelTypes now handle the opaque `segmentRef` marker.
2022-07-19 13:53:21 +02:00
Antonio Frighetto 19dd1a34dd OperatorPrecedenceResolutionPass: add segmentRef 2022-07-19 13:52:13 +02:00
Antonio Frighetto a7ddddce92 DLA: recover model::Segment type
DLA now handles `segmentRef` opaque function calls.
2022-07-19 13:51:06 +02:00
Antonio Frighetto 9a08671dae DuplicateReferences: support segmentRef call 2022-07-19 13:49:58 +02:00
Antonio Frighetto d9bc64b29d Introduce MakeSegmentRefPass
A simple pass that scans constant expressions and literals and
replaces them with opaque calls so that they can be easily dealt
with by the Backend, in an attempt of emitting better-looking
decompiled code.
2022-07-19 13:48:50 +02:00
Antonio Frighetto 0ca87e8840 ModelHelpers: drop createEmptyStruct
`createEmptyStruct` has been upstreamed into revng.
2022-07-19 13:47:44 +02:00
Pietro Fezzardi e4a7b56c05 Merge branch feature/vma-pipeline 2022-07-18 18:33:46 +02:00
Pietro Fezzardi 7d70881060 VMA: restructure getAcceptedColors
Now the two cases (with and without Model) are more clearly separated,
allowing for e.g. special handling of Function arguments in the future.
2022-07-18 18:33:29 +02:00
Pietro Fezzardi cecb02f3da Move getAcceptedColors where it's used 2022-07-18 15:37:31 +02:00
Pietro Fezzardi 06c3b22c80 VMA: make ColorSet comparisons more homogeneous 2022-07-18 15:37:31 +02:00
Alvise de Faveri c5e24053a7 Run VMA during InitModelTypes 2022-07-18 15:37:31 +02:00
Alvise de Faveri 52ae6595ad VMA: Migrate VMA to VMAPipeline
Add an engine for running VMA in different modes. User can:
- Decide how to initialize the colors (e.g. from the Model or from
  the LLVM IR)
- Decide what to do with the final TFG obtained by VMA
- Decide whether or not the Mincut algorithm should run
2022-07-18 15:37:31 +02:00
Alvise de Faveri 06e2f16e93 VMA: Make TypeFlowNode members private
Candidate colors, accepted colors and content are now accessible
only with setters and getters. In this way, we can check that
the Candidates are always a subset of the Accepted colors.
2022-07-18 15:37:31 +02:00
Alvise de Faveri a788a5ba62 Add helpers for inferring model types from the IR
1. Add a common helper to traverse ModelGEPs (`traverseModelGEP`)
2. Add a centralized way to deduce the model type of values that
   have strong model information attached to them (e.g. isolated
   functions and ModelGEPs)
3. Add a similar helper for deducing formal types of operands in known
   cases
2022-07-18 15:37:31 +02:00
Alvise de Faveri 490a09e8c1 Add Marker tag to Parentheses 2022-07-15 17:17:04 +02:00
Alvise de Faveri 557b43d525 Never include RecursiveCoroutine-coroutine.h 2022-07-15 17:17:04 +02:00
Alvise de Faveri cbeb006e11 Backend: Check that AddressOf is never a cast 2022-07-15 17:17:04 +02:00
Alvise de Faveri c2481aeb7b Support: Add deserializeFromLLVMString
Instead of having `paseQualifiedType` and `parseAndDeserialize`,
we now have a single function that is symmetric to
`serializeToLLVMString`.
2022-07-15 17:17:04 +02:00
Alvise de Faveri c9930528ee ModelGEP: Fix pointee type in makeBestGEPArgs 2022-07-15 17:17:04 +02:00
Pietro Fezzardi c8b47cfdc6 Enable -Wimplicit-fallthrough
This warning is not enabled by default with -Wall nor with -Wextra.
2022-07-05 10:33:06 +02:00
Davide Depau d02237ea5e python: import CIterable from collections.abc
Importing from `collection` has been deprecated for a while now.
2022-07-05 10:31:36 +02:00
Pietro Fezzardi f28a665a74 Merge branch feature/cloud-fixes 2022-06-29 17:00:08 +02:00
Alessandro Di Federico 0da820c7a7 Merge branch 'feature/cloud-fixes' 2022-06-29 16:50:26 +02:00
Giacomo Vercesi 80afd71721 Add singleTargetFilename to pipelines
A step's artifacts now include singleTargetFilename, which gives a
suggested filename to use when a single element is extracted from the
underlying container.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi f02aecfccb Python API: produce now returns a dict
When requesting a produce for multiple targets the result will be a
dictionary mapping "<target>:<result>". This also changes the GraphQL
API where a json-serialized string is returned.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 30ef77e6fa GraphQL: introduce queries to retrieve globals
Change the schema to allow introspection of context globals.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 636299785d GraphQL: introduce artifacts introspection
Allow artifacts information (container and kind) to be retrieved from
the Step type.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 62e9baeddb GraphQL: rework schema to be camelCase
GraphQL conventions, encourage the use of camelCase for query fields
and PascalCase for types, as detailed here:

    https://graphql-rules.com/rules/naming-fields-args
2022-06-29 14:50:58 +02:00
Giacomo Vercesi df72bb68b0 GraphQL: introduce CORS headers
Add CORS headers to the graphql api. These are set via the REVNG_ORIGINS
environment variable.
2022-06-29 14:50:58 +02:00
Giacomo Vercesi 59b01a9f1b revng.daemon: asyncify all PipelineC calls
In typical scenarios most PipelineC calls block for too long, this is
debilitating to the GraphQL API since coroutines are run
cooperatively. This commit moves all PipelineC calls in a separate
thread.
2022-06-29 14:50:58 +02:00