72 Commits

Author SHA1 Message Date
Alessandro Di Federico cc28786000 DwarfToModelConverter: match existing functions
Unfortunately, in DWARF, there's no widespread indicator on whether a
function is regular ARM or Thumb. Therefore, in this commit, instead of
blindly creating a new function, we first check if, in the model, we
already have a function at that address.

This means that, if we have a Thumb function in DWARF, but it doesn't
already exist in the model, we will import as regular ARM, which is
wrong.
Specifically, this can happen with `revng model import debug-info`.
2026-05-15 11:27:34 +02:00
Alessandro Di Federico 6894862ef2 Implement platform roots support
Refactor the binary import and dependency resolution infrastructure to
support multiple platforms (Linux, Windows, macOS) via a
configuration-driven root system.

Major changes:

* Overhaul PDB and DWARF importers for platform-aware debug info
  loading.
* Refactor LDDTree into a template-based architecture with
  platform-specific implementations (ELF, PE/COFF).
* Mostly rewrite the PDB importer, which had significant limitations.
2026-04-24 17:54:09 +02:00
Giacomo Vercesi 265af3768f Binary importers: fix debug info detection
Fix the behavior of binary importers by propagating the path of the
input binary from revng2 downwards, allowing finding `.debug` files in
the correct paths.
2025-12-19 10:28:29 +01:00
Alessandro Di Federico 5820908675 Remove and ban \file 2025-12-16 17:41:55 +01:00
Giacomo Vercesi 47038d46ec Add ParseBinaryAnalysis to pypeline 2025-12-10 15:05:53 +01:00
Alessandro Di Federico c883bed765 Drop Logger's StaticEnabled feature 2025-10-31 17:25:03 +01:00
Ivan Krysak 256d2310b0 DwarfImporter: drop an unnecessary check 2025-10-13 10:26:41 +03:00
Ivan Krysak df681aa573 Ensure consumed errors are printed somewhere 2025-10-13 10:26:41 +03:00
Ivan Krysak 9bf93d3a30 Importers: add TODOs on diagnostic candidates 2025-10-13 10:26:41 +03:00
Ivan Krysak 77ea07c364 Minor improvements 2025-10-08 12:22:30 +03:00
Ivan Krysak c8de226f56 DwarfImporter: remove an input-dependent assert
Not checking for primitives there doesn't change anything anyway, as
`purge-invalid-types` model pass will clean anything invalid still
left after the importer.
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 6cdf6b9eda DebugInfo: do --verbose if logger is enabled
Enable running `fetch-debuginfo` in verbose mode if the logger is
enabled.
2025-03-13 18:03:50 +01:00
Alessandro Di Federico d4cd9beb77 Minor changes 2025-03-05 09:57:51 +01:00
Ivan Krysak 705e4a5955 auto [...] -> auto &&[...] 2025-02-13 13:10:51 +02:00
Alessandro Di Federico b523889742 DwarfImporter: try .debug before giving up
Also, improve logging.
2025-01-28 15:20:45 +01:00
Alessandro Di Federico 832840c307 Importers: ignore unmapped code
This commit ensures that parts of the model that must point to code
(specifically `Binary::EntryPoint`, `Binary::ExtraCodeAddresses` and
`Function::Entry`) actually point to a segment mapped as +x.
2024-11-28 15:22:10 +01:00
Alessandro Di Federico a0c670652c Improve usages of Expected<T> 2024-10-10 14:50:26 +02:00
Ivan Krysak 99e016f120 ABI: reorganize default ABI helpers 2024-10-08 13:53:52 +02:00
Giacomo Vercesi f8ffe38687 Unify cache directory logic
Make the cache directory logic uniform in Python and C++, move the
respective implementations under support since it's project-wide logic
and not exclusive to debug-info.
2024-10-01 13:38:13 +02:00
Alessandro Di Federico c8d4381297 s/Context &Ctx/Context &Context/g 2024-09-27 12:07:17 +02:00
Alessandro Di Federico cba1d6fa51 PDBImporter: fix .pdb path lookup 2024-08-16 13:01:57 +02:00
Alessandro Di Federico 7b00473859 PDBImporter: rework .pdb search 2024-08-05 17:41:34 +02:00
Ivan Krysak 4a2db0ba4f UpcastablePointer: streamline empty behavior 2024-06-27 11:05:52 +02:00
Ivan Krysak dfa7478685 Adopt reworked model::Type 2024-06-27 11:05:51 +02:00
Ivan Krysak b6625e8913 Model: simplify fixModel pass
Instead of getting reimplemented/updated, it now just reuses normal
type verification routines.
2024-06-27 11:05:50 +02:00
Ivan Krysak 927e8006b9 Model: rename TypePath to DefinitionReference 2024-06-27 11:05:49 +02:00
Ivan Krysak ac587cbb4f Model: rename Type into TypeDefinition 2024-06-27 11:05:48 +02:00
Ivan Krysak b2959e36df Minor improvements 2024-06-27 11:05:48 +02:00
Massimo Fioravanti f783868dde Model: adopt tryGet instead of find() != end() 2024-06-20 09:57:36 +02:00
Alessandro Di Federico 9d12cd35e3 DwarfImporter: improve logging 2024-04-19 18:33:00 +02:00
Alessandro Di Federico 58d965f977 DwarfImporter::getName: consider abstract_origin 2024-04-19 18:33:00 +02:00
Alessandro Di Federico fcd04c163b DwarfImporter: hack to handle transparent unions 2024-04-19 18:33:00 +02:00
Alessandro Di Federico 9bbf1cc144 DwarfImporter: renumber UnionFields after cleanup 2024-04-11 15:29:39 +02:00
Alessandro Di Federico 7f1a15d1bb Model: ignore empty ExportedNames 2024-03-01 14:53:07 +01:00
Alessandro Di Federico 3cfd01e617 DwarfImporter: correctly handle Expected 2024-03-01 14:53:06 +01:00
Alessandro Di Federico 0da9d1e1a4 Model: fix handling of 0-sized arguments
We used to support having a single `void` argument. It was for some
C-compatibility ambitions, but just omitting the argument is perfectly
fine.

Also, the DWARF importer has been fixed to handle typedef'd void as
arguments.

More in general, arguments are now required to always have a size.
2024-03-01 14:53:06 +01:00
Alessandro Di Federico d9e649d272 Importer/Binary: improve logging 2024-03-01 14:53:06 +01:00
Alessandro Di Federico aa882f1bef Importer/Binary: fix default XDG cache path 2024-03-01 14:53:06 +01:00
Alessandro Di Federico 340b02c71e DwarfImporter: improve progress reporting 2024-03-01 14:23:08 +01:00
Ivan Krysak 77b1acaf00 Prefer uint64_t to size_t wherever relevant 2024-01-29 11:57:54 +02:00
Ivan Krysak cfe28d8e56 Stop using std:: prefix for u?int\d+_t types 2023-11-02 17:10:03 +01:00
Alessandro Di Federico 79c5f59449 DwarfImporter: handle invalid function addresses 2023-10-06 17:16:04 +02:00
Alessandro Di Federico b67e2ac13a Minor changes 2023-10-04 17:47:50 +02:00
Alessandro Di Federico 247879f7fc model::Type::ID: switch to progressive IDs
This commit switches `model::Type::ID` from being a GUID to be a
progressive number, in order to make things easier for humans.

On top of this, this commit introduces the following changes:

* TypeCopier: import all the necessary PrimitiveTypes and improve
  handling of CustomName.
* Move Kind as the last field of the key of each TupleTree type used in
  an `UpcastablePointer`.
* Update the ground truth of tests to ignore the `CustomName` in favor
  of focusing on `OriginalName`.
* Increase adoption of `model::Binary::makeType`, equivalent to
  `Binary.recordNewType(makeType<model::*Type>())`.
2023-08-23 16:14:04 +02:00
Alessandro Di Federico 14525d91f5 Adopt llvm::Task 2023-08-01 10:51:16 +02:00
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00