Skip to content

Commit 71ae9c1

Browse files
committed
Merge branch 'master' into develop
2 parents b7601bb + 22e2c30 commit 71ae9c1

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

solution/GraphicalDebugging/Debugger.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using EnvDTE;
1+
using EnvDTE;
22
using Microsoft.VisualStudio.Shell;
33

44
namespace GraphicalDebugging
@@ -108,14 +108,21 @@ public bool GetPointerOffset(string pointerName1, string pointerName2, out long
108108
// Returns false if address cannot be loaded, parsed or if it is equal to 0
109109
public bool GetPointer(string pointerName, out ulong result)
110110
{
111+
var genericPtrExpr = debugger.GetExpression("(void*)(" + pointerName + ")");
112+
if (genericPtrExpr.IsValidValue)
113+
{
114+
return Util.TryParseULong(genericPtrExpr.Value, out result) && result != 0;
115+
}
116+
117+
// fallback for c#
118+
var elementPtrExpr = debugger.GetExpression(pointerName);
119+
if (elementPtrExpr.IsValidValue)
120+
{
121+
return Util.TryParseULong(elementPtrExpr.Value, out result) && result != 0;
122+
}
123+
111124
result = 0;
112-
var ptrExpr = debugger.GetExpression("(void*)(" + pointerName + ")");
113-
return ptrExpr.IsValidValue
114-
// NOTE: Hexadecimal value is automatically detected, this is probably not needed.
115-
// But automatically detect the format just in case of various versions
116-
// of VS displayed it differently regardless of debugger mode.
117-
&& Util.TryParseULong(ptrExpr.Value/*, true*/, out result)
118-
&& result != 0;
125+
return false;
119126
}
120127

121128
// Address of variable

0 commit comments

Comments
 (0)