@@ -31,6 +31,10 @@ def _debug_print(self, message):
31
31
"""Print debug message only if debug logging is enabled."""
32
32
if self .debug_logging :
33
33
print (message )
34
+
35
+ @property
36
+ def _baremetal (self ) -> bool :
37
+ return sys .platform not in ("linux" ) # to be expanded
34
38
35
39
def start (self ):
36
40
"""Start the debug session message loop."""
@@ -369,15 +373,23 @@ def _handle_source(self, seq, args):
369
373
"""Handle source request."""
370
374
source = args .get ("source" , {})
371
375
source_path = source .get ("path" , "" )
372
-
376
+ if self ._baremetal or not source_path :
377
+ # BUGBUG: unable to read the source on ESP32
378
+ # Possible an effect of the import / inialization sequence ?
379
+ # Nothe that other source files ( other.py) do not seem to get requested in the same way
380
+ self .channel .send_response (CMD_SOURCE , seq , success = False )
381
+ return
382
+ self ._debug_print (f"[DAP] Processing source request for path: { source } " )
373
383
try :
374
384
# Try to read the source file
375
- with open (source_path , 'r' ) as f :
385
+ with open (source_path ) as f :
376
386
content = f .read ()
377
387
self .channel .send_response (CMD_SOURCE , seq , body = {"content" : content })
378
388
except Exception as e :
379
389
self .channel .send_response (CMD_SOURCE , seq , success = False ,
380
- message = f"Could not read source: { e } " )
390
+ message = "cancelled"
391
+ # message=f"Could not read source: {e}"
392
+ )
381
393
382
394
def _trace_function (self , frame , event , arg ):
383
395
"""Trace function called by sys.settrace."""
0 commit comments