Commit Graph

362 Commits

Author SHA1 Message Date
Alessandro Di Federico fe1dffcffd Add some missing includes
This is in preparation of reducing headers in Debug.h.
2024-05-03 21:52:40 +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 2267b51090 Mark findPrototype as inline 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
Ivan Krysak 2bffccaaf6 Move ImmediateStyle configuration to the model 2024-03-18 11:58:11 +01:00
Ivan Krysak 184aa03847 Move AddressStyle configuration to the model 2024-03-18 11:58:11 +01:00
Ivan Krysak 371784afbd Model: introduce basic disassembly configuration 2024-03-18 07:20:41 +00:00
Alessandro Di Federico ffe93548c5 Model ::size(): do not suspend tracking 2024-03-01 14:53:07 +01:00
Alessandro Di Federico 7f1a15d1bb Model: ignore empty ExportedNames 2024-03-01 14:53:07 +01:00
Alessandro Di Federico db4e5c4a5e Introduce dumpModel 2024-03-01 14:53:07 +01:00
Alessandro Di Federico c346e60ee7 PromoteOriginalName: no globals with local names
This commit ensures we do not introduce new global symbols that would
make local symbols invalid.
2024-03-01 14:53:06 +01:00
Alessandro Di Federico 6f4923265e Type verify: improve error reporting 2024-03-01 14:53:06 +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 6b4f44af2d Minor changes 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 e708a3655b ABI: drop incomplete clrcall support 2024-02-09 15:09:37 +00:00
Ivan Krysak 2e78369ec9 Model: disable float register size mismatch check 2024-02-09 15:09:37 +00:00
Ivan Krysak af6f9367b2 ImportPE: remove i386-specific values 2024-02-09 15:09:37 +00:00
Djordje Todorovic 79460c6933 PDBImport: Handle forward referenced types
A class or a struct type A can be a forward declaration and refer
to another type B in PDB, so we need to follow the references.
We pre-create type for B, when we face type A, and then, when we
visit type B, we populate the fields for the model::type we
pre-created.

In addition, this patch fixes some minor/side bugs:
  - Handle SHORT/Int16Short simple type
  - Do not delete model::Function if Prototype is invalid.
2024-02-09 15:09:37 +00:00
Alessandro Di Federico d9367954a4 Convert all public strings to kebab-case 2024-02-09 10:04:24 +01:00
Alessandro Di Federico c73e88a8d8 Model: handle missing function prototype 2024-02-09 10:04:20 +01:00
Alessandro Di Federico b34031f828 Import sections into segment's struct
Each model::Segment is associated to a model::StructType. Now we also
create sub-`structs` for sections, if available.
2024-02-08 16:57:40 +01:00
Ivan Krysak 77b1acaf00 Prefer uint64_t to size_t wherever relevant 2024-01-29 11:57:54 +02:00
Massimo Fioravanti f6ff8e544d Add tracking debug infrastructure
Add a mechanism to make the program crash when a given element of the
model is read or written.
2024-01-02 11:14:56 +01:00
Massimo Fioravanti c276a439b5 Add pipeline invalidation
Replace the stub implementation of invalidation with the proper
implementation. A ReadPathCache is added to each global so that it can
keep tracks of what target are associated to which read paths.
2024-01-02 11:14:56 +01:00
Giacomo Vercesi 8504a96020 RawFunctionType: use NamedTypedRegister for return
Use the `NamedTypedRegister` type for return values in
`RawFunctionType`. This allows return values to be renamed at the user's
discretion.
2023-12-11 12:03:45 +01:00
Giacomo Vercesi 37ef77933c NamedTypedRegister: change name to use 'register'
Change the prefix used by `NamedTypedRegister` when `CustomName` is not
present from `_argument_` to `_register_`.
2023-12-11 10:21:02 +01:00
Alessandro Di Federico 10dcb7be11 Fix semantics of model::Types purging passes
One of the two passes to purge unused types from the model had a
ill-defined semantics.

This commit simplifies them in two passes: one that purges all the types
unreachable from outside `Binary::Types` and one that does the same but
also preserves types with a `CustomName` or an `OriginalName`.
2023-12-05 16:19:39 +01:00
Pietro Fezzardi bbcb4df839 TypeSystemPrinter: print segment types 2023-12-05 16:19:39 +01:00
Pietro Fezzardi 1285c6e7af Make RawFunctionType::StackArgumentsType a TTR
This is homogeneous with all other nullable references to types in the
model, such as the StackFrameType in model::Function, and others.
2023-12-05 16:19:38 +01: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
Pietro Fezzardi ef8a9699f1 Improve model::Function::verify 2023-12-05 16:19:38 +01:00
Ivan Krysak cfe28d8e56 Stop using std:: prefix for u?int\d+_t types 2023-11-02 17:10:03 +01:00
Pietro Fezzardi 43d6a2c5c5 TypeSystemPrinter: allow prototype-less functions
Before this commit, the TypeSystemPrinter implicitly assumed that
model::Function and model::DynamicFunction always had a prototype.

However, this is not guaranteed by the model schema.

This commit extends the TypeSystemPrinter so that it doesn't make that
wrong assumption anymore, and can successfully print any model::Function
and model::DynamicFunction, even when a prototype is not present.
2023-10-31 17:42:13 +01:00
Alessandro Di Federico 79c5f59449 DwarfImporter: handle invalid function addresses 2023-10-06 17:16:04 +02:00
Alessandro Di Federico a11435becf BinaryImporter: error on unsupported formats 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 bf66ecc389 {,Dynamic}Function::Prototype: support typedefs 2023-10-05 10:19:44 +02:00
Alessandro Di Federico b67e2ac13a Minor changes 2023-10-04 17:47:50 +02:00
Giacomo Vercesi d2967d2a49 Tuple Tree Generator: remove Model headers
This commit removes the inclusion of the `Binary.h` header in
Tuple-Tree Generator files, allowing Model-independent Tuple Trees to be
generated.
2023-09-14 15:44:32 +02:00
Alessandro Di Federico b5aa75f1f1 Introduce model::PrimitiveType::fromName 2023-08-23 16:14:05 +02:00
Alessandro Di Federico f51af94e8f TupleTreeReference::isValid is for assertions only 2023-08-23 16:14:05 +02:00
Alessandro Di Federico a5b380b201 Model: rework how we name things
This commit improves the formalization of how we handle names.

The main changes are:

* Now `_` is a reserved prefix and all the generated names start with
  `_`.
* The model verification routine now checks that `CustomName`s in the
  global scope do not collide with any local namespace (e.g., fields of
  a `StructType`).
* We changed the prefix `prefix_` to `unreserved_` to better convey the
  fact that the prefix has been introduce to use an non-reserved name.
2023-08-23 16:14:04 +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 56268e94b0 VerifyHelper: handle fail in type verification
Before this commit, if there was a failure during the verification of a
type (which is recursive), we'd get an assertion in ~VerifyHelper due to
a "pending" type still being verified.
2023-08-23 16:14:04 +02:00