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

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: mac 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') | 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 be03d4cd289df1fe4c698fd09a7eeae0f084e773..4355ae00f981b2df0f77cb087dc9f70d1919025c 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 <sys/types.h>
@@ -39,6 +40,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);
@@ -90,6 +96,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698