Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: handler/win/crashy_test_program.cc

Issue 1405243002: Fix CRITICAL_SECTION test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « handler/handler.gyp ('k') | snapshot/win/end_to_end_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: handler/win/crashy_test_program.cc
diff --git a/handler/win/crashy_test_program.cc b/handler/win/crashy_test_program.cc
index 0694a88b5fa18c16777f911aa308e008844a4bcf..4057df89a36e4e41a6ae2b43fdf3170853749e66 100644
--- a/handler/win/crashy_test_program.cc
+++ b/handler/win/crashy_test_program.cc
@@ -24,6 +24,7 @@
#include "base/logging.h"
#include "client/crashpad_client.h"
#include "tools/tool_support.h"
+#include "util/win/critical_section_with_debug_info.h"
namespace crashpad {
namespace {
@@ -77,18 +78,6 @@ void AllocateMemoryOfVariousProtections() {
}
}
-BOOL CrashpadInitializeCriticalSectionEx(
- CRITICAL_SECTION* critical_section,
- DWORD spin_count,
- DWORD flags) {
- static decltype(InitializeCriticalSectionEx)* initialize_critical_section_ex =
- reinterpret_cast<decltype(InitializeCriticalSectionEx)*>(GetProcAddress(
- LoadLibrary(L"kernel32.dll"), "InitializeCriticalSectionEx"));
- if (!initialize_critical_section_ex)
- return false;
- return initialize_critical_section_ex(critical_section, spin_count, flags);
-}
-
void SomeCrashyFunction() {
// SetLastError and NTSTATUS so that we have something to view in !gle in
// windbg. RtlNtStatusToDosError() stores STATUS_NO_SUCH_FILE into the
@@ -117,9 +106,10 @@ int CrashyMain(int argc, char* argv[]) {
AllocateMemoryOfVariousProtections();
- CrashpadInitializeCriticalSectionEx(
- &g_test_critical_section, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
- EnterCriticalSection(&g_test_critical_section);
+ if (InitializeCriticalSectionWithDebugInfoIfPossible(
+ &g_test_critical_section)) {
+ EnterCriticalSection(&g_test_critical_section);
+ }
SomeCrashyFunction();
« no previous file with comments | « handler/handler.gyp ('k') | snapshot/win/end_to_end_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698