Commit Graph

29 Commits

Author SHA1 Message Date
Alessandro Di Federico 42abf64c62 revng.cli: ensure proper exit code propagation 2023-06-23 17:55:41 +02:00
Giacomo Vercesi 41662b0a43 revng.support: Rework process invocation
Refactor the `run` and `try_run` functions in 4 separate functions:
* `try_run`: Run the process and return the exit code
* `run`: Run the process and assert the exit code was 0
* `exec_run`: exec the process, stopping execution of the python
              interpreter
* `popen`: Wrapper around `subprocess.Popen`, allows the most
           flexibility
2023-05-09 17:27:00 +02:00
Giacomo Vercesi 07be2c1cae Allow the use of valgrind with python
This commit does 2 main things:
* Adds PYTHONMALLOC=1 environment variable when `--valgrind` is used
  to force python to use normal malloc instead of the custom allocator
  python normally uses that's not friendly with valgrind
* Add a suppression file to remove a couple of false-positives that
  happen consistently and generate useless noise
2023-04-20 14:43:12 +02:00
Giacomo Vercesi 4400924312 revng.cli: allow non-ELFs to be run with gdb
If needed, wrap the execution of scripts in `exec` to allow running
them with gdb. This is especially useful for running python scripts
that use cffi and being able to inspect the C/C++ side.
2023-04-20 14:43:11 +02:00
Alessandro Di Federico 416c59c43b support.py: rework get_command
We introduce two paths where we can hard code search prefixes
(`/additional-search-prefixes`) and additional binaries paths
(`/share/revng/additional-bin-paths`).

This enables us to add to `additional-bin-paths` the configure-time
specified path of the preferred LLVM installation, instead of relying on
`PATH` to look up, e.g., `opt` at run-time.
2023-04-13 18:11:48 +02:00
Alessandro Di Federico 7913bf9e58 Disable LeakSanitizer 2023-01-21 16:46:35 +01:00
Alessandro Di Federico 47fd084c88 revng --verbose: shorten paths only if beneficial 2023-01-21 16:46:35 +01:00
Giacomo Vercesi e4adbe8134 revng.support: add get_root
Add the get_root function which will return the absolute path of the
root, relatively to the file location in support
2022-10-24 09:58:55 +02:00
Alessandro Di Federico 5a99154196 Put Python packages into lib/python*/site-packages 2022-10-11 19:08:10 +02:00
Giacomo Vercesi 07c2457a16 revng.cli: various improvements
This commit introduces some miscellaneous fixes to revng.cli:

* Remove useless subclasses in pipeline_tools.py;
* Improve type annotations in _commands/ptml and fix a help string;
* Add some extra type annotations for `Command`;
* Remove useless namespaces in `commands_registry` and add help text
  for the ones in use;
2022-09-01 17:45:44 +02:00
Alessandro Di Federico b14b40b1eb revng: do not print failing command 2022-08-31 18:07:47 +02:00
Alessandro Di Federico 45d563bc15 revng: use ld.so --preload instead of LD_PRELOAD 2022-08-08 13:55:25 +02:00
Giacomo Vercesi 1a7503183a revng.cli: dynamically load commands
Now `revng.cli` houses the core command-line driver while the individual
commands have been moved to `revng.cli._commands` and are dynamically
loaded.
2022-07-28 08:48:30 +02:00
Giacomo Vercesi 79c6086d0d revng.api: autodetect files
`revng.api` now autodetects files (libraries, pipeline yamls) for
initialization via the same mechanism used by `revng.cli`. This removes
the need to pass them via environment variables from `revng daemon`
and allows easy interaction with python's C API.
2022-06-29 14:49:29 +02:00
Alessandro Di Federico d37c3d3dd8 Fix revng --prefix
When running subcommands from a `revng` script the build directory and
the root directory were being swapped.
2022-05-31 11:30:10 +02:00
Giacomo Vercesi 2a89da8d53 revng daemon: properly shut down after tests
Fix termination of the daemon process during test, previously it was the
daemon instances were not cleaned up properly and remained running after
the tests
2022-05-06 15:03:51 +02:00
Alessandro Di Federico 9ca3447b5d revng.cli: introduce try_run 2022-04-29 17:57:49 +02:00
Giacomo Vercesi e5c9141ccc Refactor revng.cli.support
* Removed shadowed `relative` function
* Clean up imports
* Add type hints to functions
* Use Path where possible
2022-04-26 15:05:30 +02:00
Giacomo Vercesi bbce0b33e5 revng-check-conventions: introduce isort 2022-04-20 09:57:08 +02:00
Giacomo Vercesi 46821cee5f revng-check-conventions: introduce mypy 2022-04-20 09:57:01 +02:00
Giacomo Vercesi 31a836e48c revng-check-conventions: introduce flake8 2022-04-20 09:56:44 +02:00
Giacomo Vercesi d81dc49809 revng-check-conventions: license check 2022-04-20 09:55:18 +02:00
Alessandro Di Federico 173ad98661 revng driver: introduce --keep-temporaries 2022-03-17 16:46:02 +01:00
Alessandro Di Federico cdeb1ea507 revng driver: introduce --dry-run 2022-03-17 16:46:02 +01:00
Alessandro Di Federico e753e28f43 revng: make more extensive use of relative paths 2022-03-17 16:46:02 +01:00
Alessandro Di Federico af6305725d Rewrite revng driver infrastructure
It really needed some fresh air.
2022-03-17 16:46:00 +01:00
Alessandro Di Federico da7701bd4e Move all executables except revng to libexec/revng
We used to collect all binaries into the `bin/` directory. However this
led to confusions since certain commands where available both as
`revng-command` and `revng command`.

This commit moves all the executables except `revng` into
`libexec/revng`, which, according to FHS, is dedicated to "internal
binaries that are not intended to be executed directly by users or shell
scripts".
2022-03-17 14:10:50 +01:00
Alessandro Di Federico 997e7f60cb scripts/renvg: handle revng pipeline
Let `scripts/revng` intercept `revng-pipeline` invocations and add, not
only -load, but `-P` (pipelines) too.
2022-03-16 22:10:15 +01:00
Filippo Cremonese 6672eb8dbc Turn Python scripts into modules 2022-02-23 18:02:42 +01:00