Skip to content

Commit

Permalink
Fixing todo
Browse files Browse the repository at this point in the history
  • Loading branch information
WardenGnaw authored and Trass3r committed Nov 6, 2020
1 parent e207135 commit 936f730
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/MICore/CommandFactories/lldb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public override async Task ExecJump(string filename, int line)

public override async Task ExecJump(ulong address)
{
string command = "jump *" + string.Format("0x{0:X}", address);
string command = "jump *" + string.Format(CultureInfo.InvariantCulture, "0x{0:X}", address);
await _debugger.CmdAsync(command, ResultClass.running);
}

Expand Down
34 changes: 22 additions & 12 deletions src/OpenDebugAD7/AD7DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
Expand Down Expand Up @@ -42,7 +43,9 @@ internal sealed class AD7DebugSession : DebugAdapterBase, IDebugPortNotify2, IDe

private readonly DebugEventLogger m_logger;
private readonly Dictionary<string, Dictionary<int, IDebugPendingBreakpoint2>> m_breakpoints;
private readonly List<IDebugCodeContext2> m_gotoCodeContexts = new List<IDebugCodeContext2>();

private readonly ConcurrentDictionary<int, IDebugCodeContext2> m_gotoCodeContexts = new ConcurrentDictionary<int, IDebugCodeContext2>();
private int m_nextContextId = 1;

private Dictionary<string, IDebugPendingBreakpoint2> m_functionBreakpoints;
private readonly Dictionary<int, ThreadFrameEnumInfo> m_threadFrameEnumInfos = new Dictionary<int, ThreadFrameEnumInfo>();
Expand Down Expand Up @@ -1268,15 +1271,17 @@ protected override void HandleGotoRequestAsync(IRequestResponder<GotoArguments>
var builder = new ErrorBuilder(() => AD7Resources.Error_UnableToSetNextStatement);
try
{
var gotoTarget = m_gotoCodeContexts[responder.Arguments.TargetId];
IDebugThread2 thread = null;
lock (m_threads)
if (m_gotoCodeContexts.TryGetValue(responder.Arguments.TargetId, out IDebugCodeContext2 gotoTarget))
{
if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread))
throw new AD7Exception("Unknown thread id: " + responder.Arguments.ThreadId.ToString(CultureInfo.InvariantCulture));
IDebugThread2 thread = null;
lock (m_threads)
{
if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread))
throw new AD7Exception("Unknown thread id: " + responder.Arguments.ThreadId.ToString(CultureInfo.InvariantCulture));
}
BeforeContinue();
builder.CheckHR(thread.SetNextStatement(null, gotoTarget));
}
BeforeContinue();
builder.CheckHR(thread.SetNextStatement(null, gotoTarget));
}
catch (AD7Exception e)
{
Expand Down Expand Up @@ -1321,11 +1326,16 @@ protected override void HandleGotoTargetsRequestAsync(IRequestResponder<GotoTarg
IDebugDocumentContext2 documentContext;
if (codeContext.GetDocumentContext(out documentContext) == HRConstants.S_OK)
{
var pos = new TEXT_POSITION[1];
if (documentContext.GetStatementRange(pos, null) == HRConstants.S_OK)
line = m_pathConverter.ConvertDebuggerLineToClient((int)pos[0].dwLine);
var startPos = new TEXT_POSITION[1];
var endPos = new TEXT_POSITION[1];
if (documentContext.GetStatementRange(startPos, endPos) == HRConstants.S_OK)
line = m_pathConverter.ConvertDebuggerLineToClient((int)startPos[0].dwLine);
}
targets.Add(new GotoTarget(m_gotoCodeContexts.Create(codeContext), contextName, line));

int codeContextId = m_nextContextId++;
m_gotoCodeContexts.TryAdd(codeContextId, codeContext);

targets.Add(new GotoTarget(codeContextId, contextName, line));
}
}

Expand Down

0 comments on commit 936f730

Please sign in to comment.