| Index: handler/win/crashy_test_program.cc
 | 
| diff --git a/handler/win/crashy_test_program.cc b/handler/win/crashy_test_program.cc
 | 
| index 622a5e5df08d3218dbdd2e5d1a2ab7fca32992e2..638098a68ebeed8b643f34f896980eb1dfa0f918 100644
 | 
| --- a/handler/win/crashy_test_program.cc
 | 
| +++ b/handler/win/crashy_test_program.cc
 | 
| @@ -20,6 +20,7 @@
 | 
|  #define STATUS_NO_SUCH_FILE static_cast<NTSTATUS>(0xC000000F)
 | 
|  #endif
 | 
|  
 | 
| +#include "base/basictypes.h"
 | 
|  #include "base/logging.h"
 | 
|  #include "client/crashpad_client.h"
 | 
|  #include "tools/tool_support.h"
 | 
| @@ -35,6 +36,45 @@ ULONG RtlNtStatusToDosError(NTSTATUS status) {
 | 
|    return rtl_nt_status_to_dos_error(status);
 | 
|  }
 | 
|  
 | 
| +void AllocateMemoryOfVariousProtections() {
 | 
| +  SYSTEM_INFO system_info;
 | 
| +  GetSystemInfo(&system_info);
 | 
| +
 | 
| +  const size_t kPageSize = system_info.dwPageSize;
 | 
| +
 | 
| +  const uint32_t kPageTypes[] = {
 | 
| +    PAGE_NOACCESS,
 | 
| +    PAGE_READONLY,
 | 
| +    PAGE_READWRITE,
 | 
| +    PAGE_EXECUTE,
 | 
| +    PAGE_EXECUTE_READ,
 | 
| +    PAGE_EXECUTE_READWRITE,
 | 
| +
 | 
| +    // PAGE_NOACCESS is invalid with PAGE_GUARD.
 | 
| +    PAGE_READONLY | PAGE_GUARD,
 | 
| +    PAGE_READWRITE | PAGE_GUARD,
 | 
| +    PAGE_EXECUTE | PAGE_GUARD,
 | 
| +    PAGE_EXECUTE_READ | PAGE_GUARD,
 | 
| +    PAGE_EXECUTE_READWRITE | PAGE_GUARD,
 | 
| +  };
 | 
| +
 | 
| +  // All of these allocations are leaked, we want to view them in windbg via
 | 
| +  // !vprot.
 | 
| +  void* reserve = VirtualAlloc(
 | 
| +      nullptr, arraysize(kPageTypes) * kPageSize, MEM_RESERVE, PAGE_READWRITE);
 | 
| +  PCHECK(reserve) << "VirtualAlloc MEM_RESERVE";
 | 
| +  uintptr_t reserve_as_int = reinterpret_cast<uintptr_t>(reserve);
 | 
| +
 | 
| +  for (size_t i = 0; i < arraysize(kPageTypes); ++i) {
 | 
| +    void* result =
 | 
| +        VirtualAlloc(reinterpret_cast<void*>(reserve_as_int + (kPageSize * i)),
 | 
| +                     kPageSize,
 | 
| +                     MEM_COMMIT,
 | 
| +                     kPageTypes[i]);
 | 
| +    PCHECK(result) << "VirtualAlloc MEM_COMMIT " << i;
 | 
| +  }
 | 
| +}
 | 
| +
 | 
|  void SomeCrashyFunction() {
 | 
|    // SetLastError and NTSTATUS so that we have something to view in !gle in
 | 
|    // windbg. RtlNtStatusToDosError() stores STATUS_NO_SUCH_FILE into the
 | 
| @@ -61,6 +101,8 @@ int CrashyMain(int argc, char* argv[]) {
 | 
|      return 1;
 | 
|    }
 | 
|  
 | 
| +  AllocateMemoryOfVariousProtections();
 | 
| +
 | 
|    SomeCrashyFunction();
 | 
|  
 | 
|    return 0;
 | 
| 
 |