Player APIs (BrightScript & Ja...
...
BrightScript
Language Reference

BrightScript Debug Console

8min
the brightscript language, which is interpreted and not compiled, has two available clis the brightsign shell which allows you to start scripts and some other device management tasks (see brightsign shell docid\ fxxyu9jmocutc6xe2p7l2 for more information) the brightscript debugger which is used to examine and manipulate a running brightscript process this page describes how to access these clis and the brightscript debugger tool set connecting to the brightscript interpreter to access both of these interfaces, you need to associate a terminal session from your local machine with the input and output of the brightscript interpreter process in a standard operating environment, the only interaction possible with the brightscript interpreter is monitoring it’s output, since it will not accept input including interrupts to interact with either cli, you must first set script debug on , which can be done in multiple ways for example, in the dws registry tab, enter registry write brightscript debug 1 (which is equivalent to the brightsign shell command script debug on ) when a physical connection to the player is available, these interfaces can be accessed via the primary serial port by using a terminal program and a null modem cable (more details on brightsign shell docid\ fxxyu9jmocutc6xe2p7l2 ) the brightsign shell and debugger interfaces can also be routed over telnet & ssh docid\ l0l gyihavtdbci9ffcqh accessing the debugger if you haven’t turned on script debug, any interruption to the brightscript interpreter execution will not give access to the debugger but will instead reboot the player to attempt a clean execution automatic access if, while a script is running, a runtime error occurs or a stop statement is encountered, the brightsign application will enter the brightscript debug console access at bootup you can also access the debug console at bootup power off the device power on the device and wait between 5 and 15 seconds press and hold the svc button on the side of the player if you are using telnet, you will need to restart telnet by running telnet {{your player ip address}} 23 on the command line wait until the brightsign> prompt appears in the serial/telnet/ssh terminal (which indicates that you are in the brightsign shell docid\ fxxyu9jmocutc6xe2p7l2 ) you can now release the svc button enter script at the prompt while in the brightsign shell this will take you to the brightscript debug console access if the player doesn’t have an autorun brs the brightsign os does not register the svc button event if there is no autorun brs on the storage device if this is the case, one of the following methods can be used to access the brightsign prompt or brightscript debugger if the serial console has been enabled (either temporarily or persistently), a starting brightsign application message will appear after the player reboots (which can take up to 30 seconds) press and hold the svc button until the brightsign prompt displays put an autorun brs that only contains end on the storage device a single line of end is sufficient the script will execute and when it ends as instructed you’ll be left at the brightsign shell prompt if you have removable storage such as a microsd card, eject it reboot the player and press the svc button if you are accessing the player through telnet, you will have to restart the telnet connection after the player reboots using the telnet {{your player ip address}} 23 command brightscript console the brightscript console should only be used in development environments when writing software or debugging your player’s application software it should be disabled for production deployments when the brightscript debug console is enabled, if a runtime error is encountered from a brightscript script, the brightsign os breaks on the line of the runtime error, allowing you to step through the file console scope the console scope is set to the function that was running when the brightscript debugger is invoked, either by choice or automatically while in the console, you can type in any brightscript statement; it will then be compiled and executed in the current context if the interpreter has exited the running script, you can instead use the brightsign shell command set commands the following console commands are currently available in the brightscript debug console command description bt print a backtrace of call function context frames classes list all public classes cont or c continue script execution counts list count of brightscript component instances da show disassembly and bytecode for this function down or d move one position down the function context chain exit exit the debug shell gc run the garbage collector and show collection statistics hash print the internal hash table histograms last show the last line that executed methods \<class> list methods provided by specified class methods \<class> \<interface> list methods provided by the specified interface or class list list the current source of the current function ld show line data (source records) next show the next line to execute bsc list all allocated brightscript component instances stats show statistics step or s step one program statement t step one statement and show each executed opcode up or u move one function up the context chain var display local variables and their types/values print or p or ? print variable value or expression brightscript print messages are routed to the brightsign application console, which is accessible via the primary serial port or telnet/ssh, as noted above