From aef8826a3accfece253a5bbd4afd214213eb2778 Mon Sep 17 00:00:00 2001 From: Alastair Robertson Date: Wed, 18 Jan 2023 09:36:01 -0800 Subject: [PATCH] Update drgn submodule Adds support for C++ member functions and virtuality. --- .gitmodules | 2 +- extern/drgn | 2 +- src/Serialize.cpp | 16 ++++++---------- src/Serialize.h | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9a6a486..20ec3f7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "extern/drgn"] path = extern/drgn - url = https://github.com/JakeHillion/drgn.git + url = https://github.com/ajor/drgn.git [submodule "extern/folly"] path = extern/folly url = https://github.com/jgkamat/folly.git diff --git a/extern/drgn b/extern/drgn index 4a5b627..e3425c1 160000 --- a/extern/drgn +++ b/extern/drgn @@ -1 +1 @@ -Subproject commit 4a5b6279798c5625f68382baaba5f565aa798830 +Subproject commit e3425c1ceb29d52cfc52e37de8763a6a4aa483eb diff --git a/src/Serialize.cpp b/src/Serialize.cpp index 77909d2..6402fc8 100644 --- a/src/Serialize.cpp +++ b/src/Serialize.cpp @@ -226,10 +226,6 @@ void serialize(Archive &ar, struct drgn_type &type, } while (0) verify_version(version); - // We want to ensure that if the definition of `struct drgn_type` is changed - // at any point in the future that our code stops compiling, instead of us - // silently ignoring any newly added fields. - static_assert(sizeof(type) == 120); // Ensure any unused fields are zeroed out for safety, as to avoid subtle // bugs resulting from mistakenly unserialized fields containing garbage. @@ -259,16 +255,12 @@ void serialize(Archive &ar, struct drgn_type &type, // `struct drgn_type`s in order to avoid serializing massive amounts of data. // In other words, our serialization of `struct drgn_type` is shallow. - // First union: `name`, `tag`, `num_parameters` + // First union: `name`, `tag` assert_in_same_union(name, tag); - assert_in_same_union(name, num_parameters); if (drgn_type_has_name(&type)) { serialize_c_string(ar, const_cast(&type._private.name)); } else if (drgn_type_has_tag(&type)) { serialize_c_string(ar, const_cast(&type._private.tag)); - } else if (drgn_type_has_parameters(&type)) { - // Leave `num_parameters` set to 0 per the initial `memset`, - // see "AVOIDING OVERSERIALIZATION" comment above } // Second union: `size`, `length`, `num_enumerators`, `is_variadic` @@ -285,7 +277,11 @@ void serialize(Archive &ar, struct drgn_type &type, ar &type._private.is_variadic; } - // Third union: `little_endian`, `members`, `enumerators`, `parameters` + // Third union: `is_signed`, `num_members`, `num_paramters` + // Leave set to 0 per the initial `memset`, see "AVOIDING OVERSERIALIZATION" + // comment above + + // Fourth union: `little_endian`, `members`, `enumerators`, `parameters` assert_in_same_union(little_endian, members); assert_in_same_union(little_endian, enumerators); assert_in_same_union(little_endian, parameters); diff --git a/src/Serialize.h b/src/Serialize.h index c7181ec..ddef335 100644 --- a/src/Serialize.h +++ b/src/Serialize.h @@ -47,7 +47,7 @@ DEFINE_TYPE_VERSION(FuncDesc::Retval, 56, 2) DEFINE_TYPE_VERSION(FuncDesc::Range, 16, 2) DEFINE_TYPE_VERSION(FuncDesc, 104, 4) DEFINE_TYPE_VERSION(GlobalDesc, 72, 4) -DEFINE_TYPE_VERSION(struct drgn_type, 120, 3) +DEFINE_TYPE_VERSION(struct drgn_type, 152, 4) DEFINE_TYPE_VERSION(DrgnClassMemberInfo, 64, 3) DEFINE_TYPE_VERSION(struct drgn_qualified_type, 16, 2) DEFINE_TYPE_VERSION(RootInfo, 48, 2)