Commit Graph

410 Commits

Author SHA1 Message Date
Alastair Robertson
e86ebb7aff TypeGraph: Support bitfields
- Change member and parent offsets to work in bits, not bytes
- Printer still displays offsets in bytes, with decimals when using
  bitfields
- AddPadding: Don't pad bitfields
- CodeGen: Emit code for bitfields
2023-07-05 13:23:23 +01:00
Alastair Robertson
c9bcf5e760 TopoSorter: Fix sorting of container template parameters
For std::vector and std::list, template parameters are not required to
be defined before they can be used. Delay sorting them until the end.

Also fix a CodeGen bug where we were defining typedefs in the middle of
the forward declarations. They only need to be defined when other types
are defined.
2023-07-05 13:10:28 +01:00
Alastair Robertson
5560624c0b Unit tests: Move last remaining tests onto using the type_graph_utils helpers 2023-07-04 17:18:43 +01:00
Alastair Robertson
00b46377a1 Unit tests: Remove unnecessary make_unique calls
This was a purely mechanical change made with some find-and-replace
macros.
2023-07-04 17:18:43 +01:00
Alastair Robertson
31050735d6 CodeGen: Add support for capturing Thrift isset data 2023-07-04 15:36:27 +01:00
Jake Hillion
01c9573acb add jit timing feature 2023-07-03 18:02:09 +01:00
Jake Hillion
63ac468a1f TypedDataSegment: clean up type of fixed suffix 2023-07-03 18:02:09 +01:00
Jake Hillion
3da628b852 help: improve feature descriptions 2023-07-03 16:57:43 +01:00
Jake Hillion
db243d9845 codegen: store prev defined containers as a class field 2023-07-03 16:04:08 +01:00
Jake Hillion
6aead62652 static types: place in own header for testing 2023-06-30 12:54:02 +01:00
Jake Hillion
8e48c6ca52 ci: enable testing for typed data segment 2023-06-29 17:31:29 +01:00
Jake Hillion
046e5f57bb add dummy handler to dummy containers 2023-06-29 17:31:29 +01:00
Jake Hillion
5c3bb261c8 integration: add GLOB with CONFIGURE_DEPENDS to pick up files 2023-06-29 15:47:06 +01:00
Alastair Robertson
b50ab57e33 AddPadding: Move common code into a function 2023-06-29 14:10:05 +01:00
Alastair Robertson
cf583700fa Add missing namespace to folly::IOBuf container TOML
Required for CodeGen v2, which does not add "using namespace xxx" and
uses fully qualified names instead.
2023-06-29 11:59:07 +01:00
Alastair Robertson
24d707cf56 Flattener: Flatten class template parameters 2023-06-29 11:58:39 +01:00
Jake Hillion
ceafce8e1a ci: retry tests once on failure 2023-06-28 16:37:11 +01:00
Alastair Robertson
26fd44c26c CI: Fix code coverage collection
Multiple jobs are not allowed to persist the same files to a workspace.

This commit takes the lazy approach of splitting the type-graph and
non-type-graph jobs into different workspaces and creating a second
coverage job to avoid the conflict.
2023-06-28 16:11:50 +01:00
Alastair Robertson
04715e2015 TypeGraph: Create dummy containers
These represent types which don't store any interesting data for us to
measure, but which are required by a real container so can not be
replaced with our own generated class types.

std::allocator often has bad DWARF, so it must be replaced after the
DWARF is fixed up in Flattener. The others could be replaced earlier in
the transformation process if desired, but I've left them all together
for simplicity for now.

This fixes the folly::fbstring tests.
2023-06-28 16:11:50 +01:00
Alastair Robertson
4dc9007166 Integration tests: Set up CI testing for TypeGraph
CTest can't forward command line arguments to the test runner, so add
the option to using an environment variable to enable features instead.

CMake issue tracking the feature that would have been needed:
  https://gitlab.kitware.com/cmake/cmake/-/issues/20470

Tests which aren't passing yet have been disabled in CI.
2023-06-27 16:40:54 +01:00
Alastair Robertson
1bb0c62987 Flattener: Attempt to take params from parent allocator in case of bad DWARF 2023-06-27 14:06:02 +01:00
Jon Haslam
5204753497
remove unused old code from trace code (#186) 2023-06-27 11:31:05 +01:00
Jon Haslam
7bb23386f1
feature flag jit-logging (#183) 2023-06-26 18:44:18 +01:00
Alastair Robertson
f5b5885666 TypeGraph: Make original fully qualified names available for Class types
The worry about doing this earlier was performance, but on a further
reading of the code, both legacy OICodeGen and new DrgnParser have been
calling into drgn_type_fully_qualified_name() for every class for a long
time already.
2023-06-26 16:11:24 +01:00
Alastair Robertson
4bfa932b9b DrgnParser: Handle enum values in template params
We want to use the fully qualified name for scoped enums to keep the C++
compiler happy. When a parameter expects an enum value, we must supply
an enum value and not its underlying integer value.

Before:
  isset_bitset<1, 0>

After:
  isset_bitset<1, apache::thrift::detail::IssetBitsetOption::Unpacked>
2023-06-26 15:13:21 +01:00
Jake Hillion
f130f3c470 features: add GenJitDebug 2023-06-26 14:39:38 +01:00
Alastair Robertson
b0ef913b19 NameGen: Handle containers with zero template params
Previously we always deleted the last two characters and appended a `>`.

Old:
  MyContaine>

New:
  MyContainer
2023-06-26 11:27:38 +01:00
Alastair Robertson
4c96b65038 Flattener: Handle classes which inherit from containers
Turn the parent container into a member so that we process it along
with any extra members that this derived class has.
2023-06-23 19:51:19 +01:00
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
5b6a9434b7 Tests: Use shared functions from type_graph_utils 2023-06-23 15:55:42 +01:00
Alastair Robertson
02b764157d Tests: Add a CodeGen test 2023-06-23 14:23:53 +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
Alastair Robertson
3120e8173c Code Coverage: Reduce irrelevant partial branch matches
The C++ compiler generates implicit branches for exception handling,
which is particularly common when calling standard library functions.

It's not generally useful to have tests for the case when
std::vector::push_back fails due to an out-of-memory condition, so in
this PR we use a feature in the latest lcov release to filter out these
compiler-generated branches.

Our code coverage numbers consequently go way up!
2023-06-23 13:03:36 +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
Jake Hillion
edaf499ced TypedDataSegment: add handlers for all tested types 2023-06-19 19:06:04 +01:00
Jake Hillion
77667e5741 tests: add polymorphic class tests with no extra features 2023-06-19 19:06:04 +01:00
Thierry Treyer
3b752fde13 Formatting 2023-06-19 19:13:16 +02:00
Thierry Treyer
32152bf5cf Introduce OIRP to dump RocksDB 2023-06-19 19:13:16 +02:00
Thierry Treyer
6e691daefc OITB support for -f/-F feature flags 2023-06-19 19:13:16 +02:00
Thierry Treyer
4e730fbc95 OIP prints location expressions 2023-06-19 19:13:16 +02:00
Thierry Treyer
aea1e12004 OIP prints 'this'as an arg for methods 2023-06-19 19:13:16 +02:00
Thierry Treyer
f28bdfca48 Fix TypeHierarchy's type 2023-06-19 19:13:16 +02: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
ad28fb64b2
elfutils: leak cu_tree to avoid double free (#164) 2023-06-12 16:35:46 -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