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

Unified Diff: handler/win/crashy_test_program.cc

Issue 1533183002: win: Capture some memory pointed at by context (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: typo Created 4 years, 11 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 | « no previous file | minidump/minidump_exception_writer.h » ('j') | snapshot/win/capture_context_memory.h » ('J')
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 847093a3e400bc076044d5fcb081ebc76f8e059b..149d72f02a70d894dcfec47c05ef15d7cc1a127f 100644
--- a/handler/win/crashy_test_program.cc
+++ b/handler/win/crashy_test_program.cc
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <intrin.h>
#include <stdint.h>
#include <stdlib.h>
#include <windows.h>
@@ -38,6 +39,11 @@ namespace {
CRITICAL_SECTION g_test_critical_section;
+unsigned char g_test_memory[] = {
+ 99, 98, 97, 96, 95, 94, 93, 92, 91, 90,
+ 89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
+};
+
ULONG RtlNtStatusToDosError(NTSTATUS status) {
static const auto rtl_nt_status_to_dos_error =
GET_FUNCTION_REQUIRED(L"ntdll.dll", ::RtlNtStatusToDosError);
@@ -89,6 +95,12 @@ void SomeCrashyFunction() {
// LastStatusError of the TEB as a side-effect, and we'll be setting
// ERROR_FILE_NOT_FOUND for GetLastError().
SetLastError(RtlNtStatusToDosError(STATUS_NO_SUCH_FILE));
+
+ // Set a register to point at some memory we can test to confirm it makes it
+ // into the minidump. We use __movsb as a way to set SI/DI without needing an
+ // external .asm file.
+ __movsb(g_test_memory, g_test_memory, 0);
+
volatile int* foo = reinterpret_cast<volatile int*>(7);
*foo = 42;
}
« no previous file with comments | « no previous file | minidump/minidump_exception_writer.h » ('j') | snapshot/win/capture_context_memory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698