Commit Graph

6113 Commits

Author SHA1 Message Date
Alessandro Di Federico 078daef537 More robust StackAnalysis test reference results
We recently bumped the GCC version used for the x86-64 toolchain. The
newer version makes slightly different choices of instruction breaking
the names of basic blocks.

This commit drops them, since they are not really necessary: checking
the order is already more than enough.
2020-10-22 11:22:26 +02:00
Alessandro Di Federico 3a78fae441 Polyfill for shutil.which 2020-10-21 10:34:35 +02:00
Alessandro Di Federico 782eb09ffc Switch to produce bitcode where possible 2020-10-21 10:34:34 +02:00
Alessandro Di Federico 0e4c4aad59 Make --use-debug-symbols the default 2020-10-21 10:34:34 +02:00
Alessandro Di Federico d72f69c975 Import GenericGraph
This commit imports `GenericGraph`, its tests and fixes some related
issues in `FilteredGraphTraits`.
2020-10-21 10:34:01 +02:00
Pietro Fezzardi 228a935a2a Add tests for preparation passes, using revng-qa
This commit uses `revng-qa`-provided artifacts to run end-to-end tests
for the preparation passes that need to be executed before
decompilation:
- RemovePCStoresPass
- RemoveBadPCPass
- RemoveNewPCCalls

These tests and the associated passes can be dropped if the preparation
they do will be ever included in `revng` as part of a specific lifting
pipeline dedicated to decompilation.
2020-10-12 11:42:06 +02:00
Pietro Fezzardi 6313b3229a Decompiler: fix detection of revng-c include file.
This commit fixes the detection of the revng-c include file in build
directory, using the PathList facility provided by revng.
Before this commit, running revng-c from build directory failed to
properly identify the revng-c include if it was not already installed
but only available in the build directory itself.
2020-10-12 11:42:06 +02:00
Alessandro Di Federico 94b28d0514 bin/revng: more robust diff of opt --help output 2020-10-06 16:04:55 +02:00
Alessandro Di Federico 1c2d3e0613 bin/revng: introduce $REAL_ARGV0 2020-10-06 16:04:32 +02:00
Alessandro Di Federico 1fa5b0fe68 Install bin/revng from build directory 2020-10-06 16:03:59 +02:00
Alessandro Di Federico 62c1e3c564 Go back to version 0.0.0 2020-10-06 16:03:33 +02:00
Pietro Fezzardi 05e34ef6f9 Add functions to get installed resource files 2020-10-05 14:09:53 +02:00
Pietro Fezzardi 838ab5b247 CSAA: switch taint sets to SetVector
This makes iteration order deterministic, making bugs due to ordering
easier to reproduce.
2020-10-05 14:09:31 +02:00
Pietro Fezzardi 9fca2ba1e0 CSAA: fix handling of recursion again 2020-10-05 14:09:17 +02:00
Antonio Frighetto 11e9203de9 StackAnalysis: storing Type in copy() method
`FunctionType::Values Type` was not copied when returning an `IFS`
object. This issue was addressed by adding `Type` to `Result` as well.
2020-10-01 18:17:53 +02:00
Pietro Fezzardi a94371cca2 EnforceABI: promote CSV in ConstantExprs casts
EnforceABI promotes global variables representing parts of the CPU
states to arguments and return values of isolated functions.

This commit enables the promotion of CSV that are used in isolated
functions only indirectly, through `ConstantExpr`s casts.
2020-10-01 18:17:53 +02:00
Alessandro Di Federico 5a7d4d194a Install check-revng-conventions 2020-10-01 18:17:53 +02:00
Antonio Frighetto 883dd14f43 Declare the exception object with static storage
Fix an out-of-scope issue, where the `_Unwind_Exception` object was used
after the destruction of `raise_exception_helper`'s stackframe.
This issue has been addressed by placing the object into the `.bss`
segment.
2020-10-01 18:17:53 +02:00
Alain Carlucci 9034fcb235 scripts/revng: s/log/log_error/ 2020-10-01 18:17:53 +02:00
Pietro Fezzardi 510f503716 IRHelpers: improve prints for llvm::Value
This commit improves prints of Argument, Function, ConstantInt
2020-10-01 18:17:53 +02:00
Pietro Fezzardi 408b2c9592 IRHelpers: improve replaceAllUsesInFunctionWith
This helper function is now able to replace also uses that are inside
`ConstantExpr`s.
Before this commit they were not substituted correctly, causing problems
down the decompilation pipeline.
2020-10-01 18:17:53 +02:00
Alessandro Di Federico b4c78ad047 libtinycode is now bitcode 2020-10-01 18:17:53 +02:00
Pietro Fezzardi b8e2f85ddd CSAA: fix handling of recursion 2020-10-01 18:17:53 +02:00
Pietro Fezzardi 998d003d10 check-conventions.sh: better match C++ filenames 2020-10-01 18:17:46 +02:00
Pietro Fezzardi 44e47de54c check-conventions.sh: properly set exit status
Before this commit, the exit status was not really taken care of.
Now the exit status is set to error whenever some of the checks fail,
and to success only if all the checks succeed.
2020-10-01 18:17:46 +02:00
Pietro Fezzardi 643a79ede5 check-conventions.sh: add check helper functions
This commit adds two helper functions that run two set of checks:
- `run_clang_format` runs clang format
- `run_revng_checks` runs revng-specific checks

This is a preliminary commit to ease extension of `check-conventions.sh`
so that it can be better integrated with bash scripts and git hooks.
2020-10-01 18:17:45 +02:00
Pietro Fezzardi 1594664743 check-conventions.sh: drop --format option
This option is now redundant, since `clang-format` always runs.
2020-10-01 18:17:29 +02:00
Alessandro Di Federico 89651cbde8 revng-lift: fix new module's data layout
We used to hard code a data layout. We now copy it over from the helpers
module.
2020-10-01 17:41:55 +02:00
Alessandro Di Federico 72b840605c AVI: fix out-of-bound access
In `AdvancedValueInfo` we used to access an element in a vector that has
been shrinked.
2020-10-01 17:41:44 +02:00
Alessandro Di Federico 60fdcbc66a Whitespace changes 2020-10-01 17:40:17 +02:00
Pietro Fezzardi 927dab517a Run RemoveNewPCCalls only on isolated functions 2020-09-28 10:42:13 +02:00
Pietro Fezzardi d24edfc3f7 Add enable_testing() to CMakeLists.txt 2020-09-25 14:26:00 +02:00
Pietro Fezzardi 25e4f9ef73 Update required version of cmake to match revng
Before this commit, the cmake_minimum_required version was cmake 2.8.
This commit updates it to require at least cmake 3.15.0.
This is in line with what revng does.
2020-09-25 14:24:02 +02:00
Alain Carlucci 3cafe56223 MetaAddress::fromString: fix error handling
StringRef::getAsInteger() returns true on error; false on success. This
commit fixes the off-by-not.
2020-09-14 17:19:14 +02:00
Pietro Fezzardi 66243838c8 Allow decompiling functions called bb.main
They were disabled before this commit, to work around some limitation of
an old benchmark suite.
2020-09-11 18:29:37 +02:00
Pietro Fezzardi 466d058c5e UnitTests: fix CMake linking for Boost Unit Test 2020-09-09 11:16:50 +02:00
Andrea Gussoni 476a004c30 Use revng_add_private_executable to build tests 2020-09-09 11:16:50 +02:00
Andrea Gussoni 50f59b0eb9 Move ReachabilityPass to tests folder
Move the `ReachabilityPass` library to the `tests` folder, the only
place where it is used, and change it from static library to dynamic
library.
2020-09-09 11:16:50 +02:00
Alessandro Di Federico 724c4c0baa Add g_realloc to support.c 2020-09-08 17:06:54 +02:00
Alessandro Di Federico 85ec2e2e05 Produce artifacts for decompilation 2020-09-04 23:54:26 +02:00
Alessandro Di Federico cbe36d5267 FunctionIsolation: enable/disable safety checks 2020-09-04 23:53:00 +02:00
Alessandro Di Federico 270595632c Fix dependencies for revng-qa artifacts 2020-09-04 23:52:45 +02:00
Alessandro Di Federico 85058249c5 Avoid pygraphviz crash with Python 3
Just a workaround.
2020-09-04 17:40:00 +02:00
Alessandro Di Federico ae3c800109 Implement MetaAddress::{from,to}String 2020-09-02 18:21:07 +02:00
Alessandro Di Federico e62cbb5ceb Implement comparison operators for MetaAddress 2020-09-02 16:55:20 +02:00
Andrea Gussoni d48a15e607 Run revng translation test with function isolation
Re-enable the use of function isolation for the `translation` test
integrated in revng.
2020-08-03 22:11:18 +02:00
Andrea Gussoni a590159993 Use c++ compiler for linking the translated module
We now make use of the `__gxx_personality_v0` personality function to
handle the exception behavior.

For this reason, we now need to use a c++ compiler for linking the final
module after the translation process of a binary.
2020-08-03 22:11:18 +02:00
Antonio Frighetto 76a6403ebd FunctionIsolation: drop ExceptionFlag
ExceptionFlag has been superseded by proper use of stack unwinding.
Our custom personality routine has been replaced with the GNU GCC
personality one.
2020-08-03 22:11:06 +02:00
Pietro Fezzardi a89b4a32d9 RegionCFG: prevent inserting nodes while iterating 2020-07-27 16:57:35 +02:00
Pietro Fezzardi 41ab9f3c72 Flattening: avoid removing SetNodes
This was a leftover from when we were trying to restructure the LLVM IR
like the combed RegionCFG, and was not necessary anymore.
2020-07-27 15:20:17 +02:00