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

Unified Diff: handler/win/crashy_test_program.cc

Issue 1392093003: win: Capture some CRITICAL_SECTION debugging data (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/win/crash_report_exception_handler.cc ('k') | snapshot/crashpad_info_client_options_test.cc » ('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 638098a68ebeed8b643f34f896980eb1dfa0f918..0694a88b5fa18c16777f911aa308e008844a4bcf 100644
--- a/handler/win/crashy_test_program.cc
+++ b/handler/win/crashy_test_program.cc
@@ -28,6 +28,8 @@
namespace crashpad {
namespace {
+CRITICAL_SECTION g_test_critical_section;
+
ULONG RtlNtStatusToDosError(NTSTATUS status) {
static decltype(::RtlNtStatusToDosError)* rtl_nt_status_to_dos_error =
reinterpret_cast<decltype(::RtlNtStatusToDosError)*>(
@@ -75,6 +77,18 @@ 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
@@ -103,6 +117,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);
+
SomeCrashyFunction();
return 0;
« no previous file with comments | « handler/win/crash_report_exception_handler.cc ('k') | snapshot/crashpad_info_client_options_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698