Commit Graph

6113 Commits

Author SHA1 Message Date
Pietro Fezzardi 3e78b3c9e6 DLA: fix handling of Functions without stack args 2022-05-25 17:23:42 +02:00
Pietro Fezzardi b09be7d34d SegregateStackAccesses: handle stackless Functions 2022-05-25 17:23:42 +02:00
Pietro Fezzardi 0e4842128c Add artifacts for decompilation 2022-05-25 17:23:42 +02:00
Pietro Fezzardi 79a799c4b3 Relax recompilation warnings on null conversions 2022-05-25 17:04:40 +02:00
Pietro Fezzardi 11108e8b32 Merge branch feature/pipeline-analysis 2022-05-25 15:56:32 +02:00
Massimo Fioravanti 36851359c1 Isolate analysis into single file 2022-05-25 15:50:49 +02:00
Massimo Fioravanti b184360340 Make DetectStackSizePass into a pipeline analysis 2022-05-25 15:49:38 +02:00
Massimo Fioravanti f40cf6471d Transformed DLA in a pipeline analysis 2022-05-25 15:48:27 +02:00
Massimo Fioravanti 28cf7049d5 Support new revng pipeline cli format
Efa must be now triggered manually and the argument --step is no longer
present.
2022-05-25 15:47:19 +02:00
Massimo Fioravanti 34a0356ca3 Changes to support FunctionStringMap
FunctionStringMap now requires a TupleTree<model::Binary> rather than a
model::Binary, users in revng-c are now changed to support that.
2022-05-25 15:46:12 +02:00
Alessandro Di Federico 6b63efa0a9 Merge branch 'feature/pipeline-analysis' 2022-05-25 09:14:53 +02:00
Giacomo Vercesi 2f0519c3c5 GraphQL: Introduce run_all_analyses 2022-05-24 10:56:04 +02:00
Giacomo Vercesi e5704ede11 Make Python API thread-safe and non-blocking
Since PipelineC is not thread-safe, add a lock to all function calls to
it to avoid any thread safety-related issues.

At the same time, use a thread pool to run "expensive" PipelineC
functions in GraphQL (specifically `produce_target` and `run_analysis`)
to avoid problems due to the cooperative nature of Python coroutines.
2022-05-24 10:56:04 +02:00
Alessandro Di Federico 071fe1c0e4 [FIXUP] Support analyses and global in Python 2022-05-24 10:56:04 +02:00
Giacomo Vercesi 7052f2a8a0 Support analyses and globals in Python
This commit adds the newly implemented functionality in PipelineC both
in revng.api and the graphql api, allowing:

* retrieval of global variable names
* unwrapping of a single target
* execution of analyses
2022-05-24 10:56:02 +02:00
Giacomo Vercesi 7c3d9a3fcd Python API: automatically call destructors
Use the owning annotation in PipelineC/Prototypes.h to automatically
destroy resources when they go out of scope on the python side.
2022-05-24 08:59:08 +02:00
Massimo Fioravanti 1508a1bc72 revng-pipeline: support out of line analyses 2022-05-24 08:59:08 +02:00
Massimo Fioravanti e38dfc74cc PipelineC: introduce run_all_analyses 2022-05-24 08:59:08 +02:00
Massimo Fioravanti f0a5ffe3b3 revng-pipeline: globals, extractOne and analyses 2022-05-24 08:58:48 +02:00
Massimo Fioravanti 2c48713af9 Make TupleTreeDiff compatible with regular vectors 2022-05-24 08:50:24 +02:00
Giacomo Vercesi 07c23dda8d revng-deamon: fix GraphQL URL
The page was using the wrong attribute to make the GraphQL calls
relative to the debug page's url.
2022-05-24 08:49:16 +02:00
Alessandro Di Federico 5b39595b77 Minor changes 2022-05-13 15:14:51 +02:00
Alessandro Di Federico e89870d125 Merge branch 'feature/asan-support' 2022-05-13 07:59:49 +02:00
Alessandro Di Federico 22d469aa10 mv librevngUnitTestHelpers.{a,so} 2022-05-12 21:55:18 +02:00
Alessandro Di Federico 41c21ddb07 revng-daemon: use ASan 2022-05-12 21:55:18 +02:00
Alessandro Di Federico 34a94188f0 Suggest how to build with ASan 2022-05-12 21:55:18 +02:00
Alessandro Di Federico ccba62b13d revng opt: do not add --help 2022-05-12 21:54:42 +02:00
Alessandro Di Federico fdd6f3a5f8 Merge branch 'feature/pipeline-friendly-string-map' 2022-05-12 21:54:37 +02:00
Pietro Fezzardi 20fea32ce1 FunctionStringMap: improve code-reuse
The serialize() method now uses the serialize() function provided by
revng/Support/YAMLTraits.h, so we don't have to explictly const_cast.
2022-05-12 17:00:13 +02:00
Pietro Fezzardi 1bb5bd6eee ModelGlobal: don't move the underlying model::Binary
Moving it was causing the address of the model to change, while for the
functionality of revng-pipeline we need it to be stable.

So we pay the price of expensive copy, for the sake of downstream
stability.
2022-05-12 16:59:47 +02:00
Pietro Fezzardi 741d55279b TupleTree: add copy-constructor and -assignment
The copy of a TupleTree is potentially very expensive, so it was
disabled until now and only allowed via the explict method clone().

We have now decided to make TupleTree copiable.
This commit adds a copy-constructor and a copy-assignment, killing the
clone() method that was already unused and is now effectively useless.
2022-05-11 16:16:49 +02:00
Pietro Fezzardi b190f1a47c Refactor logic to compact function targets
This commit introduces a reusable function to compact
pipeline::TargetLists that represent functions.

Initially this reasoning was only needed by TaggedFunctionKind, but now
also FunctionStringMap needs it, and potentially others in the future,
so it makes sense to keep only a single implementation for it instead of
duplicating code (and likely bugs).
2022-05-11 16:16:49 +02:00
Pietro Fezzardi ca566a76f0 Rename StringMapContainer to FunctionStringMap
This new naming more closely describes the fact that each element in the
map must be associated with a model::Function
2022-05-11 16:16:32 +02:00
Pietro Fezzardi 4722ee84fa Merge branch feature/revng-pipeline 2022-05-11 15:44:16 +02:00
Pietro Fezzardi 7d097ba3e0 Move CDecompilationPipe in lib/Backend 2022-05-11 15:21:41 +02:00
Pietro Fezzardi 42b52bb22b Add DecompiledYAMLToCPipe 2022-05-11 15:21:39 +02:00
Pietro Fezzardi 540d5d8db3 Add new tool revng-decompiled-yaml-to-c 2022-05-11 15:20:30 +02:00
Pietro Fezzardi 4188b709be Merge BeautifyGHAST back into RestructureCFG
The beautification library was split into a separate library for
historical reason, having to do with LLVM passes, their dependencies,
and dirty hacks we had around.

Now the LLVM passes, and the hacks are gone, so we can merge back
everything together.
2022-05-11 15:19:34 +02:00
Pietro Fezzardi 13019a4290 Add -t TargetFunction option to revng-decompile
This new option allows to decompile only a single function
2022-05-11 15:19:34 +02:00
Pietro Fezzardi d8d7779a37 DecompileFunction.cpp: improve logging 2022-05-11 15:19:34 +02:00
Pietro Fezzardi 29afe90460 DecompileFunction.cpp: skip over empty functions
This is necessary because with the port to revng-pipeline there will
be isolated functions with empty bodies.
2022-05-11 15:19:34 +02:00
Pietro Fezzardi 97f0f8c521 IRHelpers: add deleteOnlyBody helper 2022-05-11 15:19:34 +02:00
Pietro Fezzardi 604d370239 Remove LLVM passes RestructureCFG, BeautifyGHAST
Now that the late stage of the decompilation pipeline is managed with
revng-pipeline, and we have a standalone tool for decompilation, we
have no need to use LLVM passes anymore for those stages.

This commit also renames the directories to avoid the confusing Pass
suffix, not what LLVM passes are gone.
2022-05-11 15:19:34 +02:00
Pietro Fezzardi 0e4681dc38 Add -m option to revng-decompile to override Model 2022-05-11 15:19:34 +02:00
Pietro Fezzardi fc40f646a4 Replace CBackendPass with revng-decompile tool
This commit replace the old CBackendPass with a standalone tool:
revng-decompile.
This pass at the moment runs the three stages of decompilation:
  - CFG restructuring
  - Beautify GHAST
  - C Code generation
2022-05-11 15:19:25 +02:00
Pietro Fezzardi bce0bd70b1 StringMapContainer: fix enumeration for * target 2022-05-11 14:52:22 +02:00
Pietro Fezzardi 2dea29d926 StringMapContainer: use multiline strings in YAML 2022-05-11 14:39:31 +02:00
Pietro Fezzardi 0f4df96ad6 Mark some dump() methods as debug_function 2022-05-11 14:39:31 +02:00
Pietro Fezzardi bfe67413d3 StringMapContainer: find() and contains() methods 2022-05-11 14:39:31 +02:00
Pietro Fezzardi 1c6dac225a Add dedicated non-generated TypeKind.h header
This is necessary because now QualifiedType.h needs TypeKind, but
including Type.h directly would result in a circular dependency between
Type.h and QualifiedType.h
2022-05-11 14:39:31 +02:00