Skip to content

Commit

Permalink
fix AD7MemoryAddress.GetInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Trass3r committed Sep 9, 2020
1 parent 59c8b02 commit 705c51b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
21 changes: 15 additions & 6 deletions src/MIDebugEngine/AD7.Impl/AD7MemoryAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public void SetDocumentContext(IDebugDocumentContext2 docContext)
// Adds a specified value to the current context's address to create a new context.
public int Add(ulong dwCount, out IDebugMemoryContext2 newAddress)
{
// FIXME: this is not correct for IDebugCodeContext2
// NB: this is not correct for IDebugCodeContext2 according to the docs
// https://docs.microsoft.com/en-us/visualstudio/extensibility/debugger/reference/idebugcodecontext2#remarks
// But it's not used in practice (instead: IDebugDisassemblyStream2.Seek)
newAddress = new AD7MemoryAddress(_engine, (uint)dwCount + _address, null);
return Constants.S_OK;
}
Expand Down Expand Up @@ -158,12 +160,19 @@ public int GetInfo(enum_CONTEXT_INFO_FIELDS dwFields, CONTEXT_INFO[] pinfo)
{
pinfo[0].dwFields = 0;

if ((dwFields & enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS) != 0 ||
(dwFields & enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSABSOLUTE) != 0)
if ((dwFields & (enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS | enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSABSOLUTE)) != 0)
{
pinfo[0].bstrAddress = EngineUtils.AsAddr(_address, _engine.DebuggedProcess.Is64BitArch);
pinfo[0].bstrAddressAbsolute = pinfo[0].bstrAddress;
pinfo[0].dwFields |= enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS | enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSABSOLUTE;
string addr = EngineUtils.AsAddr(_address, _engine.DebuggedProcess.Is64BitArch);
if ((dwFields & enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS) != 0)
{
pinfo[0].bstrAddress = addr;
pinfo[0].dwFields |= enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS;
}
if ((dwFields & enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSABSOLUTE) != 0)
{
pinfo[0].bstrAddressAbsolute = addr;
pinfo[0].dwFields |= enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSABSOLUTE;
}
}
// Fields not supported by the sample
if ((dwFields & enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSOFFSET) != 0) { }
Expand Down
2 changes: 1 addition & 1 deletion src/OpenDebugAD7/AD7Impl/AD7BreakPointRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace OpenDebugAD7.AD7Impl
{
internal class AD7BreakPointRequest : IDebugBreakpointRequest2, IDebugBreakpointChecksumRequest2
internal sealed class AD7BreakPointRequest : IDebugBreakpointRequest2, IDebugBreakpointChecksumRequest2
{
private static uint s_nextBreakpointId = 0;

Expand Down
4 changes: 1 addition & 3 deletions src/OpenDebugAD7/AD7Impl/AD7DocumentPosition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Globalization;
using Microsoft.DebugEngineHost;
using Microsoft.VisualStudio.Debugger.Interop;

namespace OpenDebugAD7.AD7Impl
{
internal class AD7DocumentPosition : IDebugDocumentPosition2, IDebugDocumentPosition110
internal sealed class AD7DocumentPosition : IDebugDocumentPosition2, IDebugDocumentPosition110
{
public string Path
{
Expand Down

0 comments on commit 705c51b

Please sign in to comment.