Skip to content

Commit 936f730

Browse files
WardenGnawTrass3r
authored andcommitted
Fixing todo
1 parent e207135 commit 936f730

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

src/MICore/CommandFactories/lldb.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public override async Task ExecJump(string filename, int line)
186186

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

src/OpenDebugAD7/AD7DebugSession.cs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System;
5+
using System.Collections.Concurrent;
56
using System.Collections.Generic;
67
using System.Diagnostics;
78
using System.Globalization;
@@ -42,7 +43,9 @@ internal sealed class AD7DebugSession : DebugAdapterBase, IDebugPortNotify2, IDe
4243

4344
private readonly DebugEventLogger m_logger;
4445
private readonly Dictionary<string, Dictionary<int, IDebugPendingBreakpoint2>> m_breakpoints;
45-
private readonly List<IDebugCodeContext2> m_gotoCodeContexts = new List<IDebugCodeContext2>();
46+
47+
private readonly ConcurrentDictionary<int, IDebugCodeContext2> m_gotoCodeContexts = new ConcurrentDictionary<int, IDebugCodeContext2>();
48+
private int m_nextContextId = 1;
4649

4750
private Dictionary<string, IDebugPendingBreakpoint2> m_functionBreakpoints;
4851
private readonly Dictionary<int, ThreadFrameEnumInfo> m_threadFrameEnumInfos = new Dictionary<int, ThreadFrameEnumInfo>();
@@ -1268,15 +1271,17 @@ protected override void HandleGotoRequestAsync(IRequestResponder<GotoArguments>
12681271
var builder = new ErrorBuilder(() => AD7Resources.Error_UnableToSetNextStatement);
12691272
try
12701273
{
1271-
var gotoTarget = m_gotoCodeContexts[responder.Arguments.TargetId];
1272-
IDebugThread2 thread = null;
1273-
lock (m_threads)
1274+
if (m_gotoCodeContexts.TryGetValue(responder.Arguments.TargetId, out IDebugCodeContext2 gotoTarget))
12741275
{
1275-
if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread))
1276-
throw new AD7Exception("Unknown thread id: " + responder.Arguments.ThreadId.ToString(CultureInfo.InvariantCulture));
1276+
IDebugThread2 thread = null;
1277+
lock (m_threads)
1278+
{
1279+
if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread))
1280+
throw new AD7Exception("Unknown thread id: " + responder.Arguments.ThreadId.ToString(CultureInfo.InvariantCulture));
1281+
}
1282+
BeforeContinue();
1283+
builder.CheckHR(thread.SetNextStatement(null, gotoTarget));
12771284
}
1278-
BeforeContinue();
1279-
builder.CheckHR(thread.SetNextStatement(null, gotoTarget));
12801285
}
12811286
catch (AD7Exception e)
12821287
{
@@ -1321,11 +1326,16 @@ protected override void HandleGotoTargetsRequestAsync(IRequestResponder<GotoTarg
13211326
IDebugDocumentContext2 documentContext;
13221327
if (codeContext.GetDocumentContext(out documentContext) == HRConstants.S_OK)
13231328
{
1324-
var pos = new TEXT_POSITION[1];
1325-
if (documentContext.GetStatementRange(pos, null) == HRConstants.S_OK)
1326-
line = m_pathConverter.ConvertDebuggerLineToClient((int)pos[0].dwLine);
1329+
var startPos = new TEXT_POSITION[1];
1330+
var endPos = new TEXT_POSITION[1];
1331+
if (documentContext.GetStatementRange(startPos, endPos) == HRConstants.S_OK)
1332+
line = m_pathConverter.ConvertDebuggerLineToClient((int)startPos[0].dwLine);
13271333
}
1328-
targets.Add(new GotoTarget(m_gotoCodeContexts.Create(codeContext), contextName, line));
1334+
1335+
int codeContextId = m_nextContextId++;
1336+
m_gotoCodeContexts.TryAdd(codeContextId, codeContext);
1337+
1338+
targets.Add(new GotoTarget(codeContextId, contextName, line));
13291339
}
13301340
}
13311341

0 commit comments

Comments
 (0)