Add debugger registers patch for ARM
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Thu, 14 Sep 2017 12:44:34 +0000 (15:44 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Thu, 14 Sep 2017 12:44:34 +0000 (15:44 +0300)
patches/coreclr/0001-Add-more-stuff-to-devel-package-for-debugger.patch
patches/coreclr/0002-Add-patch-for-breakpoints-on-ARM.patch
patches/coreclr/0003-Enable-Debug-IPC.patch
patches/coreclr/0004-Add-patch-for-undefined-references-in-SOS.patch
patches/coreclr/0005-Fix-SetDebuggerREGDISPLAYFromREGDISPLAY-function-on-.patch [new file with mode: 0644]

index 855d08adbd5ec940979ee6eefa90611b2edd68fd..ed09300931d935cda1248927327ae05ba9b8a113 100644 (file)
@@ -1,7 +1,7 @@
 From 73063a5586b8dadf5b8f651fc792cfbbeace2392 Mon Sep 17 00:00:00 2001
 From: Igor Kulaychuk <i.kulaychuk@samsung.com>
 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 ++++++++++++++-------
index 1decd814f0aa7b6e6d97005ac61593dca31a1c36..3bd3dd2c4dc1f6d2501b40176685b8c8a70767b8 100644 (file)
@@ -1,7 +1,7 @@
 From cf1d582145e4ae064593b4d351b60477e0673299 Mon Sep 17 00:00:00 2001
 From: Igor Kulaychuk <i.kulaychuk@samsung.com>
 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 +-
index ca0e8c12899c4926cf7c2cb2c700e0567281273b..237abe46c73d26b36afdd8886cb0fa2a41462179 100644 (file)
@@ -1,7 +1,7 @@
 From 7b7b73c5ee5a152597f8547c5dc7d6786dd2938e Mon Sep 17 00:00:00 2001
 From: Igor Kulaychuk <i.kulaychuk@samsung.com>
 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 ++--
index 72566ad55837f4c62f80b5c3d39d41a4a0bbde83..1739f1ad171e0d78c208fcff7376105105ef127e 100644 (file)
@@ -1,7 +1,7 @@
 From 84eb6d8886363b7495881717e0d48fbe95ac6ec1 Mon Sep 17 00:00:00 2001
 From: Igor Kulaychuk <i.kulaychuk@samsung.com>
 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 (file)
index 0000000..8419406
--- /dev/null
@@ -0,0 +1,71 @@
+From 765fdc841203909fcdbc13dfcc2ae91b0b1ebc85 Mon Sep 17 00:00:00 2001
+From: Igor Kulaychuk <i.kulaychuk@samsung.com>
+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 <i.kulaychuk@samsung.com>
++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<DT_CONTEXT*>(pRD->pCurrentContext));
+++    pRD->pCurrentContext->ContextFlags = contextFlags;
++ 
++     pDRD->SP   = pRD->SP;
++     pDRD->PC   = (SIZE_T)*(pRD->pPC);
+-- 
+2.7.4
+