Commit Graph

366 Commits

Author SHA1 Message Date
Jurij Srebrnič 3050b291b1 Implement diff and apply for python model wrapper
Add the necessary code for the python model wrapper to allow diffing and
applying a diff.
2025-05-07 10:48:45 +02:00
Jurij Srebrnič 3bc63b833e Fixed python and typescript doc-test not executing 2025-05-07 10:48:23 +02:00
Giacomo Vercesi e95ad01ff8 Implement revng llm-rename 2025-05-05 17:28:48 +02:00
Giacomo Vercesi 591107cdce Overhaul PTML functionality
The logic of the `revng ptml` command was too tightly coupled with the
parsing of the xml. Overhaul the structure of the ptml code and split it
in two locations:
* `revng.ptml`: this module contains functions that allow easy
  manipulation of PTML, both for printing it and for obtaining the split
  metadata/text version.
* `revng.internal.cli._commands.ptml`: this implements the actual `revng
  ptml` command. This leverages the new logic in the `revng.ptml` module
  while maintaining the same functionality.
2025-05-05 17:28:48 +02:00
Giacomo Vercesi bfed42ed1e Add revng.support.get_llvmcpy helper
Add the `get_llvmcpy` helper function which returns an instance of
`LLVMCPy` which uses the `llvm-config` that's present in the search
paths.
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 6fc6d38228 Remove argparse.FileType
Python 3.14 will deprecate `argparse.FileType` [1]. This is due to a
variety of factors, one of which is that the class leaks file
descriptors when used. Remove all usages in the codebase and instead
use a wrapper function for `open`.

[1] https://docs.python.org/3.14/library/argparse.html#argparse.FileType
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 57c4f89dd3 python: remove relative imports
Remove all the relative imports from the python code that are not
relative to the current module (e.g. `from .<X> import ...`).
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 4757d57d59 StorageSaver: fetch initial credentials
Fetch the credentials contained in the URL from the `Synchronizer` when
initializing `StorageSaver`.
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 19a3eb39c6 tupletree: suppress naming error
Suppress the flake8 error N808, due to the variables beginning with `_`.
2025-05-05 16:02:40 +02:00
Khaled Ismaeel 9d80594ddc Bump model version to v3 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 8b355fc896 Add primitive support for generating migrations 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 9b07b3bcce Add primitive migration support to the CLI 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 7156cace7b Drop multiversion support in Python model wrapper 2025-04-30 15:08:45 +02:00
Giacomo Vercesi 6509cad084 test_docs: remove useless global
The `verbose` was is not modified in the `log` function, so the use of
`global` is useless.
2025-04-24 13:22:14 +02:00
Ivan Krysak ae3f19664a ModelPasses: introduce fix-model 2025-04-17 11:19:17 +03:00
Ivan Krysak 0c99d5d5fb IDBImporter: omit unnecessary typedefs 2025-04-17 11:19:17 +03:00
Ivan Krysak 2eed7f2410 IDBImporter: fix an incorrect type check 2025-04-17 11:19:17 +03:00
Ivan Krysak c4f071dfe3 Importers: adopt primitive typedef flattening 2025-04-17 11:19:17 +03:00
Ivan Krysak 433af9ef6e Adopt the new name deduplication pass 2025-04-17 11:19:17 +03:00
Ivan Krysak f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Giacomo Vercesi 38aefea930 ResettableTimer: fix deadlock
The `ResettableTimer` class' code did not account for the `function`
attribute to possibly call the timer, creating a deadlock because the
lock was already taken while calling the function. Move the function
call out of the lock.
2025-04-07 10:36:36 +02:00
Giacomo Vercesi e634861c1a Implement SyncingManager
Implement the SyncingManager class which wraps the Manager and implements
save syncing features, which comprise autosave and saving via
synchronizers.
2025-04-03 15:59:18 +02:00
Giacomo Vercesi 6a10419b69 Implement S3Synchronizer
Implement a downstream load/save handler in `revng.internal.api.Manager`
class which handles loading and saving files from a local directory to
a s3 server.
2025-03-28 14:23:10 +01:00
Giacomo Vercesi d9e928dce9 fetch debuginfo: provide alternative urls via env
Allow the `fetch debuginfo` command to have the upstream server urls be
provided via environment variables rather than the command-line.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi f6b9e509a3 fetch debuginfo: actually check for PE/COFF
Add the code needed to check if the input file is actually a PE/COFF
file.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi fa44c4cf2f fetch debuginfo: drop self.verbose
The `FetchDebugInfoCommand` contained assignment to `self.verbose` which
was unused. Drop it.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi ca26c06ecc EventManager: fix save logic
Fix the save logic of `EventManager` where an erroneous comparison lead
to the saves never being triggered.
2025-02-25 09:18:24 +01:00
Giacomo Vercesi 74cbb83d10 fetch-debuginfo: add retries
Add retries when fetching debugging symbols via the `revng model
fetch-debuginfo` command. Retries only apply when the status code
returned by the server is within the expected ones.
2025-02-24 18:17:47 +01:00
Giacomo Vercesi f6f512883a revng daemon: add save mutation
Add the `save` mutation to the GraphQL api. This allows a client to
trigger saving.
2024-12-20 12:24:34 +01:00
Giacomo Vercesi 319b558ddb EventManager: change saving logic
Switch the saving logic of EventManager from 5 minutes of inactivity to
every 2 minutes, regardless of user interaction. However if the user
does not interact, then consecutive saves will not be made.
2024-12-20 12:24:28 +01:00
Giacomo Vercesi 878356bd57 revng ptml: drop c.comparison PTML token
The `c.comparison` token was dropped by commit
0812989cb0, drop it also in the color
conversion table of `revng ptml`.
2024-12-20 12:24:28 +01:00
Alessandro Di Federico 620d142d53 Reroganize and expand documentation 2024-12-11 16:15:37 +01:00
Alessandro Di Federico 0c7c20ad48 Introduce model, artifacts and analyses references 2024-12-11 16:15:27 +01:00
Alessandro Di Federico 5b7703aff3 Minor changes 2024-12-11 16:15:09 +01:00
Giacomo Vercesi 70217f00c9 revng opt: drop unwrapping of zstd modules
Drop support of uncompressing zstd-compressed modules in `revng opt` as
this functionality has been moved within `llvm`.

(This is a revert of commit dd8d158e47)
2024-11-26 11:30:19 +01:00
Giacomo Vercesi 046be11be2 revng graphql: gracefully terminate daemon
When stopping an internal daemon, first try to use SIGINT and then
resort to SIGKILL. This is to avoid the signal handler exiting with a
non-zero return code during shutdown.
2024-11-25 17:52:27 +01:00
Giacomo Vercesi 9ee719f2c2 ptml/common: fix missing kwargs
Add the missing `kwargs` to the invocation of the wrapped `func` in
`suppress_brokenpipe`.
2024-11-22 16:05:16 +01:00
Giacomo Vercesi 38cd15d755 fetch_debuginfo: fix race condition
Fix a possible race condition that could arise if multiple instances of
`fetch-debuginfo` are run in parallel. This avoids the same file being
written by multiple processes and being moved early. This avoids a
`FileNotFoundError` and possibly data corruption due to the concurrent
situation.
2024-11-13 09:28:12 +01:00
Alessandro Di Federico efcea8ae48 importBinary: fix error handling 2024-11-12 18:05:48 +01:00
Alessandro Di Federico ba186a130c s/module.ll/module.bc.zstd/g 2024-11-12 14:58:00 +01:00
Giacomo Vercesi f0a5a48c8e mass-testing: generate crash graphs for OOMs
Add graph/crash statistics generation for the OOM category as well.
2024-10-31 08:58:59 +01:00
Giacomo Vercesi 023b470473 mass-testing: implement cmd/env overrides
Implement override mechanisms via command-line and/or env for the
following aspects:
* The maximum memory set by `test-harness`
* The timeout handled by `test-harness`
* The number of concurrent jobs to spawn while running `revng mass-testing run`
2024-10-31 08:58:59 +01:00
Giacomo Vercesi 208e18cedb revng.internal.cli: unify temporary_file
Unify the logic responsible for the `temporary_file` function, since its
body was duplicated three times over the codebase.
2024-10-31 08:58:59 +01:00
Giacomo Vercesi e651eaa072 revng ptml: update color token mapping
Update the dict that takes care of mapping PTML tokens to their color
with the updated list of PTML tokens.
2024-10-31 08:58:59 +01:00
Giacomo Vercesi dd8d158e47 revng opt: make compatible with zstd
Change the `revng opt` wrapper so that when a zstd-compressed module is
passed it is decompressed on the fly and passed to llvm's opt.
2024-10-30 21:57:56 +01:00
Giacomo Vercesi 3fe3a8524a Implement mass testing
Add the `revng mass-testing` commands and auxiliary executables which
simplify running revng on a huge quantity of input executables.
2024-10-01 13:38:21 +02:00
Giacomo Vercesi 9a29c7117b commands_registry.py: allow subcommands in subdirs
Allow external subcommands to live in subdirectories w.r.t. the main
directory.
2024-10-01 13:38:14 +02:00
Giacomo Vercesi 993f66d59c revng cli: drop revng- prefix from libexec
Drop using the `revng-` prefix from all executables under
`libexec/revng/`. Now any executable found under there that is
executable and without extension will be considered a `revng`
subcommand, following the usual command-line rules.
2024-10-01 13:38:14 +02:00
Giacomo Vercesi e1757b505d support.py: fix _run_common
The `_run_common` function assumed that the `command` argument was
mutable. Change the logic so that it works with immutable collections
(e.g. `tuple`) as well.
2024-10-01 13:38:13 +02:00
Giacomo Vercesi 583988c922 try_run: do not close fds
When running a subprocess via `try_run` & friends, do not close the
inherited file descriptors.
2024-10-01 13:38:13 +02:00