Skip to content

Commit 9696770

Browse files
committed
Fixing todo
1 parent 55ddccd commit 9696770

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
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: 24 additions & 13 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>();
@@ -705,7 +708,8 @@ protected override void HandleInitializeRequestAsync(IRequestResponder<Initializ
705708
SupportsReadMemoryRequest = true,
706709
SupportsGotoTargetsRequest = true,
707710
SupportsModulesRequest = true,
708-
AdditionalModuleColumns = additionalModuleColumns
711+
AdditionalModuleColumns = additionalModuleColumns,
712+
SupportsDisassembleRequest = true
709713
};
710714

711715
responder.SetResponse(initializeResponse);
@@ -1240,15 +1244,17 @@ protected override void HandleGotoRequestAsync(IRequestResponder<GotoArguments>
12401244
var builder = new ErrorBuilder(() => AD7Resources.Error_UnableToSetNextStatement);
12411245
try
12421246
{
1243-
var gotoTarget = m_gotoCodeContexts[responder.Arguments.TargetId];
1244-
IDebugThread2 thread = null;
1245-
lock (m_threads)
1247+
if (m_gotoCodeContexts.TryGetValue(responder.Arguments.TargetId, out IDebugCodeContext2 gotoTarget))
12461248
{
1247-
if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread))
1248-
throw new AD7Exception("Unknown thread id: " + responder.Arguments.ThreadId.ToString(CultureInfo.InvariantCulture));
1249+
IDebugThread2 thread = null;
1250+
lock (m_threads)
1251+
{
1252+
if (!m_threads.TryGetValue(responder.Arguments.ThreadId, out thread))
1253+
throw new AD7Exception("Unknown thread id: " + responder.Arguments.ThreadId.ToString(CultureInfo.InvariantCulture));
1254+
}
1255+
BeforeContinue();
1256+
builder.CheckHR(thread.SetNextStatement(null, gotoTarget));
12491257
}
1250-
BeforeContinue();
1251-
builder.CheckHR(thread.SetNextStatement(null, gotoTarget));
12521258
}
12531259
catch (AD7Exception e)
12541260
{
@@ -1293,11 +1299,16 @@ protected override void HandleGotoTargetsRequestAsync(IRequestResponder<GotoTarg
12931299
IDebugDocumentContext2 documentContext;
12941300
if (codeContext.GetDocumentContext(out documentContext) == HRConstants.S_OK)
12951301
{
1296-
var pos = new TEXT_POSITION[1];
1297-
if (documentContext.GetStatementRange(pos, null) == HRConstants.S_OK)
1298-
line = m_pathConverter.ConvertDebuggerLineToClient((int)pos[0].dwLine);
1302+
var startPos = new TEXT_POSITION[1];
1303+
var endPos = new TEXT_POSITION[1];
1304+
if (documentContext.GetStatementRange(startPos, endPos) == HRConstants.S_OK)
1305+
line = m_pathConverter.ConvertDebuggerLineToClient((int)startPos[0].dwLine);
12991306
}
1300-
targets.Add(new GotoTarget(m_gotoCodeContexts.Create(codeContext), contextName, line));
1307+
1308+
int codeContextId = m_nextContextId++;
1309+
m_gotoCodeContexts.TryAdd(codeContextId, codeContext);
1310+
1311+
targets.Add(new GotoTarget(codeContextId, contextName, line));
13011312
}
13021313
}
13031314

0 commit comments

Comments
 (0)