Commit Graph

66 Commits

Author SHA1 Message Date
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 a9a0fdc236 ELFImport: fix input file missing
When using revng through `revng daemon` the variable `InputPath` is not
populated, leading to `lddtree` failing silently. Fall back to the input
binary in the resume directory in case the the `InputPath` variable is
empty.
2025-03-14 13:05:39 +01:00
Alessandro Di Federico cac8b5d1b1 ELFImporter: search libs in the input directory 2025-03-05 09:57:51 +01:00
Ivan Krysak 705e4a5955 auto [...] -> auto &&[...] 2025-02-13 13:10:51 +02: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 278c6f625c Importers: first of all, Segments
This commit makes sure that before setting EntryPoint, adding
ExtraCodeAddresses or Function entry points, we completed the processing
of Segments.
2024-11-28 14:04:36 +01:00
Alessandro Di Federico d1252046ce Importers: do not set EntryPoint, if absent 2024-11-28 13:58:29 +01:00
Ivan Krysak 1eb80ecd2d Introduce an error creation helper 2024-11-06 15:20:37 +02: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
Alessandro Di Federico 2cdedc71f4 s/serialize/toString/
We keep serialize for method dealing with streams.
If it returns a `std::string`, let's use `toString`.
2024-09-27 12:07:17 +02:00
Alessandro Di Federico bd08864e49 DwarfReader::readValue: handle DW_EH_PE_omit 2024-09-26 17:44:51 +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 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 47c3dd8f0f Drop model::Segment::Sections 2024-05-22 10:25:25 +02:00
Alessandro Di Federico 7f1a15d1bb Model: ignore empty ExportedNames 2024-03-01 14:53:07 +01:00
Alessandro Di Federico d9e649d272 Importer/Binary: improve logging 2024-03-01 14:53:06 +01:00
Ivan Krysak 77b1acaf00 Prefer uint64_t to size_t wherever relevant 2024-01-29 11:57:54 +02:00
Pietro Fezzardi 48b27af795 Make Segment::Type a TupleTreeReference
This is homogeneous with all other nullable reference to types in the
model, like the StackFrameType in model::Function, and others.
2023-12-05 16:19:38 +01:00
Alessandro Di Federico 79c5f59449 DwarfImporter: handle invalid function addresses 2023-10-06 17:16:04 +02:00
Alessandro Di Federico 2cbf3a8313 TypeCopier: minor rework 2023-10-05 10:19:44 +02:00
Alessandro Di Federico b67e2ac13a Minor changes 2023-10-04 17:47:50 +02:00
Alessandro Di Federico f51af94e8f TupleTreeReference::isValid is for assertions only 2023-08-23 16:14:05 +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
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00
Ivan Krysak d99b0241e8 Minor improvements 2023-05-17 14:08:04 +02:00
Alessandro Di Federico b3eaae6f83 ELFImporter: fix handling of DT_{INIT,FINI} 2023-05-17 11:17:39 +02:00
Alessandro Di Federico abc380017b {ELF,Dwarf}Importer: fix ExportedNames
Under certain conditions, upon import, functions where not being added
`ExportedNames`, which was preventing them from finding the prototypes
from dynamic libraries' debug information.
2023-05-10 09:21:43 +02:00
Alessandro Di Federico f562d0373f Importers: fix usage of BaseAddress
This commit ensure the BaseAddress is propagate as appropriate to all
levels of the importers and that it is ignored for executables
(non-PIC).

This was a recurring source of importing the same function twice, once
relocated, once not.
2023-05-10 09:20:40 +02:00
Alessandro Di Federico 73fb1a31c9 Outline TypeCopier
This commit also drop the suggestion that it should be used for copying
prototypes only.
2023-05-10 09:20:15 +02:00
Alessandro Di Federico dbcdad0a4d Switch from llvm::Optional to std::optional 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 31b46de38c Remove dead code and fix spurious warnings
Remove some dead code or introduce suppressions for spurious.
These are results of more accurate warnings in clang 16.
2023-04-08 08:42:23 +02:00
Alessandro Di Federico b866e9010e ELFImporter: fix setting gp_mips canonical value
We used to set the canonical value of the MIPS gp register even in
absence of PLT, leading to a crash (specifically on archlinux librt.so).
2023-03-22 14:22:24 +01:00
Ivan Krysak 64856306c4 BinaryImporter: rework command line interface 2023-03-15 10:19:03 +01:00
Ivan Krysak 34b532c754 BinaryImporter: always promote original name 2023-03-15 10:19:03 +01:00
Ivan Krysak 0b1aaeaede Minor improvements 2023-03-15 10:19:01 +01:00
Alessandro Di Federico 8886792ebb Logger: ensure we consume llvm::Error 2023-02-23 14:51:03 +01:00
Djordje Todorovic 24a5705e12 Importer: Attach attributes when copying types 2023-02-16 11:07:52 +01:00
Antonio Frighetto ab36efca8d Model: import data objects in Segment.Type 2023-02-06 12:08:18 +01:00
Djordje Todorovic fec0ec7034 Model: add ExportedNames for local Functions 2023-01-27 17:54:06 +01:00
Djordje Todorovic 83905cf5ed Fix the level for FetchDebugInfo 2023-01-27 17:53:47 +01:00