@@ -19,6 +19,7 @@ import {DebugClient, DebugType} from "./DebugClients/DebugClient";
1919import { CreateAttachDebugClient , CreateLaunchDebugClient } from "./DebugClients/DebugFactory" ;
2020import { DjangoApp , LaunchRequestArguments , AttachRequestArguments , DebugFlags , DebugOptions , TelemetryEvent } from "./Common/Contracts" ;
2121import * as telemetryContracts from "../common/telemetryContracts" ;
22+ import { validatePath } from './Common/Utils' ;
2223
2324const CHILD_ENUMEARATION_TIMEOUT = 5000 ;
2425
@@ -380,21 +381,27 @@ export class PythonDebugger extends DebugSession {
380381 let maxFrames = typeof args . levels === "number" && args . levels > 0 ? args . levels : pyThread . Frames . length - 1 ;
381382 maxFrames = maxFrames < pyThread . Frames . length ? maxFrames : pyThread . Frames . length ;
382383
383- let frames = [ ] ;
384- for ( let counter = 0 ; counter < maxFrames ; counter ++ ) {
385- let frame = pyThread . Frames [ counter ] ;
386- let frameId = this . _pythonStackFrames . create ( frame ) ;
387- frames . push ( new StackFrame ( frameId , frame . FunctionName ,
388- new Source ( path . basename ( frame . FileName ) , this . convertDebuggerPathToClient ( frame . FileName ) ) ,
389- this . convertDebuggerLineToClient ( frame . LineNo - 1 ) ,
390- 0 ) ) ;
391- }
392-
393- response . body = {
394- stackFrames : frames
395- } ;
384+ let frames = pyThread . Frames . map ( frame => {
385+ return validatePath ( this . convertDebuggerPathToClient ( frame . FileName ) ) . then ( fileName => {
386+ let frameId = this . _pythonStackFrames . create ( frame ) ;
387+ if ( fileName . length === 0 ) {
388+ return new StackFrame ( frameId , frame . FunctionName ) ;
389+ }
390+ else {
391+ return new StackFrame ( frameId , frame . FunctionName ,
392+ new Source ( path . basename ( frame . FileName ) , fileName ) ,
393+ this . convertDebuggerLineToClient ( frame . LineNo - 1 ) ,
394+ 0 ) ;
395+ }
396+ } ) ;
397+ } ) ;
398+ Promise . all < StackFrame > ( frames ) . then ( resolvedFrames => {
399+ response . body = {
400+ stackFrames : resolvedFrames
401+ } ;
396402
397- this . sendResponse ( response ) ;
403+ this . sendResponse ( response ) ;
404+ } ) ;
398405 } ) ;
399406 }
400407 protected stepInRequest ( response : DebugProtocol . StepInResponse ) : void {
0 commit comments