From b3beb9128316036825d0bd6cdd54f4ec376179b6 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 14 Sep 2017 15:44:34 +0300 Subject: [PATCH] Add debugger registers patch for ARM --- ...-more-stuff-to-devel-package-for-debugger.patch | 2 +- .../0002-Add-patch-for-breakpoints-on-ARM.patch | 2 +- patches/coreclr/0003-Enable-Debug-IPC.patch | 2 +- ...Add-patch-for-undefined-references-in-SOS.patch | 2 +- ...ggerREGDISPLAYFromREGDISPLAY-function-on-.patch | 71 ++++++++++++++++++++++ 5 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 patches/coreclr/0005-Fix-SetDebuggerREGDISPLAYFromREGDISPLAY-function-on-.patch diff --git a/patches/coreclr/0001-Add-more-stuff-to-devel-package-for-debugger.patch b/patches/coreclr/0001-Add-more-stuff-to-devel-package-for-debugger.patch index 855d08a..ed09300 100644 --- a/patches/coreclr/0001-Add-more-stuff-to-devel-package-for-debugger.patch +++ b/patches/coreclr/0001-Add-more-stuff-to-devel-package-for-debugger.patch @@ -1,7 +1,7 @@ From 73063a5586b8dadf5b8f651fc792cfbbeace2392 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 24 Aug 2017 23:31:36 +0300 -Subject: [PATCH 1/4] Add more stuff to devel package for debugger +Subject: [PATCH 1/5] Add more stuff to devel package for debugger --- packaging/coreclr.spec | 21 ++++++++++++++------- diff --git a/patches/coreclr/0002-Add-patch-for-breakpoints-on-ARM.patch b/patches/coreclr/0002-Add-patch-for-breakpoints-on-ARM.patch index 1decd81..3bd3dd2 100644 --- a/patches/coreclr/0002-Add-patch-for-breakpoints-on-ARM.patch +++ b/patches/coreclr/0002-Add-patch-for-breakpoints-on-ARM.patch @@ -1,7 +1,7 @@ From cf1d582145e4ae064593b4d351b60477e0673299 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 24 Aug 2017 23:39:57 +0300 -Subject: [PATCH 2/4] Add patch for breakpoints on ARM +Subject: [PATCH 2/5] Add patch for breakpoints on ARM --- packaging/coreclr.spec | 4 +- diff --git a/patches/coreclr/0003-Enable-Debug-IPC.patch b/patches/coreclr/0003-Enable-Debug-IPC.patch index ca0e8c1..237abe4 100644 --- a/patches/coreclr/0003-Enable-Debug-IPC.patch +++ b/patches/coreclr/0003-Enable-Debug-IPC.patch @@ -1,7 +1,7 @@ From 7b7b73c5ee5a152597f8547c5dc7d6786dd2938e Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 24 Aug 2017 23:44:38 +0300 -Subject: [PATCH 3/4] Enable Debug IPC +Subject: [PATCH 3/5] Enable Debug IPC --- packaging/coreclr.spec | 4 ++-- diff --git a/patches/coreclr/0004-Add-patch-for-undefined-references-in-SOS.patch b/patches/coreclr/0004-Add-patch-for-undefined-references-in-SOS.patch index 72566ad..1739f1a 100644 --- a/patches/coreclr/0004-Add-patch-for-undefined-references-in-SOS.patch +++ b/patches/coreclr/0004-Add-patch-for-undefined-references-in-SOS.patch @@ -1,7 +1,7 @@ From 84eb6d8886363b7495881717e0d48fbe95ac6ec1 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 31 Aug 2017 20:22:56 +0300 -Subject: [PATCH 4/4] Add patch for undefined references in SOS +Subject: [PATCH 4/5] Add patch for undefined references in SOS --- packaging/coreclr.spec | 2 + diff --git a/patches/coreclr/0005-Fix-SetDebuggerREGDISPLAYFromREGDISPLAY-function-on-.patch b/patches/coreclr/0005-Fix-SetDebuggerREGDISPLAYFromREGDISPLAY-function-on-.patch new file mode 100644 index 0000000..8419406 --- /dev/null +++ b/patches/coreclr/0005-Fix-SetDebuggerREGDISPLAYFromREGDISPLAY-function-on-.patch @@ -0,0 +1,71 @@ +From 765fdc841203909fcdbc13dfcc2ae91b0b1ebc85 Mon Sep 17 00:00:00 2001 +From: Igor Kulaychuk +Date: Thu, 14 Sep 2017 15:40:49 +0300 +Subject: [PATCH 5/5] Fix SetDebuggerREGDISPLAYFromREGDISPLAY() function on ARM + +--- + packaging/coreclr.spec | 2 ++ + ...x-arm-set-debuggerregdisplay-from-context.patch | 31 ++++++++++++++++++++++ + 2 files changed, 33 insertions(+) + create mode 100644 packaging/fix-arm-set-debuggerregdisplay-from-context.patch + +diff --git a/packaging/coreclr.spec b/packaging/coreclr.spec +index 917fbc2..a0d03ff 100644 +--- a/packaging/coreclr.spec ++++ b/packaging/coreclr.spec +@@ -45,6 +45,7 @@ Patch17: profiling.patch + Patch18: clear_cache.patch + Patch19: fix-arm-breakpoints.patch + Patch20: fix-undefined-references-in-sos.patch ++Patch21: fix-arm-set-debuggerregdisplay-from-context.patch + + ExcludeArch: aarch64 + +@@ -164,6 +165,7 @@ cp %{SOURCE1001} . + %patch18 -p1 + %patch19 -p1 + %patch20 -p1 ++%patch21 -p1 + + %if 0%{skipmscorlib} + %else +diff --git a/packaging/fix-arm-set-debuggerregdisplay-from-context.patch b/packaging/fix-arm-set-debuggerregdisplay-from-context.patch +new file mode 100644 +index 0000000..7ddfc73 +--- /dev/null ++++ b/packaging/fix-arm-set-debuggerregdisplay-from-context.patch +@@ -0,0 +1,31 @@ ++commit ed63a9873f5228fcc2b9b0280a9a237a3401aa05 ++Author: Igor Kulaychuk ++Date: Wed Sep 13 20:39:44 2017 +0300 ++ ++ [ARM] Fix SetDebuggerREGDISPLAYFromREGDISPLAY() function ++ ++ Use the same logic as in AMD64 code: when setting DebuggerREGDISPLAY from the context, ++ the context flags might not be initialized. Since it is only called from stackwalker, ++ we can copy valid integer, control, and floating point sections from the context. ++ ++diff --git a/src/debug/shared/arm/primitives.cpp b/src/debug/shared/arm/primitives.cpp ++index e9d0bbd..8771dd9 100644 ++--- a/src/debug/shared/arm/primitives.cpp +++++ b/src/debug/shared/arm/primitives.cpp ++@@ -80,8 +80,15 @@ void CORDbgSetDebuggerREGDISPLAYFromContext(DebuggerREGDISPLAY *pDRD, ++ void SetDebuggerREGDISPLAYFromREGDISPLAY(DebuggerREGDISPLAY* pDRD, REGDISPLAY* pRD) ++ { ++ SUPPORTS_DAC_HOST_ONLY; ++- +++ // CORDbgSetDebuggerREGDISPLAYFromContext() checks the context flags. In cases where we don't have a filter +++ // context from the thread, we initialize a CONTEXT on the stack and use that to do our stack walking. We never +++ // initialize the context flags in such cases. Since this function is called from the stackwalker, we can +++ // guarantee that the integer, control, and floating point sections are valid. So we set the flags here and +++ // restore them afterwards. +++ DWORD contextFlags = pRD->pCurrentContext->ContextFlags; +++ pRD->pCurrentContext->ContextFlags = CONTEXT_FULL; ++ CORDbgSetDebuggerREGDISPLAYFromContext(pDRD, reinterpret_cast(pRD->pCurrentContext)); +++ pRD->pCurrentContext->ContextFlags = contextFlags; ++ ++ pDRD->SP = pRD->SP; ++ pDRD->PC = (SIZE_T)*(pRD->pPC); +-- +2.7.4 + -- 2.7.4