From 4367e9df172c579ca232ef98d76b1a00d7333e8a Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 10 Jan 2020 16:26:53 -0800 Subject: [PATCH] Increase kAllowedOffset for non-optimized build "init_stack_vars = true" inserts additional instructions which usually removed by optimization if code does not rely on undefined behaviour of uninitialized variables. However in non-optimized build these instructions may still be present. Fixing https://ci.chromium.org/p/chromium/builders/ci/Win10%20Tests%20x64%20%28dbg%29/12597 Related patch: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1949846 Bug: chromium:1030261 Change-Id: Ib05fa8580d4b0206f70e2dfac5e0f3a3d4389f95 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1995823 Reviewed-by: Mark Mentovai Commit-Queue: Vitaly Buka --- snapshot/win/exception_snapshot_win_test.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/snapshot/win/exception_snapshot_win_test.cc b/snapshot/win/exception_snapshot_win_test.cc index 2d4e9090..07a25a89 100644 --- a/snapshot/win/exception_snapshot_win_test.cc +++ b/snapshot/win/exception_snapshot_win_test.cc @@ -102,7 +102,12 @@ class CrashingDelegate : public ExceptionHandlerServer::Delegate { // Verify the exception happened at the expected location with a bit of // slop space to allow for reading the current PC before the exception // happens. See TestCrashingChild(). +#if !defined(NDEBUG) + // Debug build is likely not optimized and contains more instructions. + constexpr uint64_t kAllowedOffset = 200; +#else constexpr uint64_t kAllowedOffset = 100; +#endif EXPECT_GT(snapshot.Exception()->ExceptionAddress(), break_near_); EXPECT_LT(snapshot.Exception()->ExceptionAddress(), break_near_ + kAllowedOffset); @@ -215,7 +220,7 @@ class SimulateDelegate : public ExceptionHandlerServer::Delegate { constexpr uint64_t kAllowedOffset = 500; #elif !defined(NDEBUG) // Debug build is likely not optimized and contains more instructions. - constexpr uint64_t kAllowedOffset = 150; + constexpr uint64_t kAllowedOffset = 200; #else constexpr uint64_t kAllowedOffset = 100; #endif