-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get ICorDebugILFrame for ClrStackFrames
This change adds DesktopStackFrame.CordbFrame, which is its ICorDebugILFrame. This is now properly filled. This will allow us to get local variables on demand from ICorDebug. I also cleaned up the use of _CONTEXT structures in ClrMD to use a thread static byte array and not maintain magic constants in the actual code. (ContextHelper still contains the magic constants though.)
- Loading branch information
Showing
3 changed files
with
66 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -819,39 +819,17 @@ internal IEnumerable<ClrStackFrame> EnumerateStackFrames(DesktopThread thread) | |
yield break; | ||
|
||
IXCLRDataStackWalk stackWalk = (IXCLRDataStackWalk)tmp; | ||
|
||
byte[] ulongBuffer = new byte[8]; | ||
byte[] context = new byte[PointerSize == 4 ? 716 : 1232]; | ||
|
||
int ip_offset = 184; | ||
int sp_offset = 196; | ||
|
||
if (PointerSize == 8) | ||
{ | ||
ip_offset = 248; | ||
sp_offset = 152; | ||
} | ||
|
||
byte[] context = ContextHelper.Context; | ||
do | ||
{ | ||
uint size; | ||
res = stackWalk.GetContext(0x1003f, (uint)context.Length, out size, context); | ||
res = stackWalk.GetContext(ContextHelper.ContextFlags, ContextHelper.Length, out size, context); | ||
if (res < 0 || res == 1) | ||
break; | ||
|
||
ulong ip, sp; | ||
|
||
if (PointerSize == 4) | ||
{ | ||
ip = BitConverter.ToUInt32(context, ip_offset); | ||
sp = BitConverter.ToUInt32(context, sp_offset); | ||
} | ||
else | ||
{ | ||
ip = BitConverter.ToUInt64(context, ip_offset); | ||
sp = BitConverter.ToUInt64(context, sp_offset); | ||
} | ||
|
||
ulong ip = BitConverter.ToUInt32(context, ContextHelper.InstructionPointerOffset); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alobmaier
|
||
ulong sp = BitConverter.ToUInt32(context, ContextHelper.StackPointerOffset); | ||
|
||
res = stackWalk.Request(0xf0000000, 0, null, (uint)ulongBuffer.Length, ulongBuffer); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What about 64 bit systems? Shouldn't it be ToUInt64?