Commit Graph

231 Commits

Author SHA1 Message Date
Alastair Robertson
6dce2d1c33 Printer: Improvements for displaying large type graphs
- Don't truncate output above 30k characters
- Include enough padding at the begining of lines to account for large
  node IDs
2023-06-23 15:55:42 +01:00
Alastair Robertson
2edd781f9d TypeGraph: Split CodeGen into separate functions for testing 2023-06-23 14:23:53 +01:00
Alastair Robertson
a1537ab6aa Unit Tests: Create MockSymbolService 2023-06-23 14:23:53 +01:00
Jake Hillion
40c7a9afb7 features: clean up old flags 2023-06-23 11:25:43 +01:00
Jake Hillion
b0aa7a8c93 TypedDataSegment: implementation 2023-06-19 19:06:04 +01:00
Alastair Robertson
226e0cfa84 Add copyright header to all source files 2023-06-15 10:30:29 -07:00
Jake Hillion
6f2ce7871c set function oi_name to null rather than garbage 2023-06-14 17:25:18 +02:00
Jon Haslam
cac9b99974
ensure oi_name is never a nullptr (#165) 2023-06-12 16:47:34 -07:00
Jake Hillion
4c331fb5a2 clean up common.h 2023-06-09 13:15:17 +02:00
Alastair Robertson
62575a7c3e TypeGraph: Respect [[codegen.ignore]] config value 2023-06-05 13:38:54 +01:00
Alastair Robertson
2d28b20d46 TypeGraph: Fix multi dimensional arrays
Multi dimensional arrays are not flattened into 1-D arrays when using
TypeGraph. Update TreeBuilder to account for this.

By not flattening arrays, we are able to produce more descriptive
results.

The disadvantage is that we must now recurse inside arrays
containing only primitives. A better solution to requiring flattening
would be the planned work to not recurse into any static types (not just
primitives). This would also apply to multi-dimensional arrays of
primtivies.
2023-05-31 16:53:38 +01:00
Alastair Robertson
784b900218 TypeGraph: Replace allocators with DummyAllocator
When we were previously removing allocators, we were only able to work
with containers whose allocators appeared as their last template
parameter.

Now we can replace allocators in the middle of a parameter list.

This fixes tests for folly::sorted_vector_set.
2023-05-31 15:49:37 +01:00
Alastair Robertson
3a7a647a73 TypeGraph: Apply qualifiers to template params
This is necessary when replacing the allocator of a map type, for
example.

`std::map<int, int>` will need an allocator which allocates elements of
type `std::pair<const int, int>>`
2023-05-31 15:49:37 +01:00
Alastair Robertson
1723611411 Turn FeatureSet into a generic EnumBitset 2023-05-31 14:05:51 +01:00
Alastair Robertson
cfc3cc0221 TypeGraph: Handle alias templates
This fixes the test failure for std::conditional_t
2023-05-30 17:59:42 +01:00
Alastair Robertson
3d91603c8e TypeGraph: Fix std::string container
std::basic_string takes three template parameters:
1. CharT
2. Traits
3. Allocator

The Traits parameter was causing issues, as it requires a type which
exposes certain things, e.g. `Traits::value_type`.

We have a few options to resolve this:
1. Remove this parameter, as we do for allocators
    Cons: removing a template parameter doesn't work if other
    parameters appear after it

2. Stub this parameter, as we do for hashers/comparators
    Cons: we need to hardcode an implementation that satisfies the
    `Traits::value_type` requirements

3. Leave the parameter as-is
    Cons: will not work if a non-standard Traits is used

    By using the real implementation of this Traits parameter
    (normally `std::char_traits<CharT>`), we get one that we know will
    work as long as it is defined in a stdlib header.

Option 3 is what we use in this patch. Instead of adding more
configuration options to the container TOML file format (e.g.
`params_to_keep = [1]`), we add `std::char_traits` as a dummy
container type. Now, whenever `std::char_traits` appears, it will be
left as-is, i.e. not removed, replaced or reverse-engineered.

This is the same approach previously used for Thrift's isset_bitset.
2023-05-30 17:17:29 +01:00
Alastair Robertson
27c6ee10c3 OID: Use new TypeGraph CodeGen when requested
This adds a new feature flag, "type-graph", which controls whether to
use legacy OICodeGen or the new TypeGraph-based CodeGen.
2023-05-30 16:40:47 +01:00
Alastair Robertson
e01b3fd327 TypeGraph: Add new CodeGen
This code mostly works, but is obviously not complete. This commit just
adds the code and tests, but does not enable it in OID or OIL.
2023-05-30 16:40:47 +01:00
Jake Hillion
008e519cd7 tomlplusplus: compile header once 2023-05-30 16:43:10 +02:00
Alastair Robertson
bd919ae4e4 TypeGraph: Add core code
This code mostly works, but is obviously not complete. This commit just
adds the code and tests, but does not enable it in OID or OIL.
2023-05-30 13:27:23 +01:00
Alastair Robertson
a73cab758f ContainerInfo: Move matcher regex construction to class ctor and add unit tests 2023-05-26 18:21:59 +01:00
Alastair Robertson
a943f44b7a TypeGraph: Update ContainerInfo to parse new format 2023-05-26 18:21:59 +01:00
Alastair Robertson
79d40fe938 DrgnUtils: Add isSizeComplete and underlyingType helper functions
These functions are intended to be shared between OICodeGen and
TypeGraph CodeGen.
2023-05-24 15:57:18 +01:00
Alastair Robertson
75d4216016 OID: Set glog VLOG level globally for all modules
It was previously easy to miss modules and I haven't been able to notice
any difference in behaviour when setting the VLOG level globally
(despite what the old comment says).
2023-05-24 15:43:09 +01:00
Alastair Robertson
cdb70e8008 Fix warnings in core code 2023-05-23 10:36:42 +01:00
Jake Hillion
a9ace14466 features: switch to bitset 2023-05-19 15:59:18 +02:00
Jake Hillion
b32f723844 resources: manage headers properly
Previously we had an `R"(` string in `OITraceCode.cpp` which allowed us
to include the file as a string. Instead, keep `OITraceCode.cpp` a fully
formed C++ file and utilise the build system to turn it into a string.
This will be used for more header files that are needed both as valid
headers and as strings for JIT compilation in the Typed TreeBuilder
work.
2023-05-18 16:04:13 +02:00
Jake Hillion
9731a30f85 drgn: rebase on main 2023-05-10 15:32:58 +02:00
Jake Hillion
96c80cbb78 drgn: refactor, cull dead code, and disable inline 2023-05-04 12:55:16 +02:00
Jake Hillion
f70d34961d drgn: switch to Program.function_by_address() 2023-05-03 20:08:41 +02:00
Jon Haslam
d4891e98d4
move src directory to oi (#134) 2023-04-26 16:20:53 +01:00