diff --git a/Makefile b/Makefile index 1609d6951be..083b09ec540 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ CXX_dbg = $(DEFAULT_CXX) 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 @@ endif 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 407b50ca7b9..f0432bf14f8 100644 --- a/build.yaml +++ b/build.yaml @@ -3662,7 +3662,7 @@ configs: 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 12e1b1a7563..16a22b7b9be 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -97,6 +97,9 @@ typedef enum { } 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 @@ static grpc_fd *fd_create(int fd, const char *name) { * 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 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) { 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 grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, } 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 @@ retry: 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 void pollset_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, 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_destroy(grpc_pollset_set *pss) { 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_del_fd(grpc_exec_ctx *exec_ctx, grpc_pollset_set *pss, 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_del_pollset(grpc_exec_ctx *exec_ctx, 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 9be07941d75..1206a90e85b 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 52774e08025..1c875d7c093 100644 --- a/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj +++ b/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj @@ -147,53 +147,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters b/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters index 9db6ed46574..00e4276f1d4 100644 --- a/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters +++ b/vsprojects/vcxproj/google_benchmark/google_benchmark.vcxproj.filters @@ -1,125 +1,7 @@ - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - - - third_party\google_benchmark\include\benchmark - - - third_party\google_benchmark\include\benchmark - - - third_party\google_benchmark\include\benchmark - - - third_party\google_benchmark\include\benchmark - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - third_party\google_benchmark\src - - - - {7458b63d-7ba4-103d-2bed-3e3ad30d8237} - - - {54a154e8-669b-a7c1-9b6e-bd1aab2f86e3} - - - {f54c3cb1-ec20-a651-6956-78379b51e1a5} - - - {0483a457-8050-4565-bc15-09695bf7b822} - - - {c39ff2d1-691e-4614-4d75-4bc20db05e09} -