Forum Discussion

jbrave's avatar
jbrave
Channel Surfer
15 years ago

loss of contextual data in functions on STOP or BREAK

I've been encountering this in various circumstances when trying to debug various functions. When the function encounters a STOP command or is interrupted with ctrl-c, most of the variables are invalid or uninitialized. This most often seems to occur in functions that have roURLTransfers in them (which is really a pain as these are the ones I most need data from), especially functions containing asynchronous transfers.

Has anyone else seen this?

- Joel

6 Replies

  • destruk's avatar
    destruk
    Streaming Star
    I'm sure it's a valid issue. What you could do is enable logging with telnet
    telnet -f c:\log.txt 192.168.1.xxx 8085

    Then you could use prints throughout the execution of your app for debugging and log all the prints of all the variables you are wanting to track in realtime.
  • BrightScript is function scoped, so within a function all variables besides ones assigned inside or passed in would be invalid. If you referring to variables you are assigning in the function itself, I would think they should have a value, but maybe it's an out-of-order execution of operations thing (language optimization).

    You can use "up" to move the debugger context p the function chain if you want to see the state of other portions of your code.
  • renojim's avatar
    renojim
    Community Streaming Expert
    My big problem with pressing Ctrl-C to interrupt execution is that it more often than not exits to the main menu and I can't do anything. I don't know if stop produces the same behavior, but it's annoying that Ctrl-C does.

    -JT
  • "renojim" wrote:
    My big problem with pressing Ctrl-C to interrupt execution is that it more often than not exits to the main menu and I can't do anything. I don't know if stop produces the same behavior, but it's annoying that Ctrl-C does.

    -JT

    I have that problem using PuTTY, but not with Windows telnet, so that could be some obscure setting in your telnet client.
  • jbrave's avatar
    jbrave
    Channel Surfer
    The issue is within the context of a function, and the up / down thing does not always work. I sometimes even get a "no source" prompt from the debugger, like it loses even the little bit of information it has in its tiny brain at this point. The one thing that does work though is the "last" command.

    "destruk" wrote:
    I'm sure it's a valid issue. What you could do is enable logging with telnet
    telnet -f c:\log.txt 192.168.1.xxx 8085

    Then you could use prints throughout the execution of your app for debugging and log all the prints of all the variables you are wanting to track in realtime.


    Yeah, this is a good idea. Hey, didn't the Roku folks promise us an upgrade to the debugger for Christmas last year?

    viewtopic.php?f=34&t=32853&p=207252&hilit=debugger#p206861
  • renojim's avatar
    renojim
    Community Streaming Expert
    "TheEndless" wrote:
    I have that problem using PuTTY, but not with Windows telnet, so that could be some obscure setting in your telnet client.

    Thanks! I'm using PuTTY. I'll have to try something different. Did you find a way to get PuTTY to work?

    Edit: I just tried Windows telnet - same thing. 😞
    Edit #2: Windows telnet seemed to work most of the time, but not every time. I turned off the "Return key sends Telnet New Line instead of ^M" setting in PuTTY under Connection-Telnet and PuTTY seems to work much better, but still not every time.

    -JT