Skip to content

Commit fb4b9fb

Browse files
committed
[compiler-rt] Implements DumpAllRegisters for windows intel archs.
1 parent 1d2f727 commit fb4b9fb

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_win.cpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,45 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
10391039
}
10401040

10411041
void SignalContext::DumpAllRegisters(void *context) {
1042-
// FIXME: Implement this.
1042+
CONTEXT *ctx = (CONTEXT *)context;
1043+
# if defined(__M_X64)
1044+
Report("Register values:\n");
1045+
Printf("rax = %llx ", ctx->Rax);
1046+
Printf("rbx = %llx ", ctx->Rbx);
1047+
Printf("rcx = %llx ", ctx->Rcx);
1048+
Printf("rdx = %llx ", ctx->Rdx);
1049+
Printf("\n");
1050+
Printf("rdi = %llx ", ctx->Rdi);
1051+
Printf("rsi = %llx ", ctx->Rsi);
1052+
Printf("rbp = %llx ", ctx->Rbp);
1053+
Printf("rsp = %llx ", ctx->Rsp);
1054+
Printf("\n");
1055+
Printf("r8 = %llx ", ctx->R8);
1056+
Printf("r9 = %llx ", ctx->R9);
1057+
Printf("r10 = %llx ", ctx->R10);
1058+
Printf("r11 = %llx ", ctx->R11);
1059+
Printf("\n");
1060+
Printf("r12 = %llx ", ctx->R12);
1061+
Printf("r13 = %llx ", ctx->R13);
1062+
Printf("r14 = %llx ", ctx->R14);
1063+
Printf("r15 = %llx ", ctx->R15);
1064+
Printf("\n");
1065+
# elif defined(_M_IX86)
1066+
Report("Register values:\n");
1067+
Printf("eax = %lx ", ctx->Eax);
1068+
Printf("ebx = %lx ", ctx->Ebx);
1069+
Printf("ecx = %lx ", ctx->Ecx);
1070+
Printf("edx = %lx ", ctx->Edx);
1071+
Printf("\n");
1072+
Printf("edi = %lx ", ctx->Edi);
1073+
Printf("esi = %lx ", ctx->Esi);
1074+
Printf("ebp = %lx ", ctx->Ebp);
1075+
Printf("esp = %lx ", ctx->Esp);
1076+
Printf("\n");
1077+
# else
1078+
// TODO
1079+
(void)ctx;
1080+
# endif
10431081
}
10441082

10451083
int SignalContext::GetType() const {

0 commit comments

Comments
 (0)