Commit Graph

159 Commits

Author SHA1 Message Date
Jake Hillion
167df106cc drgn: add split dwarf support 2023-06-02 17:52:53 +02:00
Jake Hillion
a6d7f90f50 integration_py: fix expected sizes 2023-05-31 19:00:10 +02: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
e1bc5c7b5e Tests: Split common code out into type_graph_utils 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
a0418b6881 Update drgn
Allow reading function tags (names)
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
68290655b1 TypeGraph: Update container TOML files to new format
This change is fully backwards compatible with the old ContainerInfo
parser, as it is just adding new fields.

The old fields will continue to be used by legacy OICodeGen until that
is removed.

Also add a README to document the format.
2023-05-26 18:21:59 +01:00
Alastair Robertson
6019a37dde CodeCov: Collect coverage from all source files
The "src" directory got renamed to "oi" and the previous rule stopped
matching our source code. By changing to collect coverage for everything
except for "build" and "extern", we should avoid this problem in the
future.
2023-05-24 16:52:16 +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
8a19246c81 Integration tests: Add alignment tests 2023-05-24 15:42:26 +01:00
Alastair Robertson
cd836bad62 Integration tests: Assume dynamicSize of 0 in OIL tests if it is not set
This just makes it a little easier to write tests for purely static
types.
2023-05-24 15:42:26 +01:00
Alastair Robertson
5c691f27f7 Enable -Werror for Clang builds in CI
Don't enable for local dev builds or for GCC CI builds, as every
compiler version has a different set of warnings and trying to make them
all pass is a neverending task.
2023-05-23 10:36:42 +01:00
Alastair Robertson
280f663eb5 Only pass "-no-pie" to the linker
This fixes an "argument unused during compilation" warning from Clang
2023-05-23 10:36:42 +01:00
Alastair Robertson
5e23f9ca75 Add missing headers to oitb 2023-05-23 10:36:42 +01:00
Alastair Robertson
60e87735c8 Disable PCH 2023-05-23 10:36:42 +01:00
Alastair Robertson
cdb70e8008 Fix warnings in core code 2023-05-23 10:36:42 +01:00
Alastair Robertson
dbf6dbc71c Fix warnings in test code 2023-05-23 10:36:42 +01:00
Alastair Robertson
febef742d5 Disable warnings for generated Flex & Bison code 2023-05-23 10:36:42 +01:00
Alastair Robertson
956f828303 Disable warnings for external projects 2023-05-23 10:36:42 +01:00
Alastair Robertson
2b3f3966a9 Clean up CMakeLists.txt 2023-05-23 10:36:42 +01:00
Alastair Robertson
24e108a81b Enable compiler warnings globally
With the previous method of enabling them on a target-by-target basis,
it was very easy to accidentally miss a target. This had happened in a
number of instances, e.g. "codegen" and "symbol_service".
2023-05-23 10:36:42 +01:00
Alastair Robertson
d71a497df5 Fix compiler warnings in folly_shims.cpp 2023-05-23 10:36:42 +01:00
Jake Hillion
a9ace14466 features: switch to bitset 2023-05-19 15:59:18 +02:00
Alastair Robertson
66a171eedc Integration test README: Document "skip" and "oil_disable" 2023-05-18 15:04:22 +01: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
Alastair Robertson
939256030c Integration test: Add "target_function" option 2023-05-18 14:34:08 +01: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
Jake Hillion
fd35ce648d drgn: revendor elfutils at 0.189 2023-04-28 14:15:44 +02:00
Jon Haslam
d4891e98d4
move src directory to oi (#134) 2023-04-26 16:20:53 +01:00
Thierry Treyer
c0bfe87342 Faster locateSymbol by re-using dwfl across calls 2023-04-25 18:42:24 +02:00
Jake Hillion
4a64fc5c9c clang-format: set BinPackParameters=false 2023-04-24 11:28:22 +02:00
Jake Hillion
789fb7ef6e add feature addition to the integration test runner 2023-04-21 19:02:44 +02:00
Jake Hillion
641a128b39 add command line feature addition/removal 2023-04-21 19:02:44 +02:00
Alastair Robertson
5971643101 Pass in CodeCov.io token through CI env var
CodeCov's docs say that a token isn't required for a public repository,
but our uploads have been broken for a few weeks at this point and
passing in the token fixes them...
2023-04-21 14:42:15 +01:00
Alastair Robertson
9755688d1c Add folly shims to avoid linking against folly
This fixes linker errors in debug builds.

When building in debug mode (-DCMAKE_BUILD_TYPE=Debug), folly requires
the function "safe_assert_terminate" to be defined. To avoid building
and linking against folly, we define our own no-op version of this
function.
2023-04-21 12:56:54 +01:00
Jon Haslam
c1f672b262
fix offset in generated code (#129) 2023-04-21 11:07:37 +01:00
Jake Hillion
feaf0e86ed remove now redundant initial pointer saving 2023-04-18 16:04:47 +02:00