Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Rylek <trylek@microsoft.com>2017-04-10 03:06:43 +0300
committerTomas Rylek <trylek@microsoft.com>2017-04-10 03:06:43 +0300
commit124e3ef3ae43f45188a13f263645b6ed72751ec3 (patch)
tree5b03352b015cf65c60ced0a29105b8f2c6aa45dc /src/Native/Runtime/amd64
parent3d64c6ca2f65ea3bd93612bfdf35c69b82baab25 (diff)
Short-term fix for step into RhpUniversalTransition_DebugStepTailCall
According to recent findings current Windows DIA stackwalker malfunctions at the address ReturnFromUniversalTransition_DebugStepTailCall because it misinterprets the label for the beginning of a new method and assumes that RSP / ESP points to the return address. As the ingestion of an updated DIA version is a longer-term process I'm proposing to temporarily fix this by exporting a temporary variable holding the return address instead. [tfs-changeset: 1653716]
Diffstat (limited to 'src/Native/Runtime/amd64')
-rw-r--r--src/Native/Runtime/amd64/CallDescrWorker.S12
-rw-r--r--src/Native/Runtime/amd64/CallDescrWorker.asm20
-rw-r--r--src/Native/Runtime/amd64/UniversalTransition.S12
-rw-r--r--src/Native/Runtime/amd64/UniversalTransition.asm19
4 files changed, 58 insertions, 5 deletions
diff --git a/src/Native/Runtime/amd64/CallDescrWorker.S b/src/Native/Runtime/amd64/CallDescrWorker.S
index b9bc36462..6a980b394 100644
--- a/src/Native/Runtime/amd64/CallDescrWorker.S
+++ b/src/Native/Runtime/amd64/CallDescrWorker.S
@@ -6,7 +6,17 @@
#include <unixasmmacros.inc>
NESTED_ENTRY RhCallDescrWorker, _TEXT, NoHandler
-ALTERNATE_ENTRY ReturnFromCallDescrThunk
+LOCAL_LABEL(ReturnFromCallDescrThunk):
+
// UNIXTODO: Implement this function
int 3
NESTED_END RhCallDescrWorker, _TEXT
+
+ .text
+
+ .align 8
+
+C_FUNC(PointerToReturnFromCallDescrThunk):
+ .quad LOCAL_LABEL(ReturnFromCallDescrThunk)
+
+ .global C_FUNC(PointerToReturnFromCallDescrThunk)
diff --git a/src/Native/Runtime/amd64/CallDescrWorker.asm b/src/Native/Runtime/amd64/CallDescrWorker.asm
index 31c996893..a0d07ea45 100644
--- a/src/Native/Runtime/amd64/CallDescrWorker.asm
+++ b/src/Native/Runtime/amd64/CallDescrWorker.asm
@@ -56,8 +56,14 @@ StackCopyLoop: ; copy the arguments to stack top-down t
movdqa xmm3, [rax + 30h] ;
DoCall:
call qword ptr [rbx + OFFSETOF__CallDescrData__pTarget] ; call target function
-LABELED_RETURN_ADDRESS ReturnFromCallDescrThunk ; Symbol used to identify thunk call to managed function so the special
- ; case unwinder can unwind through this function
+
+ReturnFromCallDescrThunk label proc
+
+ ; Symbol used to identify thunk call to managed function so the special
+ ; case unwinder can unwind through this function. Sadly we cannot directly
+ ; export this symbol right now because it confuses DIA unwinder to believe
+ ; it's the beginning of a new method, therefore we export the address
+ ; of an auxiliary variable holding the address instead.
; Save FP return value
@@ -97,4 +103,14 @@ ReturnsDouble:
NESTED_END RhCallDescrWorker, _TEXT
+ .const
+
+ align 8
+
+PointerToReturnFromCallDescrThunk label qword
+
+ dq offset ReturnFromCallDescrThunk
+
+ public PointerToReturnFromCallDescrThunk
+
end
diff --git a/src/Native/Runtime/amd64/UniversalTransition.S b/src/Native/Runtime/amd64/UniversalTransition.S
index cde0ba53b..cf421c630 100644
--- a/src/Native/Runtime/amd64/UniversalTransition.S
+++ b/src/Native/Runtime/amd64/UniversalTransition.S
@@ -124,7 +124,8 @@ NESTED_ENTRY Rhp\FunctionName, _TEXT, NoHandler
mov rsi, r11
lea rdi, [rsp + DISTANCE_FROM_CHILDSP_TO_RETURN_BLOCK]
call r10
-ALTERNATE_ENTRY ReturnFrom\FunctionName
+
+LOCAL_LABEL(ReturnFrom\FunctionName):
// restore fp argument registers
movdqa xmm0, [rsp + DISTANCE_FROM_CHILDSP_TO_FP_REGS + 0x00]
@@ -151,6 +152,15 @@ ALTERNATE_ENTRY ReturnFrom\FunctionName
NESTED_END Rhp\FunctionName, _TEXT
+ .text
+
+ .align 8
+
+C_FUNC(PointerToReturnFrom\FunctionName):
+ .quad LOCAL_LABEL(ReturnFrom\FunctionName)
+
+ .global C_FUNC(PointerToReturnFrom\FunctionName)
+
.endm // UNIVERSAL_TRANSITION
// To enable proper step-in behavior in the debugger, we need to have two instances
diff --git a/src/Native/Runtime/amd64/UniversalTransition.asm b/src/Native/Runtime/amd64/UniversalTransition.asm
index 09f12373a..83aebaf6d 100644
--- a/src/Native/Runtime/amd64/UniversalTransition.asm
+++ b/src/Native/Runtime/amd64/UniversalTransition.asm
@@ -126,7 +126,12 @@ endif ; TRASH_SAVED_ARGUMENT_REGISTERS
mov rdx, r11
lea rcx, [rsp + DISTANCE_FROM_CHILDSP_TO_RETURN_BLOCK]
call r10
-LABELED_RETURN_ADDRESS ReturnFrom&FunctionName
+
+ReturnFrom&FunctionName label proc
+
+ ; We cannot make the label public as that tricks DIA stackwalker into thinking
+ ; it's the beginning of a method. For this reason we export the address
+ ; by means of an auxiliary variable.
; restore fp argument registers
movdqa xmm0, [rsp + DISTANCE_FROM_CHILDSP_TO_FP_REGS ]
@@ -150,6 +155,18 @@ LABELED_RETURN_ADDRESS ReturnFrom&FunctionName
NESTED_END Rhp&FunctionName, _TEXT
+ .const
+
+ align 8
+
+PointerToReturnFrom&FunctionName label qword
+
+ dq offset ReturnFrom&FunctionName
+
+ public PointerToReturnFrom&FunctionName
+
+ .code
+
endm
; To enable proper step-in behavior in the debugger, we need to have two instances