Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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.S_FALSE;
}

public int GetCurrentLocation(out ulong puCodeLocationId)
Expand Down
31 changes: 29 additions & 2 deletions src/MIDebugEngine/AD7.Impl/AD7Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,38 @@ 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;
}
AD7Property propArray = new AD7Property(_engine, viArray);
v = propArray._variableInformation.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(' ');
Expand Down