Skip to content

Commit 00a373d

Browse files
Перенос создание PathsMapper в Attach, проверки на null
1 parent fc7e717 commit 00a373d

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/VSCode.DebugAdapter/DebugeeProcess.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ public Breakpoint[] SetBreakpoints(IEnumerable<Breakpoint> breakpoints)
290290
{
291291
var breakpointsArray = breakpoints.ToArray();
292292

293-
for (int i = 0; i < breakpointsArray.Length; i++)
294-
{
295-
breakpointsArray[i].Source = PathsMapper.LocalToRemote(breakpointsArray[i].Source);
293+
if (PathsMapper != null) {
294+
for (int i = 0; i < breakpointsArray.Length; i++)
295+
{
296+
breakpointsArray[i].Source = PathsMapper.LocalToRemote(breakpointsArray[i].Source);
297+
}
296298
}
297299

298300
var confirmedBreaks = _debugger.SetMachineBreakpoints(breakpointsArray);
@@ -308,6 +310,7 @@ public void BeginExecution(int threadId)
308310
public StackFrame[] GetStackTrace(int threadId, int firstFrameIdx, int limit)
309311
{
310312
var allFrames = _debugger.GetStackFrames(threadId);
313+
var pathsMapperInit = PathsMapper != null;
311314

312315
if (limit == 0)
313316
limit = allFrames.Length;
@@ -318,8 +321,13 @@ public StackFrame[] GetStackTrace(int threadId, int firstFrameIdx, int limit)
318321
var result = new List<StackFrame>();
319322
for (int i = firstFrameIdx; i < limit && i < allFrames.Length; i++)
320323
{
324+
321325
allFrames[i].ThreadId = threadId;
322-
allFrames[i].Source = PathsMapper.RemoteToLocal(allFrames[i].Source);
326+
327+
if (pathsMapperInit) {
328+
allFrames[i].Source = PathsMapper.RemoteToLocal(allFrames[i].Source);
329+
}
330+
323331
result.Add(allFrames[i]);
324332
}
325333

src/VSCode.DebugAdapter/OscriptDebugSession.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public override void Initialize(Response response, dynamic args)
3535
LogCommandReceived();
3636
AdapterID = (string) args.adapterID;
3737

38-
_debuggee = DebugeeFactory.CreateProcess(AdapterID, PathStrategy);
39-
_debuggee.InitPathsMapper(args);
38+
_debuggee = DebugeeFactory.CreateProcess(AdapterID, PathStrategy);
4039

4140
SendResponse(response, new Capabilities
4241
{
@@ -140,6 +139,7 @@ public override void Attach(Response response, dynamic arguments)
140139
SubscribeForDebuggeeProcessEvents();
141140

142141
_debuggee.DebugPort = GetFromContainer(arguments, "debugPort", 2801);
142+
_debuggee.InitPathsMapper(arguments);
143143

144144
DebugClientFactory debugClientFactory;
145145
try

0 commit comments

Comments
 (0)