diff --git a/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs b/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs old mode 100644 new mode 100755 index b699a49df..2594376b6 --- a/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs +++ b/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs @@ -34,8 +34,14 @@ public int GetCodeContext(ulong uCodeLocationId, out IDebugCodeContext2 ppCodeCo public int GetCodeLocationId(IDebugCodeContext2 pCodeContext, out ulong puCodeLocationId) { AD7MemoryAddress addr = pCodeContext as AD7MemoryAddress; - puCodeLocationId = addr.Address; - return Constants.S_OK; + if (addr != null) + { + puCodeLocationId = addr.Address; + return Constants.S_OK; + } + + puCodeLocationId = 0; + return Constants.E_FAIL; } public int GetCurrentLocation(out ulong puCodeLocationId) diff --git a/src/MIDebugEngine/AD7.Impl/AD7Property.cs b/src/MIDebugEngine/AD7.Impl/AD7Property.cs index 2601d2c48..54ee427bd 100644 --- a/src/MIDebugEngine/AD7.Impl/AD7Property.cs +++ b/src/MIDebugEngine/AD7.Impl/AD7Property.cs @@ -229,11 +229,37 @@ public int GetMemoryContext(out IDebugMemoryContext2 ppMemory) { return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT; } - v = v.Trim(); + + if ((v[0] == '[') && (v[v.Length-1] == ']')) + { + // this is an array evaluation result from GDB, which does not contain an address + // VS on the other hand supports direct array evaluations without address operator + // therefore we need to re-evaluate with an address operator + // + VariableInformation viArray = new VariableInformation("&(" + _variableInformation.FullName() + ")", (VariableInformation)_variableInformation); + viArray.SyncEval(); + if (viArray.Error) + { + return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT; + } + v = viArray.Value; + v.Trim(); + if (v.Length == 0) + { + return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT; + } + } + if (v[0] == '{') { + var index = v.IndexOf('}'); + if (index == -1) + { + // syntax error! + return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT; + } // strip type name and trailing spaces - v = v.Substring(v.IndexOf('}') + 1); + v = v.Substring(index+1); v = v.Trim(); } int i = v.IndexOf(' '); diff --git a/src/SSHDebugPS/SSHDebugPS.csproj b/src/SSHDebugPS/SSHDebugPS.csproj index bcbe89061..677a34d63 100644 --- a/src/SSHDebugPS/SSHDebugPS.csproj +++ b/src/SSHDebugPS/SSHDebugPS.csproj @@ -13,7 +13,7 @@ net472 true true - false + true