Minor debug support
diff --git a/Makefile b/Makefile
index 1609d69..083b09e 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,7 @@
LD_dbg = $(DEFAULT_CC)
LDXX_dbg = $(DEFAULT_CXX)
CPPFLAGS_dbg = -O0
-DEFINES_dbg = _DEBUG DEBUG
+DEFINES_dbg = _DEBUG DEBUG PO_DEBUG
VALID_CONFIG_easan = 1
REQUIRE_CUSTOM_LIBRARIES_easan = 1
@@ -6809,19 +6809,6 @@
LIBGOOGLE_BENCHMARK_SRC = \
- third_party/google_benchmark/src/benchmark.cc \
- third_party/google_benchmark/src/benchmark_register.cc \
- third_party/google_benchmark/src/colorprint.cc \
- third_party/google_benchmark/src/commandlineflags.cc \
- third_party/google_benchmark/src/complexity.cc \
- third_party/google_benchmark/src/console_reporter.cc \
- third_party/google_benchmark/src/csv_reporter.cc \
- third_party/google_benchmark/src/json_reporter.cc \
- third_party/google_benchmark/src/reporter.cc \
- third_party/google_benchmark/src/sleep.cc \
- third_party/google_benchmark/src/string_util.cc \
- third_party/google_benchmark/src/sysinfo.cc \
- third_party/google_benchmark/src/timers.cc \
PUBLIC_HEADERS_CXX += \
diff --git a/build.yaml b/build.yaml
index 407b50c..f0432bf 100644
--- a/build.yaml
+++ b/build.yaml
@@ -3662,7 +3662,7 @@
DEFINES: NDEBUG
dbg:
CPPFLAGS: -O0
- DEFINES: _DEBUG DEBUG
+ DEFINES: _DEBUG DEBUG PO_DEBUG
easan:
CC: clang
CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer
diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c
index 12e1b1a..16a22b7 100644
--- a/src/core/lib/iomgr/ev_epoll_linux.c
+++ b/src/core/lib/iomgr/ev_epoll_linux.c
@@ -97,6 +97,9 @@
} poll_obj_type;
typedef struct poll_obj {
+#ifdef PO_DEBUG
+ poll_obj_type obj_type;
+#endif
gpr_mu mu;
struct polling_island *pi;
} poll_obj;
@@ -946,6 +949,9 @@
* would be holding a lock to it anyway. */
gpr_mu_lock(&new_fd->po.mu);
new_fd->po.pi = NULL;
+#ifdef PO_DEBUG
+ new_fd->po.obj_type = POLL_OBJ_FD;
+#endif
gpr_atm_rel_store(&new_fd->refst, (gpr_atm)1);
new_fd->fd = fd;
@@ -1281,6 +1287,9 @@
gpr_mu_init(&pollset->po.mu);
*mu = &pollset->po.mu;
pollset->po.pi = NULL;
+#ifdef PO_DEBUG
+ pollset->po.obj_type = POLL_OBJ_POLLSET;
+#endif
pollset->root_worker.next = pollset->root_worker.prev = &pollset->root_worker;
pollset->kicked_without_pollers = false;
@@ -1656,10 +1665,15 @@
}
static void add_poll_object(grpc_exec_ctx *exec_ctx, poll_obj *bag,
- poll_obj *item, poll_obj_type bag_type,
+ poll_obj_type bag_type, poll_obj *item,
poll_obj_type item_type) {
GPR_TIMER_BEGIN("add_poll_object", 0);
+#ifdef PO_DEBUG
+ GPR_ASSERT(item->obj_type == item_type);
+ GPR_ASSERT(bag->obj_type == bag_type);
+#endif
+
grpc_error *error = GRPC_ERROR_NONE;
polling_island *pi_new = NULL;
@@ -1802,7 +1816,7 @@
static void pollset_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
grpc_fd *fd) {
- add_poll_object(exec_ctx, &pollset->po, &fd->po, POLL_OBJ_POLLSET,
+ add_poll_object(exec_ctx, &pollset->po, POLL_OBJ_POLLSET, &fd->po,
POLL_OBJ_FD);
}
@@ -1812,8 +1826,11 @@
static grpc_pollset_set *pollset_set_create(void) {
grpc_pollset_set *pss = gpr_malloc(sizeof(*pss));
- pss->po.pi = NULL;
gpr_mu_init(&pss->po.mu);
+ pss->po.pi = NULL;
+#ifdef PO_DEBUG
+ pss->po.obj_type = POLL_OBJ_POLLSET_SET;
+#endif
return pss;
}
@@ -1831,7 +1848,7 @@
static void pollset_set_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset_set *pss,
grpc_fd *fd) {
- add_poll_object(exec_ctx, &pss->po, &fd->po, POLL_OBJ_POLLSET_SET,
+ add_poll_object(exec_ctx, &pss->po, POLL_OBJ_POLLSET_SET, &fd->po,
POLL_OBJ_FD);
}
@@ -1842,7 +1859,7 @@
static void pollset_set_add_pollset(grpc_exec_ctx *exec_ctx,
grpc_pollset_set *pss, grpc_pollset *ps) {
- add_poll_object(exec_ctx, &pss->po, &ps->po, POLL_OBJ_POLLSET_SET,
+ add_poll_object(exec_ctx, &pss->po, POLL_OBJ_POLLSET_SET, &ps->po,
POLL_OBJ_POLLSET);
}
@@ -1854,7 +1871,7 @@
static void pollset_set_add_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_pollset_set *bag,
grpc_pollset_set *item) {
- add_poll_object(exec_ctx, &bag->po, &item->po, POLL_OBJ_POLLSET_SET,
+ add_poll_object(exec_ctx, &bag->po, POLL_OBJ_POLLSET_SET, &item->po,
POLL_OBJ_POLLSET_SET);
}
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 9be0794..1206a90 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -6203,28 +6203,7 @@
},
{
"deps": [],
- "headers": [
- "third_party/google_benchmark/include/benchmark/benchmark.h",
- "third_party/google_benchmark/include/benchmark/benchmark_api.h",
- "third_party/google_benchmark/include/benchmark/macros.h",
- "third_party/google_benchmark/include/benchmark/reporter.h",
- "third_party/google_benchmark/src/arraysize.h",
- "third_party/google_benchmark/src/benchmark_api_internal.h",
- "third_party/google_benchmark/src/check.h",
- "third_party/google_benchmark/src/colorprint.h",
- "third_party/google_benchmark/src/commandlineflags.h",
- "third_party/google_benchmark/src/complexity.h",
- "third_party/google_benchmark/src/cycleclock.h",
- "third_party/google_benchmark/src/internal_macros.h",
- "third_party/google_benchmark/src/log.h",
- "third_party/google_benchmark/src/mutex.h",
- "third_party/google_benchmark/src/re.h",
- "third_party/google_benchmark/src/sleep.h",
- "third_party/google_benchmark/src/stat.h",
- "third_party/google_benchmark/src/string_util.h",
- "third_party/google_benchmark/src/sysinfo.h",
- "third_party/google_benchmark/src/timers.h"
- ],
+ "headers": [],
"is_filegroup": false,
"language": "c++",
"name": "google_benchmark",
diff --git a/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj b/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj
index 52774e0..1c875d7 100644
--- a/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj
+++ b/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj
@@ -147,53 +147,7 @@
</ItemDefinitionGroup>
<ItemGroup>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\benchmark.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\benchmark_api.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\macros.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\reporter.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\arraysize.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\benchmark_api_internal.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\check.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\colorprint.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\commandlineflags.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\complexity.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\cycleclock.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\internal_macros.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\log.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\mutex.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\re.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\sleep.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\stat.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\string_util.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\sysinfo.h" />
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\timers.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\benchmark.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\benchmark_register.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\colorprint.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\commandlineflags.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\complexity.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\console_reporter.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\csv_reporter.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\json_reporter.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\reporter.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\sleep.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\string_util.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\sysinfo.cc">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\timers.cc">
+ <ClCompile Include="$(SolutionDir)\..\vsprojects\dummy.c">
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters b/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters
index 9db6ed4..00e4276 100644
--- a/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters
+++ b/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters
@@ -1,125 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\benchmark.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\benchmark_register.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\colorprint.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\commandlineflags.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\complexity.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\console_reporter.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\csv_reporter.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\json_reporter.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\reporter.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\sleep.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\string_util.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\sysinfo.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\third_party\google_benchmark\src\timers.cc">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\benchmark.h">
- <Filter>third_party\google_benchmark\include\benchmark</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\benchmark_api.h">
- <Filter>third_party\google_benchmark\include\benchmark</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\macros.h">
- <Filter>third_party\google_benchmark\include\benchmark</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\include\benchmark\reporter.h">
- <Filter>third_party\google_benchmark\include\benchmark</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\arraysize.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\benchmark_api_internal.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\check.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\colorprint.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\commandlineflags.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\complexity.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\cycleclock.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\internal_macros.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\log.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\mutex.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\re.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\sleep.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\stat.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\string_util.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\sysinfo.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\third_party\google_benchmark\src\timers.h">
- <Filter>third_party\google_benchmark\src</Filter>
- </ClInclude>
- </ItemGroup>
<ItemGroup>
- <Filter Include="third_party">
- <UniqueIdentifier>{7458b63d-7ba4-103d-2bed-3e3ad30d8237}</UniqueIdentifier>
- </Filter>
- <Filter Include="third_party\google_benchmark">
- <UniqueIdentifier>{54a154e8-669b-a7c1-9b6e-bd1aab2f86e3}</UniqueIdentifier>
- </Filter>
- <Filter Include="third_party\google_benchmark\include">
- <UniqueIdentifier>{f54c3cb1-ec20-a651-6956-78379b51e1a5}</UniqueIdentifier>
- </Filter>
- <Filter Include="third_party\google_benchmark\include\benchmark">
- <UniqueIdentifier>{0483a457-8050-4565-bc15-09695bf7b822}</UniqueIdentifier>
- </Filter>
- <Filter Include="third_party\google_benchmark\src">
- <UniqueIdentifier>{c39ff2d1-691e-4614-4d75-4bc20db05e09}</UniqueIdentifier>
- </Filter>
</ItemGroup>
</Project>