This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

getStdErr() to get stderr-stream from C-printf to javascript [ Debug Server Scripting ]



public java.lang.String getStdErr() 

Because this API is not further explained I have this question:

Can I use debugSession.getStdErr() to pass the stderr stream from my C code to the javascript calling the DSS APIs?

I would like to have a simple feedback from C to the javascript to know if a test is passed or failed.

I use this:  fprintf(stderr,"error");

But getStdErr() always returns an empty string.

Kind regards!

  • Simon,

    From some quick debugging, this behaviour might be caused by the debugger/codegen handling the fprintf(stderr,"error") line as standard out instead of standard error.

    At least on the target I was testing on, after the fprintf line, I can print the last letter in the string using getStdOut() instead of getStdErr(); I think I only got one letter because the stream is only passing one character at a time in this case.

    I will need to debug further before I can provide more information.

    Thanks,

    Ricky

  • Hello Ricky,

    thanks for the information in your post. Is there any new development on this issue? It would help us a lot to enable automatic source-code testing.

    Thanks,

    Dennis

  • Dennis,

    Unfortunately, there hasn't been any updates on this issue yet. But thank you for bringing this topic up again; I'll definitely try to provide updates on this topic when it is available.

    Thanks,

    Ricky

  • Dennis,

    Sorry for the long delay, but I have some new information on this issue for you.

    The reason why the standard error output was returning in debugSession.getStdOut() instead of debugSession.getStdErr() was because of a bug in the code. The fix for this will be in the next CCS release.

    That being said, the other observation I noted in my previous reply concerning how codegen is returning one character at a time in error strings is still true. This will imply that the getStdErr() API will always just return the last character in the error string. As you noted earlier, these APIs are not documented well, and therefore, I'm really not sure if this expected behaviour or not.

    I am thinking that maybe the correct thing to do is to add a new API where it stores buffered standard error strings. But there needs to be a way to specify the max buffer length, escape characters, etc. to determine if we want to continue buffering or start a new buffer; this will prevent it from continuously buffering the error output. Please let me know if this type of API sounds useful to you or not, so I can evaluate this proposal going forward.

    Thanks,
    Ricky