You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I want to use following .cjs file as advanced decoder in the rttConfig > decoders I always get following error: "Error Initializing Advanced Decoder: Error: Unable to load decoder class from: mypath"
But if I have an issue in the file like a super() call in the constructor without a parent class I get an error but if everything is fixed it just shows the generic error.
To Reproduce
Steps to reproduce the behavior:
Set following decoder.cjs as decoder
Expected behavior
It gets loaded.
Environment (please complete the following information):
Cortex-Debug Version (this extension) current version
const{ spawn }=require('child_process');classDefmtDecoder{constructor(){this.process=null;this.elfPath=null;this.displayOutput=null;this.graphData=null;this.ports=[];}init(config,displayOutput,graphData){// Store the callbacks and elfPath from the configthis.elfPath=config.elfPath;this.displayOutput=displayOutput;this.graphData=graphData;this.ports=config.ports;constdefmtPrintPath=`${process.platform==="win32" ? process.env.USERPROFILE : process.env.HOME}/.cargo/bin/defmt-print${process.platform==="win32" ? ".exe" : ""}`;// Spawn the defmt-print process with the provided ELF paththis.process=spawn(defmtPrintPath,['-e',this.elfPath,"stdin"]);// Handle data from defmt-print stdout and relay it to the displayOutput callbackthis.process.stdout.on('data',(data)=>{if(this.displayOutput){this.displayOutput(data.toString());}});// Handle errors from defmt-print stderrthis.process.stderr.on('data',(data)=>{if(this.displayOutput){this.displayOutput(data.toString());}});// Handle when the process closesthis.process.on('close',(code)=>{if(this.displayOutput){this.displayOutput(`Decoding process exited with code: ${code}`);}});}sendData(input){// Write input data to defmt-print's stdintry{if(this.process&&this.process.stdin.writable){this.process.stdin.write(input);return;}}catch{}thrownewError('Process stdin is not writable.');}// Expected methods from the SWODecoder API conforming to the AdvancedDecoder interfacetypeName(){return'DefmtDecoder';}outputLabel(){return'RPi Pico';}softwareEvent(port,data){if(this.ports.indexOf(port)!==-1){// Handle the software event, potentially by sending data to defmt-print stdinthis.sendData(data);}}synchronized(){// Handle the synchronized eventif(this.displayOutput){this.displayOutput('Synchronized');}}lostSynchronization(){// Handle the lost synchronization eventif(this.displayOutput){this.displayOutput('Lost synchronization');}}dispose(){// Clean up the processif(this.process){this.process.kill();this.process=null;}}}module.exports=exports=DefmtDecoder;
The text was updated successfully, but these errors were encountered:
Describe the bug
If I want to use following .cjs file as advanced decoder in the rttConfig > decoders I always get following error: "Error Initializing Advanced Decoder: Error: Unable to load decoder class from: mypath"
But if I have an issue in the file like a
super()
call in the constructor without a parent class I get an error but if everything is fixed it just shows the generic error.To Reproduce
Steps to reproduce the behavior:
Expected behavior
It gets loaded.
Environment (please complete the following information):
Please include
launch.json
Note: We are unlikely to look at the issue if you do not supply this
Additional context
The text was updated successfully, but these errors were encountered: